diff --git a/YiJi-admin/src/components/Yewu/YuYue202506.vue b/YiJi-admin/src/components/Yewu/YuYue202506.vue index 8a508ca..4a021d1 100644 --- a/YiJi-admin/src/components/Yewu/YuYue202506.vue +++ b/YiJi-admin/src/components/Yewu/YuYue202506.vue @@ -330,6 +330,14 @@ const dates = new Set(dated.map(v => v.reservation_date)) return dates.size > 1 }); + let debounceTimer = null + const debouncedGetPlan = () => { + if (debounceTimer) clearTimeout(debounceTimer) + debounceTimer = setTimeout(() => { + GetEnablePlanFunc() + debounceTimer = null + }, 500) + } const handleSelectionChange = (selection) => { selectedMianListId.value = [] selectedEntrustId.value = [] @@ -395,7 +403,7 @@ GetEnablePlanFunc(); } } else { - GetEnablePlanFunc(); + debouncedGetPlan() } } // 检查缓存中是否有跨时段 dialog 需要弹出 @@ -519,6 +527,22 @@ break } } + // 全部已预约时,兜底勾选 + if (selectedMianListId.value.length === 0) { + const firstNormal = entrustTableDate.value.find(v => v.tishi_msg === '') + if (firstNormal) { + isHandlingSelection.value = false + if (skipRestore && tempSelected.length > 0) { + tempSelected.forEach(id => { + const row = entrustTableDate.value.find(v => v.id === id) + if (row) entrustTableRef.value.toggleRowSelection(row, true) + }) + } else { + entrustTableRef.value.toggleRowSelection(firstNormal, true) + } + isHandlingSelection.value = true + } + } } if(onMountedStatus.value){//如果是第一次进入,弹窗提示异常项目的状态 @@ -1492,12 +1516,20 @@ if (selectedRows.value.length > 0) { const firstDept = selectedRows.value[0].department_resources?.department_resources_name if (firstDept) activeZhenShi.value = firstDept + } + const hasUnbooked = selectedRows.value.some(v => v.list_status === 0) + if (!hasUnbooked) { GetEnablePlanFunc() } - }, true) if (auto_print.value.length > 0) { - print_shenqingdan() + const bookedIds = selectedRows.value + .filter(v => v.list_status === 1) + .map(v => v.entrust_id) + if (bookedIds.length > 0) { + print_shenqingdan(bookedIds) + } } + }, true) } else { ElMessageBox.confirm( res.msg, @@ -1624,16 +1656,19 @@ const firstDept = selectedRows.value[0].department_resources?.department_resources_name if (firstDept) activeZhenShi.value = firstDept } - GetEnablePlanFunc() + const hasUnbooked = selectedRows.value.some(v => v.list_status === 0) + if (!hasUnbooked) { + GetEnablePlanFunc() + } + if (auto_print.value.length > 0) { + print_shenqingdan(successEntrustIds) + } }, true) systemConfigs.value.forEach((v, i) => { if (v.label == '开启申请单pdf' && v.value === "1") { // CreateJianChaShenQingDanPdfFunc(successEntrustIds) } }) - if (auto_print.value.length > 0) { - print_shenqingdan(successEntrustIds) - } } } //取消预约(此界面取消预约,不验证密码) @@ -1777,7 +1812,7 @@ return } const params = ids.map(id => 'OrderNoList[]=' + id).join('&') - const url = import.meta.env.VITE_APP_API + 'GetCheckPdf?Dev=1&Type=single&' + params + const url = import.meta.env.VITE_APP_API + 'GetCheckPdf?Dev=1&Type=group&' + params fetch(url) .then(res => res.blob()) .then(blob => { @@ -1869,7 +1904,12 @@ onMountedStatus.value=true; GetConfigInfoFunc() date_list.value = getDatesAfter() - GetMainInfo() + GetMainInfo(() => { + const hasUnbooked = selectedRows.value.some(v => v.list_status === 0) + if (!hasUnbooked) { + GetEnablePlanFunc() + } + }) }) diff --git a/YiJi-admin/src/views/YeWu/MainList.vue b/YiJi-admin/src/views/YeWu/MainList.vue index f711b3b..54f2c87 100644 --- a/YiJi-admin/src/views/YeWu/MainList.vue +++ b/YiJi-admin/src/views/YeWu/MainList.vue @@ -95,6 +95,7 @@ 报到 取消报到 打印申请单 + 批量打印申请单 打印表格 @@ -238,6 +239,72 @@ {{item}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -701,6 +768,48 @@ document.body.appendChild(iframe) }) } + // 批量打印申请单 + let batchPrintDialogVisible = ref(false) + let batchPrintSelected = ref([]) + let batchPrintTableRef = ref(null) + + const batchPrint = () => { + const printable = tableData.value.filter(v => v.list_status === 1) + if (printable.length === 0) { + ElMessage.info('当前列表中没有可打印的已预约项目') + return + } + batchPrintDialogVisible.value = true + } + + const handleBatchSelectionChange = (selection) => { + batchPrintSelected.value = selection + } + + const confirmBatchPrint = () => { + if (batchPrintSelected.value.length === 0) { + ElMessage.error('请选择至少1项进行打印') + return + } + const params = batchPrintSelected.value + .map(v => 'OrderNoList[]=' + v.entrust_id) + .join('&') + const url = import.meta.env.VITE_APP_API + 'GetCheckPdf?Dev=1&Type=group&' + params + fetch(url) + .then(res => res.blob()) + .then(blob => { + const blobUrl = URL.createObjectURL(blob) + const iframe = document.createElement('iframe') + iframe.style.display = 'none' + iframe.src = blobUrl + iframe.onload = () => { + iframe.contentWindow.print() + URL.revokeObjectURL(blobUrl) + } + document.body.appendChild(iframe) + batchPrintDialogVisible.value = false + }) + } const closeYuYueDialog=()=>{ GetList() } @@ -843,6 +952,10 @@ display: none; } + .batch-print-table .el-checkbox[aria-label="选择所有行"] { + display: inline-flex; + } + .el-dialog.is-fullscreen { display: flex; flex-direction: column;