展厅登记支持在线填写值班人并记录编辑日志
This commit is contained in:
Vendored
+15
-1
@@ -1568,7 +1568,10 @@
|
||||
$('#center-hall-link').href = hall.link;
|
||||
$('#center-hall-link').classList.toggle('hidden', !hall.link);
|
||||
$('#center-hall-status').textContent = hall.ok ? `共 ${hall.count} 条登记,更新于 ${fmtDate(hall.fetched_at)}(60 秒缓存)` : `读取失败:${hall.error}`;
|
||||
$('#center-hall-list').innerHTML = hall.records.map(r => `<div class="acard"><b>${esc(r['使用事项'] || '未填写使用事项')}</b> <span class="tag joined">${esc(r['使用场地'] || '')}</span><p class="muted">${esc(r['日期'] || '')} ${esc(r['时间'] || '')} · ${esc(r['使用单位'] || '')}</p><p>参加人数:${esc(r['参加人数'] || '—')};赋能部值班:${esc(r['赋能部值班人员及联系方式'] || '—')}</p>${r['备注'] ? `<p class="muted">备注:${esc(r['备注'])}</p>` : ''}${r['使用单位联系人及联系方式'] ? `<p class="muted">联系人:${esc(r['使用单位联系人及联系方式'])}</p>` : ''}</div>`).join('') || '<div class="empty">登记表暂无数据。</div>';
|
||||
$('#center-hall-list').innerHTML = hall.records.filter(r => Object.keys(r).some(k => k !== '_row' && r[k])).map(r => {
|
||||
const duty = r['赋能部值班人员及联系方式'] || '';
|
||||
return `<div class="acard" data-hall-row="${r._row}"><b>${esc(r['使用事项'] || '未填写使用事项')}</b> <span class="tag joined">${esc(r['使用场地'] || '')}</span><p class="muted">${esc(r['日期'] || '')} ${esc(r['时间'] || '')} · ${esc(r['使用单位'] || '')}</p><p>参加人数:${esc(r['参加人数'] || '—')}</p><p>值班人:<span class="hall-duty-value">${esc(duty || '—')}</span> <button type="button" class="btn small" data-hall-edit="${r._row}">${duty ? '修改' : '填写'}</button></p>${r['备注'] ? `<p class="muted">备注:${esc(r['备注'])}</p>` : ''}${r['使用单位联系人及联系方式'] ? `<p class="muted">联系人:${esc(r['使用单位联系人及联系方式'])}</p>` : ''}</div>`;
|
||||
}).join('') || '<div class="empty">登记表暂无数据。</div>';
|
||||
} else {
|
||||
const data = await api(`/center/items?q=${encodeURIComponent($('#center-item-q').value)}`);
|
||||
$('#center-check-status').textContent = `${data.day} · ${data.checked_today ? '今日清点已完成' : '今日待清点,请逐项核对实际在库数量'}`;
|
||||
@@ -1601,6 +1604,17 @@
|
||||
$('#center-hall-refresh').addEventListener('click', async () => {
|
||||
try { await api('/center/hall-log?refresh=true'); } finally { await loadCenter(); }
|
||||
});
|
||||
$('#center-hall-list').addEventListener('click', event => {
|
||||
const button = event.target.closest('[data-hall-edit]');
|
||||
if (!button) return;
|
||||
const row = Number(button.dataset.hallEdit);
|
||||
const card = button.closest('[data-hall-row]');
|
||||
const current = card?.querySelector('.hall-duty-value')?.textContent.trim();
|
||||
centerForm('填写值班人',
|
||||
`<p class="muted">填写后同步写入金山文档登记表,服务器会记录编辑人和修改内容。留空提交即清空该格。</p>
|
||||
<label>值班人及联系方式<input name="duty" maxlength="200" value="${esc(current && current !== '—' ? current : '')}" placeholder="例如:张三 13800000000" /></label>`,
|
||||
async f => { await api('/center/hall-log/duty', { method: 'POST', body: { row, value: f.duty.value.trim() } }); toast('已保存并同步到金山文档'); });
|
||||
});
|
||||
function openLoanForm() {
|
||||
centerForm('登记借出',
|
||||
`<p class="muted">这里只保存借出记录,不占用库存,也不要求物品已加入库存清单。借出理由全员可见,联系方式仅本人可见。</p>
|
||||
|
||||
Reference in New Issue
Block a user