diff --git a/docs/features/training/annual-training-plan-prototype.html b/docs/features/training/annual-training-plan-prototype.html index b9308fb9..330b2861 100644 --- a/docs/features/training/annual-training-plan-prototype.html +++ b/docs/features/training/annual-training-plan-prototype.html @@ -27,9 +27,11 @@ .badge { display:inline-flex; padding:2px 8px; border-radius:99px; font-size:11px; font-weight:800; } .green { color:var(--green); background:#eafaf1; } .amber { color:var(--amber); background:#fff7e6; } .red { color:var(--red); background:#fff0ef; } .blue { color:#175cd3; background:var(--soft); } .gray { color:#475569; background:#edf1f6; } .link { border:0; padding:0; color:#175cd3; background:transparent; font-size:12px; font-weight:800; } .names { color:#334155; } .note { color:var(--muted); } .ops { display:flex; gap:10px; white-space:nowrap; } .chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; } .chip { padding:4px 8px; border-radius:99px; background:#f1f5f9; font-size:12px; } .mask { position:fixed; inset:0; display:none; background:rgba(15,23,42,.35); } .mask.show { display:block; } - .drawer { position:fixed; top:0; right:0; width:min(460px,100%); height:100%; display:flex; flex-direction:column; background:#fff; box-shadow:-12px 0 40px rgba(15,23,42,.12); transform:translateX(100%); transition:.2s; } .mask.show .drawer { transform:none; } - .drawer header,.drawer footer { padding:16px 18px; border-bottom:1px solid var(--line); } .drawer footer { border-bottom:0; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:8px; } .drawer h2 { margin:0; font-size:16px; } .drawer .body { padding:16px 18px 24px; overflow:auto; } .field { margin-bottom:12px; } .field textarea { min-height:64px; resize:vertical; } .readonly { padding:8px; border-radius:8px; color:#334155; background:#f8fafc; } - .people { max-height:220px; overflow:auto; border:1px solid var(--line); border-radius:8px; } .person { display:flex; gap:8px; align-items:center; padding:8px 10px; border-bottom:1px solid var(--line); } .person:last-child { border-bottom:0; } .person small { color:var(--muted); } + .drawer { position:fixed; top:0; right:0; width:min(460px,100%); height:100%; display:flex; flex-direction:column; background:#fff; box-shadow:-12px 0 40px rgba(15,23,42,.12); transform:translateX(100%); transition:.2s; } .drawer.monthly { width:min(560px,100%); } .mask.show .drawer { transform:none; } + .drawer header,.drawer footer { padding:16px 18px; border-bottom:1px solid var(--line); } .drawer footer { border-bottom:0; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:8px; } .drawer h2 { margin:0; font-size:16px; } .drawer .body { padding:16px 18px 24px; overflow:auto; } .field { margin-bottom:12px; } .field input,.field select { width:100%; height:36px; } .field textarea { min-height:64px; resize:vertical; } .readonly { display:flex; align-items:center; min-height:36px; padding:8px 10px; border:1px solid #e7edf5; border-radius:8px; color:#334155; background:#f8fafc; } + .sheet { display:flex; flex-direction:column; gap:16px; } .block { padding:12px; border:1px solid var(--line); border-radius:12px; background:#fbfcfe; } .block h3 { margin:0 0 10px; font-size:13px; } .sheet .field { margin:0; } .pair { display:grid; grid-template-columns:1fr 1fr; gap:10px 12px; } .pair .full { grid-column:1 / -1; } .triple { display:grid; grid-template-columns:1.2fr .8fr .8fr; gap:10px; } + .file-add { display:grid; grid-template-columns:1fr 72px; gap:8px; margin-top:8px; } .chip .x { margin-left:6px; border:0; padding:0; color:#64748b; background:transparent; font-weight:700; } + .people { max-height:220px; overflow:auto; border:1px solid var(--line); border-radius:8px; } .person { display:flex; gap:8px; align-items:center; padding:8px 10px; border-bottom:1px solid var(--line); } .person:last-child { border-bottom:0; } .person small { margin-left:auto; color:var(--muted); } .hint { margin:0 0 8px; color:var(--muted); font-size:12px; } .two { display:grid; grid-template-columns:1fr 360px; gap:14px; } .phone { width:100%; padding:16px; border-radius:24px; color:#fff; background:#172033; } .phone small { display:block; color:#aab9cc; text-align:center; } .notice { margin-top:12px; overflow:hidden; border-radius:12px; color:var(--ink); background:#fff; } .notice h3 { margin:0; padding:14px 14px 6px; font-size:15px; } .notice p { margin:0; padding:0 14px 14px; white-space:pre-line; color:#3d4b61; font-size:13px; } .notice button { width:100%; padding:11px; border:0; border-top:1px solid var(--line); color:var(--brand); background:#fff; font-weight:800; } .kv { display:grid; grid-template-columns:88px 1fr; gap:8px; padding:8px 0; border-bottom:1px solid var(--line); font-size:13px; } .kv b { color:var(--muted); font-weight:700; } @@ -462,8 +464,8 @@ }).join('') || '这个范围还没有月度计划。'; } - function openMask() { $('mask').classList.add('show'); } - function closeMask() { $('mask').classList.remove('show'); drawerMode = ''; } + function openMask(monthly) { document.querySelector('.drawer').classList.toggle('monthly', Boolean(monthly)); $('mask').classList.add('show'); } + function closeMask() { $('mask').classList.remove('show'); document.querySelector('.drawer').classList.remove('monthly'); drawerMode = ''; } /** * 打开计划行抽屉。分类从课程带出且只读,人员默认不勾选。 @@ -501,7 +503,7 @@ } /** - * 打开月度计划抽屉。从年度转入时带出课程、地点、内/外和参加人员。 + * 打开月度计划抽屉。日期和时间分开填写,避免系统日期控件挤在一列里。从年度转入时带出课程、地点和参加人员。 * @param {object|null} record 已有月度计划,为空则新建 * @param {object|null} annual 来源年度计划行 */ @@ -521,8 +523,21 @@ const courseOptions = courses.filter((item) => item[4] === 'enabled' || item[0] === courseName).map((item) => '' + item[0] + '').join(''); const annualOptions = '' + visiblePlans().map((item) => '').join(''); const unitName = record ? record.unit : (source ? source.unit : (scopeUnit() || '财务部')); - $('drawerBody').innerHTML = '
' + (source ? '
' + courseName + '
' : '') + '
' + unitName + '

默认带出年度计划已选人员,可按这一场增删。

' + people.map((item) => '').join('') + '
'; - const paintFiles = () => { $('m-files').innerHTML = draftFiles.map((name) => '' + name + '').join('') || '还没有资料'; }; + const classDate = record && record.start ? record.start.slice(0, 10) : ''; + const startTime = record && record.start ? record.start.slice(11, 16) : '09:00'; + const endTime = record && record.end ? record.end.slice(11, 16) : '10:00'; + const courseField = source + ? '
' + courseName + '
' + : ''; + $('drawerBody').innerHTML = '

课程

' + courseField + '
' + unitName + '

上课时间

日期用 2026-04-09,时间用 09:00。填完开始和结束会自动算时长,仍可手改。

课件 / 视频

参加人员

默认带出年度计划已选人员,可按这一场增删。

' + people.map((item) => '').join('') + '
'; + const paintFiles = () => { $('m-files').innerHTML = draftFiles.length ? draftFiles.map((name, index) => '' + name + '').join('') : '还没有资料'; }; + const syncHours = () => { + const start = ($('m-start-time').value || '').split(':'); + const end = ($('m-end-time').value || '').split(':'); + if (start.length < 2 || end.length < 2) return; + const minutes = (Number(end[0]) * 60 + Number(end[1])) - (Number(start[0]) * 60 + Number(start[1])); + if (minutes > 0) $('m-hours').value = String(Math.round(minutes / 6) / 10); + }; const applySource = () => { const no = Number($('m-source').value); const plan = plans.find((item) => item.no === no); @@ -539,6 +554,14 @@ $('m-file').value = ''; paintFiles(); }); + $('m-files').addEventListener('click', (event) => { + const button = event.target.closest('[data-file]'); + if (!button) return; + draftFiles.splice(Number(button.dataset.file), 1); + paintFiles(); + }); + $('m-start-time').addEventListener('change', syncHours); + $('m-end-time').addEventListener('change', syncHours); if (!record) $('m-source').addEventListener('change', () => { const no = Number($('m-source').value); if (!no) { @@ -557,7 +580,7 @@ } }); paintFiles(); - openMask(); + openMask(true); } /** @@ -567,17 +590,20 @@ if (drawerMode === 'monthly') { const ids = [...document.querySelectorAll('#m-people input:checked')].map((item) => item.value); if (!ids.length) { toast('请至少选择 1 名参加人员'); return; } - if (!$('m-start').value || !$('m-end').value) { toast('请填写开始和结束时间'); return; } + const classDate = $('m-date').value.trim(); + const startTime = $('m-start-time').value.trim(); + const endTime = $('m-end-time').value.trim(); + if (!/^\d{4}-\d{2}-\d{2}$/.test(classDate) || !/^\d{2}:\d{2}$/.test(startTime) || !/^\d{2}:\d{2}$/.test(endTime)) { toast('日期填 2026-04-09,时间填 09:00'); return; } const annualNo = Number($('m-source').value || 0); const annual = plans.find((item) => item.no === annualNo); if (annual && scheduledCount(annual.no) >= annual.times && editingMonthly === 0) { toast('次数已排满'); return; } const courseEl = $('m-course'); const payload = { - annualNo, month:$('m-month').value, unit:$('m-unit').textContent, + annualNo, month: classDate.slice(0, 7), unit:$('m-unit').textContent, plant: annual ? annual.plant : '1厂', course: courseEl.tagName === 'DIV' ? courseEl.textContent : courseEl.value, place:$('m-place').value.trim() || '教育训练室', side: annual ? annual.side : '内', - start:$('m-start').value, end:$('m-end').value, hours:$('m-hours').value || '1', + start: classDate + 'T' + startTime, end: classDate + 'T' + endTime, hours:$('m-hours').value || '1', instructor:$('m-instructor').value, files:draftFiles.slice(), ids, status:'scheduled' }; if (editingMonthly) Object.assign(monthlies.find((item) => item.id === editingMonthly), payload);