yuan
5 天以前 9ea5ff67655241271bdf04bb50ca3a8d60c4e22a
fix: 用河南鹤壁代码覆盖山西长治
已修改165个文件
已添加12个文件
34466 ■■■■ 文件已修改
.env.development 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/DDGWfavicon.ico 补丁 | 查看 | 原始文档 | blame | 历史
src/api/basicData/customer.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/basicData/enum.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/collaborativeApproval/knowledgeBase.js 159 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/customerService/index.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/financialManagement/invoiceApply.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inventoryManagement/stockOut.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/personnelManagement/staffSalaryMain.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/procurementManagement/paymentLedger.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/procurementManagement/procurementLedger.js 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/salesManagement/salesLedger.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/viewIndex.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/aiIndustrialBrain/reference-cards.png 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/aiIndustrialBrain/reference-chat.png 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/indexViews/HYSNLogo.png 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/styles/sidebar.scss 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/AIChatSidebar/assistants/financeAssistant.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/AIChatSidebar/assistants/productionAssistant.js 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/AIChatSidebar/assistants/purchaseAssistant.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/AIChatSidebar/assistants/salesAssistant.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Echarts/echarts.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PIMTable/PIMTable.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PIMTable/Pagination.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/ProcessParamListDialog.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Sidebar/SidebarItem.vue 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/documentPrint.js 331 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/numberFormat.js 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/summarizeTable.js 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/customerFile/index.vue 131 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/customerFileOpenSea/index.vue 424 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/parameterMaintenance/index.vue 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/product/ProductSelectDialog.vue 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/product/index.vue 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/supplierManage/components/BlacklistTab.vue 911 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/supplierManage/components/HomeTab.vue 924 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/knowledgeBase/index.vue 741 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue 741 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/notificationManagement/meetExamine/index.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/notificationManagement/meetIndex/index.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/notificationManagement/meetPublish/index.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/notificationManagement/summary/index.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/purchaseApproval/index.vue 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/rulesRegulationsManagement/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/sealManagement/index.vue 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/afterSalesHandling/components/formDia.vue 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/afterSalesHandling/index.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/components/viewDia.vue 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/feedbackRegistration/components/formDia.vue 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/customerService/feedbackRegistration/index.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/inspectionManagement/components/formDia.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue 1194 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/inspectionManagement/components/viewFiles.vue 417 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/inspectionManagement/index.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/repair/Modal/RepairModal.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/spareParts/index.vue 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/upkeep/Form/PlanModal.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/upkeep/Form/detailDia.vue 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/upkeep/Form/formDia.vue 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/upkeep/index.vue 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/assets/fixedAssets.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/assets/intangibleAssets.vue 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/payable/input-invoice.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/payable/payment.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/payable/paymentApply.vue 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/payable/purchaseIn.vue 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/payable/purchaseReturn.vue 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/payable/reconciliation.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/receivable/invoiceApply.vue 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/receivable/outputInvoice.vue 148 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/receivable/receipt.vue 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/receivable/reconciliation.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/receivable/salesOut.vue 279 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/receivable/salesReturn.vue 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/financialManagement/voucher/index.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/index.vue 217 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/dispatchLog/Record.vue 1501 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/receiptManagement/Record.vue 612 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/New.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/Record.vue 643 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/monitor/operlog/index.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/attendanceCheckin/checkinRules/components/form.vue 146 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/attendanceCheckin/checkinRules/index.vue 93 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/classsSheduling/index.vue 270 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/contractManagement/components/formDia.vue 151 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/contractManagement/index.vue 578 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/dimission/components/formDia.vue 463 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/dimission/index.vue 397 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/employeeRecord/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/monthlyStatistics/components/auditDia.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/monthlyStatistics/components/formDia.vue 1430 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/monthlyStatistics/index.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personnelManagement/socialSecuritySet/components/formDia.vue 808 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/paymentLedger/index.vue 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementLedger/detail.vue 246 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementLedger/index.vue 3344 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementPlan/index.vue 1194 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementReport/index.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/purchaseOrder/index.vue 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/purchaseReturnOrder/New.vue 97 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/purchaseReturnOrder/ProductList.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/purchaseReturnOrder/index.vue 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/qualityInspection/index.vue 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManagement/productIdentifier/index.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/processRoute/processRouteItem/index.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productStructure/Detail/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productStructure/StructureEdit.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productStructure/index.vue 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/components/MaterialDetailDialog.vue 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/components/MaterialSupplementDialog.vue 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/index.vue 135 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionReporting/index.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionTraceability/index.vue 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrder/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrderEdit/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrderManagement/index.vue 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionPlan/productionPlan/index.vue 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/components/filesDia.vue 87 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/components/formDia.vue 909 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/finalInspection/index.vue 860 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/metricBinding/index.vue 1095 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/nearExpiryReturn/index.vue 614 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/nonconformingManagement/components/formDia.vue 494 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/components/formDia.vue 122 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/index.vue 839 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue 1019 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/rawMaterialInspection/index.vue 811 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/PSIDataAnalysis/components/PanelHeader.vue 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/PSIDataAnalysis/components/ProductTypeSwitch.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/PSIDataAnalysis/components/center-bottom.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/PSIDataAnalysis/components/center-center.vue 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/PSIDataAnalysis/components/center-top.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/PSIDataAnalysis/components/left-bottom.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/PSIDataAnalysis/components/left-top.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/PSIDataAnalysis/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/PSIDataAnalysis/psiNavigation.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/dataDashboard/components/PanelHeader.vue 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/dataDashboard/components/basic/right-bottom.vue 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/dataDashboard/components/basic/right-top.vue 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/productionAnalysis/components/PanelHeader.vue 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/productionAnalysis/components/center-bottom.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/productionAnalysis/components/center-center.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/productionAnalysis/components/center-top.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/productionAnalysis/components/left-bottom.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/productionAnalysis/components/left-top.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/productionAnalysis/components/right-bottom.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/productionAnalysis/components/right-top.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/productionAnalysis/productionNavigation.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/reportAnalysis/reportManagement/index.vue 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/safeProduction/dangerInvestigation/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/safeProduction/safetyTrainingAssessment/index.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/deliveryLedger/index.vue 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/indicatorStats/index.vue 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/receiptPaymentLedger/index.vue 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/returnOrder/components/detailDia.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/returnOrder/components/formDia.vue 153 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/returnOrder/index.vue 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 5098 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesQuotation/index.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/dept/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/dict/data.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/dict/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/menu/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/post/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/role/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemArchitecture/index.vue 270 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.development
@@ -6,3 +6,5 @@
# ä¸­å°ä¼ä¸šæ•°å­—化转型二级套餐包/开发环境
VITE_APP_BASE_API = '/dev-api'
VITE_BASE_API = 'http://localhost:9003'
.gitignore
@@ -6,8 +6,6 @@
yarn-error.log*
**/*.log
.claude/
tests/**/coverage/
tests/e2e/reports
selenium-debug.log
@@ -20,9 +18,6 @@
*.njsproj
*.sln
*.local
# Claude Code
.claude/
package-lock.json
yarn.lock
package.json
@@ -29,6 +29,7 @@
    "element-plus": "2.7.7",
    "file-saver": "2.0.5",
    "fuse.js": "6.6.2",
    "html2canvas": "^1.4.1",
    "js-beautify": "1.14.11",
    "js-cookie": "3.0.5",
    "jsencrypt": "3.3.2",
public/DDGWfavicon.ico
src/api/basicData/customer.js
@@ -26,7 +26,7 @@
    })
}
// æµå…¥å…¬æµ·
// å›žé€€å®¢æˆ·åˆ°é”€å”®æ¡£æ¡ˆ
export function backCustomer(id) {
    return request({
        url: '/basic/customer/back/' + id,
src/api/basicData/enum.js
@@ -1,13 +1,5 @@
import request from "@/utils/request.js";
/** å®¡æ‰¹æ¨¡æ¿ç±»åž‹ç­‰é€šç”¨æžšä¸¾ï¼ˆTypeEnums) */
export function getTypeEnums() {
    return request({
        url: '/basic/enum/TypeEnums',
        method: 'get'
    })
}
export function findAllStockRecordTypeOptions() {
    return request({
        url: '/basic/enum/stockRecordType',
src/api/collaborativeApproval/knowledgeBase.js
@@ -1,172 +1,55 @@
import request from "@/utils/request";
import { getToken } from '@/utils/auth';
/**
 * çŸ¥è¯†åº“管理接口
 * ä¼ å‚规范:
 * - GET请求: ä½¿ç”¨ params
 * - POST请求: ä½¿ç”¨ data
 * - DELETE请求: ä½¿ç”¨ data
 * - æµå¼è¯·æ±‚: ä½¿ç”¨ Fetch API
 */
// ==================== çŸ¥è¯†åº“CRUD接口 ====================
/**
 * æŸ¥è¯¢çŸ¥è¯†åº“列表
 * @param {Object} query - æŸ¥è¯¢å‚æ•°
 * @param {number} query.current - å½“前页码(必填)
 * @param {number} query.size - æ¯é¡µæ¡æ•°(必填)
 * @param {string} [query.title] - çŸ¥è¯†æ ‡é¢˜(可选,模糊搜索)
 * @param {string} [query.type] - çŸ¥è¯†ç±»åž‹(可选,精确匹配)
 * @returns {Promise}
 */
// æŸ¥è¯¢çŸ¥è¯†åº“列表
export function listKnowledgeBase(query) {
  return request({
    url: "/knowledgeBase/getList",
    method: "get",
    params: query,  // GET请求使用params
    params: query,
  });
}
/**
 * æ–°å¢žçŸ¥è¯†åº“
 * @param {Object} data - çŸ¥è¯†åº“数据
 * @param {string} data.title - çŸ¥è¯†æ ‡é¢˜(必填)
 * @param {string} data.type - çŸ¥è¯†ç±»åž‹(必填)
 * @param {string} [data.scenario] - é€‚用场景(可选)
 * @param {string} [data.efficiency] - è§£å†³æ•ˆçއ(可选)
 * @param {string} data.problem - é—®é¢˜æè¿°(必填)
 * @param {string} data.solution - è§£å†³æ–¹æ¡ˆ(必填)
 * @param {string} [data.keyPoints] - å…³é”®è¦ç‚¹(可选)
 * @param {string} [data.creator] - åˆ›å»ºäºº(可选)
 * @param {number} [data.usageCount=0] - ä½¿ç”¨æ¬¡æ•°(可选)
 * @returns {Promise}
 */
// æŸ¥è¯¢çŸ¥è¯†åº“详细
// export function getKnowledgeBase(knowledgeBaseId) {
//   return request({
//     url: "/collaborativeApproval/knowledgeBase/" + knowledgeBaseId,
//     method: "get",
//   });
// }
// æ–°å¢žçŸ¥è¯†åº“
export function addKnowledgeBase(data) {
  return request({
    url: "/knowledgeBase/add",
    method: "post",
    data: data,  // POST请求使用data
    data: data,
  });
}
/**
 * ä¿®æ”¹çŸ¥è¯†åº“
 * @param {Object} data - çŸ¥è¯†åº“数据
 * @param {number} data.id - çŸ¥è¯†åº“ID(必填)
 * @param {string} data.title - çŸ¥è¯†æ ‡é¢˜(必填)
 * @param {string} data.type - çŸ¥è¯†ç±»åž‹(必填)
 * @returns {Promise}
 */
// ä¿®æ”¹çŸ¥è¯†åº“
export function updateKnowledgeBase(data) {
  return request({
    url: "/knowledgeBase/update",
    method: "post",
    data: data,  // POST请求使用data
    data: data,
  });
}
/**
 * åˆ é™¤çŸ¥è¯†åº“(支持批量删除)
 * @param {number[]} ids - çŸ¥è¯†åº“ID数组
 * @returns {Promise}
 */
export function delKnowledgeBase(ids) {
// åˆ é™¤çŸ¥è¯†åº“
export function delKnowledgeBase(query) {
  return request({
    url: "/knowledgeBase/delete",
    method: "delete",
    data: ids,  // DELETE请求使用data传递数组
    data: query,
  });
}
// ==================== æ–‡ä»¶ç®¡ç†æŽ¥å£ ====================
/**
 * æŸ¥è¯¢çŸ¥è¯†åº“文件向量化状态
 * @param {number} knowledgeBaseId - çŸ¥è¯†åº“ID
 * @returns {Promise} è¿”回文件列表及向量化状态
 */
export function getVectorStatus(knowledgeBaseId) {
// æ‰¹é‡åˆ é™¤çŸ¥è¯†åº“
export function delKnowledgeBaseBatch(knowledgeBaseIds) {
  return request({
    url: `/knowledgeBase/vector/status/${knowledgeBaseId}`,
    method: "get",
  });
}
/**
 * ä¿å­˜çŸ¥è¯†åº“文件关联(触发向量化)
 * @param {Object} data - æ–‡ä»¶å…³è”数据
 * @param {number} data.knowledgeBaseId - çŸ¥è¯†åº“ID(必填)
 * @param {number[]} data.storageBlobIds - æ–‡ä»¶blob ID数组(必填)
 * @returns {Promise}
 */
export function saveKnowledgeBaseFiles(data) {
  return request({
    url: "/knowledgeBase/file/save",
    method: "post",
    data: data,  // POST请求使用data
  });
}
/**
 * åˆ é™¤çŸ¥è¯†åº“文件
 * @param {number[]} ids - å‘量记录ID数组
 * @returns {Promise}
 */
export function deleteKnowledgeBaseFile(ids) {
  return request({
    url: "/knowledgeBase/file/delete",
    url: "/knowledgeBase/batch",
    method: "delete",
    data: ids,  // DELETE请求使用data传递数组
    data: knowledgeBaseIds,
  });
}
/**
 * é‡æ–°å‘量化文件
 * @param {number} vectorId - å‘量记录ID
 * @returns {Promise}
 */
export function reprocessVector(vectorId) {
  return request({
    url: `/knowledgeBase/vector/reprocess/${vectorId}`,
    method: "post",
  });
}
// ==================== çŸ¥è¯†é—®ç­”接口 ====================
/**
 * çŸ¥è¯†åº“问答(流式)
 * åŽç«¯æŽ¥å£: POST /ai/knowledge/chat
 * å“åº”类型: text/stream;charset=utf-8 (Spring Flux<String>)
 *
 * @param {Object} data - é—®ç­”参数
 * @param {number} data.knowledgeBaseId - çŸ¥è¯†åº“ID(必填)
 * @param {string} data.memoryId - ä¼šè¯ID(必填,用于保持上下文)
 * @param {string} data.question - ç”¨æˆ·é—®é¢˜(必填)
 * @returns {Promise<Response>} è¿”回Fetch Response对象
 */
export function knowledgeChat(data) {
  const token = getToken();
  return fetch(import.meta.env.VITE_APP_BASE_API + '/ai/knowledge/chat', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer ' + token
    },
    body: JSON.stringify(data)
  });
}
/**
 * æŸ¥è¯¢çŸ¥è¯†åº“问答历史
 * @param {string} memoryId - ä¼šè¯ID
 * @returns {Promise}
 */
export function getKnowledgeHistory(memoryId) {
  return request({
    url: `/ai/knowledge/history/${memoryId}`,
    method: "get",
  });
}
src/api/customerService/index.js
@@ -130,3 +130,12 @@
        params: query,
    })
}
// å”®åŽå•详情
export function getAfterSalesServiceById(id) {
    return request({
        url: '/afterSalesService/getById',
        method: 'get',
        params: { id }
    })
}
src/api/financialManagement/invoiceApply.js
@@ -56,13 +56,4 @@
    url: `/accountInvoiceApplication/deleteAccountInvoiceApplication?${query}`,
    method: "delete",
  });
}
/** æ ¹æ®å®¢æˆ·id查询开票申请台账 */
export function getAccountInvoiceApplicationList(query) {
  return request({
    url: '/accountInvoiceApplication/getAccountInvoiceApplicationList',
    method: "get",
    params: query,
  });
}
}
src/api/inventoryManagement/stockOut.js
@@ -35,12 +35,3 @@
        data,
    });
}
// æ‰¹é‡åå®¡å‡ºåº“记录
export const batchUnapproveStockOutRecords = (data) => {
    return request({
        url: "/stockOutRecord/reAudit",
        method: "post",
        data,
    });
}
src/api/personnelManagement/staffSalaryMain.js
@@ -17,14 +17,6 @@
  });
}
export function staffSalaryMainCalculateByEmployeeId(data) {
  return request({
    url: "/staffSalaryMain/calculateByEmployeeId",
    method: "post",
    data,
  });
}
export function staffSalaryMainAdd(data) {
  return request({
    url: "/staffSalaryMain/add",
@@ -49,11 +41,3 @@
  });
}
// èŽ·å–å¯ç”¨éƒ¨é—¨åˆ—è¡¨ï¼ˆæ ¹æ®æœˆä»½æŸ¥è¯¢ï¼ŒæŽ’é™¤å·²å‘æ”¾å·¥èµ„è¡¨çš„éƒ¨é—¨ï¼‰
export function staffSalaryMainAvailableDepts(salaryMonth) {
  return request({
    url: "/staffSalaryMain/availableDepts",
    method: "get",
    params: { salaryMonth },
  });
}
src/api/procurementManagement/paymentLedger.js
@@ -18,12 +18,3 @@
    params,
  });
}
/** ä»˜æ¬¾å°è´¦ - ä»˜æ¬¾ç™»è®°åˆ—表 */
export function registrationList(params) {
  return request({
    url: "/purchase/report/registration",
    method: "get",
    params,
  });
}
src/api/procurementManagement/procurementLedger.js
@@ -9,14 +9,6 @@
    params: query,
  });
}
// é‡‡è´­é€€è´§å¯é€‰é‡‡è´­å°è´¦
export function purchaseReturnableList(query) {
  return request({
    url: "/purchase/ledger/returnableList",
    method: "get",
    params: query,
  });
}
// æŸ¥è¯¢åˆåŒå·
export function getSalesNo(query) {
  return request({
@@ -74,69 +66,67 @@
  });
}
export function createPurchaseNo(entryDate) {
export function createPurchaseNo() {
  return request({
    url: "/purchase/ledger/createPurchaseNo",
    method: "get",
    params: { entryDate },
  });
}
export function updateApprovalStatus(query) {
  return request({
    url: "/purchase/ledger/updateApprovalStatus",
    method: "post",
    data: query,
  });
    return request({
        url: "/purchase/ledger/updateApprovalStatus",
        method: "post",
        data: query,
    });
}
// ä¿å­˜é‡‡è´­æ¨¡æ¿
export function addPurchaseTemplate(data) {
  return request({
    url: "/purchaseLedgerTemplate/add",
    method: "post",
    data: data,
  });
    return request({
        url: "/purchaseLedgerTemplate/add",
        method: "post",
        data: data,
    });
}
// ä¿®æ”¹é‡‡è´­æ¨¡æ¿
export function updatePurchaseTemplate(data) {
  return request({
    url: "/purchaseLedgerTemplate/update",
    method: "post",
    data: data,
  });
    return request({
        url: "/purchaseLedgerTemplate/update",
        method: "post",
        data: data,
    });
}
// æŸ¥è¯¢é‡‡è´­æ¨¡æ¿
export function getPurchaseTemplateList(query) {
  return request({
    url: "/purchase/ledger/getPurchaseTemplateList",
    method: "get",
    params: query,
  });
    return request({
        url: "/purchase/ledger/getPurchaseTemplateList",
        method: "get",
        params: query,
    });
}
// åˆ é™¤é‡‡è´­æ¨¡æ¿
export function delPurchaseTemplate(id) {
  return request({
    url: "/purchaseLedgerTemplate/delete",
    method: "delete",
    data: id,
  });
    return request({
        url: "/purchaseLedgerTemplate/delete",
        method: "delete",
        data: id,
    });
}
// æŸ¥è¯¢é‡‡è´­è¯¦æƒ…
export function getPurchaseByCode(id) {
  return request({
    url: "/purchase/ledger/getPurchaseByCode",
    method: "get",
    params: id,
  });
    return request({
        url: "/purchase/ledger/getPurchaseByCode",
        method: "get",
        params: id,
    });
}
export function batchGeneratePurchaseInboundSteps(query) {
  return request({
    url: "/purchase/ledger/batchInsertPurchaseSteps",
    method: "post",
    data: query,
  });
}
// èŽ·å–é‡‡è´­å•æ‰“å°æ•°æ®
export function getPrintData(id) {
    return request({
        url: '/purchase/ledger/printData/' + id,
        method: 'get',
    });
}
src/api/salesManagement/salesLedger.js
@@ -116,4 +116,11 @@
        method: "get",
        params: query,
    });
}
// èŽ·å–é”€å”®å•æ‰“å°æ•°æ®
export function getPrintData(id) {
    return request({
        url: '/sales/ledger/printData/' + id,
        method: 'get',
    });
}
src/api/viewIndex.js
@@ -349,7 +349,8 @@
export const productionOrderProgress = (params = {}) => {
  const safePageNum = Math.max(1, Number(params.pageNum || 1));
  const safeTab = ["all", "inProgress", "completed", "end"].includes(params.tab)
  const safePageSize = Math.min(50, Math.max(1, Number(params.pageSize || 10)));
  const safeTab = ["all", "inProgress", "completed", "paused"].includes(params.tab)
    ? params.tab
    : "all";
  return request({
@@ -359,7 +360,7 @@
      ...params,
      tab: safeTab,
      pageNum: safePageNum,
      pageSize: params.pageSize,
      pageSize: safePageSize,
    },
    headers: {
      handleAuthError: false,
src/assets/aiIndustrialBrain/reference-cards.png
src/assets/aiIndustrialBrain/reference-chat.png
src/assets/indexViews/HYSNLogo.png
src/assets/styles/sidebar.scss
@@ -216,37 +216,32 @@
    & .nest-menu .el-sub-menu > .el-sub-menu__title,
    & .el-sub-menu .el-menu-item {
      min-width: 0 !important;
      width: calc(100% - 32px) !important;
      margin: 0 16px 6px !important;
      height: 40px;
      line-height: 40px;
      padding-left: 12px !important;
      padding-right: 12px !important;
      border-radius: 8px;
      width: calc(100% - 24px) !important;
      margin: 0 12px 8px !important;
      height: 46px;
      line-height: 46px;
      padding-left: 14px !important;
      padding-right: 14px !important;
      border-radius: 12px;
      transition: all 0.24s ease;
      color: var(--sidebar-text);
      border: none !important;
      background: transparent;
      font-size: 13px;
      border: 1px solid rgba(255, 255, 255, 0.06) !important;
      background: linear-gradient(128deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
      &:hover {
        background: rgba(var(--el-color-primary-rgb, 37, 99, 235), 0.12) !important;
        transform: translateX(4px);
        background: linear-gradient(128deg, rgba(var(--el-color-primary-rgb, 37, 99, 235), 0.24), rgba(var(--el-color-primary-rgb, 37, 99, 235), 0.07)) !important;
        border-color: rgba(var(--el-color-primary-rgb, 37, 99, 235), 0.3) !important;
        transform: translateX(2px);
      }
      &.is-active {
        background: rgba(var(--el-color-primary-rgb, 37, 99, 235), 0.85) !important;
        background: var(--menu-active-bg, linear-gradient(135deg, var(--el-color-primary), var(--el-color-primary-light-3))) !important;
        background-size: 180% 180%;
        color: #fff !important;
        font-weight: 500;
        box-shadow: 0 4px 12px rgba(var(--el-color-primary-rgb, 37, 99, 235), 0.25);
        box-shadow: var(--menu-active-glow, 0 10px 24px rgba(var(--el-color-primary-rgb, 37, 99, 235), 0.34));
        animation: sidebarActiveFlow 4.6s ease infinite;
      }
    }
    // å­èœå•容器样式 - å¢žåŠ ç¼©è¿›å’Œè§†è§‰å±‚æ¬¡
    & .el-sub-menu .el-menu {
      padding: 4px 0 8px;
      margin-left: 8px;
      border-left: 2px solid rgba(255, 255, 255, 0.08);
    }
  }
src/components/AIChatSidebar/assistants/financeAssistant.js
@@ -14,15 +14,13 @@
  allowFileUpload: false,
  emptySessionText: '暂无财务会话',
  quickPrompts: [
    '查看经营驾驶舱',
    '查看本月经营驾驶舱',
    '生成本周经营周报(利润与现金流)',
    '分析本月利润下降原因',
    '查询近30天亏损订单',
    '近30天哪个客户利润贡献最高',
    '查看本月经营驾驶舱',
    '查询近30天亏损订单',
    '分析近30天库存资金占用',
    '预测未来3个月现金流',
    '查询应收回款风险',
    '哪个工序成本最高'
  ]
}
src/components/AIChatSidebar/assistants/productionAssistant.js
@@ -14,15 +14,14 @@
  allowFileUpload: false,
  emptySessionText: '暂无生产会话',
  quickPrompts: [
    '查询生产现场数据',
    '查询生产计划执行情况',
    '查询工单执行情况',
    '查询设备运行情况',
    '查询质量异常数据',
    '查询物料相关数据',
    '查看制造预警看板',
    '分析本月制造经营情况',
    '分析近7天生产异常',
    '生成制造办理建议'
    '查询本月生产计划',
    '查看最近10条工单',
    '查设备A-01的维修情况',
    '查质量不合格记录',
    '查低库存物料',
    '查近7天异常处理',
    '生成制造预警看板',
    '分析本月生产完成率和异常率',
    '给出工单逾期和设备待修的办理建议'
  ]
}
src/components/AIChatSidebar/assistants/purchaseAssistant.js
@@ -16,15 +16,10 @@
  fileAnalyzeUrl: '/purchase-ai/analyze-files',
  emptySessionText: '暂无采购会话',
  quickPrompts: [
    '查询采购台账列表',
    '查询最近10条采购台账',
    '统计本月采购数据',
    '查询本月采购物料金额排行',
    '查询未入库采购订单',
    '查询采购到货异常',
    '查询待付款采购单',
    '查询本月采购退货情况',
    '查询某个采购台账详情',
    '分析供应商采购金额排名'
    '本月采购金额排名前十的物料有哪些?',
    '哪些采购订单还未入库?',
    '最近7天供应商到货异常有哪些?',
    '帮我统计待付款采购单!',
    '列出本月采购退货情况'
  ]
}
src/components/AIChatSidebar/assistants/salesAssistant.js
@@ -14,8 +14,8 @@
  allowFileUpload: false,
  emptySessionText: '暂无销售会话',
  quickPrompts: [
    '查询私海客户档案前10条',
    '查询公海客户档案',
    '查询销售档案前10条',
    '查询客户档案',
    '查询本月销售报价',
    '查询本月销售台账',
    '查询近30天销售退货',
src/components/Echarts/echarts.vue
@@ -203,6 +203,10 @@
  clearInitTimer()
})
defineExpose({
  resize: windowResizeListener,
})
// Watch all reactive props that affect the chart
watch(
  () => [props.xAxis, props.yAxis, props.series, props.legend, props.tooltip, props.visualMap],
src/components/PIMTable/PIMTable.vue
@@ -8,10 +8,11 @@
            :highlight-current-row="highlightCurrentRow"
            :row-class-name="rowClassName"
            :row-style="rowStyle"
            :cell-style="cellStyle"
            :row-key="rowKey"
            :style="tableStyle"
            tooltip-effect="dark"
            :tooltip-options="{ popperOptions: { strategy: 'absolute' } }"
            :tooltip-options="{ appendTo: 'body' }"
            :expand-row-keys="expandRowKeys"
            :show-summary="isShowSummary"
            :summary-method="summaryMethod"
@@ -120,6 +121,7 @@
            <el-button v-show="o.type != 'upload'"
                       v-if="o.showHide ? o.showHide(scope.row) : true"
                       :disabled="isOperationDisabled(o, scope.row)"
                       :loading="isOperationLoading(o, scope.row)"
                       :plain="o.plain"
                       type="primary"
                       :style="{
@@ -292,6 +294,10 @@
      type: [Object, Function],
      default: () => ({}),
    },
    cellStyle: {
      type: [Object, Function],
      default: () => ({}),
    },
    tableData: {
      type: Array,
      default: () => [],
@@ -373,6 +379,13 @@
      : !!operation.disabled;
  };
  const isOperationLoading = (operation, row) => {
    if (!operation?.loading) return false;
    return typeof operation.loading === "function"
      ? !!operation.loading(row)
      : !!operation.loading;
  };
  const parseHexToRgb = hex => {
    const normalized = String(hex || "")
      .trim()
src/components/PIMTable/Pagination.vue
@@ -34,7 +34,7 @@
  },
  pageSizes: {
    type: Array,
    default: () => [10, 20, 30, 50, 100]
    default: () => [10, 20, 30, 50, 100, 200, 500]
  },
  pagerCount: {
    type: Number,
src/components/ProcessParamListDialog.vue
@@ -372,14 +372,7 @@
      size: paramPage.value.size,
    }).then(res => {
      if (res.code === 200) {
        const existingParamIds = new Set(
          (props.paramList || [])
            .map(item => Number(item.paramId || item.technologyOperationParamId))
            .filter(id => Number.isFinite(id) && id > 0)
        );
        filteredParamList.value = (res.data?.records || []).filter(
          item => !existingParamIds.has(Number(item.id))
        );
        filteredParamList.value = res.data?.records || [];
        paramPage.value.total = res.data.total || 0;
      } else {
        ElMessage.error(res.msg || "查询失败");
@@ -409,6 +402,7 @@
      addProcessRouteItemParamOrder({
        productionOrderId: Number(props.orderId),
        productionOrderRoutingOperationId: props.process.id,
        technologyRoutingOperationParamId: props.process.id,
        paramId: selectedParam.value.id,
        standardValue: selectedParam.value.standardValue || "",
        isRequired: selectedParam.value.isRequired || 0,
@@ -673,4 +667,4 @@
  .detail-text {
    font-weight: 500;
  }
</style>
</style>
src/layout/components/Sidebar/SidebarItem.vue
@@ -102,70 +102,57 @@
</script>
<style lang="scss" scoped>
.sidebar-item-wrapper {
  :deep(.menu-icon) {
    width: 26px;
    height: 26px;
    margin-right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s ease;
    color: var(--sidebar-text);
    opacity: 0.88;
  }
  :deep(.el-menu-item:hover .menu-icon),
  :deep(.el-sub-menu__title:hover .menu-icon) {
    color: #ffffff;
    opacity: 1;
  }
.sidebar-item-wrapper {
  :deep(.menu-icon) {
    width: 26px;
    height: 26px;
    margin-right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s ease;
    color: var(--sidebar-text);
    opacity: 0.88;
  }
  :deep(.el-menu-item:hover .menu-icon),
  :deep(.el-sub-menu__title:hover .menu-icon) {
    color: #ffffff;
    opacity: 1;
  }
  
  :deep(.el-menu-item.is-active .menu-icon) {
    color: var(--menu-active-text) !important;
    opacity: 1;
  }
  
  :deep(.menu-title) {
    font-weight: 500;
    transition: color 0.2s ease;
    color: var(--sidebar-text);
    opacity: 0.82;
  }
  :deep(.el-menu-item:hover .menu-title),
  :deep(.el-sub-menu__title:hover .menu-title) {
    color: #ffffff;
    opacity: 1;
  }
  :deep(.el-menu-item.is-active .menu-title) {
    color: var(--menu-active-text) !important;
    opacity: 1;
  }
  :deep(.nest-menu) {
    .menu-icon {
      width: 18px;
      height: 18px;
      margin-right: 8px;
      opacity: 0.7;
    }
    .menu-title {
      font-size: 13px;
      opacity: 0.85;
    }
    .el-menu-item.is-active {
      .menu-icon {
        opacity: 1;
      }
      .menu-title {
        opacity: 1;
      }
    }
  }
}
  :deep(.menu-title) {
    font-weight: 500;
    transition: color 0.2s ease;
    color: var(--sidebar-text);
    opacity: 0.82;
  }
  :deep(.el-menu-item:hover .menu-title),
  :deep(.el-sub-menu__title:hover .menu-title) {
    color: #ffffff;
    opacity: 1;
  }
  :deep(.el-menu-item.is-active .menu-title) {
    color: var(--menu-active-text) !important;
    opacity: 1;
  }
  :deep(.nest-menu) {
    .menu-icon {
      width: 22px;
      height: 22px;
      margin-right: 10px;
    }
    .menu-title { font-size: 13px; }
  }
}
</style>
src/main.js
@@ -115,5 +115,22 @@
  size: Cookies.get("size") || "default",
});
app._context.components.ElDialog.props.closeOnClickModal.default = false;
const ElTable = app._context.components.ElTable;
if (ElTable?.props?.tooltipOptions) {
  if (ElTable.props.tooltipOptions === Object) {
    ElTable.props.tooltipOptions = {
      type: Object,
      default: () => ({
        appendTo: "body",
      }),
    };
  } else if (typeof ElTable.props.tooltipOptions === "object") {
    ElTable.props.tooltipOptions.default =
      ElTable.props.tooltipOptions.default ||
      (() => ({
        appendTo: "body",
      }));
  }
}
app.mount("#app");
src/router/index.js
@@ -97,44 +97,6 @@
      },
    ],
  },
  // æ•™å­¦æ¼”示模块
  {
    path: "/productionManagement/teachingDemo",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "",
        component: () => import("@/views/productionManagement/teachingDemo/index.vue"),
        name: "TeachingDemo",
        meta: { title: "工艺路线与BOM教学演示", icon: "education" },
      },
      {
        path: "bom",
        component: () => import("@/views/productionManagement/teachingDemo/BomDemo.vue"),
        name: "BomDemo",
        meta: { title: "BOM结构演示", activeMenu: "/productionManagement/teachingDemo" },
      },
      {
        path: "processRoute",
        component: () => import("@/views/productionManagement/teachingDemo/ProcessRouteDemo.vue"),
        name: "ProcessRouteDemo",
        meta: { title: "工艺路线演示", activeMenu: "/productionManagement/teachingDemo" },
      },
      {
        path: "combined",
        component: () => import("@/views/productionManagement/teachingDemo/CombinedDemo.vue"),
        name: "CombinedDemo",
        meta: { title: "联动演示", activeMenu: "/productionManagement/teachingDemo" },
      },
      {
        path: "factory",
        component: () => import("@/views/productionManagement/teachingDemo/FactoryDemo.vue"),
        name: "FactoryDemo",
        meta: { title: "动态工厂演示", activeMenu: "/productionManagement/teachingDemo" },
      },
    ],
  },
  {
    path: "/user",
    component: Layout,
src/utils/documentPrint.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,331 @@
import html2canvas from 'html2canvas'
function esc(s) {
  if (!s) return ''
  return String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;')
}
function fmtDate(v) {
  if (!v) return ''
  const d = new Date(v)
  const y = d.getFullYear()
  const m = String(d.getMonth() + 1).padStart(2, '0')
  const day = String(d.getDate()).padStart(2, '0')
  return y + '-' + m + '-' + day
}
function fmtMoney(v) {
  if (v == null) return '0.00'
  return Number(v).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
}
function digitUppercase(n) {
  const digits = ['零', '壹', 'è´°', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
  const radices = ['', '拾', 'ä½°', '仟', '万', '拾', 'ä½°', '仟', '亿']
  let num = Math.abs(n)
  let result = ''
  const intPart = Math.floor(num)
  const intStr = String(intPart)
  const len = intStr.length
  if (intPart === 0) {
    result = '零'
  } else {
    let zeroFlag = false
    for (let i = 0; i < len; i++) {
      const d = parseInt(intStr[i])
      const pos = len - 1 - i
      if (d === 0) {
        zeroFlag = true
        if (pos % 4 === 0) {
          result += radices[pos]
          zeroFlag = false
        }
      } else {
        if (zeroFlag) {
          result += '零'
          zeroFlag = false
        }
        result += digits[d] + radices[pos]
      }
    }
    if (result.endsWith('零')) result = result.slice(0, -1)
  }
  result += '元'
  const decPart = Math.round((num - intPart) * 100)
  if (decPart === 0) {
    result += '整'
  } else {
    const jiao = Math.floor(decPart / 10)
    const fen = decPart % 10
    if (jiao > 0) result += digits[jiao] + '角'
    if (fen > 0) result += digits[fen] + '分'
  }
  return result
}
function coreCss() {
  return `*{margin:0;padding:0;box-sizing:border-box}body{font-family:"Microsoft YaHei","SimSun",sans-serif;padding:30px 36px;color:#333;background:#fff}.title{text-align:center;font-size:18px;font-weight:bold;letter-spacing:6px;margin-bottom:4px}.sub{text-align:center;font-size:12px;color:#999;margin-bottom:18px}.info-top{display:flex;justify-content:space-between;font-size:13px;margin-bottom:14px;padding-bottom:10px;border-bottom:1px dashed #ccc}.info-top .left,.info-top .right{line-height:2}.info-grid{display:grid;grid-template-columns:1fr 1fr;gap:4px 36px;font-size:13px;margin-bottom:14px;padding-bottom:8px;border-bottom:1px solid #ccc}.info-grid .l{color:#666}.info-grid .v{font-weight:500}table{width:100%;border-collapse:collapse;font-size:13px;margin-bottom:14px}th,td{border:1px solid #333;padding:5px 6px;text-align:center}th{background:#eee;font-weight:500}td.r{text-align:right}.summary{text-align:right;font-size:13px;margin-bottom:16px;line-height:2.2}.summary .cn{font-weight:bold;color:#cf1322}`
}
function productRows(products) {
  if (!products || !products.length) return ''
  let html = ''
  products.forEach((p, i) => {
    const name = p.productCategory || ''
    const spec = p.specificationModel || ''
    html += '<tr>'
    html += '<td>' + (i + 1) + '</td>'
    html += '<td style="text-align:left">' + esc(name)
    if (spec) html += '<br><span style="color:#888;font-size:12px">' + esc(spec) + '</span>'
    html += '</td>'
    html += '<td>' + esc(p.unit || '') + '</td>'
    html += '<td class="r">' + (p.quantity != null ? Number(p.quantity).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : '') + '</td>'
    html += '<td class="r">' + fmtMoney(p.taxInclusiveUnitPrice) + '</td>'
    html += '<td class="r">' + fmtMoney(p.taxInclusiveTotalPrice) + '</td>'
    html += '<td>' + (p.taxRate != null ? p.taxRate + '%' : '') + '</td>'
    html += '<td>' + esc(p.invoiceType || '') + '</td>'
    html += '</tr>'
  })
  return html
}
function calcTotals(products) {
  let total = 0, totalNoTax = 0
  if (products) {
    products.forEach(p => {
      if (p.taxInclusiveTotalPrice != null) total += Number(p.taxInclusiveTotalPrice)
      if (p.taxExclusiveTotalPrice != null) totalNoTax += Number(p.taxExclusiveTotalPrice)
    })
  }
  return { total, totalNoTax }
}
function buildSalesHtml(companyName, ledger, forPrint) {
  const products = ledger.productData || []
  const { total, totalNoTax } = calcTotals(products)
  const toolbar = forPrint ? '<div class="toolbar"><button onclick="window.print()">打印 / å¦å­˜ä¸º PDF</button></div>' : ''
  const printCss = forPrint ? '@media print{body{padding:15px 24px}.toolbar{display:none}}' : ''
  const printScript = forPrint ? '<script>window.onload=function(){setTimeout(function(){window.print();},300);};<\/script>' : ''
  return `<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8">
<title>销售单 - ${esc(ledger.salesContractNo)} - ${esc(companyName)}</title>
<style>.toolbar{text-align:center;margin-bottom:16px}.toolbar button{padding:6px 20px;font-size:14px;cursor:pointer;background:#1890ff;color:#fff;border:none;border-radius:4px}.toolbar button:hover{background:#40a9ff}${coreCss()}${printCss}</style></head><body>
${toolbar}
<div class="title">${esc(companyName)}</div>
<div class="sub">销售合同 / é”€å”®å•</div>
<div class="info-top">
  <div class="left"><div><strong>销方名称:</strong>${esc(companyName)}</div></div>
  <div class="right"><div><strong>合同编号:</strong>${esc(ledger.salesContractNo)}</div><div><strong>签订日期:</strong>${fmtDate(ledger.executionDate)}</div></div>
</div>
<div class="info-grid">
  <div><span class="l">客户名称:</span><span class="v">${esc(ledger.customerName)}</span></div>
  <div><span class="l">项目名称:</span><span class="v">${esc(ledger.projectName)}</span></div>
  <div><span class="l">业务员:</span><span class="v">${esc(ledger.salesman)}</span></div>
  <div><span class="l">付款方式:</span><span class="v">${esc(ledger.paymentMethod)}</span></div>
  <div><span class="l">录入日期:</span><span class="v">${fmtDate(ledger.entryDate)}</span></div>
  <div><span class="l">交货日期:</span><span class="v">${fmtDate(ledger.deliveryDate)}</span></div>
  ${ledger.remarks ? `<div style="grid-column:1/-1"><span class="l">备注:</span><span class="v">${esc(ledger.remarks)}</span></div>` : ''}
</div>
<table><thead><tr><th>序号</th><th>产品名称 / è§„格型号</th><th>单位</th><th>数量</th><th>含税单价</th><th>含税总价</th><th>税率</th><th>发票类型</th></tr></thead><tbody>
${productRows(products)}
</tbody></table>
<div class="summary">
  <div>不含税合计:<strong>${fmtMoney(totalNoTax)}</strong></div>
  <div>含税合计(大写):<span class="cn">${digitUppercase(total)}</span></div>
  <div>含税合计(小写):<strong>Â¥${fmtMoney(total)}</strong></div>
</div>
${printScript}
</body></html>`
}
function buildPurchaseHtml(companyName, ledger, products, forPrint) {
  const { total, totalNoTax } = calcTotals(products)
  const contractAmount = ledger.contractAmount != null ? Number(ledger.contractAmount) : total
  const toolbar = forPrint ? '<div class="toolbar"><button onclick="window.print()">打印 / å¦å­˜ä¸º PDF</button></div>' : ''
  const printCss = forPrint ? '@media print{body{padding:15px 24px}.toolbar{display:none}}' : ''
  const printScript = forPrint ? '<script>window.onload=function(){setTimeout(function(){window.print();},300);};<\/script>' : ''
  return `<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8">
<title>采购单 - ${esc(ledger.purchaseContractNumber)} - ${esc(companyName)}</title>
<style>.toolbar{text-align:center;margin-bottom:16px}.toolbar button{padding:6px 20px;font-size:14px;cursor:pointer;background:#1890ff;color:#fff;border:none;border-radius:4px}.toolbar button:hover{background:#40a9ff}${coreCss()}${printCss}</style></head><body>
${toolbar}
<div class="title">${esc(companyName)}</div>
<div class="info-top">
  <div class="left"><div><strong>购方名称:</strong>${esc(companyName)}</div></div>
  <div class="right"><div><strong>合同编号:</strong>${esc(ledger.purchaseContractNumber)}</div><div><strong>签订日期:</strong>${fmtDate(ledger.executionDate)}</div></div>
</div>
<div class="info-grid">
  <div><span class="l">供应商名称:</span><span class="v">${esc(ledger.supplierName)}</span></div>
  <div><span class="l">项目名称:</span><span class="v">${esc(ledger.projectName)}</span></div>
  <div><span class="l">录入人:</span><span class="v">${esc(ledger.recorderName)}</span></div>
  <div><span class="l">付款方式:</span><span class="v">${esc(ledger.paymentMethod)}</span></div>
  <div><span class="l">录入日期:</span><span class="v">${fmtDate(ledger.entryDate)}</span></div>
  ${ledger.salesContractNo ? `<div><span class="l">关联销售合同号:</span><span class="v">${esc(ledger.salesContractNo)}</span></div>` : ''}
  ${ledger.remarks ? `<div style="grid-column:1/-1"><span class="l">备注:</span><span class="v">${esc(ledger.remarks)}</span></div>` : ''}
</div>
<table><thead><tr><th>序号</th><th>产品名称 / è§„格型号</th><th>单位</th><th>数量</th><th>含税单价</th><th>含税总价</th><th>税率</th><th>发票类型</th></tr></thead><tbody>
${productRows(products)}
</tbody></table>
<div class="summary">
  <div>不含税合计:<strong>${fmtMoney(totalNoTax)}</strong></div>
  <div>含税合计(大写):<span class="cn">${digitUppercase(total)}</span></div>
  <div>含税合计(小写):<strong>Â¥${fmtMoney(total)}</strong></div>
  <div>合同金额(大写):<span class="cn">${digitUppercase(contractAmount)}</span></div>
  <div>合同金额(小写):<strong>Â¥${fmtMoney(contractAmount)}</strong></div>
</div>
${printScript}
</body></html>`
}
export function buildSalesDocument(companyName, ledger) {
  return buildSalesHtml(companyName, ledger, false)
}
export function buildPurchaseDocument(companyName, ledger, products) {
  return buildPurchaseHtml(companyName, ledger, products, false)
}
function buildSalesPrintHtml(companyName, ledger) {
  return buildSalesHtml(companyName, ledger, true)
}
function buildPurchasePrintHtml(companyName, ledger, products) {
  return buildPurchaseHtml(companyName, ledger, products, true)
}
export function openPrintWindow(html) {
  const w = window.open('', '_blank', 'width=900,height=700')
  if (!w) return
  w.document.write(html)
  w.document.close()
}
export async function downloadAsJpg(html, filename) {
  const iframe = document.createElement('iframe')
  iframe.style.position = 'fixed'
  iframe.style.left = '0'
  iframe.style.top = '0'
  iframe.style.width = '900px'
  iframe.style.height = '600px'
  iframe.style.opacity = '0'
  iframe.style.pointerEvents = 'none'
  iframe.style.zIndex = '99999'
  document.body.appendChild(iframe)
  return new Promise((resolve, reject) => {
    const iframeDoc = iframe.contentDocument || iframe.contentWindow.document
    iframeDoc.open()
    iframeDoc.write(html)
    iframeDoc.close()
    const doCapture = async () => {
      try {
        const body = iframeDoc.body
        iframe.style.height = Math.max(body.scrollHeight, 600) + 'px'
        await new Promise(r => setTimeout(r, 100))
        const canvas = await html2canvas(body, {
          scale: 2,
          useCORS: true,
          backgroundColor: '#ffffff',
          windowWidth: 900
        })
        document.body.removeChild(iframe)
        canvas.toBlob(blob => {
          const url = URL.createObjectURL(blob)
          const a = document.createElement('a')
          a.href = url
          a.download = filename
          a.click()
          URL.revokeObjectURL(url)
          resolve()
        }, 'image/jpeg', 0.95)
      } catch (e) {
        document.body.removeChild(iframe)
        reject(e)
      }
    }
    iframe.onload = () => setTimeout(doCapture, 300)
    setTimeout(doCapture, 1000)
  })
}
export function downloadSalesJpg(companyName, ledger, filename) {
  const html = buildSalesHtml(companyName, ledger, false)
  return downloadAsJpg(html, filename)
}
export function downloadPurchaseJpg(companyName, ledger, products, filename) {
  const html = buildPurchaseHtml(companyName, ledger, products, false)
  return downloadAsJpg(html, filename)
}
export function printSales(companyName, ledger) {
  const html = buildSalesPrintHtml(companyName, ledger)
  openPrintWindow(html)
}
export function printPurchase(companyName, ledger, products) {
  const html = buildPurchasePrintHtml(companyName, ledger, products)
  openPrintWindow(html)
}
export function printSalesMulti(companyName, orders) {
  let bodies = ''
  orders.forEach((ledger, i) => {
    const html = buildSalesHtml(companyName, ledger, true)
    const bodyMatch = html.match(/<body>([\s\S]*)<\/body>/)
    if (bodyMatch) {
      const body = bodyMatch[1].replace(/<script>[\s\S]*?<\/script>/g, '')
      bodies += '<div class="print-page' + (i < orders.length - 1 ? ' page-break' : '') + '">' + body + '</div>'
    }
  })
  const combined = `<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8">
<title>销售单 - ${esc(companyName)}</title>
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{font-family:"Microsoft YaHei","SimSun",sans-serif;padding:20px 36px;color:#333;background:#fff}
.toolbar{text-align:center;margin-bottom:20px}
.toolbar button{padding:6px 24px;font-size:14px;cursor:pointer;background:#1890ff;color:#fff;border:none;border-radius:4px}
.toolbar button:hover{background:#40a9ff}
${coreCss()}
.print-page{page-break-inside:avoid}
.page-break{page-break-after:always}
@media print{body{padding:15px 24px}.toolbar{display:none}}
</style></head><body>
<div class="toolbar"><button onclick="window.print()">打印全部 (共${orders.length}份)</button></div>
${bodies}
<script>window.onload=function(){setTimeout(function(){window.print();},300);};<\/script>
</body></html>`
  openPrintWindow(combined)
}
export function printPurchaseMulti(companyName, orders) {
  let bodies = ''
  orders.forEach((item, i) => {
    const html = buildPurchaseHtml(companyName, item.ledger, item.products, true)
    const bodyMatch = html.match(/<body>([\s\S]*)<\/body>/)
    if (bodyMatch) {
      const body = bodyMatch[1].replace(/<script>[\s\S]*?<\/script>/g, '')
      bodies += '<div class="print-page' + (i < orders.length - 1 ? ' page-break' : '') + '">' + body + '</div>'
    }
  })
  const combined = `<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8">
<title>采购单 - ${esc(companyName)}</title>
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{font-family:"Microsoft YaHei","SimSun",sans-serif;padding:20px 36px;color:#333;background:#fff}
.toolbar{text-align:center;margin-bottom:20px}
.toolbar button{padding:6px 24px;font-size:14px;cursor:pointer;background:#1890ff;color:#fff;border:none;border-radius:4px}
.toolbar button:hover{background:#40a9ff}
${coreCss()}
.print-page{page-break-inside:avoid}
.page-break{page-break-after:always}
@media print{body{padding:15px 24px}.toolbar{display:none}}
</style></head><body>
<div class="toolbar"><button onclick="window.print()">打印全部 (共${orders.length}份)</button></div>
${bodies}
<script>window.onload=function(){setTimeout(function(){window.print();},300);};<\/script>
</body></html>`
  openPrintWindow(combined)
}
src/utils/numberFormat.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
/** é‡‘额类字段默认最大小数位数 */
export const AMOUNT_DECIMAL_SCALE = 6
/**
 * æ ¼å¼åŒ–数字:最多保留 scale ä½å°æ•°ï¼Œå¹¶åŽ»é™¤æœ«å°¾å¤šä½™çš„ 0
 */
export function formatDecimal(value, scale = AMOUNT_DECIMAL_SCALE, fallback = '0') {
  if (value === null || value === undefined || value === '') {
    return fallback
  }
  const num = Number(value)
  if (Number.isNaN(num)) {
    return fallback
  }
  return parseFloat(num.toFixed(scale)).toString()
}
/** å¸¦è´§å¸ç¬¦å·çš„金额展示 */
export function formatCurrency(value, scale = AMOUNT_DECIMAL_SCALE) {
  return `Â¥${formatDecimal(value, scale)}`
}
/** el-table-column formatter */
export function tableAmountFormatter(row, column, cellValue) {
  return formatDecimal(cellValue)
}
/** è®¡ç®—后保留指定位小数 */
export function roundAmount(value, scale = AMOUNT_DECIMAL_SCALE) {
  if (value === null || value === undefined || value === '') {
    return 0
  }
  const num = Number(value)
  if (Number.isNaN(num)) {
    return 0
  }
  return parseFloat(num.toFixed(scale))
}
/** æž„建 summarizeTable é‡‘额列格式配置 */
export function buildAmountSummaryFormat(fields, extraFormat = {}) {
  const format = { ...extraFormat }
  fields.forEach(field => {
    format[field] = { decimalPlaces: AMOUNT_DECIMAL_SCALE }
  })
  return format
}
src/utils/summarizeTable.js
@@ -1,3 +1,5 @@
import { formatDecimal, AMOUNT_DECIMAL_SCALE } from './numberFormat'
/**
 * é€šç”¨çš„表格合计方法
 * @param {Object} param - åŒ…含表格列配置和数据源的对象
@@ -26,28 +28,35 @@
          // å¦‚果指定了不需要保留小数,则直接转换为整数
          sums[index] = Math.round(sum).toString();
        } else {
          // é»˜è®¤ä¿ç•™ä¸¤ä½å°æ•°
          sums[index] = parseFloat(sum).toFixed(
          sums[index] = formatDecimal(
            sum,
            specialFormat[prop]?.decimalPlaces ?? 2
          );
        }
      } else {
        sums[index] = "";
        sums[index] = '';
      }
    } else {
      sums[index] = "";
      sums[index] = '';
    }
  });
  return sums;
};
// ä¸å«ç¨Žæ€»ä»·è®¡ç®—
const calculateTaxExclusiveTotalPrice = (taxInclusiveTotalPrice, taxRate) => {
  const taxRateDecimal = taxRate / 100;
  return (taxInclusiveTotalPrice / (1 + taxRateDecimal)).toFixed(2);
  return formatDecimal(
    Number(taxInclusiveTotalPrice) / (1 + taxRateDecimal),
    AMOUNT_DECIMAL_SCALE
  );
};
// å«ç¨Žæ€»ä»·è®¡ç®—
const calculateTaxIncludeTotalPrice = (taxInclusiveUnitPrice, quantity) => {
  return (taxInclusiveUnitPrice * quantity).toFixed(2);
  return formatDecimal(
    Number(taxInclusiveUnitPrice) * Number(quantity),
    AMOUNT_DECIMAL_SCALE
  );
};
// å¯¼å‡ºå‡½æ•°ä¾›å…¶ä»–文件使用
export {
src/views/basicData/customerFile/index.vue
@@ -1,6 +1,7 @@
<template>
  <div class="app-container">
    <div class="search_form" style="margin-bottom: 20px;">
    <div class="search_form"
         style="margin-bottom: 20px;">
      <div>
        <span class="search_title">客户名称:</span>
        <el-input v-model="searchForm.customerName"
@@ -17,8 +18,8 @@
                   @change="handleQuery">
          <el-option label="零售客户"
                     value="零售客户" />
          <el-option label="进销商客户"
                     value="进销商客户" />
          <el-option label="经销商客户"
                     value="经销商客户" />
        </el-select>
        <el-button type="primary"
                   @click="handleQuery"
@@ -130,8 +131,8 @@
                         clearable>
                <el-option label="零售客户"
                           value="零售客户" />
                <el-option label="进销商客户"
                           value="进销商客户" />
                <el-option label="经销商客户"
                           value="经销商客户" />
              </el-select>
            </el-form-item>
          </el-col>
@@ -280,7 +281,8 @@
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitReminderForm">确认</el-button>
          <el-button type="primary"
                     @click="submitReminderForm">确认</el-button>
          <el-button @click="closeReminderDialog">取消</el-button>
        </div>
      </template>
@@ -363,7 +365,8 @@
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitNegotiationForm">确认</el-button>
          <el-button type="primary"
                     @click="submitNegotiationForm">确认</el-button>
          <el-button @click="closeNegotiationDialog">取消</el-button>
        </div>
      </template>
@@ -412,14 +415,14 @@
                <span class="info-value">{{ detailForm.companyAddress }}</span>
              </div>
            </el-col>
            <el-col :span="12">
            <!-- <el-col :span="12">
              <div class="info-item">
                <span class="info-label">银行基本户:</span>
                <span class="info-value">{{ detailForm.basicBankAccount }}</span>
              </div>
            </el-col>
            </el-col> -->
          </el-row>
          <el-row :gutter="20">
          <!-- <el-row :gutter="20">
            <el-col :span="12">
              <div class="info-item">
                <span class="info-label">银行账号:</span>
@@ -432,7 +435,7 @@
                <span class="info-value">{{ detailForm.bankCode }}</span>
              </div>
            </el-col>
          </el-row>
          </el-row> -->
          <el-row :gutter="20">
            <el-col :span="12">
              <div class="info-item">
@@ -464,14 +467,9 @@
        </div>
      </div>
      <!-- æ´½è°ˆè¿›åº¦è®°å½• -->
      <div class="detail-section">
      <!-- <div class="detail-section">
        <div class="section-header">
          <h3 class="section-title">洽谈进度记录</h3>
          <el-button type="primary"
                     size="small"
                     @click="openNegotiationDialog(detailForm)">
            æ·»åŠ è¿›åº¦
          </el-button>
        </div>
        <el-table :data="negotiationRecords"
                  border
@@ -501,7 +499,6 @@
                  <Paperclip />
                </el-icon>
                é™„ä»¶
                <!-- {{ row.fileList && row.fileList.length > 0 ? row.fileList.length : '上传' }} -->
              </el-button>
            </template>
          </el-table-column>
@@ -526,7 +523,7 @@
             class="no-records">
          æš‚无洽谈进度记录
        </div>
      </div>
      </div> -->
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="closeDetailDialog">关闭</el-button>
@@ -622,7 +619,14 @@
    addReturnVisit,
    getReturnVisit,
  } from "@/api/basicData/customerFile.js";
  import {listCustomer, getCustomer, addCustomer, updateCustomer, delCustomer, backCustomer} from "@/api/basicData/customer.js";
  import {
    listCustomer,
    getCustomer,
    addCustomer,
    updateCustomer,
    delCustomer,
    backCustomer,
  } from "@/api/basicData/customer.js";
  import { ElMessageBox } from "element-plus";
  import { userListNoPage } from "@/api/system/user.js";
  import useUserStore from "@/store/modules/user";
@@ -654,7 +658,7 @@
  const negotiationFormRef = ref();
  const negotiationForm = reactive({
    customerName: "",
        customerId: "",
    customerId: "",
    followUpMethod: "",
    followUpLevel: "",
    followUpTime: "",
@@ -738,16 +742,16 @@
      prop: "contactPhone",
      width: 150,
    },
    {
      label: "跟进进度",
      prop: "followUpLevel",
      width: 120,
    },
    {
      label: "跟进时间",
      prop: "followUpTime",
      width: 120,
    },
    // {
    //   label: "跟进进度",
    //   prop: "followUpLevel",
    //   width: 120,
    // },
    // {
    //   label: "跟进时间",
    //   prop: "followUpTime",
    //   width: 120,
    // },
    {
      label: "银行基本户",
      prop: "basicBankAccount",
@@ -767,7 +771,7 @@
      label: "维护人",
      prop: "maintainer",
    },
    {
    /*{
      label: "客户来源",
      prop: "type",
      dataType: "tag",
@@ -784,7 +788,7 @@
        }
        return "success";
      },
    },
    },*/
    {
      label: "维护时间",
      prop: "maintenanceTime",
@@ -800,36 +804,31 @@
        {
          name: "编辑",
          type: "text",
          showHide: row => !isCustomerEditLocked(row),
          clickFun: row => {
            if (isCustomerEditLocked(row)) {
              proxy.$modal.msgWarning("已被销售模块引用的私海客户不能编辑");
              return;
            }
            openForm("edit", row);
          },
        },
                {
                    name: "添加洽谈进度",
                    type: "text",
                    clickFun: row => {
                        openNegotiationDialog(row);
                    },
                },
        // {
        //   name: "添加洽谈进度",
        //   type: "text",
        //   clickFun: row => {
        //     openNegotiationDialog(row);
        //   },
        // },
        // {
        //   name: "回访提醒",
        //   type: "text",
        //   clickFun: row => {
        //     openReminderDialog(row);
        //   },
        // },
        {
          name: "回访提醒",
          name: "详情",
          type: "text",
          clickFun: row => {
            openReminderDialog(row);
            openDetailDialog(row);
          },
        },
                {
                    name: "详情",
                    type: "text",
                    clickFun: row => {
                        openDetailDialog(row);
                    },
                },
      ],
    },
  ]);
@@ -860,7 +859,7 @@
    searchForm: {
      customerName: "",
      customerType: "",
      type: 0
      type: 0,
    },
    form: {
      customerName: "",
@@ -875,7 +874,7 @@
      bankAccount: "",
      bankCode: "",
      customerType: "",
      type: 0
      type: 0,
    },
    rules: {
      customerName: [{ required: true, message: "请输入", trigger: "blur" }],
@@ -908,7 +907,7 @@
    // ä¸Šä¼ çš„地址
    url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
    data: {
      type: 0
      type: 0,
    },
    // æ–‡ä»¶ä¸Šä¼ å‰çš„回调
    beforeUpload: file => {
@@ -1006,10 +1005,6 @@
  }
  // æ‰“开弹框
  const openForm = (type, row) => {
    if (type === "edit" && isCustomerEditLocked(row)) {
      proxy.$modal.msgWarning("已被销售模块引用的私海客户不能编辑");
      return;
    }
    operationType.value = type;
    form.value = {};
    form.value.maintainer = userStore.nickName;
@@ -1038,12 +1033,6 @@
      });
    }
    dialogFormVisible.value = true;
  };
  const isCustomerEditLocked = row => {
    const salesReferenced = Number(row?.salesReferenceFlag || 0) === 1;
    const customerType = Number(row?.type);
    const usageStatus = Number(row?.usageStatus || 0);
    return salesReferenced && (customerType === 0 || (customerType === 1 && usageStatus === 1));
  };
  // æäº¤è¡¨å•
  const submitForm = () => {
@@ -1101,7 +1090,7 @@
      type: "warning",
    })
      .then(() => {
        proxy.download("/basic/customer/export", {type: 0}, "客户档案.xlsx");
        proxy.download("/basic/customer/export", { type: 0 }, "客户档案.xlsx");
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
@@ -1214,7 +1203,7 @@
        if (reminderForm.id) {
          submitvalue.value = {
            id: reminderForm.id,
                        customerId: currentCustomerId.value,
            customerId: currentCustomerId.value,
            isEnabled: reminderForm.reminderSwitch ? 1 : 0,
            content: reminderForm.reminderContent,
            reminderTime: reminderForm.reminderTime,
@@ -1333,7 +1322,7 @@
    // å°†å½“前记录数据填充到表单
    Object.assign(negotiationForm, {
      customerName: row.customerName,
            customerId: row.customerId,
      customerId: row.customerId,
      followUpMethod: row.followUpMethod,
      followUpLevel: row.followUpLevel,
      followUpTime: row.followUpTime,
@@ -1461,7 +1450,7 @@
  const downloadAttachment = row => {
    if (row.url) {
      // proxy.download(row.url, {}, row.name);
            proxy.$download.byUrl(row.url, row.originalFilename);
      proxy.$download.byUrl(row.url, row.originalFilename);
    } else {
      proxy.$modal.msgError("下载链接不存在");
    }
src/views/basicData/customerFileOpenSea/index.vue
@@ -1,6 +1,7 @@
<template>
  <div class="app-container">
    <div class="search_form" style="margin-bottom: 20px;">
    <div class="search_form"
         style="margin-bottom: 20px;">
      <div>
        <span class="search_title">客户名称:</span>
        <el-input v-model="searchForm.customerName"
@@ -17,8 +18,8 @@
                   @change="handleQuery">
          <el-option label="零售客户"
                     value="零售客户" />
          <el-option label="进销商客户"
                     value="进销商客户" />
          <el-option label="经销商客户"
                     value="经销商客户" />
        </el-select>
        <el-button type="primary"
                   @click="handleQuery"
@@ -92,7 +93,7 @@
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
        <!-- <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="银行基本户:"
                          prop="basicBankAccount">
@@ -109,16 +110,16 @@
                        clearable />
            </el-form-item>
          </el-col>
        </el-row>
        </el-row> -->
        <el-row :gutter="30">
          <el-col :span="12">
          <!-- <el-col :span="12">
            <el-form-item label="开户行号:"
                          prop="bankCode">
              <el-input v-model="form.bankCode"
                        placeholder="请输入"
                        clearable />
            </el-form-item>
          </el-col>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="客户分类:"
                          prop="customerType">
@@ -127,8 +128,8 @@
                         clearable>
                <el-option label="零售客户"
                           value="零售客户" />
                <el-option label="进销商客户"
                           value="进销商客户" />
                <el-option label="经销商客户"
                           value="经销商客户" />
              </el-select>
            </el-form-item>
          </el-col>
@@ -199,75 +200,6 @@
          <el-button type="primary"
                     @click="submitForm">确认</el-button>
          <el-button @click="closeDia">取消</el-button>
        </div>
      </template>
    </el-dialog>
    <el-dialog v-model="assignDialogVisible"
               title="分配客户"
               width="500px"
               @close="closeAssignDialog">
      <el-form :model="assignForm"
               :rules="assignRules"
               ref="assignFormRef"
               label-width="100px">
        <el-form-item label="客户名称">
          <el-input v-model="assignForm.customerName"
                    disabled />
        </el-form-item>
        <el-form-item label="分配人员"
                      prop="boundId">
          <el-select v-model="assignForm.boundId"
                     placeholder="请选择分配人员"
                     style="width: 100%"
                     filterable>
            <el-option v-for="item in userList"
                       :key="item.userId || item.nickName"
                       :label="item.nickName"
                       :value="item.userId" />
          </el-select>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary"
                     @click="submitAssignForm">确认</el-button>
          <el-button @click="closeAssignDialog">取消</el-button>
        </div>
      </template>
    </el-dialog>
    <el-dialog v-model="shareDialogVisible"
               title="共享客户"
               width="500px"
               @close="closeShareDialog">
      <el-form :model="shareForm"
               :rules="shareRules"
               ref="shareFormRef"
               label-width="100px">
        <el-form-item label="客户名称">
          <el-input v-model="shareForm.customerName"
                    disabled />
        </el-form-item>
        <el-form-item label="共享人员"
                      prop="boundIds">
          <el-select v-model="shareForm.boundIds"
                     placeholder="请选择共享人员"
                     style="width: 100%"
                     filterable
                     multiple
                     collapse-tags
                     collapse-tags-tooltip>
            <el-option v-for="item in userList"
                       :key="item.userId || item.nickName"
                       :label="item.nickName"
                       :value="item.userId" />
          </el-select>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary"
                     @click="submitShareForm">确认</el-button>
          <el-button @click="closeShareDialog">取消</el-button>
        </div>
      </template>
    </el-dialog>
@@ -346,7 +278,8 @@
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitReminderForm">确认</el-button>
          <el-button type="primary"
                     @click="submitReminderForm">确认</el-button>
          <el-button @click="closeReminderDialog">取消</el-button>
        </div>
      </template>
@@ -429,7 +362,8 @@
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitNegotiationForm">确认</el-button>
          <el-button type="primary"
                     @click="submitNegotiationForm">确认</el-button>
          <el-button @click="closeNegotiationDialog">取消</el-button>
        </div>
      </template>
@@ -478,14 +412,14 @@
                <span class="info-value">{{ detailForm.companyAddress }}</span>
              </div>
            </el-col>
            <el-col :span="12">
            <!-- <el-col :span="12">
              <div class="info-item">
                <span class="info-label">银行基本户:</span>
                <span class="info-value">{{ detailForm.basicBankAccount }}</span>
              </div>
            </el-col>
            </el-col> -->
          </el-row>
          <el-row :gutter="20">
          <!-- <el-row :gutter="20">
            <el-col :span="12">
              <div class="info-item">
                <span class="info-label">银行账号:</span>
@@ -498,7 +432,7 @@
                <span class="info-value">{{ detailForm.bankCode }}</span>
              </div>
            </el-col>
          </el-row>
          </el-row> -->
          <el-row :gutter="20">
            <el-col :span="12">
              <div class="info-item">
@@ -530,14 +464,9 @@
        </div>
      </div>
      <!-- æ´½è°ˆè¿›åº¦è®°å½• -->
      <div class="detail-section">
      <!-- <div class="detail-section">
        <div class="section-header">
          <h3 class="section-title">洽谈进度记录</h3>
          <el-button type="primary"
                     size="small"
                     @click="openNegotiationDialog(detailForm)">
            æ·»åŠ è¿›åº¦
          </el-button>
        </div>
        <el-table :data="negotiationRecords"
                  border
@@ -567,7 +496,6 @@
                  <Paperclip />
                </el-icon>
                é™„ä»¶
                <!-- {{ row.fileList && row.fileList.length > 0 ? row.fileList.length : '上传' }} -->
              </el-button>
            </template>
          </el-table-column>
@@ -592,7 +520,7 @@
             class="no-records">
          æš‚无洽谈进度记录
        </div>
      </div>
      </div> -->
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="closeDetailDialog">关闭</el-button>
@@ -690,41 +618,17 @@
  } from "@/api/basicData/customerFile.js";
  import {
    listCustomer,
    addCustomer,
    delCustomer,
    updateCustomer,
    getCustomer,
    assignCustomer,
    recycleCustomer,
    shareCustomer,
    addCustomer,
    updateCustomer,
    delCustomer,
  } from "@/api/basicData/customer.js";
  import { ElMessageBox } from "element-plus";
  import { userListNoPage } from "@/api/system/user.js";
  import useUserStore from "@/store/modules/user";
  import { getToken } from "@/utils/auth.js";
  const { proxy } = getCurrentInstance();
  const userStore = useUserStore();
  const assignDialogVisible = ref(false);
  const assignFormRef = ref();
  const assignForm = reactive({
    id: undefined,
    customerName: "",
    boundId: undefined,
  });
  const assignRules = {
    boundId: [{ required: true, message: "请选择分配人员", trigger: "change" }],
  };
  const shareDialogVisible = ref(false);
  const shareFormRef = ref();
  const shareForm = reactive({
    id: undefined,
    customerName: "",
    boundIds: [],
  });
  const shareRules = {
    boundIds: [{ required: true, message: "请选择共享人员", trigger: "change" }],
  };
  // å›žè®¿æé†’相关
  const reminderDialogVisible = ref(false);
@@ -822,7 +726,7 @@
    },
    {
      label: "地址及联系方式",
      prop: "addressPhone",
      prop: "companyAddress",
      width: 250,
    },
    {
@@ -844,116 +748,65 @@
    //   prop: "followUpTime",
    //   width: 120,
    // },
    {
      label: "银行基本户",
      prop: "basicBankAccount",
      width: 220,
    },
    {
      label: "银行账号",
      prop: "bankAccount",
      width: 220,
    },
    {
      label: "开户行号",
      prop: "bankCode",
      width: 220,
    },
    // {
    //   label: "银行基本户",
    //   prop: "basicBankAccount",
    //   width: 220,
    // },
    // {
    //   label: "银行账号",
    //   prop: "bankAccount",
    //   width: 220,
    // },
    // {
    //   label: "开户行号",
    //   prop: "bankCode",
    //   width: 220,
    // },
    {
      label: "维护人",
      prop: "maintainer",
    },
        {
            label: "维护时间",
            prop: "maintenanceTime",
            width: 100,
        },
    {
      label: "领用人",
      prop: "usageUserName",
      width: 120,
            fixed: "right",
    },
    {
      label: "领用状态",
      prop: "usageStatus",
      dataType: "tag",
      label: "维护时间",
      prop: "maintenanceTime",
      width: 100,
            fixed: "right",
      formatData: value => {
        if (value === 1 || value === "1") {
          return "已领用";
        }
        return "未领用";
      },
      formatType: value => {
        if (value === 1 || value === "1") {
          return "success";
        }
        return "info";
      },
    },
        {
            label: "共享人",
            prop: "togetherUserNames",
            width: 120,
            fixed: "right",
        },
    {
      dataType: "action",
      label: "操作",
      align: "center",
      fixed: "right",
      width: 200,
      width: 140,
      operation: [
        {
          name: "分配",
          name: "编辑",
          type: "text",
          showHide: row => row.usageStatus != 1,
          clickFun: row => {
            openAssignDialog(row);
            openForm("edit", row);
          },
        },
        {
          name: "回收",
          type: "text",
          disabled: row => isCustomerRecoveryLocked(row),
          showHide: row => row.usageStatus == 1,
          clickFun: row => {
            if (isCustomerRecoveryLocked(row)) {
              proxy.$modal.msgWarning("已领用并且被销售模块引用的公海客户不能回收");
              return;
            }
            recycle(row);
          },
        },
                {
                    name: "共享",
                    type: "text",
                    showHide: row => row.usageStatus == 1,
                    clickFun: row => {
                        openShareDialog(row);
                    },
                },
                {
                    name: "编辑",
                    type: "text",
          disabled: row => isCustomerEditLocked(row),
          clickFun: row => {
            if (isCustomerEditLocked(row)) {
              proxy.$modal.msgWarning("已领用并且被销售模块引用的公海客户不能编辑");
              return;
            }
                        openForm("edit", row);
                    },
                },
        // {
        //   name: "详情",
        //   name: "添加洽谈进度",
        //   type: "text",
        //   clickFun: row => {
        //     openDetailDialog(row);
        //     openNegotiationDialog(row);
        //   },
        // },
        // {
        //   name: "回访提醒",
        //   type: "text",
        //   clickFun: row => {
        //     openReminderDialog(row);
        //   },
        // },
        {
          name: "详情",
          type: "text",
          clickFun: row => {
            openDetailDialog(row);
          },
        },
      ],
    },
  ]);
@@ -984,7 +837,6 @@
    searchForm: {
      customerName: "",
      customerType: "",
      type: 1
    },
    form: {
      customerName: "",
@@ -999,15 +851,14 @@
      bankAccount: "",
      bankCode: "",
      customerType: "",
      type: 1
    },
    rules: {
      customerName: [{ required: true, message: "请输入", trigger: "blur" }],
      taxpayerIdentificationNumber: [
        { required: true, message: "请输入", trigger: "blur" },
      ],
      companyAddress: [{ required: true, message: "请输入", trigger: "blur" }],
      companyPhone: [{ required: true, message: "请输入", trigger: "blur" }],
      // taxpayerIdentificationNumber: [
      //   { required: true, message: "请输入", trigger: "blur" },
      // ],
      // companyAddress: [{ required: true, message: "请输入", trigger: "blur" }],
      // companyPhone: [{ required: true, message: "请输入", trigger: "blur" }],
      // contactPerson: [{ required: true, message: "请输入", trigger: "blur" }],
      // contactPhone: [{ required: true, message: "请输入", trigger: "blur" }],
      maintainer: [{ required: false, message: "请选择", trigger: "change" }],
@@ -1031,9 +882,7 @@
    headers: { Authorization: "Bearer " + getToken() },
    // ä¸Šä¼ çš„地址
    url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
    data: {
      type: 1
    },
    data: {},
    // æ–‡ä»¶ä¸Šä¼ å‰çš„回调
    beforeUpload: file => {
      console.log("文件即将上传", file);
@@ -1104,8 +953,7 @@
  };
  const getList = () => {
    tableLoading.value = true;
    const { total, ...queryPage } = page;
    listCustomer({ ...searchForm.value, ...queryPage }).then(res => {
    listCustomer({ ...searchForm.value, ...page }).then(res => {
      tableLoading.value = false;
      tableData.value = res.data.records;
      page.total = res.data.total;
@@ -1131,10 +979,6 @@
  }
  // æ‰“开弹框
  const openForm = (type, row) => {
    if (type === "edit" && isCustomerEditLocked(row)) {
      proxy.$modal.msgWarning("已领用并且被销售模块引用的公海客户不能编辑");
      return;
    }
    operationType.value = type;
    form.value = {};
    form.value.maintainer = userStore.nickName;
@@ -1145,7 +989,6 @@
      },
    ];
    form.value.maintenanceTime = getCurrentDate();
    form.value.type = 1;
    userListNoPage().then(res => {
      userList.value = res.data;
    });
@@ -1164,11 +1007,6 @@
    }
    dialogFormVisible.value = true;
  };
  const isCustomerSalesReferenced = row => Number(row?.salesReferenceFlag || 0) === 1;
  const isCustomerRecoveryLocked = row => Number(row?.usageStatus || 0) === 1 && isCustomerSalesReferenced(row);
  const isCustomerEditLocked = row => isCustomerSalesReferenced(row) && (
    Number(row?.type) === 0 || (Number(row?.type) === 1 && Number(row?.usageStatus || 0) === 1)
  );
  // æäº¤è¡¨å•
  const submitForm = () => {
    proxy.$refs["formRef"].validate(valid => {
@@ -1217,92 +1055,6 @@
    proxy.resetForm("formRef");
    dialogFormVisible.value = false;
  };
  const ensureUserList = () => {
    if (userList.value.length) {
      return Promise.resolve();
    }
    return userListNoPage().then(res => {
      userList.value = res.data || [];
    });
  };
  const openAssignDialog = row => {
    assignForm.id = row.id;
    assignForm.customerName = row.customerName;
    assignForm.boundId = undefined;
    ensureUserList().then(() => {
      assignDialogVisible.value = true;
    });
  };
  const closeAssignDialog = () => {
    proxy.resetForm("assignFormRef");
    assignForm.id = undefined;
    assignForm.customerName = "";
    assignForm.boundId = undefined;
    assignDialogVisible.value = false;
  };
  const openShareDialog = row => {
    shareForm.id = row.id;
    shareForm.customerName = row.customerName;
    shareForm.boundIds = row.userIds || [];
    ensureUserList().then(() => {
      shareDialogVisible.value = true;
    });
  };
  const closeShareDialog = () => {
    proxy.resetForm("shareFormRef");
    shareForm.id = undefined;
    shareForm.customerName = "";
    shareForm.boundIds = [];
    shareDialogVisible.value = false;
  };
  const submitAssignForm = () => {
    proxy.$refs.assignFormRef.validate(valid => {
      if (!valid) {
        return;
      }
      assignCustomer({
        id: assignForm.id,
        usageUser: assignForm.boundId,
      }).then(() => {
        proxy.$modal.msgSuccess("分配成功");
        closeAssignDialog();
        getList();
      });
    });
  };
  const submitShareForm = () => {
    proxy.$refs.shareFormRef.validate(valid => {
      if (!valid) {
        return;
      }
      shareCustomer({
        id: shareForm.id,
        userIds: shareForm.boundIds,
      }).then(() => {
        proxy.$modal.msgSuccess("共享成功");
        closeShareDialog();
        getList();
      });
    });
  };
  const recycle = row => {
    ElMessageBox.confirm("确认回收客户“" + row.customerName + "”吗?", "回收提示", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
      .then(() => {
        return recycleCustomer({id: row.id}).then(() => {
          proxy.$modal.msgSuccess("回收成功");
          getList();
        })
      })
      .catch(error => {
        if (error === "cancel" || error === "close") {
          proxy.$modal.msg("已取消");
        }
      });
  };
  // å¯¼å‡º
  const handleOut = () => {
    ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
@@ -1311,7 +1063,7 @@
      type: "warning",
    })
      .then(() => {
        proxy.download("/basic/customer/export", {type: 1}, "客户档案.xlsx");
        proxy.download("/basic/customer/export", {}, "客户档案.xlsx");
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
@@ -1321,14 +1073,6 @@
  const handleDelete = () => {
    let ids = [];
    if (selectedRows.value.length > 0) {
      // æ£€æŸ¥æ˜¯å¦æœ‰ä»–人维护的数据
      const unauthorizedData = selectedRows.value.filter(
        item => item.maintainer !== userStore.nickName
      );
      if (unauthorizedData.length > 0) {
        proxy.$modal.msgWarning("不可删除他人维护的数据");
        return;
      }
      ids = selectedRows.value.map(item => item.id);
    } else {
      proxy.$modal.msgWarning("请选择数据");
@@ -1342,7 +1086,7 @@
      .then(() => {
        tableLoading.value = true;
        delCustomer(ids)
          .then(res => {
          .then(() => {
            proxy.$modal.msgSuccess("删除成功");
            getList();
          })
@@ -1411,8 +1155,6 @@
          };
        }
        console.log("提交回访提醒数据:", submitvalue.value);
        // è°ƒç”¨æŽ¥å£
        addReturnVisit(submitvalue.value)
          .then(res => {
@@ -1440,14 +1182,6 @@
    negotiationForm.followUpTime = "";
    negotiationForm.followerUserName = userStore.nickName; // é»˜è®¤å½“前登录人
    negotiationForm.content = "";
    // {
    //     "customerId": 152,
    //     "followUpMethod": "电话沟通",
    //     "followUpLevel": "没有意向",
    //     "followUpTime": "2026-03-04T15:30:00",
    //     "followerUserName": "管理员账号",
    //     "content": "111"
    // }
    negotiationDialogVisible.value = true;
  };
@@ -1469,23 +1203,6 @@
        if (isEdit) {
          // ä¿®æ”¹æ“ä½œ
          console.log("修改洽谈进度数据:", negotiationForm);
          // è¿™é‡Œå¯ä»¥è°ƒç”¨æ›´æ–°æŽ¥å£
          // å®žé™…项目中需要根据后端接口进行调整
          // ç¤ºä¾‹ï¼šupdateCustomerFollow(negotiationForm).then(res => {
          //   // æ›´æ–°æœ¬åœ°æ•°æ®
          //   const index = negotiationForm.editIndex;
          //   negotiationRecords.value[index] = {
          //     followUpTime: negotiationForm.followUpTime,
          //     followUpMethod: negotiationForm.followUpMethod,
          //     followUpLevel: negotiationForm.followUpLevel,
          //     followerUserName: negotiationForm.followerUserName,
          //     content: negotiationForm.content,
          //     id: negotiationForm.id,
          //   };
          //   proxy.$modal.msgSuccess("修改成功");
          //   closeNegotiationDialog();
          // });
          updateCustomerFollow(negotiationForm).then(res => {
            // æ›´æ–°æœ¬åœ°æ•°æ®
            getCustomer(negotiationForm.customerId).then(res => {
@@ -1520,7 +1237,6 @@
  // æ‰“开详情弹窗
  const openDetailDialog = row => {
    // è°ƒç”¨getCustomer接口获取客户详情
    getCustomer(row.id).then(res => {
      // å¡«å……客户基本信息
      Object.assign(detailForm, res.data);
@@ -1670,7 +1386,7 @@
  const downloadAttachment = row => {
    if (row.url) {
      // proxy.download(row.url, {}, row.name);
            proxy.$download.byUrl(row.url, row.originalFilename);
      proxy.$download.byUrl(row.url, row.originalFilename);
    } else {
      proxy.$modal.msgError("下载链接不存在");
    }
src/views/basicData/parameterMaintenance/index.vue
@@ -50,7 +50,7 @@
                      prop="paramCode">
          <el-input v-model="formData.paramCode"
                    disabled
                    placeholder="保存后自动生成" />
                    placeholder="自动生成" />
        </el-form-item>
        <el-form-item label="参数名称"
                      prop="paramName">
@@ -82,14 +82,6 @@
                       value="2" />
          </el-select>
        </el-form-item> -->
        <el-form-item label="创建时间"
                      prop="createTime">
          <el-date-picker v-model="formCreateTimeDate"
                          type="date"
                          placeholder="选择日期"
                          value-format="YYYY-MM-DD"
                          style="width: 100%" />
        </el-form-item>
        <el-form-item label="单位"
                      prop="unit">
          <el-input v-model="formData.unit"
@@ -215,8 +207,7 @@
</template>
<script setup>
  import { onMounted, ref, reactive, computed } from "vue";
  import dayjs from "dayjs";
  import { onMounted, ref, reactive } from "vue";
  import {
    parameterListPage,
    addParameter,
@@ -232,6 +223,7 @@
  import { deptTreeSelect } from "@/api/system/user.js";
  import PIMTable from "@/components/PIMTable/PIMTable.vue";
  import { ElMessage, ElMessageBox } from "element-plus";
  import { parseTime } from "@/utils/ruoyi";
  const tableColumn = ref([
    {
@@ -302,6 +294,10 @@
    {
      label: "创建时间",
      prop: "createTime",
      formatData: val => {
        if (!val) return "";
        return parseTime(val, "{y}-{m}-{d} {h}:{i}:{s}");
      },
    },
    {
      label: "操作",
@@ -350,7 +346,6 @@
    remark: "",
    isRequired: 0,
    paramFormat: "",
    createTime: "",
  });
  const rules = reactive({
    paramName: [{ required: true, message: "请输入参数名称", trigger: "blur" }],
@@ -370,12 +365,6 @@
        },
      },
    ],
  });
  const formCreateTimeDate = computed({
    get: () => (formData.createTime ? String(formData.createTime).split(" ")[0] : ""),
    set: (value) => {
      formData.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
    },
  });
  // const productTypes = ref([]);
  const isEdit = ref(false);
@@ -535,7 +524,6 @@
    formData.unit = "";
    formData.remark = "";
    formData.isRequired = 0;
    formData.createTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
    dialogVisible.value = true;
  };
@@ -554,7 +542,6 @@
    formData.remark = row.remark || "";
    formData.paramFormat = row.paramFormat || "";
    formData.isRequired = row.isRequired || 0;
    formData.createTime = row.createTime || "";
    dialogVisible.value = true;
  };
src/views/basicData/product/ProductSelectDialog.vue
@@ -2,11 +2,11 @@
  <el-dialog v-model="visible" title="选择产品" width="900px" destroy-on-close :close-on-click-modal="false">
    <el-form :inline="true" :model="query" class="mb-2">
      <el-form-item label="产品名称">
        <el-input v-model="query.productName" placeholder="输入产品名称" clearable @keyup.enter="onSearch" />
        <el-input v-model="query.productName" placeholder="输入产品名称" clearable @keyup.enter="onSearch" style="width: 200px" />
      </el-form-item>
      <el-form-item label="产品型号">
        <el-input v-model="query.model" placeholder="输入产品型号" clearable @keyup.enter="onSearch" />
        <el-input v-model="query.model" placeholder="输入产品型号" clearable @keyup.enter="onSearch" style="width: 200px" />
      </el-form-item>
      <el-form-item>
@@ -20,9 +20,10 @@
      @selection-change="handleSelectionChange" @select="handleSelect">
      <el-table-column type="selection" width="55" />
      <el-table-column type="index" label="序号" width="60" />
      <el-table-column prop="productName" label="产品名称" min-width="160" />
      <el-table-column prop="model" label="产品型号" min-width="200" />
      <el-table-column prop="unit" label="单位" min-width="160" />
      <el-table-column prop="topProductName" label="产品大类" min-width="120" />
      <el-table-column prop="productName" label="产品名称" min-width="140" />
      <el-table-column prop="model" label="产品型号" min-width="180" />
      <el-table-column prop="unit" label="单位" min-width="100" />
    </el-table>
    <div class="mt-3 flex justify-end">
src/views/basicData/product/index.vue
@@ -104,8 +104,10 @@
            <el-form-item label="产品名称:"
                          prop="productName">
              <el-input v-model="form.productName"
                        type="textarea"
                        resize="vertical"
                        placeholder="请输入产品名称"
                        maxlength="20"
                        maxlength="50"
                        show-word-limit
                        clearable
                        @keydown.enter.prevent />
@@ -132,17 +134,15 @@
               :rules="modelRules"
               ref="modelFormRef">
        <el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="产品编号:"
                            prop="productCode">
                <el-input v-model="modelForm.productCode"
                          placeholder="请输入产品编号"
                          clearable
                          @keydown.enter.prevent />
              </el-form-item>
            </el-col>
          </el-row>
          <el-col :span="24">
            <el-form-item label="产品编号:"
                          prop="productCode">
              <el-input v-model="modelForm.productCode"
                        placeholder="请输入产品编号"
                        clearable
                        @keydown.enter.prevent />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="规格型号:"
                          prop="model">
@@ -335,7 +335,7 @@
    rules: {
      productName: [
        { required: true, message: "请输入", trigger: "blur" },
        { max: 20, message: "产品名称不能超过20个字符", trigger: "blur" },
        { max: 50, message: "产品名称不能超过50个字符", trigger: "blur" },
      ],
    },
    modelForm: {
src/views/basicData/supplierManage/components/BlacklistTab.vue
@@ -3,179 +3,126 @@
    <div class="search_form">
      <div>
        <span class="search_title">供应商档案:</span>
        <el-input
            v-model="searchForm.supplierName"
            style="width: 240px"
            placeholder="输入供应商名称搜索"
            @change="handleQuery"
            clearable
            :prefix-icon="Search"
        />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
        >搜索</el-button
        >
        <el-input v-model="searchForm.supplierName"
                  style="width: 240px"
                  placeholder="输入供应商名称搜索"
                  @change="handleQuery"
                  clearable
                  :prefix-icon="Search" />
        <el-button type="primary"
                   @click="handleQuery"
                   style="margin-left: 10px">搜索</el-button>
      </div>
      <div>
        <el-button @click="handleOut">导出</el-button>
        <el-button type="danger" plain @click="handleDelete">删除</el-button>
        <el-button type="danger"
                   plain
                   @click="handleDelete">删除</el-button>
      </div>
    </div>
    <div class="table_list">
      <PIMTable
          rowKey="id"
          :column="tableColumn"
          :tableData="tableData"
          :page="page"
          :isSelection="true"
          @selection-change="handleSelectionChange"
          :tableLoading="tableLoading"
          @pagination="pagination"
      ></PIMTable>
      <PIMTable rowKey="id"
                :column="tableColumn"
                :tableData="tableData"
                :page="page"
                :isSelection="true"
                @selection-change="handleSelectionChange"
                :tableLoading="tableLoading"
                @pagination="pagination"></PIMTable>
    </div>
    <el-dialog
        v-model="dialogFormVisible"
        :title="operationType === 'add' ? '新增供应商信息' : '编辑供应商信息'"
        width="70%"
        @close="closeDia"
    >
      <el-form
          :model="form"
          label-width="140px"
          label-position="top"
          :rules="rules"
          ref="formRef"
      >
    <el-dialog v-model="dialogFormVisible"
               :title="operationType === 'add' ? '新增供应商信息' : '编辑供应商信息'"
               width="70%"
               @close="closeDia">
      <el-form :model="form"
               label-width="140px"
               label-position="top"
               :rules="rules"
               ref="formRef">
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="供应商名称:" prop="supplierName">
              <el-input
                  v-model="form.supplierName"
                  placeholder="请输入"
                  clearable
              />
            <el-form-item label="供应商名称:"
                          prop="supplierName">
              <el-input v-model="form.supplierName"
                        placeholder="请输入"
                        clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
                label="纳税人识别号:"
                prop="taxpayerIdentificationNum"
            >
              <el-input
                  v-model="form.taxpayerIdentificationNum"
                  placeholder="请输入"
                  clearable
              />
            <el-form-item label="纳税人识别号:"
                          prop="taxpayerIdentificationNum">
              <el-input v-model="form.taxpayerIdentificationNum"
                        placeholder="请输入"
                        clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="24">
            <el-form-item label="公司地址:"
                          prop="companyAddress">
              <el-input v-model="form.companyAddress"
                        placeholder="请输入"
                        clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="公司地址:" prop="companyAddress">
              <el-input
                  v-model="form.companyAddress"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司电话:" prop="companyPhone">
              <el-input
                  v-model="form.companyPhone"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="开户行:" prop="bankAccountName">
              <el-input
                  v-model="form.bankAccountName"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="账号:" prop="bankAccountNum">
              <el-input
                  v-model="form.bankAccountNum"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="联系人:" prop="contactUserName">
              <el-input
                  v-model="form.contactUserName"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系电话:" prop="contactUserPhone">
              <el-input
                  v-model="form.contactUserPhone"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="维护人:" prop="maintainUserId">
              <el-select
                  v-model="form.maintainUserId"
                  placeholder="请选择"
                  clearable
                  disabled
              >
                <el-option
                    v-for="item in userList"
                    :key="item.nickName"
                    :label="item.nickName"
                    :value="item.userId"
                />
            <el-form-item label="维护人:"
                          prop="maintainUserId">
              <el-select v-model="form.maintainUserId"
                         placeholder="请选择"
                         clearable
                         disabled>
                <el-option v-for="item in userList"
                           :key="item.nickName"
                           :label="item.nickName"
                           :value="item.userId" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="维护时间:" prop="maintainTime">
              <el-date-picker
                  style="width: 100%"
                  v-model="form.maintainTime"
                  value-format="YYYY-MM-DD"
                  format="YYYY-MM-DD"
                  type="date"
                  placeholder="请选择"
                  clearable
              />
            <el-form-item label="维护时间:"
                          prop="maintainTime">
              <el-date-picker style="width: 100%"
                              v-model="form.maintainTime"
                              value-format="YYYY-MM-DD"
                              format="YYYY-MM-DD"
                              type="date"
                              placeholder="请选择"
                              clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="供应商类型:" prop="supplierType">
              <el-select v-model="form.supplierType" placeholder="请选择" clearable>
                <el-option label="甲" value="甲" />
                <el-option label="乙" value="乙" />
                <el-option label="丙" value="丙" />
                <el-option label="丁" value="丁" />
          <!-- <el-col :span="12">
            <el-form-item label="供应商类型:"
                          prop="supplierType">
              <el-select v-model="form.supplierType"
                         placeholder="请选择"
                         clearable>
                <el-option label="甲"
                           value="甲" />
                <el-option label="乙"
                           value="乙" />
                <el-option label="丙"
                           value="丙" />
                <el-option label="丁"
                           value="丁" />
              </el-select>
            </el-form-item>
          </el-col>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="是否白名单:" prop="isWhite">
              <el-select v-model="form.isWhite" placeholder="请选择" clearable>
                <el-option label="是" :value="0" />
                <el-option label="否" :value="1" />
            <el-form-item label="是否白名单:"
                          prop="isWhite">
              <el-select v-model="form.isWhite"
                         placeholder="请选择"
                         clearable>
                <el-option label="是"
                           :value="0" />
                <el-option label="否"
                           :value="1" />
              </el-select>
            </el-form-item>
          </el-col>
@@ -183,50 +130,44 @@
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确认</el-button>
          <el-button type="primary"
                     @click="submitForm">确认</el-button>
          <el-button @click="closeDia">取消</el-button>
        </div>
      </template>
    </el-dialog>
    <!-- ä¾›åº”商导入对话框 -->
    <el-dialog
        :title="upload.title"
        v-model="upload.open"
        width="400px"
        append-to-body
    >
      <el-upload
          ref="uploadRef"
          :limit="1"
          accept=".xlsx, .xls"
          :headers="upload.headers"
          :action="upload.url + '?updateSupport=' + upload.updateSupport"
          :disabled="upload.isUploading"
          :on-progress="handleFileUploadProgress"
          :on-success="handleFileSuccess"
          :on-error="handleFileError"
          :auto-upload="false"
          drag
      >
    <el-dialog :title="upload.title"
               v-model="upload.open"
               width="400px"
               append-to-body>
      <el-upload ref="uploadRef"
                 :limit="1"
                 accept=".xlsx, .xls"
                 :headers="upload.headers"
                 :action="upload.url + '?updateSupport=' + upload.updateSupport"
                 :disabled="upload.isUploading"
                 :on-progress="handleFileUploadProgress"
                 :on-success="handleFileSuccess"
                 :on-error="handleFileError"
                 :auto-upload="false"
                 drag>
        <el-icon class="el-icon--upload"><upload-filled /></el-icon>
        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
        <template #tip>
          <div class="el-upload__tip text-center">
            <span>仅允许导入xls、xlsx格式文件。</span>
            <el-link
                type="primary"
                :underline="false"
                style="font-size: 12px; vertical-align: baseline"
                @click="importTemplate"
            >下载模板</el-link
            >
            <el-link type="primary"
                     :underline="false"
                     style="font-size: 12px; vertical-align: baseline"
                     @click="importTemplate">下载模板</el-link>
          </div>
        </template>
      </el-upload>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitFileForm">ç¡® å®š</el-button>
          <el-button type="primary"
                     @click="submitFileForm">ç¡® å®š</el-button>
          <el-button @click="upload.open = false">取 æ¶ˆ</el-button>
        </div>
      </template>
@@ -239,352 +180,330 @@
</template>
<script setup>
import { onMounted, ref } from "vue";
import { Search } from "@element-plus/icons-vue";
import { delSupplier } from "@/api/basicData/supplierManageFile.js";
import { ElMessageBox } from "element-plus";
import { userListNoPage } from "@/api/system/user.js";
import {
  addSupplier,
  getSupplier,
  listSupplier,
  updateSupplier,
} from "@/api/basicData/supplierManageFile.js";
import useUserStore from "@/store/modules/user";
import { getToken } from "@/utils/auth.js";
const FileList = defineAsyncComponent(() =>
  import { onMounted, ref } from "vue";
  import { Search } from "@element-plus/icons-vue";
  import { delSupplier } from "@/api/basicData/supplierManageFile.js";
  import { ElMessageBox } from "element-plus";
  import { userListNoPage } from "@/api/system/user.js";
  import {
    addSupplier,
    getSupplier,
    listSupplier,
    updateSupplier,
  } from "@/api/basicData/supplierManageFile.js";
  import useUserStore from "@/store/modules/user";
  import { getToken } from "@/utils/auth.js";
  const FileList = defineAsyncComponent(() =>
    import("@/components/Dialog/FileList.vue")
);
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
  );
  const { proxy } = getCurrentInstance();
  const userStore = useUserStore();
const tableColumn = ref([
  {
    label: "供应商名称",
    prop: "supplierName",
    width: 250,
  },
  {
    label: "供应商类型",
    prop: "supplierType",
    width: 120,
  },
  {
    label: "纳税人识别号",
    prop: "taxpayerIdentificationNum",
    width: 230,
  },
  {
    label: "公司地址",
    prop: "companyAddress",
    width: 220,
  },
  {
    label: "联系方式",
    prop: "companyPhone",
    width:150
  },
  {
    label: "开户行",
    prop: "bankAccountName",
    width: 220,
  },
  {
    label: "账号",
    prop: "bankAccountNum",
    width: 220,
  },
  {
    label: "联系人",
    prop: "contactUserName",
  },
  {
    label: "联系电话",
    prop: "contactUserPhone",
    width: 150,
  },
  {
    label: "维护人",
    prop: "maintainUserName",
  },
  const tableColumn = ref([
    {
      label: "供应商名称",
      prop: "supplierName",
      // width: 250,
    },
    // {
    //   label: "供应商类型",
    //   prop: "supplierType",
    //   width: 120,
    // },
    {
      label: "纳税人识别号",
      prop: "taxpayerIdentificationNum",
      // width: 230,
    },
    {
      label: "公司地址",
      prop: "companyAddress",
      // width: 300,
    },
    {
      label: "维护人",
      prop: "maintainUserName",
    },
  {
    label: "维护时间",
    prop: "maintainTime",
    width:100
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: 'right',
    width: 150,
    operation: [
      {
        name: "编辑",
        type: "text",
        clickFun: (row) => {
          openForm("edit", row);
    {
      label: "维护时间",
      prop: "maintainTime",
      // width: 100,
    },
    {
      dataType: "action",
      label: "操作",
      align: "center",
      fixed: "right",
      width: 150,
      operation: [
        {
          name: "编辑",
          type: "text",
          clickFun: row => {
            openForm("edit", row);
          },
        },
      },
      {
        //资质附件
        name: "资质文件",
        type: "text",
        clickFun: (row) => {
          openFileDialog(row)
        // {
        //   //资质附件
        //   name: "资质文件",
        //   type: "text",
        //   clickFun: row => {
        //     openFileDialog(row);
        //   },
        // },
      ],
    },
  ]);
  const tableData = ref([]);
  const selectedRows = ref([]);
  const userList = ref([]);
  const tableLoading = ref(false);
  const page = reactive({
    current: 1,
    size: 100,
    total: 0,
  });
  const fileListDialogVisible = ref(false);
  const recordId = ref();
  // ç”¨æˆ·ä¿¡æ¯è¡¨å•弹框数据
  const operationType = ref("");
  const dialogFormVisible = ref(false);
  const data = reactive({
    searchForm: {
      supplierName: "",
    },
    form: {
      supplierName: "",
      taxpayerIdentificationNum: "",
      companyAddress: "",
      maintainUserId: "",
      maintainTime: "",
      supplierType: "",
      isWhite: "",
    },
    rules: {
      supplierName: [{ required: true, message: "请输入", trigger: "blur" }],
      taxpayerIdentificationNum: [
        { required: true, message: "请输入", trigger: "blur" },
      ],
      companyAddress: [{ required: true, message: "请输入", trigger: "blur" }],
      maintainUserId: [{ required: false, message: "请选择", trigger: "change" }],
      maintainTime: [{ required: false, message: "请选择", trigger: "change" }],
      // supplierType: [
      //   { required: true, message: "请选择供应商类型", trigger: "change" },
      // ],
    },
  });
  const { searchForm, form, rules } = toRefs(data);
  // æŸ¥è¯¢åˆ—表
  /** æœç´¢æŒ‰é’®æ“ä½œ */
  const handleQuery = () => {
    page.current = 1;
    getList();
  };
  const pagination = obj => {
    page.current = obj.page;
    page.size = obj.limit;
    getList();
  };
  /** æäº¤ä¸Šä¼ æ–‡ä»¶ */
  function submitFileForm() {
    upload.isUploading = true;
    proxy.$refs["uploadRef"].submit();
  }
  const getList = () => {
    tableLoading.value = true;
    listSupplier({ ...searchForm.value, ...page, isWhite: 1 }).then(res => {
      tableLoading.value = false;
      tableData.value = res.data.records;
      page.total = res.data.total;
    });
  };
  const upload = reactive({
    // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚(供应商导入)
    open: false,
    // å¼¹å‡ºå±‚标题(供应商导入)
    title: "",
    // æ˜¯å¦ç¦ç”¨ä¸Šä¼ 
    isUploading: false,
    // æ˜¯å¦æ›´æ–°å·²ç»å­˜åœ¨çš„用户数据
    updateSupport: 1,
    // è®¾ç½®ä¸Šä¼ çš„请求头部
    headers: { Authorization: "Bearer " + getToken() },
    // ä¸Šä¼ çš„地址
    url: import.meta.env.VITE_APP_BASE_API + "/system/supplier/import",
  });
  /** å¯¼å…¥æŒ‰é’®æ“ä½œ */
  function handleImport() {
    upload.title = "供应商导入";
    upload.open = true;
  }
  /** ä¸‹è½½æ¨¡æ¿ */
  function importTemplate() {
    proxy.download(
      "/system/supplier/downloadTemplate",
      {},
      "供应商导入模板.xlsx"
    );
  }
  /**文件上传中处理 */
  const handleFileUploadProgress = (event, file, fileList) => {
    upload.isUploading = true;
  };
  /** æ–‡ä»¶ä¸Šä¼ æˆåŠŸå¤„ç† */
  const handleFileSuccess = (response, file, fileList) => {
    upload.isUploading = false;
    if (response.code === 200) {
      proxy.$modal.msgSuccess("文件上传成功");
      upload.open = false;
      proxy.$refs["uploadRef"].clearFiles();
      getList();
    } else if (response.code === 500) {
      proxy.$modal.msgError(response.msg);
    } else {
      proxy.$modal.msgWarning(response.msg);
    }
  };
  /** æ–‡ä»¶ä¸Šä¼ å¤±è´¥å¤„理 */
  const handleFileError = (error, file, fileList) => {
    upload.isUploading = false;
    proxy.$modal.msgError("文件上传失败");
  };
  // è¡¨æ ¼é€‰æ‹©æ•°æ®
  const handleSelectionChange = selection => {
    selectedRows.value = selection;
  };
  // æ‰“开弹框
  const openForm = (type, row) => {
    operationType.value = type;
    form.value = {};
    form.value.maintainUserId = userStore.id;
    form.value.maintainTime = getCurrentDate();
    userListNoPage().then(res => {
      userList.value = res.data;
    });
    if (type === "edit") {
      getSupplier(row.id).then(res => {
        form.value = { ...res.data };
      });
    }
    dialogFormVisible.value = true;
  };
  // æäº¤è¡¨å•
  const submitForm = () => {
    proxy.$refs["formRef"].validate(valid => {
      if (valid) {
        if (operationType.value === "edit") {
          submitEdit();
        } else {
          submitAdd();
        }
      }
    ],
  },
]);
const tableData = ref([]);
const selectedRows = ref([]);
const userList = ref([]);
const tableLoading = ref(false);
const page = reactive({
  current: 1,
  size: 100,
  total: 0,
});
const fileListDialogVisible = ref(false);
const recordId = ref();
// ç”¨æˆ·ä¿¡æ¯è¡¨å•弹框数据
const operationType = ref("");
const dialogFormVisible = ref(false);
const data = reactive({
  searchForm: {
    supplierName: "",
  },
  form: {
    supplierName: "",
    taxpayerIdentificationNum: "",
    companyAddress: "",
    companyPhone: "",
    bankAccountName: "",
    bankAccountNum: "",
    contactUserName: "",
    contactUserPhone: "",
    maintainUserId: "",
    maintainTime: "",
    supplierType: "",
    isWhite: "",
  },
  rules: {
    supplierName: [{ required: true, message: "请输入", trigger: "blur" }],
    taxpayerIdentificationNum: [
      { required: true, message: "请输入", trigger: "blur" },
    ],
    companyAddress: [{ required: true, message: "请输入", trigger: "blur" }],
    companyPhone: [{ required: true, message: "请输入", trigger: "blur" }],
    bankAccountName: [{ required: true, message: "请输入", trigger: "blur" }],
    bankAccountNum: [{ required: true, message: "请输入", trigger: "blur" }],
    contactUserName: [{ required: false, message: "请输入", trigger: "blur" }],
    contactUserPhone: [{ required: false, message: "请输入", trigger: "blur" }],
    maintainUserId: [{ required: false, message: "请选择", trigger: "change" }],
    maintainTime: [{ required: false, message: "请选择", trigger: "change" }],
    supplierType: [{ required: true, message: "请选择供应商类型", trigger: "change" }],
  },
});
const { searchForm, form, rules } = toRefs(data);
// æŸ¥è¯¢åˆ—表
/** æœç´¢æŒ‰é’®æ“ä½œ */
const handleQuery = () => {
  page.current = 1;
  getList();
};
const pagination = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
/** æäº¤ä¸Šä¼ æ–‡ä»¶ */
function submitFileForm() {
  upload.isUploading = true;
  proxy.$refs["uploadRef"].submit();
}
const getList = () => {
  tableLoading.value = true;
  listSupplier({ ...searchForm.value, ...page, isWhite: 1 }).then((res) => {
    tableLoading.value = false;
    tableData.value = res.data.records;
    page.total = res.data.total;
  });
};
const upload = reactive({
  // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚(供应商导入)
  open: false,
  // å¼¹å‡ºå±‚标题(供应商导入)
  title: "",
  // æ˜¯å¦ç¦ç”¨ä¸Šä¼ 
  isUploading: false,
  // æ˜¯å¦æ›´æ–°å·²ç»å­˜åœ¨çš„用户数据
  updateSupport: 1,
  // è®¾ç½®ä¸Šä¼ çš„请求头部
  headers: { Authorization: "Bearer " + getToken() },
  // ä¸Šä¼ çš„地址
  url: import.meta.env.VITE_APP_BASE_API + "/system/supplier/import",
});
/** å¯¼å…¥æŒ‰é’®æ“ä½œ */
function handleImport() {
  upload.title = "供应商导入";
  upload.open = true;
}
/** ä¸‹è½½æ¨¡æ¿ */
function importTemplate() {
  proxy.download("/system/supplier/downloadTemplate", {}, "供应商导入模板.xlsx");
}
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
  upload.isUploading = true;
};
/** æ–‡ä»¶ä¸Šä¼ æˆåŠŸå¤„ç† */
const handleFileSuccess = (response, file, fileList) => {
  upload.isUploading = false;
  if(response.code === 200){
    proxy.$modal.msgSuccess("文件上传成功");
    upload.open = false;
    proxy.$refs["uploadRef"].clearFiles();
    getList();
  }else if(response.code === 500){
    proxy.$modal.msgError(response.msg);
  }else{
    proxy.$modal.msgWarning(response.msg);
  }
};
/** æ–‡ä»¶ä¸Šä¼ å¤±è´¥å¤„理 */
const handleFileError = (error, file, fileList) => {
  upload.isUploading = false;
  proxy.$modal.msgError("文件上传失败");
};
// è¡¨æ ¼é€‰æ‹©æ•°æ®
const handleSelectionChange = (selection) => {
  selectedRows.value = selection;
};
// æ‰“开弹框
const openForm = (type, row) => {
  operationType.value = type;
  form.value = {};
  form.value.maintainUserId = userStore.id;
  form.value.maintainTime = getCurrentDate();
  userListNoPage().then((res) => {
    userList.value = res.data;
  });
  if (type === "edit") {
    getSupplier(row.id).then((res) => {
      form.value = { ...res.data };
    });
  }
  dialogFormVisible.value = true;
};
// æäº¤è¡¨å•
const submitForm = () => {
  proxy.$refs["formRef"].validate((valid) => {
    if (valid) {
      if (operationType.value === "edit") {
        submitEdit();
      } else {
        submitAdd();
      }
    }
  });
};
// æäº¤æ–°å¢ž
const submitAdd = () => {
  addSupplier(form.value).then((res) => {
    proxy.$modal.msgSuccess("提交成功");
    closeDia();
    getList();
  });
};
// æäº¤ä¿®æ”¹
const submitEdit = () => {
  updateSupplier(form.value).then((res) => {
    proxy.$modal.msgSuccess("提交成功");
    closeDia();
    getList();
  });
};
// å…³é—­å¼¹æ¡†
const closeDia = () => {
  proxy.resetForm("formRef");
  dialogFormVisible.value = false;
};
// å¯¼å‡º
const handleOut = () => {
  ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
  };
  // æäº¤æ–°å¢ž
  const submitAdd = () => {
    addSupplier(form.value).then(res => {
      proxy.$modal.msgSuccess("提交成功");
      closeDia();
      getList();
    });
  };
  // æäº¤ä¿®æ”¹
  const submitEdit = () => {
    updateSupplier(form.value).then(res => {
      proxy.$modal.msgSuccess("提交成功");
      closeDia();
      getList();
    });
  };
  // å…³é—­å¼¹æ¡†
  const closeDia = () => {
    proxy.resetForm("formRef");
    dialogFormVisible.value = false;
  };
  // å¯¼å‡º
  const handleOut = () => {
    ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
      .then(() => {
        proxy.download("/system/supplier/export", { isWhite: 1 }, "供应商档案.xlsx");
        proxy.download(
          "/system/supplier/export",
          { isWhite: 1 },
          "供应商档案.xlsx"
        );
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
};
// åˆ é™¤
const handleDelete = () => {
  let ids = [];
  if (selectedRows.value.length > 0) {
    // æ£€æŸ¥æ˜¯å¦æœ‰ä»–人维护的数据
    const unauthorizedData = selectedRows.value.filter(item => item.maintainUserName !== userStore.nickName);
    if (unauthorizedData.length > 0) {
      proxy.$modal.msgWarning("不可删除他人维护的数据");
  };
  // åˆ é™¤
  const handleDelete = () => {
    let ids = [];
    if (selectedRows.value.length > 0) {
      // æ£€æŸ¥æ˜¯å¦æœ‰ä»–人维护的数据
      const unauthorizedData = selectedRows.value.filter(
        item => item.maintainUserName !== userStore.nickName
      );
      if (unauthorizedData.length > 0) {
        proxy.$modal.msgWarning("不可删除他人维护的数据");
        return;
      }
      ids = selectedRows.value.map(item => item.id);
    } else {
      proxy.$modal.msgWarning("请选择数据");
      return;
    }
    ids = selectedRows.value.map((item) => item.id);
  } else {
    proxy.$modal.msgWarning("请选择数据");
    return;
  }
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除提示", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除提示", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
      .then(() => {
        tableLoading.value = true;
        delSupplier(ids)
            .then((res) => {
              proxy.$modal.msgSuccess("删除成功");
              getList();
            })
            .finally(() => {
              tableLoading.value = false;
            });
          .then(res => {
            proxy.$modal.msgSuccess("删除成功");
            getList();
          })
          .finally(() => {
            tableLoading.value = false;
          });
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
};
  };
// èŽ·å–å½“å‰æ—¥æœŸå¹¶æ ¼å¼åŒ–ä¸º YYYY-MM-DD
function getCurrentDate() {
  const today = new Date();
  const year = today.getFullYear();
  const month = String(today.getMonth() + 1).padStart(2, "0"); // æœˆä»½ä»Ž0开始
  const day = String(today.getDate()).padStart(2, "0");
  return `${year}-${month}-${day}`;
}
// æ‰“开附件弹框
const openFileDialog = async row => {
  recordId.value = row.id;
  fileListDialogVisible.value = true;
};
  // èŽ·å–å½“å‰æ—¥æœŸå¹¶æ ¼å¼åŒ–ä¸º YYYY-MM-DD
  function getCurrentDate() {
    const today = new Date();
    const year = today.getFullYear();
    const month = String(today.getMonth() + 1).padStart(2, "0"); // æœˆä»½ä»Ž0开始
    const day = String(today.getDate()).padStart(2, "0");
    return `${year}-${month}-${day}`;
  }
  // æ‰“开附件弹框
  const openFileDialog = async row => {
    recordId.value = row.id;
    fileListDialogVisible.value = true;
  };
onMounted(() => {
  getList();
});
  onMounted(() => {
    getList();
  });
defineExpose({
  getList,
});
  defineExpose({
    getList,
  });
</script>
src/views/basicData/supplierManage/components/HomeTab.vue
@@ -3,185 +3,132 @@
    <div class="search_form">
      <div style="margin-bottom: 10px;">
        <span class="search_title">供应商档案:</span>
        <el-input
            v-model="searchForm.supplierName"
            style="width: 240px"
            placeholder="输入供应商名称搜索"
            @change="handleQuery"
            clearable
            :prefix-icon="Search"
        />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
        >搜索</el-button
        >
        <el-input v-model="searchForm.supplierName"
                  style="width: 240px"
                  placeholder="输入供应商名称搜索"
                  @change="handleQuery"
                  clearable
                  :prefix-icon="Search" />
        <el-button type="primary"
                   @click="handleQuery"
                   style="margin-left: 10px">搜索</el-button>
      </div>
      <div style="margin-bottom: 10px;">
        <el-button type="primary" @click="openForm('add')"
        >新增供应商</el-button
        >
        <el-button type="primary"
                   @click="openForm('add')">新增供应商</el-button>
        <el-button @click="handleOut">导出</el-button>
        <el-button type="info" plain icon="Upload" @click="handleImport"
        >导入</el-button
        >
        <el-button type="danger" plain @click="handleDelete">删除</el-button>
        <el-button type="info"
                   plain
                   icon="Upload"
                   @click="handleImport">导入</el-button>
        <el-button type="danger"
                   plain
                   @click="handleDelete">删除</el-button>
      </div>
    </div>
    <div class="table_list">
      <PIMTable
          rowKey="id"
          :column="tableColumn"
          :tableData="tableData"
          :page="page"
          :isSelection="true"
          @selection-change="handleSelectionChange"
          :tableLoading="tableLoading"
          @pagination="pagination"
      ></PIMTable>
      <PIMTable rowKey="id"
                :column="tableColumn"
                :tableData="tableData"
                :page="page"
                :isSelection="true"
                @selection-change="handleSelectionChange"
                :tableLoading="tableLoading"
                @pagination="pagination"></PIMTable>
    </div>
    <el-dialog
        v-model="dialogFormVisible"
        :title="operationType === 'add' ? '新增供应商信息' : '编辑供应商信息'"
        width="70%"
        @close="closeDia"
    >
      <el-form
          :model="form"
          label-width="140px"
          label-position="top"
          :rules="rules"
          ref="formRef"
      >
    <el-dialog v-model="dialogFormVisible"
               :title="operationType === 'add' ? '新增供应商信息' : '编辑供应商信息'"
               width="70%"
               @close="closeDia">
      <el-form :model="form"
               label-width="140px"
               label-position="top"
               :rules="rules"
               ref="formRef">
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="供应商名称:" prop="supplierName">
              <el-input
                  v-model="form.supplierName"
                  placeholder="请输入"
                  clearable
              />
            <el-form-item label="供应商名称:"
                          prop="supplierName">
              <el-input v-model="form.supplierName"
                        placeholder="请输入"
                        clearable />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
                label="纳税人识别号:"
                prop="taxpayerIdentificationNum"
            >
              <el-input
                  v-model="form.taxpayerIdentificationNum"
                  placeholder="请输入"
                  clearable
              />
            <el-form-item label="纳税人识别号:"
                          prop="taxpayerIdentificationNum">
              <el-input v-model="form.taxpayerIdentificationNum"
                        placeholder="请输入"
                        clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="24">
            <el-form-item label="公司地址:"
                          prop="companyAddress">
              <el-input v-model="form.companyAddress"
                        placeholder="请输入"
                        clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="公司地址:" prop="companyAddress">
              <el-input
                  v-model="form.companyAddress"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司电话:" prop="companyPhone">
              <el-input
                  v-model="form.companyPhone"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="开户行:" prop="bankAccountName">
              <el-input
                  v-model="form.bankAccountName"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="账号:" prop="bankAccountNum">
              <el-input
                  v-model="form.bankAccountNum"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="联系人:" prop="contactUserName">
              <el-input
                  v-model="form.contactUserName"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系电话:" prop="contactUserPhone">
              <el-input
                  v-model="form.contactUserPhone"
                  placeholder="请输入"
                  clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="维护人:" prop="maintainUserId">
              <el-select
                  v-model="form.maintainUserId"
                  placeholder="请选择"
                  clearable
                  disabled
              >
                <el-option
                    v-for="item in userList"
                    :key="item.nickName"
                    :label="item.nickName"
                    :value="item.userId"
                />
            <el-form-item label="维护人:"
                          prop="maintainUserId">
              <el-select v-model="form.maintainUserId"
                         placeholder="请选择"
                         clearable
                         disabled>
                <el-option v-for="item in userList"
                           :key="item.nickName"
                           :label="item.nickName"
                           :value="item.userId" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="维护时间:" prop="maintainTime">
              <el-date-picker
                  style="width: 100%"
                  v-model="form.maintainTime"
                  value-format="YYYY-MM-DD"
                  format="YYYY-MM-DD"
                  type="date"
                  placeholder="请选择"
                  clearable
              />
            <el-form-item label="维护时间:"
                          prop="maintainTime">
              <el-date-picker style="width: 100%"
                              v-model="form.maintainTime"
                              value-format="YYYY-MM-DD"
                              format="YYYY-MM-DD"
                              type="date"
                              placeholder="请选择"
                              clearable />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="供应商类型:" prop="supplierType">
              <el-select v-model="form.supplierType" placeholder="请选择" clearable>
                <el-option label="甲" value="甲" />
                <el-option label="乙" value="乙" />
                <el-option label="丙" value="丙" />
                <el-option label="丁" value="丁" />
          <!-- <el-col :span="12">
            <el-form-item label="供应商类型:"
                          prop="supplierType">
              <el-select v-model="form.supplierType"
                         placeholder="请选择"
                         clearable>
                <el-option label="甲"
                           value="甲" />
                <el-option label="乙"
                           value="乙" />
                <el-option label="丙"
                           value="丙" />
                <el-option label="丁"
                           value="丁" />
              </el-select>
            </el-form-item>
          </el-col>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="是否白名单:" prop="isWhite">
              <el-select v-model="form.isWhite" placeholder="请选择" clearable>
                <el-option label="是" :value="0" />
                <el-option label="否" :value="1" />
            <el-form-item label="是否白名单:"
                          prop="isWhite">
              <el-select v-model="form.isWhite"
                         placeholder="请选择"
                         clearable>
                <el-option label="是"
                           :value="0" />
                <el-option label="否"
                           :value="1" />
              </el-select>
            </el-form-item>
          </el-col>
@@ -189,50 +136,44 @@
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确认</el-button>
          <el-button type="primary"
                     @click="submitForm">确认</el-button>
          <el-button @click="closeDia">取消</el-button>
        </div>
      </template>
    </el-dialog>
    <!-- ä¾›åº”商导入对话框 -->
    <el-dialog
        :title="upload.title"
        v-model="upload.open"
        width="400px"
        append-to-body
    >
      <el-upload
          ref="uploadRef"
          :limit="1"
          accept=".xlsx, .xls"
          :headers="upload.headers"
          :action="upload.url + '?updateSupport=' + upload.updateSupport"
          :disabled="upload.isUploading"
          :on-progress="handleFileUploadProgress"
          :on-success="handleFileSuccess"
          :on-error="handleFileError"
          :auto-upload="false"
          drag
      >
    <el-dialog :title="upload.title"
               v-model="upload.open"
               width="400px"
               append-to-body>
      <el-upload ref="uploadRef"
                 :limit="1"
                 accept=".xlsx, .xls"
                 :headers="upload.headers"
                 :action="upload.url + '?updateSupport=' + upload.updateSupport"
                 :disabled="upload.isUploading"
                 :on-progress="handleFileUploadProgress"
                 :on-success="handleFileSuccess"
                 :on-error="handleFileError"
                 :auto-upload="false"
                 drag>
        <el-icon class="el-icon--upload"><upload-filled /></el-icon>
        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
        <template #tip>
          <div class="el-upload__tip text-center">
            <span>仅允许导入xls、xlsx格式文件。</span>
            <el-link
                type="primary"
                :underline="false"
                style="font-size: 12px; vertical-align: baseline"
                @click="importTemplate"
            >下载模板</el-link
            >
            <el-link type="primary"
                     :underline="false"
                     style="font-size: 12px; vertical-align: baseline"
                     @click="importTemplate">下载模板</el-link>
          </div>
        </template>
      </el-upload>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitFileForm">ç¡® å®š</el-button>
          <el-button type="primary"
                     @click="submitFileForm">ç¡® å®š</el-button>
          <el-button @click="upload.open = false">取 æ¶ˆ</el-button>
        </div>
      </template>
@@ -245,351 +186,330 @@
</template>
<script setup>
import { onMounted, ref } from "vue";
import { Search } from "@element-plus/icons-vue";
import { delSupplier } from "@/api/basicData/supplierManageFile.js";
import { ElMessageBox } from "element-plus";
import { userListNoPage } from "@/api/system/user.js";
import {
  addSupplier,
  getSupplier,
  listSupplier,
  updateSupplier,
} from "@/api/basicData/supplierManageFile.js";
import useUserStore from "@/store/modules/user";
import { getToken } from "@/utils/auth.js";
const FileList = defineAsyncComponent(() =>
  import { onMounted, ref } from "vue";
  import { Search } from "@element-plus/icons-vue";
  import { delSupplier } from "@/api/basicData/supplierManageFile.js";
  import { ElMessageBox } from "element-plus";
  import { userListNoPage } from "@/api/system/user.js";
  import {
    addSupplier,
    getSupplier,
    listSupplier,
    updateSupplier,
  } from "@/api/basicData/supplierManageFile.js";
  import useUserStore from "@/store/modules/user";
  import { getToken } from "@/utils/auth.js";
  const FileList = defineAsyncComponent(() =>
    import("@/components/Dialog/FileList.vue")
);
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
  );
  const { proxy } = getCurrentInstance();
  const userStore = useUserStore();
const tableColumn = ref([
  {
    label: "供应商名称",
    prop: "supplierName",
    width: 250,
  },
  {
    label: "供应商类型",
    prop: "supplierType",
    width: 120,
  },
  {
    label: "纳税人识别号",
    prop: "taxpayerIdentificationNum",
    width: 230,
  },
  {
    label: "公司地址",
    prop: "companyAddress",
    width: 220,
  },
  {
    label: "联系方式",
    prop: "companyPhone",
    width:150
  },
  {
    label: "开户行",
    prop: "bankAccountName",
    width: 220,
  },
  {
    label: "账号",
    prop: "bankAccountNum",
    width: 220,
  },
  {
    label: "联系人",
    prop: "contactUserName",
  },
  {
    label: "联系电话",
    prop: "contactUserPhone",
    width: 150,
  },
  {
    label: "维护人",
    prop: "maintainUserName",
  },
  const tableColumn = ref([
    {
      label: "供应商名称",
      prop: "supplierName",
      // width: 250,
    },
    // {
    //   label: "供应商类型",
    //   prop: "supplierType",
    //   width: 120,
    // },
    {
      label: "纳税人识别号",
      prop: "taxpayerIdentificationNum",
      // width: 230,
    },
    {
      label: "公司地址",
      prop: "companyAddress",
      // width: 220,
    },
    {
      label: "维护人",
      prop: "maintainUserName",
      // width: 220,
    },
  {
    label: "维护时间",
    prop: "maintainTime",
    width:100
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: 'right',
    width: 150,
    operation: [
      {
        name: "编辑",
        type: "text",
        clickFun: (row) => {
          openForm("edit", row);
    {
      label: "维护时间",
      prop: "maintainTime",
      width: 100,
    },
    {
      dataType: "action",
      label: "操作",
      align: "center",
      fixed: "right",
      width: 150,
      operation: [
        {
          name: "编辑",
          type: "text",
          clickFun: row => {
            openForm("edit", row);
          },
        },
      },
      {
        //资质附件
        name: "资质文件",
        type: "text",
        clickFun: (row) => {
          openFileDialog(row)
        // {
        //   //资质附件
        //   name: "资质文件",
        //   type: "text",
        //   clickFun: row => {
        //     openFileDialog(row);
        //   },
        // },
      ],
    },
  ]);
  const tableData = ref([]);
  const selectedRows = ref([]);
  const userList = ref([]);
  const tableLoading = ref(false);
  const fileListDialogVisible = ref(false);
  const recordId = ref();
  const page = reactive({
    current: 1,
    size: 100,
    total: 0,
  });
  // ç”¨æˆ·ä¿¡æ¯è¡¨å•弹框数据
  const operationType = ref("");
  const dialogFormVisible = ref(false);
  const data = reactive({
    searchForm: {
      supplierName: "",
    },
    form: {
      supplierName: "",
      taxpayerIdentificationNum: "",
      companyAddress: "",
      maintainUserId: "",
      maintainTime: "",
      supplierType: "",
      isWhite: "",
    },
    rules: {
      supplierName: [{ required: true, message: "请输入", trigger: "blur" }],
      taxpayerIdentificationNum: [
        { required: true, message: "请输入", trigger: "blur" },
      ],
      companyAddress: [{ required: true, message: "请输入", trigger: "blur" }],
      maintainUserId: [{ required: false, message: "请选择", trigger: "change" }],
      maintainTime: [{ required: false, message: "请选择", trigger: "change" }],
      // supplierType: [
      //   { required: true, message: "请选择供应商类型", trigger: "change" },
      // ],
    },
  });
  const { searchForm, form, rules } = toRefs(data);
  // æŸ¥è¯¢åˆ—表
  /** æœç´¢æŒ‰é’®æ“ä½œ */
  const handleQuery = () => {
    page.current = 1;
    getList();
  };
  const pagination = obj => {
    page.current = obj.page;
    page.size = obj.limit;
    getList();
  };
  /** æäº¤ä¸Šä¼ æ–‡ä»¶ */
  function submitFileForm() {
    upload.isUploading = true;
    proxy.$refs["uploadRef"].submit();
  }
  const getList = () => {
    tableLoading.value = true;
    listSupplier({ ...searchForm.value, ...page, isWhite: 0 }).then(res => {
      tableLoading.value = false;
      tableData.value = res.data.records;
      page.total = res.data.total;
    });
  };
  const upload = reactive({
    // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚(供应商导入)
    open: false,
    // å¼¹å‡ºå±‚标题(供应商导入)
    title: "",
    // æ˜¯å¦ç¦ç”¨ä¸Šä¼ 
    isUploading: false,
    // æ˜¯å¦æ›´æ–°å·²ç»å­˜åœ¨çš„用户数据
    updateSupport: 1,
    // è®¾ç½®ä¸Šä¼ çš„请求头部
    headers: { Authorization: "Bearer " + getToken() },
    // ä¸Šä¼ çš„地址
    url: import.meta.env.VITE_APP_BASE_API + "/system/supplier/import",
  });
  /** å¯¼å…¥æŒ‰é’®æ“ä½œ */
  function handleImport() {
    upload.title = "供应商导入";
    upload.open = true;
  }
  /** ä¸‹è½½æ¨¡æ¿ */
  function importTemplate() {
    proxy.download(
      "/system/supplier/downloadTemplate",
      {},
      "供应商导入模板.xlsx"
    );
  }
  /**文件上传中处理 */
  const handleFileUploadProgress = (event, file, fileList) => {
    upload.isUploading = true;
  };
  /** æ–‡ä»¶ä¸Šä¼ æˆåŠŸå¤„ç† */
  const handleFileSuccess = (response, file, fileList) => {
    upload.isUploading = false;
    if (response.code === 200) {
      proxy.$modal.msgSuccess("文件上传成功");
      upload.open = false;
      proxy.$refs["uploadRef"].clearFiles();
      getList();
    } else if (response.code === 500) {
      proxy.$modal.msgError(response.msg);
    } else {
      proxy.$modal.msgWarning(response.msg);
    }
  };
  /** æ–‡ä»¶ä¸Šä¼ å¤±è´¥å¤„理 */
  const handleFileError = (error, file, fileList) => {
    upload.isUploading = false;
    proxy.$modal.msgError("文件上传失败");
  };
  // è¡¨æ ¼é€‰æ‹©æ•°æ®
  const handleSelectionChange = selection => {
    selectedRows.value = selection;
  };
  // æ‰“开弹框
  const openForm = (type, row) => {
    operationType.value = type;
    form.value = {};
    form.value.maintainUserId = userStore.id;
    form.value.maintainTime = getCurrentDate();
    userListNoPage().then(res => {
      userList.value = res.data;
    });
    if (type === "edit") {
      getSupplier(row.id).then(res => {
        form.value = { ...res.data };
      });
    }
    dialogFormVisible.value = true;
  };
  // æäº¤è¡¨å•
  const submitForm = () => {
    proxy.$refs["formRef"].validate(valid => {
      if (valid) {
        if (operationType.value === "edit") {
          submitEdit();
        } else {
          submitAdd();
        }
      }
    ],
  },
]);
const tableData = ref([]);
const selectedRows = ref([]);
const userList = ref([]);
const tableLoading = ref(false);
const fileListDialogVisible = ref(false);
const recordId = ref();
const page = reactive({
  current: 1,
  size: 100,
  total: 0,
});
// ç”¨æˆ·ä¿¡æ¯è¡¨å•弹框数据
const operationType = ref("");
const dialogFormVisible = ref(false);
const data = reactive({
  searchForm: {
    supplierName: "",
  },
  form: {
    supplierName: "",
    taxpayerIdentificationNum: "",
    companyAddress: "",
    companyPhone: "",
    bankAccountName: "",
    bankAccountNum: "",
    contactUserName: "",
    contactUserPhone: "",
    maintainUserId: "",
    maintainTime: "",
    supplierType: "",
    isWhite: "",
  },
  rules: {
    supplierName: [{ required: true, message: "请输入", trigger: "blur" }],
    taxpayerIdentificationNum: [
      { required: true, message: "请输入", trigger: "blur" },
    ],
    companyAddress: [{ required: true, message: "请输入", trigger: "blur" }],
    companyPhone: [{ required: true, message: "请输入", trigger: "blur" }],
    bankAccountName: [{ required: true, message: "请输入", trigger: "blur" }],
    bankAccountNum: [{ required: true, message: "请输入", trigger: "blur" }],
    contactUserName: [{ required: false, message: "请输入", trigger: "blur" }],
    contactUserPhone: [{ required: false, message: "请输入", trigger: "blur" }],
    maintainUserId: [{ required: false, message: "请选择", trigger: "change" }],
    maintainTime: [{ required: false, message: "请选择", trigger: "change" }],
    supplierType: [{ required: true, message: "请选择供应商类型", trigger: "change" }],
  },
});
const { searchForm, form, rules } = toRefs(data);
// æŸ¥è¯¢åˆ—表
/** æœç´¢æŒ‰é’®æ“ä½œ */
const handleQuery = () => {
  page.current = 1;
  getList();
};
const pagination = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
/** æäº¤ä¸Šä¼ æ–‡ä»¶ */
function submitFileForm() {
  upload.isUploading = true;
  proxy.$refs["uploadRef"].submit();
}
const getList = () => {
  tableLoading.value = true;
  listSupplier({ ...searchForm.value, ...page, isWhite: 0 }).then((res) => {
    tableLoading.value = false;
    tableData.value = res.data.records;
    page.total = res.data.total;
  });
};
const upload = reactive({
  // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚(供应商导入)
  open: false,
  // å¼¹å‡ºå±‚标题(供应商导入)
  title: "",
  // æ˜¯å¦ç¦ç”¨ä¸Šä¼ 
  isUploading: false,
  // æ˜¯å¦æ›´æ–°å·²ç»å­˜åœ¨çš„用户数据
  updateSupport: 1,
  // è®¾ç½®ä¸Šä¼ çš„请求头部
  headers: { Authorization: "Bearer " + getToken() },
  // ä¸Šä¼ çš„地址
  url: import.meta.env.VITE_APP_BASE_API + "/system/supplier/import",
});
/** å¯¼å…¥æŒ‰é’®æ“ä½œ */
function handleImport() {
  upload.title = "供应商导入";
  upload.open = true;
}
/** ä¸‹è½½æ¨¡æ¿ */
function importTemplate() {
  proxy.download("/system/supplier/downloadTemplate", {}, "供应商导入模板.xlsx");
}
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
  upload.isUploading = true;
};
/** æ–‡ä»¶ä¸Šä¼ æˆåŠŸå¤„ç† */
const handleFileSuccess = (response, file, fileList) => {
  upload.isUploading = false;
  if(response.code === 200){
    proxy.$modal.msgSuccess("文件上传成功");
    upload.open = false;
    proxy.$refs["uploadRef"].clearFiles();
    getList();
  }else if(response.code === 500){
    proxy.$modal.msgError(response.msg);
  }else{
    proxy.$modal.msgWarning(response.msg);
  }
};
/** æ–‡ä»¶ä¸Šä¼ å¤±è´¥å¤„理 */
const handleFileError = (error, file, fileList) => {
  upload.isUploading = false;
  proxy.$modal.msgError("文件上传失败");
};
// è¡¨æ ¼é€‰æ‹©æ•°æ®
const handleSelectionChange = (selection) => {
  selectedRows.value = selection;
};
// æ‰“开弹框
const openForm = (type, row) => {
  operationType.value = type;
  form.value = {};
  form.value.maintainUserId = userStore.id;
  form.value.maintainTime = getCurrentDate();
  userListNoPage().then((res) => {
    userList.value = res.data;
  });
  if (type === "edit") {
    getSupplier(row.id).then((res) => {
      form.value = { ...res.data };
    });
  }
  dialogFormVisible.value = true;
};
// æäº¤è¡¨å•
const submitForm = () => {
  proxy.$refs["formRef"].validate((valid) => {
    if (valid) {
      if (operationType.value === "edit") {
        submitEdit();
      } else {
        submitAdd();
      }
    }
  });
};
// æäº¤æ–°å¢ž
const submitAdd = () => {
  addSupplier(form.value).then((res) => {
    proxy.$modal.msgSuccess("提交成功");
    closeDia();
    getList();
  });
};
// æäº¤ä¿®æ”¹
const submitEdit = () => {
  updateSupplier(form.value).then((res) => {
    proxy.$modal.msgSuccess("提交成功");
    closeDia();
    getList();
  });
};
// å…³é—­å¼¹æ¡†
const closeDia = () => {
  proxy.resetForm("formRef");
  dialogFormVisible.value = false;
};
// å¯¼å‡º
const handleOut = () => {
  ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
  };
  // æäº¤æ–°å¢ž
  const submitAdd = () => {
    addSupplier(form.value).then(res => {
      proxy.$modal.msgSuccess("提交成功");
      closeDia();
      getList();
    });
  };
  // æäº¤ä¿®æ”¹
  const submitEdit = () => {
    updateSupplier(form.value).then(res => {
      proxy.$modal.msgSuccess("提交成功");
      closeDia();
      getList();
    });
  };
  // å…³é—­å¼¹æ¡†
  const closeDia = () => {
    proxy.resetForm("formRef");
    dialogFormVisible.value = false;
  };
  // å¯¼å‡º
  const handleOut = () => {
    ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
      .then(() => {
        proxy.download("/system/supplier/export", { isWhite: 0 }, "供应商档案.xlsx");
        proxy.download(
          "/system/supplier/export",
          { isWhite: 0 },
          "供应商档案.xlsx"
        );
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
};
// åˆ é™¤
const handleDelete = () => {
  let ids = [];
  if (selectedRows.value.length > 0) {
    // æ£€æŸ¥æ˜¯å¦æœ‰ä»–人维护的数据
    const unauthorizedData = selectedRows.value.filter(item => item.maintainUserName !== userStore.nickName);
    if (unauthorizedData.length > 0) {
      proxy.$modal.msgWarning("不可删除他人维护的数据");
  };
  // åˆ é™¤
  const handleDelete = () => {
    let ids = [];
    if (selectedRows.value.length > 0) {
      // æ£€æŸ¥æ˜¯å¦æœ‰ä»–人维护的数据
      const unauthorizedData = selectedRows.value.filter(
        item => item.maintainUserName !== userStore.nickName
      );
      if (unauthorizedData.length > 0) {
        proxy.$modal.msgWarning("不可删除他人维护的数据");
        return;
      }
      ids = selectedRows.value.map(item => item.id);
    } else {
      proxy.$modal.msgWarning("请选择数据");
      return;
    }
    ids = selectedRows.value.map((item) => item.id);
  } else {
    proxy.$modal.msgWarning("请选择数据");
    return;
  }
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除提示", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除提示", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
      .then(() => {
        tableLoading.value = true;
        delSupplier(ids)
            .then((res) => {
              proxy.$modal.msgSuccess("删除成功");
              getList();
            })
            .finally(() => {
              tableLoading.value = false;
            });
          .then(res => {
            proxy.$modal.msgSuccess("删除成功");
            getList();
          })
          .finally(() => {
            tableLoading.value = false;
          });
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
};
  };
// èŽ·å–å½“å‰æ—¥æœŸå¹¶æ ¼å¼åŒ–ä¸º YYYY-MM-DD
function getCurrentDate() {
  const today = new Date();
  const year = today.getFullYear();
  const month = String(today.getMonth() + 1).padStart(2, "0"); // æœˆä»½ä»Ž0开始
  const day = String(today.getDate()).padStart(2, "0");
  return `${year}-${month}-${day}`;
}
// æ‰“开附件弹框
const openFileDialog = async row => {
  recordId.value = row.id;
  fileListDialogVisible.value = true;
};
  // èŽ·å–å½“å‰æ—¥æœŸå¹¶æ ¼å¼åŒ–ä¸º YYYY-MM-DD
  function getCurrentDate() {
    const today = new Date();
    const year = today.getFullYear();
    const month = String(today.getMonth() + 1).padStart(2, "0"); // æœˆä»½ä»Ž0开始
    const day = String(today.getDate()).padStart(2, "0");
    return `${year}-${month}-${day}`;
  }
  // æ‰“开附件弹框
  const openFileDialog = async row => {
    recordId.value = row.id;
    fileListDialogVisible.value = true;
  };
onMounted(() => {
  getList();
});
  onMounted(() => {
    getList();
  });
defineExpose({
  getList,
});
  defineExpose({
    getList,
  });
</script>
src/views/collaborativeApproval/approvalProcess/components/approvalDia.vue
@@ -22,14 +22,10 @@
        <el-row>
          <el-col :span="24">
            <el-form-item label="申请部门:">
              <el-select disabled
                         v-model="form.approveDeptId"
                         placeholder="选择部门">
                <el-option v-for="user in productOptions"
                           :key="user.deptId"
                           :label="user.deptName"
                           :value="user.deptId" />
              </el-select>
              <el-input v-model="form.approveDeptName"
                        placeholder=""
                        clearable
                        disabled />
            </el-form-item>
          </el-col>
        </el-row>
@@ -42,6 +38,18 @@
                        clearable
                        type="textarea"
                        disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="Number(props.approveType) === 4">
          <el-col :span="24">
            <el-form-item label="报销金额:">
              <el-input-number v-model="form.price"
                               disabled
                               :min="0"
                               :precision="2"
                               style="width: 100%"
                               placeholder="" />
            </el-form-item>
          </el-col>
        </el-row>
@@ -75,7 +83,7 @@
                <el-descriptions-item label="报价总额"
                                      :span="2">
                  <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">
                    Â¥{{ Number(currentQuotation.totalAmount ?? 0).toFixed(2) }}
                    {{ formatCurrency(currentQuotation.totalAmount) }}
                  </span>
                </el-descriptions-item>
              </el-descriptions>
@@ -92,7 +100,7 @@
                                   label="单位" />
                  <el-table-column prop="unitPrice"
                                   label="单价">
                    <template #default="scope">Â¥{{ Number(scope.row.unitPrice ?? 0).toFixed(2) }}</template>
                    <template #default="scope">{{ formatCurrency(scope.row.unitPrice) }}</template>
                  </el-table-column>
                </el-table>
              </div>
@@ -135,7 +143,7 @@
                <el-descriptions-item label="合同金额"
                                      :span="2">
                  <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">
                    Â¥{{ Number(currentPurchase.contractAmount ?? 0).toFixed(2) }}
                    {{ formatCurrency(currentPurchase.contractAmount) }}
                  </span>
                </el-descriptions-item>
              </el-descriptions>
@@ -154,11 +162,11 @@
                                   label="数量" />
                  <el-table-column prop="taxInclusiveUnitPrice"
                                   label="含税单价">
                    <template #default="scope">Â¥{{ Number(scope.row.taxInclusiveUnitPrice ?? 0).toFixed(2) }}</template>
                    <template #default="scope">{{ formatCurrency(scope.row.taxInclusiveUnitPrice) }}</template>
                  </el-table-column>
                  <el-table-column prop="taxInclusiveTotalPrice"
                                   label="含税总价">
                    <template #default="scope">Â¥{{ Number(scope.row.taxInclusiveTotalPrice ?? 0).toFixed(2) }}</template>
                    <template #default="scope">{{ formatCurrency(scope.row.taxInclusiveTotalPrice) }}</template>
                  </el-table-column>
                </el-table>
              </div>
@@ -295,8 +303,10 @@
                v-if="operationType === 'approval'">
        <div class="dialog-footer">
          <el-button type="primary"
                     :loading="submitLoading"
                     @click="submitForm(2)">不通过</el-button>
          <el-button type="primary"
                     :loading="submitLoading"
                     @click="submitForm(1)">通过</el-button>
          <el-button @click="closeDia">取消</el-button>
        </div>
@@ -330,6 +340,7 @@
  import { getPurchaseByCode } from "@/api/procurementManagement/procurementLedger.js";
  import { getDeliveryDetailByShippingNo } from "@/api/salesManagement/deliveryLedger.js";
  import ImagePreview from "@/components/AttachmentPreview/image/index.vue";
  import { formatCurrency } from "@/utils/numberFormat";
  const emit = defineEmits(["close"]);
  const { proxy } = getCurrentInstance();
@@ -353,6 +364,7 @@
  const deliveryLoading = ref(false);
  const currentDelivery = ref({});
  const deliveryProductList = ref([]);
  const submitLoading = ref(false);
  const isQuotationApproval = computed(() => Number(props.approveType) === 6);
  const isPurchaseApproval = computed(() => Number(props.approveType) === 5);
  const isDeliveryApproval = computed(() => Number(props.approveType) === 7);
@@ -581,10 +593,15 @@
    // åˆ¤æ–­æ˜¯å¦ä¸ºæœ€åŽä¸€æ­¥
    const isLast =
      activities.value.findIndex(a => a.isShen) === activities.value.length - 1;
    updateApproveNode({ ...currentActivity, isLast }).then(() => {
      proxy.$modal.msgSuccess("提交成功");
      closeDia();
    });
    submitLoading.value = true;
    updateApproveNode({ ...currentActivity, isLast })
      .then(() => {
        proxy.$modal.msgSuccess("提交成功");
        closeDia();
      })
      .finally(() => {
        submitLoading.value = false;
      });
  };
  // å…³é—­å¼¹æ¡†
  const closeDia = () => {
@@ -594,6 +611,7 @@
    currentQuotation.value = {};
    purchaseLoading.value = false;
    currentPurchase.value = {};
    submitLoading.value = false;
    emit("close");
  };
  defineExpose({
src/views/collaborativeApproval/knowledgeBase/index.vue
@@ -225,167 +225,18 @@
        </div>
      </div>
    </FormDialog>
    <!-- æ–‡ä»¶ç®¡ç†å¼¹çª— -->
    <FormDialog
      v-model="filesDialogVisible"
      title="文件管理"
      :width="'900px'"
      @close="closeFilesDialog"
      @confirm="closeFilesDialog"
      @cancel="closeFilesDialog"
    >
      <div class="file-manager">
        <!-- æ–‡ä»¶ä¸Šä¼  -->
        <div class="upload-section">
          <el-upload
            :action="uploadUrl"
            :headers="uploadHeaders"
            :on-success="handleUploadSuccess"
            :on-error="handleUploadError"
            :before-upload="beforeUpload"
            name="files"
            multiple
            :show-file-list="false"
            accept=".txt,.md,.docx,.xlsx,.xls,.pdf"
          >
            <el-button type="primary">上传文件</el-button>
          </el-upload>
          <el-button
            type="success"
            @click="saveFiles"
            :disabled="uploadedBlobIds.length === 0"
            :loading="savingFiles"
            style="margin-left: 10px"
          >
            ä¿å­˜æ–‡ä»¶å…³è”
          </el-button>
          <el-button
            v-if="uploadedBlobIds.length > 0"
            type="text"
            @click="clearUploadedFiles"
            style="margin-left: 10px"
          >
            æ¸…空待保存列表
          </el-button>
        </div>
        <!-- å¾…保存的文件列表 -->
        <div v-if="uploadedBlobIds.length > 0" class="uploaded-list">
          <div class="uploaded-tip">
            <el-icon style="color: #409eff"><InfoFilled /></el-icon>
            <span>已上传 {{ uploadedBlobIds.length }} ä¸ªæ–‡ä»¶,请点击"保存文件关联"按钮触发向量化处理</span>
          </div>
        </div>
        <!-- æ–‡ä»¶åˆ—表与向量化状态 -->
        <el-table :data="fileList" style="margin-top: 20px" border>
          <el-table-column prop="fileName" label="文件名" show-overflow-tooltip />
          <el-table-column prop="fileType" label="文件类型" width="100" />
          <el-table-column label="向量化状态" width="120">
            <template #default="{ row }">
              <el-tag :type="getStatusType(row.vectorStatus)">
                {{ getStatusText(row.vectorStatus) }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="chunkCount" label="切片数" width="100" align="center" />
          <el-table-column label="错误信息" width="200" show-overflow-tooltip>
            <template #default="{ row }">
              <span v-if="row.vectorError" style="color: #f56c6c">{{ row.vectorError }}</span>
              <span v-else style="color: #909399">-</span>
            </template>
          </el-table-column>
          <el-table-column prop="createTime" label="上传时间" width="180" />
          <el-table-column label="操作" width="150" align="center">
            <template #default="{ row }">
              <el-button
                v-if="row.vectorStatus === 3"
                type="text"
                @click="reprocessFile(row)"
              >
                é‡æ–°å¤„理
              </el-button>
              <el-button type="text" @click="deleteFile(row)" style="color: #f56c6c">
                åˆ é™¤
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </FormDialog>
    <!-- çŸ¥è¯†åº“问答弹窗 -->
    <FormDialog
      v-model="chatDialogVisible"
      title="知识库问答"
      :width="'800px'"
      @close="closeChatDialog"
      @confirm="closeChatDialog"
      @cancel="closeChatDialog"
    >
      <div class="knowledge-chat">
        <div class="chat-header">
          <el-tag type="success">当前知识库: {{ currentKnowledgeBase?.title }}</el-tag>
        </div>
        <!-- å¯¹è¯åŒºåŸŸ -->
        <div class="chat-messages" ref="chatMessagesRef">
          <div
            v-for="(msg, index) in messages"
            :key="index"
            :class="['message', msg.role]"
          >
            <div class="message-role">{{ msg.role === 'user' ? '我' : 'AI助手' }}</div>
            <div class="message-content">{{ msg.content }}</div>
          </div>
          <div v-if="chatLoading" class="message assistant">
            <div class="message-role">AI助手</div>
            <div class="message-content typing">正在思考中...</div>
          </div>
        </div>
        <!-- è¾“入框 -->
        <div class="chat-input">
          <el-input
            v-model="inputQuestion"
            placeholder="请输入问题,按回车发送(Ctrl+Enter快捷发送)"
            @keyup.enter="sendMessage"
            :disabled="chatLoading"
          >
            <template #append>
              <el-button @click="sendMessage" :loading="chatLoading">发送</el-button>
            </template>
          </el-input>
          <div class="chat-actions">
            <el-button type="text" size="small" @click="clearMessages">清空对话</el-button>
          </div>
        </div>
      </div>
    </FormDialog>
  </div>
</template>
<script setup>
import { Search, InfoFilled } from "@element-plus/icons-vue";
import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed, watch, nextTick } from "vue";
import { Search } from "@element-plus/icons-vue";
import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed, watch } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import PIMTable from "@/components/PIMTable/PIMTable.vue";
import FormDialog from '@/components/Dialog/FormDialog.vue';
import {
  listKnowledgeBase,
  delKnowledgeBase,
  addKnowledgeBase,
  updateKnowledgeBase,
  getVectorStatus,
  reprocessVector,
  saveKnowledgeBaseFiles,
  deleteKnowledgeBaseFile,
  knowledgeChat
} from "@/api/collaborativeApproval/knowledgeBase.js";
import { listKnowledgeBase, delKnowledgeBase,addKnowledgeBase,updateKnowledgeBase } from "@/api/collaborativeApproval/knowledgeBase.js";
import useUserStore from '@/store/modules/user';
import { userListNoPageByTenantId } from '@/api/system/user.js';
import { getToken } from "@/utils/auth";
// è¡¨å•验证规则
const rules = {
@@ -432,18 +283,7 @@
  dialogTitle: "",
  dialogType: "add",
  viewDialogVisible: false,
  currentKnowledge: {},
  filesDialogVisible: false,
  currentKnowledgeBase: null,
  fileList: [],
  uploadedBlobIds: [],
  savingFiles: false,
  vectorStatusTimer: null, // å‘量化状态轮询定时器
  chatDialogVisible: false,
  messages: [],
  inputQuestion: "",
  chatLoading: false,
  memoryId: ""
  currentKnowledge: {}
});
const {
@@ -457,18 +297,7 @@
  dialogTitle,
  dialogType,
  viewDialogVisible,
  currentKnowledge,
  filesDialogVisible,
  currentKnowledgeBase,
  fileList,
  uploadedBlobIds,
  savingFiles,
  vectorStatusTimer,
  chatDialogVisible,
  messages,
  inputQuestion,
  chatLoading,
  memoryId
  currentKnowledge
} = toRefs(data);
// è¡¨å•引用
@@ -476,12 +305,6 @@
// ç”¨æˆ·ç›¸å…³
const userStore = useUserStore();
const userList = ref([]);
// èŠå¤©æ¶ˆæ¯å®¹å™¨å¼•用
const chatMessagesRef = ref();
// æ–‡ä»¶ä¸Šä¼ ç›¸å…³
const uploadUrl = import.meta.env.VITE_APP_BASE_API + "/common/upload";
const uploadHeaders = { Authorization: "Bearer " + getToken() };
// è¡¨æ ¼åˆ—配置
const tableColumn = ref([
@@ -529,18 +352,6 @@
    }
  },
  {
    label: "文件数量",
    prop: "fileCount",
    width: 100,
    align: "center"
  },
  {
    label: "切片数量",
    prop: "totalChunkCount",
    width: 100,
    align: "center"
  },
  {
    label: "使用次数",
    prop: "usageCount",
    width: 100,
@@ -568,20 +379,6 @@
        type: "text",
        clickFun: (row) => {
          openForm("edit", row);
        }
      },
      {
        name: "文件",
        type: "text",
        clickFun: (row) => {
          openFilesDialog(row);
        }
      },
      {
        name: "问答",
        type: "text",
        clickFun: (row) => {
          openChatDialog(row);
        }
      },
      {
@@ -625,31 +422,21 @@
const getList = () => {
  tableLoading.value = true;
  // âœ… GET请求使用params传参
  listKnowledgeBase({
    current: page.value.current,
    size: page.value.size,
    title: searchForm.value.title,
    type: searchForm.value.type
  })
  listKnowledgeBase({...page.value, ...searchForm.value})
  .then(res => {
    tableLoading.value = false;
    page.value.total = res.data.total;
    // å¦‚果当前页数超过总页数,重置到第1页并重新查询
    // å¦‚果当前页数超过总页数,重置到第1页并重新查询
    const maxPage = Math.ceil(res.data.total / page.value.size) || 1;
    if (page.value.current > maxPage && maxPage > 0) {
      page.value.current = 1;
      // é‡æ–°æŸ¥è¯¢ç¬¬1页数据
      return getList();
    }
    tableData.value = res.data.records;
  })
  .catch(err => {
  }).catch(err => {
    tableLoading.value = false;
    console.error("查询知识库列表失败:", err);
  });
  })
};
// åˆ†é¡µå¤„理
@@ -824,47 +611,27 @@
const submitForm = async () => {
  try {
    await formRef.value.validate();
    // âœ… POST请求使用data传参,明确参数结构
    const formData = {
      title: form.value.title,
      type: form.value.type,
      scenario: form.value.scenario || "",
      efficiency: form.value.efficiency || "",
      problem: form.value.problem,
      solution: form.value.solution,
      keyPoints: form.value.keyPoints || "",
      creator: form.value.creator || "",
      usageCount: form.value.usageCount || 0
    };
    if (dialogType.value === "add") {
      // æ–°å¢žçŸ¥è¯†
      addKnowledgeBase(formData).then(res => {
      addKnowledgeBase({...form.value}).then(res => {
        if(res.code == 200){
          ElMessage.success("添加成功");
          closeKnowledgeDialog();
          getList();
        }
      }).catch(err => {
        console.error("添加知识库失败:", err);
        ElMessage.error(err.msg || "添加失败");
      });
        ElMessage.error(err.msg);
      })
    } else {
      // æ›´æ–°çŸ¥è¯† - æ·»åŠ id参数
      updateKnowledgeBase({
        id: form.value.id,
        ...formData
      }).then(res => {
      updateKnowledgeBase({...form.value}).then(res => {
        if(res.code == 200){
          ElMessage.success("更新成功");
          closeKnowledgeDialog();
          getList();
        }
      }).catch(err => {
        console.error("更新知识库失败:", err);
        ElMessage.error(err.msg || "更新失败");
      });
        ElMessage.error(err.msg);
      })
    }
  } catch (error) {
    console.error("表单验证失败:", error);
@@ -878,22 +645,19 @@
    return;
  }
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除", {
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  }).then(() => {
    // âœ… DELETE请求使用data传递ID数组
    // console.log(selectedIds.value);
    delKnowledgeBase(selectedIds.value).then(res => {
      if(res.code == 200){
        ElMessage.success("删除成功");
        selectedIds.value = [];
        getList();
      }
    }).catch(err => {
      console.error("删除知识库失败:", err);
      ElMessage.error(err.msg || "删除失败");
    });
    })
  }).catch(() => {
    // ç”¨æˆ·å–消
  });
@@ -916,364 +680,6 @@
const handleExport = () => {
  proxy.download('/knowledgeBase/export', { ...searchForm.value }, '知识库.xlsx')
}
// ============ æ–‡ä»¶ç®¡ç†ç›¸å…³ ============
// æ‰“开文件管理弹窗
const openFilesDialog = (row) => {
  currentKnowledgeBase.value = row;
  filesDialogVisible.value = true;
  loadFileList();
};
// åŠ è½½æ–‡ä»¶åˆ—è¡¨
const loadFileList = async () => {
  if (!currentKnowledgeBase.value?.id) return;
  try {
    const res = await getVectorStatus(currentKnowledgeBase.value.id);
    fileList.value = res.data || [];
    // æ£€æŸ¥æ˜¯å¦æœ‰å¤„理中的文件,如果有则启动轮询
    const hasProcessing = res.data.some(item => item.vectorStatus === 1);
    if (hasProcessing && !vectorStatusTimer.value) {
      startVectorStatusPolling();
    } else if (!hasProcessing && vectorStatusTimer.value) {
      stopVectorStatusPolling();
    }
  } catch (error) {
    console.error("加载文件列表失败:", error);
    ElMessage.error("加载文件列表失败");
  }
};
// å¼€å§‹è½®è¯¢å‘量化状态
const startVectorStatusPolling = () => {
  vectorStatusTimer.value = setInterval(async () => {
    try {
      const res = await getVectorStatus(currentKnowledgeBase.value.id);
      fileList.value = res.data || [];
      // æ£€æŸ¥æ˜¯å¦è¿˜æœ‰å¤„理中的文件
      const hasProcessing = res.data.some(item => item.vectorStatus === 1);
      if (!hasProcessing) {
        stopVectorStatusPolling();
        ElMessage.success("所有文件向量化处理完成");
      }
    } catch (error) {
      console.error("轮询向量化状态失败:", error);
      stopVectorStatusPolling();
    }
  }, 3000); // æ¯3秒轮询一次
};
// åœæ­¢è½®è¯¢å‘量化状态
const stopVectorStatusPolling = () => {
  if (vectorStatusTimer.value) {
    clearInterval(vectorStatusTimer.value);
    vectorStatusTimer.value = null;
  }
};
// ä¸Šä¼ å‰æ ¡éªŒ
const beforeUpload = (file) => {
  const allowedTypes = ['.txt', '.md', '.docx', '.xlsx', '.xls', '.pdf'];
  const fileName = file.name.toLowerCase();
  const isAllowed = allowedTypes.some(type => fileName.endsWith(type));
  if (!isAllowed) {
    ElMessage.error('只支持 txt、md、docx、xlsx、xls、pdf æ ¼å¼çš„æ–‡ä»¶');
    return false;
  }
  const isLt50M = file.size / 1024 / 1024 < 50;
  if (!isLt50M) {
    ElMessage.error('文件大小不能超过 50MB');
    return false;
  }
  return true;
};
// ä¸Šä¼ æˆåŠŸ
const handleUploadSuccess = (response, file) => {
  console.log("上传响应:", response);  // è°ƒè¯•日志
  if (response.code === 200) {
    // âœ… åŽç«¯è¿”回的是 List<StorageBlobVO>,所以data是数组
    if (Array.isArray(response.data) && response.data.length > 0) {
      // å–数组第一个元素的id
      const blobId = response.data[0].id;
      if (blobId) {
        uploadedBlobIds.value.push(blobId);
        ElMessage.success(`文件 ${file.name} ä¸Šä¼ æˆåŠŸ`);
      } else {
        console.error("上传响应中未找到id:", response.data[0]);
        ElMessage.error("上传失败: æœªèŽ·å–åˆ°æ–‡ä»¶ID");
      }
    } else {
      console.error("上传响应格式错误:", response);
      ElMessage.error("上传失败: å“åº”格式错误");
    }
  } else {
    ElMessage.error(response.msg || "上传失败");
  }
};
// ä¸Šä¼ å¤±è´¥
const handleUploadError = (error, file) => {
  ElMessage.error(`文件 ${file.name} ä¸Šä¼ å¤±è´¥`);
};
// ä¿å­˜æ–‡ä»¶å…³è”
const saveFiles = async () => {
  // å‚数校验
  if (!currentKnowledgeBase.value?.id) {
    ElMessage.error("知识库信息异常");
    return;
  }
  if (uploadedBlobIds.value.length === 0) {
    ElMessage.warning("请先上传文件");
    return;
  }
  savingFiles.value = true;
  try {
    // âœ… POST请求使用data传参,明确参数结构
    await saveKnowledgeBaseFiles({
      knowledgeBaseId: currentKnowledgeBase.value.id,  // çŸ¥è¯†åº“ID
      storageBlobIds: uploadedBlobIds.value             // æ–‡ä»¶blob ID数组
    });
    ElMessage.success("文件关联保存成功,正在后台处理向量化");
    uploadedBlobIds.value = [];
    // å»¶è¿Ÿåˆ·æ–°æ–‡ä»¶åˆ—表,给后台处理时间
    setTimeout(() => {
      loadFileList();
    }, 1000);
  } catch (error) {
    console.error("保存文件关联失败:", error);
    ElMessage.error("保存文件关联失败");
  } finally {
    savingFiles.value = false;
  }
};
// é‡æ–°å¤„理向量化的文件
const reprocessFile = async (row) => {
  try {
    await reprocessVector(row.id);
    ElMessage.success("已重新提交向量化任务");
    // å»¶è¿Ÿåˆ·æ–°
    setTimeout(() => {
      loadFileList();
    }, 1000);
  } catch (error) {
    console.error("重新处理失败:", error);
    ElMessage.error("重新处理失败");
  }
};
// æ¸…空待保存的文件列表
const clearUploadedFiles = () => {
  uploadedBlobIds.value = [];
  ElMessage.success("已清空待保存文件列表");
};
// åˆ é™¤æ–‡ä»¶
const deleteFile = async (row) => {
  try {
    await ElMessageBox.confirm(
      "确定要删除该文件吗?删除后将无法恢复向量数据",
      "删除确认",
      {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }
    );
    // âœ… DELETE请求使用data传递ID数组
    await deleteKnowledgeBaseFile([row.id]);  // æ³¨æ„: row.id是向量记录ID,不是storageBlobId
    ElMessage.success("删除成功");
    loadFileList();
  } catch (error) {
    if (error !== 'cancel') {
      console.error("删除文件失败:", error);
      ElMessage.error("删除文件失败");
    }
  }
};
// çŠ¶æ€æ–‡æœ¬æ˜ å°„
const getStatusText = (status) => {
  const map = {
    0: '待处理',
    1: '处理中',
    2: '已完成',
    3: '失败'
  };
  return map[status] || '未知';
};
// çŠ¶æ€æ ‡ç­¾ç±»åž‹æ˜ å°„
const getStatusType = (status) => {
  const map = {
    0: 'info',
    1: 'warning',
    2: 'success',
    3: 'danger'
  };
  return map[status] || 'info';
};
// å…³é—­æ–‡ä»¶ç®¡ç†å¼¹çª—
const closeFilesDialog = () => {
  filesDialogVisible.value = false;
  currentKnowledgeBase.value = null;
  fileList.value = [];
  uploadedBlobIds.value = [];
  stopVectorStatusPolling(); // åœæ­¢è½®è¯¢
  getList(); // åˆ·æ–°ä¸»åˆ—表,更新文件数量
};
// ============ çŸ¥è¯†åº“问答相关 ============
// ç”ŸæˆUUID的fallback方案
const generateUUID = () => {
  if (typeof crypto !== 'undefined' && crypto.randomUUID) {
    return crypto.randomUUID();
  }
  // fallback: å…¼å®¹ä¸æ”¯æŒ crypto.randomUUID çš„环境
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    const r = Math.random() * 16 | 0;
    const v = c === 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
};
// æ‰“开问答弹窗
const openChatDialog = (row) => {
  currentKnowledgeBase.value = row;
  chatDialogVisible.value = true;
  memoryId.value = generateUUID();
  messages.value = [];
  inputQuestion.value = "";
};
// å‘送消息
const sendMessage = async () => {
  // å‚数校验
  if (!inputQuestion.value.trim()) {
    ElMessage.warning("请输入问题");
    return;
  }
  if (!currentKnowledgeBase.value?.id) {
    ElMessage.error("知识库信息异常");
    return;
  }
  const question = inputQuestion.value.trim();
  // æ·»åŠ ç”¨æˆ·æ¶ˆæ¯
  messages.value.push({
    role: 'user',
    content: question
  });
  inputQuestion.value = "";
  chatLoading.value = true;
  // æ»šåŠ¨åˆ°åº•éƒ¨
  await nextTick();
  scrollToBottom();
  try {
    // âœ… æµå¼è¯·æ±‚使用Fetch API
    const response = await knowledgeChat({
      knowledgeBaseId: currentKnowledgeBase.value.id,  // çŸ¥è¯†åº“ID
      memoryId: memoryId.value,                         // ä¼šè¯ID
      question: question                                // ç”¨æˆ·é—®é¢˜
    });
    if (!response.ok) {
      const errorText = await response.text();
      throw new Error(errorText || '请求失败');
    }
    // âœ… åŽç«¯è¿”回 text/stream;charset=utf-8
    const reader = response.body.getReader();
    const decoder = new TextDecoder();
    let aiContent = '';
    messages.value.push({ role: 'assistant', content: '' });
    while (true) {
      const { done, value } = await reader.read();
      if (done) break;
      const text = decoder.decode(value, { stream: true });  // âœ… æ·»åŠ stream选项
      aiContent += text;
      messages.value[messages.value.length - 1].content = aiContent;
      // æ»šåŠ¨åˆ°åº•éƒ¨
      await nextTick();
      scrollToBottom();
    }
    // å¦‚æžœAI返回空内容,显示提示
    if (!aiContent.trim()) {
      messages.value[messages.value.length - 1].content = '抱歉,知识库中未找到相关内容,请尝试其他问题。';
    }
  } catch (error) {
    console.error("问答请求失败:", error);
    ElMessage.error("问答请求失败,请稍后重试");
    messages.value.push({
      role: 'assistant',
      content: '抱歉,发生了错误,请稍后重试'
    });
  } finally {
    chatLoading.value = false;
  }
};
// æ¸…空对话
const clearMessages = () => {
  ElMessageBox.confirm(
    "确定要清空所有对话记录吗?",
    "清空确认",
    {
      confirmButtonText: "确定",
      cancelButtonText: "取消",
      type: "warning"
    }
  ).then(() => {
    messages.value = [];
    memoryId.value = generateUUID(); // é‡æ–°ç”Ÿæˆä¼šè¯ID
    ElMessage.success("对话已清空");
  }).catch(() => {
    // ç”¨æˆ·å–消
  });
};
// æ»šåŠ¨åˆ°åº•éƒ¨
const scrollToBottom = () => {
  if (chatMessagesRef.value) {
    chatMessagesRef.value.scrollTop = chatMessagesRef.value.scrollHeight;
  }
};
// å…³é—­é—®ç­”弹窗
const closeChatDialog = () => {
  chatDialogVisible.value = false;
  currentKnowledgeBase.value = null;
  messages.value = [];
  inputQuestion.value = "";
};
</script>
<style scoped>
@@ -1349,113 +755,4 @@
  font-size: 14px;
  color: #909399;
}
/* æ–‡ä»¶ç®¡ç†æ ·å¼ */
.file-manager {
  padding: 20px 0;
}
.upload-section {
  display: flex;
  align-items: center;
}
.uploaded-list {
  margin-top: 16px;
  padding: 12px;
  background: #f0f9ff;
  border-radius: 6px;
  border: 1px solid #b3d8ff;
}
.uploaded-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #409eff;
  font-size: 14px;
}
/* çŸ¥è¯†åº“问答样式 */
.knowledge-chat {
  display: flex;
  flex-direction: column;
  height: 500px;
}
.chat-header {
  margin-bottom: 16px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f7fa;
  border-radius: 8px;
  margin-bottom: 16px;
}
.message {
  margin-bottom: 16px;
  max-width: 80%;
}
.message.user {
  margin-left: auto;
  text-align: right;
}
.message.assistant {
  margin-right: auto;
}
.message-role {
  font-size: 12px;
  color: #909399;
  margin-bottom: 4px;
}
.message-content {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.message.user .message-content {
  background: #409eff;
  color: white;
}
.message.assistant .message-content {
  background: white;
  color: #303133;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.typing {
  animation: typing 1.5s infinite;
}
@keyframes typing {
  0%, 50%, 100% {
    opacity: 1;
  }
  25%, 75% {
    opacity: 0.5;
  }
}
.chat-input {
  margin-top: auto;
}
.chat-actions {
  margin-top: 8px;
  text-align: right;
}
</style>
src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue
@@ -1,148 +1,154 @@
<template>
    <div>
        <!-- ç”³è¯·ç±»åž‹é€‰æ‹© -->
        <el-card class="type-card">
            <div class="type-selector">
                <div
                    v-for="type in applicationTypes"
                    :key="type.value"
                    class="type-item"
                    :class="{ active: currentType === type.value }"
                    @click="changeType(type.value)"
                >
                    <div class="type-icon">
                        <el-icon :size="24"><component :is="type.icon"/></el-icon>
                    </div>
                    <div class="type-info">
                        <div class="type-name">{{ type.name }}</div>
                        <div class="type-desc">{{ type.desc }}</div>
                    </div>
                </div>
            </div>
        </el-card>
        <!-- ä¼šè®®ç”³è¯·è¡¨å• -->
        <el-card>
            <div class="form-header">
                <h3>{{ getCurrentTypeName() }}申请</h3>
            </div>
            <el-form
                ref="meetingFormRef"
                :model="meetingForm"
                :rules="rules"
                label-width="100px"
            >
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="会议主题" prop="title">
                            <el-input v-model="meetingForm.title" placeholder="请输入会议主题"/>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="会议室" prop="roomId">
                            <el-select v-model="meetingForm.roomId" placeholder="请选择会议室" style="width: 100%">
                                <el-option
                                    v-for="room in meetingRooms"
                                    :key="room.id"
                                    :label="`${room.name} (${room.location})`"
                                    :value="room.id"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="主持人" prop="host">
                            <el-input v-model="meetingForm.host" placeholder="请输入主持人姓名"/>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="会议日期" prop="meetingDate">
                            <el-date-picker
                                v-model="meetingForm.meetingDate"
                                type="date"
                                placeholder="请选择会议日期"
                                value-format="YYYY-MM-DD"
                                format="YYYY-MM-DD"
                                :disabled-date="disabledDate"
                                style="width: 100%"
                            />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <!-- ç©ºåˆ—,保持布局 -->
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="开始时间" prop="startTime">
                            <el-time-picker
                                v-model="meetingForm.startTime"
                                placeholder="请选择开始时间"
                                format="HH:mm"
                                value-format="HH:mm"
                                :disabled-hours="disabledStartHours"
                                :disabled-minutes="disabledStartMinutes"
                                style="width: 100%"
                            />
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="结束时间" prop="endTime">
                            <el-time-picker
                                v-model="meetingForm.endTime"
                                placeholder="请选择结束时间"
                                format="HH:mm"
                                value-format="HH:mm"
                                :disabled-hours="disabledEndHours"
                                :disabled-minutes="disabledEndMinutes"
                                style="width: 100%"
                            />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-form-item label="参会人员" prop="participants">
                    <el-select
                        v-model="meetingForm.participants"
                        multiple
                        filterable
                        placeholder="请选择参会人员"
                        style="width: 100%"
                    >
                        <el-option
                            v-for="person in employees"
                            :key="person.id"
                            :label="`${person.staffName}${person.postName ? ` (${person.postName})` : ''}`"
                            :value="person.id"
                        />
                    </el-select>
                </el-form-item>
                <el-form-item label="会议说明" prop="description">
                    <el-input
                        v-model="meetingForm.description"
                        type="textarea"
                        :rows="4"
                        placeholder="请输入会议说明"
                    />
                </el-form-item>
            </el-form>
            <div class="form-footer">
                <el-button @click="resetForm">重置</el-button>
                <el-button type="primary" @click="submitForm">提交</el-button>
            </div>
        </el-card>
    </div>
  <div>
    <!-- ç”³è¯·ç±»åž‹é€‰æ‹© -->
    <el-card class="type-card">
      <div class="type-selector">
        <div
            v-for="type in applicationTypes"
            :key="type.value"
            class="type-item"
            :class="{ active: currentType === type.value }"
            @click="changeType(type.value)"
        >
          <div class="type-icon">
            <el-icon :size="24"><component :is="type.icon"/></el-icon>
          </div>
          <div class="type-info">
            <div class="type-name">{{ type.name }}</div>
            <div class="type-desc">{{ type.desc }}</div>
          </div>
        </div>
      </div>
    </el-card>
    <!-- ä¼šè®®ç”³è¯·è¡¨å• -->
    <el-card>
      <div class="form-header">
        <h3>{{ getCurrentTypeName() }}申请</h3>
      </div>
      <el-form
          ref="meetingFormRef"
          :model="meetingForm"
          :rules="rules"
          label-width="100px"
      >
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="会议主题" prop="title">
              <el-input v-model="meetingForm.title" placeholder="请输入会议主题"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="会议室" prop="roomId">
              <el-select v-model="meetingForm.roomId" placeholder="请选择会议室" style="width: 100%">
                <el-option
                    v-for="room in meetingRooms"
                    :key="room.id"
                    :label="`${room.name} (${room.location})`"
                    :value="room.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="主持人" prop="host">
              <el-input v-model="meetingForm.host" placeholder="请输入主持人姓名"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="会议日期" prop="meetingDate">
              <el-date-picker
                  v-model="meetingForm.meetingDate"
                  type="date"
                  placeholder="请选择会议日期"
                  value-format="YYYY-MM-DD"
                  format="YYYY-MM-DD"
                  :disabled-date="disabledDate"
                  style="width: 100%"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <!-- ç©ºåˆ—,保持布局 -->
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="开始时间" prop="startTime">
              <el-select
                  v-model="meetingForm.startTime"
                  placeholder="请选择开始时间"
                  style="width: 100%"
              >
                <el-option
                    v-for="time in startTimeOptions"
                    :key="time.value"
                    :label="time.label"
                    :value="time.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="结束时间" prop="endTime">
              <el-select
                  v-model="meetingForm.endTime"
                  placeholder="请选择结束时间"
                  style="width: 100%"
              >
                <el-option
                    v-for="time in endTimeOptions"
                    :key="time.value"
                    :label="time.label"
                    :value="time.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="参会人员" prop="participants">
          <el-select
              v-model="meetingForm.participants"
              multiple
              filterable
              placeholder="请选择参会人员"
              style="width: 100%"
          >
            <el-option
                v-for="person in employees"
                :key="person.id"
                :label="`${person.staffName}${person.postName ? ` (${person.postName})` : ''}`"
                :value="person.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="会议说明" prop="description">
          <el-input
              v-model="meetingForm.description"
              type="textarea"
              :rows="4"
              placeholder="请输入会议说明"
          />
        </el-form-item>
      </el-form>
      <div class="form-footer">
        <el-button @click="resetForm">重置</el-button>
        <el-button type="primary" @click="submitForm">提交</el-button>
      </div>
    </el-card>
  </div>
</template>
<script setup>
@@ -157,37 +163,37 @@
// ç”³è¯·ç±»åž‹é€‰é¡¹
const applicationTypes = ref([
    {
        value: 'approval',
        name: '审批流程会议',
        desc: '需要经过多级审批的会议申请',
        icon: Document
    },
    {
        value: 'department',
        name: '部门级会议',
        desc: '部门内部会议申请流程',
        icon: Promotion
    },
    {
        value: 'notification',
        name: '会议通知',
        desc: '无需审批直接发布的会议通知',
        icon: Bell
    }
  {
    value: 'approval',
    name: '审批流程会议',
    desc: '需要经过多级审批的会议申请',
    icon: Document
  },
  {
    value: 'department',
    name: '部门级会议',
    desc: '部门内部会议申请流程',
    icon: Promotion
  },
  {
    value: 'notification',
    name: '会议通知',
    desc: '无需审批直接发布的会议通知',
    icon: Bell
  }
])
// è¡¨å•数据
const meetingForm = reactive({
    title: '',
    type: '',
    roomId: '',
    host: '',
    meetingDate: '',
    startTime: '',
    endTime: '',
    participants: [],
    description: ''
  title: '',
  type: '',
  roomId: '',
  host: '',
  meetingDate: '',
  startTime: '',
  endTime: '',
  participants: [],
  description: ''
})
// è¡¨å•引用
@@ -199,270 +205,307 @@
// å‘˜å·¥åˆ—表
const employees = ref([])
// æ—¶é—´é€‰é¡¹ï¼ˆä»¥åŠå°æ—¶ä¸ºé—´éš”)
const timeOptions = ref([])
const getTimeInMinutes = (time) => {
    if (!time) return -1
    const [hour, minute] = time.split(':').map(Number)
    return hour * 60 + minute
  if (!time) return -1
  const [hour, minute] = time.split(':').map(Number)
  return hour * 60 + minute
}
const isToday = (dateText) => {
    if (!dateText) return false
    const [year, month, day] = dateText.split('-').map(Number)
    const now = new Date()
    return year === now.getFullYear() && month === now.getMonth() + 1 && day === now.getDate()
  if (!dateText) return false
  const [year, month, day] = dateText.split('-').map(Number)
  const now = new Date()
  return year === now.getFullYear() && month === now.getMonth() + 1 && day === now.getDate()
}
const validateStartTime = (_rule, value, callback) => {
    if (!value) {
        callback()
        return
    }
    callback()
  if (!value) {
    callback()
    return
  }
  if (isToday(meetingForm.meetingDate)) {
    const now = new Date()
    const currentMinutes = now.getHours() * 60 + now.getMinutes()
    if (getTimeInMinutes(value) > currentMinutes) {
      callback(new Error('当天开始时间不能晚于当前时间'))
      return
    }
  }
  callback()
}
const validateEndTime = (_rule, value, callback) => {
    if (!value || !meetingForm.startTime) {
        callback()
        return
    }
    if (getTimeInMinutes(value) <= getTimeInMinutes(meetingForm.startTime)) {
        callback(new Error('结束时间必须大于开始时间'))
        return
    }
    callback()
  if (!value || !meetingForm.startTime) {
    callback()
    return
  }
  if (getTimeInMinutes(value) <= getTimeInMinutes(meetingForm.startTime)) {
    callback(new Error('结束时间必须大于开始时间'))
    return
  }
  callback()
}
// è¡¨å•校验规则
const rules = {
    title: [{required: true, message: '请输入会议主题', trigger: 'blur'}],
    roomId: [{required: true, message: '请选择会议室', trigger: 'change'}],
    host: [{required: true, message: '请输入主持人', trigger: 'blur'}],
    meetingDate: [{required: true, message: '请选择会议日期', trigger: 'change'}],
    startTime: [
        {required: true, message: '请选择开始时间', trigger: 'change'},
        {validator: validateStartTime, trigger: 'change'}
    ],
    endTime: [
        {required: true, message: '请选择结束时间', trigger: 'change'},
        {validator: validateEndTime, trigger: 'change'}
    ],
    participants: [{required: true, message: '请选择参会人员', trigger: 'change'}]
  title: [{required: true, message: '请输入会议主题', trigger: 'blur'}],
  roomId: [{required: true, message: '请选择会议室', trigger: 'change'}],
  host: [{required: true, message: '请输入主持人', trigger: 'blur'}],
  meetingDate: [{required: true, message: '请选择会议日期', trigger: 'change'}],
  startTime: [
    {required: true, message: '请选择开始时间', trigger: 'change'},
    {validator: validateStartTime, trigger: 'change'}
  ],
  endTime: [
    {required: true, message: '请选择结束时间', trigger: 'change'},
    {validator: validateEndTime, trigger: 'change'}
  ],
  participants: [{required: true, message: '请选择参会人员', trigger: 'change'}]
}
// æ—¶é—´é€‰æ‹©å™¨ç¦ç”¨é€»è¾‘
const disabledStartHours = () => {
    const hours = []
    for (let h = 0; h < 24; h++) {
        if (h < 8 || h > 18) hours.push(h)
    }
    if (isToday(meetingForm.meetingDate)) {
        const now = new Date()
        for (let h = 8; h < now.getHours(); h++) {
            if (!hours.includes(h)) hours.push(h)
        }
    }
    return hours
const startTimeOptions = computed(() => {
  if (!isToday(meetingForm.meetingDate)) {
    return timeOptions.value
  }
  const now = new Date()
  const currentMinutes = now.getHours() * 60 + now.getMinutes()
  return timeOptions.value.filter(item => getTimeInMinutes(item.value) <= currentMinutes)
})
const endTimeOptions = computed(() => {
  if (!meetingForm.startTime) {
    return timeOptions.value
  }
  const startMinutes = getTimeInMinutes(meetingForm.startTime)
  return timeOptions.value.filter(item => getTimeInMinutes(item.value) > startMinutes)
})
// åˆå§‹åŒ–时间选项
const initTimeOptions = () => {
  const options = []
  const now = new Date()
  const currentHour = now.getHours()
  const currentMinute = now.getMinutes()
  // meetingDate æ˜¯ "yyyy-MM-dd"
  const meetingDate = new Date(meetingForm.meetingDate)
  const isSameDay =
    now.getFullYear() === meetingDate.getFullYear() &&
    now.getMonth() === meetingDate.getMonth() &&
    now.getDate() === meetingDate.getDate()
  console.log('是否同一天:', isSameDay)
  for (let hour = 8; hour <= 18; hour++) {
    // å¼€å§‹æ—¶é—´å¿…须晚于当前时间
    if (hour < currentHour && isSameDay) {
      continue
    }
    if (hour === currentHour && currentMinute > 30 && isSameDay) {
      continue
    }
    // æ¯ä¸ªå°æ—¶æ·»åŠ ä¸¤ä¸ªé€‰é¡¹ï¼šæ•´ç‚¹å’ŒåŠç‚¹
    options.push({
      value: `${hour.toString().padStart(2, '0')}:00`,
      label: `${hour.toString().padStart(2, '0')}:00`
    })
    if (hour < 18) { // 18:00之后没有半点选项
      options.push({
        value: `${hour.toString().padStart(2, '0')}:30`,
        label: `${hour.toString().padStart(2, '0')}:30`
      })
    }
  }
  timeOptions.value = options
}
const disabledStartMinutes = (hour) => {
    const minutes = []
    for (let m = 0; m < 60; m++) {
        if (m !== 0 && m !== 30) minutes.push(m)
    }
    if (isToday(meetingForm.meetingDate)) {
        const now = new Date()
        if (hour === now.getHours()) {
            if (now.getMinutes() >= 30) {
                minutes.push(0)
            }
        }
    }
    return minutes
}
const disabledEndHours = () => {
    const hours = []
    for (let h = 0; h < 24; h++) {
        if (h < 8 || h > 18) hours.push(h)
    }
    if (meetingForm.startTime) {
        const startHour = parseInt(meetingForm.startTime.split(':')[0])
        for (let h = 8; h < startHour; h++) {
            if (!hours.includes(h)) hours.push(h)
        }
    }
    return hours
}
const disabledEndMinutes = (hour) => {
    const minutes = []
    for (let m = 0; m < 60; m++) {
        if (m !== 0 && m !== 30) minutes.push(m)
    }
    if (meetingForm.startTime) {
        const startHour = parseInt(meetingForm.startTime.split(':')[0])
        const startMinute = parseInt(meetingForm.startTime.split(':')[1])
        if (hour === startHour) {
            if (startMinute >= 0) minutes.push(0)
            if (startMinute >= 30) minutes.push(30)
            // only keep minutes > startMinute
            for (let m = 0; m <= startMinute; m++) {
                if (!minutes.includes(m)) minutes.push(m)
            }
        }
    }
    return minutes
}
watch(() => meetingForm.meetingDate, () => {
  if (meetingForm.startTime && !startTimeOptions.value.some(item => item.value === meetingForm.startTime)) {
    meetingForm.startTime = ''
  }
  if (meetingForm.endTime && !endTimeOptions.value.some(item => item.value === meetingForm.endTime)) {
    meetingForm.endTime = ''
  }
  if (meetingForm.startTime) {
    meetingFormRef.value?.validateField('startTime')
  }
  if (meetingForm.endTime) {
    meetingFormRef.value?.validateField('endTime')
  }
  initTimeOptions()
})
watch(() => meetingForm.startTime, () => {
    if (meetingForm.endTime && getTimeInMinutes(meetingForm.endTime) <= getTimeInMinutes(meetingForm.startTime)) {
        meetingForm.endTime = ''
    }
    if (meetingForm.endTime) {
        meetingFormRef.value?.validateField('endTime')
    }
  if (meetingForm.endTime && getTimeInMinutes(meetingForm.endTime) <= getTimeInMinutes(meetingForm.startTime)) {
    meetingForm.endTime = ''
  }
  if (meetingForm.endTime) {
    meetingFormRef.value?.validateField('endTime')
  }
})
// ç¦ç”¨æ—¥æœŸï¼ˆç¦ç”¨ä»Šå¤©ä¹‹å‰çš„æ—¥æœŸï¼‰
const disabledDate = (time) => {
    // ç¦ç”¨ä»Šå¤©ä¹‹å‰çš„æ—¥æœŸ
    return time.getTime() < Date.now() - 86400000
  // ç¦ç”¨ä»Šå¤©ä¹‹å‰çš„æ—¥æœŸ
  return time.getTime() < Date.now() - 86400000
}
// åˆ‡æ¢ç”³è¯·ç±»åž‹
const changeType = (type) => {
    currentType.value = type
  currentType.value = type
}
// èŽ·å–å½“å‰ç±»åž‹åç§°
const getCurrentTypeName = () => {
    const type = applicationTypes.value.find(t => t.value === currentType.value)
    return type ? type.name : ''
  const type = applicationTypes.value.find(t => t.value === currentType.value)
  return type ? type.name : ''
}
// é‡ç½®è¡¨å•
const resetForm = () => {
    meetingFormRef.value?.resetFields()
  meetingFormRef.value?.resetFields()
}
// æäº¤è¡¨å•
const submitForm = () => {
    meetingFormRef.value?.validate((valid) => {
        if (valid) {
            let formData = {...meetingForm}
            formData.applicationType = currentType.value
            formData.startTime = `${meetingForm.meetingDate} ${meetingForm.startTime}:00`
            formData.endTime = `${meetingForm.meetingDate} ${meetingForm.endTime}:00`
            formData.participants = JSON.stringify(formData.participants)
            console.log(formData)
            saveMeetingApplication(formData).then(() => {
                // æ¨¡æ‹Ÿæäº¤æ“ä½œ
                ElMessage.success(`${getCurrentTypeName()}提交成功`)
                resetForm()
            })
        }
    })
  meetingFormRef.value?.validate((valid) => {
    if (valid) {
      let formData = {...meetingForm}
      formData.applicationType = currentType.value
      formData.startTime = `${meetingForm.meetingDate} ${meetingForm.startTime}:00`
      formData.endTime = `${meetingForm.meetingDate} ${meetingForm.endTime}:00`
      formData.participants = JSON.stringify(formData.participants)
      console.log(formData)
      saveMeetingApplication(formData).then(() => {
        // æ¨¡æ‹Ÿæäº¤æ“ä½œ
        ElMessage.success(`${getCurrentTypeName()}提交成功`)
        // æ ¹æ®ä¸åŒç±»åž‹æ‰§è¡Œä¸åŒæ“ä½œ
        switch (currentType.value) {
          case 'approval':
            ElMessage.info('会议已提交审批流程')
            break
          case 'department':
            ElMessage.info('部门级会议申请已提交')
            break
          case 'notification':
            ElMessage.info('会议通知已发布')
            break
        }
        resetForm()
      })
    }
  })
}
// é¡µé¢åŠ è½½æ—¶åˆå§‹åŒ–
onMounted(() => {
    getRoomEnum().then(res => {
        meetingRooms.value = res.data
    })
    staffOnJobListPage({
        current: -1,
        size: -1,
        staffState: 1
    }).then(res => {
        employees.value = res.data.records.sort((a, b) => (a.postName || '').localeCompare(b.postName || ''))
    })
  initTimeOptions()
  getRoomEnum().then(res => {
    meetingRooms.value = res.data
  })
  staffOnJobListPage({
    current: -1,
    size: -1,
    staffState: 1
  }).then(res => {
    employees.value = res.data.records.sort((a, b) => (a.postName || '').localeCompare(b.postName || ''))
  })
})
</script>
<style scoped>
.app-container {
    padding: 20px;
  padding: 20px;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.page-header h2 {
    margin: 0;
    color: #303133;
  margin: 0;
  color: #303133;
}
.type-card {
    margin-bottom: 20px;
  margin-bottom: 20px;
}
.type-selector {
    display: flex;
    gap: 20px;
  display: flex;
  gap: 20px;
}
.type-item {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 20px;
    border: 1px solid #ebeef5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
  flex: 1;
  display: flex;
  align-items: center;
  padding: 20px;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}
.type-item:hover {
    border-color: #409eff;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  border-color: #409eff;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.type-item.active {
    border-color: #409eff;
    background-color: #ecf5ff;
  border-color: #409eff;
  background-color: #ecf5ff;
}
.type-icon {
    margin-right: 15px;
    color: #409eff;
  margin-right: 15px;
  color: #409eff;
}
.type-name {
    font-size: 16px;
    font-weight: 500;
    color: #303133;
    margin-bottom: 5px;
  font-size: 16px;
  font-weight: 500;
  color: #303133;
  margin-bottom: 5px;
}
.type-desc {
    font-size: 14px;
    color: #909399;
  font-size: 14px;
  color: #909399;
}
.form-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ebeef5;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #ebeef5;
}
.form-header h3 {
    margin: 0;
    color: #303133;
  margin: 0;
  color: #303133;
}
.form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ebeef5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #ebeef5;
}
</style>
src/views/collaborativeApproval/notificationManagement/meetExamine/index.vue
@@ -36,7 +36,7 @@
        <el-table-column prop="location" label="会议地点" align="center" width="150"/>
        <el-table-column prop="participants" label="参会人数" align="center" width="100">
          <template #default="scope">
            {{ scope.row.staffCount }}人
            {{ scope.row.participants.length }}人
          </template>
        </el-table-column>
        <el-table-column prop="status" label="审批状态" align="center" width="120">
@@ -233,9 +233,9 @@
  let resp = await getExamineList({...searchForm, ...queryParams})
  approvalList.value = resp.data.records.map(it => {
    let room = roomEnum.value.find(room => it.roomId === room.id)
    it.location = room ? `${room.name}(${room.location})` : ''
    it.location = `${room.name}(${room.location})`
    let staffs = JSON.parse(it.participants)
    it.staffCount = staffs.length
    it.staffCount = staffs.size
    it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format('HH:mm:ss')} ~ ${dayjs(it.endTime).format('HH:mm:ss')}`
    it.participants = staffList.value.filter(staff => staffs.some(id=>id === staff.id)).map(staff => {
      return {
src/views/collaborativeApproval/notificationManagement/meetIndex/index.vue
@@ -145,11 +145,10 @@
    if (endIdx === -1) {
      endIdx = timeSlots.value.length
    }
    // å¾€åŽå»¶ä¼¸ä¸€æ ¼ï¼Œè®©ä¼šè®®æ ¼å­è¦†ç›–到结束时间列上
    const displayEndIdx = Math.min(endIdx + 1, timeSlots.value.length)
    if (startIdx !== -1) {
    console.log('endIdx111', endIdx)
    if (startIdx !== -1 && endIdx !== -1) {
      // æ ‡è®°è¢«å ç”¨çš„æ—¶é—´æ®µ
      for (let i = startIdx; i < displayEndIdx; i++) {
      for (let i = startIdx; i < endIdx; i++) {
        occupiedSlots.add(timeSlots.value[i].value)
      }
@@ -157,7 +156,7 @@
      cells.push({
        type: 'meeting',
        meeting: meeting,
        span: displayEndIdx - startIdx,
        span: endIdx - startIdx,
        startTime: meeting.startTime,
        endTime: meeting.endTime
      })
src/views/collaborativeApproval/notificationManagement/meetPublish/index.vue
@@ -34,7 +34,7 @@
        <el-table-column prop="location" label="会议地点" align="center" width="150"/>
        <el-table-column prop="participants" label="参会人数" align="center" width="100">
          <template #default="scope">
            {{ scope.row.staffCount }}人
            {{ scope.row.participants.length }}人
          </template>
        </el-table-column>
        <el-table-column prop="status" label="发布状态" align="center" width="120">
@@ -231,9 +231,9 @@
  let resp = await getMeetingPublish({...searchForm, ...queryParams})
  approvalList.value = resp.data.records.map(it => {
    let room = roomEnum.value.find(room => it.roomId === room.id)
    it.location = room ? `${room.name}(${room.location})` : ''
    it.location = `${room.name}(${room.location})`
    let staffs = JSON.parse(it.participants)
    it.staffCount = staffs.length
    it.staffCount = staffs.size
    it.status = it.publishStatus
    it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format('HH:mm:ss')} ~ ${dayjs(it.endTime).format('HH:mm:ss')}`
    it.participants = staffList.value.filter(staff => staffs.some(id=>id === staff.id)).map(staff => {
src/views/collaborativeApproval/notificationManagement/summary/index.vue
@@ -28,7 +28,7 @@
        <el-table-column prop="location" label="会议地点" align="center" width="150" />
        <el-table-column prop="participants" label="参会人数" align="center" width="100">
          <template #default="scope">
            {{ scope.row.staffCount }}人
            {{ scope.row.participants.length }}人
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="200" fixed="right">
@@ -207,9 +207,9 @@
  let resp = await getMeetingPublish({ ...searchForm, ...queryParams })
  meetingList.value = resp.data.records.map(it => {
    let room = roomEnum.value.find(room => it.roomId === room.id)
    it.location = room ? `${room.name}(${room.location})` : ''
    it.location = `${room.name}(${room.location})`
    let staffs = JSON.parse(it.participants)
    it.staffCount = staffs.length
    it.staffCount = staffs.size
    it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format('HH:mm:ss')} ~ ${dayjs(it.endTime).format('HH:mm:ss')}`
    it.participants = staffList.value.filter(staff => staffs.some(id => id === staff.id)).map(staff => {
      return {
@@ -260,7 +260,7 @@
<p><strong>主持人:</strong>${row.host}</p>
<p><strong>参会人员:</strong></p>
<ol>
  ${(row.participants || []).map(p => `<li>${p?.name || ''}</li>`).join('')}
  ${row.participants.map(p => `<li>${p.name}</li>`).join('')}
</ol>
<p><strong>会议内容:</strong></p>
<ol>
src/views/collaborativeApproval/purchaseApproval/index.vue
@@ -278,7 +278,7 @@
    },
    rules: {
      purchaseContractNumber: [
        { required: false, message: "请输入", trigger: "blur" },
        { required: true, message: "请输入", trigger: "blur" },
      ],
      projectName: [{ required: true, message: "请输入", trigger: "blur" }],
      supplierId: [{ required: true, message: "请输入", trigger: "blur" }],
@@ -448,7 +448,9 @@
    productData.value = [];
    fileList.value = [];
    if (operationType.value == "add") {
      form.value.purchaseContractNumber = "";
      createPurchaseNo().then(res => {
        form.value.purchaseContractNumber = res.data;
      });
    }
    userListNoPage().then(res => {
      userList.value = res.data;
@@ -519,7 +521,7 @@
  }
  // æäº¤è¡¨å•
  const submitForm = n => {
    proxy.$refs["formRef"].validate(async valid => {
    proxy.$refs["formRef"].validate(valid => {
      if (valid) {
        if (productData.value.length > 0) {
          form.value.productData = proxy.HaveJson(productData.value);
@@ -534,21 +536,6 @@
        form.value.tempFileIds = tempFileIds;
        form.value.type = 2;
        form.value.approvalStatus = n;
        // å¦‚果采购合同号为空,则根据录入日期自动生成
        if (!form.value.purchaseContractNumber) {
          try {
            const purchaseNoRes = await createPurchaseNo(form.value.entryDate);
            if (purchaseNoRes?.data) {
              form.value.purchaseContractNumber = purchaseNoRes.data;
            }
          } catch (error) {
            console.error("生成采购合同号失败:", error);
            proxy.$modal.msgWarning("生成采购合同号失败");
            return;
          }
        }
        addOrEditPurchase(form.value).then(res => {
          proxy.$modal.msgSuccess("提交成功");
          closeDia();
src/views/collaborativeApproval/rulesRegulationsManagement/index.vue
@@ -318,7 +318,7 @@
      formatData: (v) => (v === "active" ? "生效中" : "已废止"),
      formatType: (v) => (v === "active" ? "success" : "info"),
    },
    { label: "已读人数", prop: "readCount", width: 100 },
    // { label: "已读人数", prop: "readCount", width: 100 },
    {
      dataType: "action",
      label: "操作",
src/views/collaborativeApproval/sealManagement/index.vue
@@ -7,6 +7,7 @@
        </div>
      </template>
   <!-- ç”¨å°ç”³è¯·ç®¡ç† -->
        <div class="tab-content">
            <el-row :gutter="20" class="mb-20 ">
@@ -44,7 +45,7 @@
              :isShowPagination="true"
              @pagination="paginationChange"
            />
        </div>
        </div>
    </el-card>
    <!-- ç”¨å°ç”³è¯·å¯¹è¯æ¡† -->
@@ -176,7 +177,6 @@
const sealFormRef = ref()
const userList = ref([])
const sealForm = reactive({
  id: null,
  applicationNum: '',
  title: '',
  sealType: '',
@@ -241,9 +241,9 @@
// ç”¨å°ç”³è¯·è¡¨æ ¼åˆ—配置(需在 getStatusText/getSealTypeText ç­‰ä¹‹åŽå®šä¹‰ï¼‰
const sealTableColumn = ref([
  { label: '申请编号', prop: 'applicationNum' },
  { label: '申请编号', prop: 'applicationNum',},
  { label: '申请标题', prop: 'title', showOverflowTooltip: true },
  { label: '申请人', prop: 'createUserName' },
  { label: '申请人', prop: 'createUserName', },
  { label: '所属部门', prop: 'department', width: 150 },
  {
    label: '用印类型',
@@ -261,38 +261,34 @@
    formatData: (v) => getStatusText(v),
    formatType: (v) => getStatusType(v)
  },
  { label: '审批人', prop: 'approveUserName', width: 100 },
  {
    dataType: 'action',
    label: '操作',
    width: 250,
    width: 200,
    fixed: 'right',
    align: 'center',
    operation: [
      {
        name: '审批',
        clickFun: (row) => approveSeal(row),
        showHide: (row) => row.status === 'pending' && Number(userStore.id) === row.approveUserId
        showHide: (row) => row.status === 'pending'
      },
      {
        name: '拒绝',
        clickFun: (row) => rejectSeal(row),
        showHide: (row) => row.status === 'pending' && Number(userStore.id) === row.approveUserId
        showHide: (row) => row.status === 'pending'
      },
      {
        name: '重新申请',
        clickFun: (row) => reapplySeal(row),
        showHide: (row) => row.status === 'rejected' && Number(userStore.id) === row.createUser
      },
      { name: '详情', clickFun: (row) => viewSealDetail(row) }
            { name: '详情', clickFun: (row) => viewSealDetail(row) }
    ]
  }
])
// æœç´¢å°ç« ç”³è¯·
const searchSealApplications = () => {
  page.current = 1
  page.current=1
  getSealApplicationList()
  // ElMessage.success('搜索完成')
}
// é‡ç½®å°ç« ç”³è¯·æœç´¢
const resetSealSearch = () => {
@@ -301,58 +297,37 @@
  sealSearchForm.applicationNum = ''
  searchSealApplications()
}
// é‡æ–°ç”³è¯·ç”¨å°
const reapplySeal = (row) => {
  // é¢„填表单数据
  Object.assign(sealForm, {
    id: row.id,
    applicationNum: row.applicationNum,
    title: row.title,
    sealType: row.sealType,
    reason: row.reason,
    approveUserId: row.approveUserId,
    urgency: row.urgency || 'normal',
    status: 'pending',
    storageBlobDTOs: row.storageBlobVOList || []
  })
  showSealApplyDialog.value = true
}
// æäº¤ç”¨å°ç”³è¯·
const submitSealApplication = async () => {
  try {
    await sealFormRef.value.validate()
    const request = sealForm.id ? updateSealApplication : addSealApplication
    request(sealForm).then(res => {
      if (res.code == 200) {
        ElMessage.success(sealForm.id ? '重新申请成功' : '申请提交成功')
    addSealApplication(sealForm).then(res => {
      if(res.code == 200){
        ElMessage.success('申请提交成功')
        closeSealApplyDialog()
        getSealApplicationList()
        Object.assign(sealForm, {
          id: null,
          applicationNum: '',
          title: '',
          sealType: '',
          reason: '',
          approveUserId: '',
          urgency: 'normal',
          status: 'pending',
          storageBlobDTOs: []
        })
        applicationNum: '',
        title: '',
        sealType: '',
        reason: '',
        approveUserId: '',
        urgency: 'normal',
        status: 'pending',
        storageBlobDTOs: []
      })
      }
    }).catch(err => {
      console.log(err.msg)
    })
  } catch (error) {
  }
}
// å…³é—­ç”¨å°ç”³è¯·å¯¹è¯æ¡†
const closeSealApplyDialog = () => {
  // æ¸…空表单数据
  Object.assign(sealForm, {
    id: null,
    applicationNum: '',
    title: '',
    sealType: '',
@@ -408,7 +383,7 @@
  }).then(() => {
    row.status = 'approved'
    updateSealApplication(row).then(res => {
      if (res.code == 200) {
      if(res.code == 200){
        ElMessage.success('审批通过')
        getSealApplicationList()
      }
@@ -424,9 +399,8 @@
    inputErrorMessage: '拒绝原因不能为空'
  }).then(({ value }) => {
    row.status = 'rejected'
    row.reason = value
    updateSealApplication(row).then(res => {
      if (res.code == 200) {
      if(res.code == 200){
        ElMessage.success('已拒绝申请')
        getSealApplicationList()
      }
@@ -444,13 +418,13 @@
const getSealApplicationList = async () => {
  tableLoading.value = true
  listSealApplication(page, sealSearchForm)
    .then(res => {
      sealApplications.value = res.data.records
      page.total = res.data.total
      tableLoading.value = false
    }).catch(err => {
      tableLoading.value = false
    })
  .then(res => {
    sealApplications.value = res.data.records
    page.total = res.data.total
    tableLoading.value = false
  }).catch(err => {
    tableLoading.value = false
  })
}
// åˆ†é¡µå˜åŒ–处理
const paginationChange = (obj) => {
@@ -517,4 +491,4 @@
.attachment-table {
  border-radius: 4px;
}
</style>
</style>
src/views/customerService/afterSalesHandling/components/formDia.vue
@@ -82,6 +82,33 @@
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="12">
                        <el-form-item label="评分:" prop="rating">
                            <el-rate
                                v-model="form.rating"
                                :disabled="operationType === 'view'"
                                :max="5"
                                show-text
                                :texts="['非常不满意', '不满意', '一般', '满意', '非常满意']"
                            />
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="30">
                    <el-col :span="24">
                        <el-form-item label="评价内容描述:" prop="evaluation">
                            <el-input
                                v-model="form.evaluation"
                                placeholder="请输入评价内容描述"
                                clearable
                                :disabled="operationType === 'view'"
                                type="textarea"
                                :rows="3"
                            />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <el-row :gutter="30">
                <el-col :span="12">
@@ -148,6 +175,8 @@
        disposeUserId: "",
        disDate: "",
        disRes: "",
        rating: null,
        evaluation: "",
    },
    rules: {
        feedbackDate: [{required: true, message: "请选择", trigger: "change"}],
src/views/customerService/afterSalesHandling/index.vue
@@ -102,6 +102,7 @@
            ></PIMTable>
        </div>
        <form-dia ref="formDia" @close="handleQuery"></form-dia>
    <view-dia ref="viewDia"></view-dia>
    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="after_sales_service" :record-id="recordId"  />
  </div>
</template>
@@ -109,6 +110,7 @@
<script setup>
import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick, defineAsyncComponent} from "vue";
import FormDia from "@/views/customerService/afterSalesHandling/components/formDia.vue";
import ViewDia from "@/views/customerService/components/viewDia.vue";
import { ElMessageBox } from "element-plus";
import {
    afterSalesServiceListPage,
@@ -213,6 +215,15 @@
    },
    align: "center"
  },
  {
    label: "数量",
    prop: "productModelQuantities",
    align: "center",
    formatData: params => {
      if (!params) return "0";
      return String(params).split(',').reduce((sum, val) => sum + (Number(val) || 0), 0);
    }
  },
    {
    label: "问题描述",
    prop: "proDesc",
@@ -247,10 +258,10 @@
                }
            },
            {
                name: "查看",
                name: "详情",
                type: "text",
                clickFun: (row) => {
                    openForm("view", row);
                    viewDia.value?.openDialog(row);
                },
            },
            // TODO ä¸ºå†™æŠ¥å‘Šæ·»åŠ çš„
@@ -278,6 +289,7 @@
    selectedRows.value = selection;
};
const formDia = ref()
const viewDia = ref()
const fileListRef = ref(null)
const fileListDialogVisible = ref(false)
const currentFileRow = ref(null)
src/views/customerService/components/viewDia.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,123 @@
<template>
  <el-dialog v-model="dialogVisible" title="售后单详情" width="80%" @close="closeDia">
    <div v-loading="loading">
      <span class="descriptions">基础资料</span>
      <el-descriptions :column="4" border style="margin-top: 10px;">
        <el-descriptions-item label="客户名称">{{ detail.customerName || '-' }}</el-descriptions-item>
        <el-descriptions-item label="售后类型">{{ getDictLabel(classificationOptions, detail.serviceType) }}</el-descriptions-item>
        <el-descriptions-item label="关联销售单号">{{ detail.salesContractNo || '-' }}</el-descriptions-item>
        <el-descriptions-item label="紧急程度">{{ getDictLabel(degreeOfUrgencyOptions, detail.urgency) }}</el-descriptions-item>
        <el-descriptions-item label="工单编号">{{ detail.afterSalesServiceNo || '-' }}</el-descriptions-item>
        <el-descriptions-item label="处理状态">
          <el-tag :type="detail.status === 1 ? 'danger' : 'success'" size="small">
            {{ detail.status === 1 ? '待处理' : '已处理' }}
          </el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="登记人">{{ detail.checkNickName || '-' }}</el-descriptions-item>
        <el-descriptions-item label="反馈日期">{{ detail.feedbackDate || '-' }}</el-descriptions-item>
        <el-descriptions-item label="客户诉求" :span="4">{{ detail.proDesc || '-' }}</el-descriptions-item>
      </el-descriptions>
      <div style="margin-top: 20px;">
        <span class="descriptions">处理信息</span>
        <el-descriptions :column="3" border style="margin-top: 10px;">
          <el-descriptions-item label="处理人">{{ detail.disposeNickName || '-' }}</el-descriptions-item>
          <el-descriptions-item label="处理日期">{{ detail.disDate || '-' }}</el-descriptions-item>
          <el-descriptions-item label="处理结果" :span="3">{{ detail.disRes || '-' }}</el-descriptions-item>
        </el-descriptions>
      </div>
      <div style="margin-top: 20px;">
        <span class="descriptions">关联产品</span>
        <el-table :data="tableData" border style="width: 100%; margin-top: 10px;">
          <el-table-column type="index" label="序号" width="60" align="center" />
          <el-table-column prop="productCategory" label="产品大类" align="center" />
          <el-table-column prop="specificationModel" label="规格型号" align="center" />
          <el-table-column prop="unit" label="单位" align="center" />
          <el-table-column prop="expressCompany" label="快递公司" align="center" />
          <el-table-column prop="expressNumber" label="快递单号" align="center" />
          <el-table-column prop="shippingCarNumber" label="发货车牌" align="center" />
          <el-table-column prop="shippingDate" label="发货日期" align="center" />
          <el-table-column prop="quantity" label="售后数量" align="center" />
        </el-table>
      </div>
    </div>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="closeDia">关闭</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup>
import { ref, computed, getCurrentInstance } from 'vue';
import { getAfterSalesServiceById } from '@/api/customerService/index.js';
const { proxy } = getCurrentInstance();
const dialogVisible = ref(false);
const loading = ref(false);
const detail = ref({});
const tableData = ref([]);
const { post_sale_waiting_list, degree_of_urgency } = proxy.useDict(
  "post_sale_waiting_list",
  "degree_of_urgency"
);
const classificationOptions = computed(() => post_sale_waiting_list?.value || []);
const degreeOfUrgencyOptions = computed(() => degree_of_urgency?.value || []);
const getDictLabel = (options, value) => {
  if (!value) return '-';
  const item = options.find(i => String(i.value) === String(value));
  return item ? item.label : value;
};
const openDialog = (row) => {
  dialogVisible.value = true;
  loading.value = true;
  detail.value = {};
  tableData.value = [];
  getAfterSalesServiceById(row.id).then(res => {
    loading.value = false;
    if (res.code === 200) {
      detail.value = res.data || {};
      let productData = res.data?.salesLedgerDto?.productData || [];
      const selectedIds = res.data.productModelIds ? String(res.data.productModelIds).split(",") : [];
      tableData.value = productData.filter(item => selectedIds.includes(String(item.id)));
    }
  }).catch(() => {
    loading.value = false;
  });
};
const closeDia = () => {
  dialogVisible.value = false;
};
defineExpose({
  openDialog
});
</script>
<style scoped>
.descriptions {
  display: inline-block;
  font-size: 1rem;
  font-weight: 600;
  padding-left: 12px;
  position: relative;
}
.descriptions::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 1rem;
  background-color: #002fa7;
  border-radius: 2px;
}
</style>
src/views/customerService/feedbackRegistration/components/formDia.vue
@@ -97,6 +97,9 @@
                {{ getShippingStatusText(row) }}
              </el-tag>
            </template>
            <template #quantity="{ row }">
              <el-input-number v-model="row.quantity" :min="0" size="small" />
            </template>
          </PIMTable>
        </div>
      </div>
@@ -147,6 +150,7 @@
      salesContractNo: "",
      proDesc: "",
      customerName: "",
      productModelQuantities: "",
    },
    rules: {
      customerName: [
@@ -240,25 +244,12 @@
      align: "center",
    },
    { label: "发货日期", prop: "shippingDate", minWidth: 100, align: "center" },
    { label: "数量", prop: "quantity", width: 100 },
    { label: "税率(%)", prop: "taxRate", width: 100 },
    {
      label: "含税单价(元)",
      prop: "taxInclusiveUnitPrice",
      width: 160,
      formatData: formatCurrency,
    },
    {
      label: "含税总价(元)",
      prop: "taxInclusiveTotalPrice",
      width: 160,
      formatData: formatCurrency,
    },
    {
      label: "不含税总价(元)",
      prop: "taxExclusiveTotalPrice",
      width: 160,
      formatData: formatCurrency,
      label: "数量",
      prop: "quantity",
      width: 140,
      dataType: "slot",
      slot: "quantity",
    },
    {
      dataType: "action",
@@ -326,7 +317,7 @@
      form.value.customerId = null;
    }
    getSalesLedger({
      customerName: form.value.customerName,
      customerId: form.value.customerId,
    }).then(res => {
      if (res.code === 200) {
        associatedSalesOrderNumberOptions.value = res.data.records.map(item => ({
@@ -434,7 +425,7 @@
      form.value = { ...row };
      if (form.value.customerName) {
        const res = await getSalesLedger({
          customerName: form.value.customerName,
          customerId: form.value.customerId,
        });
        if (res?.code === 200) {
          console.log(res);
@@ -446,6 +437,21 @@
              id: item.id,
            })
          );
          const opt = associatedSalesOrderNumberOptions.value.find(
            item => item.value === form.value.salesContractNo
          );
          if (opt) {
            let restoredData = (opt.productData || []).map(normalizeProductRow);
            const selectedIds = form.value.productModelIds ? String(form.value.productModelIds).split(",") : [];
            const quantities = form.value.productModelQuantities ? String(form.value.productModelQuantities).split(",") : [];
            tableData.value = restoredData.filter(item => selectedIds.includes(String(item.id))).map(item => {
              let qIndex = selectedIds.indexOf(String(item.id));
              if (qIndex !== -1 && qIndex < quantities.length && quantities[qIndex] !== "") {
                 item.quantity = Number(quantities[qIndex]);
              }
              return item;
            });
          }
        }
      }
      console.log(form.value);
@@ -458,6 +464,9 @@
        form.value.productModelIds = tableData.value
          .map(item => item.id)
          .join(",");
        form.value.productModelQuantities = tableData.value
          .map(item => item.quantity || 0)
          .join(",");
        if (operationType.value === "add") {
          afterSalesServiceAdd(form.value).then(response => {
            proxy.$modal.msgSuccess("新增成功");
src/views/customerService/feedbackRegistration/index.vue
@@ -112,6 +112,7 @@
    </div>
    <form-dia ref="formDia"
              @close="handleQuery"></form-dia>
    <view-dia ref="viewDia"></view-dia>
  </div>
</template>
@@ -126,6 +127,7 @@
    nextTick,
  } from "vue";
  import FormDia from "@/views/customerService/feedbackRegistration/components/formDia.vue";
  import ViewDia from "@/views/customerService/components/viewDia.vue";
  import { ElMessageBox } from "element-plus";
  import {
    afterSalesServiceDelete,
@@ -149,14 +151,14 @@
    {
      icon: markRaw(FolderOpened),
      count: 0,
      label: "已处理",
      label: "待处理",
      color: "#ff9a2e",
      bgColor: "#fff5e6",
    },
    {
      icon: markRaw(UserFilled),
      count: 0,
      label: "已完成",
      label: "已处理",
      color: "#00b42a",
      bgColor: "#e6f7ed",
    },
@@ -255,6 +257,15 @@
      align: "center",
    },
    {
      label: "数量",
      prop: "productModelQuantities",
      align: "center",
      formatData: params => {
        if (!params) return "0";
        return String(params).split(',').reduce((sum, val) => sum + (Number(val) || 0), 0);
      }
    },
    {
      label: "客户诉求",
      prop: "proDesc",
      width: 300,
@@ -269,7 +280,16 @@
      dataType: "action",
      label: "操作",
      fixed: "right",
      width: 180,
      align: "center",
      operation: [
        {
          name: "详情",
          type: "text",
          clickFun: row => {
            viewDia.value?.openDialog(row);
          },
        },
        {
          name: "编辑",
          type: "text",
@@ -307,9 +327,10 @@
    selectedRows.value = selection;
  };
  const formDia = ref();
  const viewDia = ref();
  // å­—典获取
  /*
  /*
  post_sale_waiting_list æ–°å¢žçš„售后分类
  degree_of_urgency æ–°å¢žçš„紧急程度
  work_order_status ä¸»é¡µçš„工单状态
@@ -424,8 +445,8 @@
      if (res.code === 200) {
        const statsData = Array.isArray(res.data) ? res.data : [];
        statsList.value[0].count = getStatsCountByStatus(statsData, 3);
        statsList.value[1].count = getStatsCountByStatus(statsData, 2);
        statsList.value[2].count = getStatsCountByStatus(statsData, 1);
        statsList.value[1].count = getStatsCountByStatus(statsData, 1);
        statsList.value[2].count = getStatsCountByStatus(statsData, 2);
      }
    });
  };
src/views/equipmentManagement/inspectionManagement/components/formDia.vue
@@ -237,6 +237,14 @@
    form.value = {...row}
    form.value.inspector = form.value.inspectorIds.split(',').map(Number)
    
    // å¤„理WEEKLY频率的回显:将frequencyDetail拆分为week和time
    if (form.value.frequencyType === 'WEEKLY' && form.value.frequencyDetail) {
      const parts = form.value.frequencyDetail.split(',')
      form.value.week = parts[0] || ''
      form.value.time = parts[1] || ''
      form.value.frequencyDetail = ''
    }
    // å¦‚果有设备ID,自动设置设备信息
    if (form.value.taskId) {
      setDeviceModel(form.value.taskId);
src/views/equipmentManagement/inspectionManagement/components/uploadFiles.vue
@@ -1,117 +1,131 @@
<template>
  <FormDialog
    v-model="dialogVisible"
    title="上传巡检记录"
    width="980px"
    @close="handleClose"
    @cancel="handleClose"
  >
  <FormDialog v-model="dialogVisible"
              :title="operationType === 'view' ? '巡检记录详情' : '上传巡检记录'"
              width="980px"
              :operation-type="operationType"
              @close="handleClose"
              @cancel="handleClose">
    <main class="upload-content">
      <el-card v-if="taskInfo" class="section-card">
        <el-descriptions :column="1" border>
      <el-card v-if="taskInfo"
               class="section-card">
        <el-descriptions :column="2"
                         border>
          <el-descriptions-item label="巡检任务名称">
            {{ taskInfo.taskName || "-" }}
          </el-descriptions-item>
          <el-descriptions-item label="巡检项目">
            {{ taskInfo.inspectionProject || "-" }}
          </el-descriptions-item>
          <el-descriptions-item label="执行巡检人">
            <template v-if="formattedInspector && formattedInspector.length">
              <el-tag v-for="tag in formattedInspector"
                      :key="tag"
                      size="small"
                      style="margin-right: 4px">
                {{ tag }}
              </el-tag>
            </template>
            <span v-else>--</span>
          </el-descriptions-item>
          <el-descriptions-item label="频次">
            {{ formatFrequencyType(taskInfo.frequencyType) || "-" }}
          </el-descriptions-item>
          <el-descriptions-item label="开始日期与时间">
            {{ formatFrequencyDetail(taskInfo.frequencyDetail) || "-" }}
          </el-descriptions-item>
          <el-descriptions-item label="登记人">
            {{ taskInfo.registrant || "-" }}
          </el-descriptions-item>
          <el-descriptions-item label="登记日期">
            {{ formatDateTime(taskInfo.createTime) || "-" }}
          </el-descriptions-item>
          <el-descriptions-item label="备注">
            {{ taskInfo.remarks || "-" }}
          </el-descriptions-item>
        </el-descriptions>
      </el-card>
      <el-card class="section-card">
        <h3>巡检状态</h3>
        <el-radio-group v-model="hasException">
        <el-radio-group v-model="hasException"
                        :disabled="operationType === 'view'">
          <el-radio-button :value="false">正常</el-radio-button>
          <el-radio-button :value="true">存在异常</el-radio-button>
        </el-radio-group>
      </el-card>
      <el-card v-if="hasException === true" class="section-card">
      <el-card v-if="hasException === true"
               class="section-card">
        <h3>异常描述</h3>
        <el-input
          v-model="abnormalDescription"
          type="textarea"
          maxlength="500"
          show-word-limit
          :rows="4"
          placeholder="请描述异常情况..."
        />
        <el-input v-model="abnormalDescription"
                  type="textarea"
                  maxlength="500"
                  show-word-limit
                  :rows="4"
                  :disabled="operationType === 'view'"
                  placeholder="请描述异常情况..." />
      </el-card>
      <el-card v-if="hasException === true" class="section-card">
        <el-tabs v-model="currentUploadType">
          <el-tab-pane label="生产前" name="before" />
          <el-tab-pane label="生产中" name="after" />
          <el-tab-pane label="生产后" name="issue" />
        </el-tabs>
        <div class="upload-buttons">
          <el-upload
            :show-file-list="false"
            :http-request="uploadFile"
            :disabled="getCurrentFiles().length >= uploadConfig.limit || uploading"
            accept="image/*"
          >
            <el-button type="primary" :loading="uploading">
              <el-icon><Camera /></el-icon>
      <el-card v-if="hasException === true"
               class="section-card">
        <div class="upload-buttons"
             v-if="operationType !== 'view'">
          <el-upload :show-file-list="false"
                     :http-request="uploadFile"
                     :disabled="beforeModelValue.length >= uploadConfig.limit || uploading"
                     accept="image/*">
            <el-button type="primary"
                       :loading="uploading">
              <el-icon>
                <Camera />
              </el-icon>
              é€‰æ‹©å›¾ç‰‡
            </el-button>
          </el-upload>
          <el-upload
            :show-file-list="false"
            :http-request="uploadFile"
            :disabled="getCurrentFiles().length >= uploadConfig.limit || uploading"
            accept="video/*"
          >
            <el-button type="success" :loading="uploading">
              <el-icon><VideoCamera /></el-icon>
          <el-upload :show-file-list="false"
                     :http-request="uploadFile"
                     :disabled="beforeModelValue.length >= uploadConfig.limit || uploading"
                     accept="video/*">
            <el-button type="success"
                       :loading="uploading">
              <el-icon>
                <VideoCamera />
              </el-icon>
              é€‰æ‹©è§†é¢‘
            </el-button>
          </el-upload>
        </div>
        <el-progress
          v-if="uploading"
          :percentage="uploadProgress"
          class="upload-progress"
        />
        <div v-if="getCurrentFiles().length" class="file-list">
          <div
            v-for="(file, index) in getCurrentFiles()"
            :key="file.uid || file.id || index"
            class="file-item"
          >
        <el-progress v-if="uploading"
                     :percentage="uploadProgress"
                     class="upload-progress" />
        <div v-if="beforeModelValue.length"
             class="file-list">
          <div v-for="(file, index) in beforeModelValue"
               :key="file.uid || file.id || index"
               class="file-item">
            <div class="file-preview-container">
              <el-image
                v-if="file.type === 'image' || !file.type"
                :src="file.url || file.tempFilePath || file.path || file.downloadUrl"
                fit="cover"
                class="file-preview"
                :preview-src-list="[file.url || file.tempFilePath || file.path || file.downloadUrl]"
                preview-teleported
              />
              <div v-else class="video-preview" @click="previewVideo(file)">
                <el-icon><VideoCamera /></el-icon>
              <el-image v-if="file.type === 'image' || !file.type"
                        :src="file.url || file.tempFilePath || file.path || file.downloadUrl"
                        fit="cover"
                        class="file-preview"
                        :preview-src-list="[file.url || file.tempFilePath || file.path || file.downloadUrl]"
                        preview-teleported />
              <div v-else
                   class="video-preview"
                   @click="previewVideo(file)">
                <el-icon>
                  <VideoCamera />
                </el-icon>
                <span>视频</span>
              </div>
              <el-button
                class="delete-btn"
                type="danger"
                circle
                size="small"
                @click="removeFile(index)"
              >
                <el-icon><Close /></el-icon>
              <el-button class="delete-btn"
                         type="danger"
                         circle
                         size="small"
                         v-if="operationType !== 'view'"
                         @click="removeFile(index)">
                <el-icon>
                  <Close />
                </el-icon>
              </el-button>
            </div>
            <div class="file-info">
              <div class="file-name">
                {{ file.bucketFilename || file.name || (file.type === "image" ? "图片" : "视频") }}
@@ -120,561 +134,559 @@
            </div>
          </div>
        </div>
        <el-empty
          v-else
          :description="`请选择要上传的${getUploadTypeText()}图片或视频`"
        />
        <el-alert
          class="upload-summary"
          type="info"
          :closable="false"
          :title="`生产前:${beforeModelValue.length}个文件 | ç”Ÿäº§ä¸­ï¼š${afterModelValue.length}个文件 | ç”Ÿäº§åŽï¼š${issueModelValue.length}个文件`"
        />
        <el-empty v-else
                  :description="operationType === 'view' ? '暂无异常照片或视频' : '请选择要上传的巡检图片或视频'" />
      </el-card>
      <el-result
        v-if="hasException === false"
        icon="success"
        title="设备运行正常"
        sub-title="无需上传照片"
      />
      <el-result v-if="hasException === false"
                 icon="success"
                 title="设备运行正常"
                 :sub-title="operationType === 'view' ? '' : '无需上传照片'" />
    </main>
    <template #footer>
      <footer class="footer-buttons">
        <el-button type="primary" @click="submitUpload">提交</el-button>
        <el-button v-if="hasException === true" type="warning" @click="goToRepair">
        <el-button type="primary"
                   v-if="operationType !== 'view'"
                   @click="submitUpload">提交</el-button>
        <el-button v-if="hasException === true && operationType !== 'view'"
                   type="warning"
                   @click="goToRepair">
          æ–°å¢žæŠ¥ä¿®
        </el-button>
        <el-button @click="handleClose">取消</el-button>
        <el-button @click="handleClose">{{ operationType === 'view' ? '关闭' : '取消' }}</el-button>
      </footer>
    </template>
  </FormDialog>
  <el-dialog
    v-model="showVideoDialog"
    :title="currentVideoFile?.originalFilename || currentVideoFile?.name || '视频预览'"
    width="720px"
  >
    <video
      v-if="currentVideoFile"
      :src="currentVideoFile.url || currentVideoFile.downloadUrl"
      class="video-player"
      controls
      autoplay
    />
  <el-dialog v-model="showVideoDialog"
             :title="currentVideoFile?.originalFilename || currentVideoFile?.name || '视频预览'"
             width="720px">
    <video v-if="currentVideoFile"
           :src="currentVideoFile.url || currentVideoFile.downloadUrl"
           class="video-player"
           controls
           autoplay />
  </el-dialog>
</template>
<script setup>
import { computed, ref } from "vue";
import { useRouter } from "vue-router";
import { ElLoading, ElMessage, ElMessageBox } from "element-plus";
import { Camera, Close, VideoCamera } from "@element-plus/icons-vue";
import axios from "axios";
import FormDialog from "@/components/Dialog/FormDialog.vue";
import { uploadInspectionTask } from "@/api/inspectionManagement/index.js";
import { getToken } from "@/utils/auth";
  import { computed, ref } from "vue";
  import { useRouter } from "vue-router";
  import { ElLoading, ElMessage, ElMessageBox } from "element-plus";
  import { Camera, Close, VideoCamera } from "@element-plus/icons-vue";
  import axios from "axios";
  import dayjs from "dayjs";
  import FormDialog from "@/components/Dialog/FormDialog.vue";
  import { uploadInspectionTask } from "@/api/inspectionManagement/index.js";
  import { getToken } from "@/utils/auth";
const emit = defineEmits(["closeDia", "success"]);
const router = useRouter();
  const emit = defineEmits(["closeDia", "success"]);
  const router = useRouter();
const dialogVisible = ref(false);
const taskInfo = ref(null);
const uploading = ref(false);
const uploadProgress = ref(0);
  const dialogVisible = ref(false);
  const taskInfo = ref(null);
  const uploading = ref(false);
  const uploadProgress = ref(0);
  const operationType = ref("add"); // add, view
const beforeModelValue = ref([]);
const afterModelValue = ref([]);
const issueModelValue = ref([]);
  const beforeModelValue = ref([]);
const currentUploadType = ref("before");
const hasException = ref(null);
const abnormalDescription = ref("");
const showVideoDialog = ref(false);
const currentVideoFile = ref(null);
const uploadConfig = {
  action: "/common/upload",
  limit: 10,
  fileSize: 50,
  fileType: ["jpg", "jpeg", "png", "mp4", "mov"],
};
const uploadFileUrl = computed(
  () => `${import.meta.env.VITE_APP_BASE_API}${uploadConfig.action}`
);
const processFileUrl = fileUrl => {
  if (!fileUrl) return "";
  let currentUrl = String(fileUrl);
  if (currentUrl.includes("\\")) {
    const uploadsIndex = currentUrl.toLowerCase().indexOf("uploads");
    if (uploadsIndex > -1) {
      currentUrl = `/${currentUrl.substring(uploadsIndex).replace(/\\/g, "/")}`;
    } else {
      const fileName = currentUrl.split("\\").pop();
      currentUrl = `/uploads/${fileName}`;
  const formattedInspector = computed(() => {
    if (!taskInfo.value?.inspector) return [];
    if (Array.isArray(taskInfo.value.inspector)) return taskInfo.value.inspector;
    if (typeof taskInfo.value.inspector === "string") {
      return taskInfo.value.inspector
        .split(",")
        .map(s => s.trim())
        .filter(s => s);
    }
  }
  if (currentUrl && !currentUrl.startsWith("http")) {
    if (!currentUrl.startsWith("/")) {
      currentUrl = `/${currentUrl}`;
    }
    currentUrl = __BASE_API__ + currentUrl;
  }
  return currentUrl;
};
const normalizeList = (list, fileType) => {
  if (!Array.isArray(list)) return [];
  return list.filter(Boolean).map(item => {
    let currentType = item.type;
    if (!currentType && item.contentType) {
      currentType = item.contentType.startsWith("video") ? "video" : "image";
    } else if (!currentType) {
      currentType = fileType || "image";
    }
    return {
      ...item,
      url: processFileUrl(item.url || item.previewURL || item.downloadUrl || item.path || ""),
      downloadUrl: processFileUrl(
        item.downloadUrl || item.url || item.previewURL || item.path || ""
      ),
      name: item.name || item.originalFilename || item.bucketFilename,
      tempId: item.tempId || item.id || item.tempFileId,
      tempFileId: item.tempFileId || item.tempId || item.id,
      size: item.size || item.byteSize || 0,
      type: currentType,
      status: "success",
      uid: item.uid || `${Date.now()}-${Math.random()}`,
    };
  });
};
const resetState = () => {
  taskInfo.value = null;
  beforeModelValue.value = [];
  afterModelValue.value = [];
  issueModelValue.value = [];
  currentUploadType.value = "before";
  hasException.value = null;
  abnormalDescription.value = "";
  uploading.value = false;
  uploadProgress.value = 0;
  showVideoDialog.value = false;
  currentVideoFile.value = null;
};
const openDialog = row => {
  const raw = JSON.parse(JSON.stringify(row?.__raw || row || {}));
  taskInfo.value = raw;
  beforeModelValue.value = normalizeList(
    raw.commonFileListBeforeVO || raw.commonFileListBefore || [],
    "image"
  );
  afterModelValue.value = normalizeList(
    raw.commonFileListVO || raw.commonFileList || [],
    "image"
  );
  issueModelValue.value = normalizeList(
    raw.commonFileListAfterVO || raw.commonFileListAfter || [],
    "image"
  );
  abnormalDescription.value = raw.abnormalDescription || "";
  if (raw.hasException !== undefined && raw.hasException !== null) {
    hasException.value = raw.hasException;
  } else if (raw.inspectionResult !== undefined && raw.inspectionResult !== null) {
    hasException.value = String(raw.inspectionResult) === "0";
  } else {
    hasException.value = null;
  }
  if (
    hasException.value !== true &&
    (beforeModelValue.value.length || afterModelValue.value.length || issueModelValue.value.length)
  ) {
    hasException.value = true;
  }
  dialogVisible.value = true;
};
const handleClose = () => {
  dialogVisible.value = false;
  resetState();
  emit("closeDia");
};
const getCurrentFiles = () => {
  if (currentUploadType.value === "before") return beforeModelValue.value;
  if (currentUploadType.value === "after") return afterModelValue.value;
  if (currentUploadType.value === "issue") return issueModelValue.value;
  return [];
};
const getUploadTypeText = () => {
  if (currentUploadType.value === "before") return "生产前";
  if (currentUploadType.value === "after") return "生产中";
  if (currentUploadType.value === "issue") return "生产后";
  return "";
};
const getTabType = () => {
  if (currentUploadType.value === "before") return 10;
  if (currentUploadType.value === "after") return 11;
  if (currentUploadType.value === "issue") return 12;
  return 10;
};
const previewVideo = file => {
  currentVideoFile.value = file;
  showVideoDialog.value = true;
};
const uploadFile = async uploadRequest => {
  const rawFile = uploadRequest.file;
  if (getCurrentFiles().length >= uploadConfig.limit) {
    ElMessage.warning(`最多只能选择${uploadConfig.limit}个文件`);
    return;
  }
  const ext = rawFile.name.split(".").pop()?.toLowerCase();
  if (!uploadConfig.fileType.includes(ext)) {
    ElMessage.warning(`文件格式不支持,请上传 ${uploadConfig.fileType.join("/")} æ ¼å¼`);
    return;
  }
  if (rawFile.size > uploadConfig.fileSize * 1024 * 1024) {
    ElMessage.warning(`文件大小不能超过 ${uploadConfig.fileSize}MB`);
    return;
  }
  const token = getToken();
  if (!token) {
    ElMessage.warning("用户未登录");
    return;
  }
  const formData = new FormData();
  formData.append("files", rawFile);
  formData.append("type", getTabType());
  uploading.value = true;
  uploadProgress.value = 0;
  try {
    const { data } = await axios.post(uploadFileUrl.value, formData, {
      headers: {
        Authorization: `Bearer ${token}`,
        "Content-Type": "multipart/form-data",
      },
      onUploadProgress: event => {
        if (event.total) {
          uploadProgress.value = Math.round((event.loaded / event.total) * 100);
        }
      },
    });
    if (data.code !== 200) {
      ElMessage.error(data.msg || "上传失败");
      return;
    }
    const resultData = Array.isArray(data.data) ? data.data[0] : data.data;
    const finalUrl = processFileUrl(
      resultData.url || resultData.previewURL || resultData.downloadUrl || ""
    );
    const finalName = resultData.name || resultData.originalFilename || resultData.bucketFilename;
    const finalId = resultData.tempId || resultData.id || resultData.tempFileId;
    const uploadedFile = {
      ...resultData,
      url: finalUrl,
      downloadUrl: finalUrl,
      name: finalName,
      tempId: finalId,
      tempFileId: resultData.tempFileId || finalId,
      size: rawFile.size || resultData.size || resultData.byteSize || 0,
      type: rawFile.type?.startsWith("video") ? "video" : "image",
      status: "success",
      uid: `${Date.now()}-${Math.random()}`,
    };
    getCurrentFiles().push(uploadedFile);
    ElMessage.success("上传成功");
  } catch (error) {
    ElMessage.error(error?.message || "上传失败");
  } finally {
    uploading.value = false;
  }
};
const buildFileItem = item => ({
  id: item?.id,
  tempId: item?.tempId,
  tempFileId: item?.tempFileId,
  url: item?.downloadUrl || item?.url || "",
  downloadUrl: item?.downloadUrl || item?.url || "",
  name: item?.name,
  bucketFilename: item?.bucketFilename || item?.name,
  originalFilename: item?.originalFilename || item?.name,
  size: item?.size || 0,
  byteSize: item?.byteSize || item?.size || 0,
  contentType: item?.contentType || "",
  type: item?.type,
});
const submitUpload = async () => {
  if (hasException.value === null) {
    ElMessage.warning("请选择巡检状态");
    return;
  }
  if (hasException.value === true) {
    const totalFiles =
      beforeModelValue.value.length +
      afterModelValue.value.length +
      issueModelValue.value.length;
    if (!totalFiles) {
      ElMessage.warning("请上传异常照片或视频");
      return;
    }
    if (!abnormalDescription.value.trim()) {
      ElMessage.warning("请填写异常描述");
      return;
    }
  }
  const loading = ElLoading.service({
    text: "提交中...",
    background: "rgba(0, 0, 0, 0.3)",
    return [taskInfo.value.inspector];
  });
  try {
    const allFiles = [
      ...beforeModelValue.value,
      ...afterModelValue.value,
      ...issueModelValue.value,
    ];
    const tempFileIds = allFiles
      .map(item => item?.tempId ?? item?.tempFileId ?? item?.id)
      .filter(Boolean);
    const {
      createTime,
      updateTime,
      storageBlobDTO,
      commonFileListAfterVO,
      commonFileListVO,
      commonFileListBeforeVO,
      commonFileListAfter,
      commonFileList,
      commonFileListBefore,
      __raw,
      ...baseTaskInfo
    } = taskInfo.value || {};
    const submitData = {
      ...baseTaskInfo,
      commonFileListBeforeDTO: beforeModelValue.value.map(buildFileItem),
      commonFileListDTO: afterModelValue.value.map(buildFileItem),
      commonFileListAfterDTO: issueModelValue.value.map(buildFileItem),
      hasException: hasException.value,
      inspectionResult: hasException.value ? 0 : 1,
      abnormalDescription: abnormalDescription.value,
      tempFileIds,
  const formatFrequencyType = type => {
    const mapping = {
      DAILY: "每日",
      WEEKLY: "每周",
      MONTHLY: "每月",
      QUARTERLY: "季度",
    };
    const result = await uploadInspectionTask(submitData);
    if (result && (result.code === 200 || result.success)) {
      ElMessage.success("提交成功");
      dialogVisible.value = false;
      resetState();
      emit("success");
      emit("closeDia");
    } else {
      ElMessage.error(result?.msg || result?.message || "提交失败");
    }
  } catch (error) {
    ElMessage.error(error?.message || "提交失败");
  } finally {
    loading.close();
  }
};
const removeFile = async index => {
  try {
    await ElMessageBox.confirm("确定要删除这个文件吗?", "确认删除", {
      type: "warning",
    });
    getCurrentFiles().splice(index, 1);
  } catch {}
};
const goToRepair = () => {
  const taskData = {
    taskId: taskInfo.value?.taskId || taskInfo.value?.id,
    taskName: taskInfo.value?.taskName,
    inspectionLocation: taskInfo.value?.inspectionLocation,
    inspector: taskInfo.value?.inspector,
    hasException: hasException.value,
    inspectionResult: hasException.value ? 0 : 1,
    commonFileListBeforeDTO: beforeModelValue.value.map(buildFileItem),
    commonFileListDTO: afterModelValue.value.map(buildFileItem),
    commonFileListAfterDTO: issueModelValue.value.map(buildFileItem),
    uploadedFiles: {
      before: beforeModelValue.value,
      after: afterModelValue.value,
      issue: issueModelValue.value,
    },
    return mapping[type] || type;
  };
  sessionStorage.setItem("repairTaskInfo", JSON.stringify(taskData));
  router.push("/equipmentManagement/repair/add");
};
  const formatFrequencyDetail = detail => {
    if (typeof detail !== "string") return detail;
    const replacements = {
      MON: "周一",
      TUE: "周二",
      WED: "周三",
      THU: "周四",
      FRI: "周五",
      SAT: "周六",
      SUN: "周日",
    };
    return detail.replace(
      /MON|TUE|WED|THU|FRI|SAT|SUN/g,
      match => replacements[match]
    );
  };
const formatFileSize = size => {
  if (!size) return "0 B";
  const formatDateTime = date => {
    if (!date) return "-";
    return dayjs(date).format("YYYY-MM-DD");
  };
  const units = ["B", "KB", "MB", "GB"];
  let index = 0;
  let fileSize = size;
  const hasException = ref(null);
  const abnormalDescription = ref("");
  while (fileSize >= 1024 && index < units.length - 1) {
    fileSize /= 1024;
    index += 1;
  }
  const showVideoDialog = ref(false);
  const currentVideoFile = ref(null);
  return `${fileSize.toFixed(2)} ${units[index]}`;
};
  const uploadConfig = {
    action: "/common/upload",
    limit: 10,
    fileSize: 50,
    fileType: ["jpg", "jpeg", "png", "mp4", "mov"],
  };
defineExpose({
  openDialog,
});
  const uploadFileUrl = computed(
    () => `${import.meta.env.VITE_APP_BASE_API}${uploadConfig.action}`
  );
  const processFileUrl = fileUrl => {
    if (!fileUrl) return "";
    let currentUrl = String(fileUrl);
    if (currentUrl.includes("\\")) {
      const uploadsIndex = currentUrl.toLowerCase().indexOf("uploads");
      if (uploadsIndex > -1) {
        currentUrl = `/${currentUrl.substring(uploadsIndex).replace(/\\/g, "/")}`;
      } else {
        const fileName = currentUrl.split("\\").pop();
        currentUrl = `/uploads/${fileName}`;
      }
    }
    if (currentUrl && !currentUrl.startsWith("http")) {
      if (!currentUrl.startsWith("/")) {
        currentUrl = `/${currentUrl}`;
      }
      currentUrl = __BASE_API__ + currentUrl;
    }
    return currentUrl;
  };
  const normalizeList = (list, fileType) => {
    if (!Array.isArray(list)) return [];
    return list.filter(Boolean).map(item => {
      let currentType = item.type;
      if (!currentType && item.contentType) {
        currentType = item.contentType.startsWith("video") ? "video" : "image";
      } else if (!currentType) {
        currentType = fileType || "image";
      }
      return {
        ...item,
        url: processFileUrl(
          item.url || item.previewURL || item.downloadUrl || item.path || ""
        ),
        downloadUrl: processFileUrl(
          item.downloadUrl || item.url || item.previewURL || item.path || ""
        ),
        name: item.name || item.originalFilename || item.bucketFilename,
        tempId: item.tempId || item.id || item.tempFileId,
        tempFileId: item.tempFileId || item.tempId || item.id,
        size: item.size || item.byteSize || 0,
        type: currentType,
        status: "success",
        uid: item.uid || `${Date.now()}-${Math.random()}`,
      };
    });
  };
  const resetState = () => {
    taskInfo.value = null;
    beforeModelValue.value = [];
    hasException.value = null;
    abnormalDescription.value = "";
    uploading.value = false;
    uploadProgress.value = 0;
    showVideoDialog.value = false;
    currentVideoFile.value = null;
    operationType.value = "add";
  };
  const openDialog = (type, row) => {
    operationType.value = type || "add";
    const raw = JSON.parse(JSON.stringify(row?.__raw || row || {}));
    taskInfo.value = raw;
    beforeModelValue.value = normalizeList(
      raw.commonFileListBeforeVO || raw.commonFileListBefore || [],
      "image"
    );
    abnormalDescription.value = raw.abnormalDescription || "";
    if (raw.hasException !== undefined && raw.hasException !== null) {
      hasException.value = raw.hasException;
    } else if (
      raw.inspectionResult !== undefined &&
      raw.inspectionResult !== null
    ) {
      hasException.value = String(raw.inspectionResult) === "0";
    } else {
      hasException.value = null;
    }
    if (hasException.value !== true && beforeModelValue.value.length) {
      hasException.value = true;
    }
    dialogVisible.value = true;
  };
  const handleClose = () => {
    dialogVisible.value = false;
    resetState();
    emit("closeDia");
  };
  const previewVideo = file => {
    currentVideoFile.value = file;
    showVideoDialog.value = true;
  };
  const uploadFile = async uploadRequest => {
    const rawFile = uploadRequest.file;
    if (beforeModelValue.value.length >= uploadConfig.limit) {
      ElMessage.warning(`最多只能选择${uploadConfig.limit}个文件`);
      return;
    }
    const ext = rawFile.name.split(".").pop()?.toLowerCase();
    if (!uploadConfig.fileType.includes(ext)) {
      ElMessage.warning(
        `文件格式不支持,请上传 ${uploadConfig.fileType.join("/")} æ ¼å¼`
      );
      return;
    }
    if (rawFile.size > uploadConfig.fileSize * 1024 * 1024) {
      ElMessage.warning(`文件大小不能超过 ${uploadConfig.fileSize}MB`);
      return;
    }
    const token = getToken();
    if (!token) {
      ElMessage.warning("用户未登录");
      return;
    }
    const formData = new FormData();
    formData.append("files", rawFile);
    formData.append("type", 10); // ç”Ÿäº§å‰å›ºå®šä¸º10
    uploading.value = true;
    uploadProgress.value = 0;
    try {
      const { data } = await axios.post(uploadFileUrl.value, formData, {
        headers: {
          Authorization: `Bearer ${token}`,
          "Content-Type": "multipart/form-data",
        },
        onUploadProgress: event => {
          if (event.total) {
            uploadProgress.value = Math.round((event.loaded / event.total) * 100);
          }
        },
      });
      if (data.code !== 200) {
        ElMessage.error(data.msg || "上传失败");
        return;
      }
      const resultData = Array.isArray(data.data) ? data.data[0] : data.data;
      const finalUrl = processFileUrl(
        resultData.url || resultData.previewURL || resultData.downloadUrl || ""
      );
      const finalName =
        resultData.name ||
        resultData.originalFilename ||
        resultData.bucketFilename;
      const finalId = resultData.tempId || resultData.id || resultData.tempFileId;
      const uploadedFile = {
        ...resultData,
        url: finalUrl,
        downloadUrl: finalUrl,
        name: finalName,
        tempId: finalId,
        tempFileId: resultData.tempFileId || finalId,
        size: rawFile.size || resultData.size || resultData.byteSize || 0,
        type: rawFile.type?.startsWith("video") ? "video" : "image",
        status: "success",
        uid: `${Date.now()}-${Math.random()}`,
      };
      beforeModelValue.value.push(uploadedFile);
      ElMessage.success("上传成功");
    } catch (error) {
      ElMessage.error(error?.message || "上传失败");
    } finally {
      uploading.value = false;
    }
  };
  const buildFileItem = item => ({
    id: item?.id,
    tempId: item?.tempId,
    tempFileId: item?.tempFileId,
    url: item?.downloadUrl || item?.url || "",
    downloadUrl: item?.downloadUrl || item?.url || "",
    name: item?.name,
    bucketFilename: item?.bucketFilename || item?.name,
    originalFilename: item?.originalFilename || item?.name,
    size: item?.size || 0,
    byteSize: item?.byteSize || item?.size || 0,
    contentType: item?.contentType || "",
    type: item?.type,
  });
  const submitUpload = async () => {
    if (hasException.value === null) {
      ElMessage.warning("请选择巡检状态");
      return;
    }
    if (hasException.value === true) {
      const totalFiles = beforeModelValue.value.length;
      if (!totalFiles) {
        ElMessage.warning("请上传异常照片或视频");
        return;
      }
      if (!abnormalDescription.value.trim()) {
        ElMessage.warning("请填写异常描述");
        return;
      }
    }
    const loading = ElLoading.service({
      text: "提交中...",
      background: "rgba(0, 0, 0, 0.3)",
    });
    try {
      const allFiles = [...beforeModelValue.value];
      const tempFileIds = allFiles
        .map(item => item?.tempId ?? item?.tempFileId ?? item?.id)
        .filter(Boolean);
      const {
        createTime,
        updateTime,
        storageBlobDTO,
        commonFileListAfterVO,
        commonFileListVO,
        commonFileListBeforeVO,
        commonFileListAfter,
        commonFileList,
        commonFileListBefore,
        __raw,
        ...baseTaskInfo
      } = taskInfo.value || {};
      const submitData = {
        ...baseTaskInfo,
        commonFileListBeforeDTO: beforeModelValue.value.map(buildFileItem),
        commonFileListDTO: [],
        commonFileListAfterDTO: [],
        hasException: hasException.value,
        inspectionResult: hasException.value ? 0 : 1,
        abnormalDescription: abnormalDescription.value,
        tempFileIds,
      };
      const result = await uploadInspectionTask(submitData);
      if (result && (result.code === 200 || result.success)) {
        ElMessage.success("提交成功");
        dialogVisible.value = false;
        resetState();
        emit("success");
        emit("closeDia");
      } else {
        ElMessage.error(result?.msg || result?.message || "提交失败");
      }
    } catch (error) {
      ElMessage.error(error?.message || "提交失败");
    } finally {
      loading.close();
    }
  };
  const removeFile = async index => {
    try {
      await ElMessageBox.confirm("确定要删除这个文件吗?", "确认删除", {
        type: "warning",
      });
      beforeModelValue.value.splice(index, 1);
    } catch {}
  };
  const goToRepair = () => {
    const taskData = {
      taskId: taskInfo.value?.taskId || taskInfo.value?.id,
      taskName: taskInfo.value?.taskName,
      inspectionLocation: taskInfo.value?.inspectionLocation,
      inspector: taskInfo.value?.inspector,
      hasException: hasException.value,
      inspectionResult: hasException.value ? 0 : 1,
      commonFileListBeforeDTO: beforeModelValue.value.map(buildFileItem),
      commonFileListDTO: [],
      commonFileListAfterDTO: [],
      uploadedFiles: {
        before: beforeModelValue.value,
        after: [],
        issue: [],
      },
    };
    sessionStorage.setItem("repairTaskInfo", JSON.stringify(taskData));
    router.push("/equipmentManagement/repair/add");
  };
  const formatFileSize = size => {
    if (!size) return "0 B";
    const units = ["B", "KB", "MB", "GB"];
    let index = 0;
    let fileSize = size;
    while (fileSize >= 1024 && index < units.length - 1) {
      fileSize /= 1024;
      index += 1;
    }
    return `${fileSize.toFixed(2)} ${units[index]}`;
  };
  defineExpose({
    openDialog,
  });
</script>
<style scoped>
.inspection-upload-page {
  min-height: 70vh;
  background: #f5f7fa;
  padding: 20px 20px 90px;
  box-sizing: border-box;
}
  .inspection-upload-page {
    min-height: 70vh;
    background: #f5f7fa;
    padding: 20px 20px 90px;
    box-sizing: border-box;
  }
.upload-content {
  max-width: 960px;
  margin: 20px auto 0;
}
  .upload-content {
    max-width: 960px;
    margin: 20px auto 0;
  }
.section-card {
  margin-bottom: 16px;
}
  .section-card {
    margin-bottom: 16px;
  }
.section-card h3 {
  margin: 0 0 16px;
  font-size: 16px;
}
  .section-card h3 {
    margin: 0 0 16px;
    font-size: 16px;
  }
.upload-buttons {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}
  .upload-buttons {
    display: flex;
    gap: 12px;
    margin: 16px 0;
  }
.upload-progress {
  margin-bottom: 16px;
}
  .upload-progress {
    margin-bottom: 16px;
  }
.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
  .file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
.file-preview-container {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f2f3f5;
}
  .file-preview-container {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f2f3f5;
  }
.file-preview {
  width: 100%;
  height: 100%;
}
  .file-preview {
    width: 100%;
    height: 100%;
  }
.video-preview {
  width: 100%;
  height: 100%;
  background: #303133;
  color: #fff;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
  .video-preview {
    width: 100%;
    height: 100%;
    background: #303133;
    color: #fff;
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
.delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
}
  .delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
  }
.file-info {
  margin-top: 6px;
  font-size: 12px;
}
  .file-info {
    margin-top: 6px;
    font-size: 12px;
  }
.file-name {
  color: #606266;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
  .file-name {
    color: #606266;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
.file-size {
  color: #909399;
  margin-top: 2px;
}
  .file-size {
    color: #909399;
    margin-top: 2px;
  }
.upload-summary {
  margin-top: 16px;
}
  .upload-summary {
    margin-top: 16px;
  }
.footer-buttons {
  position: sticky;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 20px 0;
  background: #f5f7fa;
  display: flex;
  justify-content: center;
  gap: 12px;
}
  .footer-buttons {
    position: sticky;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 20px 0;
    background: #f5f7fa;
    display: flex;
    justify-content: center;
    gap: 12px;
  }
.video-player {
  width: 100%;
  max-height: 70vh;
  background: #000;
}
  .video-player {
    width: 100%;
    max-height: 70vh;
    background: #000;
  }
</style>
src/views/equipmentManagement/inspectionManagement/components/viewFiles.vue
@@ -1,37 +1,35 @@
<template>
  <div>
    <el-dialog title="查看附件" v-model="dialogVisitable" width="800px" @close="cancel">
    <el-dialog title="查看附件"
               v-model="dialogVisitable"
               width="800px"
               @close="cancel">
      <div class="upload-container">
        <div class="form-container">
          <div class="title">生产前</div>
          <div class="title">图片列表</div>
          <div class="media-list">
            <img
              v-for="(item, index) in beforeProductionImgs"
              :key="`before-img-${index}`"
              :src="item"
              alt=""
              class="media-image"
              @click="showMedia(beforeProductionImgs, index, 'image')"
            />
            <img v-for="(item, index) in beforeProductionImgs"
                 :key="`before-img-${index}`"
                 :src="item"
                 alt=""
                 class="media-image"
                 @click="showMedia(beforeProductionImgs, index, 'image')" />
          </div>
          <div class="media-list">
            <div
              v-for="(videoUrl, index) in beforeProductionVideos"
              :key="`before-video-${index}`"
              class="video-item"
              @click="showMedia(beforeProductionVideos, index, 'video')"
            >
            <div v-for="(videoUrl, index) in beforeProductionVideos"
                 :key="`before-video-${index}`"
                 class="video-item"
                 @click="showMedia(beforeProductionVideos, index, 'video')">
              <div class="video-thumb">
                <img src="@/assets/images/video.png" alt="播放" class="video-icon" />
                <img src="@/assets/images/video.png"
                     alt="播放"
                     class="video-icon" />
              </div>
              <div class="video-text">点击播放</div>
            </div>
          </div>
        </div>
        <div class="form-container">
        <!-- <div class="form-container">
          <div class="title">生产中</div>
          <div class="media-list">
@@ -87,22 +85,25 @@
              <div class="video-text">点击播放</div>
            </div>
          </div>
        </div>
        </div> -->
      </div>
    </el-dialog>
    <div v-if="isMediaViewerVisible" class="media-viewer-overlay" @click.self="closeMediaViewer">
      <div class="media-viewer-content" @click.stop>
        <vue-easy-lightbox
          v-if="mediaType === 'image'"
          :visible="isMediaViewerVisible"
          :imgs="mediaList"
          :index="currentMediaIndex"
          @hide="closeMediaViewer"
        />
        <div v-else-if="mediaType === 'video'" class="video-player-wrap">
          <video :src="mediaList[currentMediaIndex]" autoplay controls class="video-player" />
    <div v-if="isMediaViewerVisible"
         class="media-viewer-overlay"
         @click.self="closeMediaViewer">
      <div class="media-viewer-content"
           @click.stop>
        <vue-easy-lightbox v-if="mediaType === 'image'"
                           :visible="isMediaViewerVisible"
                           :imgs="mediaList"
                           :index="currentMediaIndex"
                           @hide="closeMediaViewer" />
        <div v-else-if="mediaType === 'video'"
             class="video-player-wrap">
          <video :src="mediaList[currentMediaIndex]"
                 autoplay
                 controls
                 class="video-player" />
        </div>
      </div>
    </div>
@@ -110,215 +111,215 @@
</template>
<script setup>
import { ref } from "vue";
import VueEasyLightbox from "vue-easy-lightbox";
  import { ref } from "vue";
  import VueEasyLightbox from "vue-easy-lightbox";
const dialogVisitable = ref(false);
  const dialogVisitable = ref(false);
const beforeProductionImgs = ref([]);
const afterProductionImgs = ref([]);
const productionIssuesImgs = ref([]);
  const beforeProductionImgs = ref([]);
  const afterProductionImgs = ref([]);
  const productionIssuesImgs = ref([]);
const beforeProductionVideos = ref([]);
const afterProductionVideos = ref([]);
const productionIssuesVideos = ref([]);
  const beforeProductionVideos = ref([]);
  const afterProductionVideos = ref([]);
  const productionIssuesVideos = ref([]);
const isMediaViewerVisible = ref(false);
const currentMediaIndex = ref(0);
const mediaList = ref([]);
const mediaType = ref("image");
  const isMediaViewerVisible = ref(false);
  const currentMediaIndex = ref(0);
  const mediaList = ref([]);
  const mediaType = ref("image");
const processFileUrl = fileUrl => {
  if (!fileUrl) return "";
  const processFileUrl = fileUrl => {
    if (!fileUrl) return "";
  let currentUrl = String(fileUrl);
  if (currentUrl.includes("\\")) {
    const uploadsIndex = currentUrl.toLowerCase().indexOf("uploads");
    if (uploadsIndex > -1) {
      currentUrl = `/${currentUrl.substring(uploadsIndex).replace(/\\/g, "/")}`;
    } else {
      const fileName = currentUrl.split("\\").pop();
      currentUrl = `/uploads/${fileName}`;
    let currentUrl = String(fileUrl);
    if (currentUrl.includes("\\")) {
      const uploadsIndex = currentUrl.toLowerCase().indexOf("uploads");
      if (uploadsIndex > -1) {
        currentUrl = `/${currentUrl.substring(uploadsIndex).replace(/\\/g, "/")}`;
      } else {
        const fileName = currentUrl.split("\\").pop();
        currentUrl = `/uploads/${fileName}`;
      }
    }
  }
  if (currentUrl && !currentUrl.startsWith("http")) {
    if (!currentUrl.startsWith("/")) {
      currentUrl = `/${currentUrl}`;
    if (currentUrl && !currentUrl.startsWith("http")) {
      if (!currentUrl.startsWith("/")) {
        currentUrl = `/${currentUrl}`;
      }
      currentUrl = __BASE_API__ + currentUrl;
    }
    currentUrl = __BASE_API__ + currentUrl;
  }
  return currentUrl;
};
    return currentUrl;
  };
const processItems = items => {
  const images = [];
  const videos = [];
  const processItems = items => {
    const images = [];
    const videos = [];
  if (!Array.isArray(items)) {
    if (!Array.isArray(items)) {
      return { images, videos };
    }
    items.forEach(item => {
      if (!item) return;
      const fileUrl = processFileUrl(
        item.previewURL || item.url || item.downloadUrl || item.path || ""
      );
      const contentType = String(item.contentType || "").toLowerCase();
      if (!fileUrl) return;
      if (contentType.startsWith("video/")) {
        videos.push(fileUrl);
        return;
      }
      images.push(fileUrl);
    });
    return { images, videos };
  }
  };
  items.forEach(item => {
    if (!item) return;
    const fileUrl = processFileUrl(
      item.previewURL || item.url || item.downloadUrl || item.path || ""
  const openDialog = row => {
    const { images: beforeImgs, videos: beforeVids } = processItems(
      row.commonFileListBeforeVO || []
    );
    const contentType = String(item.contentType || "").toLowerCase();
    const { images: afterImgs, videos: afterVids } = processItems(
      row.commonFileListVO || []
    );
    const { images: issueImgs, videos: issueVids } = processItems(
      row.commonFileListAfterVO || []
    );
    if (!fileUrl) return;
    beforeProductionImgs.value = beforeImgs;
    beforeProductionVideos.value = beforeVids;
    afterProductionImgs.value = afterImgs;
    afterProductionVideos.value = afterVids;
    productionIssuesImgs.value = issueImgs;
    productionIssuesVideos.value = issueVids;
    dialogVisitable.value = true;
  };
    if (contentType.startsWith("video/")) {
      videos.push(fileUrl);
      return;
    }
  const showMedia = (items, index, type) => {
    mediaList.value = items;
    currentMediaIndex.value = index;
    mediaType.value = type;
    isMediaViewerVisible.value = true;
  };
    images.push(fileUrl);
  });
  const closeMediaViewer = () => {
    isMediaViewerVisible.value = false;
    mediaList.value = [];
    mediaType.value = "image";
  };
  return { images, videos };
};
  const cancel = () => {
    dialogVisitable.value = false;
  };
const openDialog = row => {
  const { images: beforeImgs, videos: beforeVids } = processItems(
    row.commonFileListBeforeVO || []
  );
  const { images: afterImgs, videos: afterVids } = processItems(
    row.commonFileListVO || []
  );
  const { images: issueImgs, videos: issueVids } = processItems(
    row.commonFileListAfterVO || []
  );
  beforeProductionImgs.value = beforeImgs;
  beforeProductionVideos.value = beforeVids;
  afterProductionImgs.value = afterImgs;
  afterProductionVideos.value = afterVids;
  productionIssuesImgs.value = issueImgs;
  productionIssuesVideos.value = issueVids;
  dialogVisitable.value = true;
};
const showMedia = (items, index, type) => {
  mediaList.value = items;
  currentMediaIndex.value = index;
  mediaType.value = type;
  isMediaViewerVisible.value = true;
};
const closeMediaViewer = () => {
  isMediaViewerVisible.value = false;
  mediaList.value = [];
  mediaType.value = "image";
};
const cancel = () => {
  dialogVisitable.value = false;
};
defineExpose({ openDialog });
  defineExpose({ openDialog });
</script>
<style scoped lang="scss">
.upload-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  border: 1px solid #dcdfe6;
  box-sizing: border-box;
  .upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 1px solid #dcdfe6;
    box-sizing: border-box;
  .form-container {
    flex: 1;
    width: 100%;
    margin-bottom: 20px;
    .form-container {
      flex: 1;
      width: 100%;
      margin-bottom: 20px;
    }
  }
}
.title {
  font-size: 14px;
  color: #165dff;
  line-height: 20px;
  font-weight: 600;
  padding-left: 10px;
  position: relative;
  margin: 6px 0;
  .title {
    font-size: 14px;
    color: #165dff;
    line-height: 20px;
    font-weight: 600;
    padding-left: 10px;
    position: relative;
    margin: 6px 0;
  &::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    width: 4px;
    height: 14px;
    background-color: #165dff;
    &::before {
      content: "";
      position: absolute;
      left: 0;
      top: 3px;
      width: 4px;
      height: 14px;
      background-color: #165dff;
    }
  }
}
.media-list {
  display: flex;
  flex-wrap: wrap;
}
  .media-list {
    display: flex;
    flex-wrap: wrap;
  }
.media-image {
  max-width: 100px;
  height: 100px;
  margin: 5px;
  cursor: pointer;
}
  .media-image {
    max-width: 100px;
    height: 100px;
    margin: 5px;
    cursor: pointer;
  }
.video-item {
  position: relative;
  margin: 10px;
  cursor: pointer;
}
  .video-item {
    position: relative;
    margin: 10px;
    cursor: pointer;
  }
.video-thumb {
  width: 160px;
  height: 90px;
  background-color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
}
  .video-thumb {
    width: 160px;
    height: 90px;
    background-color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
  }
.video-icon {
  width: 30px;
  height: 30px;
  opacity: 0.8;
}
  .video-icon {
    width: 30px;
    height: 30px;
    opacity: 0.8;
  }
.video-text {
  text-align: center;
  font-size: 12px;
  color: #666;
}
  .video-text {
    text-align: center;
    font-size: 12px;
    color: #666;
  }
.media-viewer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
  .media-viewer-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
  }
.media-viewer-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
}
  .media-viewer-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
  }
.video-player-wrap {
  position: relative;
}
  .video-player-wrap {
    position: relative;
  }
.video-player {
  max-width: 90vw;
  max-height: 80vh;
}
  .video-player {
    max-width: 90vw;
    max-height: 80vh;
  }
</style>
src/views/equipmentManagement/inspectionManagement/index.vue
@@ -197,7 +197,7 @@
      formatData: cell => {
        if (!cell) return "-";
        try {
          return dayjs(cell).format("YYYY-MM-DD HH:mm:ss");
          return dayjs(cell).format("YYYY-MM-DD");
        } catch {
          return cell;
        }
@@ -231,6 +231,12 @@
      operation: operations
        .map(op => {
          switch (op) {
            case "view":
              return {
                name: "详情",
                clickFun: openViewDialog,
                color: "#409EFF",
              };
            case "edit":
              return {
                name: "编辑",
@@ -273,14 +279,14 @@
      ];
      operationsArr.value = ["edit"];
    } else if (value === "task") {
      const operationColumn = getOperationColumn(["upload", "viewFile"]);
      const operationColumn = getOperationColumn(["view", "upload", "viewFile"]);
      // å·¡æ£€è®°å½•不展示"是否启用"列
      const taskColumns = columns.value.filter(col => col.prop !== "isEnabled");
      tableColumns.value = [
        ...taskColumns,
        ...(operationColumn ? [operationColumn] : []),
      ];
      operationsArr.value = ["upload", "viewFile"];
      operationsArr.value = ["view", "upload", "viewFile"];
    }
    pageNum.value = 1;
    pageSize.value = 10;
@@ -377,7 +383,13 @@
  const openUploadDialog = row => {
    nextTick(() => {
      uploadFiles.value?.openDialog(row);
      uploadFiles.value?.openDialog("add", row);
    });
  };
  const openViewDialog = row => {
    nextTick(() => {
      uploadFiles.value?.openDialog("view", row);
    });
  };
src/views/equipmentManagement/repair/Modal/RepairModal.vue
@@ -49,9 +49,9 @@
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="报修报修项目">
          <el-form-item label="报修项目">
            <el-input v-model="form.machineryCategory"
                      placeholder="请输入报修报修项目"
                      placeholder="请输入报修项目"
                      :disabled="operationType === 'view'" />
          </el-form-item>
        </el-col>
src/views/equipmentManagement/spareParts/index.vue
@@ -29,6 +29,7 @@
                        :tableLoading="loading"
                        :page="pagination"
                        :isShowPagination="true"
                        :row-class-name="rowClassName"
                        @pagination="handleSizeChange"
                    >
                        <template #status="{ row }">
@@ -95,7 +96,7 @@
        </el-dialog>
      </el-tab-pane>
      <el-tab-pane label="备件领用记录" name="usage">
      <el-tab-pane label="备件使用记录" name="usage">
        <div class="search_form">
          <el-form :inline="true" :model="usageQuery" class="search-form">
            <el-form-item label="备件名称">
@@ -521,9 +522,17 @@
onMounted(() => {
  fetchListData();
});
// æ ¹æ®æ•°é‡è¿›è¡Œåˆ¤æ–­èƒŒæ™¯é¢œè‰²
const rowClassName = ({ row }) => {
  const num = Number(row.quantity);
  if (num <= 1) return 'row-qty-low';
  if (num >= 8) return 'row-qty-high';
  return 'row-qty-mid';
};
</script>
<style scoped>
<style>
.spare-part-category {
  padding: 20px;
}
@@ -547,8 +556,17 @@
  font-weight: 600;
}
.el-table__row:hover > td {
  background-color: #fafafa;
.el-table .row-qty-low td.el-table__cell,
.el-table .row-qty-low:hover > td.el-table__cell {
  background-color: #fde8e8 !important;
}
.el-table .row-qty-mid td.el-table__cell,
.el-table .row-qty-mid:hover > td.el-table__cell {
  background-color: #f0f4f8 !important;
}
.el-table .row-qty-high td.el-table__cell,
.el-table .row-qty-high:hover > td.el-table__cell {
  background-color: #e8f5e9 !important;
}
/* æŒ‰é’®ç»„样式 */
@@ -567,4 +585,5 @@
  font-size: 12px;
  margin-right: 4px;
}
</style>
src/views/equipmentManagement/upkeep/Form/PlanModal.vue
@@ -35,6 +35,7 @@
      <el-form-item label="保养项目">
        <el-input
            v-model="form.machineryCategory"
            type="textarea"
            placeholder="请输入保养项目"
        />
      </el-form-item>
src/views/equipmentManagement/upkeep/Form/RecordDetailDia.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,99 @@
<template>
    <FormDialog
        v-model="dialogVisitable"
        title="保养记录详情"
        width="800px"
        operation-type="detail"
        @close="cancel"
    >
        <el-descriptions border :column="2">
            <el-descriptions-item label="设备名称">
                {{ detailData.deviceName || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="规格型号">
                {{ detailData.deviceModel || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="计划保养日期">
                {{ formatDate(detailData.maintenancePlanTime) }}
            </el-descriptions-item>
            <el-descriptions-item label="录入人">
                {{ detailData.createUserName || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="保养项目" :span="2">
                {{ detailData.machineryCategory || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="实际保养人">
                {{ detailData.maintenanceActuallyName || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="实际保养日期">
                {{ formatDate(detailData.maintenanceActuallyTime) }}
            </el-descriptions-item>
            <el-descriptions-item label="保养结果" :span="2">
                {{ detailData.maintenanceResult || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="状态" :span="2">
                <el-tag v-if="detailData.status === 2" type="danger">失败</el-tag>
                <el-tag v-else-if="detailData.status === 1" type="success">完结</el-tag>
                <el-tag v-else type="warning">待保养</el-tag>
            </el-descriptions-item>
        </el-descriptions>
        <div v-if="fileList && fileList.length > 0" class="image-section">
            <div class="image-title">保养附件(图片):</div>
            <AttachmentUploadImage
                v-model:fileList="fileList"
                :disabled="true"
            />
        </div>
    </FormDialog>
</template>
<script setup>
import FormDialog from "@/components/Dialog/FormDialog.vue";
import { ref } from "vue";
import dayjs from "dayjs";
import { attachmentList } from "@/api/basicData/storageAttachment.js";
import AttachmentUploadImage from '@/components/AttachmentUpload/image/index.vue';
const dialogVisitable = ref(false);
const detailData = ref({});
const fileList = ref([]);
const formatDate = (date) => {
    return date ? dayjs(date).format("YYYY-MM-DD") : "--";
};
const openDialog = (row) => {
    dialogVisitable.value = true;
    detailData.value = { ...row };
    fileList.value = [];
    if (row.id) {
        attachmentList({
            recordType: 'device_maintenance',
            recordId: row.id,
        }).then(res => {
            if (res && res.data) {
                fileList.value = res.data || [];
            }
        });
    }
};
const cancel = () => {
    dialogVisitable.value = false;
};
defineExpose({ openDialog });
</script>
<style scoped>
.image-section {
    margin-top: 20px;
}
.image-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #606266;
}
</style>
src/views/equipmentManagement/upkeep/Form/detailDia.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,118 @@
<template>
    <FormDialog
        v-model="dialogVisitable"
        title="保养任务详情"
        width="800px"
        operation-type="detail"
        @close="cancel"
    >
        <el-descriptions border :column="2">
            <el-descriptions-item label="设备名称">
                {{ detailData.taskName || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="规格型号">
                {{ detailData.deviceModel || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="录入人">
                {{ detailData.registrant || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="登记时间">
                {{ detailData.registrationDate || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="保养项目" :span="2">
                {{ detailData.machineryCategory || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="保养人">
                {{ detailData.maintenancePerson || '--' }}
            </el-descriptions-item>
            <el-descriptions-item label="任务频率">
                {{ formatFrequencyType(detailData.frequencyType) }}
            </el-descriptions-item>
            <el-descriptions-item label="执行时间">
                {{ formatFrequencyDetail(detailData.frequencyDetail) }}
            </el-descriptions-item>
            <el-descriptions-item label="定时任务">
                <el-tag :type="detailData.isActive === 1 ? 'success' : 'info'">
                    {{ detailData.isActive === 1 ? '开启' : '关闭' }}
                </el-tag>
            </el-descriptions-item>
            <el-descriptions-item label="备注" :span="2">
                {{ detailData.remarks || '--' }}
            </el-descriptions-item>
        </el-descriptions>
        <div v-if="fileList && fileList.length > 0" class="image-section">
            <div class="image-title">设备图片:</div>
            <AttachmentUploadImage
                v-model:fileList="fileList"
                :disabled="true"
            />
        </div>
    </FormDialog>
</template>
<script setup>
import FormDialog from "@/components/Dialog/FormDialog.vue";
import { ref } from "vue";
import { getLedgerById } from "@/api/equipmentManagement/ledger";
import AttachmentUploadImage from '@/components/AttachmentUpload/image/index.vue';
const dialogVisitable = ref(false);
const detailData = ref({});
const fileList = ref([]);
const formatFrequencyType = (type) => {
    const map = {
        DAILY: "每日",
        WEEKLY: "每周",
        MONTHLY: "每月",
        QUARTERLY: "季度",
    };
    return map[type] || "--";
};
const formatFrequencyDetail = (detail) => {
    if (!detail) return "--";
    const replacements = {
        MON: "周一",
        TUE: "周二",
        WED: "周三",
        THU: "周四",
        FRI: "周五",
        SAT: "周六",
        SUN: "周日",
    };
    return detail.replace(/MON|TUE|WED|THU|FRI|SAT|SUN/g, match => replacements[match]);
};
const openDialog = (row) => {
    dialogVisitable.value = true;
    detailData.value = { ...row };
    fileList.value = [];
    if (row.taskId) {
        getLedgerById(row.taskId).then(res => {
            if (res.code === 200 && res.data) {
                fileList.value = res.data.storageBlobVOs || [];
            }
        });
    }
};
const cancel = () => {
    dialogVisitable.value = false;
};
defineExpose({ openDialog });
</script>
<style scoped>
.image-section {
    margin-top: 20px;
}
.image-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #606266;
}
</style>
src/views/equipmentManagement/upkeep/Form/formDia.vue
@@ -70,8 +70,8 @@
                    <el-form-item label="保养项目" prop="machineryCategory">
                        <el-input
                            v-model.trim="form.machineryCategory"
                            type="textarea"
                            placeholder="请输入保养项目"
                            maxlength="100"
                            clearable
                        />
                    </el-form-item>
@@ -101,7 +101,7 @@
                <el-col :span="12" v-if="form.frequencyType === 'DAILY' && form.frequencyType">
                    <el-form-item label="日期" prop="frequencyDetail">
                        <el-time-picker v-model="form.frequencyDetail" placeholder="选择时间" format="HH:mm"
                                                        value-format="HH:mm" />
                                                    value-format="HH:mm" />
                    </el-form-item>
                </el-col>
                <el-col :span="12" v-if="form.frequencyType === 'WEEKLY' && form.frequencyType">
@@ -116,7 +116,7 @@
                            <el-option label="周日" value="SUN"/>
                        </el-select>
                        <el-time-picker v-model="form.time" placeholder="选择时间" format="HH:mm"
                                                        value-format="HH:mm"  style="width: 50%"/>
                                                    value-format="HH:mm"  style="width: 50%"/>
                    </el-form-item>
                </el-col>
                <el-col :span="12" v-if="form.frequencyType === 'MONTHLY' && form.frequencyType">
@@ -141,6 +141,23 @@
                            format="MM,DD,HH:mm"
                            value-format="MM,DD,HH:mm"
                        />
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item label="定时任务">
                        <el-switch
                            v-model="form.isActive"
                            :active-value="1"
                            :inactive-value="0"
                            active-text="开启"
                            inactive-text="关闭"
                            inline-prompt
                        />
                        <span style="margin-left: 12px; color: #909399; font-size: 12px;">
                            {{ form.isActive === 1 ? '任务将按计划执行' : '任务暂停执行' }}
                        </span>
                    </el-form-item>
                </el-col>
            </el-row>
@@ -184,7 +201,8 @@
        time: '',
        deviceModel: undefined, // è§„格型号
        registrationDate: '',
        maintenancePerson: '' // ä¿å…»äºº
        maintenancePerson: '', // ä¿å…»äºº
        isActive: 0 // å®šæ—¶ä»»åŠ¡å¼€å…³ï¼š0=关闭,1=开启
    },
    rules: {
        taskId: [{ required: true, message: "请选择设备", trigger: "change" },],
@@ -271,7 +289,8 @@
        time: '',
        deviceModel: undefined,
        registrationDate: '',
        maintenancePerson: ''
        maintenancePerson: '',
        isActive: 0
    }
}
@@ -294,21 +313,21 @@
                }
                delete payload.inspector
                delete payload.inspectorIds
                delete payload.active
                if (payload.frequencyType === 'WEEKLY') {
                    let frequencyDetail = ''
                    frequencyDetail = payload.week + ',' + payload.time
                    payload.frequencyDetail = frequencyDetail
                }
                // å½•入日期:直接使用表单里的 registrationDate å­—段
                // ä¸€äº›é»˜è®¤çŠ¶æ€å­—æ®µ
                if (payload.status === undefined || payload.status === null || payload.status === '') {
                    payload.status = '0' // é»˜è®¤çŠ¶æ€ï¼Œå¯æŒ‰å®žé™…æžšä¸¾è°ƒæ•´
                }
                payload.active = true
                payload.deleted = 0
                if (operationType.value === 'edit') {
                    await deviceMaintenanceTaskEdit(payload)
                } else {
src/views/equipmentManagement/upkeep/index.vue
@@ -63,6 +63,12 @@
            }"
                    @selection-change="handleScheduledSelectionChange"
                    @pagination="changeScheduledPage">
            <template #isActiveRef="{ row }">
              <el-tag v-if="row.isActive === 1"
                      type="success">开启</el-tag>
              <el-tag v-else
                      type="info">关闭</el-tag>
            </template>
            <template #statusRef="{ row }">
              <el-tag v-if="row.status === 1"
                      type="success">启用</el-tag>
@@ -70,6 +76,11 @@
                      type="danger">停用</el-tag>
            </template>
            <template #operation="{ row }">
              <el-button type="primary"
                         link
                         @click="handleDetail(row)">
                è¯¦æƒ…
              </el-button>
              <el-button type="primary"
                         link
                         @click="editScheduledTask(row)">
@@ -171,6 +182,11 @@
                      type="warning">待保养</el-tag>
            </template>
            <template #operation="{ row }">
              <el-button type="primary"
                         link
                         @click="handleRecordDetail(row)">
                è¯¦æƒ…
              </el-button>
              <!-- è¿™ä¸ªåŠŸèƒ½è·Ÿæ–°å¢žä¿å…»åŠŸèƒ½ä¸€æ¨¡ä¸€æ ·ï¼Œæœ‰å•¥æ„ä¹‰ï¼Ÿ -->
              <!-- <el-button
              type="primary"
@@ -213,6 +229,8 @@
                      @ok="getTableData" />
    <FormDia ref="formDiaRef"
             @closeDia="getScheduledTableData" />
    <DetailDia ref="detailDiaRef" />
    <RecordDetailDia ref="recordDetailDiaRef" />
    <FileList v-if="fileDialogVisible"
              v-model:visible="fileDialogVisible"
              :record-type="'device_maintenance'"
@@ -235,6 +253,8 @@
  import PlanModal from "./Form/PlanModal.vue";
  import MaintenanceModal from "./Form/MaintenanceModal.vue";
  import FormDia from "./Form/formDia.vue";
  import DetailDia from "./Form/detailDia.vue";
  import RecordDetailDia from "./Form/RecordDetailDia.vue";
  import {
    getUpkeepPage,
    delUpkeep,
@@ -257,6 +277,10 @@
  const maintainModalRef = ref();
  // å®šæ—¶ä»»åŠ¡å¼¹çª—æŽ§åˆ¶å™¨
  const formDiaRef = ref();
  // å®šæ—¶ä»»åŠ¡è¯¦æƒ…å¼¹çª—æŽ§åˆ¶å™¨
  const detailDiaRef = ref();
  // ä¿å…»è®°å½•详情弹窗控制器
  const recordDetailDiaRef = ref();
  // é™„件弹窗
  const fileListDialogRef = ref(null);
  const fileDialogVisible = ref(false);
@@ -308,7 +332,7 @@
    {
      prop: "frequencyType",
      label: "频次",
      minWidth: 150,
      minWidth: 80,
      // PIMTable ä½¿ç”¨çš„æ˜¯ formatData,而不是 Element-Plus çš„ formatter
      formatData: cell =>
        ({
@@ -321,7 +345,7 @@
    {
      prop: "frequencyDetail",
      label: "开始日期与时间",
      minWidth: 150,
      minWidth: 130,
      // åŒæ ·æ”¹ç”¨ formatData,PIMTable å†…部会把单元格值传进来
      formatData: cell => {
        if (typeof cell !== "string") return "";
@@ -342,6 +366,14 @@
        );
      },
    },
    {
      prop: "isActive",
      label: "定时任务",
      dataType: "slot",
      slot: "isActiveRef",
      align: "center",
      minWidth: 100,
    },
    { prop: "maintenancePerson", label: "保养人", minWidth: 100 },
    { prop: "registrant", label: "登记人", minWidth: 100 },
    {
@@ -349,7 +381,7 @@
      label: "登记日期",
      minWidth: 100,
      formatData: cell =>
        cell ? dayjs(cell).format("YYYY-MM-DD HH:mm:ss") : "-",
        cell ? dayjs(cell).format("YYYY-MM-DD") : "-",
    },
    {
      fixed: "right",
@@ -357,7 +389,7 @@
      dataType: "slot",
      slot: "operation",
      align: "center",
      width: "200px",
      width: "160px",
    },
  ]);
@@ -409,7 +441,7 @@
      align: "center",
      prop: "maintenanceActuallyTime",
      formatData: cell =>
        cell ? dayjs(cell).format("YYYY-MM-DD HH:mm:ss") : "-",
        cell ? dayjs(cell).format("YYYY-MM-DD") : "-",
    },
    {
      label: "保养结果",
@@ -431,7 +463,7 @@
      dataType: "slot",
      slot: "operation",
      align: "center",
      width: "350px",
      width: "250px",
    },
  ]);
@@ -489,6 +521,14 @@
    if (row) {
      nextTick(() => {
        formDiaRef.value?.openDialog("edit", row);
      });
    }
  };
  const handleDetail = row => {
    if (row) {
      nextTick(() => {
        detailDiaRef.value?.openDialog(row);
      });
    }
  };
@@ -564,6 +604,14 @@
    maintainModalRef.value.open(row.id, row);
  };
  const handleRecordDetail = row => {
    if (row) {
      nextTick(() => {
        recordDetailDiaRef.value?.openDialog(row);
      });
    }
  };
  const addPlan = () => {
    planModalRef.value.openModal();
  };
src/views/financialManagement/assets/fixedAssets.vue
@@ -82,7 +82,7 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="资产编号" prop="assetCode">
              <el-input v-model="form.assetCode" placeholder="保存后自动生成" disabled />
              <el-input v-model="form.assetCode" placeholder="系统自动生成" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -175,13 +175,6 @@
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="创建时间" prop="createTime">
              <el-date-picker v-model="createTimeDate" type="date" placeholder="选择日期" value-format="YYYY-MM-DD" style="width: 100%;" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注" />
        </el-form-item>
@@ -196,7 +189,6 @@
<script setup>
import { ref, reactive, onMounted, computed } from "vue";
import dayjs from "dayjs";
import { ElMessage, ElMessageBox } from "element-plus";
import FormDialog from "@/components/Dialog/FormDialog.vue";
import {
@@ -266,17 +258,10 @@
  keeper: "",
  status: "in_use",
  remark: "",
  createTime: "",
});
const form = reactive({
  ...createDefaultForm(),
});
const createTimeDate = computed({
  get: () => (form.createTime ? String(form.createTime).split(" ")[0] : ""),
  set: (value) => {
    form.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
  },
});
const rules = {
@@ -371,14 +356,16 @@
  getTableData();
};
const buildAssetCode = () => `GD${Date.now().toString().slice(-10)}`;
const add = () => {
  isEdit.value = false;
  isView.value = false;
  currentId.value = null;
  dialogTitle.value = "新增固定资产";
  Object.assign(form, createDefaultForm(), {
    assetCode: buildAssetCode(),
    purchaseDate: new Date().toISOString().split('T')[0],
    createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
  });
  dialogVisible.value = true;
};
src/views/financialManagement/assets/intangibleAssets.vue
@@ -72,7 +72,7 @@
        </template>
        <template #operation="{ row }">
          <el-button type="primary" link @click="view(row)">查看</el-button>
          <el-button v-if="row.status !== 'amortized'" type="primary" link @click="edit(row)">编辑</el-button>
          <el-button type="primary" link @click="edit(row)">编辑</el-button>
          <el-button type="danger" link @click="handleDelete(row)">删除</el-button>
        </template>
      </PIMTable>
@@ -83,7 +83,7 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="资产编号" prop="assetCode">
              <el-input v-model="form.assetCode" placeholder="保存后自动生成" disabled />
              <el-input v-model="form.assetCode" placeholder="系统自动生成" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -160,15 +160,8 @@
              <el-select v-model="form.status" placeholder="请选择状态" style="width: 100%;">
                <el-option label="在用" value="in_use" />
                <el-option label="闲置" value="idle" />
                <el-option v-if="isView" label="已摊销完毕" value="amortized" />
                <el-option label="已摊销完毕" value="amortized" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="创建时间" prop="createTime">
              <el-date-picker v-model="createTimeDate" type="date" placeholder="选择日期" value-format="YYYY-MM-DD" style="width: 100%;" />
            </el-form-item>
          </el-col>
        </el-row>
@@ -189,7 +182,6 @@
<script setup>
import { ref, reactive, onMounted, computed } from "vue";
import dayjs from "dayjs";
import { ElMessage, ElMessageBox } from "element-plus";
import FormDialog from "@/components/Dialog/FormDialog.vue";
import {
@@ -244,7 +236,6 @@
);
const createDefaultForm = () => ({
  id: null,
  assetCode: "",
  assetName: "",
  category: "",
@@ -259,17 +250,10 @@
  status: "in_use",
  description: "",
  remark: "",
  createTime: "",
});
const form = reactive({
  ...createDefaultForm(),
});
const createTimeDate = computed({
  get: () => (form.createTime ? String(form.createTime).split(" ")[0] : ""),
  set: (value) => {
    form.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
  },
});
const rules = {
@@ -370,14 +354,16 @@
  getTableData();
};
const buildAssetCode = () => `WX${Date.now().toString().slice(-10)}`;
const add = () => {
  isEdit.value = false;
  isView.value = false;
  currentId.value = null;
  dialogTitle.value = "新增无形资产";
  Object.assign(form, createDefaultForm(), {
    assetCode: buildAssetCode(),
    acquisitionDate: new Date().toISOString().split('T')[0],
    createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
  });
  dialogVisible.value = true;
};
src/views/financialManagement/payable/input-invoice.vue
@@ -51,8 +51,6 @@
        :column="columns"
        :tableData="dataList"
        :tableLoading="tableLoading"
        isShowSummary
        :summaryMethod="getSummaries"
        :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
@@ -375,26 +373,6 @@
  invoiceType: [{ required: true, message: "请选择发票类型", trigger: "change" }],
  taxRate: [{ required: true, message: "请选择税率", trigger: "change" }],
  amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
};
const summaryProps = ["amount", "taxAmount", "totalAmount"];
const getSummaries = ({ columns, data }) => {
  const sums = [];
  columns.forEach((col, index) => {
    if (index === 0) {
      sums[index] = "合计";
    } else if (summaryProps.includes(col.property)) {
      const total = data.reduce((prev, cur) => {
        const v = Number(cur[col.property]);
        return prev + (isNaN(v) ? 0 : v);
      }, 0);
      sums[index] = Number(total.toFixed(2)).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
    } else {
      sums[index] = "";
    }
  });
  return sums;
};
const formatMoney = (value) => {
src/views/financialManagement/payable/payment.vue
@@ -65,8 +65,6 @@
                :column="columns"
                :tableData="dataList"
                :tableLoading="tableLoading"
                isShowSummary
                :summaryMethod="getSummaries"
                :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
@@ -151,25 +149,7 @@
    dataList.value.reduce((sum, item) => sum + Number(item.amount ?? 0), 0)
  );
  const getSummaries = ({ columns, data }) => {
  const sums = [];
  columns.forEach((col, index) => {
    if (index === 0) {
      sums[index] = "合计";
    } else if (col.property === "amount") {
      const total = data.reduce((prev, cur) => {
        const v = Number(cur.amount);
        return prev + (isNaN(v) ? 0 : v);
      }, 0);
      sums[index] = total.toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
    } else {
      sums[index] = "";
    }
  });
  return sums;
};
const formatMoney = value => {
  const formatMoney = value => {
    if (value === undefined || value === null) return "0.00";
    return Number(value)
      .toFixed(2)
src/views/financialManagement/payable/paymentApply.vue
@@ -52,8 +52,6 @@
        :column="columns"
        :tableData="dataList"
        :tableLoading="tableLoading"
        isShowSummary
        :summaryMethod="getSummaries"
        :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
@@ -99,7 +97,7 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="申请单号" prop="invoiceApplicationNo">
              <el-input v-model="form.invoiceApplicationNo" placeholder="保存后自动生成" disabled />
              <el-input v-model="form.invoiceApplicationNo" placeholder="系统自动生成" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -160,18 +158,6 @@
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="创建时间" prop="createTime">
              <el-date-picker
                v-model="formCreateTimeDate"
                type="date"
                placeholder="选择日期"
                value-format="YYYY-MM-DD"
                style="width: 100%;"
                :disabled="isView"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款金额" prop="paymentAmount">
              <el-input-number
                v-model="form.paymentAmount"
@@ -231,7 +217,7 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="付款单号" prop="paymentNumber">
              <el-input v-model="paymentForm.paymentNumber" placeholder="保存后自动生成" disabled />
              <el-input v-model="paymentForm.paymentNumber" placeholder="系统自动生成" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -259,17 +245,6 @@
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="创建时间" prop="createTime">
              <el-date-picker
                v-model="paymentFormCreateTimeDate"
                type="date"
                placeholder="选择日期"
                value-format="YYYY-MM-DD"
                style="width: 100%;"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款金额" prop="paymentAmount">
              <el-input-number
@@ -355,7 +330,6 @@
<script setup>
import { ref, reactive, computed, onMounted, nextTick, getCurrentInstance } from "vue";
import dayjs from "dayjs";
import { ElMessage, ElMessageBox } from "element-plus";
import FormDialog from "@/components/Dialog/FormDialog.vue";
import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
@@ -433,7 +407,6 @@
  bankAccount: "",
  bankName: "",
  remark: "",
  createTime: "",
});
const paymentRules = {
@@ -456,19 +429,6 @@
  stockInRecordIds: [],
  inboundBatches: "",
  status: 0,
  createTime: "",
});
const formCreateTimeDate = computed({
  get: () => (form.createTime ? String(form.createTime).split(" ")[0] : ""),
  set: (value) => {
    form.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
  },
});
const paymentFormCreateTimeDate = computed({
  get: () => (paymentForm.createTime ? String(paymentForm.createTime).split(" ")[0] : ""),
  set: (value) => {
    paymentForm.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
  },
});
const rules = {
@@ -477,24 +437,6 @@
  paymentAmount: [{ required: true, message: "请输入付款金额", trigger: "blur" }],
  paymentMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
  applyDate: [{ required: true, message: "请选择申请日期", trigger: "change" }],
};
const getSummaries = ({ columns, data }) => {
  const sums = [];
  columns.forEach((col, index) => {
    if (index === 0) {
      sums[index] = "合计";
    } else if (col.property === "amount") {
      const total = data.reduce((prev, cur) => {
        const v = Number(cur.amount);
        return prev + (isNaN(v) ? 0 : v);
      }, 0);
      sums[index] = total.toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
    } else {
      sums[index] = "";
    }
  });
  return sums;
};
const formatMoney = (value) => {
@@ -621,7 +563,6 @@
    stockInRecordIds,
    inboundBatches: formatInboundBatches(row.inboundBatches),
    status: normalizeStatus(row.status),
    createTime: row.createTime ?? "",
  });
};
@@ -639,7 +580,6 @@
  remark: row.remark ?? "",
  status: statusOverride !== undefined ? statusOverride : normalizeStatus(row.status),
  paymentAmount: Number(row.paymentAmount ?? row.amount ?? 0),
  createTime: row.createTime,
});
const buildSubmitPayload = (forUpdate = false) => {
@@ -653,7 +593,6 @@
    remark: form.remark || "",
    status: 0,
    paymentAmount: form.paymentAmount,
    createTime: form.createTime,
  };
  if (forUpdate) {
    payload.id = currentId.value;
@@ -764,7 +703,6 @@
    stockInRecordIds: [],
    inboundBatches: "",
    status: 0,
    createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
  });
  inboundBatchList.value = [];
  inboundBatchOptions.value = [];
@@ -843,7 +781,6 @@
    bankAccount: row.bankAccountNum ?? row.bankAccount ?? "",
    bankName: row.bankAccountName ?? row.bankName ?? "",
    remark: "",
    createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
  });
  paymentDialogVisible.value = true;
  nextTick(() => {
@@ -863,7 +800,6 @@
      paymentAmount: paymentForm.paymentAmount,
      paymentNumber: paymentForm.paymentNumber || "",
      remark: paymentForm.remark || "",
      createTime: paymentForm.createTime,
    })
      .then((res) => {
        if (res.code === 200) {
src/views/financialManagement/payable/purchaseIn.vue
@@ -49,8 +49,6 @@
                :column="columns"
                :tableData="dataList"
                :tableLoading="tableLoading"
                isShowSummary
                :summaryMethod="getSummaries"
                :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
@@ -100,7 +98,7 @@
      slot: "inboundDate",
    },
    { label: "产品名称", prop: "productName", minWidth: "140" },
    { label: "规格型号", prop: "specificationModel", minWidth: "140" },
    { label: "产品规格", prop: "specificationModel", minWidth: "140" },
    {
      label: "金额",
      prop: "inboundAmount",
@@ -191,25 +189,7 @@
    getTableData();
  };
  const getSummaries = ({ columns, data }) => {
  const sums = [];
  columns.forEach((col, index) => {
    if (index === 0) {
      sums[index] = "合计";
    } else if (col.property === "inboundAmount") {
      const total = data.reduce((prev, cur) => {
        const v = Number(cur.inboundAmount);
        return prev + (isNaN(v) ? 0 : v);
      }, 0);
      sums[index] = total.toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
    } else {
      sums[index] = "";
    }
  });
  return sums;
};
const handleOut = () => {
  const handleOut = () => {
    proxy.download(
      "/accountPurchase/exportAccountPurchaseInbound",
      buildFilterParams(),
src/views/financialManagement/payable/purchaseReturn.vue
@@ -44,8 +44,6 @@
        :column="columns"
        :tableData="dataList"
        :tableLoading="tableLoading"
        isShowSummary
        :summaryMethod="getSummaries"
        :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
@@ -85,30 +83,6 @@
  { label: "退货单号", prop: "returnNo", minWidth: "150" },
  { label: "供应商", prop: "supplierName", minWidth: "180" },
  { label: "关联入库单号", prop: "inboundBatches", minWidth: "150" },
  {
    label: "发货类型",
    prop: "shippingType",
    minWidth: "110",
    formatData: (val) => ({ 1: "货车", 2: "快递" }[String(val)] || "--"),
  },
  {
    label: "发货车牌号",
    prop: "truckPlateNo",
    minWidth: "140",
    formatData: (_val, row) => (String(row?.shippingType) === "1" ? row?.truckPlateNo || "--" : "--"),
  },
  {
    label: "快递公司",
    prop: "expressCompany",
    minWidth: "140",
    formatData: (_val, row) => (String(row?.shippingType) === "2" ? row?.expressCompany || "--" : "--"),
  },
  {
    label: "快递单号",
    prop: "expressNo",
    minWidth: "150",
    formatData: (_val, row) => (String(row?.shippingType) === "2" ? row?.expressNo || "--" : "--"),
  },
  { label: "退货日期", prop: "preparedAt", minWidth: "170" },
  {
    label: "退款总额",
@@ -199,24 +173,6 @@
  pagination.currentPage = page;
  pagination.pageSize = limit;
  getTableData();
};
const getSummaries = ({ columns, data }) => {
  const sums = [];
  columns.forEach((col, index) => {
    if (index === 0) {
      sums[index] = "合计";
    } else if (col.property === "totalAmount") {
      const total = data.reduce((prev, cur) => {
        const v = Number(cur.totalAmount);
        return prev + (isNaN(v) ? 0 : v);
      }, 0);
      sums[index] = total.toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
    } else {
      sums[index] = "";
    }
  });
  return sums;
};
const handleOut = () => {
src/views/financialManagement/payable/reconciliation.vue
@@ -35,8 +35,6 @@
        :column="columns"
        :tableData="dataList"
        :tableLoading="tableLoading"
        isShowSummary
        :summaryMethod="getSummaries"
        :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
@@ -406,26 +404,6 @@
  closingBalance: generateForm.closingBalance,
  accountStatementDetails: selectedPurchases.value.map(buildDetailSubmitItem),
});
const summaryProps = ["openingBalance", "currentPlan", "currentActually", "closingBalance"];
const getSummaries = ({ columns, data }) => {
  const sums = [];
  columns.forEach((col, index) => {
    if (index === 0) {
      sums[index] = "合计";
    } else if (summaryProps.includes(col.property)) {
      const total = data.reduce((prev, cur) => {
        const v = Number(cur[col.property]);
        return prev + (isNaN(v) ? 0 : v);
      }, 0);
      sums[index] = Number(total.toFixed(2)).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
    } else {
      sums[index] = "";
    }
  });
  return sums;
};
const formatMoney = (value) => {
  if (value === undefined || value === null) return "0.00";
src/views/financialManagement/receivable/invoiceApply.vue
@@ -48,8 +48,6 @@
        v-loading="tableLoading"
        :column="columns"
        :tableData="dataList"
        isShowSummary
        :summaryMethod="getSummaries"
        :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
@@ -100,7 +98,7 @@
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item label="申请单号" prop="applyCode">
              <el-input v-model="form.applyCode" placeholder="保存后自动生成" disabled />
              <el-input v-model="form.applyCode" placeholder="系统自动生成" disabled />
            </el-form-item>
          </el-col>
        </el-row>
@@ -191,20 +189,6 @@
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="创建时间" prop="createTime">
              <el-date-picker
                v-model="formCreateTimeDate"
                type="date"
                placeholder="选择日期"
                value-format="YYYY-MM-DD"
                style="width: 100%;"
                :disabled="isView"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="发票内容" prop="content">
          <el-input v-model="form.content" type="textarea" :rows="3" placeholder="请输入发票内容" :disabled="isView" />
        </el-form-item>
@@ -269,7 +253,6 @@
<script setup>
import { ref, reactive, computed, onMounted, nextTick, getCurrentInstance, defineAsyncComponent } from "vue";
import dayjs from "dayjs";
import { ElMessage, ElMessageBox } from "element-plus";
import FormDialog from "@/components/Dialog/FormDialog.vue";
import { listCustomer } from "@/api/basicData/customer.js";
@@ -541,13 +524,6 @@
  applyDate: "",
  content: "",
  remark: "",
  createTime: "",
});
const formCreateTimeDate = computed({
  get: () => (form.createTime ? String(form.createTime).split(" ")[0] : ""),
  set: (value) => {
    form.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
  },
});
const rules = {
@@ -650,27 +626,6 @@
  proxy.download("/accountInvoiceApplication/exportAccountInvoiceApplication", params, filename);
};
const getSummaries = ({ columns, data }) => {
  const sums = [];
  columns.forEach((col, index) => {
    if (index === 0) {
      sums[index] = "合计";
    } else if (col.property === "amount") {
      const total = data.reduce((prev, cur) => {
        const v = Number(cur.amount);
        return prev + (isNaN(v) ? 0 : v);
      }, 0);
      sums[index] = total.toLocaleString("zh-CN", {
        minimumFractionDigits: 2,
        maximumFractionDigits: 2,
      });
    } else {
      sums[index] = "";
    }
  });
  return sums;
};
const formatMoney = (value) => {
  if (value === undefined || value === null) return "0.00";
  return Number(value).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
@@ -751,7 +706,6 @@
    status: normalizeStatus(row.status ?? row.auditStatus),
    outboundBatchNos,
    outboundBatches: formatOutboundBatches(row.outboundBatches),
    createTime: row.createTime ?? "",
  });
};
@@ -760,7 +714,7 @@
  isView.value = false;
  dialogTitle.value = "新增开票申请";
  Object.assign(form, {
    applyCode: "",
    applyCode: "KP" + Date.now().toString().slice(-8),
    customerId: "",
    outboundBatchNos: [],
    outboundBatches: "",
@@ -770,7 +724,6 @@
    applyDate: new Date().toISOString().split("T")[0],
    content: "",
    remark: "",
    createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
  });
  outboundBatchList.value = [];
  outboundBatchOptions.value = [];
@@ -799,7 +752,6 @@
    invoiceAmount: form.amount,
    taxRate: form.taxRate,
    status: 0,
    createTime: form.createTime,
  };
  if (forUpdate) {
    payload.id = currentId.value;
@@ -814,7 +766,6 @@
  dialogTitle.value = "编辑开票申请";
  fillFormFromRow(row);
  dialogVisible.value = true;
  loadOutboundBatches(form.customerId, true);
};
const view = (row) => {
src/views/financialManagement/receivable/outputInvoice.vue
@@ -37,7 +37,7 @@
      <div class="actions">
        <div></div>
        <div>
          <el-button type="primary" @click="add" icon="Plus">录入发票</el-button>
          <!-- <el-button type="primary" @click="add" icon="Plus">录入发票</el-button> -->
          <el-button type="success" @click="handleExport" icon="Download">导出</el-button>
        </div>
      </div>
@@ -46,8 +46,6 @@
        v-loading="tableLoading"
        :column="columns"
        :tableData="dataList"
        isShowSummary
        :summaryMethod="getSummaries"
        :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
@@ -93,7 +91,7 @@
      @confirm="submitForm"
      @cancel="closeDialog"
    >
      <el-form :model="form" :rules="rules" ref="formRef" label-width="100px">
      <el-form :model="form" :rules="rules" ref="formRef" label-width="120px">
        <el-row v-if="isView" :gutter="20">
          <el-col :span="12">
            <el-form-item label="状态">
@@ -111,25 +109,13 @@
          </el-col>
          <el-col :span="12">
            <el-form-item label="客户" prop="customerId">
              <el-select @change="checkCustomer" v-model="form.customerId" placeholder="请选择客户" style="width: 100%;" :disabled="isView">
              <el-select v-model="form.customerId" placeholder="请选择客户" style="width: 100%;" :disabled="isView">
                <el-option v-for="item in customerList" :key="item.id" :label="item.customerName" :value="item.id" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="关联开票申请" prop="accountInvoiceApplicationId">
              <el-select v-model="form.accountInvoiceApplicationId"
                        placeholder="请先选择客户"
                        readonly
                         @change="selectionApply"
                        :disabled="!form.customerId || isView"
                        class="outbound-batch-select">
                <el-option v-for="(item,index) in applyList" :key="index" :label="item.invoiceApplicationNo" :value="item.id"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开票日期" prop="invoiceDate">
              <el-date-picker
@@ -142,15 +128,14 @@
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="发票类型" prop="invoiceType">
              <el-select
                  v-model="form.invoiceType"
                  placeholder="请选择发票类型"
                  style="width: 100%;"
                  :disabled="isView"
                v-model="form.invoiceType"
                placeholder="请选择发票类型"
                style="width: 100%;"
                :disabled="isView"
                @change="handleInvoiceTypeChange"
              >
                <el-option label="增值税专用发票" value="增值税专用发票" />
                <el-option label="增值税普通发票" value="增值税普通发票" />
@@ -158,6 +143,8 @@
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="税率" prop="taxRate">
              <el-select
@@ -165,7 +152,7 @@
                placeholder="请选择税率"
                style="width: 100%;"
                :disabled="isView"
                @change="handleTaxRateChange"
                @change="calculateTax"
              >
                <el-option
                  v-for="dict in tax_rate"
@@ -178,7 +165,7 @@
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="10">
          <el-col :span="8">
            <el-form-item label="金额(不含税)" prop="amount">
              <el-input-number
                v-model="form.amount"
@@ -186,18 +173,18 @@
                :precision="2"
                style="width: 100%;"
                :disabled="isView"
                @change="handleTaxRateChange"
                @change="calculateTax"
              />
            </el-form-item>
          </el-col>
          <el-col :span="7">
          <el-col :span="8">
            <el-form-item label="税额">
              <el-input v-model="form.taxAmount" style="width: 100%;" disabled />
              <el-input v-model="form.taxAmount" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="7">
          <el-col :span="8">
            <el-form-item label="价税合计">
              <el-input v-model="form.totalAmount" style="width: 100%;" disabled />
              <el-input v-model="form.totalAmount" disabled />
            </el-form-item>
          </el-col>
        </el-row>
@@ -235,7 +222,6 @@
  cancelAccountSalesInvoice,
  deleteAccountSalesInvoice,
} from "@/api/financialManagement/accountSalesInvoice.js";
import {getAccountInvoiceApplicationList} from "@/api/financialManagement/invoiceApply.js";
const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
@@ -283,9 +269,6 @@
const fileDialogVisible = ref(false);
const currentRecordId = ref(0);
const applySelectVisible = ref(false);
const applyList = ref([]);
const openFileDialog = (row) => {
  if (!row.accountInvoiceApplicationId) {
    ElMessage.warning("未关联开票申请,无法查看附件");
@@ -328,14 +311,12 @@
  totalAmount: 0,
  content: "",
  remark: "",
  deptId: undefined,
  accountInvoiceApplicationId: undefined,
  storageAttachmentId: undefined,
});
const rules = {
  invoiceNo: [{ required: true, message: "请输入发票号码", trigger: "blur" }],
  accountInvoiceApplicationId: [{ required: true, message: "请选择开票申请", trigger: "change" }],
  customerId: [{ required: true, message: "请选择客户", trigger: "change" }],
  invoiceDate: [{ required: true, message: "请选择开票日期", trigger: "change" }],
  invoiceType: [{ required: true, message: "请选择发票类型", trigger: "change" }],
@@ -343,99 +324,18 @@
  amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
};
// é€‰æ‹©å®¢æˆ·
const checkCustomer = (val) =>{
  loadApplyList(val);
}
//查询开票申请列表
const loadApplyList = (customerId) => {
  if (!customerId) {
    applyList.value = [];
    return Promise.resolve();
  }
  return getAccountInvoiceApplicationList({ customerId })
      .then(res => {
        if (res.code === 200) {
          const list = res.data?.records ?? res.data ?? [];
          applyList.value = Array.isArray(list) ? list : [];
        } else {
          applyList.value = [];
        }
      })
      .catch(() => {
        applyList.value = [];
      })
const formatMoney = (value) => {
  if (value === undefined || value === null) return "0.00";
  return Number(value).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
};
const selectionApply = (val)=>{
  const applyObj = applyList.value.find(item=>item.id === val);
  if(!applyObj){
    ElMessage.warning("请选择关联的开票申请");
    return;
  }
  form.remark = applyObj.remark;
  form.content = applyObj.invoiceContent;
  form.invoiceDate = applyObj.applyDate;
  form.invoiceType = applyObj.invoiceType;
  form.deptId = applyObj.deptId;
  form.taxRate = applyObj.taxRate;
  form.totalAmount = applyObj.invoiceAmount
  handleTaxRateChange();
}
/** ä»·ç¨Žåˆè®¡å˜æ›´ï¼šæŒ‰ç¨ŽçŽ‡åç®—ä¸å«ç¨Žé‡‘é¢ã€ç¨Žé¢ */
const calculateTaxFromInclusive = (inclusiveTotal) => {
  const total = Number(inclusiveTotal ?? form.totalAmount ?? 0);
  if (total <= 0) {
    form.amount = 0;
    form.taxAmount = 0;
    form.totalAmount = 0;
    return;
  }
  const rate = Number(form.taxRate) / 100;
  form.totalAmount = Number(total.toFixed(2));
  form.amount = Number((form.totalAmount / (1 + rate)).toFixed(2));
  form.taxAmount = Number((form.totalAmount - form.amount).toFixed(2));
};
const calculateTaxFromExclusive = () => {
const calculateTax = () => {
  form.taxAmount = Number((form.amount * form.taxRate / 100).toFixed(2));
  form.totalAmount = Number((form.amount + form.taxAmount).toFixed(2));
};
const handleTaxRateChange = () => {
  if (form.totalAmount > 0) {
    calculateTaxFromInclusive(form.totalAmount);
  } else {
    calculateTaxFromExclusive();
  }
};
const getSummaries = ({ columns, data }) => {
  const sums = [];
  columns.forEach((col, index) => {
    if (index === 0) {
      sums[index] = "合计";
    } else if (col.property === "amount") {
      const total = data.reduce((prev, cur) => {
        const v = Number(cur.amount);
        return prev + (isNaN(v) ? 0 : v);
      }, 0);
      sums[index] = total.toLocaleString("zh-CN", {
        minimumFractionDigits: 2,
        maximumFractionDigits: 2,
      });
    } else {
      sums[index] = "";
    }
  });
  return sums;
};
const formatMoney = (value) => {
  if (value === undefined || value === null) return "0.00";
  return Number(value).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
const handleInvoiceTypeChange = () => {
  calculateTax();
};
const normalizeTableRow = (row) => ({
@@ -583,8 +483,6 @@
const closeDialog = () => {
  dialogVisible.value = false;
  applySelectVisible.value = false;
  isView.value = false;
  isView.value = false;
};
src/views/financialManagement/receivable/receipt.vue
@@ -111,7 +111,7 @@
            <el-form-item label="收款单号"
                          prop="receiptCode">
              <el-input v-model="form.receiptCode"
                        placeholder="保存后自动生成"
                        placeholder="系统自动生成"
                        disabled />
            </el-form-item>
          </el-col>
@@ -171,10 +171,10 @@
                          prop="amount">
              <el-input-number v-model="form.amount"
                               :min="0"
                               :max="collectionAmountInputMax"
                               :precision="2"
                               style="width: 100%;"
                               :disabled="isView" />
                               :disabled="isView"
                               placeholder="根据关联单据自动汇总,可修改" />
            </el-form-item>
          </el-col>
        </el-row>
@@ -191,17 +191,6 @@
                           :label="item.label"
                           :value="item.value" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="创建时间"
                          prop="createTime">
              <el-date-picker v-model="formCreateTimeDate"
                              type="date"
                              placeholder="选择日期"
                              value-format="YYYY-MM-DD"
                              style="width: 100%;"
                              :disabled="isView" />
            </el-form-item>
          </el-col>
        </el-row>
@@ -274,12 +263,6 @@
                         align="right">
          <template #default="{ row }">Â¥{{ formatMoney(row.outboundAmount) }}</template>
        </el-table-column>
        <el-table-column prop="amountReceived"
                         label="已收款金额"
                         width="110"
                         align="right">
          <template #default="{ row }">Â¥{{ formatMoney(row.amountReceived) }}</template>
        </el-table-column>
        <el-table-column prop="taxRate"
                         label="税率"
                         width="80"
@@ -305,7 +288,6 @@
    nextTick,
    getCurrentInstance,
  } from "vue";
  import dayjs from "dayjs";
  import { ElMessage, ElMessageBox } from "element-plus";
  import FormDialog from "@/components/Dialog/FormDialog.vue";
  import { listCustomer } from "@/api/basicData/customer.js";
@@ -368,7 +350,6 @@
  const isEdit = ref(false);
  const isView = ref(false);
  const currentId = ref(null);
  const originalReceiptAmount = ref(0);
  const submitLoading = ref(false);
  const customerList = ref([]);
@@ -398,54 +379,7 @@
    stockOutRecordIds: [],
    outboundBatches: "",
    remark: "",
    createTime: "",
  });
  const formCreateTimeDate = computed({
    get: () => (form.createTime ? String(form.createTime).split(" ")[0] : ""),
    set: (value) => {
      form.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
    },
  });
  const maxCollectionAmount = computed(() => {
    const selected = form.stockOutRecordIds || [];
    const editAmount = isEdit.value ? Number(originalReceiptAmount.value) || 0 : 0;
    if (!selected.length) return isEdit.value ? editAmount : undefined;
    const selectedValueSet = new Set(selected.map(id => String(id)));
    const selectedOptions = outboundBatchOptions.value.filter(
      opt => opt.amountLimitAvailable && selectedValueSet.has(String(opt.value))
    );
    if (selectedOptions.length !== selectedValueSet.size) {
      return isEdit.value ? Number(editAmount.toFixed(2)) : undefined;
    }
    const sum = selectedOptions.reduce(
      (acc, opt) => acc + (Number(opt.outboundAmount) || 0),
      0
    );
    return Number((sum + editAmount).toFixed(2));
  });
  const collectionAmountInputMax = computed(
    () => maxCollectionAmount.value ?? Number.MAX_SAFE_INTEGER
  );
  const validateCollectionAmount = (rule, value, callback) => {
    if (value === undefined || value === null || value === "") {
      callback();
      return;
    }
    const amount = Number(value);
    if (Number.isNaN(amount)) {
      callback(new Error("请输入收款金额"));
      return;
    }
    const max = maxCollectionAmount.value;
    if (max !== undefined && amount - max > 0.000001) {
      callback(new Error(`收款金额不能超过${max.toFixed(2)}`));
      return;
    }
    callback();
  };
  const rules = {
    customerId: [{ required: true, message: "请选择客户", trigger: "change" }],
@@ -461,10 +395,7 @@
    receiptDate: [
      { required: true, message: "请选择收款日期", trigger: "change" },
    ],
    amount: [
      { required: true, message: "请输入收款金额", trigger: "blur" },
      { validator: validateCollectionAmount, trigger: ["blur", "change"] },
    ],
    amount: [{ required: true, message: "请输入收款金额", trigger: "blur" }],
    receiptMethod: [
      { required: true, message: "请选择收款方式", trigger: "change" },
    ],
@@ -524,12 +455,7 @@
    return list.map((item, index) => {
      if (typeof item === "string" || typeof item === "number") {
        const text = String(item);
        return {
          label: text,
          value: text,
          outboundAmount: 0,
          amountLimitAvailable: false,
        };
        return { label: text, value: text, outboundAmount: 0 };
      }
      const label =
        item.outboundBatches ??
@@ -539,15 +465,10 @@
        item.label ??
        `出库单${index + 1}`;
      const value = item.id ?? item.stockOutRecordId ?? label;
      const outboundAmount = Number(item.outboundAmount) || 0;
      const amountReceived = Number(item.amountReceived) || 0;
      const availableAmount = outboundAmount - amountReceived;
      return {
        label: String(label),
        value,
        outboundAmount:
          availableAmount > 0 ? Number(availableAmount.toFixed(2)) : 0,
        amountLimitAvailable: true,
        outboundAmount: Number(item.outboundAmount) || 0,
      };
    });
  };
@@ -595,7 +516,6 @@
        label: String(id),
        value: id,
        outboundAmount: 0,
        amountLimitAvailable: false,
      });
    });
  };
@@ -698,7 +618,6 @@
    outboundSelectVisible.value = false;
    syncCollectionAmount();
    formRef.value?.validateField("stockOutRecordIds");
    formRef.value?.validateField("amount");
  };
  const handleOutboundDialogClosed = () => {
@@ -739,7 +658,6 @@
      collectionNumber: form.receiptCode || "",
      remark: form.remark || "",
      stockOutRecordIds: (form.stockOutRecordIds || []).join(","),
      createTime: form.createTime,
    };
    if (forUpdate) {
      payload.id = currentId.value;
@@ -760,7 +678,6 @@
      stockOutRecordIds,
      outboundBatches: formatOutboundBatches(row.outboundBatches),
      remark: row.remark ?? "",
      createTime: row.createTime ?? "",
    });
  };
@@ -769,7 +686,6 @@
    outboundSelectVisible.value = false;
    isView.value = false;
    isEdit.value = false;
    originalReceiptAmount.value = 0;
  };
  const handleExport = () => {
@@ -829,9 +745,8 @@
    isEdit.value = false;
    isView.value = false;
    dialogTitle.value = "新增收款";
    originalReceiptAmount.value = 0;
    Object.assign(form, {
      receiptCode: "",
      receiptCode: "SK" + Date.now().toString().slice(-8),
      customerId: "",
      receiptDate: new Date().toISOString().split("T")[0],
      amount: 0,
@@ -839,7 +754,6 @@
      stockOutRecordIds: [],
      outboundBatches: "",
      remark: "",
      createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
    });
    outboundBatchList.value = [];
    outboundBatchOptions.value = [];
@@ -852,16 +766,13 @@
    currentId.value = row.id;
    dialogTitle.value = "编辑收款";
    fillFormFromRow(row);
    originalReceiptAmount.value = Number(form.amount || 0);
    dialogVisible.value = true;
    loadOutboundBatches(form.customerId, true);
  };
  const view = row => {
    isView.value = true;
    isEdit.value = false;
    dialogTitle.value = "查看收款";
    originalReceiptAmount.value = 0;
    fillFormFromRow(row);
    dialogVisible.value = true;
  };
src/views/financialManagement/receivable/reconciliation.vue
@@ -30,8 +30,6 @@
        :column="columns"
        :tableData="dataList"
        :tableLoading="tableLoading"
        isShowSummary
        :summaryMethod="getSummaries"
        :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
@@ -389,29 +387,6 @@
  closingBalance: generateForm.closingBalance,
  accountStatementDetails: selectedSales.value.map(buildDetailSubmitItem),
});
const summaryProps = ["openingBalance", "currentPlan", "currentActually", "closingBalance"];
const getSummaries = ({ columns, data }) => {
  const sums = [];
  columns.forEach((col, index) => {
    if (index === 0) {
      sums[index] = "合计";
    } else if (summaryProps.includes(col.property)) {
      const total = data.reduce((prev, cur) => {
        const v = Number(cur[col.property]);
        return prev + (isNaN(v) ? 0 : v);
      }, 0);
      sums[index] = Number(total.toFixed(2)).toLocaleString("zh-CN", {
        minimumFractionDigits: 2,
        maximumFractionDigits: 2,
      });
    } else {
      sums[index] = "";
    }
  });
  return sums;
};
const formatMoney = (value) => {
  if (value === undefined || value === null) return "0.00";
src/views/financialManagement/receivable/salesOut.vue
@@ -1,33 +1,27 @@
<template>
  <!-- é”€å”®å‡ºåº“ -->
<!-- é”€å”®å‡ºåº“ -->
  <div class="app-container">
    <el-form :model="filters"
             :inline="true">
    <el-form :model="filters" :inline="true">
      <el-form-item label="出库单号:">
        <el-input v-model="filters.outboundBatches"
                  placeholder="请输入出库单号"
                  clearable
                  style="width: 200px;" />
        <el-input v-model="filters.outboundBatches" placeholder="请输入出库单号" clearable style="width: 200px;" />
      </el-form-item>
      <el-form-item label="客户名称:">
        <el-input v-model="filters.customerName"
                  placeholder="请输入客户名称"
                  clearable
                  style="width: 200px;" />
        <el-input v-model="filters.customerName" placeholder="请输入客户名称" clearable style="width: 200px;" />
      </el-form-item>
      <el-form-item label="出库日期:">
        <el-date-picker v-model="filters.dateRange"
                        value-format="YYYY-MM-DD"
                        format="YYYY-MM-DD"
                        type="daterange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        clearable />
        <el-date-picker
          v-model="filters.dateRange"
          value-format="YYYY-MM-DD"
          format="YYYY-MM-DD"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          clearable
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary"
                   @click="onSearch">搜索</el-button>
        <el-button type="primary" @click="onSearch">搜索</el-button>
        <el-button @click="resetFilters">重置</el-button>
      </el-form-item>
    </el-form>
@@ -35,168 +29,141 @@
      <div class="actions">
        <div></div>
        <div>
          <el-button @click="handleOut"
                     icon="Download">导出</el-button>
          <el-button @click="handleOut" icon="Download">导出</el-button>
        </div>
      </div>
      <PIMTable rowKey="id"
                :column="columns"
                :tableData="dataList"
                :tableLoading="tableLoading"
                isShowSummary
                :summaryMethod="getSummaries"
                :page="{
      <PIMTable
        rowKey="id"
        :column="columns"
        :tableData="dataList"
        :tableLoading="tableLoading"
        :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
          total: pagination.total,
        }"
                @pagination="changePage" />
        @pagination="changePage"
      />
    </div>
  </div>
</template>
<script setup>
  import { ref, reactive, onMounted, getCurrentInstance } from "vue";
  import { ElMessage } from "element-plus";
  import { listPageAccountSales } from "@/api/financialManagement/accountSales";
import { ref, reactive, onMounted, getCurrentInstance } from "vue";
import { ElMessage } from "element-plus";
import { listPageAccountSales } from "@/api/financialManagement/accountSales";
  defineOptions({
    name: "销售出库",
  });
defineOptions({
  name: "销售出库",
});
  const { proxy } = getCurrentInstance();
const { proxy } = getCurrentInstance();
  const filters = reactive({
    outboundBatches: "",
    customerName: "",
    dateRange: [],
  });
const filters = reactive({
  outboundBatches: "",
  customerName: "",
  dateRange: [],
});
  const pagination = reactive({
    currentPage: 1,
    pageSize: 10,
    total: 0,
  });
const pagination = reactive({
  currentPage: 1,
  pageSize: 10,
  total: 0,
});
  const columns = [
    { label: "出库单号", prop: "outboundBatches", minWidth: "150" },
    { label: "客户名称", prop: "customerName", minWidth: "180" },
    { label: "出库日期", prop: "shippingDate", width: "170" },
    { label: "产品名称", prop: "productName", minWidth: "140" },
    { label: "规格型号", prop: "specificationModel", minWidth: "140" },
    {
      label: "金额",
      prop: "outboundAmount",
      minWidth: "120",
      formatData: val =>
        val === null || val === undefined || val === ""
          ? ""
          : Number(val).toLocaleString("zh-CN", {
              minimumFractionDigits: 2,
              maximumFractionDigits: 2,
            }),
    },
    { label: "发货编号", prop: "shippingNo", minWidth: "140" },
    { label: "销售订单号", prop: "salesContractNo", minWidth: "150" },
  ];
const columns = [
  { label: "出库单号", prop: "outboundBatches", minWidth: "150" },
  { label: "客户名称", prop: "customerName", minWidth: "180" },
  { label: "出库日期", prop: "shippingDate", width: "170" },
  { label: "产品名称", prop: "productName", minWidth: "140" },
  { label: "产品规格", prop: "specificationModel", minWidth: "140" },
  {
    label: "金额",
    prop: "outboundAmount",
    minWidth: "120",
    align: "right",
    formatData: (val) => (val === null || val === undefined || val === "" ? "" : Number(val).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 })),
  },
  { label: "发货编号", prop: "shippingNo", minWidth: "140" },
  { label: "销售订单号", prop: "salesContractNo", minWidth: "150" },
];
  const dataList = ref([]);
  const tableLoading = ref(false);
const dataList = ref([]);
const tableLoading = ref(false);
  function buildFilterParams() {
    const params = {
      outboundBatches: filters.outboundBatches || undefined,
      customerName: filters.customerName || undefined,
    };
    if (filters.dateRange && filters.dateRange.length === 2) {
      params.startDate = filters.dateRange[0];
      params.endDate = filters.dateRange[1];
    }
    return params;
function buildFilterParams() {
  const params = {
    outboundBatches: filters.outboundBatches || undefined,
    customerName: filters.customerName || undefined,
  };
  if (filters.dateRange && filters.dateRange.length === 2) {
    params.startDate = filters.dateRange[0];
    params.endDate = filters.dateRange[1];
  }
  return params;
}
  const onSearch = () => {
    pagination.currentPage = 1;
    getTableData();
  };
const onSearch = () => {
  pagination.currentPage = 1;
  getTableData();
};
  const getTableData = () => {
    tableLoading.value = true;
    listPageAccountSales({
      ...buildFilterParams(),
      current: pagination.currentPage,
      size: pagination.pageSize,
    })
      .then(res => {
        const ok = res.code === 200 || res.code === 0;
        if (ok && res.data) {
          pagination.total = res.data.total ?? 0;
          dataList.value = res.data.records ?? [];
        } else {
          ElMessage.error(res.msg || "查询失败");
          dataList.value = [];
        }
      })
      .catch(() => {
        dataList.value = [];
      })
      .finally(() => {
        tableLoading.value = false;
      });
  };
  const resetFilters = () => {
    filters.outboundBatches = "";
    filters.customerName = "";
    filters.dateRange = [];
    pagination.currentPage = 1;
    getTableData();
  };
  const changePage = ({ page, limit }) => {
    pagination.currentPage = page;
    pagination.pageSize = limit;
    getTableData();
  };
  const getSummaries = ({ columns, data }) => {
    const sums = [];
    columns.forEach((col, index) => {
      if (index === 0) {
        sums[index] = "合计";
      } else if (col.property === "outboundAmount") {
        const total = data.reduce((prev, cur) => {
          const v = Number(cur.outboundAmount);
          return prev + (isNaN(v) ? 0 : v);
        }, 0);
        sums[index] = total.toLocaleString("zh-CN", {
          minimumFractionDigits: 2,
          maximumFractionDigits: 2,
        });
const getTableData = () => {
  tableLoading.value = true;
  listPageAccountSales({
    ...buildFilterParams(),
    current: pagination.currentPage,
    size: pagination.pageSize,
  })
    .then((res) => {
      const ok = res.code === 200 || res.code === 0;
      if (ok && res.data) {
        pagination.total = res.data.total ?? 0;
        dataList.value = res.data.records ?? [];
      } else {
        sums[index] = "";
        ElMessage.error(res.msg || "查询失败");
        dataList.value = [];
      }
    })
    .catch(() => {
      dataList.value = [];
    })
    .finally(() => {
      tableLoading.value = false;
    });
    return sums;
  };
};
  const handleOut = () => {
    proxy.download(
      "/accountSales/exportAccountSalesOutbound",
      buildFilterParams(),
      `销售出库_${new Date().getTime()}.xlsx`
    );
  };
const resetFilters = () => {
  filters.outboundBatches = "";
  filters.customerName = "";
  filters.dateRange = [];
  pagination.currentPage = 1;
  getTableData();
};
  onMounted(() => {
    getTableData();
  });
const changePage = ({ page, limit }) => {
  pagination.currentPage = page;
  pagination.pageSize = limit;
  getTableData();
};
const handleOut = () => {
  proxy.download(
    "/accountSales/exportAccountSalesOutbound",
    buildFilterParams(),
    `销售出库_${new Date().getTime()}.xlsx`
  );
};
onMounted(() => {
  getTableData();
});
</script>
<style lang="scss" scoped>
  .actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
  }
.actions {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}
</style>
src/views/financialManagement/receivable/salesReturn.vue
@@ -37,8 +37,6 @@
        :column="columns"
        :tableData="dataList"
        :tableLoading="tableLoading"
        isShowSummary
        :summaryMethod="getSummaries"
        :page="{
          current: pagination.currentPage,
          size: pagination.pageSize,
@@ -77,35 +75,12 @@
  { label: "退货单号", prop: "returnNo", minWidth: "150" },
  { label: "客户名称", prop: "customerName", minWidth: "180" },
  { label: "关联发货单号", prop: "shippingNo", minWidth: "150" },
  {
    label: "发货类型",
    prop: "shippingType",
    minWidth: "110",
    formatData: (val) => ({ 1: "货车", 2: "快递" }[String(val)] || "--"),
  },
  {
    label: "发货车牌号",
    prop: "truckPlateNo",
    minWidth: "140",
    formatData: (_val, row) => (String(row?.shippingType) === "1" ? row?.truckPlateNo || "--" : "--"),
  },
  {
    label: "快递公司",
    prop: "expressCompany",
    minWidth: "140",
    formatData: (_val, row) => (String(row?.shippingType) === "2" ? row?.expressCompany || "--" : "--"),
  },
  {
    label: "快递单号",
    prop: "expressNo",
    minWidth: "150",
    formatData: (_val, row) => (String(row?.shippingType) === "2" ? row?.expressNo || "--" : "--"),
  },
  { label: "退货日期", prop: "makeTime", minWidth: "170" },
  {
    label: "退款总额",
    prop: "refundAmount",
    minWidth: "120",
    align: "right",
    formatData: (val) =>
      val === null || val === undefined || val === ""
        ? ""
@@ -172,27 +147,6 @@
  pagination.currentPage = page;
  pagination.pageSize = limit;
  getTableData();
};
const getSummaries = ({ columns, data }) => {
  const sums = [];
  columns.forEach((col, index) => {
    if (index === 0) {
      sums[index] = "合计";
    } else if (col.property === "refundAmount") {
      const total = data.reduce((prev, cur) => {
        const v = Number(cur.refundAmount);
        return prev + (isNaN(v) ? 0 : v);
      }, 0);
      sums[index] = total.toLocaleString("zh-CN", {
        minimumFractionDigits: 2,
        maximumFractionDigits: 2,
      });
    } else {
      sums[index] = "";
    }
  });
  return sums;
};
const handleOut = () => {
src/views/financialManagement/voucher/index.vue
@@ -25,7 +25,7 @@
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSearch">搜索</el-button>
        <el-button type="primary" @click="getTableData">搜索</el-button>
        <el-button @click="resetFilters">重置</el-button>
      </el-form-item>
    </el-form>
@@ -453,11 +453,6 @@
  return map[key] || "";
};
const onSearch = () => {
  pagination.currentPage = 1;
  getTableData();
};
// è”调约定:分页参数使用 current/size,日期范围拆分为 startDate/endDate
const getTableData = async () => {
  try {
@@ -523,9 +518,9 @@
  getTableData();
};
const changePage = ({ page, limit }) => {
  pagination.currentPage = page;
  pagination.pageSize = limit;
const changePage = ({ current, size }) => {
  pagination.currentPage = current;
  pagination.pageSize = size;
  getTableData();
};
src/views/index.vue
@@ -117,38 +117,36 @@
              <el-radio-button :value="'waiting'">待开始({{ orderProgressMeta.waitingCount }})</el-radio-button>
              <el-radio-button :value="'inProgress'">进行中({{ orderProgressMeta.inProgressCount }})</el-radio-button>
              <el-radio-button :value="'completed'">已完成({{ orderProgressMeta.completedCount }})</el-radio-button>
              <el-radio-button :value="'end'">已结束({{ orderProgressMeta.endCount }})</el-radio-button>
              <el-radio-button :value="'paused'">已暂停({{ orderProgressMeta.pausedCount }})</el-radio-button>
            </el-radio-group>
          </div>
          <div class="order-table-wrap">
            <el-table :data="filteredOrders" stripe max-height="440">
              <el-table-column prop="orderNo" label="订单编号" min-width="150" />
              <el-table-column prop="productName" label="产品名称" min-width="120" />
              <el-table-column prop="planQty" label="计划数量" min-width="90" />
              <el-table-column prop="completedQty" label="已完成" min-width="90" />
              <el-table-column label="完成率" min-width="180">
                <template #default="{ row }">
                  <div class="table-progress">
                    <el-progress
                        :stroke-width="8"
                        :percentage="row.completionRate"
                        :show-text="false"
                        status="success"
                    />
                    <span>{{ row.completionRate }}%</span>
                  </div>
                </template>
              </el-table-column>
              <el-table-column prop="deliveryDate" label="交期" min-width="110" />
              <el-table-column label="状态" min-width="90">
                <template #default="{ row }">
                  <el-tag :type="getOrderStatusType(row.status)" effect="light">
                    {{ row.statusLabel || getOrderStatusText(row.status) }}
                  </el-tag>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <el-table :data="filteredOrders" stripe>
            <el-table-column prop="orderNo" label="订单编号" min-width="150" />
            <el-table-column prop="productName" label="产品名称" min-width="120" />
            <el-table-column prop="planQty" label="计划数量" min-width="90" />
            <el-table-column prop="completedQty" label="已完成" min-width="90" />
            <el-table-column label="完成率" min-width="180">
              <template #default="{ row }">
                <div class="table-progress">
                  <el-progress
                      :stroke-width="8"
                      :percentage="row.completionRate"
                      :show-text="false"
                      status="success"
                  />
                  <span>{{ row.completionRate }}%</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column prop="deliveryDate" label="交期" min-width="110" />
            <el-table-column label="状态" min-width="90">
              <template #default="{ row }">
                <el-tag :type="getOrderStatusType(row.status)" effect="light">
                  {{ row.statusLabel || getOrderStatusText(row.status) }}
                </el-tag>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div v-if="visiblePanels.contract" class="cockpit-panel contract-panel">
@@ -216,7 +214,7 @@
        <div v-if="visiblePanels.todo" class="cockpit-panel todo-panel">
          <div class="panel-title-row">
            <div class="panel-title">待办事项</div>
            <span class="panel-more" @click="openTodoDialog">更多</span>
            <span class="panel-more" @click="goToApprovalProcess">更多</span>
          </div>
          <ul class="todo-list" v-if="todoList.length > 0">
            <li v-for="item in todoList" :key="item.id" class="todo-item">
@@ -234,6 +232,7 @@
        <div v-if="visiblePanels.realtime" class="cockpit-panel realtime-panel">
          <div class="panel-title-row">
            <div class="panel-title">生产实时看板</div>
            <span class="panel-more" @click="goToProductionOrder">更多</span>
          </div>
          <div class="realtime-grid">
            <div class="realtime-item" v-for="item in realtimeBoard" :key="item.key">
@@ -279,7 +278,7 @@
        <div v-if="visiblePanels.plan" class="cockpit-panel plan-panel">
          <div class="panel-title-row">
            <div class="panel-title">今日生产计划</div>
            <span class="panel-more">{{ todayPlanTotal }}项</span>
            <span class="panel-more" @click="goToProductionPlan">{{ todayPlanTotal }}项</span>
          </div>
          <ul class="plan-list">
            <li v-for="item in todayPlanList" :key="item.orderNo" class="plan-item">
@@ -333,18 +332,6 @@
          <el-button type="primary" @click="handleProcessDialogConfirm">确认</el-button>
        </span>
      </template>
    </el-dialog>
    <el-dialog v-model="todoDialogVisible" title="全部待办事项" width="900px" append-to-body destroy-on-close>
      <div v-loading="todoDialogLoading" class="todo-dialog-body">
        <el-table :data="todoDialogList" stripe max-height="520">
          <el-table-column prop="approveId" label="待办编号" min-width="160" />
          <el-table-column prop="approveDeptName" label="部门/模板" min-width="160" />
          <el-table-column prop="approveReason" label="事由" min-width="240" show-overflow-tooltip />
          <el-table-column prop="approveUserName" label="发起人" min-width="120" />
          <el-table-column prop="approveTime" label="时间" min-width="170" />
        </el-table>
      </div>
    </el-dialog>
  </div>
</template>
@@ -462,7 +449,6 @@
});
const realtimeBoardData = ref({
  deviceOee: { value: 0, compareYesterday: 0 },
  orderAchievementRate: { value: 0, compareYesterday: 0 },
  defectRate: { value: 0, compareYesterday: 0 },
});
@@ -477,14 +463,11 @@
  waitingCount: 0,
  inProgressCount: 0,
  completedCount: 0,
  endCount: 0,
  pausedCount: 0,
});
const todayPlanList = ref([]);
const todayPlanTotal = ref(0);
const todoDialogVisible = ref(false);
const todoDialogLoading = ref(false);
const todoDialogList = ref([]);
const sum = ref(0);
const yny = ref(0);
@@ -852,12 +835,12 @@
const productionOrders = ref([]);
const orderFilterOptions = ["all", "waiting", "inProgress", "completed", "end"];
const orderFilterOptions = ["all", "waiting", "inProgress", "completed", "paused"];
const orderFilterAliasMap = {
  1: "waiting",
  2: "inProgress",
  3: "completed",
  5: "end",
  4: "paused",
};
const orderFilter = ref("all");
const filteredOrders = computed(() => productionOrders.value);
@@ -899,22 +882,11 @@
};
const realtimeBoard = computed(() => {
  const oee = Number(realtimeBoardData.value.deviceOee?.value || 0);
  const orderAchievement = Number(realtimeBoardData.value.orderAchievementRate?.value || 0);
  const defectRate = Number(realtimeBoardData.value.defectRate?.value || 0);
  const oeeCompare = Number(realtimeBoardData.value.deviceOee?.compareYesterday || 0);
  const orderCompare = Number(realtimeBoardData.value.orderAchievementRate?.compareYesterday || 0);
  const defectCompare = Number(realtimeBoardData.value.defectRate?.compareYesterday || 0);
  return [
    {
      key: "oee",
      label: "设备 OEE",
      percent: clampPercent(oee),
      display: `${oee.toFixed(2)}%`,
      delta: getCompareText(oeeCompare),
      trend: getCompareTrend(oeeCompare),
      color: "#2d8cff",
    },
    {
      key: "order",
      label: "订单达成率",
@@ -922,7 +894,7 @@
      display: `${orderAchievement.toFixed(2)}%`,
      delta: getCompareText(orderCompare),
      trend: getCompareTrend(orderCompare),
      color: "#31d2ff",
      color: "#2d8cff",
    },
    {
      key: "defect",
@@ -1031,8 +1003,8 @@
    pathPrefixes: ["/inventorymanagement"],
  },
  production: {
    titles: ["生产管控"],
    pathPrefixes: ["/productionManagement", "/productionPlan"],
    titles: ["生产管理", "主生产计划", "生产订单", "生产报工"],
    pathPrefixes: ["/productionmanagement", "/productionplan"],
  },
  quality: {
    titles: ["质量管理"],
@@ -1086,7 +1058,7 @@
  realtime: visibleModules.value.production,
  quick: quickEntries.value.length > 0,
  plan: visibleModules.value.production,
  receipt: visibleModules.value.finance,
  receipt: visibleModules.value.sales || visibleModules.value.finance,
}));
const hasLeftPanels = computed(
@@ -1157,7 +1129,7 @@
    1: "待开始",
    2: "进行中",
    3: "已完成",
    5: "已结束",
    4: "已暂停",
  };
  return mapping[status] || "未知";
};
@@ -1221,10 +1193,6 @@
    const res = await productionRealtimeBoard();
    const data = res?.data || {};
    realtimeBoardData.value = {
      deviceOee: {
        value: Number(data.deviceOee?.value || 0),
        compareYesterday: Number(data.deviceOee?.compareYesterday || 0),
      },
      orderAchievementRate: {
        value: Number(data.orderAchievementRate?.value || 0),
        compareYesterday: Number(data.orderAchievementRate?.compareYesterday || 0),
@@ -1236,7 +1204,6 @@
    };
  } catch {
    realtimeBoardData.value = {
      deviceOee: { value: 0, compareYesterday: 0 },
      orderAchievementRate: { value: 0, compareYesterday: 0 },
      defectRate: { value: 0, compareYesterday: 0 },
    };
@@ -1248,8 +1215,8 @@
    const res = await productionOrderProgress({
      status: orderFilter.value,
      tab: orderFilter.value,
      pageNum: -1,
      pageSize: -1,
      pageNum: 1,
      pageSize: 10,
    });
    const data = res?.data || {};
    const statusValue = normalizeOrderFilter(data.status, orderFilter.value);
@@ -1264,7 +1231,7 @@
      waitingCount: resolveProgressCount(data.waitingCount, statusValue, "waiting", total),
      inProgressCount: resolveProgressCount(data.inProgressCount, statusValue, "inProgress", total),
      completedCount: resolveProgressCount(data.completedCount, statusValue, "completed", total),
      endCount: resolveProgressCount(data.endCount, statusValue, "end", total),
      pausedCount: resolveProgressCount(data.pausedCount, statusValue, "paused", total),
    };
    productionOrders.value = (data.records || []).map(mapOrderProgressRecord);
  } catch {
@@ -1278,7 +1245,7 @@
      waitingCount: 0,
      inProgressCount: 0,
      completedCount: 0,
      endCount: 0,
      pausedCount: 0,
    };
    productionOrders.value = [];
  }
@@ -1287,7 +1254,7 @@
const refreshTodayProductionPlan = async () => {
  try {
    const res = await todayProductionPlan({
      limit: 1000,
      limit: 4,
      planDate: nowDate.value,
    });
    const data = res?.data || {};
@@ -1319,19 +1286,6 @@
const todoInfoS = async () => {
  const res = await homeTodos();
  todoList.value = res.data || [];
};
const openTodoDialog = async () => {
  todoDialogVisible.value = true;
  todoDialogLoading.value = true;
  try {
    const res = await homeTodos();
    todoDialogList.value = res.data || [];
  } catch {
    todoDialogList.value = [];
  } finally {
    todoDialogLoading.value = false;
  }
};
const statisticsReceivable = async () => {
@@ -1425,6 +1379,18 @@
const goToQuick = (path) => {
  if (!path) return;
  router.push(path).catch(() => {});
};
const goToProductionOrder = () => {
  router.push('/productionManagement/productionOrder').catch(() => {});
};
const goToApprovalProcess = () => {
  router.push('/collaborativeApproval/approvalProcess').catch(() => {});
};
const goToProductionPlan = () => {
  router.push('/productionManagement/productionPlan').catch(() => {});
};
watch(orderFilter, () => {
@@ -1584,12 +1550,9 @@
}
.stats-grid {
  display: flex;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.stats-grid .stat-card {
  flex: 1;
}
.stat-card {
@@ -1771,34 +1734,6 @@
  font-size: 14px;
  color: #2563eb;
  cursor: pointer;
}
.todo-dialog-body {
  min-height: 220px;
}
.plan-panel {
  overflow: hidden;
}
.plan-list {
  margin: 10px 0 0;
  padding: 0 4px 0 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}
.plan-list::-webkit-scrollbar {
  width: 6px;
}
.plan-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.28);
}
.todo-list {
@@ -2154,7 +2089,7 @@
.realtime-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@@ -2162,12 +2097,12 @@
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px 8px;
  padding: 16px 12px;
  text-align: center;
}
.realtime-value {
  font-size: 26px;
  font-size: 32px;
  color: #0f172a;
  font-weight: 700;
}
@@ -2254,13 +2189,6 @@
.order-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.order-table-wrap {
  flex: 1;
  min-height: 0;
}
.quick-panel {
@@ -2300,12 +2228,25 @@
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.plan-panel {
  min-height: 236px;
}
.quality-panel {
  min-height: 0;
}
.receipt-panel {
  min-height: 340px;
}
.plan-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-item {
@@ -2460,6 +2401,10 @@
  .main-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 1200px) {
@@ -2482,7 +2427,7 @@
  }
  .realtime-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quality-cards {
@@ -2505,6 +2450,10 @@
    justify-content: flex-start;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .right-column {
    grid-template-columns: 1fr;
  }
src/views/inventoryManagement/dispatchLog/Record.vue
@@ -1,70 +1,71 @@
<template>
  <div>
    <div class="search_form"
         style="margin-bottom: 10px">
      <el-form ref="searchFormRef"
               :model="searchForm"
               class="demo-form-inline">
    <div class="search_form" style="margin-bottom: 10px">
      <el-form
          ref="searchFormRef"
          :model="searchForm"
          class="demo-form-inline"
      >
        <el-row :gutter="20">
          <el-col :span="4">
            <el-form-item label="出库日期"
                          prop="timeStr">
            <el-form-item label="出库日期" prop="timeStr">
              <el-date-picker v-model="searchForm.timeStr"
                              type="date"
                              placeholder="请选择日期"
                              value-format="YYYY-MM-DD"
                              format="YYYY-MM-DD"
                              clearable />
                              clearable/>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="产品大类"
                          prop="productName">
            <el-form-item label="产品大类" prop="productName">
              <el-input v-model="searchForm.productName"
                        style="width: 240px"
                        placeholder="请输入"
                        clearable />
                        clearable/>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="规格型号"
                          prop="model">
            <el-form-item label="产品规格" prop="model">
              <el-input v-model="searchForm.model"
                        style="width: 240px"
                        placeholder="请输入"
                        clearable />
                        clearable/>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="批号"
                          prop="batchNo">
            <el-form-item label="批号" prop="batchNo">
              <el-input v-model="searchForm.batchNo"
                        style="width: 240px"
                        placeholder="请输入"
                        clearable />
                        clearable/>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="来源"
                          prop="recordType">
              <el-select v-model="searchForm.recordType"
                         style="width: 240px"
                         placeholder="请选择"
                         clearable>
                <el-option v-for="item in stockRecordTypeOptions"
                           :key="item.value"
                           :label="item.label"
                           :value="item.value" />
            <el-form-item label="来源" prop="recordType">
              <el-select
                  v-model="searchForm.recordType"
                  style="width: 240px"
                  placeholder="请选择"
                  clearable
              >
                <el-option
                    v-for="item in stockRecordTypeOptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <!-- æŒ‰é’® -->
          <el-col :span="4">
            <el-form-item>
              <el-button type="primary"
                         @click="getList">
              <el-button type="primary" @click="getList">
                æœç´¢
              </el-button>
              <el-button @click="resetSearch">
                é‡ç½®
              </el-button>
@@ -74,837 +75,799 @@
      </el-form>
    </div>
    <div class="actions">
      <el-button type="primary"
                 @click="handleBatchApprove">审批</el-button>
      <el-button :disabled="!canReverseApprove"
                 @click="handleReverseApprove">反审</el-button>
      <!-- <el-button type="primary" @click="handleBatchApprove">审批</el-button> -->
      <el-button @click="handleOut">导出</el-button>
      <el-button type="danger"
                 plain
                 @click="handleDelete">删除</el-button>
      <el-button type="primary"
                 plain
                 @click="handlePrint">打印</el-button>
      <el-button type="danger" plain @click="handleDelete">删除</el-button>
      <el-button type="primary" plain @click="handlePrint">打印</el-button>
    </div>
    <div class="table_list">
      <el-table :data="tableData"
                border
                v-loading="tableLoading"
                @selection-change="handleSelectionChange"
                :expand-row-keys="expandedRowKeys"
                :row-key="(row) => row.id"
                style="width: 100%"
                height="calc(100vh - 18.5em)">
        <el-table-column align="center"
                         type="selection"
                         width="55" />
        <el-table-column align="center"
                         label="序号"
                         type="index"
                         width="60" />
        <el-table-column label="出库批次"
                         prop="outboundBatches"
                         min-width="100"
                         show-overflow-tooltip />
        <el-table-column label="出库日期"
                         prop="createTime"
                         show-overflow-tooltip />
        <el-table-column label="产品大类"
                         prop="productName"
                         show-overflow-tooltip />
        <el-table-column label="规格型号"
                         prop="model"
                         show-overflow-tooltip />
        <el-table-column label="批号"
                         prop="batchNo"
                         show-overflow-tooltip />
        <el-table-column label="单位"
                         prop="unit"
                         show-overflow-tooltip />
        <el-table-column label="出库数量"
                         prop="stockOutNum"
                         show-overflow-tooltip />
        <el-table-column label="出库人"
                         prop="createBy"
                         show-overflow-tooltip />
        <el-table-column label="来源"
                         prop="recordType"
                         show-overflow-tooltip>
      <el-table
        :data="tableData"
        border
        v-loading="tableLoading"
        @selection-change="handleSelectionChange"
        :expand-row-keys="expandedRowKeys"
        :row-key="(row) => row.id"
        style="width: 100%"
        height="calc(100vh - 18.5em)"
      >
        <el-table-column align="center" type="selection" width="55" />
        <el-table-column align="center" label="序号" type="index" width="60" />
        <el-table-column
          label="出库批次"
          prop="outboundBatches"
          min-width="100"
          show-overflow-tooltip
        />
        <el-table-column
          label="出库日期"
          prop="createTime"
          width="120"
          show-overflow-tooltip
        >
          <template #default="scope">
            <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="产品大类"
          prop="productName"
          show-overflow-tooltip
        />
        <el-table-column label="规格型号" prop="model" show-overflow-tooltip />
        <el-table-column label="批号" prop="batchNo" width="150" show-overflow-tooltip />
        <el-table-column label="单位" prop="unit" width="80" show-overflow-tooltip />
        <el-table-column
          label="出库数量"
          prop="stockOutNum"
          width="80"
          show-overflow-tooltip
        />
        <el-table-column label="出库人" prop="createBy" width="100" show-overflow-tooltip />
        <el-table-column label="来源" prop="recordType" show-overflow-tooltip>
          <template #default="scope">
            {{ getRecordType(scope.row.recordType) }}
          </template>
        </el-table-column>
        <el-table-column label="审批状态"
                         prop="approvalStatus"
                         show-overflow-tooltip>
        <!-- <el-table-column
          label="审批状态"
          prop="approvalStatus"
          show-overflow-tooltip
        >
          <template #default="scope">
            <el-tag :type="getApprovalStatusTagType(scope.row.approvalStatus)"
                    size="small">
            <el-tag
              :type="getApprovalStatusTagType(scope.row.approvalStatus)"
              size="small"
            >
              {{ getApprovalStatusLabel(scope.row.approvalStatus) }}
            </el-tag>
          </template>
        </el-table-column>
        </el-table-column> -->
      </el-table>
      <pagination v-show="total > 0"
                  :total="total"
                  layout="total, sizes, prev, pager, next, jumper"
                  :page="page.current"
                  :limit="page.size"
                  @pagination="paginationChange" />
      <pagination
        v-show="total > 0"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        :page="page.current"
        :limit="page.size"
        @pagination="paginationChange"
      />
    </div>
  </div>
</template>
<script setup>
  import pagination from "@/components/PIMTable/Pagination.vue";
  import { ref } from "vue";
  import { ElMessageBox } from "element-plus";
  import useUserStore from "@/store/modules/user";
  import { getCurrentDate } from "@/utils/index.js";
  import {
    getStockOutPage,
    delPendingStockOut,
    batchApproveStockOutRecords,
    batchUnapproveStockOutRecords,
  } from "@/api/inventoryManagement/stockOut.js";
  import {
    findAllQualifiedStockOutRecordTypeOptions,
    findAllUnQualifiedStockOutRecordTypeOptions,
  } from "@/api/basicData/enum.js";
import pagination from "@/components/PIMTable/Pagination.vue";
import { ref } from "vue";
import { ElMessageBox } from "element-plus";
import useUserStore from "@/store/modules/user";
import { getCurrentDate } from "@/utils/index.js";
import {
  getStockOutPage,
  delPendingStockOut,
  batchApproveStockOutRecords,
} from "@/api/inventoryManagement/stockOut.js";
import {
  findAllQualifiedStockOutRecordTypeOptions,
  findAllUnQualifiedStockOutRecordTypeOptions,
} from "@/api/basicData/enum.js";
import { parseTime } from "@/utils/ruoyi";
  const userStore = useUserStore();
  const { proxy } = getCurrentInstance();
  const tableData = ref([]);
  const selectedRows = ref([]);
  const tableLoading = ref(false);
  // æ¥æºç±»åž‹é€‰é¡¹
  const stockRecordTypeOptions = ref([]);
  const page = reactive({
    current: 1,
    size: 100,
  });
  const total = ref(0);
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
// æ¥æºç±»åž‹é€‰é¡¹
const stockRecordTypeOptions = ref([]);
const page = reactive({
  current: 1,
  size: 100,
});
const total = ref(0);
  const props = defineProps({
    type: {
      type: String,
      required: true,
      default: "0",
    },
    topParentProductId: {
      type: [String, Number],
      default: undefined,
    },
  });
const props = defineProps({
  type: {
    type: String,
    required: true,
    default: "0",
  },
  topParentProductId: {
    type: [String, Number],
    default: undefined,
  },
});
  // æ‰“印相关
  const printPreviewVisible = ref(false);
  const printData = ref([]);
// æ‰“印相关
const printPreviewVisible = ref(false);
const printData = ref([]);
  // ç”¨æˆ·ä¿¡æ¯è¡¨å•弹框数据
  const data = reactive({
    searchForm: {
      supplierName: "",
      timeStr: "",
      recordType: "",
    },
  });
  const { searchForm } = toRefs(data);
// ç”¨æˆ·ä¿¡æ¯è¡¨å•弹框数据
const data = reactive({
  searchForm: {
    supplierName: "",
    timeStr: "",
    recordType: "",
  },
});
const { searchForm } = toRefs(data);
  const searchFormRef = ref(null);
const searchFormRef = ref(null);
  const resetSearch = () => {
    searchFormRef.value?.resetFields();
    page.current = 1;
    getList();
  };
const resetSearch = () => {
  searchFormRef.value?.resetFields();
  page.current = 1;
  getList();
}
  const paginationChange = obj => {
    page.current = obj.page;
    page.size = obj.limit;
    getList();
  };
  const getList = () => {
    tableLoading.value = true;
    getStockOutPage({
      ...searchForm.value,
      ...page,
      topParentProductId: props.topParentProductId,
const paginationChange = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
const getList = () => {
  tableLoading.value = true;
  getStockOutPage({
    ...searchForm.value,
    ...page,
    topParentProductId: props.topParentProductId,
  })
    .then((res) => {
      tableLoading.value = false;
      tableData.value = res.data.records;
      tableData.value.map((item) => {
        item.children = [];
      });
      total.value = res.data.total;
    })
      .then(res => {
        tableLoading.value = false;
        tableData.value = res.data.records;
        tableData.value.map(item => {
          item.children = [];
        });
        total.value = res.data.total;
      })
      .catch(() => {
        tableLoading.value = false;
      });
  };
    .catch(() => {
      tableLoading.value = false;
    });
};
  const getRecordType = recordType => {
    return (
      stockRecordTypeOptions.value.find(item => item.value === recordType)
        ?.label || ""
    );
  };
const getRecordType = (recordType) => {
  return (
    stockRecordTypeOptions.value.find((item) => item.value === recordType)
      ?.label || ""
  );
};
  const approvalStatusLabelMap = {
    0: "待审批",
    1: "通过",
    2: "驳回",
    3: "待确认",
    pending: "待审批",
    approved: "通过",
    rejected: "驳回",
    PENDING: "待审批",
    APPROVED: "通过",
    REJECTED: "驳回",
  };
const approvalStatusLabelMap = {
  0: "待审批",
  1: "通过",
  2: "驳回",
  3: "待确认",
  pending: "待审批",
  approved: "通过",
  rejected: "驳回",
  PENDING: "待审批",
  APPROVED: "通过",
  REJECTED: "驳回",
};
  const getApprovalStatusLabel = status => {
    if (status === null || status === undefined || status === "") {
      return "待审批";
    }
    return approvalStatusLabelMap[status] || "待审批";
  };
const getApprovalStatusLabel = (status) => {
  if (status === null || status === undefined || status === "") {
    return "待审批";
  }
  return approvalStatusLabelMap[status] || "待审批";
};
  // é€šè¿‡/驳回固定色;其余(含待审批、空值、未映射但文案为待审批)统一用 warning é¢„警色
  const getApprovalStatusTagType = status => {
    if (
      status === 1 ||
      status === "1" ||
      status === "approved" ||
      status === "APPROVED"
    )
      return "success";
    if (
      status === 2 ||
      status === "2" ||
      status === "rejected" ||
      status === "REJECTED"
    )
      return "danger";
    return "warning";
  };
// é€šè¿‡/驳回固定色;其余(含待审批、空值、未映射但文案为待审批)统一用 warning é¢„警色
const getApprovalStatusTagType = (status) => {
  if (
    status === 1 ||
    status === "1" ||
    status === "approved" ||
    status === "APPROVED"
  )
    return "success";
  if (
    status === 2 ||
    status === "2" ||
    status === "rejected" ||
    status === "REJECTED"
  )
    return "danger";
  return "warning";
};
  // èŽ·å–æ¥æºç±»åž‹é€‰é¡¹
  const fetchStockRecordTypeOptions = () => {
    if (props.type === "0") {
      findAllQualifiedStockOutRecordTypeOptions().then(res => {
        stockRecordTypeOptions.value = res.data;
      });
      return;
    }
    findAllUnQualifiedStockOutRecordTypeOptions().then(res => {
// èŽ·å–æ¥æºç±»åž‹é€‰é¡¹
const fetchStockRecordTypeOptions = () => {
  if (props.type === "0") {
    findAllQualifiedStockOutRecordTypeOptions().then((res) => {
      stockRecordTypeOptions.value = res.data;
    });
  };
  // è¡¨æ ¼é€‰æ‹©æ•°æ®
  const handleSelectionChange = selection => {
    // è¿‡æ»¤æŽ‰å­æ•°æ®
    selectedRows.value = selection.filter(item => item.id);
    console.log("selection", selectedRows.value);
  };
  const isRejectedApproval = status => {
    return status === 2 || status === "2" || status === "rejected" || status === "REJECTED";
  };
  const canReverseApprove = computed(() => {
    return (
      selectedRows.value.length > 0 &&
      selectedRows.value.every(row => isRejectedApproval(row.approvalStatus))
    );
    return;
  }
  findAllUnQualifiedStockOutRecordTypeOptions().then((res) => {
    stockRecordTypeOptions.value = res.data;
  });
};
  const handleReverseApprove = () => {
    if (!canReverseApprove.value) {
      proxy.$modal.msgWarning("请选择驳回状态的数据");
      return;
    }
    const ids = selectedRows.value.map(item => item.id);
    ElMessageBox.confirm("反审后记录将恢复为待审批状态,是否确认反审?", "反审", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
      .then(() => {
        batchUnapproveStockOutRecords({ ids })
          .then(() => {
            proxy.$modal.msgSuccess("反审成功");
            getList();
          })
          .catch(() => {
            proxy.$modal.msgError("反审失败");
          });
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
  };
// è¡¨æ ¼é€‰æ‹©æ•°æ®
const handleSelectionChange = (selection) => {
  // è¿‡æ»¤æŽ‰å­æ•°æ®
  selectedRows.value = selection.filter((item) => item.id);
  console.log("selection", selectedRows.value);
};
const expandedRowKeys = ref([]);
  const expandedRowKeys = ref([]);
  const handleBatchApprove = () => {
    if (selectedRows.value.length === 0) {
      proxy.$modal.msgWarning("请选择数据");
      return;
    }
    const ids = selectedRows.value.map(item => item.id);
    ElMessageBox.confirm("请选择审批结果", "审批", {
      confirmButtonText: "通过",
      cancelButtonText: "驳回",
      type: "warning",
      distinguishCancelAndClose: true,
    })
      .then(() => {
        batchApproveStockOutRecords({ ids, approvalStatus: 1 })
          .then(() => {
            proxy.$modal.msgSuccess("审批通过成功");
            getList();
          })
          .catch(() => {
            proxy.$modal.msgError("审批通过失败");
          });
      })
      .catch(action => {
        if (action === "cancel") {
          batchApproveStockOutRecords({ ids, approvalStatus: 2 })
            .then(() => {
              proxy.$modal.msgSuccess("审批驳回成功");
              getList();
            })
            .catch(() => {
              proxy.$modal.msgError("审批驳回失败");
            });
          return;
        }
        proxy.$modal.msg("已取消");
      });
  };
  // å¯¼å‡º
  const handleOut = () => {
    ElMessageBox.confirm("是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
      .then(() => {
        proxy.download(
          "/stockOutRecord/exportStockOutRecord",
          { type: props.type },
          props.type === "0" ? "合格出库台账.xlsx" : "不合格出库台账.xlsx"
        );
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
  };
  // åˆ é™¤
  const handleDelete = () => {
    let ids = [];
    if (selectedRows.value.length > 0) {
      ids = selectedRows.value.map(item => item.id);
    } else {
      proxy.$modal.msgWarning("请选择数据");
      return;
    }
    ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
      .then(() => {
        delPendingStockOut(ids).then(res => {
          proxy.$modal.msgSuccess("删除成功");
const handleBatchApprove = () => {
  if (selectedRows.value.length === 0) {
    proxy.$modal.msgWarning("请选择数据");
    return;
  }
  const ids = selectedRows.value.map((item) => item.id);
  ElMessageBox.confirm("请选择审批结果", "审批", {
    confirmButtonText: "通过",
    cancelButtonText: "驳回",
    type: "warning",
    distinguishCancelAndClose: true,
  })
    .then(() => {
      batchApproveStockOutRecords({ ids, approvalStatus: 1 })
        .then(() => {
          proxy.$modal.msgSuccess("审批通过成功");
          getList();
        })
        .catch(() => {
          proxy.$modal.msgError("审批通过失败");
        });
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
    })
    .catch((action) => {
      if (action === "cancel") {
        batchApproveStockOutRecords({ ids, approvalStatus: 2 })
          .then(() => {
            proxy.$modal.msgSuccess("审批驳回成功");
            getList();
          })
          .catch(() => {
            proxy.$modal.msgError("审批驳回失败");
          });
        return;
      }
      proxy.$modal.msg("已取消");
    });
};
// å¯¼å‡º
const handleOut = () => {
  ElMessageBox.confirm("是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      proxy.download(
        "/stockOutRecord/exportStockOutRecord",
        { type: props.type },
        props.type === "0" ? "合格出库台账.xlsx" : "不合格出库台账.xlsx"
      );
    })
    .catch(() => {
      proxy.$modal.msg("已取消");
    });
};
// åˆ é™¤
const handleDelete = () => {
  let ids = [];
  if (selectedRows.value.length > 0) {
    ids = selectedRows.value.map((item) => item.id);
  } else {
    proxy.$modal.msgWarning("请选择数据");
    return;
  }
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      delPendingStockOut(ids).then((res) => {
        proxy.$modal.msgSuccess("删除成功");
        getList();
      });
  };
    })
    .catch(() => {
      proxy.$modal.msg("已取消");
    });
};
  // æ‰“印功能
  const handlePrint = () => {
    if (selectedRows.value.length === 0) {
      proxy.$modal.msgWarning("请选择要打印的数据");
      return;
    }
    printData.value = [...selectedRows.value];
    console.log("打印数据:", printData.value);
    printPreviewVisible.value = true;
  };
// æ‰“印功能
const handlePrint = () => {
  if (selectedRows.value.length === 0) {
    proxy.$modal.msgWarning("请选择要打印的数据");
    return;
  }
  printData.value = [...selectedRows.value];
  console.log("打印数据:", printData.value);
  printPreviewVisible.value = true;
};
  // æ‰§è¡Œæ‰“印
  const executePrint = () => {
    console.log("开始执行打印,数据条数:", printData.value.length);
    console.log("打印数据:", printData.value);
// æ‰§è¡Œæ‰“印
const executePrint = () => {
  console.log("开始执行打印,数据条数:", printData.value.length);
  console.log("打印数据:", printData.value);
    // åˆ›å»ºä¸€ä¸ªæ–°çš„æ‰“印窗口
    const printWindow = window.open("", "_blank", "width=800,height=600");
  // åˆ›å»ºä¸€ä¸ªæ–°çš„æ‰“印窗口
  const printWindow = window.open("", "_blank", "width=800,height=600");
    // æž„建打印内容
    let printContent = `
      <!DOCTYPE html>
      <html>
      <head>
        <meta charset="UTF-8">
        <title>打印预览</title>
        <style>
  // æž„建打印内容
  let printContent = `
    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="UTF-8">
      <title>打印预览</title>
      <style>
        body {
          margin: 0;
          padding: 0;
          font-family: "SimSun", serif;
          background: white;
        }
                                                     .print-page {
            width: 200mm;
            height: 75mm;
            padding: 10mm;
            padding-left: 20mm;
            background: white;
            box-sizing: border-box;
            page-break-after: always;
            page-break-inside: avoid;
          }
         .print-page:last-child {
           page-break-after: avoid;
         }
        .delivery-note {
          width: 100%;
          height: 100%;
          font-size: 12px;
          line-height: 1.2;
          display: flex;
          flex-direction: column;
          color: #000;
        }
        .header {
          text-align: center;
          margin-bottom: 8px;
        }
        .company-name {
          font-size: 18px;
          font-weight: bold;
          margin-bottom: 4px;
        }
        .document-title {
          font-size: 16px;
          font-weight: bold;
        }
        .info-section {
          margin-bottom: 8px;
          display: flex;
          justify-content: space-between;
          align-items: center;
        }
        .info-row {
          line-height: 20px;
        }
        .label {
          font-weight: bold;
          width: 60px;
          font-size: 12px;
        }
        .value {
          margin-right: 20px;
          min-width: 80px;
          font-size: 12px;
        }
                 .table-section {
                 margin-bottom: 40px;
          //  flex: 0.6;
         }
        .product-table {
          width: 100%;
          border-collapse: collapse;
          border: 1px solid #000;
        }
                 .product-table th, .product-table td {
           border: 1px solid #000;
           padding: 6px;
           text-align: center;
           font-size: 12px;
           line-height: 1.4;
         }
        .product-table th {
          font-weight: bold;
        }
        .total-value {
          font-weight: bold;
        }
        .footer-section {
          margin-top: auto;
        }
        .footer-row {
          display: flex;
          margin-bottom: 3px;
          line-height: 22px;
          justify-content: space-between;
        }
        .footer-item {
          display: flex;
          margin-right: 20px;
        }
        .footer-item .label {
          font-weight: bold;
          width: 80px;
          font-size: 12px;
        }
        .footer-item .value {
          min-width: 80px;
          font-size: 12px;
        }
        .address-item .address-value {
          min-width: 200px;
        }
        @media print {
          body {
            margin: 0;
            padding: 0;
            font-family: "SimSun", serif;
            background: white;
          }
                                                       .print-page {
              width: 200mm;
              height: 75mm;
              padding: 10mm;
              padding-left: 20mm;
              background: white;
              box-sizing: border-box;
              page-break-after: always;
              page-break-inside: avoid;
            }
                     .print-page {
             margin: 0;
             padding: 10mm;
             /* padding-left: 20mm; */
             page-break-inside: avoid;
             page-break-after: always;
           }
           .print-page:last-child {
             page-break-after: avoid;
           }
          .delivery-note {
            width: 100%;
            height: 100%;
            font-size: 12px;
            line-height: 1.2;
            display: flex;
            flex-direction: column;
            color: #000;
          }
          .header {
            text-align: center;
            margin-bottom: 8px;
          }
          .company-name {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 4px;
          }
          .document-title {
            font-size: 16px;
            font-weight: bold;
          }
          .info-section {
            margin-bottom: 8px;
            display: flex;
            justify-content: space-between;
            align-items: center;
          }
          .info-row {
            line-height: 20px;
          }
          .label {
            font-weight: bold;
            width: 60px;
            font-size: 12px;
          }
          .value {
            margin-right: 20px;
            min-width: 80px;
            font-size: 12px;
          }
                   .table-section {
                   margin-bottom: 40px;
            //  flex: 0.6;
           }
          .product-table {
            width: 100%;
            border-collapse: collapse;
            border: 1px solid #000;
          }
                   .product-table th, .product-table td {
             border: 1px solid #000;
             padding: 6px;
             text-align: center;
             font-size: 12px;
             line-height: 1.4;
           }
          .product-table th {
            font-weight: bold;
          }
          .total-value {
            font-weight: bold;
          }
          .footer-section {
            margin-top: auto;
          }
          .footer-row {
            display: flex;
            margin-bottom: 3px;
            line-height: 22px;
            justify-content: space-between;
          }
          .footer-item {
            display: flex;
            margin-right: 20px;
          }
          .footer-item .label {
            font-weight: bold;
            width: 80px;
            font-size: 12px;
          }
          .footer-item .value {
            min-width: 80px;
            font-size: 12px;
          }
          .address-item .address-value {
            min-width: 200px;
          }
          @media print {
            body {
              margin: 0;
              padding: 0;
            }
                       .print-page {
               margin: 0;
               padding: 10mm;
               /* padding-left: 20mm; */
               page-break-inside: avoid;
               page-break-after: always;
             }
             .print-page:last-child {
               page-break-after: avoid;
             }
          }
        </style>
      </head>
      <body>
    `;
        }
      </style>
    </head>
    <body>
  `;
    // ä¸ºæ¯æ¡æ•°æ®ç”Ÿæˆæ‰“印页面
    printData.value.forEach((item, index) => {
      printContent += `
        <div class="print-page">
          <div class="delivery-note">
            <div class="header">
              <div class="document-title">零售发货单</div>
            </div>
            <div class="info-section">
              <div class="info-row">
                <div>
                  <span class="label">发货日期:</span>
                  <span class="value">${formatDate(item.createTime)}</span>
                </div>
                <div>
                  <span class="label">客户名称:</span>
                  <span class="value">${item.supplierName}</span>
                </div>
  // ä¸ºæ¯æ¡æ•°æ®ç”Ÿæˆæ‰“印页面
  printData.value.forEach((item, index) => {
    printContent += `
      <div class="print-page">
        <div class="delivery-note">
          <div class="header">
            <div class="document-title">零售发货单</div>
          </div>
          <div class="info-section">
            <div class="info-row">
              <div>
                <span class="label">发货日期:</span>
                <span class="value">${formatDate(item.createTime)}</span>
              </div>
              <div class="info-row">
                <span class="label">单号:</span>
                <span class="value">${item.code || ""}</span>
              <div>
                <span class="label">客户名称:</span>
                <span class="value">${item.supplierName}</span>
              </div>
            </div>
            <div class="table-section">
              <table class="product-table">
                <thead>
                  <tr>
                    <th>产品名称</th>
                    <th>规格型号</th>
                    <th>单位</th>
                    <th>单价</th>
                    <th>零售数量</th>
                    <th>零售金额</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>${item.productName || "砂灰砖"}</td>
                    <td>${item.model || "标准"}</td>
                    <td>${item.unit || "块"}</td>
                    <td>${item.taxInclusiveUnitPrice || "0"}</td>
                    <td>${item.inboundNum || "2000"}</td>
                    <td>${item.taxInclusiveTotalPrice || "0"}</td>
                  </tr>
                </tbody>
                <tfoot>
                  <tr>
                    <td class="label">合计</td>
                    <td class="total-value"></td>
                    <td class="total-value"></td>
                    <td class="total-value"></td>
                    <td class="total-value">${item.inboundNum || "2000"}</td>
                    <td class="total-value">${
                      item.taxInclusiveTotalPrice || "0"
                    }</td>
                  </tr>
                </tfoot>
              </table>
            <div class="info-row">
              <span class="label">单号:</span>
              <span class="value">${item.code || ""}</span>
            </div>
          </div>
            <div class="footer-section">
              <div class="footer-row">
                <div class="footer-item">
                  <span class="label">收货电话:</span>
                  <span class="value"></span>
                </div>
                <div class="footer-item">
                  <span class="label">收货人:</span>
                  <span class="value"></span>
                </div>
                <div class="footer-item address-item">
                  <span class="label">收货地址:</span>
                  <span class="value address-value"></span>
                </div>
          <div class="table-section">
            <table class="product-table">
              <thead>
                <tr>
                  <th>产品名称</th>
                  <th>规格型号</th>
                  <th>单位</th>
                  <th>单价</th>
                  <th>零售数量</th>
                  <th>零售金额</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>${item.productName || "砂灰砖"}</td>
                  <td>${item.model || "标准"}</td>
                  <td>${item.unit || "块"}</td>
                  <td>${item.taxInclusiveUnitPrice || "0"}</td>
                  <td>${item.inboundNum || "2000"}</td>
                  <td>${item.taxInclusiveTotalPrice || "0"}</td>
                </tr>
              </tbody>
              <tfoot>
                <tr>
                  <td class="label">合计</td>
                  <td class="total-value"></td>
                  <td class="total-value"></td>
                  <td class="total-value"></td>
                  <td class="total-value">${item.inboundNum || "2000"}</td>
                  <td class="total-value">${
                    item.taxInclusiveTotalPrice || "0"
                  }</td>
                </tr>
              </tfoot>
            </table>
          </div>
          <div class="footer-section">
            <div class="footer-row">
              <div class="footer-item">
                <span class="label">收货电话:</span>
                <span class="value"></span>
              </div>
              <div class="footer-row">
                <div class="footer-item">
                  <span class="label">操作员:</span>
                  <span class="value">${userStore.nickName || "撕开前"}</span>
                </div>
                <div class="footer-item">
                  <span class="label">打印日期:</span>
                  <span class="value">${formatDateTime(new Date())}</span>
                </div>
              <div class="footer-item">
                <span class="label">收货人:</span>
                <span class="value"></span>
              </div>
              <div class="footer-item address-item">
                <span class="label">收货地址:</span>
                <span class="value address-value"></span>
              </div>
            </div>
            <div class="footer-row">
              <div class="footer-item">
                <span class="label">操作员:</span>
                <span class="value">${userStore.nickName || "撕开前"}</span>
              </div>
              <div class="footer-item">
                <span class="label">打印日期:</span>
                <span class="value">${formatDateTime(new Date())}</span>
              </div>
            </div>
          </div>
        </div>
      `;
    });
    printContent += `
      </body>
      </html>
      </div>
    `;
    // å†™å…¥å†…容到新窗口
    printWindow.document.write(printContent);
    printWindow.document.close();
    // ç­‰å¾…内容加载完成后打印
    printWindow.onload = () => {
      setTimeout(() => {
        printWindow.print();
        printWindow.close();
        printPreviewVisible.value = false;
      }, 500);
    };
  };
  // æ ¼å¼åŒ–日期
  const formatDate = dateString => {
    if (!dateString) return getCurrentDate();
    const date = new Date(dateString);
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, "0");
    const day = String(date.getDate()).padStart(2, "0");
    return `${year}/${month}/${day}`;
  };
  // æ ¼å¼åŒ–日期时间
  const formatDateTime = date => {
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, "0");
    const day = String(date.getDate()).padStart(2, "0");
    const hours = String(date.getHours()).padStart(2, "0");
    const minutes = String(date.getMinutes()).padStart(2, "0");
    const seconds = String(date.getSeconds()).padStart(2, "0");
    return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
  };
  onMounted(() => {
    getList();
    fetchStockRecordTypeOptions();
  });
  watch(
    () => props.topParentProductId,
    () => {
      page.current = 1;
      getList();
    }
  );
  printContent += `
    </body>
    </html>
  `;
  // å†™å…¥å†…容到新窗口
  printWindow.document.write(printContent);
  printWindow.document.close();
  // ç­‰å¾…内容加载完成后打印
  printWindow.onload = () => {
    setTimeout(() => {
      printWindow.print();
      printWindow.close();
      printPreviewVisible.value = false;
    }, 500);
  };
};
// æ ¼å¼åŒ–日期
const formatDate = (dateString) => {
  if (!dateString) return getCurrentDate();
  const date = new Date(dateString);
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, "0");
  const day = String(date.getDate()).padStart(2, "0");
  return `${year}/${month}/${day}`;
};
// æ ¼å¼åŒ–日期时间
const formatDateTime = (date) => {
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, "0");
  const day = String(date.getDate()).padStart(2, "0");
  const hours = String(date.getHours()).padStart(2, "0");
  const minutes = String(date.getMinutes()).padStart(2, "0");
  const seconds = String(date.getSeconds()).padStart(2, "0");
  return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
};
onMounted(() => {
  getList();
  fetchStockRecordTypeOptions();
});
watch(
  () => props.topParentProductId,
  () => {
    page.current = 1;
    getList();
  }
);
</script>
<style scoped lang="scss">
  .print-preview-dialog {
    .el-dialog__body {
      padding: 0;
      max-height: 80vh;
      overflow-y: auto;
    }
.print-preview-dialog {
  .el-dialog__body {
    padding: 0;
    max-height: 80vh;
    overflow-y: auto;
  }
}
  .print-preview-container {
    .print-preview-header {
      padding: 15px;
      border-bottom: 1px solid #e4e7ed;
      text-align: center;
      .el-button {
        margin: 0 10px;
      }
    }
    .print-preview-content {
      padding: 20px;
      background-color: #f5f5f5;
      min-height: 400px;
    }
  }
  .print-page {
    width: 220mm;
    height: 90mm;
    padding: 10mm;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    box-sizing: border-box;
  }
  .delivery-note {
    width: 100%;
    height: 100%;
    font-family: "SimSun", serif;
    font-size: 10px;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
  }
  .header {
.print-preview-container {
  .print-preview-header {
    padding: 15px;
    border-bottom: 1px solid #e4e7ed;
    text-align: center;
    margin-bottom: 8px;
    .company-name {
      font-size: 18px;
      font-weight: bold;
      margin-bottom: 4px;
    }
    .document-title {
      font-size: 16px;
      font-weight: bold;
    .el-button {
      margin: 0 10px;
    }
  }
  .info-section {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  .print-preview-content {
    padding: 20px;
    background-color: #f5f5f5;
    min-height: 400px;
  }
}
    .info-row {
      line-height: 20px;
.print-page {
  width: 220mm;
  height: 90mm;
  padding: 10mm;
  margin: 0 auto;
  background: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 10px;
  box-sizing: border-box;
}
.delivery-note {
  width: 100%;
  height: 100%;
  font-family: "SimSun", serif;
  font-size: 10px;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
}
.header {
  text-align: center;
  margin-bottom: 8px;
  .company-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 4px;
  }
  .document-title {
    font-size: 16px;
    font-weight: bold;
  }
}
.info-section {
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .info-row {
    line-height: 20px;
    .label {
      font-weight: bold;
      width: 60px;
      font-size: 14px;
    }
    .value {
      margin-right: 20px;
      min-width: 80px;
      font-size: 14px;
    }
  }
}
.table-section {
  margin-bottom: 4px;
  flex: 1;
  .product-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #000;
    th,
    td {
      border: 1px solid #000;
      padding: 6px;
      text-align: center;
      font-size: 14px;
      line-height: 1.4;
    }
    th {
      font-weight: bold;
    }
    .total-label {
      text-align: right;
      font-weight: bold;
    }
    .total-value {
      font-weight: bold;
    }
  }
}
.footer-section {
  .footer-row {
    display: flex;
    margin-bottom: 3px;
    line-height: 20px;
    justify-content: space-between;
    .footer-item {
      display: flex;
      margin-right: 20px;
      .label {
        font-weight: bold;
        width: 60px;
        width: 80px;
        font-size: 14px;
      }
      .value {
        margin-right: 20px;
        min-width: 80px;
        font-size: 14px;
      }
    }
  }
  .table-section {
    margin-bottom: 4px;
    flex: 1;
    .product-table {
      width: 100%;
      border-collapse: collapse;
      border: 1px solid #000;
      th,
      td {
        border: 1px solid #000;
        padding: 6px;
        text-align: center;
        font-size: 14px;
        line-height: 1.4;
      }
      th {
        font-weight: bold;
      }
      .total-label {
        text-align: right;
        font-weight: bold;
      }
      .total-value {
        font-weight: bold;
      }
    }
  }
  .footer-section {
    .footer-row {
      display: flex;
      margin-bottom: 3px;
      line-height: 20px;
      justify-content: space-between;
      .footer-item {
        display: flex;
        margin-right: 20px;
        .label {
          font-weight: bold;
          width: 80px;
          font-size: 14px;
        }
        .value {
          min-width: 80px;
          font-size: 14px;
        }
        &.address-item {
          .address-value {
            min-width: 200px;
          }
      &.address-item {
        .address-value {
          min-width: 200px;
        }
      }
    }
  }
}
  @media print {
    .app-container {
      display: none;
    }
    .print-page {
      box-shadow: none;
      margin: 0;
      padding: 10mm;
      padding-left: 20mm;
      page-break-inside: avoid;
      page-break-after: always;
    }
    .print-page:last-child {
      page-break-after: avoid;
    }
@media print {
  .app-container {
    display: none;
  }
  .actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
  .print-page {
    box-shadow: none;
    margin: 0;
    padding: 10mm;
    padding-left: 20mm;
    page-break-inside: avoid;
    page-break-after: always;
  }
  .print-page:last-child {
    page-break-after: avoid;
  }
}
.actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
</style>
src/views/inventoryManagement/receiptManagement/Record.vue
@@ -1,52 +1,49 @@
<template>
  <div>
    <div class="search_form"
         style="margin-bottom: 10px;">
      <el-form ref="searchFormRef"
               :model="searchForm"
               class="demo-form-inline">
    <div class="search_form" style="margin-bottom: 10px;">
      <el-form
          ref="searchFormRef"
          :model="searchForm"
          class="demo-form-inline"
      >
        <el-row :gutter="20">
          <el-col :span="4">
            <el-form-item label="入库日期"
                          prop="timeStr">
            <el-form-item label="入库日期" prop="timeStr">
              <el-date-picker v-model="searchForm.timeStr"
                              type="date"
                              placeholder="请选择日期"
                              value-format="YYYY-MM-DD"
                              format="YYYY-MM-DD"
                              clearable />
                              clearable/>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="产品大类"
                          prop="productName">
            <el-form-item label="产品大类" prop="productName">
              <el-input v-model="searchForm.productName"
                        style="width: 240px"
                        placeholder="请输入"
                        clearable />
                        clearable/>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="规格型号"
                          prop="model">
            <el-form-item label="产品规格" prop="model">
              <el-input v-model="searchForm.model"
                        style="width: 240px"
                        placeholder="请输入"
                        clearable />
                        clearable/>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="批号"
                          prop="batchNo">
            <el-form-item label="批号" prop="batchNo">
              <el-input v-model="searchForm.batchNo"
                        style="width: 240px"
                        placeholder="请输入"
                        clearable />
                        clearable/>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="来源"
                          prop="recordType">
            <el-form-item label="来源" prop="recordType">
              <el-select v-model="searchForm.recordType"
                         style="width: 240px"
                         placeholder="请选择"
@@ -54,17 +51,17 @@
                <el-option v-for="item in stockRecordTypeOptions"
                           :key="item.value"
                           :label="item.label"
                           :value="item.value" />
                           :value="item.value"/>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- æŒ‰é’® -->
          <el-col :span="4">
            <el-form-item>
              <el-button type="primary"
                         @click="getList">
              <el-button type="primary" @click="getList">
                æœç´¢
              </el-button>
              <el-button @click="resetSearch">
                é‡ç½®
              </el-button>
@@ -74,11 +71,11 @@
      </el-form>
    </div>
    <div class="actions">
      <el-button type="primary"
      <!-- <el-button type="primary"
                 :disabled="!canBatchApprove"
                 @click="handleBatchApprove">审批</el-button>
      <el-button :disabled="!canReverseApprove"
                 @click="handleReverseApprove">反审</el-button>
                 @click="handleReverseApprove">反审</el-button> -->
      <el-button @click="handleOut">导出</el-button>
      <el-button type="danger"
                 plain
@@ -98,36 +95,42 @@
        <el-table-column align="center"
                         type="selection"
                         :selectable="isRowSelectable"
                         width="55" />
                         width="55"/>
        <el-table-column align="center"
                         label="序号"
                         type="index"
                         width="60" />
                         width="60"/>
        <el-table-column label="入库批次"
                         prop="inboundBatches"
                         width="200"
                         show-overflow-tooltip />
                         width="150"
                         show-overflow-tooltip/>
        <el-table-column label="入库时间"
                         prop="createTime"
                         show-overflow-tooltip />
                         width="120"
                         show-overflow-tooltip>
          <template #default="scope">
            <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column>
        <el-table-column label="产品大类"
                         prop="productName"
                         show-overflow-tooltip />
                         show-overflow-tooltip/>
        <el-table-column label="规格型号"
                         prop="model"
                         show-overflow-tooltip />
                         show-overflow-tooltip/>
        <el-table-column label="批号"
                         prop="batchNo"
                         show-overflow-tooltip />
                         width="180"
                         show-overflow-tooltip/>
        <el-table-column label="单位"
                         prop="unit"
                         show-overflow-tooltip />
                         show-overflow-tooltip/>
        <el-table-column label="入库数量"
                         prop="stockInNum"
                         show-overflow-tooltip />
                         show-overflow-tooltip/>
        <el-table-column label="入库人"
                         prop="createBy"
                         show-overflow-tooltip />
                         show-overflow-tooltip/>
        <el-table-column label="来源"
                         prop="recordType"
                         show-overflow-tooltip>
@@ -135,380 +138,331 @@
            {{ getRecordType(scope.row.recordType) }}
          </template>
        </el-table-column>
        <el-table-column v-if="showSourceOrderNoColumn"
                         label="源单号"
                         width="150"
                         prop="sourceOrderNo"
                         show-overflow-tooltip>
        <el-table-column
            v-if="showSourceOrderNoColumn"
            label="源单号"
            width="150"
            prop="sourceOrderNo"
            show-overflow-tooltip>
          <template #default="scope">
            {{ formatSourceOrderNo(scope.row?.sourceOrderNo) }}
          </template>
        </el-table-column>
        <el-table-column label="审批状态"
        <!-- <el-table-column label="审批状态"
                         prop="approvalStatus"
                         show-overflow-tooltip>
          <template #default="scope">
            <el-tag :type="getApprovalStatusTagType(scope.row.approvalStatus)"
                    size="small">
            <el-tag :type="getApprovalStatusTagType(scope.row.approvalStatus)" size="small">
              {{ getApprovalStatusLabel(scope.row.approvalStatus) }}
            </el-tag>
          </template>
        </el-table-column>
        </el-table-column> -->
      </el-table>
      <pagination v-show="total > 0"
                  :total="total"
                  layout="total, sizes, prev, pager, next, jumper"
                  :page="page.current"
                  :limit="page.size"
                  @pagination="pageProductChange" />
                  @pagination="pageProductChange"/>
    </div>
  </div>
</template>
<script setup>
  import pagination from "@/components/PIMTable/Pagination.vue";
  import {
    ref,
    reactive,
    toRefs,
    computed,
    onMounted,
    getCurrentInstance,
  } from "vue";
  import { ElMessageBox } from "element-plus";
  import {
    getStockInRecordListPage,
    batchDeletePendingStockInRecords,
    batchApproveStockInRecords,
    batchUnapproveStockInRecords,
  } from "@/api/inventoryManagement/stockInRecord.js";
  import {
    findAllQualifiedStockInRecordTypeOptions,
    // findAllUnQualifiedStockInRecordTypeOptions,
  } from "@/api/basicData/enum.js";
import pagination from "@/components/PIMTable/Pagination.vue";
import {
  ref,
  reactive,
  toRefs,
  computed,
  onMounted,
  getCurrentInstance,
} from "vue";
import {ElMessageBox} from "element-plus";
import {
  getStockInRecordListPage,
  batchDeletePendingStockInRecords,
  batchApproveStockInRecords,
  batchUnapproveStockInRecords,
} from "@/api/inventoryManagement/stockInRecord.js";
import {
  findAllQualifiedStockInRecordTypeOptions,
  // findAllUnQualifiedStockInRecordTypeOptions,
} from "@/api/basicData/enum.js";
import { parseTime } from "@/utils/ruoyi";
  const { proxy } = getCurrentInstance();
const {proxy} = getCurrentInstance();
  const props = defineProps({
    type: {
      type: String,
      required: true,
      default: "0",
    },
    topParentProductId: {
      type: [String, Number],
      default: undefined,
    },
  });
const props = defineProps({
  type: {
    type: String,
    required: true,
    default: '0'
  },
  topParentProductId: {
    type: [String, Number],
    default: undefined
  }
})
  const tableData = ref([]);
  const selectedRows = ref([]);
  const tableLoading = ref(false);
  // æ¥æºç±»åž‹é€‰é¡¹
  const stockRecordTypeOptions = ref([]);
  const page = reactive({
    current: 1,
    size: 10,
  });
  const total = ref(0);
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
// æ¥æºç±»åž‹é€‰é¡¹
const stockRecordTypeOptions = ref([]);
const page = reactive({
  current: 1,
  size: 10,
});
const total = ref(0);
  const data = reactive({
    searchForm: {
      productName: "",
      batchNo: "",
      model: "",
      timeStr: "",
      recordType: "",
    },
  });
  const { searchForm } = toRefs(data);
  const searchFormRef = ref(null);
const data = reactive({
  searchForm: {
    productName: "",
    batchNo: "",
    model: "",
    timeStr: "",
    recordType: "",
  },
});
const {searchForm} = toRefs(data);
const searchFormRef = ref(null);
  const resetSearch = () => {
    searchFormRef.value?.resetFields();
    page.current = 1;
    getList();
  };
const resetSearch = () => {
  searchFormRef.value?.resetFields();
  page.current = 1;
  getList();
}
  const getRecordType = recordType => {
    return (
      stockRecordTypeOptions.value.find(item => item.value === recordType)
        ?.label || ""
    );
  };
const getRecordType = (recordType) => {
  return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
}
  const approvalStatusLabelMap = {
    0: "待审批",
    1: "通过",
    2: "驳回",
    pending: "待审批",
    approved: "通过",
    rejected: "驳回",
    PENDING: "待审批",
    APPROVED: "通过",
    REJECTED: "驳回",
  };
  approvalStatusLabelMap[3] = "待确认";
const approvalStatusLabelMap = {
  0: "待审批",
  1: "通过",
  2: "驳回",
  pending: "待审批",
  approved: "通过",
  rejected: "驳回",
  PENDING: "待审批",
  APPROVED: "通过",
  REJECTED: "驳回",
};
approvalStatusLabelMap[3] = "待确认";
  const getApprovalStatusLabel = status => {
    if (status === null || status === undefined || status === "") {
      return "待审批";
    }
    return approvalStatusLabelMap[status] || "待审批";
  };
const getApprovalStatusLabel = (status) => {
  if (status === null || status === undefined || status === "") {
    return "待审批";
  }
  return approvalStatusLabelMap[status] || "待审批";
};
  // é€šè¿‡/驳回固定色;其余(含待审批、空值、未映射但文案为待审批)统一用 warning é¢„警色
  const getApprovalStatusTagType = status => {
    if (
      status === 1 ||
      status === "1" ||
      status === "approved" ||
      status === "APPROVED"
    )
      return "success";
    if (
      status === 2 ||
      status === "2" ||
      status === "rejected" ||
      status === "REJECTED"
    )
      return "danger";
    return "warning";
  };
// é€šè¿‡/驳回固定色;其余(含待审批、空值、未映射但文案为待审批)统一用 warning é¢„警色
const getApprovalStatusTagType = (status) => {
  if (status === 1 || status === "1" || status === "approved" || status === "APPROVED") return "success";
  if (status === 2 || status === "2" || status === "rejected" || status === "REJECTED") return "danger";
  return "warning";
};
  const isPendingApproval = status => {
    return (
      status === 0 ||
      status === "0" ||
      status === "pending" ||
      status === "PENDING" ||
      status === null ||
      status === undefined ||
      status === ""
    );
  };
const isPendingApproval = status => {
  return status === 0 || status === "0" || status === "pending" || status === "PENDING" || status === null || status === undefined || status === "";
};
  const isRejectedApproval = status => {
    return (
      status === 2 ||
      status === "2" ||
      status === "rejected" ||
      status === "REJECTED"
    );
  };
const isRejectedApproval = status => {
  return status === 2 || status === "2" || status === "rejected" || status === "REJECTED";
};
  const isRowSelectable = row => {
    return (
      isPendingApproval(row?.approvalStatus) ||
      isRejectedApproval(row?.approvalStatus)
    );
  };
const isRowSelectable = row => {
  return isPendingApproval(row?.approvalStatus) || isRejectedApproval(row?.approvalStatus);
};
  const canBatchApprove = computed(() => {
    return (
      selectedRows.value.length > 0 &&
      selectedRows.value.every(row => isPendingApproval(row.approvalStatus))
    );
  });
const canBatchApprove = computed(() => {
  return selectedRows.value.length > 0
      && selectedRows.value.every(row => isPendingApproval(row.approvalStatus));
});
  const canReverseApprove = computed(() => {
    return (
      selectedRows.value.length > 0 &&
      selectedRows.value.every(row => isRejectedApproval(row.approvalStatus))
    );
  });
const canReverseApprove = computed(() => {
  return selectedRows.value.length > 0
      && selectedRows.value.every(row => isRejectedApproval(row.approvalStatus));
});
  const canDelete = computed(() => canBatchApprove.value);
  const showSourceOrderNoColumn = computed(() => {
    const topParentProductId = Number(props.topParentProductId);
    return topParentProductId === 276 || topParentProductId === 278;
  });
const canDelete = computed(() => canBatchApprove.value);
const showSourceOrderNoColumn = computed(() => {
  const topParentProductId = Number(props.topParentProductId);
  return topParentProductId === 1 || topParentProductId === 3;
});
  const formatSourceOrderNo = value => {
    const text = String(value ?? "").trim();
    return text || "--";
  };
const formatSourceOrderNo = (value) => {
  const text = String(value ?? "").trim();
  return text || "--";
};
  const pageProductChange = obj => {
    page.current = obj.page;
    page.size = obj.limit;
    getList();
  };
const pageProductChange = obj => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
  const getList = () => {
    tableLoading.value = true;
    getStockInRecordListPage(
      Object.assign(
        {},
        {
          ...searchForm.value,
          ...page,
          topParentProductId: props.topParentProductId,
        }
      )
    )
const getList = () => {
  tableLoading.value = true;
  getStockInRecordListPage(Object.assign({}, {...searchForm.value, ...page,  topParentProductId: props.topParentProductId}))
      .then(res => {
        tableData.value = res.data.records;
        total.value = res.data.total || 0;
      })
      .finally(() => {
        tableLoading.value = false;
      });
  };
      }).finally(() => {
    tableLoading.value = false;
  })
};
  // èŽ·å–æ¥æºç±»åž‹é€‰é¡¹
  const fetchStockRecordTypeOptions = () => {
    if (props.type === "0") {
      findAllQualifiedStockInRecordTypeOptions().then(res => {
        stockRecordTypeOptions.value = res.data;
      });
      return;
    }
    // findAllUnQualifiedStockInRecordTypeOptions()
    //     .then(res => {
    //       stockRecordTypeOptions.value = res.data;
    //     })
  };
// èŽ·å–æ¥æºç±»åž‹é€‰é¡¹
const fetchStockRecordTypeOptions = () => {
  if (props.type === '0') {
    findAllQualifiedStockInRecordTypeOptions()
        .then(res => {
          stockRecordTypeOptions.value = res.data;
        })
    return
  }
  // findAllUnQualifiedStockInRecordTypeOptions()
  //     .then(res => {
  //       stockRecordTypeOptions.value = res.data;
  //     })
}
  // è¡¨æ ¼é€‰æ‹©æ•°æ®
  const handleSelectionChange = selection => {
    selectedRows.value = selection.filter(
      item => item.id && isRowSelectable(item)
    );
  };
// è¡¨æ ¼é€‰æ‹©æ•°æ®
const handleSelectionChange = selection => {
  selectedRows.value = selection.filter(item => item.id && isRowSelectable(item));
};
  const expandedRowKeys = ref([]);
const expandedRowKeys = ref([]);
  const handleReverseApprove = () => {
    if (!canReverseApprove.value) {
      proxy.$modal.msgWarning("请选择已驳回的数据");
      return;
    }
    const ids = selectedRows.value.map(item => item.id);
    ElMessageBox.confirm("反审后记录将恢复为待审批状态,是否确认反审?", "反审", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
const handleReverseApprove = () => {
  if (!canReverseApprove.value) {
    proxy.$modal.msgWarning("请选择已驳回的数据");
    return;
  }
  const ids = selectedRows.value.map(item => item.id);
  ElMessageBox.confirm("反审后记录将恢复为待审批状态,是否确认反审?", "反审", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
      .then(() => {
        batchUnapproveStockInRecords({ ids })
          .then(() => {
            proxy.$modal.msgSuccess("反审成功");
            getList();
          })
          .catch(() => {
            proxy.$modal.msgError("反审失败");
          });
        batchUnapproveStockInRecords({ids})
            .then(() => {
              proxy.$modal.msgSuccess("反审成功");
              getList();
            })
            .catch(() => {
              proxy.$modal.msgError("反审失败");
            });
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
  };
};
  const handleBatchApprove = () => {
    if (!canBatchApprove.value) {
      proxy.$modal.msgWarning("请选择待审批的数据");
      return;
    }
    const ids = selectedRows.value.map(item => item.id);
    ElMessageBox.confirm("请选择审批结果", "审批", {
      confirmButtonText: "通过",
      cancelButtonText: "驳回",
      type: "warning",
      distinguishCancelAndClose: true,
    })
const handleBatchApprove = () => {
  if (!canBatchApprove.value) {
    proxy.$modal.msgWarning("请选择待审批的数据");
    return;
  }
  const ids = selectedRows.value.map(item => item.id);
  ElMessageBox.confirm("请选择审批结果", "审批", {
    confirmButtonText: "通过",
    cancelButtonText: "驳回",
    type: "warning",
    distinguishCancelAndClose: true,
  })
      .then(() => {
        batchApproveStockInRecords({ ids, approvalStatus: 1 })
          .then(() => {
            proxy.$modal.msgSuccess("审批通过成功");
            getList();
          })
          .catch(() => {
            proxy.$modal.msgError("审批通过失败");
          });
      })
      .catch(action => {
        if (action === "cancel") {
          batchApproveStockInRecords({ ids, approvalStatus: 2 })
        batchApproveStockInRecords({ids, approvalStatus: 1})
            .then(() => {
              proxy.$modal.msgSuccess("审批驳回成功");
              proxy.$modal.msgSuccess("审批通过成功");
              getList();
            })
            .catch(() => {
              proxy.$modal.msgError("审批驳回失败");
              proxy.$modal.msgError("审批通过失败");
            });
      })
      .catch((action) => {
        if (action === "cancel") {
          batchApproveStockInRecords({ids, approvalStatus: 2})
              .then(() => {
                proxy.$modal.msgSuccess("审批驳回成功");
                getList();
              })
              .catch(() => {
                proxy.$modal.msgError("审批驳回失败");
              });
          return;
        }
        proxy.$modal.msg("已取消");
      });
  };
};
  // å¯¼å‡º
  const handleOut = () => {
    ElMessageBox.confirm("是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
// å¯¼å‡º
const handleOut = () => {
  ElMessageBox.confirm("是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
      .then(() => {
        // æ ¹æ®ä¸åŒçš„ tab ç±»åž‹è°ƒç”¨ä¸åŒçš„导出接口
        proxy.download(
          "/stockInRecord/exportStockInRecord",
          { type: props.type },
          props.type === "0" ? "合格入库.xlsx" : "不合格入库.xlsx"
        );
        proxy.download("/stockInRecord/exportStockInRecord", {type: props.type}, props.type === '0' ? "合格入库.xlsx" : "不合格入库.xlsx");
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
  };
};
  // åˆ é™¤
  const handleDelete = () => {
    if (!canDelete.value) {
      proxy.$modal.msgWarning("请选择待审批的数据");
      return;
    }
    const ids = selectedRows.value.map(item => item.id);
// åˆ é™¤
const handleDelete = () => {
  if (!canDelete.value) {
    proxy.$modal.msgWarning("请选择待审批的数据");
    return;
  }
  const ids = selectedRows.value.map(item => item.id);
    ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
      .then(() => {
        batchDeletePendingStockInRecords(ids)
          .then(() => {
            proxy.$modal.msgSuccess("删除成功");
            getList();
          })
          .catch(() => {
            proxy.$modal.msgError("删除失败");
          });
            .then(() => {
              proxy.$modal.msgSuccess("删除成功");
              getList();
            })
            .catch(() => {
              proxy.$modal.msgError("删除失败");
            });
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
  };
};
  onMounted(() => {
onMounted(() => {
  getList();
  fetchStockRecordTypeOptions();
});
watch(
  () => props.topParentProductId,
  () => {
    page.current = 1;
    getList();
    fetchStockRecordTypeOptions();
  });
  watch(
    () => props.topParentProductId,
    () => {
      page.current = 1;
      getList();
    }
  );
  }
);
</script>
<style scoped lang="scss">
  .actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
  }
.actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
</style>
src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue
@@ -29,12 +29,12 @@
            prop="qualifiedQuantity"
            show-overflow-tooltip
          />
          <el-table-column
          <!-- <el-table-column
            label="不合格库存数量"
            prop="unQualifiedQuantity"
            show-overflow-tooltip
          />
          <el-table-column
          /> -->
          <!-- <el-table-column
            label="合格冻结数量"
            prop="qualifiedLockedQuantity"
            show-overflow-tooltip
@@ -43,7 +43,7 @@
            label="不合格冻结数量"
            prop="unQualifiedLockedQuantity"
            show-overflow-tooltip
          />
          /> -->
          <el-table-column
            label="库存预警数量"
            prop="warnNum"
@@ -55,7 +55,7 @@
            prop="updateTime"
            show-overflow-tooltip
          />
          <el-table-column fixed="right" label="操作" min-width="180" align="center">
          <el-table-column fixed="right" label="操作" min-width="100" align="center">
            <template #default="scope">
              <el-button
                link
@@ -71,7 +71,7 @@
                "
                >领用</el-button
              >
              <el-button
              <!-- <el-button
                link
                type="primary"
                v-if="
@@ -80,7 +80,7 @@
                "
                @click="handleFrozen(scope.row)"
                >冻结</el-button
              >
              > -->
              <el-button
                link
                type="primary"
src/views/inventoryManagement/stockManagement/New.vue
@@ -45,16 +45,15 @@
                     placeholder="请选择库存类型">
            <el-option label="合格库存"
                       value="qualified" />
            <el-option label="不合格库存"
                       value="unqualified" />
            <!-- <el-option label="不合格库存"
                       value="unqualified" /> -->
          </el-select>
        </el-form-item>
        <el-form-item label="库存数量"
                      prop="qualitity">
          <el-input-number v-model="formState.qualitity"
                           :step="0.01"
                           :min="0.01"
                           :precision="2"
                           :step="1"
                           :min="1"
                           style="width: 100%" />
        </el-form-item>
        <el-form-item label="批号"
@@ -66,10 +65,9 @@
                      label="库存预警数量"
                      prop="warnNum">
          <el-input-number v-model="formState.warnNum"
                           :step="0.01"
                           :step="1"
                           :min="0"
                           :max="formState.qualitity"
                           :precision="2"
                           style="width: 100%" />
        </el-form-item>
        <el-form-item label="备注"
src/views/inventoryManagement/stockManagement/Record.vue
@@ -1,359 +1,384 @@
<template>
  <div>
    <div class="search_form mb10">
      <el-form ref="searchFormRef"
               :model="searchForm"
               class="demo-form-inline">
      <el-form
          ref="searchFormRef"
          :model="searchForm"
          class="demo-form-inline"
      >
        <el-row :gutter="20">
          <el-col :span="4">
            <el-form-item label="产品大类"
                          prop="productName">
            <el-form-item label="产品大类" prop="productName">
              <el-input v-model="searchForm.productName"
                        style="width: 240px"
                        placeholder="请输入"
                        clearable />
                        clearable/>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="规格型号"
                          prop="model">
            <el-form-item label="产品规格" prop="model">
              <el-input v-model="searchForm.model"
                        style="width: 240px"
                        placeholder="请输入"
                        clearable />
                        clearable/>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="批号"
                          prop="batchNo">
            <el-form-item label="批号" prop="batchNo">
              <el-input v-model="searchForm.batchNo"
                        style="width: 240px"
                        placeholder="请输入"
                        clearable />
                        clearable/>
            </el-form-item>
          </el-col>
          <!-- æŒ‰é’® -->
          <el-col :span="4">
          <el-col :span="24" :sm="24" :md="12" :lg="12">
            <el-form-item>
              <el-button type="primary"
                         @click="getList">
                æœç´¢
              </el-button>
              <el-button @click="resetSearch">
                é‡ç½®
              </el-button>
              <div style="display: flex; align-items: center; gap: 4px; width: 100%; flex-wrap: wrap;">
                <el-button type="primary" @click="getList">
                  æœç´¢
                </el-button>
                <el-button @click="resetSearch">
                  é‡ç½®
                </el-button>
                <div style="display: flex; gap: 4px; margin-left: auto;">
                  <el-button type="primary" @click="isShowNewModal = true">
                    æ–°å¢žåº“å­˜
                  </el-button>
                  <el-button
                    type="info"
                    plain
                    icon="Upload"
                    @click="isShowImportModal = true"
                  >
                    å¯¼å…¥åº“å­˜
                  </el-button>
                  <el-button @click="handleOut">导出</el-button>
                </div>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div style="display: flex; gap: 10px; flex-wrap: nowrap;">
        <el-button type="primary"
                   @click="isShowNewModal = true">新增库存</el-button>
        <el-button type="info"
                   plain
                   icon="Upload"
                   @click="isShowImportModal = true">
          å¯¼å…¥åº“å­˜
        </el-button>
        <el-button @click="handleOut">导出</el-button>
      </div>
    </div>
    <div class="table_list">
      <el-table :data="tableData"
                border
                v-loading="tableLoading"
                @selection-change="handleSelectionChange"
                :expand-row-keys="expandedRowKeys"
                :row-key="(row, index) => index"
                style="width: 100%"
                :row-class-name="tableRowClassName"
                height="calc(100vh - 18.5em)">
        <el-table-column align="center"
                         type="selection"
                         width="55" />
        <el-table-column align="center"
                         label="序号"
                         type="index"
                         width="60" />
        <el-table-column label="产品名称"
                         prop="productName"
                         show-overflow-tooltip />
        <el-table-column label="规格型号"
                         prop="model"
                         show-overflow-tooltip />
        <el-table-column label="单位"
                         prop="unit"
                         show-overflow-tooltip />
        <el-table-column label="批号"
                         prop="batchNo"
                         show-overflow-tooltip />
        <el-table-column label="合格库存数量"
                         prop="qualifiedQuantity"
                         show-overflow-tooltip />
        <el-table-column label="不合格库存数量"
                         prop="unQualifiedQuantity"
                         show-overflow-tooltip />
        <el-table-column label="合格冻结数量"
                         prop="qualifiedLockedQuantity"
                         show-overflow-tooltip />
        <el-table-column label="不合格冻结数量"
                         prop="unQualifiedLockedQuantity"
                         show-overflow-tooltip />
        <el-table-column label="库存预警数量"
                         prop="warnNum"
                         show-overflow-tooltip />
        <el-table-column label="备注"
                         prop="remark"
                         show-overflow-tooltip />
        <el-table-column label="最近更新时间"
                         prop="updateTime"
                         show-overflow-tooltip />
        <el-table-column fixed="right"
                         label="操作"
                         min-width="80"
                         align="center">
      <el-table
        :data="tableData"
        border
        v-loading="tableLoading"
        @selection-change="handleSelectionChange"
        :expand-row-keys="expandedRowKeys"
        :row-key="(row, index) => index"
        style="width: 100%"
        :row-class-name="tableRowClassName"
        height="calc(100vh - 18.5em)"
      >
        <el-table-column align="center" type="selection" width="55" />
        <el-table-column align="center" label="序号" type="index" width="60" />
        <el-table-column
          label="产品名称"
          prop="productName"
          show-overflow-tooltip
        />
        <el-table-column label="规格型号" prop="model" show-overflow-tooltip />
        <el-table-column label="单位" prop="unit" show-overflow-tooltip />
        <!-- <el-table-column label="批号" prop="batchNo" show-overflow-tooltip /> -->
        <el-table-column
          label="合格库存数量"
          prop="qualifiedQuantity"
          show-overflow-tooltip
        />
        <!-- <el-table-column
          label="不合格库存数量"
          prop="unQualifiedQuantity"
          show-overflow-tooltip
        /> -->
        <!-- <el-table-column
          label="合格冻结数量"
          prop="qualifiedLockedQuantity"
          show-overflow-tooltip
        />
        <el-table-column
          label="不合格冻结数量"
          prop="unQualifiedLockedQuantity"
          show-overflow-tooltip
        /> -->
       <el-table-column
          label="库存预警数量"
          prop="warnNum"
          show-overflow-tooltip
        />
        <el-table-column label="备注" prop="remark" show-overflow-tooltip />
        <el-table-column
          label="最近更新时间"
          prop="updateTime"
          show-overflow-tooltip
        />
        <el-table-column
          fixed="right"
          label="操作"
          min-width="80"
          align="center"
        >
          <template #default="scope">
            <el-button link
                       type="primary"
                       @click="showDetailModal(scope.row)">详情</el-button>
            <el-button
              link
              type="primary"
              @click="showDetailModal(scope.row)"
              >详情</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total > 0"
                  :total="total"
                  layout="total, sizes, prev, pager, next, jumper"
                  :page="page.current"
                  :limit="page.size"
                  @pagination="paginationChange" />
      <pagination
        v-show="total > 0"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        :page="page.current"
        :limit="page.size"
        @pagination="paginationChange"
      />
    </div>
    <batch-no-qty-detail v-if="isShowDetailModal"
                         v-model:visible="isShowDetailModal"
                         :record="record"
                         @subtract="handleDetailSubtract"
                         @frozen="handleDetailFrozen"
                         @thaw="handleDetailThaw" />
    <new-stock-inventory v-if="isShowNewModal"
                         v-model:visible="isShowNewModal"
                         :top-product-parent-id="props.productId"
                         @completed="handleQuery" />
    <subtract-stock-inventory v-if="isShowSubtractModal"
                              v-model:visible="isShowSubtractModal"
                              :record="record"
                              :type="record.stockType"
                              @completed="handleQuery" />
    <batch-no-qty-detail
      v-if="isShowDetailModal"
      v-model:visible="isShowDetailModal"
      :record="record"
      @subtract="handleDetailSubtract"
      @frozen="handleDetailFrozen"
      @thaw="handleDetailThaw"
    />
    <new-stock-inventory
      v-if="isShowNewModal"
      v-model:visible="isShowNewModal"
      :top-product-parent-id="props.productId"
      @completed="handleQuery"
    />
    <subtract-stock-inventory
      v-if="isShowSubtractModal"
      v-model:visible="isShowSubtractModal"
      :record="record"
      :type="record.stockType"
      @completed="handleQuery"
    />
    <!-- å¯¼å…¥åº“å­˜-->
    <import-stock-inventory v-if="isShowImportModal"
                            v-model:visible="isShowImportModal"
                            type="qualified"
                            @uploadSuccess="handleQuery" />
    <import-stock-inventory
      v-if="isShowImportModal"
      v-model:visible="isShowImportModal"
      type="qualified"
      @uploadSuccess="handleQuery"
    />
    <!-- å†»ç»“/解冻库存-->
    <frozen-and-thaw-stock-inventory v-if="isShowFrozenAndThawModal"
                                     v-model:visible="isShowFrozenAndThawModal"
                                     :record="record"
                                     :operation-type="operationType"
                                     :type="record.stockType"
                                     @completed="handleQuery" />
    <frozen-and-thaw-stock-inventory
      v-if="isShowFrozenAndThawModal"
      v-model:visible="isShowFrozenAndThawModal"
      :record="record"
      :operation-type="operationType"
      :type="record.stockType"
      @completed="handleQuery"
    />
  </div>
</template>
<script setup>
  import pagination from "@/components/PIMTable/Pagination.vue";
  import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
  import { ElMessage, ElMessageBox } from "element-plus";
  import { getStockInventoryListPageCombined } from "@/api/inventoryManagement/stockInventory.js";
  const props = defineProps({
    productId: {
      type: Number,
      required: true,
      default: 0,
    },
  });
import pagination from "@/components/PIMTable/Pagination.vue";
import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { getStockInventoryListPageCombined } from "@/api/inventoryManagement/stockInventory.js";
const props = defineProps({
  productId: {
    type: Number,
    required: true,
    default: 0,
  },
});
  const NewStockInventory = defineAsyncComponent(() =>
    import("@/views/inventoryManagement/stockManagement/New.vue")
  );
  const SubtractStockInventory = defineAsyncComponent(() =>
    import("@/views/inventoryManagement/stockManagement/Subtract.vue")
  );
  const ImportStockInventory = defineAsyncComponent(() =>
    import("@/views/inventoryManagement/stockManagement/Import.vue")
  );
  const FrozenAndThawStockInventory = defineAsyncComponent(() =>
    import("@/views/inventoryManagement/stockManagement/FrozenAndThaw.vue")
  );
  const BatchNoQtyDetail = defineAsyncComponent(() =>
    import("@/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue")
  );
  const { proxy } = getCurrentInstance();
  const tableData = ref([]);
  const selectedRows = ref([]);
  const record = ref({});
  const tableLoading = ref(false);
  const page = reactive({
    current: 1,
    size: 100,
  });
  const total = ref(0);
  // æ˜¯å¦æ˜¾ç¤ºæ–°å¢žå¼¹æ¡†
  const isShowNewModal = ref(false);
  // æ˜¯å¦æ˜¾ç¤ºé¢†ç”¨å¼¹æ¡†
  const isShowSubtractModal = ref(false);
  // æ˜¯å¦æ˜¾ç¤ºå†»ç»“/解冻弹框
  const isShowFrozenAndThawModal = ref(false);
  // æ˜¯å¦æ˜¾ç¤ºè¯¦æƒ…弹框
  const isShowDetailModal = ref(false);
  // æ“ä½œç±»åž‹
  const operationType = ref("frozen");
  // æ˜¯å¦æ˜¾ç¤ºå¯¼å…¥å¼¹æ¡†
  const isShowImportModal = ref(false);
  const data = reactive({
    searchForm: {
      productName: "",
      model: "",
      batchNo: "",
      topParentProductId: props.productId,
    },
  });
  const { searchForm } = toRefs(data);
  const searchFormRef = ref(null);
const NewStockInventory = defineAsyncComponent(() =>
  import("@/views/inventoryManagement/stockManagement/New.vue")
);
const SubtractStockInventory = defineAsyncComponent(() =>
  import("@/views/inventoryManagement/stockManagement/Subtract.vue")
);
const ImportStockInventory = defineAsyncComponent(() =>
  import("@/views/inventoryManagement/stockManagement/Import.vue")
);
const FrozenAndThawStockInventory = defineAsyncComponent(() =>
  import("@/views/inventoryManagement/stockManagement/FrozenAndThaw.vue")
);
const BatchNoQtyDetail = defineAsyncComponent(() =>
  import("@/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue")
);
const { proxy } = getCurrentInstance();
const tableData = ref([]);
const selectedRows = ref([]);
const record = ref({});
const tableLoading = ref(false);
const page = reactive({
  current: 1,
  size: 100,
});
const total = ref(0);
// æ˜¯å¦æ˜¾ç¤ºæ–°å¢žå¼¹æ¡†
const isShowNewModal = ref(false);
// æ˜¯å¦æ˜¾ç¤ºé¢†ç”¨å¼¹æ¡†
const isShowSubtractModal = ref(false);
// æ˜¯å¦æ˜¾ç¤ºå†»ç»“/解冻弹框
const isShowFrozenAndThawModal = ref(false);
// æ˜¯å¦æ˜¾ç¤ºè¯¦æƒ…弹框
const isShowDetailModal = ref(false);
// æ“ä½œç±»åž‹
const operationType = ref("frozen");
// æ˜¯å¦æ˜¾ç¤ºå¯¼å…¥å¼¹æ¡†
const isShowImportModal = ref(false);
const data = reactive({
  searchForm: {
    productName: "",
    model: "",
    batchNo: "",
    topParentProductId: props.productId,
  },
});
const { searchForm } = toRefs(data);
const searchFormRef = ref(null);
  const resetSearch = () => {
    searchFormRef.value?.resetFields();
    page.current = 1;
    getList();
  };
const resetSearch = () => {
  searchFormRef.value?.resetFields();
  page.current = 1;
  getList();
}
  // æŸ¥è¯¢åˆ—表
  /** æœç´¢æŒ‰é’®æ“ä½œ */
  const handleQuery = () => {
    page.current = 1;
    getList();
  };
  const paginationChange = obj => {
    page.current = obj.page;
    page.size = obj.limit;
    getList();
  };
  const getList = () => {
    tableLoading.value = true;
    getStockInventoryListPageCombined({ ...searchForm.value, ...page })
      .then(res => {
        tableLoading.value = false;
        tableData.value = res.data.records;
        total.value = res.data.total;
        // æ•°æ®åŠ è½½å®ŒæˆåŽæ£€æŸ¥åº“å­˜
        // checkStockAndCreatePurchase();
      })
      .catch(() => {
        tableLoading.value = false;
      });
  };
  const handleFileSuccess = response => {
    const { code, msg } = response;
    if (code == 200) {
      ElMessage({ message: "导入成功", type: "success" });
      upload.open = false;
      emits("uploadSuccess");
    } else {
      ElMessage({ message: msg, type: "error" });
    }
  };
  // ç‚¹å‡»é¢†ç”¨
  const showSubtractModal = row => {
    record.value = row;
    isShowSubtractModal.value = true;
  };
  // ç‚¹å‡»è¯¦æƒ…
  const showDetailModal = row => {
    if (!row?.productId || !row?.productModelId) {
      proxy.$modal.msgError("当前数据缺少产品ID或规格型号ID");
      return;
    }
    record.value = row;
    isShowDetailModal.value = true;
  };
  const handleDetailSubtract = row => {
    isShowDetailModal.value = false;
    showSubtractModal(row);
  };
  const handleDetailFrozen = row => {
    isShowDetailModal.value = false;
    showFrozenModal(row);
  };
  const handleDetailThaw = row => {
    isShowDetailModal.value = false;
    showThawModal(row);
  };
  // ç‚¹å‡»å†»ç»“
  const showFrozenModal = row => {
    record.value = row;
    isShowFrozenAndThawModal.value = true;
    operationType.value = "frozen";
  };
  // ç‚¹å‡»è§£å†»
  const showThawModal = row => {
    record.value = row;
    isShowFrozenAndThawModal.value = true;
    operationType.value = "thaw";
  };
  // è¡¨æ ¼é€‰æ‹©æ•°æ®
  const handleSelectionChange = selection => {
    // è¿‡æ»¤æŽ‰å­æ•°æ®
    selectedRows.value = selection.filter(item => item.id);
    console.log("selection", selectedRows.value);
  };
  const expandedRowKeys = ref([]);
  // è¡¨æ ¼è¡Œç±»å
  const tableRowClassName = ({ row }) => {
    const stock = Number(row?.qualifiedUnLockedQuantity ?? 0);
    const warn = Number(row?.warnNum ?? 0);
    if (!Number.isFinite(stock) || !Number.isFinite(warn)) {
      return "";
    }
    return stock < warn ? "row-low-stock" : "";
  };
  // å¯¼å‡º
  const handleOut = () => {
    ElMessageBox.confirm("是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
// æŸ¥è¯¢åˆ—表
/** æœç´¢æŒ‰é’®æ“ä½œ */
const handleQuery = () => {
  page.current = 1;
  getList();
};
const paginationChange = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
const getList = () => {
  tableLoading.value = true;
  getStockInventoryListPageCombined({ ...searchForm.value, ...page })
    .then((res) => {
      tableLoading.value = false;
      tableData.value = res.data.records;
      total.value = res.data.total;
      // æ•°æ®åŠ è½½å®ŒæˆåŽæ£€æŸ¥åº“å­˜
      // checkStockAndCreatePurchase();
    })
      .then(() => {
        proxy.download(
          "/stockInventory/exportStockInventory",
          { topParentProductId: props.productId },
          "库存信息.xlsx"
        );
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
  };
    .catch(() => {
      tableLoading.value = false;
    });
};
  onMounted(() => {
    getList();
  });
const handleFileSuccess = (response) => {
  const { code, msg } = response;
  if (code == 200) {
    ElMessage({ message: "导入成功", type: "success" });
    upload.open = false;
    emits("uploadSuccess");
  } else {
    ElMessage({ message: msg, type: "error" });
  }
};
// ç‚¹å‡»é¢†ç”¨
const showSubtractModal = (row) => {
  record.value = row;
  isShowSubtractModal.value = true;
};
// ç‚¹å‡»è¯¦æƒ…
const showDetailModal = (row) => {
  if (!row?.productId || !row?.productModelId) {
    proxy.$modal.msgError("当前数据缺少产品ID或规格型号ID");
    return;
  }
  record.value = row;
  isShowDetailModal.value = true;
};
const handleDetailSubtract = (row) => {
  isShowDetailModal.value = false;
  showSubtractModal(row);
};
const handleDetailFrozen = (row) => {
  isShowDetailModal.value = false;
  showFrozenModal(row);
};
const handleDetailThaw = (row) => {
  isShowDetailModal.value = false;
  showThawModal(row);
};
// ç‚¹å‡»å†»ç»“
const showFrozenModal = (row) => {
  record.value = row;
  isShowFrozenAndThawModal.value = true;
  operationType.value = "frozen";
};
// ç‚¹å‡»è§£å†»
const showThawModal = (row) => {
  record.value = row;
  isShowFrozenAndThawModal.value = true;
  operationType.value = "thaw";
};
// è¡¨æ ¼é€‰æ‹©æ•°æ®
const handleSelectionChange = (selection) => {
  // è¿‡æ»¤æŽ‰å­æ•°æ®
  selectedRows.value = selection.filter((item) => item.id);
  console.log("selection", selectedRows.value);
};
const expandedRowKeys = ref([]);
// è¡¨æ ¼è¡Œç±»å
const tableRowClassName = ({ row }) => {
  const stock = Number(row?.qualifiedUnLockedQuantity ?? 0);
  const warn = Number(row?.warnNum ?? 0);
  if (!Number.isFinite(stock) || !Number.isFinite(warn)) {
    return "";
  }
  return stock < warn ? "row-low-stock" : "";
};
// å¯¼å‡º
const handleOut = () => {
  ElMessageBox.confirm("是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      proxy.download(
        "/stockInventory/exportStockInventory",
        { topParentProductId: props.productId },
        "库存信息.xlsx"
      );
    })
    .catch(() => {
      proxy.$modal.msg("已取消");
    });
};
onMounted(() => {
  getList();
});
</script>
<style scoped lang="scss">
  :deep(.row-low-stock td) {
    background-color: #fde2e2;
    color: #c45656;
  }
:deep(.row-low-stock td) {
  background-color: #fde2e2;
  color: #c45656;
}
  :deep(.row-low-stock:hover > td) {
    background-color: #fcd4d4;
  }
:deep(.row-low-stock:hover > td) {
  background-color: #fcd4d4;
}
</style>
src/views/login.vue
@@ -2,16 +2,16 @@
  <div class="login-page">
    <main class="page">
      <section class="factory">
<!--        <div class="brand hero-brand">-->
<!--          <div class="logo hero-logo">-->
<!--            <img-->
<!--              :src="brandLogoUrl"-->
<!--              :alt="`${companyName} logo`"-->
<!--              class="logo-image hero-logo-image"-->
<!--              @error="handleLogoError"-->
<!--            />-->
<!--          </div>-->
<!--        </div>-->
        <div class="brand hero-brand">
          <div class="logo hero-logo">
            <img
              :src="brandLogoUrl"
              :alt="`${companyName} logo`"
              class="logo-image hero-logo-image"
              @error="handleLogoError"
            />
          </div>
        </div>
        <div class="hero">
          <div class="chip">数字工厂 Â· æ™ºèƒ½æŽ’产 Â· è®¾å¤‡äº’联 Â· è´¨é‡è¿½æº¯</div>
src/views/monitor/operlog/index.vue
@@ -125,7 +125,7 @@
         </el-table-column>
         <el-table-column label="操作日期" align="center" prop="operTime" width="180" sortable="custom" :sort-orders="['descending', 'ascending']">
            <template #default="scope">
               <span>{{ parseTime(scope.row.operTime) }}</span>
               <span>{{ parseTime(scope.row.operTime, '{y}-{m}-{d}') }}</span>
            </template>
         </el-table-column>
         <el-table-column label="消耗时间" align="center" prop="costTime" width="110" :show-overflow-tooltip="true" sortable="custom" :sort-orders="['descending', 'ascending']">
@@ -165,10 +165,10 @@
               <el-col :span="24">
                  <el-form-item label="操作方法:">{{ form.method }}</el-form-item>
               </el-col>
               <el-col :span="24">
               <el-col :span="24" v-if="form.status === 1">
                  <el-form-item label="请求参数:">{{ form.operParam }}</el-form-item>
               </el-col>
               <el-col :span="24">
               <el-col :span="24" v-if="form.status === 1">
                  <el-form-item label="返回参数:">{{ form.jsonResult }}</el-form-item>
               </el-col>
               <el-col :span="8">
@@ -181,7 +181,7 @@
                  <el-form-item label="消耗时间:">{{ form.costTime }}毫秒</el-form-item>
               </el-col>
               <el-col :span="8">
                  <el-form-item label="操作时间:">{{ parseTime(form.operTime) }}</el-form-item>
                  <el-form-item label="操作时间:">{{ parseTime(form.operTime, '{y}-{m}-{d}') }}</el-form-item>
               </el-col>
               <el-col :span="24">
                  <el-form-item label="异常信息:" v-if="form.status === 1">{{ form.errorMsg }}</el-form-item>
src/views/personnelManagement/attendanceCheckin/checkinRules/components/form.vue
@@ -37,17 +37,11 @@
          <el-option v-for="item in shifts_list"
                     :key="item.value"
                     :label="item.label"
                     :value="item.value"
                     :disabled="
              operationType === 'add' &&
              (String(item.label || '').includes('假') ||
                String(item.label || '').includes('休'))
            " />
                     :value="item.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="打卡范围(m)"
                    prop="radius"
                    v-show="!hideClockFields">
                    prop="radius">
        <el-input-number v-model="form.radius"
                         :min="10"
                         :max="1000"
@@ -57,8 +51,7 @@
      </el-form-item>
      <!-- é«˜å¾·åœ°å›¾é€‰æ‹© -->
      <el-form-item label="打卡位置"
                    prop="longitude"
                    v-show="!hideClockFields">
                    prop="longitude">
        <div class="map-container">
          <div class="map-header"
               style="margin-bottom: 10px">
@@ -89,16 +82,14 @@
        </div>
      </el-form-item>
      <el-form-item label="地点名称"
                    prop="locationName"
                    v-show="!hideClockFields">
                    prop="locationName">
        <el-input v-model="form.locationName"
                  :disabled="operationType === 'view'"
                  placeholder="请输入地点名称" />
      </el-form-item>
      <!-- ä¸Šä¸‹ç­æ—¶é—´ -->
      <el-form-item label="上班时间"
                    prop="startAt"
                    v-show="!hideClockFields">
                    prop="startAt">
        <el-time-picker v-model="form.startAt"
                        format="HH:mm"
                        value-format="HH:mm"
@@ -106,8 +97,7 @@
                        :disabled="operationType === 'view'" />
      </el-form-item>
      <el-form-item label="下班时间"
                    prop="endAt"
                    v-show="!hideClockFields">
                    prop="endAt">
        <el-time-picker v-model="form.endAt"
                        format="HH:mm"
                        value-format="HH:mm"
@@ -120,9 +110,7 @@
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button type="primary"
                   @click="submitForm"
                   v-if="operationType !== 'view'">确定</el-button>
        <el-button type="primary" @click="submitForm" v-if="operationType !== 'view'">确定</el-button>
        <el-button @click="dialogVisible = false">取消</el-button>
      </span>
    </template>
@@ -169,21 +157,6 @@
  // èŽ·å–ç­æ¬¡å­—å…¸å€¼
  const { shifts_list } = useDict("shifts_list");
  const selectedShiftLabel = computed(() => {
    const item = shifts_list.value?.find(
      s => String(s.value) === String(form.shift)
    );
    return item?.label || "";
  });
  const hideClockFields = computed(() => {
    if (props.operationType === "view") return false;
    return (
      selectedShiftLabel.value.includes("假") ||
      selectedShiftLabel.value.includes("休")
    );
  });
  // è¡¨å•数据
  const formRef = ref();
  const form = reactive({
@@ -199,53 +172,39 @@
  });
  // è¡¨å•验证规则
  const rules = computed(() => {
    const base = {
      sysDeptId: [{ required: true, message: "请选择部门", trigger: "change" }],
      shift: [{ required: true, message: "请选择班次", trigger: "change" }],
    };
    if (hideClockFields.value) {
      return base;
    }
    return {
      ...base,
      locationName: [
        { required: true, message: "请输入地点名称", trigger: "blur" },
      ],
      longitude: [{ required: true, message: "请选择打卡位置", trigger: "blur" }],
      latitude: [{ required: true, message: "请选择打卡位置", trigger: "blur" }],
      radius: [{ required: true, message: "请输入打卡范围", trigger: "blur" }],
      startAt: [{ required: true, message: "请选择上班时间", trigger: "change" }],
      endAt: [
        { required: true, message: "请选择下班时间", trigger: "change" },
        {
          validator: (rule, value, callback) => {
            if (form.shift && ["夜班", "夜"].includes(form.shift)) {
              callback();
              return;
            }
            if (form.startAt && value) {
              const startParts = form.startAt.split(":");
              const endParts = value.split(":");
              const startTime =
                parseInt(startParts[0]) * 60 + parseInt(startParts[1]);
              const endTime = parseInt(endParts[0]) * 60 + parseInt(endParts[1]);
              if (endTime <= startTime) {
                callback(new Error("下班时间不能早于上班时间"));
              } else {
                callback();
              }
  const rules = {
    sysDeptId: [{ required: true, message: "请选择部门", trigger: "change" }],
    locationName: [
      { required: true, message: "请输入地点名称", trigger: "blur" },
    ],
    longitude: [{ required: true, message: "请选择打卡位置", trigger: "blur" }],
    latitude: [{ required: true, message: "请选择打卡位置", trigger: "blur" }],
    shift: [{ required: true, message: "请选择班次", trigger: "change" }],
    radius: [{ required: true, message: "请输入打卡范围", trigger: "blur" }],
    startAt: [{ required: true, message: "请选择上班时间", trigger: "change" }],
    endAt: [
      { required: true, message: "请选择下班时间", trigger: "change" },
      {
        validator: (rule, value, callback) => {
          if (form.startAt && value) {
            const startParts = form.startAt.split(":");
            const endParts = value.split(":");
            const startTime =
              parseInt(startParts[0]) * 60 + parseInt(startParts[1]);
            const endTime = parseInt(endParts[0]) * 60 + parseInt(endParts[1]);
            if (endTime <= startTime) {
              callback(new Error("下班时间不能早于上班时间"));
            } else {
              callback();
            }
          },
          trigger: "change",
          } else {
            callback();
          }
        },
      ],
    };
  });
        trigger: "change",
      },
    ],
  };
  // éƒ¨é—¨é€‰é¡¹
  const deptOptions = ref([]);
@@ -429,8 +388,8 @@
  watch(
    () => form.radius,
    newValue => {
      if (circle && newValue != null && newValue !== "") {
        circle.setRadius(Number(newValue));
      if (circle) {
        circle.setRadius(newValue);
      }
    }
  );
@@ -441,29 +400,6 @@
    () => {
      if (formRef.value && form.endAt) {
        formRef.value.validateField("endAt");
      }
    }
  );
  watch(
    () => hideClockFields.value,
    val => {
      if (!val) return;
      form.radius = null;
      form.longitude = "";
      form.latitude = "";
      form.locationName = "";
      form.startAt = "";
      form.endAt = "";
      if (formRef.value) {
        formRef.value.clearValidate([
          "radius",
          "longitude",
          "latitude",
          "locationName",
          "startAt",
          "endAt",
        ]);
      }
    }
  );
@@ -501,9 +437,7 @@
        // åˆå§‹åŒ–地图
        setTimeout(() => {
          if (!hideClockFields.value) {
            initMap();
          }
          initMap();
        }, 100);
      }
    }
@@ -574,4 +508,4 @@
  .mt8 {
    margin-top: 8px;
  }
</style>
</style>
src/views/personnelManagement/attendanceCheckin/checkinRules/index.vue
@@ -13,37 +13,30 @@
        </el-button>
      </div>
    </div>
    <el-form :model="searchForm"
    <!-- æŸ¥è¯¢æ¡ä»¶ -->
    <!-- <el-form :model="searchForm"
             :inline="true"
             class="search-form mb16">
      <el-form-item label="部门:"
                    prop="sysDeptId">
        <el-tree-select v-model="searchForm.sysDeptId"
                    prop="countId">
        <el-tree-select v-model="searchForm.countId"
                        :data="deptOptions"
                        :props="{ value: 'id', label: 'label', children: 'children' }"
                        value-key="id"
                        placeholder="请选择部门"
                        check-strictly
                        clearable
                        style="width: 200px" />
      </el-form-item>
      <el-form-item label="班次:"
                    prop="shift">
        <el-select v-model="searchForm.shift"
                   placeholder="请选择班次"
                   clearable
                   style="width: 200px">
          <el-option
              v-for="item in shifts_list"
              :key="item.value"
              :label="item.label"
              :value="item.value"
          />
        </el-select>
      <el-form-item label="地点:"
                    prop="locationName">
        <el-input v-model="searchForm.locationName"
                  placeholder="请输入地点名称"
                  clearable
                  style="width: 200px" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary"
                   @click="handleSearch">
                   @click="fetchData">
          <el-icon>
            <Search />
          </el-icon>
@@ -56,7 +49,7 @@
          é‡ç½®
        </el-button>
      </el-form-item>
    </el-form>
    </el-form> -->
    <!-- ç­æ¬¡åˆ—表 -->
    <el-card shadow="never"
             class="mb16">
@@ -81,39 +74,23 @@
          </template>
        </el-table-column>
        <el-table-column prop="locationName"
                         label="地点名称">
          <template #default="scope">
            {{ scope.row.locationName || "-" }}
          </template>
        </el-table-column>
                         label="地点名称" />
        <el-table-column prop="longitude"
                         label="经度">
          <template #default="scope">
            {{ scope.row.longitude ?? "-" }}
          </template>
        </el-table-column>
                         label="经度" />
        <el-table-column prop="latitude"
                         label="纬度">
          <template #default="scope">
            {{ scope.row.latitude ?? "-" }}
          </template>
        </el-table-column>
                         label="纬度" />
        <el-table-column prop="radius"
                         label="打卡范围(m)">
          <template #default="scope">
            {{ scope.row.radius ?? "-" }}
          </template>
        </el-table-column>
                         label="打卡范围(m)" />
        <el-table-column prop="startAt"
                         label="上班时间">
          <template #default="scope">
            {{ scope.row.startAt || "-" }}
            {{ scope.row.startAt }}
          </template>
        </el-table-column>
        <el-table-column prop="endAt"
                         label="下班时间">
          <template #default="scope">
            {{ scope.row.endAt || "-" }}
            {{ scope.row.endAt }}
          </template>
        </el-table-column>
        <el-table-column label="操作"
@@ -123,11 +100,9 @@
          <template #default="scope">
            <el-button type="primary"
                       link
                       :disabled="isRuleLocked(scope.row)"
                       @click="openForm('edit', scope.row)">编辑</el-button>
            <el-button type="danger"
                       link
                       :disabled="isRuleLocked(scope.row)"
                       @click="handleDelete(scope.row.id)">删除</el-button>
          </template>
        </el-table-column>
@@ -149,7 +124,7 @@
</template>
<script setup>
  import { ref, reactive, onMounted, getCurrentInstance } from "vue";
  import { ref, reactive, onMounted } from "vue";
  import { ElMessage, ElMessageBox } from "element-plus";
  import {
    Plus,
@@ -183,8 +158,8 @@
  // æŸ¥è¯¢è¡¨å•
  const searchForm = reactive({
    sysDeptId: "",
    shift: "",
    countId: "",
    locationName: "",
  });
  // éƒ¨é—¨é€‰é¡¹
@@ -212,10 +187,6 @@
    if (!value) return "";
    const shift = shifts_list.value.find(item => item.value === value);
    return shift ? shift.label : value;
  };
  const isRuleLocked = row => {
    return Boolean(row?.usageLocked || row?.canEdit === false || row?.canDelete === false);
  };
  // èŽ·å–éƒ¨é—¨åˆ—è¡¨
@@ -261,18 +232,12 @@
    tableLoading.value = true;
    getAttendanceRules({ ...page, ...searchForm })
      .then(res => {
        const records = Array.isArray(res?.data?.records) ? res.data.records : [];
        tableData.value = records.filter(r => String(r?.id) !== "999");
        tableData.value = res.data.records;
        page.total = res.data.total;
      })
      .finally(() => {
        tableLoading.value = false;
      });
  };
  const handleSearch = () => {
    page.current = 1;
    fetchData();
  };
  // åˆ†é¡µå˜æ›´
@@ -284,18 +249,13 @@
  // é‡ç½®æœç´¢
  const resetSearch = () => {
    searchForm.sysDeptId = "";
    searchForm.shift = "";
    page.current = 1;
    searchForm.countId = "";
    searchForm.locationName = "";
    fetchData();
  };
  // æ‰“开表单
  const openForm = (type, row = {}) => {
    if (type === "edit" && isRuleLocked(row)) {
      ElMessage.warning("该班次配置已被排班并产生打卡记录,不能编辑");
      return;
    }
    operationType.value = type;
    currentRow.value = row;
    dialogVisible.value = true;
@@ -303,11 +263,6 @@
  // åˆ é™¤ç­æ¬¡
  const handleDelete = id => {
    const row = tableData.value.find(item => String(item.id) === String(id));
    if (isRuleLocked(row)) {
      ElMessage.warning("存在已排班且已有打卡记录的班次配置,不能删除");
      return;
    }
    ElMessageBox.confirm("确定要删除这条班次吗?", "删除确认", {
      confirmButtonText: "确定",
      cancelButtonText: "取消",
src/views/personnelManagement/classsSheduling/index.vue
@@ -142,20 +142,19 @@
                     :key="'d' + i">
                  <el-dropdown trigger="click"
                               placement="bottom"
                               :disabled="isCellBlockedByLeaveDate(item, m)"
                               @command="(e) => handleCommand(e, item, m)"
                               @command="(e) => handleCommand(e, m)"
                               class="shift-dropdown">
                    <div class="shift-box"
                         :class="{
                      'shift-box-early': m.shift === '早班',
                      'shift-box-mid': m.shift === '中班',
                      'shift-box-night': m.shift === '夜班',
                      'shift-box-rest': !m.shift || m.shift === '休息',
                      'shift-box-rest': m.shift === '休息',
                      'shift-box-leave': m.shift === '请假',
                      'shift-box-other': m.shift === '夜11',
                      'shift-box-business': m.shift === '夜12',
                    }">
                      <span class="shift-text">{{ getShiftNameByValue(m.shift) || '休息' }}</span>
                      <span class="shift-text">{{ getShiftNameByValue(m.shift) || '—' }}</span>
                    </div>
                    <template #dropdown>
                      <el-dropdown-menu>
@@ -200,7 +199,7 @@
              </div> -->
              <div class="user-total">
                <span class="total-label">合计出勤:</span>
                <span class="total-value">{{ item.year.totalYearAttendance }}天</span>
                <span class="total-value">{{ item.work_time }}天</span>
              </div>
            </div>
          </div>
@@ -272,23 +271,6 @@
      <div class="search_thing">
        <div class="search_label"
             style="width: 90px">
          <span style="color: red; margin-right: 4px">*</span>部门:
        </div>
        <div class="search_input">
          <el-tree-select v-model="schedulingQuery.deptId"
                          :data="deptOptions"
                          :props="{ value: 'id', label: 'label', children: 'children' }"
                          value-key="id"
                          placeholder="请选择部门"
                          check-strictly
                          clearable
                          @change="onSchedulingDeptChange"
                          style="width: 100%" />
        </div>
      </div>
      <div class="search_thing">
        <div class="search_label"
             style="width: 90px">
          <span style="color: red; margin-right: 4px">*</span>人员名称:
        </div>
        <div class="search_input">
@@ -297,8 +279,7 @@
                     style="width: 100%"
                     multiple
                     clearable
                     collapse-tags
                     :disabled="!schedulingQuery.deptId">
                     collapse-tags>
            <el-option v-for="item in personList"
                       :key="item.id"
                       :label="item.staffName"
@@ -315,9 +296,8 @@
        <div class="search_input">
          <el-select v-model="schedulingQuery.shift"
                     placeholder="请选择"
                     style="width: 100%"
                     :disabled="!schedulingQuery.deptId">
            <el-option v-for="item in schedulingClassType"
                     style="width: 100%">
            <el-option v-for="item in classType"
                       :key="item.id"
                       :label="getShiftNameByValue(item.shift)"
                       :value="item.id">
@@ -338,14 +318,7 @@
</template>
<script setup>
  import {
    ref,
    reactive,
    computed,
    watch,
    onMounted,
    getCurrentInstance,
  } from "vue";
  import { ref, reactive, onMounted, getCurrentInstance } from "vue";
  import { useRouter } from "vue-router";
  import {
    page,
@@ -355,7 +328,6 @@
    update,
    staffOnJobListPage,
  } from "@/api/personnelManagement/class";
  import { findStaffLeaveListPage } from "@/api/personnelManagement/staffLeave.js";
  import { deptTreeSelect } from "@/api/system/user.js";
  import { getAttendanceRules } from "@/api/personnelManagement/attendanceRules.js";
  import { useDict } from "@/utils/dict";
@@ -404,8 +376,6 @@
  // äººå‘˜åˆ—表
  const personList = ref([]);
  const personListAll = ref([]);
  const leaveDateMap = ref({});
  // åŠ è½½çŠ¶æ€
  const loading = ref(false);
@@ -413,18 +383,8 @@
  // æŽ’班查询条件
  const schedulingQuery = reactive({
    week: "",
    deptId: "",
    userId: null,
    shift: "",
  });
  const schedulingClassType = computed(() => {
    if (!schedulingQuery.deptId) return classType.value || [];
    return (classType.value || []).filter(item => {
      if (["998", "999"].includes(String(item?.id))) return true;
      const itemDeptId = item.deptId ?? item.sysDeptId ?? item.dept_id;
      return String(itemDeptId) === String(schedulingQuery.deptId);
    });
  });
  // åˆ—表数据
@@ -633,10 +593,6 @@
      proxy.$modal.msgError("请选择周次");
      return;
    }
    if (!schedulingQuery.deptId) {
      proxy.$modal.msgError("请选择部门");
      return;
    }
    let time = schedulingQuery.week.getTime();
    // æ ¼å¼åŒ–日期为 YYYY-MM-DD æ ¼å¼
@@ -660,15 +616,6 @@
      proxy.$modal.msgError("请选择班次");
      return;
    }
    const blockedEmployees = (personList.value || []).filter(item => {
      const leaveDate = getEmployeeLeaveDate(item?.id);
      const weekEndDate = getSchedulingWeekEndDate();
      return leaveDate && weekEndDate && weekEndDate.getTime() > leaveDate.getTime();
    });
    if (blockedEmployees.length) {
      proxy.$modal.msgError("存在已超过离职日期的人员,不能继续排班");
      return;
    }
    loading.value = true;
    add({
      startWeek,
@@ -681,10 +628,8 @@
        proxy.$modal.msgSuccess("操作成功");
        schedulingVisible.value = false;
        schedulingQuery.week = "";
        schedulingQuery.deptId = "";
        schedulingQuery.userId = null;
        schedulingQuery.shift = "";
        personList.value = [];
        refresh();
      })
      .catch(err => {
@@ -738,20 +683,17 @@
        }
        proxy.$download.saveAs(blob, fileName + ".xlsx");
      })
      .catch(err => {})
      .catch(err => {
      })
      .finally(() => {
        downLoading.value = false;
      });
  };
  // å¤„理命令
  const handleCommand = (e, row, cell) => {
    if (isCellBlockedByLeaveDate(row, cell)) {
      proxy.$modal.msgError("该员工已超出离职日期,不能继续排班");
      return;
    }
  const handleCommand = (e, m) => {
    // if (e != m.shift) {
    update({
      id: cell.id,
      id: m.id,
      personalAttendanceLocationConfigId: e,
    }).then(res => {
      proxy.$modal.msgSuccess("操作成功");
@@ -767,18 +709,7 @@
  // æŸ¥è¯¢è§„则列表
  const fetchData = () => {
    getAttendanceRules({ current: -1, size: -1 }).then(res => {
      const records = Array.isArray(res?.data?.records) ? res.data.records : [];
      const appendList = [
        { id: 998, shift: "休息" },
        { id: 999, shift: "请假" },
      ];
      const exists = new Set(records.map(r => String(r?.id)));
      appendList.forEach(item => {
        if (!exists.has(String(item.id))) {
          records.push(item);
        }
      });
      classType.value = records;
      classType.value = res.data.records;
    });
  };
  // èŽ·å–ç”¨æˆ·
@@ -793,139 +724,8 @@
      staffState: 1,
    }).then(res => {
      let arr = res.data.records;
      personListAll.value = arr;
      updatePersonListByDept();
      personList.value = arr;
    });
  };
  const getLeaveDates = () => {
    findStaffLeaveListPage({
      current: -1,
      size: -1,
    }).then(res => {
      const records = Array.isArray(res?.data?.records) ? res.data.records : [];
      const map = {};
      records.forEach(item => {
        const staffId = item?.staffOnJobId ?? item?.staff_on_job_id;
        const leaveDate = item?.leaveDate ?? item?.leave_date;
        if (!staffId || !leaveDate) return;
        const key = String(staffId);
        const prev = map[key];
        if (!prev || String(leaveDate) > String(prev)) {
          map[key] = leaveDate;
        }
      });
      leaveDateMap.value = map;
      updatePersonListByDept();
      syncPersonListSelection();
    });
  };
  const findDeptNodeById = (deptId, deptList = deptOptions.value) => {
    const list = Array.isArray(deptList) ? deptList : [];
    for (const node of list) {
      if (String(node.id) === String(deptId)) return node;
      if (node.children && node.children.length) {
        const found = findDeptNodeById(deptId, node.children);
        if (found) return found;
      }
    }
    return null;
  };
  const collectDeptIds = node => {
    const ids = [];
    if (!node) return ids;
    ids.push(String(node.id));
    if (node.children && node.children.length) {
      node.children.forEach(child => {
        ids.push(...collectDeptIds(child));
      });
    }
    return ids;
  };
  const updatePersonListByDept = () => {
    if (!schedulingQuery.deptId) {
      personList.value = [];
      return;
    }
    const node = findDeptNodeById(schedulingQuery.deptId);
    const deptIds = new Set(collectDeptIds(node));
    personList.value = (personListAll.value || []).filter(item => {
      const itemDeptId = item.deptId ?? item.sysDeptId ?? item.dept_id;
      return deptIds.has(String(itemDeptId)) && !isEmployeeBlockedByLeaveDate(item);
    });
  };
  const parseDateOnly = value => {
    if (!value) return null;
    if (value instanceof Date) {
      const d = new Date(value);
      d.setHours(0, 0, 0, 0);
      return d;
    }
    const normalized = String(value).trim().slice(0, 10);
    if (!normalized) return null;
    const d = new Date(normalized.replace(/-/g, "/"));
    if (Number.isNaN(d.getTime())) return null;
    d.setHours(0, 0, 0, 0);
    return d;
  };
  const getSchedulingWeekEndDate = () => {
    if (!schedulingQuery.week) return null;
    const start = new Date(schedulingQuery.week);
    start.setHours(0, 0, 0, 0);
    return new Date(start.getTime() + 24 * 60 * 60 * 1000 * 5);
  };
  const getCellDate = cell => parseDateOnly(cell?.time);
  const getEmployeeLeaveDate = staffId => {
    const leaveDate = leaveDateMap.value[String(staffId)];
    return parseDateOnly(leaveDate);
  };
  const isEmployeeBlockedByLeaveDate = item => {
    const leaveDate = getEmployeeLeaveDate(item?.id);
    if (!leaveDate) return false;
    const weekEndDate = getSchedulingWeekEndDate();
    if (!weekEndDate) return false;
    return weekEndDate.getTime() > leaveDate.getTime();
  };
  const isCellBlockedByLeaveDate = (row, cell) => {
    const staffId = row?.userId ?? row?.user_id ?? row?.id;
    const leaveDate = getEmployeeLeaveDate(staffId);
    const cellDate = getCellDate(cell);
    if (!leaveDate || !cellDate) return false;
    return cellDate.getTime() > leaveDate.getTime();
  };
  const syncPersonListSelection = () => {
    if (!Array.isArray(schedulingQuery.userId) || !schedulingQuery.userId.length) return;
    const validIds = new Set((personList.value || []).map(item => String(item.id)));
    const nextIds = schedulingQuery.userId.filter(id => validIds.has(String(id)));
    if (nextIds.length !== schedulingQuery.userId.length) {
      schedulingQuery.userId = nextIds;
      proxy.$modal.msgWarning("已自动剔除超出离职日期的人员");
    }
  };
  const setDefaultShiftByDept = () => {
    if (!schedulingQuery.deptId) {
      schedulingQuery.shift = "";
      return;
    }
    const first = schedulingClassType.value?.[0];
    schedulingQuery.shift = first ? first.id : "";
  };
  const onSchedulingDeptChange = () => {
    schedulingQuery.userId = null;
    updatePersonListByDept();
    setDefaultShiftByDept();
  };
  // æ ¹æ®å­—典获取日期
@@ -949,7 +749,6 @@
  onMounted(() => {
    fetchData();
    getUsers();
    getLeaveDates();
    fetchDeptOptions();
    if (query.month) {
      init();
@@ -962,45 +761,6 @@
    }
    monthList.value.reverse();
  });
  watch(
    () => classType.value,
    () => {
      if (schedulingVisible.value && schedulingQuery.deptId) {
        setDefaultShiftByDept();
      }
    }
  );
  watch(
    () => schedulingQuery.week,
    () => {
      if (!schedulingVisible.value) return;
      updatePersonListByDept();
      syncPersonListSelection();
    }
  );
  watch(
    () => schedulingQuery.deptId,
    () => {
      if (!schedulingVisible.value) return;
      updatePersonListByDept();
      syncPersonListSelection();
    }
  );
  watch(
    () => schedulingVisible.value,
    val => {
      if (!val) return;
      schedulingQuery.week = "";
      schedulingQuery.deptId = "";
      schedulingQuery.userId = null;
      schedulingQuery.shift = "";
      personList.value = [];
    }
  );
</script>
<style scoped>
@@ -1213,7 +973,7 @@
  .user-stats {
    /* display: flex; */
    /* flex-wrap: wrap;
                                                                                                                                                                                                                                                                                                      gap: 10px; */
                                                                                                                                                                                                                                                                                        gap: 10px; */
    margin-bottom: 4px;
  }
src/views/personnelManagement/contractManagement/components/formDia.vue
@@ -1,93 +1,96 @@
<template>
  <div>
    <el-dialog v-model="dialogFormVisible"
               title="详情"
               width="70%"
               @close="closeDia">
      <PIMTable rowKey="id"
                :column="tableColumn"
                :tableData="tableData"
                :tableLoading="tableLoading"
                height="600"></PIMTable>
    <el-dialog
        v-model="dialogFormVisible"
        title="详情"
        width="70%"
        @close="closeDia"
    >
      <PIMTable
          rowKey="id"
          :column="tableColumn"
          :tableData="tableData"
          :tableLoading="tableLoading"
          height="600"
      ></PIMTable>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="closeDia">取消</el-button>
        </div>
      </template>
    </el-dialog>
    <FileList v-if="fileDialogVisible"
              v-model:visible="fileDialogVisible"
              :record-type="'staff_contract'"
              :record-id="recordId" />
    <Files ref="filesDia"></Files>
  </div>
</template>
<script setup>
  import { ref, defineAsyncComponent, getCurrentInstance } from "vue";
  import { findStaffContractListPage } from "@/api/personnelManagement/staffContract.js";
  const FileList = defineAsyncComponent(() =>
    import("@/components/Dialog/FileList.vue")
  );
  const { proxy } = getCurrentInstance();
  const emit = defineEmits(["close"]);
  const fileDialogVisible = ref(false);
  const recordId = ref(0);
  const dialogFormVisible = ref(false);
  const operationType = ref("");
  const tableColumn = ref([
    {
      label: "合同年限",
      prop: "contractTerm",
    },
    {
      label: "合同开始日期",
      prop: "contractStartTime",
    },
    {
      label: "合同结束日期",
      prop: "contractEndTime",
    },
    {
      dataType: "action",
      label: "操作",
      align: "center",
      fixed: "right",
      width: 120,
      operation: [
        {
          name: "附件",
          type: "text",
          clickFun: row => {
            recordId.value = row.id;
            fileDialogVisible.value = true;
          },
import {ref} from "vue";
import {findStaffContractListPage} from "@/api/personnelManagement/staffContract.js";
const Files = defineAsyncComponent(() => import( "@/views/personnelManagement/contractManagement/filesDia.vue"));
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
const filesDia = ref()
const dialogFormVisible = ref(false);
const operationType = ref('')
const tableColumn = ref([
  {
    label: "合同年限",
    prop: "contractTerm",
  },
  {
    label: "合同开始日期",
    prop: "contractStartTime",
  },
  {
    label: "合同结束日期",
    prop: "contractEndTime",
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: 'right',
    width: 120,
    operation: [
      {
        name: "上传附件",
        type: "text",
        clickFun: (row) => {
          filesDia.value.openDialog( row,'合同')
        },
      ],
    },
  ]);
  const tableData = ref([]);
  const tableLoading = ref(false);
      }
    ],
  },
]);
const tableData = ref([]);
const tableLoading = ref(false);
  // æ‰“开弹框
  const openDialog = (type, row) => {
    operationType.value = type;
    dialogFormVisible.value = true;
    if (operationType.value === "edit") {
      findStaffContractListPage({ staffOnJobId: row.id }).then(res => {
        tableData.value = res.data.records;
      });
    }
  };
// æ‰“开弹框
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  if (operationType.value === 'edit') {
    findStaffContractListPage({staffOnJobId: row.id}).then(res => {
      tableData.value = res.data.records
    })
  }
}
  // å…³é—­å¼¹æ¡†
  const closeDia = () => {
    dialogFormVisible.value = false;
    emit("close");
  };
  defineExpose({
    openDialog,
  });
const openUploadFile = (row) => {
  filesDia.value.open = true
  filesDia.value.row = row
}
// å…³é—­å¼¹æ¡†
const closeDia = () => {
  dialogFormVisible.value = false;
  emit('close')
};
defineExpose({
  openDialog,
});
</script>
<style scoped>
</style>
src/views/personnelManagement/contractManagement/index.vue
@@ -3,64 +3,52 @@
    <div class="search_form mb20">
      <div>
        <span class="search_title">姓名:</span>
        <el-input v-model="searchForm.staffName"
                  style="width: 240px"
                  placeholder="请输入姓名搜索"
                  @change="handleQuery"
                  clearable
                  :prefix-icon="Search" />
        <span style="margin-left: 10px"
              class="search_title">合同结束日期:</span>
        <el-date-picker v-model="searchForm.entryDate"
                        value-format="YYYY-MM-DD"
                        format="YYYY-MM-DD"
                        type="daterange"
                        placeholder="请选择"
                        clearable
                        @change="changeDaterange" />
        <el-button type="primary"
                   @click="handleQuery"
                   style="margin-left: 10px">搜索</el-button>
        <el-input v-model="searchForm.staffName" style="width: 240px" placeholder="请输入姓名搜索" @change="handleQuery"
          clearable :prefix-icon="Search" />
        <span style="margin-left: 10px" class="search_title">合同结束日期:</span>
        <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
          placeholder="请选择" clearable @change="changeDaterange" />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
      </div>
      <div>
        <!--        <el-button type="primary" @click="openForm('add')">新增入职</el-button>-->
        <!--        <el-button type="info" @click="handleImport">导入</el-button>-->
<!--        <el-button type="info" @click="handleImport">导入</el-button>-->
        <el-button @click="handleOut">导出</el-button>
        <!--        <el-button type="danger" plain @click="handleDelete">删除</el-button>-->
      </div>
    </div>
    <div class="table_list">
      <PIMTable rowKey="id"
                :column="tableColumn"
                :tableData="tableData"
                :page="page"
                :isSelection="true"
                @selection-change="handleSelectionChange"
                :tableLoading="tableLoading"
                @pagination="pagination"
                :total="page.total"></PIMTable>
      <PIMTable rowKey="id" :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true"
        @selection-change="handleSelectionChange" :tableLoading="tableLoading" @pagination="pagination"
        :total="page.total"></PIMTable>
    </div>
    <form-dia ref="formDia"
              @close="handleQuery"></form-dia>
    <renew-contract v-if="isShowRenewContractModal"
                    v-model:visible="isShowRenewContractModal"
                    :id="id"
                    @completed="handleQuery" />
    <form-dia ref="formDia" @close="handleQuery"></form-dia>
    <renew-contract
        v-if="isShowRenewContractModal"
        v-model:visible="isShowRenewContractModal"
        :id="id"
        @completed="handleQuery"
    />
    <!-- åˆåŒå¯¼å…¥å¯¹è¯æ¡† -->
    <el-dialog :title="upload.title"
               v-model="upload.open"
               width="400px"
               append-to-body>
      <el-upload ref="uploadRef"
                 :limit="1"
                 accept=".xlsx, .xls"
                 :headers="upload.headers"
                 :action="upload.url + '?updateSupport=' + upload.updateSupport"
                 :disabled="upload.isUploading"
                 :on-progress="handleFileUploadProgress"
                 :on-success="handleFileSuccess"
                 :auto-upload="false"
                 drag>
    <el-dialog
      :title="upload.title"
      v-model="upload.open"
      width="400px"
      append-to-body
    >
      <el-upload
        ref="uploadRef"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <el-icon class="el-icon--upload"><upload-filled /></el-icon>
        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
        <template #tip>
@@ -78,8 +66,7 @@
      </el-upload>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary"
                     @click="submitFileForm">ç¡® å®š</el-button>
          <el-button type="primary" @click="submitFileForm">ç¡® å®š</el-button>
          <el-button @click="upload.open = false">取 æ¶ˆ</el-button>
        </div>
      </template>
@@ -89,259 +76,258 @@
</template>
<script setup>
  import { Search } from "@element-plus/icons-vue";
  import { onMounted, ref, defineAsyncComponent } from "vue";
  import FormDia from "@/views/personnelManagement/contractManagement/components/formDia.vue";
  const RenewContract = defineAsyncComponent(() =>
    import(
      "@/views/personnelManagement/employeeRecord/components/RenewContract.vue"
    )
  );
  import { ElMessageBox } from "element-plus";
  import { staffOnJobListPage } from "@/api/personnelManagement/staffOnJob.js";
  import dayjs from "dayjs";
  import { getToken } from "@/utils/auth.js";
  import FilesDia from "./filesDia.vue";
  const data = reactive({
    searchForm: {
      staffName: "",
      entryDate: null, // å½•入日期
      entryDateStart: undefined,
      entryDateEnd: undefined,
import { Search } from "@element-plus/icons-vue";
import { onMounted, ref, defineAsyncComponent } from "vue";
import FormDia from "@/views/personnelManagement/contractManagement/components/formDia.vue";
const RenewContract = defineAsyncComponent(() => import("@/views/personnelManagement/employeeRecord/components/RenewContract.vue"));
import { ElMessageBox } from "element-plus";
import { staffOnJobListPage } from "@/api/personnelManagement/staffOnJob.js";
import dayjs from "dayjs";
import { getToken } from "@/utils/auth.js";
import FilesDia from "./filesDia.vue";
const data = reactive({
  searchForm: {
    staffName: "",
    entryDate: null, // å½•入日期
    entryDateStart: undefined,
    entryDateEnd: undefined,
  },
});
const { searchForm } = toRefs(data);
const tableColumn = ref([
  {
    label: "状态",
    prop: "staffState",
    dataType: "tag",
    formatData: (params) => {
      if (params == 0) {
        return "离职";
      } else if (params == 1) {
        return "在职";
      } else {
        return null;
      }
    },
  });
  const { searchForm } = toRefs(data);
  const tableColumn = ref([
    {
      label: "状态",
      prop: "staffState",
      dataType: "tag",
      formatData: params => {
        if (params == 0) {
          return "离职";
        } else if (params == 1) {
          return "在职";
        } else {
          return null;
        }
      },
      formatType: params => {
        if (params == 0) {
          return "danger";
        } else if (params == 1) {
          return "primary";
        } else {
          return null;
        }
      },
    formatType: (params) => {
      if (params == 0) {
        return "danger";
      } else if (params == 1) {
        return "primary";
      } else {
        return null;
      }
    },
    {
      label: "员工编号",
      prop: "staffNo",
    },
    {
      label: "姓名",
      prop: "staffName",
    },
    {
      label: "性别",
      prop: "sex",
    },
    {
      label: "岗位",
      prop: "postName",
    },
    {
      label: "第一学历",
      prop: "firstStudy",
    },
    {
      label: "专业",
      prop: "profession",
      width: 100,
    },
    {
      label: "年龄",
      prop: "age",
    },
    {
      label: "联系电话",
      prop: "phone",
      width: 150,
    },
    {
      label: "紧急联系人",
      prop: "emergencyContact",
      width: 120,
    },
    {
      label: "紧急联系人电话",
      prop: "emergencyContactPhone",
      width: 150,
    },
    // {
    //   label: "合同年限",
    //   prop: "contractTerm",
    // },
    // {
    //   label: "合同开始日期",
    //   prop: "contractStartTime",
    //   width: 120
    // },
    {
      label: "合同结束日期",
      prop: "contractExpireTime",
      width: 120,
    },
    {
      dataType: "action",
      label: "操作",
      align: "center",
      fixed: "right",
      width: 160,
      operation: [
        {
          name: "详情",
          type: "text",
          clickFun: row => {
            openForm("edit", row);
          },
  },
  {
    label: "员工编号",
    prop: "staffNo",
  },
  {
    label: "姓名",
    prop: "staffName",
  },
  {
    label: "性别",
    prop: "sex",
  },
  {
    label: "户籍住址",
    prop: "nativePlace",
  },
  {
    label: "岗位",
    prop: "postJob",
  },
  {
    label: "现住址",
    prop: "adress",
    width: 200
  },
  {
    label: "第一学历",
    prop: "firstStudy",
  },
  {
    label: "专业",
    prop: "profession",
    width: 100
  },
  {
    label: "年龄",
    prop: "age",
  },
  {
    label: "联系电话",
    prop: "phone",
    width: 150
  },
  {
    label: "紧急联系人",
    prop: "emergencyContact",
    width: 120
  },
  {
    label: "紧急联系人电话",
    prop: "emergencyContactPhone",
    width: 150
  },
  // {
  //   label: "合同年限",
  //   prop: "contractTerm",
  // },
  // {
  //   label: "合同开始日期",
  //   prop: "contractStartTime",
  //   width: 120
  // },
  {
    label: "合同结束日期",
    prop: "contractExpireTime",
    width: 120
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: 'right',
    width: 160,
    operation: [
      {
        name: "详情",
        type: "text",
        clickFun: (row) => {
          openForm("edit", row);
        },
        {
          name: "续签合同",
          type: "text",
          showHide: row => row.staffState === 1,
          clickFun: row => {
            isShowRenewContractModal.value = true;
            id.value = row.id;
          },
      },
      {
        name: "续签合同",
        type: "text",
        showHide: row => row.staffState === 1,
        clickFun: (row) => {
          isShowRenewContractModal.value = true;
          id.value = row.id;
        },
      ],
    },
  ]);
  const filesDia = ref();
  const isShowRenewContractModal = ref(false);
  const id = ref(0);
  const tableData = ref([]);
  const selectedRows = ref([]);
  const tableLoading = ref(false);
  const page = reactive({
    current: 1,
    size: 100,
    total: 0,
  });
  const formDia = ref();
  const { proxy } = getCurrentInstance();
      }
    ],
  },
]);
const filesDia = ref()
const isShowRenewContractModal = ref(false);
const id = ref(0);
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
const page = reactive({
  current: 1,
  size: 100,
  total: 0,
});
const formDia = ref()
const { proxy } = getCurrentInstance()
  const changeDaterange = value => {
    searchForm.value.entryDateStart = undefined;
    searchForm.value.entryDateEnd = undefined;
    if (value) {
      searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
      searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
    }
    getList();
  };
  // æ‰“开附件弹框
  const openFilesFormDia = row => {
    console.log(row);
    nextTick(() => {
      filesDia.value?.openDialog(row, "合同");
    });
  };
  // æŸ¥è¯¢åˆ—表
  /** æœç´¢æŒ‰é’®æ“ä½œ */
  const handleQuery = () => {
    page.current = 1;
    getList();
  };
  const pagination = obj => {
    page.current = obj.page;
    page.size = obj.limit;
    getList();
  };
  const getList = () => {
    tableLoading.value = true;
    const params = { ...searchForm.value, ...page };
    params.entryDate = undefined;
    params.staffState = 1;
    staffOnJobListPage(params)
      .then(res => {
        tableLoading.value = false;
        tableData.value = res.data.records;
        page.total = res.data.total;
      })
      .catch(err => {
        tableLoading.value = false;
      });
  };
  // è¡¨æ ¼é€‰æ‹©æ•°æ®
  const handleSelectionChange = selection => {
    selectedRows.value = selection;
  };
const changeDaterange = (value) => {
  searchForm.value.entryDateStart = undefined;
  searchForm.value.entryDateEnd = undefined;
  if (value) {
    searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
    searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
  }
  getList();
};
// æ‰“开附件弹框
const openFilesFormDia = (row) => {
  console.log(row)
  nextTick(() => {
    filesDia.value?.openDialog( row,'合同')
  })
};
// æŸ¥è¯¢åˆ—表
/** æœç´¢æŒ‰é’®æ“ä½œ */
const handleQuery = () => {
  page.current = 1;
  getList();
};
const pagination = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
const getList = () => {
  tableLoading.value = true;
  const params = { ...searchForm.value, ...page };
  params.entryDate = undefined
  params.staffState = 1
  staffOnJobListPage(params).then(res => {
    tableLoading.value = false;
    tableData.value = res.data.records
    page.total = res.data.total;
  }).catch(err => {
    tableLoading.value = false;
  })
};
// è¡¨æ ¼é€‰æ‹©æ•°æ®
const handleSelectionChange = (selection) => {
  selectedRows.value = selection;
};
  // æ‰“开弹框
  const openForm = (type, row) => {
    nextTick(() => {
      formDia.value?.openDialog(type, row);
    });
  };
  // å¯¼å‡º
  const handleOut = () => {
    ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
// æ‰“开弹框
const openForm = (type, row) => {
  nextTick(() => {
    formDia.value?.openDialog(type, row)
  })
};
// å¯¼å‡º
const handleOut = () => {
  ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      proxy.download("/staff/staffOnJob/export", {staffState: 1}, "合同管理.xlsx");
    })
      .then(() => {
        proxy.download(
          "/staff/staffOnJob/export",
          { staffState: 1 },
          "合同管理.xlsx"
        );
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
  };
  const upload = reactive({
    // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚(合同导入)
    open: false,
    // å¼¹å‡ºå±‚标题(合同导入)
    title: "",
    // æ˜¯å¦ç¦ç”¨ä¸Šä¼ 
    isUploading: false,
    // æ˜¯å¦æ›´æ–°å·²ç»å­˜åœ¨çš„用户数据
    updateSupport: 1,
    // è®¾ç½®ä¸Šä¼ çš„请求头部
    headers: { Authorization: "Bearer " + getToken() },
    // ä¸Šä¼ çš„地址
    url: import.meta.env.VITE_APP_BASE_API + "/staff/staffOnJob/import",
  });
  /** å¯¼å…¥æŒ‰é’®æ“ä½œ */
  function handleImport() {
    upload.title = "合同导入";
    upload.open = true;
  }
  /** æäº¤ä¸Šä¼ æ–‡ä»¶ */
  function submitFileForm() {
    console.log(upload.url + "?updateSupport=" + upload.updateSupport);
    proxy.$refs["uploadRef"].submit();
  }
  /**文件上传中处理 */
  const handleFileUploadProgress = (event, file, fileList) => {
    upload.isUploading = true;
  };
  /** æ–‡ä»¶ä¸Šä¼ æˆåŠŸå¤„ç† */
  const handleFileSuccess = (response, file, fileList) => {
    upload.open = false;
    upload.isUploading = false;
    proxy.$refs["uploadRef"].handleRemove(file);
    getList();
  };
  onMounted(() => {
    getList();
  });
    .catch(() => {
      proxy.$modal.msg("已取消");
    });
};
const upload = reactive({
  // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚(合同导入)
  open: false,
  // å¼¹å‡ºå±‚标题(合同导入)
  title: "",
  // æ˜¯å¦ç¦ç”¨ä¸Šä¼ 
  isUploading: false,
  // æ˜¯å¦æ›´æ–°å·²ç»å­˜åœ¨çš„用户数据
  updateSupport: 1,
  // è®¾ç½®ä¸Šä¼ çš„请求头部
  headers: { Authorization: "Bearer " + getToken() },
  // ä¸Šä¼ çš„地址
  url: import.meta.env.VITE_APP_BASE_API + "/staff/staffOnJob/import",
});
/** å¯¼å…¥æŒ‰é’®æ“ä½œ */
function handleImport() {
  upload.title = "合同导入";
  upload.open = true;
}
/** æäº¤ä¸Šä¼ æ–‡ä»¶ */
function submitFileForm() {
  console.log(upload.url + '?updateSupport=' + upload.updateSupport)
  proxy.$refs["uploadRef"].submit();
}
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
  upload.isUploading = true;
};
/** æ–‡ä»¶ä¸Šä¼ æˆåŠŸå¤„ç† */
const handleFileSuccess = (response, file, fileList) => {
  upload.open = false;
  upload.isUploading = false;
  proxy.$refs["uploadRef"].handleRemove(file);
  getList();
};
onMounted(() => {
  getList();
});
</script>
<style scoped></style>
src/views/personnelManagement/dimission/components/formDia.vue
@@ -1,31 +1,29 @@
<template>
  <div>
    <el-dialog v-model="dialogFormVisible"
               :title="operationType === 'add' ? '新增离职' : '编辑离职'"
               width="70%"
               @close="closeDia">
    <el-dialog
        v-model="dialogFormVisible"
        :title="operationType === 'add' ? '新增离职' : '编辑离职'"
        width="70%"
        @close="closeDia"
    >
      <!-- å‘˜å·¥ä¿¡æ¯å±•示区域 -->
      <div class="info-section">
        <div class="info-title">员工信息</div>
        <el-form :model="form"
                 label-width="200px"
                 label-position="left"
                 :rules="rules"
                 ref="formRef"
                 style="margin-top: 20px">
        <el-form :model="form" label-width="200px" label-position="left" :rules="rules" ref="formRef" style="margin-top: 20px">
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="姓名:"
                            prop="staffOnJobId">
              <el-form-item label="姓名:" prop="staffOnJobId">
                <el-select v-model="form.staffOnJobId"
                           placeholder="请选择人员"
                           style="width: 100%"
                           :disabled="operationType === 'edit'"
                           @change="handleSelect">
                  <el-option v-for="item in personList"
                             :key="item.id"
                             :label="item.staffName"
                             :value="item.id" />
                  <el-option
                      v-for="item in personList"
                      :key="item.id"
                      :label="item.staffName"
                      :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
@@ -41,11 +39,21 @@
                {{ currentStaffRecord.sex || '-' }}
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="户籍住址:">
                {{ currentStaffRecord.nativePlace || '-' }}
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="岗位:">
                {{ currentStaffRecord.postName || '-' }}
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="现住址:">
                {{ currentStaffRecord.adress || '-' }}
              </el-form-item>
            </el-col>
          </el-row>
@@ -89,74 +97,74 @@
          </el-row>
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="离职日期:"
                            prop="leaveDate">
                <el-date-picker v-model="form.leaveDate"
                                type="date"
                                :disabled="operationType === 'edit'"
                                :disabled-date="disabledFutureDate"
                                placeholder="请选择离职日期"
                                value-format="YYYY-MM-DD"
                                format="YYYY-MM-DD"
                                style="width: 100%" />
              <el-form-item label="离职日期:" prop="leaveDate">
                <el-date-picker
                    v-model="form.leaveDate"
                    type="date"
                    :disabled="operationType === 'edit'"
                    :disabled-date="disabledFutureDate"
                    placeholder="请选择离职日期"
                    value-format="YYYY-MM-DD"
                    format="YYYY-MM-DD"
                    style="width: 100%"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="离职原因:"
                            prop="reason">
                <el-select v-model="form.reason"
                           placeholder="请选择离职原因"
                           style="width: 100%"
                           @change="handleSelectDimissionReason">
                  <el-option v-for="(item, index) in dimissionReasonOptions"
                             :key="index"
                             :label="item.label"
                             :value="item.value" />
              <el-form-item label="离职原因:" prop="reason">
                <el-select v-model="form.reason" placeholder="请选择离职原因" style="width: 100%" @change="handleSelectDimissionReason">
                  <el-option
                      v-for="(item, index) in dimissionReasonOptions"
                      :key="index"
                      :label="item.label"
                      :value="item.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="30">
            <el-col :span="12">
              <el-form-item label="备注:"
                            prop="remark"
                            v-if="form.reason === 'other'">
                <el-input v-model="form.remark"
                          type="textarea"
                          :rows="3"
                          placeholder="备注"
                          maxlength="500"
                          show-word-limit />
              <el-form-item label="备注:" prop="remark" v-if="form.reason === 'other'">
                <el-input
                    v-model="form.remark"
                    type="textarea"
                    :rows="3"
                    placeholder="备注"
                    maxlength="500"
                    show-word-limit
                />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <!--        <el-row :gutter="30">-->
        <!--          <el-col :span="12">-->
        <!--            <div class="info-item">-->
        <!--              <span class="info-label">离职原因:</span>-->
        <!--              <el-select v-model="form.reason" placeholder="请选择人员" style="width: 100%" @change="handleSelect">-->
        <!--                <el-option-->
        <!--                    v-for="(item, index) in dimissionReasonOptions"-->
        <!--                    :key="index"-->
        <!--                    :label="item.label"-->
        <!--                    :value="item.value"-->
        <!--                />-->
        <!--              </el-select>-->
        <!--            </div>-->
        <!--          </el-col>-->
        <!--          <el-col :span="12">-->
        <!--            <div class="info-item">-->
        <!--              <span class="info-label">员工编号:</span>-->
        <!--              <span class="info-value">{{ form.staffNo || '-' }}</span>-->
        <!--            </div>-->
        <!--          </el-col>-->
        <!--        </el-row>-->
<!--        <el-row :gutter="30">-->
<!--          <el-col :span="12">-->
<!--            <div class="info-item">-->
<!--              <span class="info-label">离职原因:</span>-->
<!--              <el-select v-model="form.reason" placeholder="请选择人员" style="width: 100%" @change="handleSelect">-->
<!--                <el-option-->
<!--                    v-for="(item, index) in dimissionReasonOptions"-->
<!--                    :key="index"-->
<!--                    :label="item.label"-->
<!--                    :value="item.value"-->
<!--                />-->
<!--              </el-select>-->
<!--            </div>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <div class="info-item">-->
<!--              <span class="info-label">员工编号:</span>-->
<!--              <span class="info-value">{{ form.staffNo || '-' }}</span>-->
<!--            </div>-->
<!--          </el-col>-->
<!--        </el-row>-->
      </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary"
                     @click="submitForm">确认</el-button>
          <el-button type="primary" @click="submitForm">确认</el-button>
          <el-button @click="closeDia">取消</el-button>
        </div>
      </template>
@@ -165,180 +173,175 @@
</template>
<script setup>
  import { ref, reactive, toRefs, getCurrentInstance } from "vue";
  import { staffOnJobListPage } from "@/api/personnelManagement/staffOnJob.js";
  import {
    createStaffLeave,
    updateStaffLeave,
  } from "@/api/personnelManagement/staffLeave.js";
  const { proxy } = getCurrentInstance();
  const emit = defineEmits(["close"]);
import {ref, reactive, toRefs, getCurrentInstance} from "vue";
import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
import {createStaffLeave, updateStaffLeave} from "@/api/personnelManagement/staffLeave.js";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
  const dialogFormVisible = ref(false);
  const operationType = ref("");
  const getTodayDate = () => {
    const now = new Date();
    const year = now.getFullYear();
    const month = `${now.getMonth() + 1}`.padStart(2, "0");
    const day = `${now.getDate()}`.padStart(2, "0");
    return `${year}-${month}-${day}`;
  };
const dialogFormVisible = ref(false);
const operationType = ref('')
const getTodayDate = () => {
  const now = new Date();
  const year = now.getFullYear();
  const month = `${now.getMonth() + 1}`.padStart(2, '0');
  const day = `${now.getDate()}`.padStart(2, '0');
  return `${year}-${month}-${day}`;
};
  const disabledFutureDate = time => {
    const todayEnd = new Date();
    todayEnd.setHours(23, 59, 59, 999);
    return time.getTime() > todayEnd.getTime();
  };
  const data = reactive({
    form: {
      staffOnJobId: undefined,
      leaveDate: "",
      reason: "",
      remark: "",
    },
    rules: {
      staffName: [{ required: true, message: "请选择人员" }],
      leaveDate: [
        { required: true, message: "请选择离职日期", trigger: "change" },
      ],
      reason: [{ required: true, message: "请选择离职原因" }],
    },
    dimissionReasonOptions: [
      { label: "薪资待遇", value: "salary" },
      { label: "职业发展", value: "career_development" },
      { label: "工作环境", value: "work_environment" },
      { label: "个人原因", value: "personal_reason" },
      { label: "其他", value: "other" },
    ],
    currentStaffRecord: {},
  });
  const { form, rules, dimissionReasonOptions, currentStaffRecord } =
    toRefs(data);
const disabledFutureDate = (time) => {
  const todayEnd = new Date();
  todayEnd.setHours(23, 59, 59, 999);
  return time.getTime() > todayEnd.getTime();
};
const data = reactive({
  form: {
    staffOnJobId: undefined,
    leaveDate: "",
    reason: "",
    remark: "",
  },
  rules: {
    staffName: [{ required: true, message: "请选择人员" }],
    leaveDate: [{ required: true, message: "请选择离职日期", trigger: "change" }],
    reason: [{ required: true, message: "请选择离职原因"}],
  },
  dimissionReasonOptions: [
      {label: '薪资待遇', value: 'salary'},
      {label: '职业发展', value: 'career_development'},
      {label: '工作环境', value: 'work_environment'},
      {label: '个人原因', value: 'personal_reason'},
      {label: '其他', value: 'other'},
  ],
  currentStaffRecord: {},
});
const { form, rules, dimissionReasonOptions, currentStaffRecord } = toRefs(data);
  // æ‰“开弹框
  const openDialog = (type, row) => {
    operationType.value = type;
    dialogFormVisible.value = true;
    if (operationType.value === "edit") {
      currentStaffRecord.value = row;
      form.value.staffOnJobId = row.staffOnJobId;
      form.value.leaveDate = row.leaveDate;
      form.value.reason = row.reason;
      form.value.remark = row.remark;
      personList.value = [
        {
          staffName: row.staffName,
          id: row.staffOnJobId,
        },
      ];
    } else {
      form.value.leaveDate = getTodayDate();
      getList();
    }
  };
  const handleSelectDimissionReason = val => {
    if (val === "other") {
      form.value.remark = "";
    }
  };
  // æäº¤äº§å“è¡¨å•
  const submitForm = () => {
    form.value.staffState = 0;
    if (form.value.reason !== "other") {
      form.value.remark = "";
    }
    proxy.$refs["formRef"].validate(valid => {
      if (valid) {
        if (operationType.value === "add") {
          createStaffLeave(form.value).then(res => {
            proxy.$modal.msgSuccess("提交成功");
            closeDia();
          });
        } else {
          updateStaffLeave(currentStaffRecord.value.id, form.value).then(res => {
            proxy.$modal.msgSuccess("提交成功");
            closeDia();
          });
        }
// æ‰“开弹框
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  if (operationType.value === 'edit') {
    currentStaffRecord.value = row
    form.value.staffOnJobId = row.staffOnJobId
    form.value.leaveDate = row.leaveDate
    form.value.reason = row.reason
    form.value.remark = row.remark
    personList.value = [
      {
        staffName: row.staffName,
        id: row.staffOnJobId,
      }
    });
  };
  // å…³é—­å¼¹æ¡†
  const closeDia = () => {
    // è¡¨å•已注释,手动重置表单数据
    form.value = {
      staffOnJobId: undefined,
      leaveDate: "",
      reason: "",
      remark: "",
    };
    dialogFormVisible.value = false;
    emit("close");
  };
    ]
  } else {
    form.value.leaveDate = getTodayDate()
    getList()
  }
}
  const personList = ref([]);
  /**
   * èŽ·å–å½“å‰åœ¨èŒäººå‘˜åˆ—è¡¨
   */
  const getList = () => {
    staffOnJobListPage({
      current: -1,
      size: -1,
      staffState: 1,
    }).then(res => {
      personList.value = res.data.records || [];
    });
  };
  const handleSelect = val => {
    let obj = personList.value.find(item => item.id === val);
    currentStaffRecord.value = {};
    if (obj) {
      // ä¿ç•™ç¦»èŒæ—¥æœŸå’Œç¦»èŒåŽŸå› ï¼Œåªæ›´æ–°å‘˜å·¥ä¿¡æ¯
      currentStaffRecord.value = obj;
const handleSelectDimissionReason = (val) => {
  if (val === 'other') {
    form.value.remark = ''
  }
}
// æäº¤äº§å“è¡¨å•
const submitForm = () => {
  form.value.staffState = 0
  if (form.value.reason !== 'other') {
    form.value.remark = ''
  }
  proxy.$refs["formRef"].validate(valid => {
    if (valid) {
      if (operationType.value === "add") {
        createStaffLeave(form.value).then(res => {
          proxy.$modal.msgSuccess("提交成功");
          closeDia();
        })
      } else {
        updateStaffLeave(currentStaffRecord.value.id, form.value).then(res => {
          proxy.$modal.msgSuccess("提交成功");
          closeDia();
        })
      }
    }
  })
}
// å…³é—­å¼¹æ¡†
const closeDia = () => {
  // è¡¨å•已注释,手动重置表单数据
  form.value = {
    staffOnJobId: undefined,
    leaveDate: "",
    reason: "",
    remark: "",
  };
  defineExpose({
    openDialog,
  });
  dialogFormVisible.value = false;
  emit('close')
};
const personList = ref([]);
/**
 * èŽ·å–å½“å‰åœ¨èŒäººå‘˜åˆ—è¡¨
 */
const getList = () => {
  staffOnJobListPage({
    current: -1,
    size: -1,
        staffState: 1
  }).then(res => {
    personList.value = res.data.records || []
  })
};
const handleSelect = (val) => {
  let obj = personList.value.find(item => item.id === val)
  currentStaffRecord.value = {}
  if (obj) {
    // ä¿ç•™ç¦»èŒæ—¥æœŸå’Œç¦»èŒåŽŸå› ï¼Œåªæ›´æ–°å‘˜å·¥ä¿¡æ¯
    currentStaffRecord.value = obj
  }
}
defineExpose({
  openDialog,
});
</script>
<style scoped>
  .info-section {
    background: #f5f7fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
  }
.info-section {
  background: #f5f7fa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}
  .info-title {
    font-size: 16px;
    font-weight: 600;
    color: #303133;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e4e7ed;
  }
.info-title {
  font-size: 16px;
  font-weight: 600;
  color: #303133;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e4e7ed;
}
  .info-item {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    min-height: 32px;
  }
.info-item {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  min-height: 32px;
}
  .info-label {
    min-width: 140px;
    color: #606266;
    font-size: 14px;
    font-weight: 500;
  }
.info-label {
  min-width: 140px;
  color: #606266;
  font-size: 14px;
  font-weight: 500;
}
  .info-value {
    flex: 1;
    color: #303133;
    font-size: 14px;
  }
.info-value {
  flex: 1;
  color: #303133;
  font-size: 14px;
}
</style>
src/views/personnelManagement/dimission/index.vue
@@ -3,209 +3,216 @@
    <div class="search_form mb20">
      <div>
        <span class="search_title">姓名:</span>
        <el-input v-model="searchForm.staffName"
                  style="width: 240px"
                  placeholder="请输入姓名搜索"
                  @change="handleQuery"
                  clearable
                  :prefix-icon="Search" />
        <el-button type="primary"
                   @click="handleQuery"
                   style="margin-left: 10px">搜索</el-button>
        <el-input
            v-model="searchForm.staffName"
            style="width: 240px"
            placeholder="请输入姓名搜索"
            @change="handleQuery"
            clearable
            :prefix-icon="Search"
        />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
        >搜索</el-button
        >
      </div>
      <div>
        <el-button type="primary"
                   @click="openForm('add')">新增离职</el-button>
        <el-button type="primary" @click="openForm('add')">新增离职</el-button>
        <el-button @click="handleOut">导出</el-button>
        <!-- <el-button type="danger" plain @click="handleDelete">删除</el-button> -->
      </div>
    </div>
    <div class="table_list">
      <PIMTable rowKey="id"
                :column="tableColumn"
                :tableData="tableData"
                :page="page"
                :isSelection="true"
                @selection-change="handleSelectionChange"
                :tableLoading="tableLoading"
                @pagination="pagination"
                :total="page.total"></PIMTable>
      <PIMTable
          rowKey="id"
          :column="tableColumn"
          :tableData="tableData"
          :page="page"
          :isSelection="true"
          @selection-change="handleSelectionChange"
          :tableLoading="tableLoading"
          @pagination="pagination"
          :total="page.total"
      ></PIMTable>
    </div>
    <form-dia ref="formDia"
              @close="handleQuery"></form-dia>
    <form-dia ref="formDia" @close="handleQuery"></form-dia>
  </div>
</template>
<script setup>
  import { Search } from "@element-plus/icons-vue";
  import { onMounted, ref } from "vue";
  import FormDia from "@/views/personnelManagement/dimission/components/formDia.vue";
  import {
    findStaffLeaveListPage,
    batchDeleteStaffLeaves,
  } from "@/api/personnelManagement/staffLeave.js";
  import { ElMessageBox } from "element-plus";
import { Search } from "@element-plus/icons-vue";
import {onMounted, ref} from "vue";
import FormDia from "@/views/personnelManagement/dimission/components/formDia.vue";
import {findStaffLeaveListPage, batchDeleteStaffLeaves} from "@/api/personnelManagement/staffLeave.js";
import {ElMessageBox} from "element-plus";
  const data = reactive({
    searchForm: {
      staffName: "",
const data = reactive({
  searchForm: {
    staffName: "",
  },
});
const { searchForm } = toRefs(data);
const tableColumn = ref([
  {
    label: "状态",
    prop: "staffState",
    dataType: "tag",
    formatData: (params) => {
      if (params == 0) {
        return "离职";
      } else if (params == 1) {
        return "在职";
      } else {
        return null;
      }
    },
  });
  const { searchForm } = toRefs(data);
  const tableColumn = ref([
    {
      label: "状态",
      prop: "staffState",
      dataType: "tag",
      formatData: params => {
        if (params == 0) {
          return "离职";
        } else if (params == 1) {
          return "在职";
        } else {
          return null;
        }
      },
      formatType: params => {
        if (params == 0) {
          return "danger";
        } else if (params == 1) {
          return "primary";
        } else {
          return null;
        }
      },
    formatType: (params) => {
      if (params == 0) {
        return "danger";
      } else if (params == 1) {
        return "primary";
      } else {
        return null;
      }
    },
    {
      label: "离职日期",
      prop: "leaveDate",
    },
    {
      label: "员工编号",
      prop: "staffNo",
    },
    {
      label: "姓名",
      prop: "staffName",
    },
    {
      label: "性别",
      prop: "sex",
    },
    {
      label: "部门",
      prop: "deptName",
    },
    {
      label: "岗位",
      prop: "postName",
    },
    {
      label: "第一学历",
      prop: "firstStudy",
    },
    {
      label: "专业",
      prop: "profession",
      width: 100,
    },
    {
      label: "年龄",
      prop: "age",
    },
    {
      label: "联系电话",
      prop: "phone",
      width: 150,
    },
    {
      label: "紧急联系人",
      prop: "emergencyContact",
      width: 120,
    },
    {
      label: "紧急联系人电话",
      prop: "emergencyContactPhone",
      width: 150,
    },
    {
      dataType: "action",
      label: "操作",
      align: "center",
      fixed: "right",
      operation: [
        {
          name: "编辑",
          type: "text",
          clickFun: row => {
            openForm("edit", row);
          },
  },
  {
    label: "离职日期",
    prop: "leaveDate",
  },
  {
    label: "员工编号",
    prop: "staffNo",
  },
  {
    label: "姓名",
    prop: "staffName",
  },
  {
    label: "性别",
    prop: "sex",
  },
  {
    label: "户籍住址",
    prop: "nativePlace",
  },
  {
    label: "部门",
    prop: "deptName",
  },
  {
    label: "岗位",
    prop: "postName",
  },
  {
    label: "现住址",
    prop: "adress",
    width:200
  },
  {
    label: "第一学历",
    prop: "firstStudy",
  },
  {
    label: "专业",
    prop: "profession",
    width:100
  },
  {
    label: "年龄",
    prop: "age",
  },
  {
    label: "联系电话",
    prop: "phone",
    width:150
  },
  {
    label: "紧急联系人",
    prop: "emergencyContact",
    width: 120
  },
  {
    label: "紧急联系人电话",
    prop: "emergencyContactPhone",
    width:150
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
    fixed: 'right',
    operation: [
      {
        name: "编辑",
        type: "text",
        clickFun: (row) => {
          openForm("edit", row);
        },
      ],
    },
  ]);
  const tableData = ref([]);
  const selectedRows = ref([]);
  const tableLoading = ref(false);
  const page = reactive({
    current: 1,
    size: 100,
    total: 0,
  });
  const formDia = ref();
  const { proxy } = getCurrentInstance();
      },
    ],
  },
]);
const tableData = ref([]);
const selectedRows = ref([]);
const tableLoading = ref(false);
const page = reactive({
  current: 1,
  size: 100,
  total: 0,
});
const formDia = ref()
const { proxy } = getCurrentInstance()
  // æŸ¥è¯¢åˆ—表
  /** æœç´¢æŒ‰é’®æ“ä½œ */
  const handleQuery = () => {
    page.current = 1;
    getList();
  };
  const pagination = obj => {
    page.current = obj.page;
    page.size = obj.limit;
    getList();
  };
  const getList = () => {
    tableLoading.value = true;
    findStaffLeaveListPage({ ...page, ...searchForm.value })
      .then(res => {
        tableLoading.value = false;
        tableData.value = res.data.records;
        page.total = res.data.total;
      })
      .catch(err => {
        tableLoading.value = false;
      });
  };
  // è¡¨æ ¼é€‰æ‹©æ•°æ®
  const handleSelectionChange = selection => {
    selectedRows.value = selection;
  };
  // æ‰“开弹框
  const openForm = (type, row) => {
    nextTick(() => {
      formDia.value?.openDialog(type, row);
    });
  };
// æŸ¥è¯¢åˆ—表
/** æœç´¢æŒ‰é’®æ“ä½œ */
const handleQuery = () => {
  page.current = 1;
  getList();
};
const pagination = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
const getList = () => {
  tableLoading.value = true;
  findStaffLeaveListPage({...page, ...searchForm.value}).then(res => {
    tableLoading.value = false;
    tableData.value = res.data.records
    page.total = res.data.total;
  }).catch(err => {
    tableLoading.value = false;
  })
};
// è¡¨æ ¼é€‰æ‹©æ•°æ®
const handleSelectionChange = (selection) => {
  selectedRows.value = selection;
};
  // åˆ é™¤
  const handleDelete = () => {
    let ids = [];
    if (selectedRows.value.length > 0) {
      ids = selectedRows.value.map(item => item.id);
    } else {
      proxy.$modal.msgWarning("请选择数据");
      return;
    }
    ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
// æ‰“开弹框
const openForm = (type, row) => {
  nextTick(() => {
    formDia.value?.openDialog(type, row)
  })
};
// åˆ é™¤
const handleDelete = () => {
  let ids = [];
  if (selectedRows.value.length > 0) {
    ids = selectedRows.value.map((item) => item.id);
  } else {
    proxy.$modal.msgWarning("请选择数据");
    return;
  }
  ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
      .then(() => {
        batchDeleteStaffLeaves(ids).then(res => {
        batchDeleteStaffLeaves(ids).then((res) => {
          proxy.$modal.msgSuccess("删除成功");
          getList();
        });
@@ -213,24 +220,24 @@
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
  };
  // å¯¼å‡º
  const handleOut = () => {
    ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      type: "warning",
    })
};
// å¯¼å‡º
const handleOut = () => {
  ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
      .then(() => {
        proxy.download("/staff/staffLeave/export", {}, "人员离职.xlsx");
      })
      .catch(() => {
        proxy.$modal.msg("已取消");
      });
  };
  onMounted(() => {
    getList();
  });
};
onMounted(() => {
  getList();
});
</script>
<style scoped></style>
src/views/personnelManagement/employeeRecord/index.vue
@@ -145,10 +145,6 @@
    prop: "staffNo",
  },
  {
    label: "部门",
    prop: "deptName",
  },
  {
    label: "姓名",
    prop: "staffName",
  },
src/views/personnelManagement/monthlyStatistics/components/auditDia.vue
@@ -86,7 +86,7 @@
<script setup>
import { ref, computed, reactive, toRefs, getCurrentInstance, watch } from "vue";
import { ElMessage } from "element-plus";
import useUserStore from "@/store/modules/user";
import Cookies from "js-cookie";
import FormDialog from "@/components/Dialog/FormDialog.vue";
import { staffSalaryMainUpdate } from "@/api/personnelManagement/staffSalaryMain.js";
@@ -98,7 +98,6 @@
});
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
const dialogVisible = computed({
  get: () => props.modelValue,
@@ -177,21 +176,15 @@
      return;
    }
    
    const username = userStore.name || "";
    const currentUserId = Number(userStore.id);
    const assignedAuditUserId = Number(row?.auditUserId);
    // æƒé™éªŒè¯ï¼šåªæœ‰æŒ‡å®šçš„审核人才能进行审核
    if (!currentUserId || currentUserId !== assignedAuditUserId) {
      ElMessage.warning("您不是指定的审核人,无法进行审核操作");
      return;
    }
    const username = Cookies.get("username") || "";
    const userIdRaw = Cookies.get("userId");
    const auditUserId = userIdRaw ? Number(userIdRaw) : undefined;
    
    // æž„建审核数据
    const submitData = {
      id: row.id,
      status: Number(auditResult.value) === 2 ? 2 : 4, // 2=不通过 4=通过(待发放)
      auditUserId: currentUserId,
      auditUserId,
      auditUserName: username,
    };
    loading.value = true;
src/views/personnelManagement/monthlyStatistics/components/formDia.vue
@@ -1,520 +1,505 @@
<template>
  <FormDialog v-model="dialogVisible"
              :title="operationType === 'add' ? '新建工资表' : '编辑工资表'"
              width="90%"
              @close="closeDia">
  <FormDialog
    v-model="dialogVisible"
    :title="operationType === 'add' ? '新建工资表' : '编辑工资表'"
    width="90%"
    @close="closeDia"
  >
    <template #footer>
      <el-button type="info"
                 @click="saveDraft">保存草稿</el-button>
      <el-button type="primary"
                 @click="submitForm">确认提交</el-button>
      <el-button type="info" @click="saveDraft">保存草稿</el-button>
      <el-button type="primary" @click="submitForm">确认提交</el-button>
      <el-button @click="closeDia">取消</el-button>
    </template>
    <div class="form-dia-body">
      <!-- åŸºç¡€èµ„æ–™ -->
      <el-card class="form-card"
               shadow="never">
      <el-card class="form-card" shadow="never">
        <template #header>
          <span class="card-title"><span class="card-title-line">|</span> åŸºç¡€èµ„æ–™</span>
          <el-icon class="card-collapse">
            <ArrowUp />
          </el-icon>
          <el-icon class="card-collapse"><ArrowUp /></el-icon>
        </template>
        <el-form ref="formRef"
                 :model="form"
                 :rules="rules"
                 label-position="top">
        <el-form ref="formRef" :model="form" :rules="rules" label-position="top">
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item label="工资主题"
                            prop="salaryTitle">
                <el-input v-model="form.salaryTitle"
                          placeholder="请输入"
                          clearable
                          maxlength="20"
                          show-word-limit />
              <el-form-item label="工资主题" prop="salaryTitle">
                <el-input
                  v-model="form.salaryTitle"
                  placeholder="请输入"
                  clearable
                  maxlength="20"
                  show-word-limit
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="选择工资月份"
                            prop="salaryMonth">
                <el-date-picker v-model="form.salaryMonth"
                                type="month"
                                value-format="YYYY-MM"
                                format="YYYY-MM"
                                placeholder="请选择工资月份"
                                style="width: 100%"
                                clearable />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="选择部门"
                            prop="deptIds">
                <el-select v-model="form.deptIds"
                           placeholder="请选择"
                           clearable
                           multiple
                           collapse-tags-tooltip
                           style="width: 100%">
                  <el-option v-for="item in deptOptions"
                             :key="item.deptId"
                             :label="item.deptName"
                             :value="item.deptId"
                             :disabled="isDeptDisabled(item.deptId)" />
              <el-form-item label="选择部门" prop="deptIds">
                <el-select
                  v-model="form.deptIds"
                  placeholder="请选择"
                  clearable
                  multiple
                  collapse-tags-tooltip
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in deptOptions"
                    :key="item.deptId"
                    :label="item.deptName"
                    :value="item.deptId"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="备注"
                            prop="remark">
                <el-input v-model="form.remark"
                          placeholder="请输入"
                          clearable />
              <el-form-item label="选择工资月份" prop="salaryMonth">
                <el-date-picker
                  v-model="form.salaryMonth"
                  type="month"
                  value-format="YYYY-MM"
                  format="YYYY-MM"
                  placeholder="请选择工资月份"
                  style="width: 100%"
                  clearable
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="备注" prop="remark">
                <el-input
                  v-model="form.remark"
                  placeholder="请输入"
                  clearable
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item label="支付银行"
                            prop="payBank">
                <el-select v-model="form.payBank"
                           placeholder="请选择"
                           clearable
                           filterable
                           style="width: 100%">
                  <el-option v-for="b in bankOptions"
                             :key="b"
                             :label="b"
                             :value="b" />
              <el-form-item label="支付银行" prop="payBank">
                <el-select
                  v-model="form.payBank"
                  placeholder="请选择"
                  clearable
                  filterable
                  style="width: 100%"
                >
                  <el-option
                    v-for="b in bankOptions"
                    :key="b"
                    :label="b"
                    :value="b"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="审核人"
                            prop="auditUserId">
                <el-select v-model="form.auditUserId"
                           placeholder="请选择审核人"
                           clearable
                           filterable
                           style="width: 100%">
                  <el-option v-for="item in userList"
                             :key="item.userId"
                             :label="item.nickName"
                             :value="item.userId" />
              <el-form-item label="审核人" prop="auditUserId">
                <el-select
                  v-model="form.auditUserId"
                  placeholder="请选择审核人"
                  clearable
                  filterable
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in userList"
                    :key="item.userId"
                    :label="item.nickName"
                    :value="item.userId"
                  />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
      <!-- æ“ä½œæŒ‰é’® -->
      <div class="toolbar">
        <el-button type="primary"
                   @click="handleGenerate">生成工资表</el-button>
        <el-button type="primary" @click="handleGenerate">生成工资表</el-button>
        <el-button @click="handleClear">清空</el-button>
        <el-button @click="handleBatchDelete">删除</el-button>
        <el-button @click="handleTaxForm">个税表</el-button>
      </div>
      <!-- å‘˜å·¥å·¥èµ„详情表格 -->
      <div class="employee-table-wrap">
        <el-table ref="employeeTableRef"
                  :data="employeeList"
                  border
                  max-height="400"
                  @selection-change="onEmployeeSelectionChange">
          <el-table-column type="selection"
                           width="55"
                           align="center" />
          <el-table-column label="员工姓名"
                           prop="staffName"
                           minWidth="100" />
          <el-table-column label="部门"
                           prop="deptName"
                           minWidth="100" />
          <el-table-column label="基本工资"
                           minWidth="110">
        <el-table
          ref="employeeTableRef"
          :data="employeeList"
          border
          max-height="400"
          @selection-change="onEmployeeSelectionChange"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="员工姓名" prop="staffName" minWidth="100" />
          <el-table-column label="部门" prop="deptName" minWidth="100" />
          <el-table-column label="基本工资" minWidth="110">
            <template #default="{ row }">
              <el-input v-model.number="row.basicSalary"
                        type="number"
                        placeholder="0"
                        size="small"
                        @input="handleSalaryInput(row)" />
              <el-input
                v-model.number="row.basicSalary"
                type="number"
                placeholder="0"
                size="small"
                @input="row.basicSalary = parseNum(row.basicSalary)"
              />
            </template>
          </el-table-column>
          <el-table-column label="计件工资"
                           minWidth="110">
          <el-table-column label="计件工资" minWidth="110">
            <template #default="{ row }">
              <el-input v-model.number="row.pieceSalary"
                        type="number"
                        placeholder="0"
                        size="small"
                        disabled
                        @input="row.pieceSalary = parseNum(row.pieceSalary)" />
              <el-input
                v-model.number="row.pieceSalary"
                type="number"
                placeholder="0"
                size="small"
                @input="row.pieceSalary = parseNum(row.pieceSalary)"
              />
            </template>
          </el-table-column>
          <el-table-column label="计时工资"
                           minWidth="110">
          <el-table-column label="计时工资" minWidth="110">
            <template #default="{ row }">
              <el-input v-model.number="row.hourlySalary"
                        type="number"
                        placeholder="0"
                        size="small"
                        disabled
                        @input="row.hourlySalary = parseNum(row.hourlySalary)" />
              <el-input
                v-model.number="row.hourlySalary"
                type="number"
                placeholder="0"
                size="small"
                @input="row.hourlySalary = parseNum(row.hourlySalary)"
              />
            </template>
          </el-table-column>
          <el-table-column label="其他收入"
                           minWidth="110">
          <el-table-column label="其他收入" minWidth="110">
            <template #default="{ row }">
              <el-input v-model.number="row.otherIncome"
                        type="number"
                        placeholder="0"
                        size="small"
                        @input="handleSalaryInput(row)" />
              <el-input
                v-model.number="row.otherIncome"
                type="number"
                placeholder="0"
                size="small"
                @input="row.otherIncome = parseNum(row.otherIncome)"
              />
            </template>
          </el-table-column>
          <el-table-column label="社保个人"
                           minWidth="110">
          <el-table-column label="社保个人" minWidth="110">
            <template #default="{ row }">
              <el-input v-model.number="row.socialPersonal"
                        type="number"
                        placeholder="0"
                        size="small"
                        disabled
                        @input="row.socialPersonal = parseNum(row.socialPersonal)" />
              <el-input
                v-model.number="row.socialPersonal"
                type="number"
                placeholder="0"
                size="small"
                @input="row.socialPersonal = parseNum(row.socialPersonal)"
              />
            </template>
          </el-table-column>
          <el-table-column label="公积金个人"
                           minWidth="120">
          <el-table-column label="公积金个人" minWidth="120">
            <template #default="{ row }">
              <el-input v-model.number="row.fundPersonal"
                        type="number"
                        placeholder="0"
                        size="small"
                        disabled
                        @input="row.fundPersonal = parseNum(row.fundPersonal)" />
              <el-input
                v-model.number="row.fundPersonal"
                type="number"
                placeholder="0"
                size="small"
                @input="row.fundPersonal = parseNum(row.fundPersonal)"
              />
            </template>
          </el-table-column>
          <el-table-column label="其他支出"
                           minWidth="110">
          <el-table-column label="其他支出" minWidth="110">
            <template #default="{ row }">
              <el-input v-model.number="row.otherDeduct"
                        type="number"
                        placeholder="0"
                        size="small"
                        disabled
                        @input="row.otherDeduct = parseNum(row.otherDeduct)" />
              <el-input
                v-model.number="row.otherDeduct"
                type="number"
                placeholder="0"
                size="small"
                @input="row.otherDeduct = parseNum(row.otherDeduct)"
              />
            </template>
          </el-table-column>
          <el-table-column label="社保补缴"
                           minWidth="120">
          <el-table-column label="工资个税" minWidth="110">
            <template #default="{ row }">
              <el-input v-model.number="row.socialSupplementAmount"
                        type="number"
                        placeholder="0"
                        size="small"
                        @input="handleSalaryInput(row)" />
              <el-input
                v-model.number="row.salaryTax"
                type="number"
                placeholder="0"
                size="small"
                @input="row.salaryTax = parseNum(row.salaryTax)"
              />
            </template>
          </el-table-column>
          <el-table-column label="工资个税"
                           minWidth="110">
          <el-table-column label="应发工资" minWidth="110">
            <template #default="{ row }">
              <el-input v-model.number="row.salaryTax"
                        type="number"
                        placeholder="0"
                        size="small"
                        disabled
                        @input="row.salaryTax = parseNum(row.salaryTax)" />
              <el-input
                v-model.number="row.grossSalary"
                type="number"
                placeholder="0"
                size="small"
                @input="row.grossSalary = parseNum(row.grossSalary)"
              />
            </template>
          </el-table-column>
          <el-table-column label="应发工资"
                           minWidth="110">
          <el-table-column label="应扣工资" minWidth="110">
            <template #default="{ row }">
              <el-input v-model.number="row.grossSalary"
                        type="number"
                        placeholder="0"
                        size="small"
                        disabled
                        @input="row.grossSalary = parseNum(row.grossSalary)" />
              <el-input
                v-model.number="row.deductSalary"
                type="number"
                placeholder="0"
                size="small"
                @input="row.deductSalary = parseNum(row.deductSalary)"
              />
            </template>
          </el-table-column>
          <el-table-column label="应扣工资"
                           minWidth="110">
          <el-table-column label="实发工资" minWidth="110">
            <template #default="{ row }">
              <el-input v-model.number="row.deductSalary"
                        type="number"
                        placeholder="0"
                        size="small"
                        disabled
                        @input="row.deductSalary = parseNum(row.deductSalary)" />
              <el-input
                v-model.number="row.netSalary"
                type="number"
                placeholder="0"
                size="small"
                @input="row.netSalary = parseNum(row.netSalary)"
              />
            </template>
          </el-table-column>
          <el-table-column label="实发工资"
                           minWidth="110">
          <el-table-column label="备注" minWidth="120">
            <template #default="{ row }">
              <el-input v-model.number="row.netSalary"
                        type="number"
                        placeholder="0"
                        size="small"
                        disabled
                        @input="row.netSalary = parseNum(row.netSalary)" />
              <el-input
                v-model="row.remark"
                placeholder="请输入"
                size="small"
              />
            </template>
          </el-table-column>
          <el-table-column label="备注"
                           minWidth="120">
          <el-table-column label="操作" width="80" align="center" fixed="right">
            <template #default="{ row }">
              <el-input v-model="row.remark"
                        placeholder="请输入"
                        size="small" />
            </template>
          </el-table-column>
          <el-table-column label="操作"
                           width="80"
                           align="center"
                           fixed="right">
            <template #default="{ row }">
              <el-button type="primary"
                         link
                         @click="removeEmployee(row)">删除</el-button>
              <el-button type="primary" link @click="removeEmployee(row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div v-if="!employeeList.length"
             class="table-empty">暂无数据</div>
        <div v-else
             class="salary-total">
        <div v-if="!employeeList.length" class="table-empty">暂无数据</div>
        <div v-else class="salary-total">
          <span class="total-label">工资总额:</span>
          <span class="total-value">Â¥ {{ totalSalary.toFixed(2) }}</span>
        </div>
      </div>
    </div>
    <!-- æ–°å¢žäººå‘˜å¼¹çª— -->
    <el-dialog v-model="addPersonVisible"
               title="新增人员"
               width="400px"
               append-to-body
               @close="addPersonClose">
    <el-dialog
      v-model="addPersonVisible"
      title="新增人员"
      width="400px"
      append-to-body
      @close="addPersonClose"
    >
      <div class="add-person-tree">
        <el-tree ref="personTreeRef"
                 :data="deptStaffTree"
                 show-checkbox
                 node-key="id"
                 :props="{ label: 'label', children: 'children' }"
                 default-expand-all />
        <el-tree
          ref="personTreeRef"
          :data="deptStaffTree"
          show-checkbox
          node-key="id"
          :props="{ label: 'label', children: 'children' }"
          default-expand-all
        />
      </div>
      <template #footer>
        <el-button @click="addPersonVisible = false">取消</el-button>
        <el-button type="primary"
                   @click="confirmAddPerson">确定</el-button>
        <el-button type="primary" @click="confirmAddPerson">确定</el-button>
      </template>
    </el-dialog>
    <!-- ä¸ªç¨Žè¡¨å¼¹çª— -->
    <el-dialog v-model="taxDialogVisible"
               title="个税表"
               width="700px"
               append-to-body>
    <el-dialog
      v-model="taxDialogVisible"
      title="个税表"
      width="700px"
      append-to-body
    >
      <div class="tax-desc">个人所得税免征额:5000元</div>
      <el-table :data="taxTableData"
                border
                style="width: 100%;margin-bottom: 20px;">
        <el-table-column prop="level"
                         label="级数"
                         width="80"
                         align="center" />
        <el-table-column prop="range"
                         label="全年应纳税所得额/元"
                         min-width="220" />
        <el-table-column prop="rate"
                         label="税率(%)"
                         width="100"
                         align="center" />
        <el-table-column prop="quickDeduction"
                         label="速算扣除数/元"
                         width="160"
                         align="center" />
      <el-table :data="taxTableData" border style="width: 100%;margin-bottom: 20px;">
        <el-table-column prop="level" label="级数" width="80" align="center" />
        <el-table-column
          prop="range"
          label="全年应纳税所得额/元"
          min-width="220"
        />
        <el-table-column
          prop="rate"
          label="税率(%)"
          width="100"
          align="center"
        />
        <el-table-column
          prop="quickDeduction"
          label="速算扣除数/元"
          width="160"
          align="center"
        />
      </el-table>
    </el-dialog>
  </FormDialog>
</template>
<script setup>
  import {
    ref,
    reactive,
    toRefs,
    computed,
    getCurrentInstance,
    nextTick,
    watch,
  } from "vue";
  import { ArrowUp } from "@element-plus/icons-vue";
  import FormDialog from "@/components/Dialog/FormDialog.vue";
  import { listDept } from "@/api/system/dept.js";
  import { staffOnJobList } from "@/api/personnelManagement/monthlyStatistics.js";
import { ref, reactive, toRefs, computed, getCurrentInstance, nextTick } from "vue";
import { ArrowUp } from "@element-plus/icons-vue";
import FormDialog from "@/components/Dialog/FormDialog.vue";
import { listDept } from "@/api/system/dept.js";
import { staffOnJobList } from "@/api/personnelManagement/monthlyStatistics.js";
import { bankList } from "@/api/personnelManagement/bank.js";
import {
  staffSalaryMainAdd,
  staffSalaryMainUpdate,
  staffSalaryMainCalculateSalary,
  staffSalaryMainCalculateByEmployeeId,
  staffSalaryMainAvailableDepts,
} from "@/api/personnelManagement/staffSalaryMain.js";
  import { userListNoPageByTenantId } from "@/api/system/user.js";
import { userListNoPageByTenantId } from "@/api/system/user.js";
  const emit = defineEmits(["update:modelValue", "close"]);
  const props = defineProps({
    modelValue: { type: Boolean, default: false },
    operationType: { type: String, default: "add" },
    row: { type: Object, default: () => ({}) },
  });
  const { proxy } = getCurrentInstance();
const emit = defineEmits(["update:modelValue", "close"]);
const props = defineProps({
  modelValue: { type: Boolean, default: false },
  operationType: { type: String, default: "add" },
  row: { type: Object, default: () => ({}) },
});
  const dialogVisible = computed({
    get: () => props.modelValue,
    set: val => emit("update:modelValue", val),
  });
const { proxy } = getCurrentInstance();
  const formRef = ref(null);
  const employeeTableRef = ref(null);
  const personTreeRef = ref(null);
  const addPersonVisible = ref(false);
  const taxDialogVisible = ref(false);
  const deptOptions = ref([]);
  const availableDeptIds = ref(new Set());
  const deptStaffTree = ref([]);
  const employeeList = ref([]);
  const selectedEmployees = ref([]);
  const bankOptions = ref([]);
  const userList = ref([]);
  const recalcTimers = new Map();
  const recalcVersions = new Map();
  const taxTableData = ref([
    { level: 1, range: "不超过36000元", rate: 3, quickDeduction: 0 },
    { level: 2, range: "超过36000-144000元", rate: 10, quickDeduction: 2520 },
    { level: 3, range: "超过144000-300000元", rate: 20, quickDeduction: 16920 },
    { level: 4, range: "超过300000-420000元", rate: 25, quickDeduction: 31920 },
    { level: 5, range: "超过420000-660000元", rate: 30, quickDeduction: 52920 },
    { level: 6, range: "超过660000-960000元", rate: 35, quickDeduction: 85920 },
    { level: 7, range: "超过960000元", rate: 45, quickDeduction: 181920 },
  ]);
const dialogVisible = computed({
  get: () => props.modelValue,
  set: (val) => emit("update:modelValue", val),
});
  function parseNum(v) {
    if (v === "" || v == null) return 0;
    const n = Number(v);
    return isNaN(n) ? 0 : n;
  }
const formRef = ref(null);
const employeeTableRef = ref(null);
const personTreeRef = ref(null);
const addPersonVisible = ref(false);
const taxDialogVisible = ref(false);
const deptOptions = ref([]);
const deptStaffTree = ref([]);
const employeeList = ref([]);
const selectedEmployees = ref([]);
const bankOptions = ref([]);
const userList = ref([]);
const taxTableData = ref([
  { level: 1, range: "不超过36000元", rate: 3, quickDeduction: 0 },
  { level: 2, range: "超过36000-144000元", rate: 10, quickDeduction: 2520 },
  { level: 3, range: "超过144000-300000元", rate: 20, quickDeduction: 16920 },
  { level: 4, range: "超过300000-420000元", rate: 25, quickDeduction: 31920 },
  { level: 5, range: "超过420000-660000元", rate: 30, quickDeduction: 52920 },
  { level: 6, range: "超过660000-960000元", rate: 35, quickDeduction: 85920 },
  { level: 7, range: "超过960000元", rate: 45, quickDeduction: 181920 },
]);
  function parseNullableNum(v) {
    if (v === "" || v == null) return null;
    const n = Number(v);
    return isNaN(n) ? null : n;
  }
function parseNum(v) {
  if (v === "" || v == null) return 0;
  const n = Number(v);
  return isNaN(n) ? 0 : n;
}
  const createEmployeeRow = () => ({
    staffOnJobId: undefined,
// åŸºç¡€èµ„料表单
const data = reactive({
  form: {
    id: undefined,
    staffName: "",
    postName: "",
    deptName: "",
    basicSalary: 0,
    pieceSalary: 0,
    hourlySalary: 0,
    otherIncome: 0,
    socialPersonal: 0,
    fundPersonal: 0,
    otherDeduct: 0,
    socialSupplementAmount: null,
    salaryTax: 0,
    grossSalary: 0,
    deductSalary: 0,
    netSalary: 0,
    salaryTitle: "",
    deptIds: [],
    salaryMonth: "",
    remark: "",
    payBank: "",
    auditUserId: undefined,
  },
  rules: {
    salaryTitle: [{ required: true, message: "请输入工资主题", trigger: "blur" }],
    deptIds: [{ required: true, message: "请选择部门", trigger: "change" }],
    salaryMonth: [{ required: true, message: "请选择工资月份", trigger: "change" }],
    auditUserId: [{ required: true, message: "请选择审核人", trigger: "change" }],
  },
});
const { form, rules } = toRefs(data);
// è®¡ç®—工资总额(所有员工实发工资之和)
const totalSalary = computed(() => {
  return employeeList.value.reduce((sum, e) => sum + parseNum(e.netSalary), 0);
});
// æ ¹æ®å®¡æ ¸äººID获取审核人名称
const auditUserName = computed(() => {
  if (!form.value.auditUserId) return "";
  const user = userList.value.find(u => u.userId === form.value.auditUserId);
  return user ? user.nickName : "";
});
const loadBankOptions = () => {
  return bankList().then((res) => {
    const list = Array.isArray(res?.data) ? res.data : [];
    bankOptions.value = list
      .map((b) => (b?.bankName == null ? "" : String(b.bankName).trim()))
      .filter((v) => v !== "");
  });
};
  const normalizeEmployeeRow = (source, fallback = {}) => ({
    ...createEmployeeRow(),
    ...fallback,
    ...source,
    staffOnJobId: source?.staffOnJobId ?? source?.staffId ?? source?.id ?? fallback.staffOnJobId ?? fallback.id,
    id: source?.staffOnJobId ?? source?.staffId ?? source?.id ?? fallback.staffOnJobId ?? fallback.id,
    staffName: source?.staffName ?? fallback.staffName ?? "",
    postName: source?.postName ?? fallback.postName ?? "",
    deptName: source?.deptName ?? fallback.deptName ?? "",
    basicSalary: parseNum(source?.basicSalary ?? fallback.basicSalary),
    pieceSalary: parseNum(source?.pieceSalary ?? fallback.pieceSalary),
    hourlySalary: parseNum(source?.hourlySalary ?? fallback.hourlySalary),
    otherIncome: parseNum(source?.otherIncome ?? fallback.otherIncome),
    socialPersonal: parseNum(source?.socialPersonal ?? fallback.socialPersonal),
    fundPersonal: parseNum(source?.fundPersonal ?? fallback.fundPersonal),
    otherDeduct: parseNum(source?.otherDeduct ?? fallback.otherDeduct),
    socialSupplementAmount:
      source?.socialSupplementAmount ?? fallback.socialSupplementAmount ?? null,
    salaryTax: parseNum(source?.salaryTax ?? fallback.salaryTax),
    grossSalary: parseNum(source?.grossSalary ?? fallback.grossSalary),
    deductSalary: parseNum(source?.deductSalary ?? fallback.deductSalary),
    netSalary: parseNum(source?.netSalary ?? fallback.netSalary),
    remark: source?.remark ?? fallback.remark ?? "",
const loadUserList = () => {
  return userListNoPageByTenantId().then((res) => {
    userList.value = res.data || [];
  });
};
  const applyBackendRow = (targetRow, sourceRow) => {
    Object.assign(targetRow, normalizeEmployeeRow(sourceRow, targetRow));
  };
// æ‰å¹³åŒ–部门树供下拉使用
function flattenDept(tree, list = []) {
  if (!tree?.length) return list;
  tree.forEach((node) => {
    list.push({ deptId: node.deptId, deptName: node.deptName });
    if (node.children?.length) flattenDept(node.children, list);
  });
  return list;
}
  const clearRowRecalcState = row => {
    const key = String(row?.staffOnJobId ?? row?.id ?? "");
    if (!key) return;
    clearTimeout(recalcTimers.get(key));
    recalcTimers.delete(key);
    recalcVersions.delete(key);
  };
const loadDeptOptions = () => {
  listDept().then((res) => {
    const tree = res.data ?? [];
    deptOptions.value = flattenDept(tree);
  });
};
  const resetRecalcState = () => {
    recalcTimers.forEach(timer => clearTimeout(timer));
    recalcTimers.clear();
    recalcVersions.clear();
  };
  const requestEmployeeRecalculate = row => {
    const key = String(row?.staffOnJobId ?? row?.id ?? "");
    if (!key || !form.value.salaryMonth) return;
    const version = (recalcVersions.get(key) || 0) + 1;
    recalcVersions.set(key, version);
    clearTimeout(recalcTimers.get(key));
    const payload = {
      staffOnJobId: row.staffOnJobId ?? row.id,
      salaryMonth: form.value.salaryMonth,
      staffName: row.staffName ?? "",
      postName: row.postName ?? "",
      deptName: row.deptName ?? "",
      basicSalary: parseNum(row.basicSalary),
      pieceSalary: parseNum(row.pieceSalary),
      hourlySalary: parseNum(row.hourlySalary),
      otherIncome: parseNum(row.otherIncome),
      otherDeduct: parseNum(row.otherDeduct),
      socialSupplementAmount: parseNullableNum(row.socialSupplementAmount),
      remark: row.remark ?? "",
    };
    recalcTimers.set(
      key,
      setTimeout(() => {
        staffSalaryMainCalculateByEmployeeId(payload).then(res => {
          if (recalcVersions.get(key) !== version) return;
          applyBackendRow(row, res?.data || {});
// æž„建 éƒ¨é—¨-人员 æ ‘(用于新增人员弹窗)
const loadDeptStaffTree = () => {
  Promise.all([listDept(), staffOnJobList()]).then(([deptRes, staffRes]) => {
    const tree = deptRes.data ?? [];
    const staffList = staffRes.data ?? [];
    const deptMap = new Map();
    function walk(nodes) {
      nodes.forEach((node) => {
        deptMap.set(node.deptId, {
          id: "dept_" + node.deptId,
          deptId: node.deptId,
          label: node.deptName,
          type: "dept",
          children: [],
        });
      }, 250)
        if (node.children?.length) walk(node.children);
      });
    }
    walk(tree);
    staffList.forEach((s) => {
      const deptId = s.deptId ?? s.dept_id;
      const node = deptMap.get(deptId);
      if (node) {
        node.children.push({
          id: s.id ?? s.staffId,
          staffId: s.id ?? s.staffId,
          label: s.staffName ?? s.name,
          type: "staff",
          ...s,
        });
      }
    });
    deptStaffTree.value = Array.from(deptMap.values()).filter(
      (n) => n.children && n.children.length > 0
    );
  };
  });
};
  const handleSalaryInput = row => {
    row.basicSalary = parseNum(row.basicSalary);
    row.otherIncome = parseNum(row.otherIncome);
    requestEmployeeRecalculate(row);
  };
  // åŸºç¡€èµ„料表单
  const data = reactive({
    form: {
const openDialog = (type, row) => {
  nextTick(() => {
    loadDeptOptions();
    loadBankOptions();
    loadUserList();
    employeeList.value = [];
    Object.assign(form.value, {
      id: undefined,
      salaryTitle: "",
      deptIds: [],
@@ -522,413 +507,298 @@
      remark: "",
      payBank: "",
      auditUserId: undefined,
    },
    rules: {
      salaryTitle: [
        { required: true, message: "请输入工资主题", trigger: "blur" },
      ],
      deptIds: [{ required: true, message: "请选择部门", trigger: "change" }],
      salaryMonth: [
        { required: true, message: "请选择工资月份", trigger: "change" },
      ],
      auditUserId: [
        { required: true, message: "请选择审核人", trigger: "change" },
      ],
    },
  });
  const { form, rules } = toRefs(data);
  // è®¡ç®—工资总额(所有员工实发工资之和)
  const totalSalary = computed(() => {
    return employeeList.value.reduce((sum, e) => sum + parseNum(e.netSalary), 0);
  });
  // æ ¹æ®å®¡æ ¸äººID获取审核人名称
  const auditUserName = computed(() => {
    if (!form.value.auditUserId) return "";
    const user = userList.value.find(u => u.userId === form.value.auditUserId);
    return user ? user.nickName : "";
  });
  const loadBankOptions = () => {
    return bankList().then(res => {
      const list = Array.isArray(res?.data) ? res.data : [];
      bankOptions.value = list
        .map(b => (b?.bankName == null ? "" : String(b.bankName).trim()))
        .filter(v => v !== "");
    });
  };
  const loadUserList = () => {
    return userListNoPageByTenantId().then(res => {
      userList.value = res.data || [];
    });
  };
  // æ‰å¹³åŒ–部门树供下拉使用
  function flattenDept(tree, list = []) {
    if (!tree?.length) return list;
    tree.forEach(node => {
      list.push({ deptId: node.deptId, deptName: node.deptName });
      if (node.children?.length) flattenDept(node.children, list);
    });
    return list;
  }
  // åŠ è½½æ‰€æœ‰éƒ¨é—¨
  const loadAllDeptOptions = () => {
    listDept().then(res => {
      const tree = res.data ?? [];
      deptOptions.value = flattenDept(tree);
    });
  };
  // åŠ è½½å¯ç”¨éƒ¨é—¨åˆ—è¡¨ï¼ˆç”¨äºŽåˆ¤æ–­éƒ¨é—¨æ˜¯å¦å¯é€‰ï¼‰
  const loadAvailableDepts = (salaryMonth) => {
    if (!salaryMonth) {
      availableDeptIds.value = new Set();
      return;
    }
    staffSalaryMainAvailableDepts(salaryMonth).then(res => {
      const availableDepts = Array.isArray(res.data) ? res.data : [];
      availableDeptIds.value = new Set(availableDepts.map(d => d.deptId));
    });
  };
  // åˆ¤æ–­éƒ¨é—¨æ˜¯å¦ç¦ç”¨
  const isDeptDisabled = (deptId) => {
    // å¦‚果没有选择月份,所有部门都可选
    if (!form.value.salaryMonth) return false;
    // å¦‚果已选择月份,只有在可用部门列表中的部门才可选
    return !availableDeptIds.value.has(deptId);
  };
  // æž„建 éƒ¨é—¨-人员 æ ‘(用于新增人员弹窗)
  const loadDeptStaffTree = () => {
    Promise.all([listDept(), staffOnJobList()]).then(([deptRes, staffRes]) => {
      const tree = deptRes.data ?? [];
      const staffList = staffRes.data ?? [];
      const deptMap = new Map();
      function walk(nodes) {
        nodes.forEach(node => {
          deptMap.set(node.deptId, {
            id: "dept_" + node.deptId,
            deptId: node.deptId,
            label: node.deptName,
            type: "dept",
            children: [],
          });
          if (node.children?.length) walk(node.children);
        });
    // ç¼–辑:列表页已返回主表字段;这里只做回显(明细由“生成工资表/计算工资”得到)
    if (type === "edit" && row?.id) {
      form.value.id = row.id;
      form.value.salaryTitle = row.salaryTitle ?? "";
      // deptIds åŽç«¯æ˜¯å­—符串(多个用逗号分隔);当前表单仍是单选 deptId
      form.value.deptIds = row.deptIds
        ? String(row.deptIds).split(",").map((id) => Number(id.trim())).filter(Boolean)
        : [];
      form.value.salaryMonth = row.salaryMonth ?? "";
      form.value.remark = row.remark ?? "";
      form.value.payBank = row.payBank ?? "";
      form.value.auditUserId = row.auditUserId ?? undefined;
      // å¦‚果有员工明细数据,直接反显
      if (row.staffSalaryDetailList && row.staffSalaryDetailList.length > 0) {
        employeeList.value = row.staffSalaryDetailList.map((e) => ({
          staffOnJobId: e.staffOnJobId ?? e.staffId ?? e.id,
          id: e.staffOnJobId ?? e.staffId ?? e.id,
          staffName: e.staffName ?? "",
          postName: e.postName ?? "",
          deptName: e.deptName ?? "",
          basicSalary: parseNum(e.basicSalary),
          pieceSalary: parseNum(e.pieceSalary),
          hourlySalary: parseNum(e.hourlySalary),
          otherIncome: parseNum(e.otherIncome),
          socialPersonal: parseNum(e.socialPersonal),
          fundPersonal: parseNum(e.fundPersonal),
          otherDeduct: parseNum(e.otherDeduct),
          salaryTax: parseNum(e.salaryTax),
          grossSalary: parseNum(e.grossSalary),
          deductSalary: parseNum(e.deductSalary),
          netSalary: parseNum(e.netSalary),
          remark: e.remark ?? "",
        }));
      }
      walk(tree);
      staffList.forEach(s => {
        const deptId = s.deptId ?? s.dept_id;
        const node = deptMap.get(deptId);
        if (node) {
          node.children.push({
            id: s.id ?? s.staffId,
            staffId: s.id ?? s.staffId,
            label: s.staffName ?? s.name,
            type: "staff",
            ...s,
          });
        }
      });
      deptStaffTree.value = Array.from(deptMap.values()).filter(
        n => n.children && n.children.length > 0
      );
    });
  };
  const openDialog = (type, row) => {
    nextTick(() => {
      resetRecalcState();
      loadBankOptions();
      loadUserList();
      loadAllDeptOptions();
      employeeList.value = [];
      Object.assign(form.value, {
        id: undefined,
        salaryTitle: "",
        deptIds: [],
        salaryMonth: "",
        remark: "",
        payBank: "",
        auditUserId: undefined,
      });
      // ç¼–辑:列表页已返回主表字段;这里只做回显(明细由“生成工资表/计算工资”得到)
      if (type === "edit" && row?.id) {
        form.value.id = row.id;
        form.value.salaryTitle = row.salaryTitle ?? "";
        // deptIds åŽç«¯æ˜¯å­—符串(多个用逗号分隔);当前表单仍是单选 deptId
        form.value.deptIds = row.deptIds
          ? String(row.deptIds)
              .split(",")
              .map(id => Number(id.trim()))
              .filter(Boolean)
          : [];
        form.value.salaryMonth = row.salaryMonth ?? "";
        form.value.remark = row.remark ?? "";
        form.value.payBank = row.payBank ?? "";
        form.value.auditUserId = row.auditUserId ?? undefined;
        // å¦‚果有员工明细数据,直接反显
        if (row.staffSalaryDetailList && row.staffSalaryDetailList.length > 0) {
          employeeList.value = row.staffSalaryDetailList.map(e => normalizeEmployeeRow(e));
        }
      }
      // ç¼–辑状态且有月份时,加载可用部门列表
      if (type === "edit" && form.value.salaryMonth) {
        loadAvailableDepts(form.value.salaryMonth);
      }
    });
  };
  // ç›‘听工资月份变化,清空部门选择并加载可用部门列表
  watch(() => form.value.salaryMonth, (newMonth, oldMonth) => {
    // åˆ‡æ¢æœˆä»½æ—¶æ¸…空已选择的部门
    if (newMonth !== oldMonth) {
      form.value.deptIds = [];
    }
    loadAvailableDepts(newMonth);
  });
};
  const openAddPerson = () => {
    loadDeptStaffTree();
    addPersonVisible.value = true;
    nextTick(() => {
      personTreeRef.value?.setCheckedKeys([]);
    });
  };
const openAddPerson = () => {
  loadDeptStaffTree();
  addPersonVisible.value = true;
  nextTick(() => {
    personTreeRef.value?.setCheckedKeys([]);
  });
};
  const addPersonClose = () => {};
const addPersonClose = () => {};
  const confirmAddPerson = () => {
    const tree = personTreeRef.value;
    if (!tree) {
      addPersonVisible.value = false;
      return;
    }
    const checked = tree.getCheckedNodes();
    const staffNodes = checked.filter(n => n.type === "staff");
    const existIds = new Set(employeeList.value.map(e => e.staffId || e.id));
    staffNodes.forEach(node => {
      const id = node.staffId ?? node.id;
      if (existIds.has(id)) return;
      existIds.add(id);
      const newRow = normalizeEmployeeRow({
        staffOnJobId: id,
        id,
        staffName: node.label,
        postName: node.postName ?? node.post ?? "",
        deptName: node.deptName ?? "",
        remark: "",
        socialSupplementAmount: null,
      });
      employeeList.value.push(newRow);
      requestEmployeeRecalculate(newRow);
    });
const confirmAddPerson = () => {
  const tree = personTreeRef.value;
  if (!tree) {
    addPersonVisible.value = false;
  };
    return;
  }
  const checked = tree.getCheckedNodes();
  const staffNodes = checked.filter((n) => n.type === "staff");
  const existIds = new Set(employeeList.value.map((e) => e.staffId || e.id));
  staffNodes.forEach((node) => {
    const id = node.staffId ?? node.id;
    if (existIds.has(id)) return;
    existIds.add(id);
    employeeList.value.push({
      staffOnJobId: id,
      id,
      staffName: node.label,
      postName: node.postName ?? node.post ?? "",
      deptName: node.deptName ?? "",
      basicSalary: 0,
      pieceSalary: 0,
      hourlySalary: 0,
      otherIncome: 0,
      socialPersonal: 0,
      fundPersonal: 0,
      otherDeduct: 0,
      salaryTax: 0,
      grossSalary: 0,
      deductSalary: 0,
      netSalary: 0,
      remark: "",
    });
  });
  addPersonVisible.value = false;
};
  const removeEmployee = row => {
    clearRowRecalcState(row);
    employeeList.value = employeeList.value.filter(
      e => (e.staffOnJobId || e.id) !== (row.staffOnJobId || row.id)
    );
  };
const removeEmployee = (row) => {
  employeeList.value = employeeList.value.filter(
    (e) => (e.staffOnJobId || e.id) !== (row.staffOnJobId || row.id)
  );
};
  const onEmployeeSelectionChange = selection => {
    selectedEmployees.value = selection;
  };
const onEmployeeSelectionChange = (selection) => {
  selectedEmployees.value = selection;
};
  const handleBatchDelete = () => {
    if (!selectedEmployees.value?.length) {
      proxy.$modal.msgWarning("请先勾选要删除的员工");
const handleBatchDelete = () => {
  if (!selectedEmployees.value?.length) {
    proxy.$modal.msgWarning("请先勾选要删除的员工");
    return;
  }
  const ids = new Set(selectedEmployees.value.map((e) => e.staffOnJobId || e.id));
  employeeList.value = employeeList.value.filter(
    (e) => !ids.has(e.staffOnJobId || e.id)
  );
};
const handleGenerate = () => {
  if (!form.value.deptIds?.length) {
    proxy.$modal.msgWarning("请先选择部门");
    return;
  }
  if (!form.value.salaryMonth) {
    proxy.$modal.msgWarning("请先选择工资月份");
    return;
  }
  const payload = {
    ids: form.value.deptIds,
    date: form.value.salaryMonth,
  };
  staffSalaryMainCalculateSalary(payload).then((res) => {
    const list = Array.isArray(res?.data) ? res.data : [];
    if (!list.length) {
      proxy.$modal.msgWarning("未计算到工资数据");
      return;
    }
    const ids = new Set(selectedEmployees.value.map(e => e.staffOnJobId || e.id));
    selectedEmployees.value.forEach(item => clearRowRecalcState(item));
    employeeList.value = employeeList.value.filter(
      e => !ids.has(e.staffOnJobId || e.id)
    );
  };
    employeeList.value = list.map((e) => ({
      ...e,
      staffOnJobId: e.staffOnJobId ?? e.staffId ?? e.id,
      staffName: e.staffName,
      postName: e.postName,
      deptName: e.deptName,
      basicSalary: parseNum(e.basicSalary),
      pieceSalary: parseNum(e.pieceSalary),
      hourlySalary: parseNum(e.hourlySalary),
      otherIncome: parseNum(e.otherIncome),
      socialPersonal: parseNum(e.socialPersonal),
      fundPersonal: parseNum(e.fundPersonal),
      otherDeduct: parseNum(e.otherDeduct),
      salaryTax: parseNum(e.salaryTax),
      grossSalary: parseNum(e.grossSalary),
      deductSalary: parseNum(e.deductSalary),
      netSalary: parseNum(e.netSalary),
      remark: e.remark ?? "",
    }));
    proxy.$modal.msgSuccess("生成成功");
  });
};
  const handleGenerate = () => {
    if (!form.value.deptIds?.length) {
      proxy.$modal.msgWarning("请先选择部门");
      return;
    }
    if (!form.value.salaryMonth) {
      proxy.$modal.msgWarning("请先选择工资月份");
      return;
    }
    const payload = {
      ids: form.value.deptIds,
      date: form.value.salaryMonth,
    };
    staffSalaryMainCalculateSalary(payload).then(res => {
      const list = Array.isArray(res?.data) ? res.data : [];
      if (!list.length) {
        proxy.$modal.msgWarning("未计算到工资数据");
        return;
      }
      resetRecalcState();
      employeeList.value = list.map(e => normalizeEmployeeRow(e));
      proxy.$modal.msgSuccess("生成成功");
const handleClear = () => {
  proxy.$modal.confirm("确定清空当前员工列表吗?").then(() => {
    employeeList.value = [];
  }).catch(() => {});
};
const handleTaxForm = () => {
  taxDialogVisible.value = true;
};
const submitForm = () => {
  formRef.value?.validate((valid) => {
    if (!valid) return;
    saveData(3); // ç¡®è®¤æäº¤ï¼ŒçŠ¶æ€ä¸º3(待审核)
  });
};
const saveDraft = () => {
  formRef.value?.validate((valid) => {
    if (!valid) return;
    saveData(1); // ä¿å­˜è‰ç¨¿ï¼ŒçŠ¶æ€ä¸º1(草稿)
  });
};
const saveData = (status) => {
  const payload = {
    id: form.value.id,
    salaryTitle: form.value.salaryTitle,
    deptIds: form.value.deptIds?.length ? form.value.deptIds.join(",") : "",
    salaryMonth: form.value.salaryMonth,
    remark: form.value.remark,
    payBank: form.value.payBank,
    auditUserId: form.value.auditUserId,
    auditUserName: auditUserName.value,
    totalSalary: totalSalary.value,
    staffSalaryDetailList: employeeList.value.map((e) => ({
      staffOnJobId: e.staffOnJobId ?? e.staffId ?? e.id,
      staffName: e.staffName,
      postName: e.postName ?? "",
      deptName: e.deptName ?? "",
      basicSalary: parseNum(e.basicSalary),
      pieceSalary: parseNum(e.pieceSalary),
      hourlySalary: parseNum(e.hourlySalary),
      otherIncome: parseNum(e.otherIncome),
      socialPersonal: parseNum(e.socialPersonal),
      fundPersonal: parseNum(e.fundPersonal),
      otherDeduct: parseNum(e.otherDeduct),
      salaryTax: parseNum(e.salaryTax),
      grossSalary: parseNum(e.grossSalary),
      deductSalary: parseNum(e.deductSalary),
      netSalary: parseNum(e.netSalary),
      remark: e.remark ?? "",
    })),
  };
  if (props.operationType === "add") {
    staffSalaryMainAdd({ ...payload, status }).then(() => {
      proxy.$modal.msgSuccess(status === 1 ? "草稿保存成功" : "提交成功");
      closeDia();
    });
  };
  const handleClear = () => {
    proxy.$modal
      .confirm("确定清空当前员工列表吗?")
      .then(() => {
        resetRecalcState();
        employeeList.value = [];
      })
      .catch(() => {});
  };
  const handleTaxForm = () => {
    taxDialogVisible.value = true;
  };
  const submitForm = () => {
    formRef.value?.validate(valid => {
      if (!valid) return;
      saveData(3); // ç¡®è®¤æäº¤ï¼ŒçŠ¶æ€ä¸º3(待审核)
  } else {
    staffSalaryMainUpdate({ ...payload, status }).then(() => {
      proxy.$modal.msgSuccess(status === 1 ? "草稿保存成功" : "提交成功");
      closeDia();
    });
  };
  }
};
  const saveDraft = () => {
    formRef.value?.validate(valid => {
      if (!valid) return;
      saveData(1); // ä¿å­˜è‰ç¨¿ï¼ŒçŠ¶æ€ä¸º1(草稿)
    });
  };
const closeDia = () => {
  dialogVisible.value = false;
  emit("close");
};
  const saveData = status => {
    const payload = {
      id: form.value.id,
      salaryTitle: form.value.salaryTitle,
      deptIds: form.value.deptIds?.length ? form.value.deptIds.join(",") : "",
      salaryMonth: form.value.salaryMonth,
      remark: form.value.remark,
      payBank: form.value.payBank,
      auditUserId: form.value.auditUserId,
      auditUserName: auditUserName.value,
      totalSalary: totalSalary.value,
      staffSalaryDetailList: employeeList.value.map(e => ({
        staffOnJobId: e.staffOnJobId ?? e.staffId ?? e.id,
        staffName: e.staffName,
        postName: e.postName ?? "",
        deptName: e.deptName ?? "",
        basicSalary: parseNum(e.basicSalary),
        pieceSalary: parseNum(e.pieceSalary),
        hourlySalary: parseNum(e.hourlySalary),
        otherIncome: parseNum(e.otherIncome),
        socialPersonal: parseNum(e.socialPersonal),
        fundPersonal: parseNum(e.fundPersonal),
        otherDeduct: parseNum(e.otherDeduct),
        socialSupplementAmount: parseNum(e.socialSupplementAmount),
        salaryTax: parseNum(e.salaryTax),
        grossSalary: parseNum(e.grossSalary),
        deductSalary: parseNum(e.deductSalary),
        netSalary: parseNum(e.netSalary),
        remark: e.remark ?? "",
      })),
    };
    if (props.operationType === "add") {
      staffSalaryMainAdd({ ...payload, status }).then(() => {
        proxy.$modal.msgSuccess(status === 1 ? "草稿保存成功" : "提交成功");
        closeDia();
      });
    } else {
      staffSalaryMainUpdate({ ...payload, status }).then(() => {
        proxy.$modal.msgSuccess(status === 1 ? "草稿保存成功" : "提交成功");
        closeDia();
      });
    }
  };
  const closeDia = () => {
    resetRecalcState();
    dialogVisible.value = false;
    emit("close");
  };
  defineExpose({ openDialog });
defineExpose({ openDialog });
</script>
<style scoped>
  .form-dia-body {
    padding: 0;
  }
  .card-title-line {
    color: #f56c6c;
    margin-right: 4px;
  }
  .form-card {
    margin-bottom: 16px;
  }
  .form-card :deep(.el-card__header) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
  }
  .card-title {
    font-weight: 500;
  }
  .card-collapse {
    color: #999;
    cursor: pointer;
  }
  .toolbar {
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .employee-table-wrap {
    position: relative;
    min-height: 120px;
  }
  .table-empty {
    text-align: center;
    padding: 24px;
    color: #999;
    font-size: 14px;
  }
  .add-person-tree {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px 0;
  }
  .tax-desc {
    margin-bottom: 12px;
    font-size: 14px;
    color: #606266;
  }
  .dialog-footer {
    text-align: right;
  }
  .salary-total {
    margin-top: 16px;
    padding: 12px 16px;
    background-color: #f5f7fa;
    border-radius: 4px;
    text-align: right;
    font-size: 16px;
  }
  .salary-total .total-label {
    color: #606266;
    margin-right: 8px;
  }
  .salary-total .total-value {
    color: #f56c6c;
    font-weight: bold;
    font-size: 18px;
  }
.form-dia-body {
  padding: 0;
}
.card-title-line {
  color: #f56c6c;
  margin-right: 4px;
}
.form-card {
  margin-bottom: 16px;
}
.form-card :deep(.el-card__header) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.card-title {
  font-weight: 500;
}
.card-collapse {
  color: #999;
  cursor: pointer;
}
.toolbar {
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.employee-table-wrap {
  position: relative;
  min-height: 120px;
}
.table-empty {
  text-align: center;
  padding: 24px;
  color: #999;
  font-size: 14px;
}
.add-person-tree {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 0;
}
.tax-desc {
  margin-bottom: 12px;
  font-size: 14px;
  color: #606266;
}
.dialog-footer {
  text-align: right;
}
.salary-total {
  margin-top: 16px;
  padding: 12px 16px;
  background-color: #f5f7fa;
  border-radius: 4px;
  text-align: right;
  font-size: 16px;
}
.salary-total .total-label {
  color: #606266;
  margin-right: 8px;
}
.salary-total .total-value {
  color: #f56c6c;
  font-weight: bold;
  font-size: 18px;
}
</style>
src/views/personnelManagement/monthlyStatistics/index.vue
@@ -107,7 +107,7 @@
  nextTick,
} from "vue";
import { ElMessageBox } from "element-plus";
import useUserStore from "@/store/modules/user";
import Cookies from "js-cookie";
import FormDia from "./components/formDia.vue";
import BankSettingDia from "./components/bankSettingDia.vue";
import AuditDia from "./components/auditDia.vue";
@@ -167,12 +167,7 @@
      {
        name: "审核",
        type: "text",
        disabled: (row) => {
          const currentUserId = Number(userStore.id);
          const auditUserId = Number(row?.auditUserId);
          // çŠ¶æ€ä¸æ˜¯å¾…å®¡æ ¸ æˆ– å½“前用户不是指定的审核人,则禁用审核按钮
          return Number(row?.status) !== 3 || !currentUserId || currentUserId !== auditUserId;
        },
        disabled: (row) => Number(row?.status) !== 3,
        clickFun: (row) => openAudit(row),
      },
      {
@@ -198,7 +193,6 @@
const operationType = ref("add");
const currentRow = ref({});
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
const bankSetting = ref({});
const bankDialogVisible = ref(false);
const bankDiaRef = ref(null);
@@ -384,8 +378,8 @@
const handleExport = () => {
  proxy.download(
    "/staffSalaryMain/export",
    { ...searchForm.value },
    "/compensationPerformance/export",
    { ...searchForm.value, current: page.current, size: page.size },
    "工资表.xlsx"
  );
};
@@ -410,4 +404,4 @@
.table_list {
  margin-top: 20px;
}
</style>
</style>
src/views/personnelManagement/socialSecuritySet/components/formDia.vue
@@ -1,31 +1,34 @@
<template>
  <div>
    <FormDialog v-model="dialogFormVisible"
                :operation-type="operationType"
                :title="dialogTitle"
                width="80%"
                @close="closeDia"
                @confirm="submitForm"
                @cancel="closeDia">
      <el-form ref="formRef"
               :model="form"
               :rules="rules"
               label-position="top">
    <FormDialog
      v-model="dialogFormVisible"
      :operation-type="operationType"
      :title="dialogTitle"
      width="80%"
      @close="closeDia"
      @confirm="submitForm"
      @cancel="closeDia"
    >
      <el-form ref="formRef" :model="form" :rules="rules" label-position="top">
        <el-row :gutter="24">
          <!-- å·¦ä¾§ï¼šé€‚用人员 -->
          <el-col :span="8">
            <el-form-item label="适用人员:"
                          prop="deptIds">
            <el-form-item label="适用人员:" prop="deptIds">
              <div class="dept-checkbox-wrap">
                <el-checkbox-group v-model="form.deptIds"
                                   :disabled="isDetail">
                  <div v-for="dept in deptList"
                       :key="dept.deptId"
                       class="dept-checkbox-item">
                <el-checkbox-group
                  v-model="form.deptIds"
                  :disabled="isDetail"
                >
                  <div
                    v-for="dept in deptList"
                    :key="dept.deptId"
                    class="dept-checkbox-item"
                  >
                    <el-checkbox :value="dept.deptId">
                      {{ dept.deptName }}
                      <span v-if="dept.personCount != null"
                            class="dept-count">{{ dept.personCount }}人</span>
                      <span v-if="dept.personCount != null" class="dept-count"
                        >{{ dept.personCount }}人</span
                      >
                    </el-checkbox>
                  </div>
                </el-checkbox-group>
@@ -35,117 +38,124 @@
          <!-- å³ä¾§ï¼šåŸºç¡€ä¿¡æ¯ + ä¿é™©ç±»åž‹ -->
          <el-col :span="16">
            <!-- åŸºç¡€ä¿¡æ¯ -->
            <el-card class="form-card"
                     shadow="never">
            <el-card class="form-card" shadow="never">
              <template #header>
                <span class="card-title"><span class="card-title-line">|</span> åŸºç¡€ä¿¡æ¯</span>
                <el-icon class="card-collapse">
                  <ArrowUp />
                </el-icon>
                <el-icon class="card-collapse"><ArrowUp /></el-icon>
              </template>
              <el-form-item label="方案标题:"
                            prop="title">
                <el-input v-model="form.title"
                          placeholder="请输入"
                          clearable
                          :disabled="isDetail" />
              <el-form-item label="方案标题:" prop="title">
                <el-input
                  v-model="form.title"
                  placeholder="请输入"
                  clearable
                  :disabled="isDetail"
                />
              </el-form-item>
              <el-form-item label="备注:"
                            prop="remark">
                <el-input v-model="form.remark"
                          type="textarea"
                          :rows="2"
                          placeholder="请输入"
                          clearable
                          :disabled="isDetail" />
              <el-form-item label="备注:" prop="remark">
                <el-input
                  v-model="form.remark"
                  type="textarea"
                  :rows="2"
                  placeholder="请输入"
                  clearable
                  :disabled="isDetail"
                />
              </el-form-item>
            </el-card>
            <!-- ä¿é™©ç±»åž‹ -->
            <el-card class="form-card"
                     shadow="never">
            <el-card class="form-card" shadow="never">
              <template #header>
                <span class="card-title"><span class="card-title-line">|</span> ä¿é™©ç±»åž‹</span>
                <el-button v-if="!isDetail"
                           type="primary"
                           size="small"
                           @click="addInsuranceBenefit">
                <el-button
                  v-if="!isDetail"
                  type="primary"
                  size="small"
                  @click="addInsuranceBenefit"
                >
                  æ·»åŠ ä¿é™©ç¦åˆ©
                </el-button>
              </template>
              <el-row :gutter="16">
                <el-col v-for="(item, index) in form.insuranceBenefits"
                        :key="item._key"
                        :span="12">
                <el-col
                  v-for="(item, index) in form.insuranceBenefits"
                  :key="item._key"
                  :span="12"
                >
                  <div class="insurance-benefit-card">
                    <div class="insurance-benefit-title">
                      ä¿é™©ç¦åˆ©{{ index + 1 }}
                      <el-button v-if="!isDetail && form.insuranceBenefits.length > 1"
                                 type="danger"
                                 link
                                 size="small"
                                 class="card-delete-btn"
                                 @click="removeInsuranceBenefit(index)">
                      <el-button
                        v-if="!isDetail && form.insuranceBenefits.length > 1"
                        type="danger"
                        link
                        size="small"
                        class="card-delete-btn"
                        @click="removeInsuranceBenefit(index)"
                      >
                        åˆ é™¤
                      </el-button>
                    </div>
                    <el-form-item :prop="'insuranceBenefits.' + index + '.insuranceType'"
                                  label="保险类型:"
                                  label-width="100px"
                                  :rules="[{ required: true, message: '请选择保险类型', trigger: 'blur' }]"
                    <el-form-item
                      :prop="'insuranceBenefits.' + index + '.insuranceType'"
                      label="保险类型:"
                      label-width="100px"
                    >
                      <el-select v-model="item.insuranceType"
                                 placeholder="请选择"
                                 clearable
                                 style="width: 100%"
                                 :disabled="isDetail">
                        <el-option v-for="opt in insuranceTypeOptions"
                                   :key="opt.value"
                                   :label="opt.label"
                                   :value="opt.value" />
                      <el-select
                        v-model="item.insuranceType"
                        placeholder="请选择"
                        clearable
                        style="width: 100%"
                        :disabled="isDetail"
                      >
                        <el-option
                          v-for="opt in insuranceTypeOptions"
                          :key="opt.value"
                          :label="opt.label"
                          :value="opt.value"
                        />
                      </el-select>
                    </el-form-item>
                    <el-form-item label="缴费基数:"
                                  label-width="100px"
                                  :prop="'insuranceBenefits.' + index + '.paymentBase'"
                                  :rules="[{ validator: validatePaymentBase, trigger: 'blur' }]">
                    <el-form-item label="缴费基数:" label-width="100px">
                      <div class="base-salary-wrap">
                        <el-input v-model="item.paymentBase"
                                  placeholder="根据基本工资缴纳"
                                  clearable
                                  style="width: 120px"
                                  type="number"
                                  :disabled="isDetail || item.useBasicSalary"
                                  @input="handlePaymentBaseInput(item)" />
                        <el-checkbox v-model="item.useBasicSalary"
                                     @change="(val) => handleUseBasicSalaryChange(item, index)"
                                     :disabled="isDetail">
                        <el-input
                          v-model="item.paymentBase"
                          placeholder="根据基本工资缴纳"
                          clearable
                          style="width: 120px"
                          type="number"
                          :disabled="isDetail || item.useBasicSalary"
                          @input="handlePaymentBaseInput(item)"
                        />
                        <el-checkbox
                          v-model="item.useBasicSalary"
                          @change="handleUseBasicSalaryChange(item)"
                          :disabled="isDetail"
                        >
                          è°ƒç”¨åŸºæœ¬å·¥èµ„
                        </el-checkbox>
                      </div>
                    </el-form-item>
                    <el-form-item label="个人缴费比例:"
                                  label-width="100px"
                                  :prop="'insuranceBenefits.' + index + '.personalRatio'"
                                  :rules="[{ required: true, message: '请输入个人缴费比例', trigger: 'blur' }]">
                    <el-form-item label="个人缴费比例:" label-width="100px">
                      <div class="personal-ratio-wrap">
                        <el-input v-model="item.personalRatio"
                                  placeholder="请输入"
                                  clearable
                                  style="width: 100px"
                                  type="number"
                                  :disabled="isDetail"
                                  :min="0"
                                  @input="handlePersonalRatioInput(item)" />
                        <el-input
                          v-model="item.personalRatio"
                          placeholder="请输入"
                          clearable
                          style="width: 100px"
                          type="number"
                          :disabled="isDetail"
                        />
                        <span class="ratio-unit">(%)</span>
                        <span class="ratio-plus">+</span>
                        <el-input v-model="item.personalFixed"
                                  placeholder="请输入"
                                  clearable
                                  style="width: 100px"
                                  type="number"
                                  :disabled="isDetail"
                                  :min="0"
                                  @input="handlePersonalFixedInput(item)" />
                        <el-input
                          v-model="item.personalFixed"
                          placeholder="请输入"
                          clearable
                          style="width: 100px"
                          type="number"
                          :disabled="isDetail"
                        />
                      </div>
                    </el-form-item>
                  </div>
@@ -160,345 +170,301 @@
</template>
<script setup>
  import {
    ref,
    reactive,
    toRefs,
    getCurrentInstance,
    nextTick,
    computed,
  } from "vue";
  import FormDialog from "@/components/Dialog/FormDialog.vue";
  import { ArrowUp } from "@element-plus/icons-vue";
  import { listDept } from "@/api/system/dept.js";
  import {
    socialSecurityAdd,
    socialSecurityUpdate,
  } from "@/api/personnelManagement/socialSecuritySet.js";
import { ref, reactive, toRefs, getCurrentInstance, nextTick, computed } from "vue";
import FormDialog from "@/components/Dialog/FormDialog.vue";
import { ArrowUp } from "@element-plus/icons-vue";
import { listDept } from "@/api/system/dept.js";
import { socialSecurityAdd, socialSecurityUpdate } from "@/api/personnelManagement/socialSecuritySet.js";
  const emit = defineEmits(["close"]);
  const { proxy } = getCurrentInstance();
const emit = defineEmits(["close"]);
const { proxy } = getCurrentInstance();
  const dialogFormVisible = ref(false);
  const operationType = ref("add");
  const formRef = ref(null);
  const deptList = ref([]);
const dialogFormVisible = ref(false);
const operationType = ref("add");
const formRef = ref(null);
const deptList = ref([]);
  const isDetail = computed(() => operationType.value === "detail");
const isDetail = computed(() => operationType.value === "detail");
  const dialogTitle = () =>
    operationType.value === "add"
      ? "新增方案"
      : operationType.value === "edit"
      ? "编辑方案"
      : "方案详情";
const dialogTitle = () =>
  operationType.value === "add"
    ? "新增方案"
    : operationType.value === "edit"
    ? "编辑方案"
    : "方案详情";
  // ä¿é™©ç±»åž‹é€‰é¡¹ï¼ˆå¯æŒ‰å­—典替换)
  const insuranceTypeOptions = [
    { label: "养老保险", value: "养老保险" },
    { label: "医疗保险", value: "医疗保险" },
    { label: "失业保险", value: "失业保险" },
    { label: "工伤保险", value: "工伤保险" },
    { label: "生育保险", value: "生育保险" },
    { label: "公积金", value: "公积金" },
  ];
// ä¿é™©ç±»åž‹é€‰é¡¹ï¼ˆå¯æŒ‰å­—典替换)
const insuranceTypeOptions = [
  { label: "养老保险", value: "养老保险" },
  { label: "医疗保险", value: "医疗保险" },
  { label: "失业保险", value: "失业保险" },
  { label: "工伤保险", value: "工伤保险" },
  { label: "生育保险", value: "生育保险" },
  { label: "公积金", value: "公积金" },
];
  const defaultBenefit = () => ({
    _key: Math.random().toString(36).slice(2),
    insuranceType: "",
    paymentBase: "",
    useBasicSalary: false,
    personalRatio: "",
    personalFixed: "",
  });
const defaultBenefit = () => ({
  _key: Math.random().toString(36).slice(2),
  insuranceType: "",
  paymentBase: "",
  useBasicSalary: false,
  personalRatio: "",
  personalFixed: "",
});
  const data = reactive({
    form: {
      id: undefined,
      title: "",
      remark: "",
      deptIds: [],
      insuranceBenefits: [defaultBenefit()],
    },
    rules: {
      title: [{ required: true, message: "请输入方案标题", trigger: "blur" }],
      deptIds: [
        {
          required: true,
          type: "array",
          min: 1,
          message: "请至少选择一个适用部门",
          trigger: "change",
        },
      ],
    },
  });
  const { form, rules } = toRefs(data);
const data = reactive({
  form: {
    id: undefined,
    title: "",
    remark: "",
    deptIds: [],
    insuranceBenefits: [defaultBenefit()],
  },
  rules: {
    title: [{ required: true, message: "请输入方案标题", trigger: "blur" }],
    deptIds: [
      {
        required: true,
        type: "array",
        min: 1,
        message: "请至少选择一个适用部门",
        trigger: "change",
      },
    ],
  },
});
const { form, rules } = toRefs(data);
  function flattenDept(tree, list = []) {
    if (!tree || !tree.length) return list;
    tree.forEach(node => {
      list.push({
        deptId: node.deptId,
        deptName: node.deptName,
        personCount: node.personCount ?? null,
      });
      if (node.children && node.children.length) {
        flattenDept(node.children, list);
      }
function flattenDept(tree, list = []) {
  if (!tree || !tree.length) return list;
  tree.forEach((node) => {
    list.push({
      deptId: node.deptId,
      deptName: node.deptName,
      personCount: node.personCount ?? null,
    });
    return list;
    if (node.children && node.children.length) {
      flattenDept(node.children, list);
    }
  });
  return list;
}
const loadDeptList = () => {
  listDept().then((res) => {
    const tree = res.data ?? [];
    deptList.value = flattenDept(tree);
  });
};
const addInsuranceBenefit = () => {
  form.value.insuranceBenefits.push(defaultBenefit());
};
const removeInsuranceBenefit = (index) => {
  form.value.insuranceBenefits.splice(index, 1);
};
const handleUseBasicSalaryChange = (item) => {
  if (item.useBasicSalary) {
    item.paymentBase = "";
  }
};
  const loadDeptList = () => {
    listDept().then(res => {
      const tree = res.data ?? [];
      deptList.value = flattenDept(tree);
    });
const handlePaymentBaseInput = (item) => {
  if (item.paymentBase !== "" && item.paymentBase != null) {
    item.useBasicSalary = false;
  }
};
const resetForm = () => {
  form.value = {
    id: undefined,
    title: "",
    remark: "",
    deptIds: [],
    insuranceBenefits: [defaultBenefit()],
  };
};
  const addInsuranceBenefit = () => {
    form.value.insuranceBenefits.push(defaultBenefit());
  };
  const removeInsuranceBenefit = index => {
    form.value.insuranceBenefits.splice(index, 1);
  };
  const handleUseBasicSalaryChange = (item, index) => {
    if (item.useBasicSalary) {
      item.paymentBase = "";
    }
    nextTick(() => {
      formRef.value?.validateField(`insuranceBenefits.${index}.paymentBase`);
    });
  };
  const handlePaymentBaseInput = item => {
    if (item.paymentBase !== "" && item.paymentBase != null) {
      item.useBasicSalary = false;
    }
  };
  const handlePersonalRatioInput = item => {
    if (item.personalRatio !== "" && item.personalRatio != null) {
      const value = Number(item.personalRatio);
      if (value < 0) {
        item.personalRatio = "";
      }
    }
  };
  const handlePersonalFixedInput = item => {
    if (item.personalFixed !== "" && item.personalFixed != null) {
      const value = Number(item.personalFixed);
      if (value < 0) {
        item.personalFixed = "";
      }
    }
  };
  const validatePaymentBase = (rule, value, callback) => {
    const match = rule.field.match(/insuranceBenefits\.(\d+)\.paymentBase/);
    if (match) {
      const index = parseInt(match[1], 10);
      const item = form.value.insuranceBenefits[index];
      if (item && !item.useBasicSalary && (!value || value === "")) {
        callback(new Error("请输入缴费基数"));
      } else {
        callback();
      }
const openDialog = (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  loadDeptList();
  resetForm();
  if ((type === "edit" || type === "detail") && row) {
    const d = row || {};
    form.value.id = d.id;
    form.value.title = d.title;
    form.value.remark = d.remark ?? "";
    // deptIds åŽç«¯å¯èƒ½æ˜¯é€—号分隔字符串或数组,这里统一转为数组并尽量还原数值类型
    if (d.deptIds) {
      form.value.deptIds = String(d.deptIds)
        .split(",")
        .filter((v) => v !== "")
        .map((v) => {
          const num = Number(v);
          return Number.isNaN(num) ? v : num;
        });
    } else {
      callback();
      form.value.deptIds = [];
    }
  };
    const detailList = d.schemeInsuranceDetailList || [];
    form.value.insuranceBenefits =
      detailList.length > 0
        ? detailList.map((b) => ({
            _key: Math.random().toString(36).slice(2),
            insuranceType: b.insuranceType || "",
            paymentBase: b.paymentBase ?? "",
            useBasicSalary: b.useBasicSalary === 2,
            personalRatio: b.personalRatio ?? "",
            personalFixed: b.personalFixed ?? "",
          }))
        : [defaultBenefit()];
  }
};
  const resetForm = () => {
    form.value = {
      id: undefined,
      title: "",
      remark: "",
      deptIds: [],
      insuranceBenefits: [defaultBenefit()],
    };
  };
  const openDialog = (type, row) => {
    operationType.value = type;
    dialogFormVisible.value = true;
    loadDeptList();
    resetForm();
    if ((type === "edit" || type === "detail") && row) {
      const d = row || {};
      form.value.id = d.id;
      form.value.title = d.title;
      form.value.remark = d.remark ?? "";
      // deptIds åŽç«¯å¯èƒ½æ˜¯é€—号分隔字符串或数组,这里统一转为数组并尽量还原数值类型
      if (d.deptIds) {
        form.value.deptIds = String(d.deptIds)
          .split(",")
          .filter(v => v !== "")
          .map(v => {
            const num = Number(v);
            return Number.isNaN(num) ? v : num;
          });
      } else {
        form.value.deptIds = [];
      }
      const detailList = d.schemeInsuranceDetailList || [];
      form.value.insuranceBenefits =
        detailList.length > 0
          ? detailList.map(b => ({
              _key: Math.random().toString(36).slice(2),
              insuranceType: b.insuranceType || "",
              paymentBase: b.paymentBase ?? "",
              useBasicSalary: b.useBasicSalary === 2,
              personalRatio: b.personalRatio ?? "",
              personalFixed: b.personalFixed ?? "",
            }))
          : [defaultBenefit()];
    }
  };
  const submitForm = () => {
    // è¯¦æƒ…模式下不提交,只关闭弹窗
    if (operationType.value === "detail") {
      closeDia();
      return;
    }
    formRef.value?.validate(valid => {
      if (!valid) return;
      const deptIds =
        Array.isArray(form.value.deptIds) && form.value.deptIds.length
          ? form.value.deptIds.join(",")
          : "";
      const schemeInsuranceDetailList = (form.value.insuranceBenefits || []).map(
        ({ _key, ...rest }) => ({
          ...rest,
          useBasicSalary: rest.useBasicSalary ? 2 : 1,
        })
      );
      const insuranceTypes = schemeInsuranceDetailList
        .map(item => item.insuranceType)
        .filter(v => v)
        .join(",");
      // éƒ¨é—¨åç§°ï¼Œå¤šä¸ªä½¿ç”¨é€—号隔开(根据选中的 deptIds ä¸Ž deptList è®¡ç®—)
      const deptNames = (deptList.value || [])
        .filter(d =>
          (form.value.deptIds || []).some(id => String(id) === String(d.deptId))
const submitForm = () => {
  // è¯¦æƒ…模式下不提交,只关闭弹窗
  if (operationType.value === "detail") {
    closeDia();
    return;
  }
  formRef.value?.validate((valid) => {
    if (!valid) return;
    const deptIds =
      Array.isArray(form.value.deptIds) && form.value.deptIds.length
        ? form.value.deptIds.join(",")
        : "";
    const schemeInsuranceDetailList = (form.value.insuranceBenefits || []).map(
      ({ _key, ...rest }) => ({
        ...rest,
        useBasicSalary: rest.useBasicSalary ? 2 : 1,
      })
    );
    const insuranceTypes = schemeInsuranceDetailList
      .map((item) => item.insuranceType)
      .filter((v) => v)
      .join(",");
    // éƒ¨é—¨åç§°ï¼Œå¤šä¸ªä½¿ç”¨é€—号隔开(根据选中的 deptIds ä¸Ž deptList è®¡ç®—)
    const deptNames = (deptList.value || [])
      .filter((d) =>
        (form.value.deptIds || []).some(
          (id) => String(id) === String(d.deptId)
        )
        .map(d => d.deptName)
        .join(",");
      const submitData = {
        id: form.value.id,
        title: form.value.title,
        remark: form.value.remark ?? "",
        deptIds,
        insuranceTypes,
        deptNames,
        schemeInsuranceDetailList,
      };
      if (operationType.value === "add") {
        socialSecurityAdd(submitData).then(() => {
          proxy.$modal.msgSuccess("新增成功");
          closeDia();
        });
      } else {
        socialSecurityUpdate(submitData).then(() => {
          proxy.$modal.msgSuccess("修改成功");
          closeDia();
        });
      }
    });
  };
      )
      .map((d) => d.deptName)
      .join(",");
    const submitData = {
      id: form.value.id,
      title: form.value.title,
      remark: form.value.remark ?? "",
      deptIds,
      insuranceTypes,
      deptNames,
      schemeInsuranceDetailList,
    };
    if (operationType.value === "add") {
      socialSecurityAdd(submitData).then(() => {
        proxy.$modal.msgSuccess("新增成功");
        closeDia();
      });
    } else {
      socialSecurityUpdate(submitData).then(() => {
        proxy.$modal.msgSuccess("修改成功");
        closeDia();
      });
    }
  });
};
  const closeDia = () => {
    proxy.resetForm?.("formRef");
    dialogFormVisible.value = false;
    emit("close");
  };
const closeDia = () => {
  proxy.resetForm?.("formRef");
  dialogFormVisible.value = false;
  emit("close");
};
  defineExpose({ openDialog });
defineExpose({ openDialog });
</script>
<style scoped>
  .card-title-line {
    color: #f56c6c;
    margin-right: 4px;
  }
  .form-card {
    margin-bottom: 16px;
  }
  .form-card :deep(.el-card__header) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
  }
  .card-title {
    font-weight: 500;
  }
  .card-collapse {
    color: #999;
    cursor: pointer;
  }
  .dept-checkbox-wrap {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px 0;
    border: 1px solid var(--el-border-color);
    border-radius: 4px;
    background: #fff;
  }
  .dept-checkbox-item {
    padding: 6px 12px;
  }
  .dept-count {
    color: #909399;
    font-size: 12px;
    margin-left: 4px;
  }
  .insurance-benefit-card {
    border: 1px solid var(--el-border-color-lighter);
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: #fafafa;
  }
  .insurance-benefit-title {
    font-size: 14px;
    margin-bottom: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .card-delete-btn {
    margin-left: auto;
  }
  .checkbox-group-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
  }
  .base-salary-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .base-salary-text {
    color: #606266;
    font-size: 14px;
  }
  .personal-ratio-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .ratio-unit,
  .ratio-plus {
    color: #606266;
    font-size: 14px;
  }
</style>
.card-title-line {
  color: #f56c6c;
  margin-right: 4px;
}
.form-card {
  margin-bottom: 16px;
}
.form-card :deep(.el-card__header) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.card-title {
  font-weight: 500;
}
.card-collapse {
  color: #999;
  cursor: pointer;
}
.dept-checkbox-wrap {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px 0;
  border: 1px solid var(--el-border-color);
  border-radius: 4px;
  background: #fff;
}
.dept-checkbox-item {
  padding: 6px 12px;
}
.dept-count {
  color: #909399;
  font-size: 12px;
  margin-left: 4px;
}
.insurance-benefit-card {
  border: 1px solid var(--el-border-color-lighter);
  border-radius: 4px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: #fafafa;
}
.insurance-benefit-title {
  font-size: 14px;
  margin-bottom: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-delete-btn {
  margin-left: auto;
}
.checkbox-group-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.base-salary-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.base-salary-text {
  color: #606266;
  font-size: 14px;
}
.personal-ratio-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ratio-unit,
.ratio-plus {
  color: #606266;
  font-size: 14px;
}
</style>
在上述文件截断后对比
src/views/procurementManagement/paymentLedger/index.vue src/views/procurementManagement/procurementLedger/detail.vue src/views/procurementManagement/procurementLedger/index.vue src/views/procurementManagement/procurementPlan/index.vue src/views/procurementManagement/procurementReport/index.vue src/views/procurementManagement/purchaseOrder/index.vue src/views/procurementManagement/purchaseReturnOrder/New.vue src/views/procurementManagement/purchaseReturnOrder/ProductList.vue src/views/procurementManagement/purchaseReturnOrder/index.vue src/views/procurementManagement/qualityInspection/index.vue src/views/productManagement/productIdentifier/index.vue src/views/productionManagement/processRoute/processRouteItem/index.vue src/views/productionManagement/productStructure/Detail/index.vue src/views/productionManagement/productStructure/StructureEdit.vue src/views/productionManagement/productStructure/index.vue src/views/productionManagement/productionOrder/components/MaterialDetailDialog.vue src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue src/views/productionManagement/productionOrder/components/MaterialSupplementDialog.vue src/views/productionManagement/productionOrder/index.vue src/views/productionManagement/productionReporting/index.vue src/views/productionManagement/productionTraceability/index.vue src/views/productionManagement/workOrder/index.vue src/views/productionManagement/workOrderEdit/index.vue src/views/productionManagement/workOrderManagement/index.vue src/views/productionPlan/productionPlan/index.vue src/views/qualityManagement/finalInspection/components/filesDia.vue src/views/qualityManagement/finalInspection/components/formDia.vue src/views/qualityManagement/finalInspection/index.vue src/views/qualityManagement/metricBinding/index.vue src/views/qualityManagement/nearExpiryReturn/index.vue src/views/qualityManagement/nonconformingManagement/components/formDia.vue src/views/qualityManagement/processInspection/components/formDia.vue src/views/qualityManagement/processInspection/index.vue src/views/qualityManagement/rawMaterialInspection/components/filesDia.vue src/views/qualityManagement/rawMaterialInspection/components/formDia.vue src/views/qualityManagement/rawMaterialInspection/index.vue src/views/reportAnalysis/PSIDataAnalysis/components/PanelHeader.vue src/views/reportAnalysis/PSIDataAnalysis/components/ProductTypeSwitch.vue src/views/reportAnalysis/PSIDataAnalysis/components/center-bottom.vue src/views/reportAnalysis/PSIDataAnalysis/components/center-center.vue src/views/reportAnalysis/PSIDataAnalysis/components/center-top.vue src/views/reportAnalysis/PSIDataAnalysis/components/left-bottom.vue src/views/reportAnalysis/PSIDataAnalysis/components/left-top.vue src/views/reportAnalysis/PSIDataAnalysis/index.vue src/views/reportAnalysis/PSIDataAnalysis/psiNavigation.js src/views/reportAnalysis/dataDashboard/components/PanelHeader.vue src/views/reportAnalysis/dataDashboard/components/basic/right-bottom.vue src/views/reportAnalysis/dataDashboard/components/basic/right-top.vue src/views/reportAnalysis/productionAnalysis/components/PanelHeader.vue src/views/reportAnalysis/productionAnalysis/components/center-bottom.vue src/views/reportAnalysis/productionAnalysis/components/center-center.vue src/views/reportAnalysis/productionAnalysis/components/center-top.vue src/views/reportAnalysis/productionAnalysis/components/left-bottom.vue src/views/reportAnalysis/productionAnalysis/components/left-top.vue src/views/reportAnalysis/productionAnalysis/components/right-bottom.vue src/views/reportAnalysis/productionAnalysis/components/right-top.vue src/views/reportAnalysis/productionAnalysis/productionNavigation.js src/views/reportAnalysis/reportManagement/index.vue src/views/safeProduction/dangerInvestigation/index.vue src/views/safeProduction/safetyTrainingAssessment/index.vue src/views/salesManagement/deliveryLedger/index.vue src/views/salesManagement/indicatorStats/index.vue src/views/salesManagement/receiptPaymentLedger/index.vue src/views/salesManagement/returnOrder/components/detailDia.vue src/views/salesManagement/returnOrder/components/formDia.vue src/views/salesManagement/returnOrder/index.vue src/views/salesManagement/salesLedger/index.vue src/views/salesManagement/salesQuotation/index.vue src/views/system/dept/index.vue src/views/system/dict/data.vue src/views/system/dict/index.vue src/views/system/menu/index.vue src/views/system/post/index.vue src/views/system/role/index.vue src/views/systemArchitecture/index.vue vite.config.js