From 769fb543015f1a90d42882a0a9f0592efa45a10e Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期一, 01 六月 2026 19:33:30 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' of http://114.132.189.42:9002/r/product-inventory-management into dev_NEW_pro
---
src/views/financialManagement/receivable/salesOut.vue | 257
src/api/procurementManagement/procurementLedger.js | 73
src/layout/index.vue | 23
src/views/basicData/parameterMaintenance/index.vue | 22
src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceFormConfigTable.js | 58
src/views/qualityManagement/rawMaterialInspection/index.vue | 790 +-
multiple/assets/favicon/RFSYfavicon.ico | 0
src/views/qualityManagement/finalInspection/index.vue | 828 ++-
src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue | 301 +
src/views/qualityManagement/processInspection/index.vue | 815 +-
src/views/collaborativeApproval/sealManagement/index.vue | 94
src/views/productionManagement/workOrderManagement/index.vue | 2
src/views/collaborativeApproval/purchaseApproval/index.vue | 23
src/views/personnelManagement/contractManagement/components/formDia.vue | 151
src/views/procurementManagement/procurementPlan/index.vue | 1194 ++--
src/views/productionManagement/productionTraceability/index.vue | 2
src/views/officeProcessAutomation/HrManage/staff-contract/components/formDia.vue | 151
multiple/assets/favicon/HQJCfavicon.ico | 0
multiple/assets/logo/CKGMLogo.png | 0
multiple/assets/favicon/RFSYLogo.png | 0
src/views/safeProduction/safetyTrainingAssessment/index.vue | 25
src/views/inventoryManagement/receiptManagement/Record.vue | 595 +-
src/components/AIChatSidebar/assistants/productionAssistant.js | 19
multiple/assets/favicon/BWSMfavicon.ico | 0
multiple/assets/logo/BWSMLogo.png | 0
multiple/assets/logo/HQJCLogo.png | 0
src/views/financialManagement/receivable/receipt.vue | 26
src/views/financialManagement/assets/fixedAssets.vue | 21
src/views/financialManagement/payable/paymentApply.vue | 48
src/components/AIChatSidebar/assistants/financeAssistant.js | 6
src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js | 78
src/views/procurementManagement/procurementLedger/index.vue | 93
src/views/financialManagement/payable/purchaseIn.vue | 2
multiple/assets/favicon/CKGMfavicon.ico | 0
src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceListSearch.js | 82
src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js | 129
src/assets/logo/XDRJ.png | 0
src/views/procurementManagement/qualityInspection/index.vue | 42
multiple/config.json | 47
src/components/AIChatSidebar/assistants/purchaseAssistant.js | 15
src/views/productionManagement/workOrder/index.vue | 2
src/views/procurementManagement/purchaseOrder/index.vue | 27
src/views/salesManagement/salesLedger/index.vue | 4763 ++++++++++----------
src/views/productManagement/productIdentifier/index.vue | 21
src/views/inventoryManagement/dispatchLog/Record.vue | 1427 +++---
src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js | 2
src/views/financialManagement/assets/intangibleAssets.vue | 21
src/views/inventoryManagement/stockManagement/Record.vue | 618 +-
src/layout/components/Sidebar/SidebarItem.vue | 107
src/views/officeProcessAutomation/ApproveManage/approve-list/index.vue | 7
src/assets/styles/sidebar.scss | 37
src/views/financialManagement/receivable/invoiceApply.vue | 29
src/views/officeProcessAutomation/ApproveManage/approve-template/useApproveTemplate.js | 15
multiple/assets/logo/XDRJ.png | 0
src/views/qualityManagement/nearExpiryReturn/index.vue | 628 +-
src/views/productionPlan/productionPlan/index.vue | 52
multiple/assets/logo/RFSYLogo.png | 0
src/views/safeProduction/dangerInvestigation/index.vue | 2
src/views/officeProcessAutomation/ApproveManage/approve-template/index.vue | 73
59 files changed, 7,524 insertions(+), 6,319 deletions(-)
diff --git a/multiple/assets/favicon/BWSMfavicon.ico b/multiple/assets/favicon/BWSMfavicon.ico
new file mode 100644
index 0000000..12c7cd0
--- /dev/null
+++ b/multiple/assets/favicon/BWSMfavicon.ico
Binary files differ
diff --git a/multiple/assets/favicon/CKGMfavicon.ico b/multiple/assets/favicon/CKGMfavicon.ico
new file mode 100644
index 0000000..7668e42
--- /dev/null
+++ b/multiple/assets/favicon/CKGMfavicon.ico
Binary files differ
diff --git a/multiple/assets/favicon/HQJCfavicon.ico b/multiple/assets/favicon/HQJCfavicon.ico
new file mode 100644
index 0000000..65e6942
--- /dev/null
+++ b/multiple/assets/favicon/HQJCfavicon.ico
Binary files differ
diff --git a/multiple/assets/favicon/RFSYLogo.png b/multiple/assets/favicon/RFSYLogo.png
new file mode 100644
index 0000000..d9eaab1
--- /dev/null
+++ b/multiple/assets/favicon/RFSYLogo.png
Binary files differ
diff --git a/multiple/assets/favicon/RFSYfavicon.ico b/multiple/assets/favicon/RFSYfavicon.ico
new file mode 100644
index 0000000..ef5b5d3
--- /dev/null
+++ b/multiple/assets/favicon/RFSYfavicon.ico
Binary files differ
diff --git a/multiple/assets/logo/BWSMLogo.png b/multiple/assets/logo/BWSMLogo.png
new file mode 100644
index 0000000..044d31c
--- /dev/null
+++ b/multiple/assets/logo/BWSMLogo.png
Binary files differ
diff --git a/multiple/assets/logo/CKGMLogo.png b/multiple/assets/logo/CKGMLogo.png
new file mode 100644
index 0000000..cfa60b2
--- /dev/null
+++ b/multiple/assets/logo/CKGMLogo.png
Binary files differ
diff --git a/multiple/assets/logo/HQJCLogo.png b/multiple/assets/logo/HQJCLogo.png
new file mode 100644
index 0000000..5e21e9c
--- /dev/null
+++ b/multiple/assets/logo/HQJCLogo.png
Binary files differ
diff --git a/multiple/assets/logo/RFSYLogo.png b/multiple/assets/logo/RFSYLogo.png
new file mode 100644
index 0000000..d9eaab1
--- /dev/null
+++ b/multiple/assets/logo/RFSYLogo.png
Binary files differ
diff --git "a/src/assets/logo/\350\212\257\345\257\274\350\275\257\344\273\266\357\274\210\346\261\237\350\213\217\357\274\211\346\234\211\351\231\220\345\205\254\345\217\270.png" b/multiple/assets/logo/XDRJ.png
similarity index 100%
copy from "src/assets/logo/\350\212\257\345\257\274\350\275\257\344\273\266\357\274\210\346\261\237\350\213\217\357\274\211\346\234\211\351\231\220\345\205\254\345\217\270.png"
copy to multiple/assets/logo/XDRJ.png
Binary files differ
diff --git a/multiple/config.json b/multiple/config.json
index c897d2f..3d2c176 100644
--- a/multiple/config.json
+++ b/multiple/config.json
@@ -12,7 +12,7 @@
"VITE_BASE_API": "http://1.15.17.182:9048",
"VITE_JAVA_API": "http://1.15.17.182:9049"
},
- "logo": "logo/Logo.png",
+ "logo": "logo/XDRJ.png",
"favicon": "favicon/favicon.ico"
},
"BTYX": {
@@ -51,6 +51,15 @@
"logo": "logo/QXYLogo.png",
"favicon": "favicon/QXYfavicon.ico"
},
+ "HQJC": {
+ "env": {
+ "VITE_APP_TITLE": "鍗庡己寤烘潗绠$悊绯荤粺",
+ "VITE_BASE_API": "http://36.134.77.64:9001",
+ "VITE_JAVA_API": "http://36.134.77.64:9000"
+ },
+ "logo": "logo/HQJCLogo.png",
+ "favicon": "favicon/HQJCfavicon.ico"
+ },
"XCDQ": {
"env": {
"VITE_APP_TITLE": "鏃櫒鐢靛櫒绠$悊绯荤粺",
@@ -59,6 +68,33 @@
},
"logo": "logo/XCDQLogo.png",
"favicon": "favicon/XCDQfavicon.ico"
+ },
+ "BWSM": {
+ "env": {
+ "VITE_APP_TITLE": "鍏淮鍟嗚锤绠$悊绯荤粺",
+ "VITE_BASE_API": "http://1.15.17.182:9070",
+ "VITE_JAVA_API": "http://1.15.17.182:9069"
+ },
+ "logo": "logo/BWSMLogo.png",
+ "favicon": "favicon/BWSMfavicon.ico"
+ },
+ "CKGM": {
+ "env": {
+ "VITE_APP_TITLE": "瀹稿悍宸ヨ锤绠$悊绯荤粺",
+ "VITE_BASE_API": "http://1.15.17.182:9072",
+ "VITE_JAVA_API": "http://1.15.17.182:9071"
+ },
+ "logo": "logo/CKGMLogo.png",
+ "favicon": "favicon/CKGMfavicon.ico"
+ },
+ "RFSY": {
+ "env": {
+ "VITE_APP_TITLE": "鐟炰赴鐩涗笟绠$悊绯荤粺",
+ "VITE_BASE_API": "http://1.15.17.182:9076",
+ "VITE_JAVA_API": "http://1.15.17.182:9075"
+ },
+ "logo": "logo/RFSYLogo.png",
+ "favicon": "favicon/RFSYfavicon.ico"
},
"ZQSY": {
"env": {
@@ -150,6 +186,15 @@
"logo": "logo/KYHGLogo.png",
"favicon": "favicon/KYHGfavicon.ico"
},
+ "JXSM": {
+ "env": {
+ "VITE_APP_TITLE": "瑗勫灒鍘挎磥閼晢璐告湁闄愬叕鍙�",
+ "VITE_BASE_API": "http://36.134.76.148:9001",
+ "VITE_JAVA_API": "http://36.134.76.148:9002"
+ },
+ "logo": "logo/JXSMLogo.png",
+ "favicon": "favicon/JXSMico.ico"
+ },
"logo": "/src/assets/logo/logo.png",
"favicon": "/public/favicon.ico"
}
\ No newline at end of file
diff --git a/src/api/procurementManagement/procurementLedger.js b/src/api/procurementManagement/procurementLedger.js
index 5f9df05..88f4ce0 100644
--- a/src/api/procurementManagement/procurementLedger.js
+++ b/src/api/procurementManagement/procurementLedger.js
@@ -66,60 +66,69 @@
});
}
-export function createPurchaseNo() {
+export function createPurchaseNo(entryDate) {
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,
- });
-}
\ No newline at end of file
+ return request({
+ url: "/purchase/ledger/getPurchaseByCode",
+ method: "get",
+ params: id,
+ });
+}
+
+export function batchGeneratePurchaseInboundSteps(query) {
+ return request({
+ url: "/purchase/ledger/batchInsertPurchaseSteps",
+ method: "post",
+ data: query,
+ });
+}
diff --git "a/src/assets/logo/\350\212\257\345\257\274\350\275\257\344\273\266\357\274\210\346\261\237\350\213\217\357\274\211\346\234\211\351\231\220\345\205\254\345\217\270.png" b/src/assets/logo/XDRJ.png
similarity index 100%
rename from "src/assets/logo/\350\212\257\345\257\274\350\275\257\344\273\266\357\274\210\346\261\237\350\213\217\357\274\211\346\234\211\351\231\220\345\205\254\345\217\270.png"
rename to src/assets/logo/XDRJ.png
Binary files differ
diff --git a/src/assets/styles/sidebar.scss b/src/assets/styles/sidebar.scss
index 685a0eb..5da0e59 100644
--- a/src/assets/styles/sidebar.scss
+++ b/src/assets/styles/sidebar.scss
@@ -216,33 +216,38 @@
& .nest-menu .el-sub-menu > .el-sub-menu__title,
& .el-sub-menu .el-menu-item {
min-width: 0 !important;
- 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;
+ 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;
transition: all 0.24s ease;
color: var(--sidebar-text);
- 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));
+ border: none !important;
+ background: transparent;
+ font-size: 13px;
&:hover {
- 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);
+ background: rgba(var(--el-color-primary-rgb, 37, 99, 235), 0.12) !important;
+ transform: translateX(4px);
}
&.is-active {
- background: var(--menu-active-bg, linear-gradient(135deg, var(--el-color-primary), var(--el-color-primary-light-3))) !important;
- background-size: 180% 180%;
+ background: rgba(var(--el-color-primary-rgb, 37, 99, 235), 0.85) !important;
color: #fff !important;
font-weight: 500;
- 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;
+ box-shadow: 0 4px 12px rgba(var(--el-color-primary-rgb, 37, 99, 235), 0.25);
}
}
+
+ // 瀛愯彍鍗曞鍣ㄦ牱寮� - 澧炲姞缂╄繘鍜岃瑙夊眰娆�
+ & .el-sub-menu .el-menu {
+ padding: 4px 0 8px;
+ margin-left: 8px;
+ border-left: 2px solid rgba(255, 255, 255, 0.08);
+ }
}
.hideSidebar {
diff --git a/src/components/AIChatSidebar/assistants/financeAssistant.js b/src/components/AIChatSidebar/assistants/financeAssistant.js
index e8df3f4..f5dd7c6 100644
--- a/src/components/AIChatSidebar/assistants/financeAssistant.js
+++ b/src/components/AIChatSidebar/assistants/financeAssistant.js
@@ -14,13 +14,15 @@
allowFileUpload: false,
emptySessionText: '鏆傛棤璐㈠姟浼氳瘽',
quickPrompts: [
+ '鏌ョ湅缁忚惀椹鹃┒鑸�',
+ '鏌ョ湅鏈湀缁忚惀椹鹃┒鑸�',
'鐢熸垚鏈懆缁忚惀鍛ㄦ姤锛堝埄娑︿笌鐜伴噾娴侊級',
'鍒嗘瀽鏈湀鍒╂鼎涓嬮檷鍘熷洜',
- '杩�30澶╁摢涓鎴峰埄娑﹁础鐚渶楂�',
- '鏌ョ湅鏈湀缁忚惀椹鹃┒鑸�',
'鏌ヨ杩�30澶╀簭鎹熻鍗�',
+ '杩�30澶╁摢涓鎴峰埄娑﹁础鐚渶楂�',
'鍒嗘瀽杩�30澶╁簱瀛樿祫閲戝崰鐢�',
'棰勬祴鏈潵3涓湀鐜伴噾娴�',
+ '鏌ヨ搴旀敹鍥炴椋庨櫓',
'鍝釜宸ュ簭鎴愭湰鏈�楂�'
]
}
diff --git a/src/components/AIChatSidebar/assistants/productionAssistant.js b/src/components/AIChatSidebar/assistants/productionAssistant.js
index fb2d737..d5b4924 100644
--- a/src/components/AIChatSidebar/assistants/productionAssistant.js
+++ b/src/components/AIChatSidebar/assistants/productionAssistant.js
@@ -14,14 +14,15 @@
allowFileUpload: false,
emptySessionText: '鏆傛棤鐢熶骇浼氳瘽',
quickPrompts: [
- '鏌ヨ鏈湀鐢熶骇璁″垝',
- '鏌ョ湅鏈�杩�10鏉″伐鍗�',
- '鏌ヨ澶嘇-01鐨勭淮淇儏鍐�',
- '鏌ヨ川閲忎笉鍚堟牸璁板綍',
- '鏌ヤ綆搴撳瓨鐗╂枡',
- '鏌ヨ繎7澶╁紓甯稿鐞�',
- '鐢熸垚鍒堕�犻璀︾湅鏉�',
- '鍒嗘瀽鏈湀鐢熶骇瀹屾垚鐜囧拰寮傚父鐜�',
- '缁欏嚭宸ュ崟閫炬湡鍜岃澶囧緟淇殑鍔炵悊寤鸿'
+ '鏌ヨ鐢熶骇鐜板満鏁版嵁',
+ '鏌ヨ鐢熶骇璁″垝鎵ц鎯呭喌',
+ '鏌ヨ宸ュ崟鎵ц鎯呭喌',
+ '鏌ヨ璁惧杩愯鎯呭喌',
+ '鏌ヨ璐ㄩ噺寮傚父鏁版嵁',
+ '鏌ヨ鐗╂枡鐩稿叧鏁版嵁',
+ '鏌ョ湅鍒堕�犻璀︾湅鏉�',
+ '鍒嗘瀽鏈湀鍒堕�犵粡钀ユ儏鍐�',
+ '鍒嗘瀽杩�7澶╃敓浜у紓甯�',
+ '鐢熸垚鍒堕�犲姙鐞嗗缓璁�'
]
}
diff --git a/src/components/AIChatSidebar/assistants/purchaseAssistant.js b/src/components/AIChatSidebar/assistants/purchaseAssistant.js
index 4f2e72c..5dd85e7 100644
--- a/src/components/AIChatSidebar/assistants/purchaseAssistant.js
+++ b/src/components/AIChatSidebar/assistants/purchaseAssistant.js
@@ -16,10 +16,15 @@
fileAnalyzeUrl: '/purchase-ai/analyze-files',
emptySessionText: '鏆傛棤閲囪喘浼氳瘽',
quickPrompts: [
- '鏈湀閲囪喘閲戦鎺掑悕鍓嶅崄鐨勭墿鏂欐湁鍝簺锛�',
- '鍝簺閲囪喘璁㈠崟杩樻湭鍏ュ簱锛�',
- '鏈�杩�7澶╀緵搴斿晢鍒拌揣寮傚父鏈夊摢浜涳紵',
- '甯垜缁熻寰呬粯娆鹃噰璐崟锛�',
- '鍒楀嚭鏈湀閲囪喘閫�璐ф儏鍐�'
+ '鏌ヨ閲囪喘鍙拌处鍒楄〃',
+ '鏌ヨ鏈�杩�10鏉¢噰璐彴璐�',
+ '缁熻鏈湀閲囪喘鏁版嵁',
+ '鏌ヨ鏈湀閲囪喘鐗╂枡閲戦鎺掕',
+ '鏌ヨ鏈叆搴撻噰璐鍗�',
+ '鏌ヨ閲囪喘鍒拌揣寮傚父',
+ '鏌ヨ寰呬粯娆鹃噰璐崟',
+ '鏌ヨ鏈湀閲囪喘閫�璐ф儏鍐�',
+ '鏌ヨ鏌愪釜閲囪喘鍙拌处璇︽儏',
+ '鍒嗘瀽渚涘簲鍟嗛噰璐噾棰濇帓鍚�'
]
}
diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue
index 003b489..3712c68 100644
--- a/src/layout/components/Sidebar/SidebarItem.vue
+++ b/src/layout/components/Sidebar/SidebarItem.vue
@@ -102,57 +102,70 @@
</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: 22px;
- height: 22px;
- margin-right: 10px;
- }
-
- .menu-title { font-size: 13px; }
- }
-}
+ :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;
+ }
+ }
+ }
+}
</style>
diff --git a/src/layout/index.vue b/src/layout/index.vue
index 500b2ab..aa1bfb5 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -11,7 +11,7 @@
class="main-container main-layout">
<div :class="{ 'fixed-header': fixedHeader, 'with-tags': showTagsView }">
<navbar @setLayout="setLayout" />
- <tags-view v-if="showTagsView" />
+ <tags-view />
</div>
<app-main />
<settings ref="settingRef" />
@@ -42,11 +42,15 @@
const sidebar = computed(() => useAppStore().sidebar);
const device = computed(() => useAppStore().device);
const needTagsView = computed(() => settingsStore.tagsView);
- const showTagsView = computed(() => needTagsView.value && tagsViewStore.visitedViews.length > 1);
+ const showTagsView = computed(
+ () => needTagsView.value && tagsViewStore.visitedViews.length > 1
+ );
const fixedHeader = computed(() => settingsStore.fixedHeader);
const aiEnabled = computed(() => Number(userStore.aiEnabled) === 1);
const showGlobalAiChat = computed(() => {
- const isIndustrialBrainRoute = String(route.path || "").startsWith("/ai-industrial-brain");
+ const isIndustrialBrainRoute = String(route.path || "").startsWith(
+ "/ai-industrial-brain"
+ );
return !isIndustrialBrainRoute && aiEnabled.value;
});
@@ -96,9 +100,16 @@
position: relative;
min-height: 100%;
width: 100%;
- background:
- radial-gradient(circle at 14% -8%, rgba(59, 130, 246, 0.14), transparent 36%),
- radial-gradient(circle at 88% -12%, rgba(56, 189, 248, 0.1), transparent 30%),
+ background: radial-gradient(
+ circle at 14% -8%,
+ rgba(59, 130, 246, 0.14),
+ transparent 36%
+ ),
+ radial-gradient(
+ circle at 88% -12%,
+ rgba(56, 189, 248, 0.1),
+ transparent 30%
+ ),
linear-gradient(165deg, #f3f7fc 0%, #eef5ff 56%, #f8fbff 100%);
&.mobile.openSidebar {
diff --git a/src/views/basicData/parameterMaintenance/index.vue b/src/views/basicData/parameterMaintenance/index.vue
index 2dbf5df..38ddd4f 100644
--- a/src/views/basicData/parameterMaintenance/index.vue
+++ b/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,6 +82,14 @@
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"
@@ -207,7 +215,8 @@
</template>
<script setup>
- import { onMounted, ref, reactive } from "vue";
+ import { onMounted, ref, reactive, computed } from "vue";
+ import dayjs from "dayjs";
import {
parameterListPage,
addParameter,
@@ -341,6 +350,7 @@
remark: "",
isRequired: 0,
paramFormat: "",
+ createTime: "",
});
const rules = reactive({
paramName: [{ required: true, message: "璇疯緭鍏ュ弬鏁板悕绉�", trigger: "blur" }],
@@ -360,6 +370,12 @@
},
},
],
+ });
+ 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);
@@ -519,6 +535,7 @@
formData.unit = "";
formData.remark = "";
formData.isRequired = 0;
+ formData.createTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
dialogVisible.value = true;
};
@@ -537,6 +554,7 @@
formData.remark = row.remark || "";
formData.paramFormat = row.paramFormat || "";
formData.isRequired = row.isRequired || 0;
+ formData.createTime = row.createTime || "";
dialogVisible.value = true;
};
diff --git a/src/views/collaborativeApproval/purchaseApproval/index.vue b/src/views/collaborativeApproval/purchaseApproval/index.vue
index b276bec..d39748f 100644
--- a/src/views/collaborativeApproval/purchaseApproval/index.vue
+++ b/src/views/collaborativeApproval/purchaseApproval/index.vue
@@ -278,7 +278,7 @@
},
rules: {
purchaseContractNumber: [
- { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ { required: false, message: "璇疯緭鍏�", trigger: "blur" },
],
projectName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
supplierId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -448,9 +448,7 @@
productData.value = [];
fileList.value = [];
if (operationType.value == "add") {
- createPurchaseNo().then(res => {
- form.value.purchaseContractNumber = res.data;
- });
+ form.value.purchaseContractNumber = "";
}
userListNoPage().then(res => {
userList.value = res.data;
@@ -521,7 +519,7 @@
}
// 鎻愪氦琛ㄥ崟
const submitForm = n => {
- proxy.$refs["formRef"].validate(valid => {
+ proxy.$refs["formRef"].validate(async valid => {
if (valid) {
if (productData.value.length > 0) {
form.value.productData = proxy.HaveJson(productData.value);
@@ -536,6 +534,21 @@
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();
diff --git a/src/views/collaborativeApproval/sealManagement/index.vue b/src/views/collaborativeApproval/sealManagement/index.vue
index 9d68848..a06f6d5 100644
--- a/src/views/collaborativeApproval/sealManagement/index.vue
+++ b/src/views/collaborativeApproval/sealManagement/index.vue
@@ -7,7 +7,6 @@
</div>
</template>
-
<!-- 鐢ㄥ嵃鐢宠绠$悊 -->
<div class="tab-content">
<el-row :gutter="20" class="mb-20 ">
@@ -45,7 +44,7 @@
:isShowPagination="true"
@pagination="paginationChange"
/>
- </div>
+ </div>
</el-card>
<!-- 鐢ㄥ嵃鐢宠瀵硅瘽妗� -->
@@ -177,6 +176,7 @@
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,34 +261,38 @@
formatData: (v) => getStatusText(v),
formatType: (v) => getStatusType(v)
},
+ { label: '瀹℃壒浜�', prop: 'approveUserName', width: 100 },
{
dataType: 'action',
label: '鎿嶄綔',
- width: 200,
+ width: 250,
fixed: 'right',
align: 'center',
operation: [
{
name: '瀹℃壒',
clickFun: (row) => approveSeal(row),
- showHide: (row) => row.status === 'pending'
+ showHide: (row) => row.status === 'pending' && Number(userStore.id) === row.approveUserId
},
{
name: '鎷掔粷',
clickFun: (row) => rejectSeal(row),
- showHide: (row) => row.status === 'pending'
+ showHide: (row) => row.status === 'pending' && Number(userStore.id) === row.approveUserId
},
- { name: '璇︽儏', clickFun: (row) => viewSealDetail(row) }
+ {
+ name: '閲嶆柊鐢宠',
+ clickFun: (row) => reapplySeal(row),
+ showHide: (row) => row.status === 'rejected' && Number(userStore.id) === row.createUser
+ },
+ { name: '璇︽儏', clickFun: (row) => viewSealDetail(row) }
]
}
])
// 鎼滅储鍗扮珷鐢宠
const searchSealApplications = () => {
- page.current=1
+ page.current = 1
getSealApplicationList()
-
- // ElMessage.success('鎼滅储瀹屾垚')
}
// 閲嶇疆鍗扮珷鐢宠鎼滅储
const resetSealSearch = () => {
@@ -297,37 +301,58 @@
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()
- addSealApplication(sealForm).then(res => {
- if(res.code == 200){
- ElMessage.success('鐢宠鎻愪氦鎴愬姛')
+ const request = sealForm.id ? updateSealApplication : addSealApplication
+ request(sealForm).then(res => {
+ if (res.code == 200) {
+ ElMessage.success(sealForm.id ? '閲嶆柊鐢宠鎴愬姛' : '鐢宠鎻愪氦鎴愬姛')
closeSealApplyDialog()
getSealApplicationList()
Object.assign(sealForm, {
- applicationNum: '',
- title: '',
- sealType: '',
- reason: '',
- approveUserId: '',
- urgency: 'normal',
- status: 'pending',
- storageBlobDTOs: []
- })
+ id: null,
+ 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: '',
@@ -383,7 +408,7 @@
}).then(() => {
row.status = 'approved'
updateSealApplication(row).then(res => {
- if(res.code == 200){
+ if (res.code == 200) {
ElMessage.success('瀹℃壒閫氳繃')
getSealApplicationList()
}
@@ -399,8 +424,9 @@
inputErrorMessage: '鎷掔粷鍘熷洜涓嶈兘涓虹┖'
}).then(({ value }) => {
row.status = 'rejected'
+ row.reason = value
updateSealApplication(row).then(res => {
- if(res.code == 200){
+ if (res.code == 200) {
ElMessage.success('宸叉嫆缁濈敵璇�')
getSealApplicationList()
}
@@ -418,13 +444,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) => {
@@ -491,4 +517,4 @@
.attachment-table {
border-radius: 4px;
}
-</style>
+</style>
\ No newline at end of file
diff --git a/src/views/financialManagement/assets/fixedAssets.vue b/src/views/financialManagement/assets/fixedAssets.vue
index 24b4cc3..95eb017 100644
--- a/src/views/financialManagement/assets/fixedAssets.vue
+++ b/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,6 +175,13 @@
</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>
@@ -189,6 +196,7 @@
<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 {
@@ -258,10 +266,17 @@
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 = {
@@ -356,16 +371,14 @@
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;
};
diff --git a/src/views/financialManagement/assets/intangibleAssets.vue b/src/views/financialManagement/assets/intangibleAssets.vue
index 4642166..9aef2bf 100644
--- a/src/views/financialManagement/assets/intangibleAssets.vue
+++ b/src/views/financialManagement/assets/intangibleAssets.vue
@@ -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">
@@ -165,6 +165,13 @@
</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="description">
<el-input v-model="form.description" type="textarea" :rows="3" placeholder="璇疯緭鍏ヨ祫浜ф弿杩�" />
</el-form-item>
@@ -182,6 +189,7 @@
<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 {
@@ -250,10 +258,17 @@
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 = {
@@ -354,16 +369,14 @@
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;
};
diff --git a/src/views/financialManagement/payable/paymentApply.vue b/src/views/financialManagement/payable/paymentApply.vue
index 3937e96..e34793f 100644
--- a/src/views/financialManagement/payable/paymentApply.vue
+++ b/src/views/financialManagement/payable/paymentApply.vue
@@ -97,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">
@@ -158,6 +158,18 @@
</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"
@@ -217,7 +229,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">
@@ -245,6 +257,17 @@
</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
@@ -330,6 +353,7 @@
<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";
@@ -407,6 +431,7 @@
bankAccount: "",
bankName: "",
remark: "",
+ createTime: "",
});
const paymentRules = {
@@ -429,6 +454,19 @@
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 = {
@@ -563,6 +601,7 @@
stockInRecordIds,
inboundBatches: formatInboundBatches(row.inboundBatches),
status: normalizeStatus(row.status),
+ createTime: row.createTime ?? "",
});
};
@@ -580,6 +619,7 @@
remark: row.remark ?? "",
status: statusOverride !== undefined ? statusOverride : normalizeStatus(row.status),
paymentAmount: Number(row.paymentAmount ?? row.amount ?? 0),
+ createTime: row.createTime,
});
const buildSubmitPayload = (forUpdate = false) => {
@@ -593,6 +633,7 @@
remark: form.remark || "",
status: 0,
paymentAmount: form.paymentAmount,
+ createTime: form.createTime,
};
if (forUpdate) {
payload.id = currentId.value;
@@ -703,6 +744,7 @@
stockInRecordIds: [],
inboundBatches: "",
status: 0,
+ createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
});
inboundBatchList.value = [];
inboundBatchOptions.value = [];
@@ -781,6 +823,7 @@
bankAccount: row.bankAccountNum ?? row.bankAccount ?? "",
bankName: row.bankAccountName ?? row.bankName ?? "",
remark: "",
+ createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
});
paymentDialogVisible.value = true;
nextTick(() => {
@@ -800,6 +843,7 @@
paymentAmount: paymentForm.paymentAmount,
paymentNumber: paymentForm.paymentNumber || "",
remark: paymentForm.remark || "",
+ createTime: paymentForm.createTime,
})
.then((res) => {
if (res.code === 200) {
diff --git a/src/views/financialManagement/payable/purchaseIn.vue b/src/views/financialManagement/payable/purchaseIn.vue
index fcb768f..532bcb4 100644
--- a/src/views/financialManagement/payable/purchaseIn.vue
+++ b/src/views/financialManagement/payable/purchaseIn.vue
@@ -98,7 +98,7 @@
slot: "inboundDate",
},
{ label: "浜у搧鍚嶇О", prop: "productName", minWidth: "140" },
- { label: "浜у搧瑙勬牸", prop: "specificationModel", minWidth: "140" },
+ { label: "瑙勬牸鍨嬪彿", prop: "specificationModel", minWidth: "140" },
{
label: "閲戦",
prop: "inboundAmount",
diff --git a/src/views/financialManagement/receivable/invoiceApply.vue b/src/views/financialManagement/receivable/invoiceApply.vue
index 31b6345..85f30b2 100644
--- a/src/views/financialManagement/receivable/invoiceApply.vue
+++ b/src/views/financialManagement/receivable/invoiceApply.vue
@@ -98,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>
@@ -189,6 +189,20 @@
</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>
@@ -253,6 +267,7 @@
<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";
@@ -524,6 +539,13 @@
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 = {
@@ -706,6 +728,7 @@
status: normalizeStatus(row.status ?? row.auditStatus),
outboundBatchNos,
outboundBatches: formatOutboundBatches(row.outboundBatches),
+ createTime: row.createTime ?? "",
});
};
@@ -714,7 +737,7 @@
isView.value = false;
dialogTitle.value = "鏂板寮�绁ㄧ敵璇�";
Object.assign(form, {
- applyCode: "KP" + Date.now().toString().slice(-8),
+ applyCode: "",
customerId: "",
outboundBatchNos: [],
outboundBatches: "",
@@ -724,6 +747,7 @@
applyDate: new Date().toISOString().split("T")[0],
content: "",
remark: "",
+ createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
});
outboundBatchList.value = [];
outboundBatchOptions.value = [];
@@ -752,6 +776,7 @@
invoiceAmount: form.amount,
taxRate: form.taxRate,
status: 0,
+ createTime: form.createTime,
};
if (forUpdate) {
payload.id = currentId.value;
diff --git a/src/views/financialManagement/receivable/receipt.vue b/src/views/financialManagement/receivable/receipt.vue
index 6ddb3fe..ae7a763 100644
--- a/src/views/financialManagement/receivable/receipt.vue
+++ b/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>
@@ -191,6 +191,17 @@
: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>
@@ -288,6 +299,7 @@
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";
@@ -379,6 +391,13 @@
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 rules = {
@@ -658,6 +677,7 @@
collectionNumber: form.receiptCode || "",
remark: form.remark || "",
stockOutRecordIds: (form.stockOutRecordIds || []).join(","),
+ createTime: form.createTime,
};
if (forUpdate) {
payload.id = currentId.value;
@@ -678,6 +698,7 @@
stockOutRecordIds,
outboundBatches: formatOutboundBatches(row.outboundBatches),
remark: row.remark ?? "",
+ createTime: row.createTime ?? "",
});
};
@@ -746,7 +767,7 @@
isView.value = false;
dialogTitle.value = "鏂板鏀舵";
Object.assign(form, {
- receiptCode: "SK" + Date.now().toString().slice(-8),
+ receiptCode: "",
customerId: "",
receiptDate: new Date().toISOString().split("T")[0],
amount: 0,
@@ -754,6 +775,7 @@
stockOutRecordIds: [],
outboundBatches: "",
remark: "",
+ createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
});
outboundBatchList.value = [];
outboundBatchOptions.value = [];
diff --git a/src/views/financialManagement/receivable/salesOut.vue b/src/views/financialManagement/receivable/salesOut.vue
index 297a82c..0e24b37 100644
--- a/src/views/financialManagement/receivable/salesOut.vue
+++ b/src/views/financialManagement/receivable/salesOut.vue
@@ -1,27 +1,33 @@
<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>
@@ -29,141 +35,146 @@
<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"
- :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",
- 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 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];
+ 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;
}
- 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 || "鏌ヨ澶辫触");
+ 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 = [];
- }
- })
- .catch(() => {
- dataList.value = [];
- })
- .finally(() => {
- tableLoading.value = false;
- });
-};
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ };
-const resetFilters = () => {
- filters.outboundBatches = "";
- filters.customerName = "";
- filters.dateRange = [];
- pagination.currentPage = 1;
- getTableData();
-};
+ const resetFilters = () => {
+ filters.outboundBatches = "";
+ filters.customerName = "";
+ filters.dateRange = [];
+ pagination.currentPage = 1;
+ getTableData();
+ };
-const changePage = ({ page, limit }) => {
- pagination.currentPage = page;
- pagination.pageSize = limit;
- getTableData();
-};
+ const changePage = ({ page, limit }) => {
+ pagination.currentPage = page;
+ pagination.pageSize = limit;
+ getTableData();
+ };
-const handleOut = () => {
- proxy.download(
- "/accountSales/exportAccountSalesOutbound",
- buildFilterParams(),
- `閿�鍞嚭搴揰${new Date().getTime()}.xlsx`
- );
-};
+ const handleOut = () => {
+ proxy.download(
+ "/accountSales/exportAccountSalesOutbound",
+ buildFilterParams(),
+ `閿�鍞嚭搴揰${new Date().getTime()}.xlsx`
+ );
+ };
-onMounted(() => {
- getTableData();
-});
+ 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>
diff --git a/src/views/inventoryManagement/dispatchLog/Record.vue b/src/views/inventoryManagement/dispatchLog/Record.vue
index fb24e40..2d7411d 100644
--- a/src/views/inventoryManagement/dispatchLog/Record.vue
+++ b/src/views/inventoryManagement/dispatchLog/Record.vue
@@ -1,71 +1,70 @@
<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>
@@ -75,792 +74,796 @@
</el-form>
</div>
<div class="actions">
- <el-button type="primary" @click="handleBatchApprove">瀹℃壒</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"
+ 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>
<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>
- <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,
-} 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";
-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,
- })
- .then((res) => {
- tableLoading.value = false;
- tableData.value = res.data.records;
- tableData.value.map((item) => {
- item.children = [];
- });
- total.value = res.data.total;
+ const paginationChange = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const getList = () => {
+ tableLoading.value = true;
+ getStockOutPage({
+ ...searchForm.value,
+ ...page,
+ topParentProductId: props.topParentProductId,
})
- .catch(() => {
- tableLoading.value = false;
- });
-};
+ .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;
+ });
+ };
-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) => {
+ // 鑾峰彇鏉ユ簮绫诲瀷閫夐」
+ const fetchStockRecordTypeOptions = () => {
+ if (props.type === "0") {
+ findAllQualifiedStockOutRecordTypeOptions().then(res => {
+ stockRecordTypeOptions.value = res.data;
+ });
+ return;
+ }
+ findAllUnQualifiedStockOutRecordTypeOptions().then(res => {
stockRecordTypeOptions.value = res.data;
});
- return;
- }
- findAllUnQualifiedStockOutRecordTypeOptions().then((res) => {
- stockRecordTypeOptions.value = res.data;
- });
-};
+ };
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
- // 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter((item) => item.id);
- console.log("selection", selectedRows.value);
-};
-const expandedRowKeys = ref([]);
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ // 杩囨护鎺夊瓙鏁版嵁
+ selectedRows.value = selection.filter(item => item.id);
+ console.log("selection", selectedRows.value);
+ };
+ 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("瀹℃壒閫氳繃澶辫触");
- });
+ 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,
})
- .catch((action) => {
- if (action === "cancel") {
- batchApproveStockOutRecords({ ids, approvalStatus: 2 })
+ .then(() => {
+ batchApproveStockOutRecords({ ids, approvalStatus: 1 })
.then(() => {
- proxy.$modal.msgSuccess("瀹℃壒椹冲洖鎴愬姛");
+ proxy.$modal.msgSuccess("瀹℃壒閫氳繃鎴愬姛");
getList();
})
.catch(() => {
- proxy.$modal.msgError("瀹℃壒椹冲洖澶辫触");
+ 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(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",
})
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
-};
+ .then(() => {
+ proxy.download(
+ "/stockOutRecord/exportStockOutRecord",
+ { type: props.type },
+ props.type === "0" ? "鍚堟牸鍑哄簱鍙拌处.xlsx" : "涓嶅悎鏍煎嚭搴撳彴璐�.xlsx"
+ );
+ })
+ .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 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 executePrint = () => {
- console.log("寮�濮嬫墽琛屾墦鍗帮紝鏁版嵁鏉℃暟:", printData.value.length);
- console.log("鎵撳嵃鏁版嵁:", printData.value);
+ // 鎵撳嵃鍔熻兘
+ const handlePrint = () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨瑕佹墦鍗扮殑鏁版嵁");
+ return;
+ }
+ printData.value = [...selectedRows.value];
+ console.log("鎵撳嵃鏁版嵁:", printData.value);
+ printPreviewVisible.value = true;
+ };
- // 鍒涘缓涓�涓柊鐨勬墦鍗扮獥鍙�
- const printWindow = window.open("", "_blank", "width=800,height=600");
+ // 鎵ц鎵撳嵃
+ const executePrint = () => {
+ console.log("寮�濮嬫墽琛屾墦鍗帮紝鏁版嵁鏉℃暟:", printData.value.length);
+ console.log("鎵撳嵃鏁版嵁:", printData.value);
- // 鏋勫缓鎵撳嵃鍐呭
- 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 {
+ // 鍒涘缓涓�涓柊鐨勬墦鍗扮獥鍙�
+ const printWindow = window.open("", "_blank", "width=800,height=600");
+
+ // 鏋勫缓鎵撳嵃鍐呭
+ 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 {
- margin: 0;
- padding: 10mm;
- /* padding-left: 20mm; */
- page-break-inside: avoid;
- page-break-after: always;
- }
+ .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;
}
- }
- </style>
- </head>
- <body>
- `;
+ .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>
+ `;
- // 涓烘瘡鏉℃暟鎹敓鎴愭墦鍗伴〉闈�
- 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>
+ // 涓烘瘡鏉℃暟鎹敓鎴愭墦鍗伴〉闈�
+ 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>
</div>
- <div>
- <span class="label">瀹㈡埛鍚嶇О锛�</span>
- <span class="value">${item.supplierName}</span>
+ <div class="info-row">
+ <span class="label">鍗曞彿锛�</span>
+ <span class="value">${item.code || ""}</span>
</div>
</div>
- <div class="info-row">
- <span class="label">鍗曞彿锛�</span>
- <span class="value">${item.code || ""}</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>
-
- <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-row">
- <div class="footer-item">
- <span class="label">鎿嶄綔鍛橈細</span>
- <span class="value">${userStore.nickName || "鎾曞紑鍓�"}</span>
+
+ <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>
- <div class="footer-item">
- <span class="label">鎵撳嵃鏃ユ湡锛�</span>
- <span class="value">${formatDateTime(new Date())}</span>
+ <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>
</div>
- </div>
+ `;
+ });
+
+ 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();
});
- 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();
- }
-);
+ 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-container {
- .print-preview-header {
- padding: 15px;
- border-bottom: 1px solid #e4e7ed;
- text-align: center;
-
- .el-button {
- margin: 0 10px;
+ .print-preview-dialog {
+ .el-dialog__body {
+ padding: 0;
+ max-height: 80vh;
+ overflow-y: auto;
}
}
- .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 {
- 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;
+ .print-preview-container {
+ .print-preview-header {
+ padding: 15px;
+ border-bottom: 1px solid #e4e7ed;
text-align: center;
- font-size: 14px;
- line-height: 1.4;
+
+ .el-button {
+ margin: 0 10px;
+ }
}
- th {
+ .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 {
+ text-align: center;
+ margin-bottom: 8px;
+
+ .company-name {
+ font-size: 18px;
font-weight: bold;
+ margin-bottom: 4px;
}
- .total-label {
- text-align: right;
- font-weight: bold;
- }
-
- .total-value {
+ .document-title {
+ font-size: 16px;
font-weight: bold;
}
}
-}
-.footer-section {
- .footer-row {
+ .info-section {
+ margin-bottom: 8px;
display: flex;
- margin-bottom: 3px;
- line-height: 20px;
justify-content: space-between;
+ align-items: center;
- .footer-item {
- display: flex;
- margin-right: 20px;
+ .info-row {
+ line-height: 20px;
.label {
font-weight: bold;
- width: 80px;
+ width: 60px;
font-size: 14px;
}
.value {
+ margin-right: 20px;
min-width: 80px;
font-size: 14px;
}
+ }
+ }
- &.address-item {
- .address-value {
- min-width: 200px;
+ .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;
+ }
}
}
}
}
-}
-@media print {
- .app-container {
- display: none;
+ @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;
+ }
}
- .print-page {
- box-shadow: none;
- margin: 0;
- padding: 10mm;
- padding-left: 20mm;
- page-break-inside: avoid;
- page-break-after: always;
+ .actions {
+ display: flex;
+ justify-content: flex-end;
+ margin-bottom: 10px;
}
- .print-page:last-child {
- page-break-after: avoid;
- }
-}
-
-.actions {
- display: flex;
- justify-content: flex-end;
- margin-bottom: 10px;
-}
</style>
diff --git a/src/views/inventoryManagement/receiptManagement/Record.vue b/src/views/inventoryManagement/receiptManagement/Record.vue
index 3fce379..0a01def 100644
--- a/src/views/inventoryManagement/receiptManagement/Record.vue
+++ b/src/views/inventoryManagement/receiptManagement/Record.vue
@@ -1,49 +1,52 @@
<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="璇烽�夋嫨"
@@ -51,17 +54,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>
@@ -95,36 +98,36 @@
<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/>
+ show-overflow-tooltip />
<el-table-column label="鍏ュ簱鏃堕棿"
prop="createTime"
- show-overflow-tooltip/>
+ show-overflow-tooltip />
<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/>
+ 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>
@@ -132,12 +135,11 @@
{{ 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>
@@ -146,7 +148,8 @@
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>
@@ -157,305 +160,355 @@
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";
-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 === 276 || topParentProductId === 278;
+ });
-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})
+ batchApproveStockInRecords({ ids, approvalStatus: 1 })
+ .then(() => {
+ proxy.$modal.msgSuccess("瀹℃壒閫氳繃鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ proxy.$modal.msgError("瀹℃壒閫氳繃澶辫触");
+ });
+ })
+ .catch(action => {
+ if (action === "cancel") {
+ batchApproveStockInRecords({ ids, approvalStatus: 2 })
.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(() => {
- getList();
- fetchStockRecordTypeOptions();
-});
-
-watch(
- () => props.topParentProductId,
- () => {
- page.current = 1;
+ onMounted(() => {
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>
diff --git a/src/views/inventoryManagement/stockManagement/Record.vue b/src/views/inventoryManagement/stockManagement/Record.vue
index dee5e66..934ae06 100644
--- a/src/views/inventoryManagement/stockManagement/Record.vue
+++ b/src/views/inventoryManagement/stockManagement/Record.vue
@@ -1,44 +1,44 @@
<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-form-item>
- <el-button type="primary" @click="getList">
+ <el-button type="primary"
+ @click="getList">
鎼滅储
</el-button>
-
<el-button @click="resetSearch">
閲嶇疆
</el-button>
@@ -47,337 +47,313 @@
</el-row>
</el-form>
<div>
- <el-button type="primary" @click="isShowNewModal = true"
- >鏂板搴撳瓨</el-button
- >
- <el-button
- type="info"
- plain
- icon="Upload"
- @click="isShowImportModal = true"
- >
+ <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" />
<!-- 鍐荤粨/瑙e喕搴撳瓨-->
- <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);
-// 鏄惁鏄剧ず鍐荤粨/瑙e喕寮规
-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);
+ // 鏄惁鏄剧ず鍐荤粨/瑙e喕寮规
+ 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();
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ 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鎴栬鏍煎瀷鍙稩D");
+ 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";
+ };
+
+ // 鐐瑰嚮瑙e喕
+ 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",
})
- .catch(() => {
- tableLoading.value = false;
- });
-};
+ .then(() => {
+ proxy.download(
+ "/stockInventory/exportStockInventory",
+ { topParentProductId: props.productId },
+ "搴撳瓨淇℃伅.xlsx"
+ );
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
-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鎴栬鏍煎瀷鍙稩D");
- 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";
-};
-
-// 鐐瑰嚮瑙e喕
-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();
-});
+ 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>
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
index 938a787..e2f1e45 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/approveListConstants.js
@@ -1,21 +1,7 @@
-import {
- createEmptyNode,
- formatDisplayTime,
- mapNodesFromApi,
- mapSignModeFromApi,
- mapSignModeToApi,
- normalizeFlowNodes,
- nodeSignModeLabel,
-} from "../approve-template/approveTemplateConstants.js";
+import { createEmptyNode, formatDisplayTime, mapNodesFromApi, mapSignModeFromApi, mapSignModeToApi, normalizeFlowNodes, nodeSignModeLabel } from "../approve-template/approveTemplateConstants.js";
import { buildFormPayloadFromFields, parseFormConfigToData } from "../approve-template/formConfigUtils.js";
-import {
- isDynamicOptionSource,
- resolveSelectDisplayLabel,
-} from "../approve-template/selectOptionSource.js";
-import {
- appendDotNotationQuery,
- buildApprovalInstanceSearchDto,
-} from "../approve-shared/approvalInstanceListSearch.js";
+import { isDynamicOptionSource, resolveSelectDisplayLabel } from "../approve-template/selectOptionSource.js";
+import { appendDotNotationQuery, buildApprovalInstanceSearchDto } from "../approve-shared/approvalInstanceListSearch.js";
/** 瀹℃壒绫诲瀷锛堜笌鍚庣瀛楁 approvalType 瀵归綈锛屽悗鏈熷彲鍚屾锛� */
export const APPROVAL_TYPE_OPTIONS = [
@@ -80,24 +66,11 @@
if (upper === "APPROVED" || upper === "APPROVE" || upper === "PASS" || upper === "AGREE") {
return "approved";
}
- if (
- upper === "REJECTED" ||
- upper === "REJECT" ||
- upper === "REFUSE" ||
- upper === "REFUSED" ||
- upper === "DENIED"
- ) {
+ if (upper === "REJECTED" || upper === "REJECT" || upper === "REFUSE" || upper === "REFUSED" || upper === "DENIED") {
return "rejected";
}
if (upper === "CANCELLED" || upper === "CANCEL" || upper === "REVOKED") return "cancelled";
- if (
- upper === "PENDING" ||
- upper === "IN_PROGRESS" ||
- upper === "PROCESSING" ||
- upper === "RUNNING" ||
- upper === "WAIT" ||
- upper === "WAITING"
- ) {
+ if (upper === "PENDING" || upper === "IN_PROGRESS" || upper === "PROCESSING" || upper === "RUNNING" || upper === "WAIT" || upper === "WAITING") {
return "pending";
}
if (s.includes("鑽夌")) return "draft";
@@ -134,13 +107,9 @@
}
const tasks = row.tasks;
if (Array.isArray(tasks) && tasks.length) {
- const rejected = tasks.some((t) =>
- normalizeApprovalStatusKey(t?.status ?? t?.taskStatus) === "rejected"
- );
+ const rejected = tasks.some(t => normalizeApprovalStatusKey(t?.status ?? t?.taskStatus) === "rejected");
if (rejected) return "REJECTED";
- const allApproved = tasks.every((t) =>
- normalizeApprovalStatusKey(t?.status ?? t?.taskStatus) === "approved"
- );
+ const allApproved = tasks.every(t => normalizeApprovalStatusKey(t?.status ?? t?.taskStatus) === "approved");
if (allApproved) return "APPROVED";
}
return "";
@@ -175,7 +144,7 @@
/** 鍚庣 records 鈫� 鏃堕棿绾垮睍绀虹粨鏋� */
export function mapRecordsFromApi(records) {
const list = Array.isArray(records) ? records : [];
- return list.map((r) => ({
+ return list.map(r => ({
id: r.id,
operatorName: r.approverName || r.operatorName || r.createUserName || "",
result: mapRecordResultFromApi(r.approveAction ?? r.action ?? r.status),
@@ -198,7 +167,7 @@
const list = Array.isArray(tasks) ? tasks : [];
if (!list.length) return [];
const byLevel = new Map();
- list.forEach((t) => {
+ list.forEach(t => {
const level = Number(t.levelNo ?? t.taskLevel ?? t.nodeOrder ?? 1);
if (!byLevel.has(level)) {
byLevel.set(level, {
@@ -226,16 +195,14 @@
node.signMode = mapSignModeFromApi(t.approveType);
}
});
- return [...byLevel.entries()]
- .sort(([a], [b]) => a - b)
- .map(([, node]) => node);
+ return [...byLevel.entries()].sort(([a], [b]) => a - b).map(([, node]) => node);
}
/** 椤甸潰 flowNodes 鈫� 鍚庣 tasks */
export function mapFlowNodesToTasks(flowNodes, { instanceId, templateId } = {}) {
const nodes = normalizeFlowNodes(flowNodes);
const tasks = [];
- nodes.forEach((n) => {
+ nodes.forEach(n => {
const levelNo = n.nodeOrder ?? 1;
const approveType = mapSignModeToApi(n.signMode);
n.approvers.forEach((a, idx) => {
@@ -278,7 +245,7 @@
return String(val);
}
if (field?.type === "select" && field.options?.length) {
- const hit = field.options.find((o) => String(o.value) === String(val));
+ const hit = field.options.find(o => String(o.value) === String(val));
return hit?.label || String(val);
}
if (Array.isArray(val)) return val.join(" 鑷� ");
@@ -298,8 +265,8 @@
};
if (!fields.length && Object.keys(formPayload).length) {
fields = Object.keys(formPayload)
- .filter((k) => k && k !== "summary")
- .map((k) => ({
+ .filter(k => k && k !== "summary")
+ .map(k => ({
key: k,
label: k,
type: guessFieldTypeFromValue(formPayload[k]),
@@ -366,11 +333,7 @@
export function buildInstanceDto({ submitForm, activeTemplate, userStore, flowNodes, existingRow }) {
const payload = submitForm?.formPayload || {};
const tpl = activeTemplate || {};
- const title =
- String(payload.summary || payload.title || "").trim() ||
- tpl.label ||
- submitForm?.templateName ||
- "瀹℃壒鐢宠";
+ const title = String(payload.summary || payload.title || "").trim() || tpl.label || submitForm?.templateName || "瀹℃壒鐢宠";
const templateId = submitForm?.templateId || tpl.templateId;
const instanceId = existingRow?.id ?? submitForm?.instanceId;
const taskList = mapFlowNodesToTasks(flowNodes || submitForm?.flowNodes, {
@@ -388,20 +351,13 @@
tasks: taskList,
};
- const attachments =
- (Array.isArray(submitForm?.storageBlobDTOs) && submitForm.storageBlobDTOs.length
- ? submitForm.storageBlobDTOs
- : null) || tpl.storageBlobDTOs;
+ const attachments = (Array.isArray(submitForm?.storageBlobDTOs) && submitForm.storageBlobDTOs.length ? submitForm.storageBlobDTOs : null) || tpl.storageBlobDTOs;
if (attachments?.length) dto.storageBlobDTOs = attachments;
if (isUpdate) {
dto.id = existingRow?.id ?? submitForm?.instanceId;
dto.instanceNo = existingRow?.instanceNo ?? submitForm?.instanceNo ?? "";
- dto.status =
- submitForm?.saveStatusApi ||
- existingRow?.statusRaw ||
- mapInstanceStatusToApi(existingRow?.approvalStatus) ||
- "PENDING";
+ dto.status = submitForm?.saveStatusApi || existingRow?.statusRaw || mapInstanceStatusToApi(existingRow?.approvalStatus) || "PENDING";
dto.currentLevel = existingRow?.currentLevel ?? submitForm?.currentLevel ?? 1;
dto.applicantId = existingRow?.applicantId ?? existingRow?.applicantNo;
dto.applicantName = existingRow?.applicantName || "";
@@ -440,7 +396,7 @@
/** 椤甸潰 approvalStatus 鈫� 鍚庣 status */
export function mapInstanceStatusToApi(approvalStatus) {
const key = normalizeApprovalStatusKey(approvalStatus);
- const hit = APPROVAL_STATUS_OPTIONS.find((x) => x.value === key);
+ const hit = APPROVAL_STATUS_OPTIONS.find(x => x.value === key);
return hit?.api || "PENDING";
}
@@ -463,9 +419,7 @@
const resolved = resolveInstanceFormFields(row);
const { fields, formPayload, templateSnapshot } = resolved;
const tasks = Array.isArray(row.tasks) ? row.tasks : [];
- const flowNodes = tasks.length
- ? mapTasksToFlowNodes(tasks)
- : mapNodesFromApi(row.nodes || row.flowNodes);
+ const flowNodes = tasks.length ? mapTasksToFlowNodes(tasks) : mapNodesFromApi(row.nodes || row.flowNodes);
const approvalRecords = mapRecordsFromApi(row.records);
return {
id: row.id,
@@ -496,12 +450,16 @@
templateSnapshot,
tasks,
records: Array.isArray(row.records) ? row.records : [],
+ storageBlobVOList: row.storageBlobVOList || [],
+ storageBlobDTOs: row.storageBlobVOList || row.storageBlobDTOs || [],
flowNodes,
approvalFlowNodes: [],
currentNodeIndex: 0,
approvalRecords,
- rejectReason:
- approvalRecords.find((r) => r.result === "rejected")?.opinion || "",
+ rejectReason: approvalRecords.find(r => r.result === "rejected")?.opinion || "",
+ purchaseContractNumber: row.purchaseContractNumber || "",
+ quotationNo: row.quotationNo || "",
+ shippingNo: row.shippingNo || "",
};
}
@@ -524,12 +482,7 @@
};
}
-export function buildApprovalInstanceListParams({
- page,
- searchForm,
- businessType,
- extraParams,
-}) {
+export function buildApprovalInstanceListParams({ page, searchForm, businessType, extraParams }) {
const dto = buildApprovalInstanceSearchDto(searchForm, extraParams);
const bizType = businessType ?? searchForm?.businessType;
if (bizType != null && bizType !== "") {
@@ -548,11 +501,11 @@
}
export function approvalTypeLabel(v) {
- return APPROVAL_TYPE_OPTIONS.find((x) => x.value === v)?.label || v || "鈥�";
+ return APPROVAL_TYPE_OPTIONS.find(x => x.value === v)?.label || v || "鈥�";
}
export function approvalTypeStyle(v) {
- const hit = APPROVAL_TYPE_OPTIONS.find((x) => x.value === v);
+ const hit = APPROVAL_TYPE_OPTIONS.find(x => x.value === v);
if (!hit) return {};
return {
backgroundColor: hit.cellBg,
@@ -563,7 +516,7 @@
export function approvalStatusLabel(v) {
const key = normalizeApprovalStatusKey(v);
- return APPROVAL_STATUS_OPTIONS.find((x) => x.value === key)?.label || "鈥�";
+ return APPROVAL_STATUS_OPTIONS.find(x => x.value === key)?.label || "鈥�";
}
/** 涓氬姟鐢宠椤电姸鎬佹枃妗堬細PENDING鈫掕繘琛屼腑 APPROVED鈫掑凡瀹屾垚 REJECTED鈫掑凡椹冲洖 */
@@ -582,9 +535,7 @@
* 杩涜涓�(PENDING)銆佸凡瀹屾垚(APPROVED) 涓嶅彲淇敼锛涘凡椹冲洖銆佸凡鎾ら攢绛夊彲淇敼
*/
export function canEditBusinessInstanceRow(row) {
- const key = normalizeApprovalStatusKey(
- row?.approvalStatus ?? row?.statusRaw ?? row?.status
- );
+ const key = normalizeApprovalStatusKey(row?.approvalStatus ?? row?.statusRaw ?? row?.status);
return key !== "pending" && key !== "approved";
}
@@ -609,12 +560,8 @@
/** 鍒楄〃琛� 鈫� 缂栬緫琛ㄥ崟锛堜粎鐢ㄨ鏁版嵁鍥炴樉锛� */
export function buildEditFormFromInstanceRow(row) {
const { fields, formPayload, templateSnapshot } = resolveInstanceFormFields(row);
- const normalized = normalizeFlowNodes(
- row?.flowNodes?.length ? row.flowNodes : mapTasksToFlowNodes(row?.tasks)
- );
- const flowNodes = normalized.length
- ? JSON.parse(JSON.stringify(normalized))
- : [createEmptyNode(1)];
+ const normalized = normalizeFlowNodes(row?.flowNodes?.length ? row.flowNodes : mapTasksToFlowNodes(row?.tasks));
+ const flowNodes = normalized.length ? JSON.parse(JSON.stringify(normalized)) : [createEmptyNode(1)];
return {
templateKey: String(row?.templateId || ""),
@@ -631,9 +578,7 @@
formPayload,
flowNodes,
templateAttachments: initTemplateAttachmentsFromSnapshot(templateSnapshot),
- storageBlobDTOs: row?.storageBlobDTOs?.length
- ? JSON.parse(JSON.stringify(row.storageBlobDTOs))
- : [],
+ storageBlobDTOs: (row?.storageBlobDTOs?.length ? row.storageBlobDTOs : row?.storageBlobVOList || []).map(f => JSON.parse(JSON.stringify(f))),
};
}
@@ -641,9 +586,7 @@
const tpl = templateOverride || null;
const payload = tpl?.fields?.length ? buildFormPayloadFromFields(tpl.fields) : { summary: "" };
const normalized = normalizeFlowNodes(flowNodesOverride);
- const flowNodes = normalized.length
- ? JSON.parse(JSON.stringify(normalized))
- : [createEmptyNode(1)];
+ const flowNodes = normalized.length ? JSON.parse(JSON.stringify(normalized)) : [createEmptyNode(1)];
return {
templateKey: templateKey || "",
templateId: tpl?.templateId || "",
@@ -658,9 +601,7 @@
formFieldDefs: tpl?.fields || [],
formPayload: payload,
flowNodes,
- templateAttachments: tpl?.storageBlobDTOs
- ? JSON.parse(JSON.stringify(tpl.storageBlobDTOs))
- : [],
+ templateAttachments: tpl?.storageBlobDTOs ? JSON.parse(JSON.stringify(tpl.storageBlobDTOs)) : [],
storageBlobDTOs: [],
};
}
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue b/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue
index f54c167..b9eb42f 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/components/ApproveDetailPanel.vue
@@ -3,83 +3,284 @@
<div class="approve-detail-panel">
<div class="detail-block">
<div class="detail-block-title">鍩烘湰淇℃伅</div>
- <el-descriptions :column="2" border>
+ <el-descriptions :column="2"
+ border>
<el-descriptions-item label="涓氬姟鍗曞彿">{{ row.bizId || row.id || "鈥�" }}</el-descriptions-item>
<el-descriptions-item label="瀹℃壒鐘舵��">
- <el-tag :type="approvalStatusTagType(row.approvalStatus)" size="small" effect="plain">
+ <el-tag :type="approvalStatusTagType(row.approvalStatus)"
+ size="small"
+ effect="plain">
{{ approvalStatusLabel(row.approvalStatus) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="瀹℃壒绫诲瀷">
- <span class="approve-type-cell" :style="approvalTypeStyle(row.approvalType)">
+ <span class="approve-type-cell"
+ :style="approvalTypeStyle(row.approvalType)">
{{ approvalTypeLabel(row.approvalType) }}
</span>
</el-descriptions-item>
<el-descriptions-item label="鐢宠浜虹紪鍙�">{{ row.applicantNo || "鈥�" }}</el-descriptions-item>
<el-descriptions-item label="鐢宠浜哄悕绉�">{{ row.applicantName || "鈥�" }}</el-descriptions-item>
<el-descriptions-item label="鐢宠鎽樿">{{ row.summary || "鈥�" }}</el-descriptions-item>
- <el-descriptions-item v-if="row.rejectReason" label="椹冲洖鍘熷洜" :span="2">
+ <el-descriptions-item v-if="row.rejectReason"
+ label="椹冲洖鍘熷洜"
+ :span="2">
<span class="reject-text">{{ row.rejectReason }}</span>
</el-descriptions-item>
- <el-descriptions-item label="鍒涘缓鏃堕棿" :span="2">
+ <el-descriptions-item label="鍒涘缓鏃堕棿"
+ :span="2">
{{ formatDisplayTime(row.createTime) }}
</el-descriptions-item>
</el-descriptions>
</div>
-
<div class="detail-block">
<div class="detail-block-title">濉姤鍐呭</div>
- <FormPayloadFields
- :fields="formResolved.fields"
- :form-payload="formResolved.formPayload"
- readonly
- />
+ <!-- 榛樿琛ㄥ崟灞曠ず -->
+ <FormPayloadFields v-if="!isSpecialApprovalType"
+ :fields="formResolved.fields"
+ :form-payload="formResolved.formPayload"
+ readonly />
+
+ <!-- 鍙戣揣瀹℃壒璇︽儏 -->
+ <template v-else-if="row.businessType === 7">
+ <div v-if="detailData.shippingInfo" class="shipment-detail">
+ <el-divider content-position="left">鍙戣揣璇︽儏</el-divider>
+ <el-descriptions :column="2" border>
+ <el-descriptions-item label="閿�鍞鍗�">{{ detailData.shippingInfo.salesContractNo || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="鍙戣揣璁㈠崟鍙�">{{ detailData.shippingInfo.shippingNo || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ detailData.shippingInfo.customerName || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="鍙戣揣绫诲瀷">{{ detailData.shippingInfo.type || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="鍙戣揣鏃ユ湡">{{ detailData.shippingInfo.shippingDateDate || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="瀹℃牳鐘舵��">{{ detailData.shippingInfo.status || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="鍙戣揣杞︾墝鍙�">{{ detailData.shippingInfo.shippingCarNumber || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="蹇�掑叕鍙�">{{ detailData.shippingInfo.expressCompany || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="蹇�掑崟鍙�" :span="2">{{ detailData.shippingInfo.expressNumber || "--" }}</el-descriptions-item>
+ </el-descriptions>
+ <div v-if="detailData.shippingProductDetailDtoList.length" style="margin-top: 20px;">
+ <h4>浜у搧鏄庣粏</h4>
+ <el-table :data="detailData.shippingProductDetailDtoList"
+ border
+ size="small"
+ style="width: 100%">
+ <el-table-column label="鎵瑰彿" prop="batchNo" min-width="160" show-overflow-tooltip />
+ <el-table-column label="浜у搧鍚嶇О" prop="productName" min-width="160" show-overflow-tooltip />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" min-width="160" show-overflow-tooltip />
+ <el-table-column label="鍙戣揣鏁伴噺" prop="deliveryQuantity" min-width="120" align="center" />
+ </el-table>
+ </div>
+ </div>
+ </template>
+
+ <!-- 閲囪喘瀹℃壒璇︽儏 -->
+ <template v-else-if="row.businessType === 5">
+ <div v-if="detailData" class="procurement-detail">
+ <el-divider content-position="left">閲囪喘璇︽儏</el-divider>
+ <el-descriptions :column="2" border>
+ <el-descriptions-item label="閲囪喘鍚堝悓鍙�">{{ detailData.purchaseContractNumber || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="渚涘簲鍟嗗悕绉�">{{ detailData.supplierName || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰鍚嶇О">{{ detailData.projectName || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="閿�鍞悎鍚屽彿">{{ detailData.salesContractNo || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="绛捐鏃ユ湡">{{ detailData.executionDate || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="褰曞叆鏃ユ湡">{{ detailData.entryDate || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="浠樻鏂瑰紡">{{ detailData.paymentMethod || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="鍚堝悓閲戦" :span="2">
+ <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">
+ 楼{{ Number(detailData.contractAmount ?? 0).toFixed(2) }}
+ </span>
+ </el-descriptions-item>
+ </el-descriptions>
+ <div v-if="detailData.productData.length" style="margin-top: 20px;">
+ <h4>浜у搧鏄庣粏</h4>
+ <el-table :data="detailData.productData"
+ border
+ style="width: 100%">
+ <el-table-column prop="productCategory" label="浜у搧鍚嶇О" />
+ <el-table-column prop="specificationModel" label="瑙勬牸鍨嬪彿" />
+ <el-table-column prop="unit" label="鍗曚綅" />
+ <el-table-column prop="quantity" label="鏁伴噺" />
+ <el-table-column prop="taxInclusiveUnitPrice" label="鍚◣鍗曚环">
+ <template #default="scope">楼{{ Number(scope.row.taxInclusiveUnitPrice ?? 0).toFixed(2) }}</template>
+ </el-table-column>
+ <el-table-column prop="taxInclusiveTotalPrice" label="鍚◣鎬讳环">
+ <template #default="scope">楼{{ Number(scope.row.taxInclusiveTotalPrice ?? 0).toFixed(2) }}</template>
+ </el-table-column>
+ </el-table>
+ </div>
+ </div>
+ </template>
+
+ <!-- 鎶ヤ环瀹℃壒璇︽儏 -->
+ <template v-else-if="row.businessType === 6">
+ <div v-if="detailData" class="quotation-detail">
+ <el-divider content-position="left">鎶ヤ环璇︽儏</el-divider>
+ <el-descriptions :column="2" border>
+ <el-descriptions-item label="鎶ヤ环鍗曞彿">{{ detailData.quotationNo || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ detailData.customer || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="涓氬姟鍛�">{{ detailData.salesperson || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="鎶ヤ环鏃ユ湡">{{ detailData.quotationDate || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="鏈夋晥鏈熻嚦">{{ detailData.validDate || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="浠樻鏂瑰紡">{{ detailData.paymentMethod || "--" }}</el-descriptions-item>
+ <el-descriptions-item label="鎶ヤ环鎬婚" :span="2">
+ <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">
+ 楼{{ Number(detailData.totalAmount ?? 0).toFixed(2) }}
+ </span>
+ </el-descriptions-item>
+ </el-descriptions>
+ <div v-if="detailData.products.length" style="margin-top: 20px;">
+ <h4>浜у搧鏄庣粏</h4>
+ <el-table :data="detailData.products"
+ border
+ style="width: 100%">
+ <el-table-column prop="product" label="浜у搧鍚嶇О" />
+ <el-table-column prop="specification" label="瑙勬牸鍨嬪彿" />
+ <el-table-column prop="unit" label="鍗曚綅" />
+ <el-table-column prop="unitPrice" label="鍗曚环">
+ <template #default="scope">楼{{ Number(scope.row.unitPrice ?? 0).toFixed(2) }}</template>
+ </el-table-column>
+ </el-table>
+ </div>
+ <div v-if="detailData.remark" style="margin-top: 20px;">
+ <h4>澶囨敞</h4>
+ <p>{{ detailData.remark }}</p>
+ </div>
+ </div>
+ </template>
+ </div>
+ <div v-if="attachmentList.length"
+ class="detail-block">
+ <div class="detail-block-title">闄勪欢鍒楄〃</div>
+ <div class="attachment-list">
+ <div v-for="file in attachmentList"
+ :key="file.id"
+ class="attachment-item">
+ <el-icon class="file-icon">
+ <Paperclip />
+ </el-icon>
+ <span class="file-name"
+ :title="file.name || file.originalFilename">
+ {{ file.name || file.originalFilename }}
+ </span>
+ <div class="file-actions">
+ <el-link v-if="file.previewURL || file.url"
+ type="primary"
+ :underline="false"
+ @click="openFile(file.previewURL || file.url)">棰勮</el-link>
+ <el-divider v-if="(file.previewURL || file.url) && file.downloadURL"
+ direction="vertical" />
+ <el-link v-if="file.downloadURL"
+ type="primary"
+ :underline="false"
+ @click="openFile(file.downloadURL)">涓嬭浇</el-link>
+ </div>
+ </div>
+ </div>
</div>
</div>
</template>
<script setup>
-import { computed } from "vue";
-import { formatDisplayTime } from "../../approve-template/approveTemplateConstants.js";
-import {
- approvalTypeLabel,
- approvalTypeStyle,
- approvalStatusLabel,
- approvalStatusTagType,
- resolveInstanceFormFields,
-} from "../approveListConstants.js";
-import FormPayloadFields from "./FormPayloadFields.vue";
+ import { computed } from "vue";
+ import { Paperclip } from "@element-plus/icons-vue";
+ import { formatDisplayTime } from "../../approve-template/approveTemplateConstants.js";
+ import {
+ approvalTypeLabel,
+ approvalTypeStyle,
+ approvalStatusLabel,
+ approvalStatusTagType,
+ resolveInstanceFormFields,
+ } from "../approveListConstants.js";
+ import FormPayloadFields from "./FormPayloadFields.vue";
-const props = defineProps({
- row: { type: Object, default: () => ({}) },
-});
+ const props = defineProps({
+ row: { type: Object, default: () => ({}) },
+ detailData: { type: Object, default: () => ({}) },
+ });
-const formResolved = computed(() => resolveInstanceFormFields(props.row));
+ const formResolved = computed(() => resolveInstanceFormFields(props.row));
+
+
+ // 鏄惁涓虹壒娈婂鎵圭被鍨嬶紙閲囪喘銆佸彂璐с�佹姤浠凤級
+ const isSpecialApprovalType = computed(() => {
+ return [5, 7, 6].includes(props.row.businessType);
+ });
+
+ // 璇︽儏鏁版嵁锛堢洿鎺ヤ娇鐢ㄤ紶鍏ョ殑 detail-data 鍙傛暟锛�
+ const detailData = computed(() => {
+ return props.detailData || {};
+ });
+
+ const attachmentList = computed(() => {
+ const list = props.row.storageBlobVOList || props.row.storageBlobDTOs || [];
+ return Array.isArray(list) ? list : [];
+ });
+
+ function openFile(url) {
+ if (!url) return;
+ window.open(url, "_blank");
+ }
</script>
<style scoped>
-.approve-detail-panel {
- display: flex;
- flex-direction: column;
- gap: 20px;
-}
-.detail-block-title {
- font-size: 14px;
- font-weight: 600;
- color: var(--el-text-color-primary);
- margin: 0 0 12px;
- padding-left: 10px;
- border-left: 3px solid var(--el-color-primary);
- line-height: 1.4;
-}
-.approve-type-cell {
- display: inline-block;
- padding: 2px 10px;
- border-radius: 4px;
- font-size: 13px;
- line-height: 1.5;
-}
-.reject-text {
- color: var(--el-color-danger);
-}
-</style>
+ .approve-detail-panel {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+ }
+ .detail-block-title {
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--el-text-color-primary);
+ margin: 0 0 12px;
+ padding-left: 10px;
+ border-left: 3px solid var(--el-color-primary);
+ line-height: 1.4;
+ }
+ .approve-type-cell {
+ display: inline-block;
+ padding: 2px 10px;
+ border-radius: 4px;
+ font-size: 13px;
+ line-height: 1.5;
+ }
+ .reject-text {
+ color: var(--el-color-danger);
+ }
+
+ .attachment-list {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
+ gap: 12px;
+ }
+ .attachment-item {
+ display: flex;
+ align-items: center;
+ padding: 10px 12px;
+ background-color: var(--el-fill-color-light);
+ border-radius: 6px;
+ border: 1px solid var(--el-border-color-lighter);
+ transition: all 0.3s;
+ }
+ .attachment-item:hover {
+ border-color: var(--el-color-primary-light-5);
+ background-color: var(--el-color-primary-light-9);
+ }
+ .file-icon {
+ font-size: 18px;
+ color: var(--el-text-color-secondary);
+ margin-right: 10px;
+ }
+ .file-name {
+ flex: 1;
+ font-size: 13px;
+ color: var(--el-text-color-primary);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ margin-right: 12px;
+ }
+ .file-actions {
+ display: flex;
+ align-items: center;
+ flex-shrink: 0;
+ }
+</style>
\ No newline at end of file
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/index.vue b/src/views/officeProcessAutomation/ApproveManage/approve-list/index.vue
index bbfa56a..4a9cf29 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/index.vue
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/index.vue
@@ -172,7 +172,7 @@
class="approve-detail-dialog"
>
<div class="approve-detail-body">
- <ApproveDetailPanel :row="detailRow" />
+ <ApproveDetailPanel :row="detailRow" :detail-data="detailData" />
<div class="detail-block">
<div class="detail-block-title">
瀹℃壒娴佺▼锛坽{ detailRow.tasks?.length || detailRow.flowNodes?.length || 0 }} 椤癸級
@@ -290,7 +290,7 @@
destroy-on-close
@closed="approveOpinion = ''"
>
- <ApproveDetailPanel :row="approveDialog.row" />
+ <ApproveDetailPanel :row="approveDialog.row" :detail-data="detailData" />
<div class="detail-block mt16">
<div class="detail-block-title">
瀹℃壒娴佺▼锛坽{ approveDialog.row?.tasks?.length || approveDialog.row?.flowNodes?.length || 0 }} 椤癸級
@@ -369,6 +369,7 @@
tableColumn,
detailDialog,
detailRow,
+ detailData,
reimburseDialog,
approveDialog,
approveOpinion,
@@ -610,4 +611,4 @@
border-left: 3px solid var(--el-color-primary);
line-height: 1.4;
}
-</style>
+</style>
\ No newline at end of file
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js b/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
index 67b9213..3f0e99c 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-list/useApproveList.js
@@ -10,6 +10,9 @@
saveApprovalInstance,
updateApprovalInstance,
} from "@/api/officeProcessAutomation/approvalInstance.js";
+import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
+import { getPurchaseByCode } from "@/api/procurementManagement/procurementLedger.js";
+import { getDeliveryDetailByShippingNo } from "@/api/salesManagement/deliveryLedger.js";
import useUserStore from "@/store/modules/user";
import { Search } from "@element-plus/icons-vue";
import { ElMessage, ElMessageBox } from "element-plus";
@@ -77,6 +80,7 @@
const detailDialog = reactive({ visible: false });
const detailRow = ref({});
+ const detailData = ref({});
const approveDialog = reactive({ visible: false, row: null });
const approveOpinion = ref("");
@@ -135,7 +139,7 @@
}));
const tableColumn = ref([
- { label: "鐢宠浜虹紪鍙�", prop: "applicantNo", width: 110 },
+ // { label: "鐢宠浜虹紪鍙�", prop: "applicantNo", width: 110 },
{ label: "鐢宠浜哄悕绉�", prop: "applicantName", minWidth: 100 },
{ label: "妯℃澘绫诲瀷", prop: "businessName", minWidth: 120 },
{
@@ -220,7 +224,7 @@
fetchBusinessTypeOptions(),
listApprovalTemplate(TEMPLATE_TYPE_CUSTOM),
]);
- submitBusinessTypeOptions.value = typeOptions;
+ submitBusinessTypeOptions.value = typeOptions.filter((x) => ![5, 6, 7].includes(x.value));
allSubmitTemplates.value = unwrapTemplateList(customRes)
.filter((row) => mapEnabledFromApi(row.enabled))
.map(mapSubmitTemplateCard);
@@ -288,11 +292,46 @@
await openReimburseDetail(row, "detail");
return;
}
+
detailRow.value = { ...row };
+ // 鎶ヤ环瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"鎶ヤ环鍗曞彿"鍘绘煡鎶ヤ环鍒楄〃
+ if (row.businessType === 6) {
+ const quotationNo = row?.quotationNo;
+ if (quotationNo) {
+ const res = await getQuotationList({ quotationNo });
+ const records = res?.data?.records || [];
+ detailData.value = records[0] || {};
+ }
+ }
+
+ // 閲囪喘瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"閲囪喘鍚堝悓鍙�"鍘绘煡閲囪喘璇︽儏
+ else if (row.businessType === 5) {
+ const purchaseContractNumber = row?.purchaseContractNumber;
+ if (purchaseContractNumber) {
+ const res = await getPurchaseByCode({ purchaseContractNumber });
+ detailData.value = res || {};
+ }
+ }
+
+ // 鍙戣揣瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"鍙戣揣鍗曞彿"鍘绘煡鍙戣揣璇︽儏
+ else if (row.businessType === 7) {
+ const shippingNo = row?.shippingNo;
+ if (shippingNo) {
+ const res = await getDeliveryDetailByShippingNo({ shippingNo });
+ detailData.value = res?.data || res || {};
+ }
+ }
+
+ // 鍏朵粬瀹℃壒绫诲瀷
+ else {
+ detailData.value = {};
+ }
+
detailDialog.visible = true;
}
async function openApprove(row) {
+
if (inferReimburseModuleKeyFromInstance(row)) {
approveOpinion.value = "";
await openReimburseDetail(row, "approve");
@@ -300,6 +339,38 @@
}
approveDialog.row = { ...row };
approveOpinion.value = "";
+ // 鎶ヤ环瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"鎶ヤ环鍗曞彿"鍘绘煡鎶ヤ环鍒楄〃
+ if (row.businessType === 6) {
+ const quotationNo = row?.quotationNo;
+ if (quotationNo) {
+ const res = await getQuotationList({ quotationNo });
+ const records = res?.data?.records || [];
+ detailData.value = records[0] || {};
+ }
+ }
+
+ // 閲囪喘瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"閲囪喘鍚堝悓鍙�"鍘绘煡閲囪喘璇︽儏
+ else if (row.businessType === 5) {
+ const purchaseContractNumber = row?.purchaseContractNumber;
+ if (purchaseContractNumber) {
+ const res = await getPurchaseByCode({ purchaseContractNumber });
+ detailData.value = res || {};
+ }
+ }
+
+ // 鍙戣揣瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"鍙戣揣鍗曞彿"鍘绘煡鍙戣揣璇︽儏
+ else if (row.businessType === 7) {
+ const shippingNo = row?.shippingNo;
+ if (shippingNo) {
+ const res = await getDeliveryDetailByShippingNo({ shippingNo });
+ detailData.value = res?.data || res || {};
+ }
+ }
+
+ // 鍏朵粬瀹℃壒绫诲瀷
+ else {
+ detailData.value = {};
+ }
approveDialog.visible = true;
}
@@ -586,6 +657,7 @@
tableColumn,
detailDialog,
detailRow,
+ detailData,
reimburseDialog,
approveDialog,
approveOpinion,
@@ -625,4 +697,4 @@
openApprove,
fetchApprovalList,
};
-}
+}
\ No newline at end of file
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceFormConfigTable.js b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceFormConfigTable.js
index 0251647..d6bec18 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceFormConfigTable.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceFormConfigTable.js
@@ -1,25 +1,9 @@
import { computed } from "vue";
-import {
- businessApprovalStatusLabel,
- businessApprovalStatusTagType,
- formatFieldDisplayValue,
- resolveInstanceFormFields,
-} from "../approve-list/approveListConstants.js";
-import {
- INSTANCE_NO_SEARCH_MODULE_KEYS,
- INSTANCE_NO_TABLE_COLUMN,
-} from "./approvalInstanceListSearch.js";
+import { businessApprovalStatusLabel, businessApprovalStatusTagType, formatFieldDisplayValue, resolveInstanceFormFields } from "../approve-list/approveListConstants.js";
+import { INSTANCE_NO_SEARCH_MODULE_KEYS, INSTANCE_NO_TABLE_COLUMN } from "./approvalInstanceListSearch.js";
/** 鍒楄〃/璇︽儏涓嶅洖鏄句负鐙珛鍒楃殑濉姤椤� key锛堥伩鍏嶈鐩栧疄渚嬬郴缁熷瓧娈碉級 */
-const DEFAULT_EXCLUDE_KEYS = new Set([
- "summary",
- "status",
- "approvalStatus",
- "approvalstatus",
- "instanceStatus",
- "publishStatus",
- "newsStatus",
-]);
+const DEFAULT_EXCLUDE_KEYS = new Set(["summary", "status", "approvalStatus", "approvalstatus", "instanceStatus", "publishStatus", "newsStatus"]);
/** enrich 鍚庡繀椤讳繚鐣欑殑瀹炰緥瀛楁锛堜笉琚� formConfig 閾哄钩瑕嗙洊锛� */
const PRESERVE_INSTANCE_FIELDS = [
@@ -44,6 +28,8 @@
"unread",
"currentLevel",
"newsStatus",
+ "storageBlobVOList",
+ "storageBlobDTOs",
];
/**
@@ -64,14 +50,8 @@
if (!f?.key || DEFAULT_EXCLUDE_KEYS.has(f.key)) continue;
const val = formPayload[f.key];
let text = formatFieldDisplayValue(f, val, caches);
- if (
- text === String(val) &&
- row?.applicantName &&
- (f.label === "鐢宠浜�" || f.key === "applicant" || f.key === "applicantName")
- ) {
- const idMatch =
- String(val) === String(row.applicantId) ||
- String(val) === String(row.applicantNo);
+ if (text === String(val) && row?.applicantName && (f.label === "鐢宠浜�" || f.key === "applicant" || f.key === "applicantName")) {
+ const idMatch = String(val) === String(row.applicantId) || String(val) === String(row.applicantNo);
if (idMatch) text = row.applicantName;
}
formDisplay[f.key] = text;
@@ -89,10 +69,8 @@
* 浠庡垪琛ㄩ琛� formConfig 鐢熸垚涓昏〃鍔ㄦ�佸垪锛坙abel 鍙栬嚜妯℃澘瀛楁 label锛�
*/
export function getFormConfigFieldColumns(firstRow, { excludeKeys = DEFAULT_EXCLUDE_KEYS } = {}) {
- const fields = (firstRow?.formFieldDefs || []).filter(
- (f) => f?.key && !excludeKeys.has(f.key)
- );
- return fields.map((f) => ({
+ const fields = (firstRow?.formFieldDefs || []).filter(f => f?.key && !excludeKeys.has(f.key));
+ return fields.map(f => ({
label: f.label || f.key,
prop: f.key,
minWidth: f.type === "textarea" ? 200 : f.type === "datetimerange" ? 160 : 120,
@@ -104,19 +82,9 @@
* 涓氬姟鐢宠涓昏〃鍒楋細鍥哄畾鍒� + formConfig 鍔ㄦ�佸垪 + 瀹℃壒鐘舵�� + 鎿嶄綔
*/
export function buildInstanceTableColumns(tableDataRef, buildTableActions, options = {}) {
- const {
- moduleKey,
- excludeKeys = DEFAULT_EXCLUDE_KEYS,
- beforeFormColumns = [],
- extraColumns = [],
- afterFormColumns = [],
- actionWidth = 260,
- } = options;
+ const { moduleKey, excludeKeys = DEFAULT_EXCLUDE_KEYS, beforeFormColumns = [], extraColumns = [], afterFormColumns = [], actionWidth = 260 } = options;
- const leadingCols =
- moduleKey && INSTANCE_NO_SEARCH_MODULE_KEYS.has(moduleKey)
- ? [INSTANCE_NO_TABLE_COLUMN]
- : [];
+ const leadingCols = moduleKey && INSTANCE_NO_SEARCH_MODULE_KEYS.has(moduleKey) ? [INSTANCE_NO_TABLE_COLUMN] : [];
return computed(() => {
const formCols = getFormConfigFieldColumns(tableDataRef.value?.[0], { excludeKeys });
@@ -132,8 +100,8 @@
prop: "approvalStatus",
width: 110,
dataType: "tag",
- formatData: (v) => businessApprovalStatusLabel(v),
- formatType: (v) => businessApprovalStatusTagType(v),
+ formatData: v => businessApprovalStatusLabel(v),
+ formatType: v => businessApprovalStatusTagType(v),
},
{
dataType: "action",
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceListSearch.js b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceListSearch.js
index 3042d0c..80dda5c 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceListSearch.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalInstanceListSearch.js
@@ -1,3 +1,4 @@
+import dayjs from "dayjs";
import { APPROVAL_MODULE_KEYS } from "./approvalModuleRegistry.js";
/** 鏀寔瀹℃壒鍗曞彿鏌ヨ/涓昏〃灞曠ず鐨勫鎵圭敵璇锋ā鍧� */
@@ -48,16 +49,29 @@
return no ? { instanceNo: no } : {};
}
-/** 缁勮 approvalInstanceDto 鏌ヨ鐗囨锛堢敵璇蜂汉 + 瀹℃壒鍗曞彿锛� */
+/** 缁勮 approvalInstanceDto 鏌ヨ鐗囨锛堢敵璇蜂汉 + 瀹℃壒鍗曞彿 + 鐘舵�� + 鏃堕棿鑼冨洿锛� */
export function buildApprovalInstanceSearchDto(searchForm = {}, extraParams = {}) {
const dto = {
...(extraParams && typeof extraParams === "object" ? extraParams : {}),
};
Object.assign(dto, pickApplicantFromSearchForm(searchForm));
Object.assign(dto, pickInstanceNoFromSearchForm(searchForm));
+
+ // 瀹℃壒鐘舵��
+ if (searchForm?.status) {
+ dto.status = searchForm.status;
+ }
+
+ // 鍒涘缓鏃堕棿鑼冨洿
+ const range = searchForm?.createTimeRange;
+ if (Array.isArray(range) && range[0]) {
+ dto.createTimeStart = range[0] + (range[0].includes(":") ? "" : " 00:00:00");
+ }
+ if (Array.isArray(range) && range[1]) {
+ dto.createTimeEnd = range[1] + (range[1].includes(":") ? "" : " 23:59:59");
+ }
+
delete dto.createTime;
- delete dto.createTimeStart;
- delete dto.createTimeEnd;
return dto;
}
@@ -74,26 +88,17 @@
function matchApplicantKeyword(row, keyword) {
const kw = (keyword || "").trim().toLowerCase();
if (!kw) return true;
- const parts = [
- row?.applicantName,
- row?.applicantNo,
- row?.applicantId,
- getRowPayloadValue(row, ["applicant", "applicantName", "applicantId"]),
- ]
- .filter((v) => v != null && v !== "")
- .map((v) => String(v).toLowerCase());
- return parts.some((p) => p.includes(kw));
+ const parts = [row?.applicantName, row?.applicantNo, row?.applicantId, getRowPayloadValue(row, ["applicant", "applicantName", "applicantId"])]
+ .filter(v => v != null && v !== "")
+ .map(v => String(v).toLowerCase());
+ return parts.some(p => p.includes(kw));
}
function matchApplicantId(row, applicantId) {
if (applicantId == null || applicantId === "") return true;
const id = String(applicantId);
if (row?.applicantId != null && String(row.applicantId) === id) return true;
- const payloadApplicant = getRowPayloadValue(row, [
- "applicant",
- "applicantId",
- "applicantUserId",
- ]);
+ const payloadApplicant = getRowPayloadValue(row, ["applicant", "applicantId", "applicantUserId"]);
return String(payloadApplicant) === id;
}
@@ -106,31 +111,48 @@
function matchInstanceNo(row, instanceNo) {
const kw = (instanceNo || "").trim().toLowerCase();
if (!kw) return true;
- const parts = [row?.instanceNo, row?.bizId]
- .filter((v) => v != null && v !== "")
- .map((v) => String(v).toLowerCase());
- return parts.some((p) => p.includes(kw));
+ const parts = [row?.instanceNo, row?.bizId].filter(v => v != null && v !== "").map(v => String(v).toLowerCase());
+ return parts.some(p => p.includes(kw));
}
-/** 鏄惁瀛樺湪鍒楄〃绛涢�夋潯浠讹紙鐢宠浜� / 瀹℃壒鍗曞彿锛� */
+/** 鏄惁瀛樺湪鍒楄〃绛涢�夋潯浠讹紙鐢宠浜� / 瀹℃壒鍗曞彿 / 鐘舵�� / 鏃堕棿鑼冨洿锛� */
export function hasActiveModuleSearch(moduleKey, searchForm = {}) {
const sf = searchForm || {};
if ((sf.instanceNo || "").trim()) return true;
if ((sf.applicantKeyword || "").trim()) return true;
if ((sf.applicantName || "").trim()) return true;
- return sf.applicantId != null && sf.applicantId !== "";
+ if (sf.applicantId != null && sf.applicantId !== "") return true;
+ if (sf.status) return true;
+ if (Array.isArray(sf.createTimeRange) && sf.createTimeRange.length === 2) return true;
+ return false;
}
-/** 鎸夌敵璇蜂汉銆佸鎵瑰崟鍙峰仛鍓嶇鍏滃簳绛涢�� */
+/** 鎸夌敵璇蜂汉銆佸鎵瑰崟鍙枫�佺姸鎬併�佹椂闂磋寖鍥村仛鍓嶇鍏滃簳绛涢�� */
export function filterInstanceRowsByModuleSearch(moduleKey, rows, searchForm = {}) {
const sf = searchForm || {};
const list = Array.isArray(rows) ? rows : [];
if (!hasActiveModuleSearch(moduleKey, sf)) return list;
- return list.filter(
- (row) =>
- matchInstanceNo(row, sf.instanceNo) &&
- matchApplicantId(row, sf.applicantId) &&
- matchApplicantKeyword(row, sf.applicantKeyword || sf.applicantName)
- );
+ return list.filter(row => {
+ // 瀹℃壒鍗曞彿
+ if (!matchInstanceNo(row, sf.instanceNo)) return false;
+ // 鐢宠浜�
+ if (!matchApplicantId(row, sf.applicantId)) return false;
+ if (!matchApplicantKeyword(row, sf.applicantKeyword || sf.applicantName)) return false;
+ // 鐘舵��
+ if (sf.status && String(row.statusRaw || row.status).toUpperCase() !== String(sf.status).toUpperCase()) {
+ return false;
+ }
+ // 鏃堕棿鑼冨洿
+ if (Array.isArray(sf.createTimeRange) && sf.createTimeRange.length === 2) {
+ const rowTime = row.createTime || row.applyTime;
+ if (rowTime) {
+ const t = dayjs(rowTime);
+ const start = dayjs(sf.createTimeRange[0] + " 00:00:00");
+ const end = dayjs(sf.createTimeRange[1] + " 23:59:59");
+ if (t.isBefore(start) || t.isAfter(end)) return false;
+ }
+ }
+ return true;
+ });
}
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js
index a85cf9c..fd56eca 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-shared/approvalModuleRegistry.js
@@ -1,5 +1,3 @@
-import { matchBusinessTypeValue } from "../approve-list/approveListConstants.js";
-
/**
* 鍚勪笟鍔℃ā鍧椾笌瀹℃壒妯℃澘绫诲瀷鐨勬槧灏勶紙閰嶇疆鍖栧叆鍙o級
* businessType 涓庡悗绔� TypeEnums / listPage 绾﹀畾涓�鑷达紙鍐欐鏋氫妇鍊硷級
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/index.vue b/src/views/officeProcessAutomation/ApproveManage/approve-template/index.vue
index d094c13..0a495c6 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/index.vue
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/index.vue
@@ -380,23 +380,18 @@
<template v-if="detailAttachments.length">
- <el-tag
-
- v-for="(f, i) in detailAttachments"
-
- :key="i"
-
- class="detail-attachment-tag"
-
- type="info"
-
- effect="plain"
-
- >
-
- {{ attachmentDisplayName(f) }}
-
- </el-tag>
+ <div class="detail-attachment-list">
+ <div
+ v-for="(f, i) in detailAttachments"
+ :key="i"
+ class="detail-attachment-item"
+ @click="openAttachmentFile(f)"
+ >
+ <el-icon class="attachment-icon"><Document /></el-icon>
+ <span class="attachment-name">{{ attachmentDisplayName(f) }}</span>
+ <el-icon class="attachment-download"><Download /></el-icon>
+ </div>
+ </div>
</template>
@@ -422,7 +417,7 @@
<script setup>
-import { ArrowRight, Plus, RefreshRight } from "@element-plus/icons-vue";
+import { ArrowRight, Document, Download, Plus, RefreshRight } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
@@ -525,6 +520,14 @@
}
+function openAttachmentFile(file) {
+ const url = file?.url || file?.previewURL || file?.downloadURL || file?.previewUrl || "";
+ if (url) {
+ window.open(url, "_blank");
+ } else {
+ ElMessage.warning("鏃犳硶鎵撳紑璇ラ檮浠�");
+ }
+}
function unwrapArray(payload) {
@@ -795,10 +798,40 @@
}
-.detail-attachment-tag {
+.detail-attachment-list {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+}
- margin: 0 8px 8px 0;
+.detail-attachment-item {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ padding: 8px 12px;
+ background: var(--el-fill-color-light);
+ border-radius: 6px;
+ cursor: pointer;
+ transition: background 0.2s;
+}
+.detail-attachment-item:hover {
+ background: var(--el-fill-color);
+}
+
+.attachment-icon {
+ font-size: 16px;
+ color: var(--el-text-color-regular);
+}
+
+.attachment-name {
+ font-size: 14px;
+ color: var(--el-text-color-primary);
+}
+
+.attachment-download {
+ font-size: 14px;
+ color: var(--el-text-color-secondary);
}
.text-muted {
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/useApproveTemplate.js b/src/views/officeProcessAutomation/ApproveManage/approve-template/useApproveTemplate.js
index 61aa6c0..79e96bc 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/useApproveTemplate.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/useApproveTemplate.js
@@ -214,10 +214,21 @@
});
}
- function openFormDialog(mode, row) {
+ async function openFormDialog(mode, row) {
formDialog.mode = mode;
formDialog.title = mode === "add" ? "鏂板缓瀹℃壒妯℃澘" : "缂栬緫瀹℃壒妯℃澘";
- resetForm(mode === "edit" ? row : null);
+ if (mode === "edit" && row?.id) {
+ // 缂栬緫鏃跺厛鏌ヨ璇︽儏鑾峰彇瀹屾暣鏁版嵁锛堝寘鍚檮浠讹級
+ try {
+ const res = await getApprovalTemplateDetail(row.id);
+ const detailData = mapTemplateFromApi(unwrapTemplateDetail(res));
+ resetForm(detailData);
+ } catch {
+ resetForm(row);
+ }
+ } else {
+ resetForm(mode === "edit" ? row : null);
+ }
formDialog.visible = true;
}
diff --git a/src/views/officeProcessAutomation/HrManage/staff-contract/components/formDia.vue b/src/views/officeProcessAutomation/HrManage/staff-contract/components/formDia.vue
index 54b2ef9..3db1bee 100644
--- a/src/views/officeProcessAutomation/HrManage/staff-contract/components/formDia.vue
+++ b/src/views/officeProcessAutomation/HrManage/staff-contract/components/formDia.vue
@@ -1,96 +1,93 @@
<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>
- <Files ref="filesDia"></Files>
+ <FileList v-if="fileDialogVisible"
+ v-model:visible="fileDialogVisible"
+ :record-type="'staff_contract'"
+ :record-id="recordId" />
</div>
</template>
<script setup>
-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,'鍚堝悓')
+ 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;
+ },
},
- }
- ],
- },
-]);
-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 openUploadFile = (row) => {
- filesDia.value.open = true
- filesDia.value.row = row
-}
-
-// 鍏抽棴寮规
-const closeDia = () => {
- dialogFormVisible.value = false;
- emit('close')
-};
-defineExpose({
- openDialog,
-});
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ dialogFormVisible.value = false;
+ emit("close");
+ };
+ defineExpose({
+ openDialog,
+ });
</script>
<style scoped>
-
</style>
\ No newline at end of file
diff --git a/src/views/personnelManagement/contractManagement/components/formDia.vue b/src/views/personnelManagement/contractManagement/components/formDia.vue
index 54b2ef9..3db1bee 100644
--- a/src/views/personnelManagement/contractManagement/components/formDia.vue
+++ b/src/views/personnelManagement/contractManagement/components/formDia.vue
@@ -1,96 +1,93 @@
<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>
- <Files ref="filesDia"></Files>
+ <FileList v-if="fileDialogVisible"
+ v-model:visible="fileDialogVisible"
+ :record-type="'staff_contract'"
+ :record-id="recordId" />
</div>
</template>
<script setup>
-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,'鍚堝悓')
+ 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;
+ },
},
- }
- ],
- },
-]);
-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 openUploadFile = (row) => {
- filesDia.value.open = true
- filesDia.value.row = row
-}
-
-// 鍏抽棴寮规
-const closeDia = () => {
- dialogFormVisible.value = false;
- emit('close')
-};
-defineExpose({
- openDialog,
-});
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ dialogFormVisible.value = false;
+ emit("close");
+ };
+ defineExpose({
+ openDialog,
+ });
</script>
<style scoped>
-
</style>
\ No newline at end of file
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index dad6a26..2d42b57 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -66,6 +66,9 @@
</div>
<div class="table_list">
<div style="display: flex;justify-content: flex-end;margin-bottom: 20px;">
+ <el-button type="success"
+ plain
+ @click="handleBatchGenerate">鎵归噺鐢熸垚鏁版嵁</el-button>
<el-button type="primary"
@click="openForm('add')">鏂板鍙拌处</el-button>
<el-button type="primary"
@@ -106,7 +109,7 @@
prop="specificationModel" />
<el-table-column label="鍗曚綅"
prop="unit" />
- <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
+ <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
prop="stockInApprovalStatus"
width="120">
<template #default="scope">
@@ -721,6 +724,7 @@
getOptions,
getPurchaseTemplateList,
delPurchaseTemplate,
+ batchGeneratePurchaseInboundSteps,
} from "@/api/procurementManagement/procurementLedger.js";
import useFormData from "@/hooks/useFormData.js";
const FileList = defineAsyncComponent(() =>
@@ -776,9 +780,9 @@
// 鑾峰彇鍏ュ簱鐘舵�佹爣绛剧被鍨�
const getStockInStatusType = status => {
const typeMap = {
- "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
- "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
- "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+ 寰呭叆搴�: "info", // 寰呭叆搴� - 鐏拌壊
+ 鍏ュ簱涓�: "warning", // 鍏ュ簱涓� - 姗欒壊
+ 瀹屽叏鍏ュ簱: "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
};
return typeMap[status] || "";
};
@@ -786,9 +790,9 @@
// 鑾峰彇鍏ュ簱瀹℃牳鐘舵�佹爣绛剧被鍨�
const getStockInApprovalStatusType = status => {
const typeMap = {
- "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
- "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
- "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+ 寰呭叆搴�: "info", // 寰呭叆搴� - 鐏拌壊
+ 鍏ュ簱涓�: "warning", // 鍏ュ簱涓� - 姗欒壊
+ 瀹屽叏鍏ュ簱: "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
};
return typeMap[status] || "";
};
@@ -923,7 +927,7 @@
},
rules: {
purchaseContractNumber: [
- { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ { required: false, message: "璇疯緭鍏�", trigger: "blur" },
],
projectName: [
{ required: true, message: "璇疯緭鍏ラ」鐩悕绉�", trigger: "blur" },
@@ -1274,7 +1278,7 @@
const openForm = async (type, row) => {
// 缂栬緫鏃舵鏌ュ叆搴撶姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
if (type === "edit" && row) {
- if (row.stockInStatus === '瀹屽叏鍏ュ簱') {
+ if (row.stockInStatus === "瀹屽叏鍏ュ簱") {
proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑璁板綍涓嶈兘缂栬緫");
return;
}
@@ -1306,18 +1310,7 @@
form.value.entryDate = getCurrentDate();
- if (type === "add") {
- // 鏂板鏃剁敓鎴愰噰璐悎鍚屽彿
- try {
- const purchaseNoRes = await createPurchaseNo();
- if (purchaseNoRes?.data) {
- form.value.purchaseContractNumber = purchaseNoRes.data;
- }
- } catch (error) {
- console.error("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:", error);
- proxy.$modal.msgWarning("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�");
- }
- } else if (type === "edit" && row?.id) {
+ if (type === "edit" && row?.id) {
// 缂栬緫鏃跺姞杞芥暟鎹�
currentId.value = row.id;
try {
@@ -1325,7 +1318,10 @@
form.value = { ...purchaseRes, stockInStatus: row.stockInStatus };
fileList.value = purchaseRes.storageBlobVOS || [];
// 浣跨敤 productList 鎺ュ彛鑾峰彇浜у搧鍒楄〃锛屼互鑾峰彇鍏ュ簱瀹℃牳鐘舵��
- const productRes = await productList({ salesLedgerId: row.id, type: 2 });
+ const productRes = await productList({
+ salesLedgerId: row.id,
+ type: 2,
+ });
productData.value = productRes.data || [];
} catch (error) {
console.error("鍔犺浇閲囪喘鍙拌处鏁版嵁澶辫触:", error);
@@ -1398,7 +1394,7 @@
// 鎻愪氦琛ㄥ崟
const submitForm = () => {
- proxy.$refs["formRef"].validate(valid => {
+ proxy.$refs["formRef"].validate(async valid => {
if (valid) {
if (productData.value.length > 0) {
// 鏂板鏃讹紝闇�瑕佷粠姣忎釜浜у搧瀵硅薄涓垹闄� id 瀛楁
@@ -1428,6 +1424,20 @@
delete submitData.id;
}
+ // 濡傛灉閲囪喘鍚堝悓鍙蜂负绌猴紝鍒欐牴鎹綍鍏ユ棩鏈熻嚜鍔ㄧ敓鎴�
+ if (!submitData.purchaseContractNumber) {
+ try {
+ const purchaseNoRes = await createPurchaseNo(submitData.entryDate);
+ if (purchaseNoRes?.data) {
+ submitData.purchaseContractNumber = purchaseNoRes.data;
+ }
+ } catch (error) {
+ console.error("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:", error);
+ proxy.$modal.msgWarning("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�");
+ return;
+ }
+ }
+
addOrEditPurchase(submitData).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeDia();
@@ -1444,7 +1454,7 @@
// 鎵撳紑浜у搧寮规
const openProductForm = async (type, row, index) => {
// 缂栬緫鏃舵鏌ヤ骇鍝佸叆搴撳鏍哥姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
- if (type === "edit" && row && row.stockInApprovalStatus === '瀹屽叏鍏ュ簱') {
+ if (type === "edit" && row && row.stockInApprovalStatus === "瀹屽叏鍏ュ簱") {
proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑浜у搧涓嶈兘缂栬緫");
return;
}
@@ -1633,7 +1643,7 @@
}
// 妫�鏌ラ�変腑鐨勪骇鍝佷腑鏄惁鏈夊畬鍏ㄥ叆搴撶殑
const hasFullyStocked = productSelectedRows.value.some(
- row => row.stockInApprovalStatus === '瀹屽叏鍏ュ簱'
+ row => row.stockInApprovalStatus === "瀹屽叏鍏ュ簱"
);
if (hasFullyStocked) {
proxy.$modal.msgWarning("閫変腑鐨勪骇鍝佷腑鍖呭惈瀹屽叏鍏ュ簱鐨勪骇鍝侊紝鏃犳硶鍒犻櫎");
@@ -1709,6 +1719,37 @@
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
});
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ const handleBatchGenerate = async () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const ids = selectedRows.value.map((item) => item.id);
+
+ ElMessageBox.confirm("纭鎵归噺鐢熸垚鏁版嵁锛�", "鎵归噺鐢熸垚", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "info",
+ })
+ .then(() => {
+ proxy.$modal.loading("姝e湪鎵归噺鐢熸垚鏁版嵁锛岃绋嶅��...");
+ batchGeneratePurchaseInboundSteps({ ids })
+ .then((res) => {
+ proxy.$modal.msgSuccess("鎵归噺鐢熸垚鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ proxy.$modal.msgError("鎵归噺鐢熸垚澶辫触");
+ })
+ .finally(() => {
+ proxy.$modal.closeLoading();
+ });
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
@@ -1852,7 +1893,7 @@
contractNo: form.value.salesLedgerId,
});
if (code == 200) {
- productData.value = data;
+ productData.value = data || [];
}
};
diff --git a/src/views/procurementManagement/procurementPlan/index.vue b/src/views/procurementManagement/procurementPlan/index.vue
index 42a1bcf..ba9a38c 100644
--- a/src/views/procurementManagement/procurementPlan/index.vue
+++ b/src/views/procurementManagement/procurementPlan/index.vue
@@ -1,158 +1,205 @@
<template>
<div class="app-container">
<!-- 鎼滅储鍖哄煙 -->
- <el-card class="search-card" shadow="never">
- <el-form :model="searchForm" :inline="true" class="search-form">
+ <el-card class="search-card"
+ shadow="never">
+ <el-form :model="searchForm"
+ :inline="true"
+ class="search-form">
<el-form-item label="璁″垝鍚嶇О">
- <el-input v-model="searchForm.planName" placeholder="璇疯緭鍏ヨ鍒掑悕绉�" clearable />
+ <el-input v-model="searchForm.planName"
+ placeholder="璇疯緭鍏ヨ鍒掑悕绉�"
+ clearable />
</el-form-item>
<el-form-item label="鐘舵��">
- <el-select v-model="searchForm.status" placeholder="璇烽�夋嫨鐘舵��" clearable style="width: 150px">
- <el-option label="鍚敤" value="active" />
- <el-option label="绂佺敤" value="disabled" />
+ <el-select v-model="searchForm.status"
+ placeholder="璇烽�夋嫨鐘舵��"
+ clearable
+ style="width: 150px">
+ <el-option label="鍚敤"
+ value="active" />
+ <el-option label="绂佺敤"
+ value="disabled" />
</el-select>
</el-form-item>
<el-form-item>
- <el-button type="primary" @click="handleSearch">
- <el-icon><Search /></el-icon>
+ <el-button type="primary"
+ @click="handleSearch">
+ <el-icon>
+ <Search />
+ </el-icon>
鎼滅储
</el-button>
<el-button @click="handleReset">
- <el-icon><Refresh /></el-icon>
+ <el-icon>
+ <Refresh />
+ </el-icon>
閲嶇疆
</el-button>
</el-form-item>
</el-form>
</el-card>
-
<!-- 鎿嶄綔鎸夐挳 -->
- <el-card class="table-card" shadow="never">
+ <el-card class="table-card"
+ shadow="never">
<div class="table-header">
<div class="table-title">閲囪喘璁″垝鍒楄〃</div>
<div class="table-actions">
- <el-button type="primary" @click="handleAdd">
- <el-icon><Plus /></el-icon>
+ <el-button type="primary"
+ @click="handleAdd">
+ <el-icon>
+ <Plus />
+ </el-icon>
鏂板璁″垝
</el-button>
- <el-button type="info" @click="handleExport">
- <el-icon><Download /></el-icon>
+ <el-button type="info"
+ @click="handleExport">
+ <el-icon>
+ <Download />
+ </el-icon>
瀵煎嚭
</el-button>
</div>
</div>
-
<!-- 鏁版嵁琛ㄦ牸 -->
- <el-table
- v-loading="loading"
- :data="tableData"
- stripe
- border
- style="width: 100%"
- >
- <el-table-column prop="planName" label="璁″垝鍚嶇О" min-width="150" />
- <el-table-column prop="description" label="鎻忚堪" min-width="200" show-overflow-tooltip />
- <el-table-column prop="formula" label="璁$畻鍏紡" min-width="200" show-overflow-tooltip>
+ <el-table v-loading="loading"
+ :data="tableData"
+ stripe
+ border
+ style="width: 100%">
+ <el-table-column prop="planName"
+ label="璁″垝鍚嶇О"
+ min-width="150" />
+ <el-table-column prop="description"
+ label="鎻忚堪"
+ min-width="200"
+ show-overflow-tooltip />
+ <el-table-column prop="formula"
+ label="璁$畻鍏紡"
+ min-width="200"
+ show-overflow-tooltip>
<template #default="{ row }">
- <el-tag type="info" size="small">{{ row.formula }}</el-tag>
+ <el-tag type="info"
+ size="small">{{ row.formula }}</el-tag>
</template>
</el-table-column>
- <el-table-column prop="status" label="鐘舵��" width="80" align="center">
+ <el-table-column prop="status"
+ label="鐘舵��"
+ width="80"
+ align="center">
<template #default="{ row }">
- <el-tag :type="row.status === 'active' ? 'success' : 'info'" size="small">
+ <el-tag :type="row.status === 'active' ? 'success' : 'info'"
+ size="small">
{{ row.status === 'active' ? '鍚敤' : '绂佺敤' }}
</el-tag>
</template>
</el-table-column>
- <el-table-column prop="updateTime" label="鏈�鍚庤绠楁椂闂�" width="160" />
- <el-table-column label="鎿嶄綔" width="200" fixed="right" align="center">
+ <el-table-column prop="updateTime"
+ label="鏈�鍚庤绠楁椂闂�"
+ width="160" />
+ <el-table-column label="鎿嶄綔"
+ width="200"
+ fixed="right"
+ align="center">
<template #default="{ row }">
- <el-button type="primary" link @click="handleEdit(row)">缂栬緫</el-button>
- <el-button type="success" link @click="handleCalculate(row)">璁$畻</el-button>
- <el-button type="danger" link @click="handleDelete(row)">鍒犻櫎</el-button>
+ <el-button type="primary"
+ link
+ @click="handleEdit(row)">缂栬緫</el-button>
+ <el-button type="success"
+ link
+ @click="handleCalculate(row)">璁$畻</el-button>
+ <el-button type="danger"
+ link
+ @click="handleDelete(row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
-
<!-- 鍒嗛〉 -->
<div class="pagination-container">
- <el-pagination
- v-model:current-page="pagination.current"
- v-model:page-size="pagination.size"
- :page-sizes="[10, 20, 50, 100]"
- :total="total"
- layout="total, sizes, prev, pager, next, jumper"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- />
+ <el-pagination v-model:current-page="pagination.current"
+ v-model:page-size="pagination.size"
+ :page-sizes="[10, 20, 50, 100]"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ @size-change="handleSizeChange"
+ @current-change="handleCurrentChange" />
</div>
</el-card>
-
<!-- 鏂板/缂栬緫瀵硅瘽妗� -->
- <FormDialog
- v-model="dialogVisible"
- :title="dialogType === 'add' ? '鏂板閲囪喘璁″垝' : '缂栬緫閲囪喘璁″垝'"
- :width="'1000px'"
- :operation-type="dialogType"
- :close-on-click-modal="false"
- @close="dialogVisible = false"
- @confirm="handleSubmit"
- @cancel="dialogVisible = false"
- >
+ <FormDialog v-model="dialogVisible"
+ :title="dialogType === 'add' ? '鏂板閲囪喘璁″垝' : '缂栬緫閲囪喘璁″垝'"
+ :width="'1000px'"
+ :operation-type="dialogType"
+ :close-on-click-modal="false"
+ @close="dialogVisible = false"
+ @confirm="handleSubmit"
+ @cancel="dialogVisible = false">
<div class="form-container">
<!-- 鍩烘湰淇℃伅 -->
<div class="form-section">
<div class="section-title">鍩烘湰淇℃伅</div>
- <el-form
- ref="formRef"
- :model="formData"
- :rules="formRules"
- label-width="120px"
- >
+ <el-form ref="formRef"
+ :model="formData"
+ :rules="formRules"
+ label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="缂栫爜" prop="code">
- <el-input v-model="formData.code" placeholder="绯荤粺鑷姩鐢熸垚" disabled />
+ <el-form-item label="缂栫爜"
+ prop="code">
+ <el-input v-model="formData.code"
+ placeholder="淇濆瓨鍚庤嚜鍔ㄧ敓鎴�"
+ disabled />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍚嶇О" prop="planName" required>
- <el-input v-model="formData.planName" placeholder="璇疯緭鍏ヨ鍒掑悕绉�" />
+ <el-form-item label="鍚嶇О"
+ prop="planName"
+ required>
+ <el-input v-model="formData.planName"
+ placeholder="璇疯緭鍏ヨ鍒掑悕绉�" />
</el-form-item>
</el-col>
</el-row>
-
- <el-form-item label="鎻忚堪" prop="description">
- <el-input
- v-model="formData.description"
- type="textarea"
- :rows="3"
- placeholder="璇疯緭鍏ヨ鍒掓弿杩�"
- />
+ <el-form-item label="鎻忚堪"
+ prop="description">
+ <el-input v-model="formData.description"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ヨ鍒掓弿杩�" />
</el-form-item>
-
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="鐘舵��" prop="status">
- <el-select v-model="formData.status" placeholder="璇烽�夋嫨鐘舵��" style="width: 100%">
- <el-option label="鍚敤" value="active" />
- <el-option label="绂佺敤" value="disabled" />
+ <el-form-item label="鐘舵��"
+ prop="status">
+ <el-select v-model="formData.status"
+ placeholder="璇烽�夋嫨鐘舵��"
+ style="width: 100%">
+ <el-option label="鍚敤"
+ value="active" />
+ <el-option label="绂佺敤"
+ value="disabled" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏄惁绯荤粺棰勭疆">
- <el-checkbox v-model="formData.isSystemPreset">鏄�</el-checkbox>
+ <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-col>
</el-row>
</el-form>
</div>
-
<!-- 璁$畻鍙傛暟 -->
<div class="form-section">
<div class="section-title">璁$畻鍙傛暟</div>
- <el-tabs v-model="activeTab" class="param-tabs">
- <el-tab-pane label="闇�姹傚弬鏁�" name="demand">
+ <el-tabs v-model="activeTab"
+ class="param-tabs">
+ <el-tab-pane label="闇�姹傚弬鏁�"
+ name="demand">
<div class="checkbox-group">
<el-checkbox v-model="formData.considerExistingStock">鑰冭檻鐜版湁搴撳瓨</el-checkbox>
<el-checkbox v-model="formData.warehouseControl">浠撳簱杩愯MRP鐨勬帶鍒�</el-checkbox>
@@ -163,7 +210,8 @@
<el-checkbox v-model="formData.negativeStockAsDemand">璐熷簱瀛樹綔涓洪渶姹�</el-checkbox>
</div>
</el-tab-pane>
- <el-tab-pane label="璁$畻鍙傛暟" name="calculation">
+ <el-tab-pane label="璁$畻鍙傛暟"
+ name="calculation">
<div class="checkbox-group">
<el-checkbox v-model="formData.considerExistingStock">鑰冭檻鐜版湁搴撳瓨</el-checkbox>
<el-checkbox v-model="formData.warehouseControl">浠撳簱杩愯MRP鐨勬帶鍒�</el-checkbox>
@@ -176,7 +224,6 @@
</el-tab-pane>
</el-tabs>
</div>
-
<!-- 姹囨�诲悎骞堕�夐」 -->
<div class="form-section">
<div class="section-title">姹囨�诲悎骞堕�夐」</div>
@@ -186,20 +233,20 @@
<el-checkbox v-model="formData.summaryDemandDate">闇�姹傛棩鏈�</el-checkbox>
</div>
</div>
-
<!-- 璁$畻鍏紡 -->
<div class="form-section">
<div class="section-title">璁$畻鍏紡</div>
<div class="formula-input-section">
- <el-form-item label="璁$畻鍏紡" prop="formula" required>
- <el-input
- v-model="formData.formula"
- placeholder="渚嬪: 棰勮鍑哄簱鏁伴噺 - 鐜版湁搴撳瓨 + 瀹夊叏搴撳瓨 - 棰勮鍏ュ簱鏁伴噺"
- @input="validateFormula"
- />
+ <el-form-item label="璁$畻鍏紡"
+ prop="formula"
+ required>
+ <el-input v-model="formData.formula"
+ placeholder="渚嬪: 棰勮鍑哄簱鏁伴噺 - 鐜版湁搴撳瓨 + 瀹夊叏搴撳瓨 - 棰勮鍏ュ簱鏁伴噺"
+ @input="validateFormula" />
</el-form-item>
<div class="formula-help">
- <el-text type="info" size="small">
+ <el-text type="info"
+ size="small">
鏀寔鍙橀噺锛氶璁″嚭搴撴暟閲忋�佺幇鏈夊簱瀛樸�佸畨鍏ㄥ簱瀛樸�侀璁″叆搴撴暟閲�
</el-text>
</div>
@@ -207,87 +254,117 @@
</div>
</div>
</FormDialog>
-
<!-- 浜у搧閫夋嫨瀵硅瘽妗� -->
- <FormDialog
- v-model="productSelectDialogVisible"
- title="閫夋嫨浜у搧"
- :width="'800px'"
- :close-on-click-modal="false"
- @close="productSelectDialogVisible = false"
- @confirm="handleConfirmProductSelection"
- @cancel="productSelectDialogVisible = false"
- >
+ <FormDialog v-model="productSelectDialogVisible"
+ title="閫夋嫨浜у搧"
+ :width="'800px'"
+ :close-on-click-modal="false"
+ @close="productSelectDialogVisible = false"
+ @confirm="handleConfirmProductSelection"
+ @cancel="productSelectDialogVisible = false">
<div class="product-select">
- <el-alert
- title="璇烽�夋嫨瑕佽绠楃殑浜у搧"
- type="info"
- :closable="false"
- show-icon
- >
+ <el-alert title="璇烽�夋嫨瑕佽绠楃殑浜у搧"
+ type="info"
+ :closable="false"
+ show-icon>
<template #default>
<p>閫夋嫨浜у搧鍚庯紝绯荤粺灏嗘牴鎹綋鍓嶈绠楀叕寮忓拰浜у搧搴撳瓨鎯呭喌杩涜璁$畻銆�</p>
</template>
</el-alert>
-
- <el-table
- v-loading="productLoading"
- :data="productList"
- @selection-change="handleProductSelectionChange"
- stripe
- border
- style="width: 100%; margin-top: 20px;"
- >
- <el-table-column type="selection" width="55" />
- <el-table-column prop="productCategory" label="浜у搧澶х被" min-width="150" />
- <el-table-column prop="specificationModel" label="浜у搧瑙勬牸" width="120" />
- <el-table-column prop="inboundNum0" label="鐜版湁搴撳瓨" width="100" align="right" />
- <el-table-column prop="inboundNum" label="瀹夊叏搴撳瓨" width="100" align="right" />
- <el-table-column prop="inboundNum" label="棰勮鍑哄簱" width="100" align="right" />
- <el-table-column prop="inboundNum0" label="棰勮鍏ュ簱" width="100" align="right" />
+ <el-table v-loading="productLoading"
+ :data="productList"
+ @selection-change="handleProductSelectionChange"
+ stripe
+ border
+ style="width: 100%; margin-top: 20px;">
+ <el-table-column type="selection"
+ width="55" />
+ <el-table-column prop="productCategory"
+ label="浜у搧澶х被"
+ min-width="150" />
+ <el-table-column prop="specificationModel"
+ label="瑙勬牸鍨嬪彿"
+ width="120" />
+ <el-table-column prop="inboundNum0"
+ label="鐜版湁搴撳瓨"
+ width="100"
+ align="right" />
+ <el-table-column prop="inboundNum"
+ label="瀹夊叏搴撳瓨"
+ width="100"
+ align="right" />
+ <el-table-column prop="inboundNum"
+ label="棰勮鍑哄簱"
+ width="100"
+ align="right" />
+ <el-table-column prop="inboundNum0"
+ label="棰勮鍏ュ簱"
+ width="100"
+ align="right" />
</el-table>
</div>
</FormDialog>
-
<!-- 璁$畻缁撴灉瀵硅瘽妗� -->
- <FormDialog
- v-model="calculateDialogVisible"
- title="閲囪喘璁$畻缁撴灉"
- :width="'1000px'"
- :close-on-click-modal="false"
- @close="calculateDialogVisible = false"
- @confirm="handleCreatePurchaseOrder"
- @cancel="calculateDialogVisible = false"
- >
+ <FormDialog v-model="calculateDialogVisible"
+ title="閲囪喘璁$畻缁撴灉"
+ :width="'1000px'"
+ :close-on-click-modal="false"
+ @close="calculateDialogVisible = false"
+ @confirm="handleCreatePurchaseOrder"
+ @cancel="calculateDialogVisible = false">
<div class="calculate-result">
- <el-alert
- title="璁$畻缁撴灉"
- type="success"
- :closable="false"
- show-icon
- >
+ <el-alert title="璁$畻缁撴灉"
+ type="success"
+ :closable="false"
+ show-icon>
<template #default>
<p>鍩轰簬褰撳墠閰嶇疆鐨勮绠楀叕寮忓拰搴撳瓨鎯呭喌锛岀郴缁熷凡璁$畻鍑哄悇浜у搧鐨勯噰璐渶姹傘��</p>
</template>
</el-alert>
-
- <el-table :data="calculateResult" stripe border style="width: 100%; margin-top: 20px;">
- <el-table-column prop="productCategory" label="浜у搧澶х被" min-width="150" />
- <el-table-column prop="specificationModel" label="浜у搧瑙勬牸" width="120" />
- <el-table-column prop="inboundNum0" label="鐜版湁搴撳瓨" width="100" align="right" />
- <el-table-column prop="inboundNum" label="瀹夊叏搴撳瓨" width="100" align="right" />
- <el-table-column prop="inboundNum" label="棰勮鍑哄簱鏁伴噺" width="120" align="right" />
- <el-table-column prop="inboundNum0" label="棰勮鍏ュ簱鏁伴噺" width="120" align="right" />
- <el-table-column prop="weeklyNetDemand" label="鎸夊懆鍑�闇�姹�" width="120" align="right">
+ <el-table :data="calculateResult"
+ stripe
+ border
+ style="width: 100%; margin-top: 20px;">
+ <el-table-column prop="productCategory"
+ label="浜у搧澶х被"
+ min-width="150" />
+ <el-table-column prop="specificationModel"
+ label="瑙勬牸鍨嬪彿"
+ width="120" />
+ <el-table-column prop="inboundNum0"
+ label="鐜版湁搴撳瓨"
+ width="100"
+ align="right" />
+ <el-table-column prop="inboundNum"
+ label="瀹夊叏搴撳瓨"
+ width="100"
+ align="right" />
+ <el-table-column prop="inboundNum"
+ label="棰勮鍑哄簱鏁伴噺"
+ width="120"
+ align="right" />
+ <el-table-column prop="inboundNum0"
+ label="棰勮鍏ュ簱鏁伴噺"
+ width="120"
+ align="right" />
+ <el-table-column prop="weeklyNetDemand"
+ label="鎸夊懆鍑�闇�姹�"
+ width="120"
+ align="right">
<template #default="{ row }">
- <el-tag :type="row.weeklyNetDemand > 0 ? 'warning' : 'success'" size="small">
+ <el-tag :type="row.weeklyNetDemand > 0 ? 'warning' : 'success'"
+ size="small">
{{ row.weeklyNetDemand }}
</el-tag>
</template>
</el-table-column>
- <el-table-column prop="suggestedPurchase" label="寤鸿閲囪喘" width="100" align="right">
+ <el-table-column prop="suggestedPurchase"
+ label="寤鸿閲囪喘"
+ width="100"
+ align="right">
<template #default="{ row }">
- <el-tag :type="row.suggestedPurchase > 0 ? 'danger' : 'success'" size="small">
+ <el-tag :type="row.suggestedPurchase > 0 ? 'danger' : 'success'"
+ size="small">
{{ row.suggestedPurchase }}
</el-tag>
</template>
@@ -299,214 +376,51 @@
</template>
<script setup>
-import FormDialog from '@/components/Dialog/FormDialog.vue';
-import {ref, reactive, onMounted, getCurrentInstance} from 'vue'
-import { ElMessage, ElMessageBox } from 'element-plus'
-import { Search, Refresh, Plus, Download } from '@element-plus/icons-vue'
-import {listPage,add,update,del,listPageCopy} from "@/api/procurementManagement/procurementPlan.js"
+ import FormDialog from "@/components/Dialog/FormDialog.vue";
+ import { ref, reactive, onMounted, getCurrentInstance, computed } from "vue";
+ import dayjs from "dayjs";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import { Search, Refresh, Plus, Download } from "@element-plus/icons-vue";
+ import {
+ listPage,
+ add,
+ update,
+ del,
+ listPageCopy,
+ } from "@/api/procurementManagement/procurementPlan.js";
-// 鍝嶅簲寮忔暟鎹�
-const loading = ref(false)
-const submitLoading = ref(false)
-const dialogVisible = ref(false)
-const productSelectDialogVisible = ref(false)
-const calculateDialogVisible = ref(false)
-const dialogType = ref('add')
-const productLoading = ref(false)
-const selectedProducts = ref([])
-const currentPlan = ref(null)
+ // 鍝嶅簲寮忔暟鎹�
+ const loading = ref(false);
+ const submitLoading = ref(false);
+ const dialogVisible = ref(false);
+ const productSelectDialogVisible = ref(false);
+ const calculateDialogVisible = ref(false);
+ const dialogType = ref("add");
+ const productLoading = ref(false);
+ const selectedProducts = ref([]);
+ const currentPlan = ref(null);
-// 鎼滅储琛ㄥ崟
-const searchForm = reactive({
- planName: '',
- status: ''
-})
+ // 鎼滅储琛ㄥ崟
+ const searchForm = reactive({
+ planName: "",
+ status: "",
+ });
-// 鍒嗛〉鏁版嵁
-const pagination = reactive({
- current: 1,
- size: 20
-})
+ // 鍒嗛〉鏁版嵁
+ const pagination = reactive({
+ current: 1,
+ size: 20,
+ });
-// 琛ㄥ崟鏁版嵁
-const formData = reactive({
- code: '',
- planName: '',
- description: '',
- status: '',
- isSystemPreset: false,
- formula: '',
- // 璁$畻鍙傛暟
- considerExistingStock: false,
- warehouseControl: false,
- calculateTotalDemand: false,
- considerSafetyStock: false,
- considerLockedStock: false,
- notConsiderMaterialAux: false,
- negativeStockAsDemand: false,
- // 姹囨�诲悎骞堕�夐」
- summaryMaterial: false,
- summaryAuxAttributes: false,
- summaryDemandDate: false
-})
-
-// 褰撳墠婵�娲荤殑鏍囩椤�
-const activeTab = ref('demand')
-
-// 琛ㄥ崟楠岃瘉瑙勫垯
-const formRules = {
- planName: [
- { required: true, message: '璇疯緭鍏ヨ鍒掑悕绉�', trigger: 'blur' }
- ],
- status: [
- { required: true, message: '璇烽�夋嫨鐘舵��', trigger: 'change' }
- ],
- formula: [
- { required: true, message: '璇疯緭鍏ヨ绠楀叕寮�', trigger: 'blur' }
- ]
-}
-
-// 琛ㄦ牸鏁版嵁
-const tableData = ref([])
-
-// 浜у搧鍒楄〃鏁版嵁
-const productList = ref([
- {
- id: 4,
- productName: '浜у搧D',
- productCode: 'PD004',
- existingStock: 90,
- safetyStock: 40,
- expectedOutbound: 160,
- expectedInbound: 35
- }
-])
-
-// 璁$畻缁撴灉鏁版嵁
-const calculateResult = ref([
- {
- productName: '浜у搧A',
- existingStock: 100,
- safetyStock: 50,
- expectedOutbound: 200,
- expectedInbound: 30,
- weeklyNetDemand: 120,
- suggestedPurchase: 150
- },
- {
- productName: '浜у搧B',
- existingStock: 80,
- safetyStock: 30,
- expectedOutbound: 150,
- expectedInbound: 20,
- weeklyNetDemand: 100,
- suggestedPurchase: 120
- }
-])
-const total = ref(0)
-// 鏂规硶
-const handleSearch = () => {
- pagination.current = 1
- loadData()
-}
-
-const handleReset = () => {
- Object.assign(searchForm, {
- planName: '',
- status: ''
- })
- handleSearch()
-}
-
-const loadData = () => {
- loading.value = true
- listPage({...searchForm,...pagination}).then(res => {
- if(res.code === 200){
- tableData.value = res.data.records
- total.value = res.data.total
- loading.value = false
- }
- })
-}
-
-const handleAdd = () => {
- dialogType.value = 'add'
- resetForm()
- // 鑷姩鐢熸垚缂栫爜
- formData.code = 'CGJH' + String(Date.now()).slice(-4)
- dialogVisible.value = true
-}
-
-const handleEdit = (row) => {
- dialogType.value = 'edit'
- Object.assign(formData, row)
- dialogVisible.value = true
-}
-
-const handleDelete = async (row) => {
- try {
- await ElMessageBox.confirm('纭畾瑕佸垹闄よ繖涓噰璐鍒掑悧锛�', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- })
- let ids = [row.id]
- del(ids).then(res =>{
- if(res.code === 200){
- ElMessage.success('鍒犻櫎鎴愬姛')
- loadData()
- }
- })
- } catch {
- // 鐢ㄦ埛鍙栨秷鍒犻櫎
- }
-}
-
-const handleSubmit = async () => {
- try {
- // 琛ㄥ崟楠岃瘉
- if (!formData.planName || !formData.formula) {
- ElMessage.error('璇峰~鍐欏繀濉」')
- return
- }
-
- submitLoading.value = true
-
- if (dialogType.value === 'add') {
- add(formData).then(res => {
- if(res.code === 200){
- ElMessage.success('鏂板鎴愬姛')
- dialogVisible.value = false
- loadData()
- }
- })
- } else {
- // 缂栬緫
- update(formData).then(res => {
- if(res.code === 200){
- ElMessage.success('缂栬緫鎴愬姛')
- dialogVisible.value = false
- loadData()
- }
- })
- }
-
-
- } catch (error) {
- ElMessage.error('鎿嶄綔澶辫触')
- } finally {
- submitLoading.value = false
- }
-}
-
-const resetForm = () => {
- Object.assign(formData, {
- code: '',
- planName: '',
- description: '',
- status: '',
+ // 琛ㄥ崟鏁版嵁
+ const formData = reactive({
+ code: "",
+ planName: "",
+ description: "",
+ status: "",
isSystemPreset: false,
- formula: '棰勮鍑哄簱鏁伴噺 - 鐜版湁搴撳瓨 + 瀹夊叏搴撳瓨 - 棰勮鍏ュ簱鏁伴噺',
+ formula: "",
+ createTime: "",
// 璁$畻鍙傛暟
considerExistingStock: false,
warehouseControl: false,
@@ -518,255 +432,425 @@
// 姹囨�诲悎骞堕�夐」
summaryMaterial: false,
summaryAuxAttributes: false,
- summaryDemandDate: false
- })
- activeTab.value = 'demand'
-}
+ summaryDemandDate: false,
+ });
+ const formCreateTimeDate = computed({
+ get: () => (formData.createTime ? String(formData.createTime).split(" ")[0] : ""),
+ set: (value) => {
+ formData.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
+ },
+ });
-const validateFormula = () => {
- // 绠�鍗曠殑鍏紡楠岃瘉
- const formula = formData.formula
- if (formula && !/^[a-zA-Z\u4e00-\u9fa5\s\*\+\-\/\(\)\d\.]+$/.test(formula)) {
- ElMessage.warning('鍏紡鏍煎紡鍙兘涓嶆纭紝璇锋鏌�')
- }
-}
+ // 褰撳墠婵�娲荤殑鏍囩椤�
+ const activeTab = ref("demand");
-const handleCalculate = (row) => {
- currentPlan.value = row
- productSelectDialogVisible.value = true
- loadProductList()
-}
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ const formRules = {
+ planName: [{ required: true, message: "璇疯緭鍏ヨ鍒掑悕绉�", trigger: "blur" }],
+ status: [{ required: true, message: "璇烽�夋嫨鐘舵��", trigger: "change" }],
+ formula: [{ required: true, message: "璇疯緭鍏ヨ绠楀叕寮�", trigger: "blur" }],
+ };
-const loadProductList = () => {
- productLoading.value = true
- // 妯℃嫙鍔犺浇浜у搧鏁版嵁
- listPageCopy({size:-1}).then(res => {
- if(res.code === 200){
- productList.value = res.data.records
- productLoading.value = false
+ // 琛ㄦ牸鏁版嵁
+ const tableData = ref([]);
+
+ // 浜у搧鍒楄〃鏁版嵁
+ const productList = ref([
+ {
+ id: 4,
+ productName: "浜у搧D",
+ productCode: "PD004",
+ existingStock: 90,
+ safetyStock: 40,
+ expectedOutbound: 160,
+ expectedInbound: 35,
+ },
+ ]);
+
+ // 璁$畻缁撴灉鏁版嵁
+ const calculateResult = ref([
+ {
+ productName: "浜у搧A",
+ existingStock: 100,
+ safetyStock: 50,
+ expectedOutbound: 200,
+ expectedInbound: 30,
+ weeklyNetDemand: 120,
+ suggestedPurchase: 150,
+ },
+ {
+ productName: "浜у搧B",
+ existingStock: 80,
+ safetyStock: 30,
+ expectedOutbound: 150,
+ expectedInbound: 20,
+ weeklyNetDemand: 100,
+ suggestedPurchase: 120,
+ },
+ ]);
+ const total = ref(0);
+ // 鏂规硶
+ const handleSearch = () => {
+ pagination.current = 1;
+ loadData();
+ };
+
+ const handleReset = () => {
+ Object.assign(searchForm, {
+ planName: "",
+ status: "",
+ });
+ handleSearch();
+ };
+
+ const loadData = () => {
+ loading.value = true;
+ listPage({ ...searchForm, ...pagination }).then(res => {
+ if (res.code === 200) {
+ tableData.value = res.data.records;
+ total.value = res.data.total;
+ loading.value = false;
+ }
+ });
+ };
+
+ const handleAdd = () => {
+ dialogType.value = "add";
+ resetForm();
+ formData.createTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
+ dialogVisible.value = true;
+ };
+
+ const handleEdit = row => {
+ dialogType.value = "edit";
+ Object.assign(formData, row);
+ dialogVisible.value = true;
+ };
+
+ const handleDelete = async row => {
+ try {
+ await ElMessageBox.confirm("纭畾瑕佸垹闄よ繖涓噰璐鍒掑悧锛�", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ });
+ let ids = [row.id];
+ del(ids).then(res => {
+ if (res.code === 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ loadData();
+ }
+ });
+ } catch {
+ // 鐢ㄦ埛鍙栨秷鍒犻櫎
}
- })
-}
+ };
-const handleProductSelectionChange = (selection) => {
- selectedProducts.value = selection
-}
+ const handleSubmit = async () => {
+ try {
+ // 琛ㄥ崟楠岃瘉
+ if (!formData.planName || !formData.formula) {
+ ElMessage.error("璇峰~鍐欏繀濉」");
+ return;
+ }
-const handleConfirmProductSelection = () => {
- if (selectedProducts.value.length === 0) {
- ElMessage.warning('璇烽�夋嫨瑕佽绠楃殑浜у搧')
- return
- }
-
- ElMessage.success(`姝e湪璁$畻 ${currentPlan.value.planName} 鐨勯噰璐渶姹�...`)
- productSelectDialogVisible.value = false
-
- // 鏍规嵁閫夋嫨鐨勪骇鍝佸拰璁$畻鍏紡杩涜璁$畻
- calculateWithSelectedProducts()
-}
+ submitLoading.value = true;
-const calculateWithSelectedProducts = () => {
- // 妯℃嫙璁$畻杩囩▼
- // 鏍规嵁閫夋嫨鐨勪骇鍝佹洿鏂拌绠楃粨鏋�
- const result = selectedProducts.value.map(product => {
- // 杩欓噷搴旇鏍规嵁瀹為檯鐨勮绠楀叕寮忚繘琛岃绠�
- // 绀轰緥锛氶璁″嚭搴撴暟閲� - 鐜版湁搴撳瓨 + 瀹夊叏搴撳瓨 - 棰勮鍏ュ簱鏁伴噺
- const weeklyNetDemand = product.inboundNum - product.inboundNum0 + product.inboundNum - product.inboundNum0
- const suggestedPurchase = Math.max(0, weeklyNetDemand)
-
- return {
- productCategory: product.productCategory,
- specificationModel: product.specificationModel,
- inboundNum0: product.inboundNum0,
- inboundNum: product.inboundNum,
- weeklyNetDemand: weeklyNetDemand,
- suggestedPurchase: suggestedPurchase
+ if (dialogType.value === "add") {
+ add(formData).then(res => {
+ if (res.code === 200) {
+ ElMessage.success("鏂板鎴愬姛");
+ dialogVisible.value = false;
+ loadData();
+ }
+ });
+ } else {
+ // 缂栬緫
+ update(formData).then(res => {
+ if (res.code === 200) {
+ ElMessage.success("缂栬緫鎴愬姛");
+ dialogVisible.value = false;
+ loadData();
+ }
+ });
+ }
+ } catch (error) {
+ ElMessage.error("鎿嶄綔澶辫触");
+ } finally {
+ submitLoading.value = false;
}
- })
+ };
- calculateResult.value = result
- calculateDialogVisible.value = true
-}
+ const resetForm = () => {
+ Object.assign(formData, {
+ code: "",
+ planName: "",
+ description: "",
+ status: "",
+ isSystemPreset: false,
+ formula: "棰勮鍑哄簱鏁伴噺 - 鐜版湁搴撳瓨 + 瀹夊叏搴撳瓨 - 棰勮鍏ュ簱鏁伴噺",
+ // 璁$畻鍙傛暟
+ considerExistingStock: false,
+ warehouseControl: false,
+ calculateTotalDemand: false,
+ considerSafetyStock: false,
+ considerLockedStock: false,
+ notConsiderMaterialAux: false,
+ negativeStockAsDemand: false,
+ // 姹囨�诲悎骞堕�夐」
+ summaryMaterial: false,
+ summaryAuxAttributes: false,
+ summaryDemandDate: false,
+ });
+ activeTab.value = "demand";
+ };
+ const validateFormula = () => {
+ // 绠�鍗曠殑鍏紡楠岃瘉
+ const formula = formData.formula;
+ if (formula && !/^[a-zA-Z\u4e00-\u9fa5\s\*\+\-\/\(\)\d\.]+$/.test(formula)) {
+ ElMessage.warning("鍏紡鏍煎紡鍙兘涓嶆纭紝璇锋鏌�");
+ }
+ };
-const handleCreatePurchaseOrder = () => {
- calculateDialogVisible.value = false
-}
-const { proxy } = getCurrentInstance();
-const handleExport = () => {
- ElMessageBox.confirm("鍐呭灏嗚瀵煎嚭锛屾槸鍚︾‘璁ゅ鍑猴紵", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
+ const handleCalculate = row => {
+ currentPlan.value = row;
+ productSelectDialogVisible.value = true;
+ loadProductList();
+ };
+
+ const loadProductList = () => {
+ productLoading.value = true;
+ // 妯℃嫙鍔犺浇浜у搧鏁版嵁
+ listPageCopy({ size: -1 }).then(res => {
+ if (res.code === 200) {
+ productList.value = res.data.records;
+ productLoading.value = false;
+ }
+ });
+ };
+
+ const handleProductSelectionChange = selection => {
+ selectedProducts.value = selection;
+ };
+
+ const handleConfirmProductSelection = () => {
+ if (selectedProducts.value.length === 0) {
+ ElMessage.warning("璇烽�夋嫨瑕佽绠楃殑浜у搧");
+ return;
+ }
+
+ ElMessage.success(`姝e湪璁$畻 ${currentPlan.value.planName} 鐨勯噰璐渶姹�...`);
+ productSelectDialogVisible.value = false;
+
+ // 鏍规嵁閫夋嫨鐨勪骇鍝佸拰璁$畻鍏紡杩涜璁$畻
+ calculateWithSelectedProducts();
+ };
+
+ const calculateWithSelectedProducts = () => {
+ // 妯℃嫙璁$畻杩囩▼
+ // 鏍规嵁閫夋嫨鐨勪骇鍝佹洿鏂拌绠楃粨鏋�
+ const result = selectedProducts.value.map(product => {
+ // 杩欓噷搴旇鏍规嵁瀹為檯鐨勮绠楀叕寮忚繘琛岃绠�
+ // 绀轰緥锛氶璁″嚭搴撴暟閲� - 鐜版湁搴撳瓨 + 瀹夊叏搴撳瓨 - 棰勮鍏ュ簱鏁伴噺
+ const weeklyNetDemand =
+ product.inboundNum -
+ product.inboundNum0 +
+ product.inboundNum -
+ product.inboundNum0;
+ const suggestedPurchase = Math.max(0, weeklyNetDemand);
+
+ return {
+ productCategory: product.productCategory,
+ specificationModel: product.specificationModel,
+ inboundNum0: product.inboundNum0,
+ inboundNum: product.inboundNum,
+ weeklyNetDemand: weeklyNetDemand,
+ suggestedPurchase: suggestedPurchase,
+ };
+ });
+
+ calculateResult.value = result;
+ calculateDialogVisible.value = true;
+ };
+
+ const handleCreatePurchaseOrder = () => {
+ calculateDialogVisible.value = false;
+ };
+ const { proxy } = getCurrentInstance();
+ const handleExport = () => {
+ ElMessageBox.confirm("鍐呭灏嗚瀵煎嚭锛屾槸鍚︾‘璁ゅ鍑猴紵", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
.then(() => {
proxy.download("/procurementPlan/export", {}, "閲囪喘璁″垝.xlsx");
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
-}
+ };
+ const handleSizeChange = size => {
+ pagination.size = size;
+ loadData();
+ };
-const handleSizeChange = (size) => {
- pagination.size = size
- loadData()
-}
+ const handleCurrentChange = current => {
+ pagination.current = current;
+ loadData();
+ };
-const handleCurrentChange = (current) => {
- pagination.current = current
- loadData()
-}
-
-// 鐢熷懡鍛ㄦ湡
-onMounted(() => {
- loadData()
-})
+ // 鐢熷懡鍛ㄦ湡
+ onMounted(() => {
+ loadData();
+ });
</script>
<style scoped>
-.app-container {
- padding: 20px;
-}
+ .app-container {
+ padding: 20px;
+ }
-.page-header {
- margin-bottom: 20px;
-}
+ .page-header {
+ margin-bottom: 20px;
+ }
-.page-header h2 {
- margin: 0 0 8px 0;
- color: #303133;
- font-size: 24px;
- font-weight: 600;
-}
+ .page-header h2 {
+ margin: 0 0 8px 0;
+ color: #303133;
+ font-size: 24px;
+ font-weight: 600;
+ }
-.page-header p {
- margin: 0;
- color: #909399;
- font-size: 14px;
-}
+ .page-header p {
+ margin: 0;
+ color: #909399;
+ font-size: 14px;
+ }
-.search-card {
- margin-bottom: 20px;
-}
+ .search-card {
+ margin-bottom: 20px;
+ }
-.search-form {
- margin-bottom: 0;
-}
+ .search-form {
+ margin-bottom: 0;
+ }
-.table-card {
- margin-bottom: 20px;
-}
+ .table-card {
+ margin-bottom: 20px;
+ }
-.table-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
-}
+ .table-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ }
-.table-title {
- font-size: 16px;
- font-weight: 600;
- color: #303133;
-}
+ .table-title {
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ }
-.table-actions {
- display: flex;
- gap: 10px;
-}
+ .table-actions {
+ display: flex;
+ gap: 10px;
+ }
-.pagination-container {
- margin-top: 20px;
- display: flex;
- justify-content: end;
-}
+ .pagination-container {
+ margin-top: 20px;
+ display: flex;
+ justify-content: end;
+ }
-.form-container {
- padding: 0 20px;
-}
+ .form-container {
+ padding: 0 20px;
+ }
-.formula-help {
- margin-top: 5px;
-}
+ .formula-help {
+ margin-top: 5px;
+ }
-.calculate-result {
- padding: 20px 0;
-}
+ .calculate-result {
+ padding: 20px 0;
+ }
-.dialog-footer {
- text-align: right;
-}
+ .dialog-footer {
+ text-align: right;
+ }
-:deep(.el-card__body) {
- padding: 20px;
-}
+ :deep(.el-card__body) {
+ padding: 20px;
+ }
-:deep(.el-table) {
- font-size: 14px;
-}
+ :deep(.el-table) {
+ font-size: 14px;
+ }
-:deep(.el-form-item__label) {
- font-weight: 500;
-}
+ :deep(.el-form-item__label) {
+ font-weight: 500;
+ }
-.form-container {
- padding: 0;
-}
+ .form-container {
+ padding: 0;
+ }
-.form-section {
- margin-bottom: 24px;
- border: 1px solid #e4e7ed;
- border-radius: 6px;
- overflow: hidden;
-}
+ .form-section {
+ margin-bottom: 24px;
+ border: 1px solid #e4e7ed;
+ border-radius: 6px;
+ overflow: hidden;
+ }
-.section-title {
- background-color: #f5f7fa;
- padding: 12px 16px;
- font-weight: 600;
- color: #303133;
- border-bottom: 1px solid #e4e7ed;
-}
+ .section-title {
+ background-color: #f5f7fa;
+ padding: 12px 16px;
+ font-weight: 600;
+ color: #303133;
+ border-bottom: 1px solid #e4e7ed;
+ }
-.form-section .el-form {
- padding: 20px;
-}
+ .form-section .el-form {
+ padding: 20px;
+ }
-.param-tabs {
- padding: 20px;
-}
+ .param-tabs {
+ padding: 20px;
+ }
-.param-tabs :deep(.el-tabs__header) {
- margin-bottom: 20px;
-}
+ .param-tabs :deep(.el-tabs__header) {
+ margin-bottom: 20px;
+ }
-.param-tabs :deep(.el-tabs__item.is-active) {
- color: #f56c6c;
- border-bottom-color: #f56c6c;
-}
+ .param-tabs :deep(.el-tabs__item.is-active) {
+ color: #f56c6c;
+ border-bottom-color: #f56c6c;
+ }
-.checkbox-group {
- display: flex;
- flex-wrap: wrap;
- gap: 16px;
-}
+ .checkbox-group {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 16px;
+ }
-.checkbox-group .el-checkbox {
- margin-right: 0;
- margin-bottom: 8px;
-}
+ .checkbox-group .el-checkbox {
+ margin-right: 0;
+ margin-bottom: 8px;
+ }
-.formula-input-section {
- padding: 20px;
-}
+ .formula-input-section {
+ padding: 20px;
+ }
-.formula-input-section .el-form-item {
- margin-bottom: 12px;
-}
+ .formula-input-section .el-form-item {
+ margin-bottom: 12px;
+ }
-.formula-help {
- text-align: center;
- margin-top: 8px;
-}
+ .formula-help {
+ text-align: center;
+ margin-top: 8px;
+ }
</style>
diff --git a/src/views/procurementManagement/purchaseOrder/index.vue b/src/views/procurementManagement/purchaseOrder/index.vue
index 7e56cb4..4f9812f 100644
--- a/src/views/procurementManagement/purchaseOrder/index.vue
+++ b/src/views/procurementManagement/purchaseOrder/index.vue
@@ -56,6 +56,13 @@
<el-option label="渚涘簲鍟咮" value="渚涘簲鍟咮" />
</el-select>
</el-form-item>
+ <el-form-item label="鍒涘缓鏃堕棿">
+ <el-date-picker v-model="formCreateTimeDate"
+ type="date"
+ placeholder="閫夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ style="width: 100%" />
+ </el-form-item>
<el-form-item label="澶囨敞">
<el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�" />
</el-form-item>
@@ -66,7 +73,8 @@
<script setup>
import FormDialog from '@/components/Dialog/FormDialog.vue';
-import { ref, reactive } from 'vue'
+import { ref, reactive, computed } from 'vue'
+import dayjs from 'dayjs'
import { ElMessage, ElMessageBox } from 'element-plus'
const loading = ref(false)
@@ -81,7 +89,14 @@
const formData = reactive({
supplierName: '',
- remark: ''
+ remark: '',
+ createTime: ''
+})
+const formCreateTimeDate = computed({
+ get: () => (formData.createTime ? String(formData.createTime).split(' ')[0] : ''),
+ set: (value) => {
+ formData.createTime = value ? `${value} ${dayjs().format('HH:mm:ss')}` : ''
+ }
})
const mockData = [
@@ -122,9 +137,9 @@
const openDialog = (type, row = {}) => {
dialogType.value = type
if (type === 'edit' && row.id) {
- Object.assign(formData, { supplierName: row.supplierName, remark: row.remark })
+ Object.assign(formData, { supplierName: row.supplierName, remark: row.remark, createTime: row.createTime || '' })
} else {
- Object.assign(formData, { supplierName: '', remark: '' })
+ Object.assign(formData, { supplierName: '', remark: '', createTime: dayjs().format('YYYY-MM-DD HH:mm:ss') })
}
dialogVisible.value = true
}
@@ -133,11 +148,11 @@
if (dialogType.value === 'add') {
const newOrder = {
id: Date.now(),
- orderNo: `PO${Date.now()}`,
+ orderNo: '',
supplierName: formData.supplierName,
status: 'draft',
totalAmount: 0,
- createTime: new Date().toLocaleString(),
+ createTime: formData.createTime,
remark: formData.remark
}
tableData.value.unshift(newOrder)
diff --git a/src/views/procurementManagement/qualityInspection/index.vue b/src/views/procurementManagement/qualityInspection/index.vue
index 7628839..aee1d99 100644
--- a/src/views/procurementManagement/qualityInspection/index.vue
+++ b/src/views/procurementManagement/qualityInspection/index.vue
@@ -116,6 +116,18 @@
<el-input v-model="formData.inspector" placeholder="璇疯緭鍏ヨ川妫�鍛樺鍚�" />
</el-form-item>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鍒涘缓鏃堕棿">
+ <el-date-picker v-model="formCreateTimeDate"
+ type="date"
+ placeholder="閫夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+
<el-form-item label="澶囨敞">
<el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�" />
</el-form-item>
@@ -126,7 +138,8 @@
<script setup>
import FormDialog from '@/components/Dialog/FormDialog.vue';
-import { ref, reactive } from 'vue'
+import { ref, reactive, computed } from 'vue'
+import dayjs from 'dayjs'
import { ElMessage, ElMessageBox } from 'element-plus'
const loading = ref(false)
@@ -144,7 +157,14 @@
supplierName: '',
products: [],
inspector: '',
- remark: ''
+ remark: '',
+ createTime: ''
+})
+const formCreateTimeDate = computed({
+ get: () => (formData.createTime ? String(formData.createTime).split(' ')[0] : ''),
+ set: (value) => {
+ formData.createTime = value ? `${value} ${dayjs().format('HH:mm:ss')}` : ''
+ }
})
const mockData = [
@@ -190,15 +210,17 @@
arrivalNo: row.arrivalNo,
supplierName: row.supplierName,
inspector: row.inspector,
- remark: row.remark
+ remark: row.remark,
+ createTime: row.createTime || ''
})
} else {
- Object.assign(formData, {
- arrivalNo: '',
- supplierName: '',
+ Object.assign(formData, {
+ arrivalNo: '',
+ supplierName: '',
products: [],
- inspector: '',
- remark: ''
+ inspector: '',
+ remark: '',
+ createTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
})
}
dialogVisible.value = true
@@ -228,13 +250,13 @@
if (dialogType.value === 'add') {
const newInspection = {
id: Date.now(),
- inspectionNo: `QI${Date.now()}`,
+ inspectionNo: '',
arrivalNo: formData.arrivalNo,
supplierName: formData.supplierName,
status: 'pending',
qualifiedQuantity: totalQualified,
unqualifiedQuantity: totalUnqualified,
- inspectionTime: new Date().toLocaleString(),
+ inspectionTime: formData.createTime,
inspector: formData.inspector,
remark: formData.remark
}
diff --git a/src/views/productManagement/productIdentifier/index.vue b/src/views/productManagement/productIdentifier/index.vue
index 94359e4..d638e7a 100644
--- a/src/views/productManagement/productIdentifier/index.vue
+++ b/src/views/productManagement/productIdentifier/index.vue
@@ -239,6 +239,13 @@
<el-form-item label="鏍囪瘑绫诲瀷">
<span>{{ currentProduct.identifierType }}</span>
</el-form-item>
+ <el-form-item label="鍒涘缓鏃堕棿">
+ <el-date-picker v-model="createTimeDate"
+ type="date"
+ placeholder="閫夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ style="width: 100%"></el-date-picker>
+ </el-form-item>
<el-form-item label="鐢熸垚鏁伴噺"
prop="generateQuantity">
<el-input-number v-model="generateQuantity"
@@ -356,6 +363,7 @@
<script setup>
import { ref, reactive, computed } from "vue";
+ import dayjs from "dayjs";
import { ElMessage, ElMessageBox } from "element-plus";
import { Plus, Search, Loading, Download } from "@element-plus/icons-vue";
import Pagination from "@/components/PIMTable/Pagination.vue";
@@ -442,6 +450,13 @@
const generateQuantity = ref(1);
const codeRule = ref("");
const customPrefix = ref("");
+ const createTime = ref(dayjs().format("YYYY-MM-DD HH:mm:ss"));
+ const createTimeDate = computed({
+ get: () => (createTime.value ? String(createTime.value).split(" ")[0] : ""),
+ set: (value) => {
+ createTime.value = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
+ },
+ });
const newBatchNo = ref("");
const reassignReason = ref("");
const formRef = ref();
@@ -659,9 +674,9 @@
currentProduct.value.batchNo
}_${String(i).padStart(3, "0")}`;
} else if (codeRule.value === "鏃堕棿鎴�+闅忔満鏁�") {
- identifierCode = `TS_${Date.now()}_${Math.floor(Math.random() * 1000)}`;
+ identifierCode = "";
} else if (codeRule.value === "鑷畾涔夎鍒�") {
- identifierCode = `${customPrefix.value || "CUSTOM"}_${Date.now()}_${i}`;
+ identifierCode = "";
}
newIdentifiers.push({
@@ -672,7 +687,7 @@
identifierType: currentProduct.value.identifierType,
identifierCode: identifierCode,
status: "宸茬敓鎴�",
- generateTime: new Date().toLocaleString(),
+ generateTime: createTime.value,
remark: "鎵归噺鐢熸垚",
});
}
diff --git a/src/views/productionManagement/productionTraceability/index.vue b/src/views/productionManagement/productionTraceability/index.vue
index b9d37a1..a726ad0 100644
--- a/src/views/productionManagement/productionTraceability/index.vue
+++ b/src/views/productionManagement/productionTraceability/index.vue
@@ -35,7 +35,7 @@
border>
<el-descriptions-item label="鐢熶骇璁㈠崟鍙�">{{ rowData.productionOrderDto?.npsNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="浜у搧鍚嶇О">{{ rowData.productionOrderDto?.productName || '-' }}</el-descriptions-item>
- <el-descriptions-item label="浜у搧瑙勬牸">{{ rowData.productionOrderDto?.model || '-' }}</el-descriptions-item>
+ <el-descriptions-item label="瑙勬牸鍨嬪彿">{{ rowData.productionOrderDto?.model || '-' }}</el-descriptions-item>
<!-- <el-descriptions-item label="鐗╂枡缂栫爜">{{ rowData.productionOrderDto?.materialCode || '-' }}</el-descriptions-item> -->
<el-descriptions-item label="璁″垝鏁伴噺">{{ rowData.productionOrderDto?.quantity || 0 }} <span class="unit">{{ rowData.productionOrderDto?.unit || '-' }}</span></el-descriptions-item>
<el-descriptions-item label="褰撳墠鐘舵��">
diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
index 1e4810a..8c76b2e 100644
--- a/src/views/productionManagement/workOrder/index.vue
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -93,7 +93,7 @@
<span class="info-value">{{ transferCardRowData.productName }}</span>
</div>
<div class="info-item">
- <span class="info-label">浜у搧瑙勬牸</span>
+ <span class="info-label">瑙勬牸鍨嬪彿</span>
<span class="info-value">{{ transferCardRowData.model }}</span>
</div>
<!-- <div class="info-item">
diff --git a/src/views/productionManagement/workOrderManagement/index.vue b/src/views/productionManagement/workOrderManagement/index.vue
index 60fe511..8bc6dc2 100644
--- a/src/views/productionManagement/workOrderManagement/index.vue
+++ b/src/views/productionManagement/workOrderManagement/index.vue
@@ -57,7 +57,7 @@
<span class="info-value">{{ transferCardRowData.productName }}</span>
</div>
<div class="info-item">
- <span class="info-label">浜у搧瑙勬牸</span>
+ <span class="info-label">瑙勬牸鍨嬪彿</span>
<span class="info-value">{{ transferCardRowData.model }}</span>
</div>
<div class="info-item">
diff --git a/src/views/productionPlan/productionPlan/index.vue b/src/views/productionPlan/productionPlan/index.vue
index 4251daa..fd6c1a3 100644
--- a/src/views/productionPlan/productionPlan/index.vue
+++ b/src/views/productionPlan/productionPlan/index.vue
@@ -56,7 +56,7 @@
style="width: 160px;"
@keyup.enter="handleQuery" />
</el-form-item>
- <el-form-item label="浜у搧瑙勬牸:"
+ <el-form-item label="瑙勬牸鍨嬪彿:"
prop="model">
<el-input v-model="searchForm.model"
placeholder="璇疯緭鍏�"
@@ -121,7 +121,7 @@
</el-row>
<el-row :gutter="20">
<el-col>
- <el-form-item label="浜у搧瑙勬牸">
+ <el-form-item label="瑙勬牸鍨嬪彿">
<div class="info-display">{{ mergeForm.model || '-' }}</div>
</el-form-item>
</el-col>
@@ -138,6 +138,12 @@
:max="sumAssignedQuantity"
@change="onBlur"
style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="鍒涘缓鏃堕棿">
+ <el-date-picker v-model="mergeCreateTimeDate"
+ type="date"
+ value-format="YYYY-MM-DD"
+ style="width: 100%" />
</el-form-item>
</el-form>
<template #footer>
@@ -173,7 +179,7 @@
prop="mpsNo">
<el-input v-model="form.mpsNo"
disabled
- placeholder="鏂板鍚庤嚜鍔ㄧ敓鎴�" />
+ placeholder="淇濆瓨鍚庤嚜鍔ㄧ敓鎴�" />
</el-form-item>
<el-form-item label="浜у搧鍚嶇О"
prop="productId">
@@ -186,7 +192,7 @@
@change="handleProductChange"
style="width: 100%" />
</el-form-item>
- <el-form-item label="浜у搧瑙勬牸"
+ <el-form-item label="瑙勬牸鍨嬪彿"
prop="productModelId">
<el-select v-model="form.productModelId"
@change="handleChangeSpecification"
@@ -226,6 +232,14 @@
value-format="YYYY-MM-DD"
style="width: 100%"
placeholder="璇烽�夋嫨鎵胯鏃ユ湡" />
+ </el-form-item>
+ <el-form-item label="鍒涘缓鏃堕棿"
+ prop="createTime">
+ <el-date-picker v-model="formCreateTimeDate"
+ type="date"
+ value-format="YYYY-MM-DD"
+ style="width: 100%"
+ placeholder="璇烽�夋嫨鍒涘缓鏃堕棿" />
</el-form-item>
<el-form-item label="澶囨敞"
prop="remark">
@@ -321,7 +335,7 @@
},
},
{
- label: "浜у搧瑙勬牸",
+ label: "瑙勬牸鍨嬪彿",
prop: "model",
width: "150px",
className: "spec-cell",
@@ -430,6 +444,7 @@
Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0);
mergeForm.planCompleteTime = row.requiredDate || "";
mergeForm.productId = row.productId || "";
+ mergeForm.createTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
mergeForm.ids = [row.id];
sumAssignedQuantity.value =
Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0);
@@ -473,6 +488,13 @@
totalAssignedQuantity: 0,
planCompleteTime: "",
productId: "",
+ createTime: "",
+ });
+ const mergeCreateTimeDate = computed({
+ get: () => (mergeForm.createTime ? String(mergeForm.createTime).split(" ")[0] : ""),
+ set: (value) => {
+ mergeForm.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
+ },
});
// 瀵煎叆鐩稿叧
@@ -503,11 +525,18 @@
requiredDate: "",
promisedDeliveryDate: "",
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 = reactive({
productId: [{ required: true, message: "璇烽�夋嫨浜у搧", trigger: "change" }],
productModelId: [
- { required: true, message: "璇烽�夋嫨浜у搧瑙勬牸", trigger: "change" },
+ { required: true, message: "璇烽�夋嫨瑙勬牸鍨嬪彿", trigger: "change" },
],
qtyRequired: [{ required: true, message: "璇疯緭鍏ユ暟閲�", trigger: "blur" }],
requiredDate: [
@@ -686,17 +715,17 @@
});
};
- // 閫変腑鐨勪骇鍝佽鏍糏D
+ // 閫変腑鐨勮鏍煎瀷鍙稩D
const selectedProductModelId = ref("");
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = selection => {
selectedRows.value = selection;
- // 濡傛灉鏈夐�変腑鐨勮锛岃褰曠涓�涓�変腑琛岀殑浜у搧瑙勬牸ID
+ // 濡傛灉鏈夐�変腑鐨勮锛岃褰曠涓�涓�変腑琛岀殑瑙勬牸鍨嬪彿ID
if (selection.length > 0) {
selectedProductModelId.value = selection[0].productModelId;
} else {
- // 濡傛灉娌℃湁閫変腑鐨勮锛屾竻绌轰骇鍝佽鏍糏D
+ // 濡傛灉娌℃湁閫変腑鐨勮锛屾竻绌鸿鏍煎瀷鍙稩D
selectedProductModelId.value = "";
}
};
@@ -717,7 +746,7 @@
if (!selectedProductModelId.value) {
return true;
}
- // 濡傛灉鏈夐�変腑鐨勮锛屽彧鏈変骇鍝佽鏍糏D鐩稿悓鐨勮鎵嶅彲閫夋嫨
+ // 濡傛灉鏈夐�変腑鐨勮锛屽彧鏈夎鏍煎瀷鍙稩D鐩稿悓鐨勮鎵嶅彲閫夋嫨
return row.productModelId === selectedProductModelId.value;
};
// 鎷夊彇鏁版嵁鎸夐挳鎿嶄綔
@@ -746,6 +775,7 @@
mergeForm.totalAssignedQuantity = totalAssignedQuantity;
mergeForm.planCompleteTime = firstRow.requiredDate || "";
mergeForm.productId = firstRow.productId || "";
+ mergeForm.createTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
mergeForm.ids = selectedRows.value.map(row => row.id);
// 鎵撳紑寮圭獥
@@ -889,6 +919,7 @@
requiredDate: "",
promisedDeliveryDate: "",
remark: "",
+ createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
});
dialogVisible.value = true;
fetchProductOptions();
@@ -909,6 +940,7 @@
requiredDate: row.requiredDate || "",
promisedDeliveryDate: row.promisedDeliveryDate || "",
remark: row.remark || "",
+ createTime: row.createTime || "",
});
dialogVisible.value = true;
fetchProductOptions();
diff --git a/src/views/qualityManagement/finalInspection/index.vue b/src/views/qualityManagement/finalInspection/index.vue
index bdb71c4..4a59fa4 100644
--- a/src/views/qualityManagement/finalInspection/index.vue
+++ b/src/views/qualityManagement/finalInspection/index.vue
@@ -1,59 +1,111 @@
<template>
<div class="app-container">
<div class="search_form mb20">
- <div>
- <span class="search_title">浜у搧鍚嶇О锛�</span>
- <el-input
- v-model="searchForm.productName"
- 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-form ref="searchFormRef"
+ :model="searchForm"
+ class="demo-form-inline">
+ <el-row :gutter="20">
+ <el-col :span="4">
+ <el-form-item label="浜у搧鍚嶇О"
+ prop="productName">
+ <el-input v-model="searchForm.productName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="6">
+ <el-form-item label="妫�娴嬫棩鏈�"
+ prop="entryDate">
+ <el-date-picker v-model="searchForm.entryDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="daterange"
+ placeholder="璇烽�夋嫨"
+ clearable
+ @change="changeDaterange" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="4">
+ <el-form-item label="閿�鍞崟鍙�"
+ prop="salesContractNo">
+ <el-input v-model="searchForm.salesContractNo"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ラ攢鍞崟鍙锋悳绱�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="4">
+ <el-form-item label="鐢熶骇宸ュ崟鍙�"
+ prop="workOrderNo">
+ <el-input v-model="searchForm.workOrderNo"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ョ敓浜у伐鍗曞彿鎼滅储"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <!-- 鎸夐挳 -->
+ <el-col :span="4">
+ <el-form-item>
+ <el-button type="primary"
+ @click="getList">
+ 鎼滅储
+ </el-button>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <div class="actions">
+ <el-button type="primary"
+ @click="openForm('add')">鏂板</el-button>
<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"
- :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>
- <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia>
- <FormDia ref="formDia" @close="handleQuery"></FormDia>
- <files-dia ref="filesDia" @close="handleQuery"></files-dia>
- <el-dialog v-model="dialogFormVisible" title="缂栬緫妫�楠屽憳" width="30%"
+ <InspectionFormDia ref="inspectionFormDia"
+ @close="handleQuery"></InspectionFormDia>
+ <FormDia ref="formDia"
+ @close="handleQuery"></FormDia>
+ <files-dia ref="filesDia"
+ @close="handleQuery"></files-dia>
+ <el-dialog v-model="dialogFormVisible"
+ title="缂栬緫妫�楠屽憳"
+ width="30%"
@close="closeDia">
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
- <el-form-item label="妫�楠屽憳锛�" prop="checkName">
- <el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
- :value="item.nickName"/>
+ <el-form :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef">
+ <el-form-item label="妫�楠屽憳锛�"
+ prop="checkName">
+ <el-select v-model="form.checkName"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.nickName"
+ :label="item.nickName"
+ :value="item.nickName" />
</el-select>
</el-form-item>
</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>
@@ -62,280 +114,320 @@
</template>
<script setup>
-import {Search} from "@element-plus/icons-vue";
-import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
-import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue";
-import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue";
-import {ElMessageBox} from "element-plus";
-import {
- downloadQualityInspect,
- qualityInspectDel,
- qualityInspectListPage, qualityInspectUpdate,
- submitQualityInspect
-} from "@/api/qualityManagement/rawMaterialInspection.js";
-import FilesDia from "@/views/qualityManagement/finalInspection/components/filesDia.vue";
-import dayjs from "dayjs";
-import {userListNoPage} from "@/api/system/user.js";
-import useUserStore from "@/store/modules/user";
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ onMounted,
+ ref,
+ reactive,
+ toRefs,
+ getCurrentInstance,
+ nextTick,
+ } from "vue";
+ import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue";
+ import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue";
+ import { ElMessageBox } from "element-plus";
+ import {
+ downloadQualityInspect,
+ qualityInspectDel,
+ qualityInspectListPage,
+ qualityInspectUpdate,
+ submitQualityInspect,
+ } from "@/api/qualityManagement/rawMaterialInspection.js";
+ import FilesDia from "@/views/qualityManagement/finalInspection/components/filesDia.vue";
+ import dayjs from "dayjs";
+ import { userListNoPage } from "@/api/system/user.js";
+ import useUserStore from "@/store/modules/user";
-const data = reactive({
- searchForm: {
- productName: "",
- entryDate: undefined, // 褰曞叆鏃ユ湡
- entryDateStart: undefined,
- entryDateEnd: undefined,
- },
- rules: {
- checkName: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
- },
-});
-const {searchForm} = toRefs(data);
-const tableColumn = ref([
- {
- label: "妫�娴嬫棩鏈�",
- prop: "checkTime",
- width: 120
- },
- {
- label: "閿�鍞崟鍙�",
- prop: "salesContractNo",
- width: 120
- },
- {
- label: "鐢熶骇宸ュ崟鍙�",
- prop: "workOrderNo",
- width: 120
- },
- {
- label: "妫�楠屽憳",
- prop: "checkName",
- },
- {
- label: "浜у搧鍚嶇О",
- prop: "productName",
- },
- {
- label: "瑙勬牸鍨嬪彿",
- prop: "model",
- },
- {
- label: "鍗曚綅",
- prop: "unit",
- },
- {
- label: "鎬绘暟閲�",
- prop: "quantity",
- width: 100
- },
- {
- label: "鍚堟牸鏁伴噺",
- prop: "qualifiedQuantity",
- width: 100
- },
- {
- label: "涓嶅悎鏍兼暟閲�",
- prop: "unqualifiedQuantity",
- width: 100
- },
- {
- label: "妫�娴嬪崟浣�",
- prop: "checkCompany",
- width: 120
- },
- {
- label: "妫�娴嬬粨鏋�",
- prop: "checkResult",
- dataType: "tag",
- formatType: (params) => {
- if (params == '涓嶅悎鏍�') {
- return "danger";
- } else if (params == '鍚堟牸') {
- return "success";
- } else {
- return 'danger';
- }
+ const data = reactive({
+ searchForm: {
+ productName: "",
+ salesContractNo: "",
+ workOrderNo: "",
+ entryDate: undefined, // 褰曞叆鏃ユ湡
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
},
- },
- {
- label: "鎻愪氦鐘舵��",
- prop: "inspectState",
- formatData: (params) => {
- if (params) {
- return "宸叉彁浜�";
- } else {
- return "鏈彁浜�";
- }
+ rules: {
+ checkName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
},
- },
- {
- dataType: "action",
- label: "鎿嶄綔",
- align: "center",
- fixed: "right",
- width: 280,
- operation: [
- {
- name: "缂栬緫",
- type: "text",
- clickFun: (row) => {
- openForm("edit", row);
- },
- disabled: (row) => {
- // 宸叉彁浜ゅ垯绂佺敤
- if (row.inspectState == 1) return true;
- // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
- if (row.checkName) {
- return row.checkName !== userStore.nickName;
- }
- return false;
+ });
+ const { searchForm } = toRefs(data);
+ const tableColumn = ref([
+ {
+ label: "妫�娴嬫棩鏈�",
+ prop: "checkTime",
+ width: 120,
+ },
+ {
+ label: "閿�鍞崟鍙�",
+ prop: "salesContractNo",
+ width: 120,
+ },
+ {
+ label: "鐢熶骇宸ュ崟鍙�",
+ prop: "workOrderNo",
+ width: 120,
+ },
+ {
+ label: "妫�楠屽憳",
+ prop: "checkName",
+ },
+ {
+ label: "浜у搧鍚嶇О",
+ prop: "productName",
+ },
+ {
+ label: "瑙勬牸鍨嬪彿",
+ prop: "model",
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ },
+ {
+ label: "鎬绘暟閲�",
+ prop: "quantity",
+ width: 100,
+ },
+ {
+ label: "鍚堟牸鏁伴噺",
+ prop: "qualifiedQuantity",
+ width: 100,
+ },
+ {
+ label: "涓嶅悎鏍兼暟閲�",
+ prop: "unqualifiedQuantity",
+ width: 100,
+ },
+ {
+ label: "鍚堟牸鐜�",
+ prop: "passRate",
+ width: 100,
+ dataType: "tag",
+ formatType: params => {
+ if (!params) return "";
+ const rate = parseFloat(params);
+ if (rate < 90) {
+ return "danger";
+ } else if (rate === 100) {
+ return "success";
+ } else {
+ return "warning";
}
},
- {
- name: "鏌ョ湅",
- type: "text",
- clickFun: (row) => {
- openForm("view", row);
- },
- },
- {
- name: "闄勪欢",
- type: "text",
- clickFun: (row) => {
- openFilesFormDia(row);
- },
- },
- {
- name: "鎻愪氦",
- type: "text",
- clickFun: (row) => {
- submit(row.id);
- },
- disabled: (row) => {
- // 宸叉彁浜ゅ垯绂佺敤
- if (row.inspectState == 1) return true;
- // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
- if (row.checkName) {
- return row.checkName !== userStore.nickName;
- }
- return false;
+ },
+ {
+ label: "妫�娴嬪崟浣�",
+ prop: "checkCompany",
+ width: 120,
+ },
+ {
+ label: "妫�娴嬬粨鏋�",
+ prop: "checkResult",
+ dataType: "tag",
+ formatType: params => {
+ if (params == "涓嶅悎鏍�") {
+ return "danger";
+ } else if (params == "鍚堟牸") {
+ return "success";
+ } else {
+ return "danger";
}
},
- {
- name: "鍒嗛厤妫�楠屽憳",
- type: "text",
- clickFun: (row) => {
- if (!row.checkName) {
- open(row)
- } else {
- proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
- }
- },
- disabled: (row) => {
- return row.inspectState == 1 || row.checkName;
+ },
+ {
+ label: "鎻愪氦鐘舵��",
+ prop: "inspectState",
+ formatData: params => {
+ if (params) {
+ return "宸叉彁浜�";
+ } else {
+ return "鏈彁浜�";
}
},
- {
- name: "涓嬭浇",
- type: "text",
- clickFun: (row) => {
- downLoadFile(row);
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 280,
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: row => {
+ openForm("edit", row);
+ },
+ disabled: row => {
+ // 宸叉彁浜ゅ垯绂佺敤
+ if (row.inspectState == 1) return true;
+ // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
+ if (row.checkName) {
+ return row.checkName !== userStore.nickName;
+ }
+ return false;
+ },
},
- },
- ],
- },
-]);
-const tableData = ref([]);
-const selectedRows = ref([]);
-const tableLoading = ref(false);
-const currentRow = ref(null)
-const page = reactive({
- current: 1,
- size: 100,
- total: 0
-});
-const formDia = ref()
-const filesDia = ref()
-const inspectionFormDia = ref()
-const {proxy} = getCurrentInstance()
-const userStore = useUserStore()
-const userList = ref([]);
-const form = ref({
- checkName: ""
-});
-const dialogFormVisible = ref(false);
+ {
+ name: "鏌ョ湅",
+ type: "text",
+ clickFun: row => {
+ openForm("view", row);
+ },
+ },
+ {
+ name: "闄勪欢",
+ type: "text",
+ clickFun: row => {
+ openFilesFormDia(row);
+ },
+ },
+ {
+ name: "鎻愪氦",
+ type: "text",
+ clickFun: row => {
+ submit(row.id);
+ },
+ disabled: row => {
+ // 宸叉彁浜ゅ垯绂佺敤
+ if (row.inspectState == 1) return true;
+ // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
+ if (row.checkName) {
+ return row.checkName !== userStore.nickName;
+ }
+ return false;
+ },
+ },
+ {
+ name: "鍒嗛厤妫�楠屽憳",
+ type: "text",
+ clickFun: row => {
+ if (!row.checkName) {
+ open(row);
+ } else {
+ proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
+ }
+ },
+ disabled: row => {
+ return row.inspectState == 1 || row.checkName;
+ },
+ },
+ {
+ name: "涓嬭浇",
+ type: "text",
+ clickFun: row => {
+ downLoadFile(row);
+ },
+ },
+ ],
+ },
+ ]);
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const tableLoading = ref(false);
+ const currentRow = ref(null);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const formDia = ref();
+ const filesDia = ref();
+ const inspectionFormDia = ref();
+ const { proxy } = getCurrentInstance();
+ const userStore = useUserStore();
+ const userList = ref([]);
+ const form = ref({
+ checkName: "",
+ });
+ const dialogFormVisible = ref(false);
-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 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
- qualityInspectListPage({...params, inspectType: 2}).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 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;
+ qualityInspectListPage({ ...params, inspectType: 2 })
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records.map(item => {
+ const quantity = parseFloat(item.quantity);
+ const qualifiedQuantity = parseFloat(item.qualifiedQuantity);
+ let passRate = null;
+ if (!isNaN(quantity) && !isNaN(qualifiedQuantity) && quantity > 0) {
+ passRate = ((qualifiedQuantity / quantity) * 100).toFixed(2) + "%";
+ }
+ return {
+ ...item,
+ passRate: passRate,
+ };
+ });
+ 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 openInspectionForm = (type, row) => {
- nextTick(() => {
- inspectionFormDia.value?.openDialog(type, row)
- })
-};
-// 鎵撳紑闄勪欢寮规
-const openFilesFormDia = (type, row) => {
- nextTick(() => {
- filesDia.value?.openDialog(type, row)
- })
-};
+ // 鎵撳紑寮规
+ const openForm = (type, row) => {
+ nextTick(() => {
+ formDia.value?.openDialog(type, row);
+ });
+ };
+ // 鎵撳紑鏂板妫�楠屽脊妗�
+ const openInspectionForm = (type, row) => {
+ nextTick(() => {
+ inspectionFormDia.value?.openDialog(type, row);
+ });
+ };
+ // 鎵撳紑闄勪欢寮规
+ const openFilesFormDia = (type, row) => {
+ nextTick(() => {
+ filesDia.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",
- })
+ // 鍒犻櫎
+ 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(() => {
- qualityInspectDel(ids).then((res) => {
+ qualityInspectDel(ids).then(res => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
});
@@ -343,78 +435,88 @@
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
-};
-// 瀵煎嚭
-const handleOut = () => {
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
+ };
+ // 瀵煎嚭
+ const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
.then(() => {
- proxy.download("/quality/qualityInspect/export", {inspectType: 2}, "鍑哄巶妫�楠�.xlsx");
+ proxy.download(
+ "/quality/qualityInspect/export",
+ { inspectType: 2 },
+ "鍑哄巶妫�楠�.xlsx"
+ );
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
-};
+ };
-// 鎻愪环
-const submit = async (id) => {
- const res = await submitQualityInspect({id: id})
- if (res.code === 200) {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- getList();
- }
-}
-
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef");
- dialogFormVisible.value = false;
-};
-
-const submitForm = () => {
- if (currentRow.value) {
- const data = {
- ...form.value,
- id: currentRow.value.id
- }
- qualityInspectUpdate(data).then(res => {
+ // 鎻愪环
+ const submit = async id => {
+ const res = await submitQualityInspect({ id: id });
+ if (res.code === 200) {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
getList();
- })
- }
-};
+ }
+ };
-const open = async (row) => {
- let userLists = await userListNoPage();
- userList.value = userLists.data;
- currentRow.value = row
- dialogFormVisible.value = true
-}
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ };
-const downLoadFile = (row) => {
- downloadQualityInspect({id: row.id}).then((blobData) => {
- const blob = new Blob([blobData], {
- type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
- })
- const downloadUrl = window.URL.createObjectURL(blob)
+ const submitForm = () => {
+ if (currentRow.value) {
+ const data = {
+ ...form.value,
+ id: currentRow.value.id,
+ };
+ qualityInspectUpdate(data).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ }
+ };
- const link = document.createElement('a')
- link.href = downloadUrl
- link.download = '鍘熸潗鏂欐楠屾姤鍛�.docx'
- document.body.appendChild(link)
- link.click()
+ const open = async row => {
+ let userLists = await userListNoPage();
+ userList.value = userLists.data;
+ currentRow.value = row;
+ dialogFormVisible.value = true;
+ };
- document.body.removeChild(link)
- window.URL.revokeObjectURL(downloadUrl)
- })
-};
-onMounted(() => {
- getList();
-});
+ const downLoadFile = row => {
+ downloadQualityInspect({ id: row.id }).then(blobData => {
+ const blob = new Blob([blobData], {
+ type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ });
+ const downloadUrl = window.URL.createObjectURL(blob);
+
+ const link = document.createElement("a");
+ link.href = downloadUrl;
+ link.download = "鍘熸潗鏂欐楠屾姤鍛�.docx";
+ document.body.appendChild(link);
+ link.click();
+
+ document.body.removeChild(link);
+ window.URL.revokeObjectURL(downloadUrl);
+ });
+ };
+ onMounted(() => {
+ getList();
+ });
</script>
-<style scoped></style>
+<style scoped lang="scss">
+ .actions {
+ display: flex;
+ justify-content: flex-end;
+ margin-bottom: 10px;
+ }
+</style>
diff --git a/src/views/qualityManagement/nearExpiryReturn/index.vue b/src/views/qualityManagement/nearExpiryReturn/index.vue
index 93e19c2..26dc747 100644
--- a/src/views/qualityManagement/nearExpiryReturn/index.vue
+++ b/src/views/qualityManagement/nearExpiryReturn/index.vue
@@ -1,213 +1,257 @@
<template>
<div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="浜у搧鍚嶇О" prop="productName">
- <el-input
- v-model="queryParams.productName"
- placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"
- clearable
- @keyup.enter.native="handleQuery"
- />
+ <el-form :model="queryParams"
+ ref="queryForm"
+ :inline="true"
+ v-show="showSearch"
+ label-width="68px">
+ <el-form-item label="浜у搧鍚嶇О"
+ prop="productName">
+ <el-input v-model="queryParams.productName"
+ placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"
+ clearable
+ @keyup.enter.native="handleQuery" />
</el-form-item>
- <el-form-item label="鎵规鍙�" prop="batchNumber">
- <el-input
- v-model="queryParams.batchNumber"
- placeholder="璇疯緭鍏ユ壒娆″彿"
- clearable
- @keyup.enter.native="handleQuery"
- />
+ <el-form-item label="鎵规鍙�"
+ prop="batchNumber">
+ <el-input v-model="queryParams.batchNumber"
+ placeholder="璇疯緭鍏ユ壒娆″彿"
+ clearable
+ @keyup.enter.native="handleQuery" />
</el-form-item>
- <el-form-item label="閫�鍥炴棩鏈�" prop="returnDate">
- <el-date-picker
- clearable
- v-model="queryParams.returnDate"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨閫�鍥炴棩鏈�">
+ <el-form-item label="閫�鍥炴棩鏈�"
+ prop="returnDate">
+ <el-date-picker clearable
+ v-model="queryParams.returnDate"
+ type="date"
+ value-format="YYYY-MM-DD"
+ placeholder="璇烽�夋嫨閫�鍥炴棩鏈�">
</el-date-picker>
</el-form-item>
<el-form-item>
- <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button>
- <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
+ <el-button type="primary"
+ icon="Search"
+ @click="handleQuery">鎼滅储</el-button>
+ <el-button icon="Refresh"
+ @click="resetQuery">閲嶇疆</el-button>
</el-form-item>
</el-form>
-
- <el-row :gutter="10" class="mb8">
+ <el-row :gutter="10"
+ class="mb8">
<el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="Plus"
- @click="handleAdd"
- >鏂板</el-button>
+ <el-button type="primary"
+ plain
+ icon="Plus"
+ @click="handleAdd">鏂板</el-button>
</el-col>
<el-col :span="1.5">
- <el-button
- type="success"
- plain
- icon="Edit"
- :disabled="single"
- @click="handleUpdate"
- >淇敼</el-button>
+ <el-button type="success"
+ plain
+ icon="Edit"
+ :disabled="single"
+ @click="handleUpdate">淇敼</el-button>
</el-col>
<el-col :span="1.5">
- <el-button
- type="danger"
- plain
- icon="Delete"
- :disabled="multiple"
- @click="handleDelete"
- >鍒犻櫎</el-button>
+ <el-button type="danger"
+ plain
+ icon="Delete"
+ :disabled="multiple"
+ @click="handleDelete">鍒犻櫎</el-button>
</el-col>
<el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="Download"
- @click="handleExport"
- >瀵煎嚭</el-button>
+ <el-button type="warning"
+ plain
+ icon="Download"
+ @click="handleExport">瀵煎嚭</el-button>
</el-col>
- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+ <right-toolbar v-model:showSearch="showSearch"
+ @queryTable="getList"></right-toolbar>
</el-row>
-
- <el-table v-loading="loading" :data="nearExpiryReturnList" @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="搴忓彿" type="index" width="50" align="center" />
- <el-table-column label="浜у搧鍚嶇О" prop="productName" />
- <el-table-column label="浜у搧瑙勬牸" prop="productSpec" />
- <el-table-column label="鎵规鍙�" prop="batchNumber" />
- <el-table-column label="鐢熶骇鏃ユ湡" prop="productionDate" align="center">
+ <el-table v-loading="loading"
+ :data="nearExpiryReturnList"
+ @selection-change="handleSelectionChange">
+ <el-table-column type="selection"
+ width="55"
+ align="center" />
+ <el-table-column label="搴忓彿"
+ type="index"
+ width="50"
+ align="center" />
+ <el-table-column label="浜у搧鍚嶇О"
+ prop="productName" />
+ <el-table-column label="瑙勬牸鍨嬪彿"
+ prop="productSpec" />
+ <el-table-column label="鎵规鍙�"
+ prop="batchNumber" />
+ <el-table-column label="鐢熶骇鏃ユ湡"
+ prop="productionDate"
+ align="center">
<template #default="scope">
<span>{{ parseTime(scope.row.productionDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
- <el-table-column label="鍒版湡鏃ユ湡" prop="expiryDate" align="center">
+ <el-table-column label="鍒版湡鏃ユ湡"
+ prop="expiryDate"
+ align="center">
<template #default="scope">
<span>{{ parseTime(scope.row.expiryDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
- <el-table-column label="閫�鍥炴暟閲�" prop="returnQuantity" />
- <el-table-column label="閫�鍥炲師鍥�" prop="returnReason" />
- <el-table-column label="閫�鍥炴棩鏈�" prop="returnDate" align="center">
+ <el-table-column label="閫�鍥炴暟閲�"
+ prop="returnQuantity" />
+ <el-table-column label="閫�鍥炲師鍥�"
+ prop="returnReason" />
+ <el-table-column label="閫�鍥炴棩鏈�"
+ prop="returnDate"
+ align="center">
<template #default="scope">
<span>{{ parseTime(scope.row.returnDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
- <el-table-column label="澶勭悊鐘舵��" prop="status" align="center">
+ <el-table-column label="澶勭悊鐘舵��"
+ prop="status"
+ align="center">
<template #default="scope">
- <dict-tag :options="statusOptions" :value="scope.row.status"/>
+ <dict-tag :options="statusOptions"
+ :value="scope.row.status" />
</template>
</el-table-column>
- <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
+ <el-table-column label="鎿嶄綔"
+ align="center"
+ class-name="small-padding fixed-width">
<template #default="scope">
- <el-button size="mini" type="text" icon="Edit" @click="handleUpdate(scope.row)">淇敼</el-button>
- <el-button size="mini" type="text" icon="Delete" @click="handleDelete(scope.row)">鍒犻櫎</el-button>
+ <el-button size="mini"
+ type="text"
+ icon="Edit"
+ @click="handleUpdate(scope.row)">淇敼</el-button>
+ <el-button size="mini"
+ type="text"
+ icon="Delete"
+ @click="handleDelete(scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
-
- <pagination
- v-show="total>0"
- :total="total"
- v-model:page="queryParams.pageNum"
- v-model:limit="queryParams.pageSize"
- @pagination="getList"
- />
-
+ <pagination v-show="total>0"
+ :total="total"
+ v-model:page="queryParams.pageNum"
+ v-model:limit="queryParams.pageSize"
+ @pagination="getList" />
<!-- 娣诲姞鎴栦慨鏀逛复鏈熼��鍥炲彴璐﹀璇濇 -->
- <el-dialog :title="title" v-model="open" width="800px" append-to-body>
- <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
+ <el-dialog :title="title"
+ v-model="open"
+ width="800px"
+ append-to-body>
+ <el-form ref="formRef"
+ :model="form"
+ :rules="rules"
+ label-width="100px">
<el-row>
<el-col :span="12">
- <el-form-item label="浜у搧鍚嶇О" prop="productName">
- <el-input v-model="form.productName" placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�" />
+ <el-form-item label="浜у搧鍚嶇О"
+ prop="productName">
+ <el-input v-model="form.productName"
+ placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�" />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="浜у搧瑙勬牸" prop="productSpec">
- <el-input v-model="form.productSpec" placeholder="璇疯緭鍏ヤ骇鍝佽鏍�" />
+ <el-form-item label="瑙勬牸鍨嬪彿"
+ prop="productSpec">
+ <el-input v-model="form.productSpec"
+ placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
- <el-form-item label="鎵规鍙�" prop="batchNumber">
- <el-input v-model="form.batchNumber" placeholder="璇疯緭鍏ユ壒娆″彿" />
+ <el-form-item label="鎵规鍙�"
+ prop="batchNumber">
+ <el-input v-model="form.batchNumber"
+ placeholder="璇疯緭鍏ユ壒娆″彿" />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="閫�鍥炴暟閲�" prop="returnQuantity">
- <el-input-number v-model="form.returnQuantity" controls-position="right" :min="1" />
+ <el-form-item label="閫�鍥炴暟閲�"
+ prop="returnQuantity">
+ <el-input-number v-model="form.returnQuantity"
+ controls-position="right"
+ :min="1" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
- <el-form-item label="鐢熶骇鏃ユ湡" prop="productionDate">
- <el-date-picker
- clearable
- v-model="form.productionDate"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨鐢熶骇鏃ユ湡">
+ <el-form-item label="鐢熶骇鏃ユ湡"
+ prop="productionDate">
+ <el-date-picker clearable
+ v-model="form.productionDate"
+ type="date"
+ value-format="YYYY-MM-DD"
+ placeholder="璇烽�夋嫨鐢熶骇鏃ユ湡">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍒版湡鏃ユ湡" prop="expiryDate">
- <el-date-picker
- clearable
- v-model="form.expiryDate"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨鍒版湡鏃ユ湡">
+ <el-form-item label="鍒版湡鏃ユ湡"
+ prop="expiryDate">
+ <el-date-picker clearable
+ v-model="form.expiryDate"
+ type="date"
+ value-format="YYYY-MM-DD"
+ placeholder="璇烽�夋嫨鍒版湡鏃ユ湡">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
- <el-form-item label="閫�鍥炴棩鏈�" prop="returnDate">
- <el-date-picker
- clearable
- v-model="form.returnDate"
- type="date"
- value-format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨閫�鍥炴棩鏈�">
+ <el-form-item label="閫�鍥炴棩鏈�"
+ prop="returnDate">
+ <el-date-picker clearable
+ v-model="form.returnDate"
+ type="date"
+ value-format="YYYY-MM-DD"
+ placeholder="璇烽�夋嫨閫�鍥炴棩鏈�">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="澶勭悊鐘舵��" prop="status">
- <el-select v-model="form.status" placeholder="璇烽�夋嫨澶勭悊鐘舵��">
- <el-option
- v-for="dict in statusOptions"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- ></el-option>
+ <el-form-item label="澶勭悊鐘舵��"
+ prop="status">
+ <el-select v-model="form.status"
+ placeholder="璇烽�夋嫨澶勭悊鐘舵��">
+ <el-option v-for="dict in statusOptions"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
- <el-form-item label="閫�鍥炲師鍥�" prop="returnReason">
- <el-input v-model="form.returnReason" type="textarea" placeholder="璇疯緭鍏ラ��鍥炲師鍥�" />
+ <el-form-item label="閫�鍥炲師鍥�"
+ prop="returnReason">
+ <el-input v-model="form.returnReason"
+ type="textarea"
+ placeholder="璇疯緭鍏ラ��鍥炲師鍥�" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
- <el-form-item label="澶囨敞" prop="remark">
- <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ娉�" />
+ <el-form-item label="澶囨敞"
+ prop="remark">
+ <el-input v-model="form.remark"
+ type="textarea"
+ placeholder="璇疯緭鍏ュ娉�" />
</el-form-item>
</el-col>
</el-row>
</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="cancel">鍙� 娑�</el-button>
</div>
</template>
@@ -216,180 +260,186 @@
</template>
<script setup name="NearExpiryReturn">
-import { ref, reactive, onMounted } from "vue";
-import { ElMessageBox } from "element-plus";
-// API鎺ュ彛宸茬Щ闄わ紝涓嶅啀璋冪敤鍚庣鎺ュ彛
+ import { ref, reactive, onMounted } from "vue";
+ import { ElMessageBox } from "element-plus";
+ // API鎺ュ彛宸茬Щ闄わ紝涓嶅啀璋冪敤鍚庣鎺ュ彛
-const { proxy } = getCurrentInstance();
-const { parseTime } = proxy;
+ const { proxy } = getCurrentInstance();
+ const { parseTime } = proxy;
-const nearExpiryReturnList = ref([]);
-const open = ref(false);
-const loading = ref(true);
-const showSearch = ref(true);
-const ids = ref([]);
-const single = ref(true);
-const multiple = ref(true);
-const total = ref(0);
-const title = ref("");
+ const nearExpiryReturnList = ref([]);
+ const open = ref(false);
+ const loading = ref(true);
+ const showSearch = ref(true);
+ const ids = ref([]);
+ const single = ref(true);
+ const multiple = ref(true);
+ const total = ref(0);
+ const title = ref("");
-// 鐘舵�佸瓧鍏�
-const statusOptions = ref([
- { label: "寰呭鐞�", value: "0" },
- { label: "澶勭悊涓�", value: "1" },
- { label: "宸插畬鎴�", value: "2" }
-]);
+ // 鐘舵�佸瓧鍏�
+ const statusOptions = ref([
+ { label: "寰呭鐞�", value: "0" },
+ { label: "澶勭悊涓�", value: "1" },
+ { label: "宸插畬鎴�", value: "2" },
+ ]);
-const data = reactive({
- form: {},
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- productName: null,
- batchNumber: null,
- returnDate: null
- },
- rules: {
- productName: [
- { required: true, message: "浜у搧鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }
- ],
- productSpec: [
- { required: true, message: "浜у搧瑙勬牸涓嶈兘涓虹┖", trigger: "blur" }
- ],
- batchNumber: [
- { required: true, message: "鎵规鍙蜂笉鑳戒负绌�", trigger: "blur" }
- ],
- returnQuantity: [
- { required: true, message: "閫�鍥炴暟閲忎笉鑳戒负绌�", trigger: "blur" }
- ],
- productionDate: [
- { required: true, message: "鐢熶骇鏃ユ湡涓嶈兘涓虹┖", trigger: "blur" }
- ],
- expiryDate: [
- { required: true, message: "鍒版湡鏃ユ湡涓嶈兘涓虹┖", trigger: "blur" }
- ],
- returnDate: [
- { required: true, message: "閫�鍥炴棩鏈熶笉鑳戒负绌�", trigger: "blur" }
- ],
- returnReason: [
- { required: true, message: "閫�鍥炲師鍥犱笉鑳戒负绌�", trigger: "blur" }
- ],
- status: [
- { required: true, message: "澶勭悊鐘舵�佷笉鑳戒负绌�", trigger: "change" }
- ]
- }
-});
-
-const { queryParams, form, rules } = toRefs(data);
-
-/** 鏌ヨ涓存湡閫�鍥炲彴璐﹀垪琛� */
-function getList() {
- loading.value = true;
- // 涓嶈皟鐢ㄦ帴鍙o紝杩斿洖绌烘暟鎹�
- nearExpiryReturnList.value = [];
- total.value = 0;
- loading.value = false;
-}
-
-// 鍙栨秷鎸夐挳
-function cancel() {
- open.value = false;
- reset();
-}
-
-// 琛ㄥ崟閲嶇疆
-function reset() {
- form.value = {
- id: null,
- productName: null,
- productSpec: null,
- batchNumber: null,
- productionDate: null,
- expiryDate: null,
- returnQuantity: null,
- returnReason: null,
- returnDate: null,
- status: null,
- remark: null
- };
- proxy.resetForm("formRef");
-}
-
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-function handleQuery() {
- queryParams.value.pageNum = 1;
- getList();
-}
-
-/** 閲嶇疆鎸夐挳鎿嶄綔 */
-function resetQuery() {
- proxy.resetForm("queryForm");
- handleQuery();
-}
-
-// 澶氶�夋閫変腑鏁版嵁
-function handleSelectionChange(selection) {
- ids.value = selection.map(item => item.id);
- single.value = selection.length !== 1;
- multiple.value = !selection.length;
-}
-
-/** 鏂板鎸夐挳鎿嶄綔 */
-function handleAdd() {
- reset();
- open.value = true;
- title.value = "娣诲姞涓存湡閫�鍥炲彴璐�";
-}
-
-/** 淇敼鎸夐挳鎿嶄綔 */
-function handleUpdate(row) {
- reset();
- // 涓嶈皟鐢ㄦ帴鍙o紝鐩存帴浣跨敤浼犲叆鐨勬暟鎹�
- if (row) {
- form.value = { ...row };
- open.value = true;
- title.value = "淇敼涓存湡閫�鍥炲彴璐�";
- }
-}
-
-/** 鎻愪氦鎸夐挳 */
-function submitForm() {
- proxy.$refs["formRef"].validate(valid => {
- if (valid) {
- // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘垚鍔熸彁绀�
- if (form.value.id != null) {
- proxy.$modal.msgSuccess("淇敼鎴愬姛");
- } else {
- proxy.$modal.msgSuccess("鏂板鎴愬姛");
- }
- open.value = false;
- getList();
- }
+ const data = reactive({
+ form: {},
+ queryParams: {
+ pageNum: 1,
+ pageSize: 10,
+ productName: null,
+ batchNumber: null,
+ returnDate: null,
+ },
+ rules: {
+ productName: [
+ { required: true, message: "浜у搧鍚嶇О涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ productSpec: [
+ { required: true, message: "瑙勬牸鍨嬪彿涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ batchNumber: [
+ { required: true, message: "鎵规鍙蜂笉鑳戒负绌�", trigger: "blur" },
+ ],
+ returnQuantity: [
+ { required: true, message: "閫�鍥炴暟閲忎笉鑳戒负绌�", trigger: "blur" },
+ ],
+ productionDate: [
+ { required: true, message: "鐢熶骇鏃ユ湡涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ expiryDate: [
+ { required: true, message: "鍒版湡鏃ユ湡涓嶈兘涓虹┖", trigger: "blur" },
+ ],
+ returnDate: [
+ { required: true, message: "閫�鍥炴棩鏈熶笉鑳戒负绌�", trigger: "blur" },
+ ],
+ returnReason: [
+ { required: true, message: "閫�鍥炲師鍥犱笉鑳戒负绌�", trigger: "blur" },
+ ],
+ status: [
+ { required: true, message: "澶勭悊鐘舵�佷笉鑳戒负绌�", trigger: "change" },
+ ],
+ },
});
-}
-/** 鍒犻櫎鎸夐挳鎿嶄綔 */
-function handleDelete(row) {
- const deleteIds = row.id || ids.value;
- ElMessageBox.confirm('鏄惁纭鍒犻櫎涓存湡閫�鍥炲彴璐︾紪鍙蜂负"' + deleteIds + '"鐨勬暟鎹」锛�', "璀﹀憡", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning"
- }).then(function() {
- // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘垚鍔熸彁绀�
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ const { queryParams, form, rules } = toRefs(data);
+
+ /** 鏌ヨ涓存湡閫�鍥炲彴璐﹀垪琛� */
+ function getList() {
+ loading.value = true;
+ // 涓嶈皟鐢ㄦ帴鍙o紝杩斿洖绌烘暟鎹�
+ nearExpiryReturnList.value = [];
+ total.value = 0;
+ loading.value = false;
+ }
+
+ // 鍙栨秷鎸夐挳
+ function cancel() {
+ open.value = false;
+ reset();
+ }
+
+ // 琛ㄥ崟閲嶇疆
+ function reset() {
+ form.value = {
+ id: null,
+ productName: null,
+ productSpec: null,
+ batchNumber: null,
+ productionDate: null,
+ expiryDate: null,
+ returnQuantity: null,
+ returnReason: null,
+ returnDate: null,
+ status: null,
+ remark: null,
+ };
+ proxy.resetForm("formRef");
+ }
+
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ function handleQuery() {
+ queryParams.value.pageNum = 1;
getList();
- }).catch(() => {});
-}
+ }
-/** 瀵煎嚭鎸夐挳鎿嶄綔 */
-function handleExport() {
- // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘彁绀�
- proxy.$modal.msgSuccess("瀵煎嚭鍔熻兘鏆傛湭瀹炵幇");
-}
+ /** 閲嶇疆鎸夐挳鎿嶄綔 */
+ function resetQuery() {
+ proxy.resetForm("queryForm");
+ handleQuery();
+ }
-onMounted(() => {
- getList();
-});
+ // 澶氶�夋閫変腑鏁版嵁
+ function handleSelectionChange(selection) {
+ ids.value = selection.map(item => item.id);
+ single.value = selection.length !== 1;
+ multiple.value = !selection.length;
+ }
+
+ /** 鏂板鎸夐挳鎿嶄綔 */
+ function handleAdd() {
+ reset();
+ open.value = true;
+ title.value = "娣诲姞涓存湡閫�鍥炲彴璐�";
+ }
+
+ /** 淇敼鎸夐挳鎿嶄綔 */
+ function handleUpdate(row) {
+ reset();
+ // 涓嶈皟鐢ㄦ帴鍙o紝鐩存帴浣跨敤浼犲叆鐨勬暟鎹�
+ if (row) {
+ form.value = { ...row };
+ open.value = true;
+ title.value = "淇敼涓存湡閫�鍥炲彴璐�";
+ }
+ }
+
+ /** 鎻愪氦鎸夐挳 */
+ function submitForm() {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘垚鍔熸彁绀�
+ if (form.value.id != null) {
+ proxy.$modal.msgSuccess("淇敼鎴愬姛");
+ } else {
+ proxy.$modal.msgSuccess("鏂板鎴愬姛");
+ }
+ open.value = false;
+ getList();
+ }
+ });
+ }
+
+ /** 鍒犻櫎鎸夐挳鎿嶄綔 */
+ function handleDelete(row) {
+ const deleteIds = row.id || ids.value;
+ ElMessageBox.confirm(
+ '鏄惁纭鍒犻櫎涓存湡閫�鍥炲彴璐︾紪鍙蜂负"' + deleteIds + '"鐨勬暟鎹」锛�',
+ "璀﹀憡",
+ {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }
+ )
+ .then(function () {
+ // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘垚鍔熸彁绀�
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ })
+ .catch(() => {});
+ }
+
+ /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+ function handleExport() {
+ // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘彁绀�
+ proxy.$modal.msgSuccess("瀵煎嚭鍔熻兘鏆傛湭瀹炵幇");
+ }
+
+ onMounted(() => {
+ getList();
+ });
</script>
diff --git a/src/views/qualityManagement/processInspection/index.vue b/src/views/qualityManagement/processInspection/index.vue
index 178e81a..58d1a3a 100644
--- a/src/views/qualityManagement/processInspection/index.vue
+++ b/src/views/qualityManagement/processInspection/index.vue
@@ -3,369 +3,436 @@
<div class="search_form mb20">
<div>
<span class="search_title">宸ュ簭锛�</span>
- <el-input
- v-model="searchForm.process"
- 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.process"
+ 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" />
+ <span style="margin-left: 10px"
+ class="search_title">鐢熶骇宸ュ崟鍙凤細</span>
+ <el-input v-model="searchForm.workOrderNo"
+ 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>
+ <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>
- <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia>
- <FormDia ref="formDia" @close="handleQuery"></FormDia>
- <files-dia ref="filesDia" @close="handleQuery"></files-dia>
- <el-dialog v-model="dialogFormVisible" title="缂栬緫妫�楠屽憳" width="30%"
- @close="closeDia">
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
- <el-form-item label="妫�楠屽憳锛�" prop="checkName">
- <el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
- :value="item.nickName"/>
- </el-select>
- </el-form-item>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
- <el-button @click="closeDia">鍙栨秷</el-button>
- </div>
- </template>
- </el-dialog>
+ <InspectionFormDia ref="inspectionFormDia"
+ @close="handleQuery"></InspectionFormDia>
+ <FormDia ref="formDia"
+ @close="handleQuery"></FormDia>
+ <files-dia ref="filesDia"
+ @close="handleQuery"></files-dia>
+ <el-dialog v-model="dialogFormVisible"
+ title="缂栬緫妫�楠屽憳"
+ width="30%"
+ @close="closeDia">
+ <el-form :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef">
+ <el-form-item label="妫�楠屽憳锛�"
+ prop="checkName">
+ <el-select v-model="form.checkName"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.nickName"
+ :label="item.nickName"
+ :value="item.nickName" />
+ </el-select>
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary"
+ @click="submitForm">纭</el-button>
+ <el-button @click="closeDia">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
</div>
</template>
<script setup>
-import { Search } from "@element-plus/icons-vue";
-import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
-import InspectionFormDia from "@/views/qualityManagement/processInspection/components/inspectionFormDia.vue";
-import FormDia from "@/views/qualityManagement/processInspection/components/formDia.vue";
-import {ElMessageBox} from "element-plus";
-import {
- downloadQualityInspect,
- qualityInspectDel,
- qualityInspectListPage, qualityInspectUpdate,
- submitQualityInspect
-} from "@/api/qualityManagement/rawMaterialInspection.js";
-import FilesDia from "@/views/qualityManagement/processInspection/components/filesDia.vue";
-import dayjs from "dayjs";
-import {userListNoPage} from "@/api/system/user.js";
-import useUserStore from "@/store/modules/user";
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ onMounted,
+ ref,
+ reactive,
+ toRefs,
+ getCurrentInstance,
+ nextTick,
+ } from "vue";
+ import InspectionFormDia from "@/views/qualityManagement/processInspection/components/inspectionFormDia.vue";
+ import FormDia from "@/views/qualityManagement/processInspection/components/formDia.vue";
+ import { ElMessageBox } from "element-plus";
+ import {
+ downloadQualityInspect,
+ qualityInspectDel,
+ qualityInspectListPage,
+ qualityInspectUpdate,
+ submitQualityInspect,
+ } from "@/api/qualityManagement/rawMaterialInspection.js";
+ import FilesDia from "@/views/qualityManagement/processInspection/components/filesDia.vue";
+ import dayjs from "dayjs";
+ import { userListNoPage } from "@/api/system/user.js";
+ import useUserStore from "@/store/modules/user";
-const data = reactive({
- searchForm: {
- process: "",
- entryDate: undefined, // 褰曞叆鏃ユ湡
- entryDateStart: undefined,
- entryDateEnd: undefined,
- },
- rules: {
- checkName: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
- },
-});
-const { searchForm } = toRefs(data);
-const tableColumn = ref([
- {
- label: "妫�娴嬫棩鏈�",
- prop: "checkTime",
- width: 120
- },
- {
- label: "鐢熶骇宸ュ崟鍙�",
- prop: "workOrderNo",
- width: 120
- },
- {
- label: "宸ュ簭",
- prop: "process",
- width: 230
- },
- {
- label: "妫�楠屽憳",
- prop: "checkName",
- },
- {
- label: "浜у搧鍚嶇О",
- prop: "productName",
- },
- {
- label: "瑙勬牸鍨嬪彿",
- prop: "model",
- },
- {
- label: "鍗曚綅",
- prop: "unit",
- },
- {
- label: "鎬绘暟閲�",
- prop: "quantity",
- width: 100
- },
- {
- label: "鍚堟牸鏁伴噺",
- prop: "qualifiedQuantity",
- width: 100
- },
- {
- label: "涓嶅悎鏍兼暟閲�",
- prop: "unqualifiedQuantity",
- width: 100
- },
- {
- label: "妫�娴嬪崟浣�",
- prop: "checkCompany",
- width: 120
- },
- {
- label: "妫�娴嬬粨鏋�",
- prop: "checkResult",
- dataType: "tag",
- formatType: (params) => {
- if (params == '涓嶅悎鏍�') {
- return "danger";
- } else if (params == '鍚堟牸') {
- return "success";
- } else {
- return 'danger';
- }
+ const data = reactive({
+ searchForm: {
+ process: "",
+ entryDate: undefined, // 褰曞叆鏃ユ湡
+ workOrderNo: "",
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
},
- },
- {
- label: "鎻愪氦鐘舵��",
- prop: "inspectState",
- formatData: (params) => {
- if (params) {
- return "宸叉彁浜�";
- } else {
- return "鏈彁浜�";
- }
- },
- },
- {
- dataType: "action",
- label: "鎿嶄綔",
- align: "center",
- fixed: "right",
- width: 280,
- operation: [
- {
- name: "缂栬緫",
- type: "text",
- clickFun: (row) => {
- openForm("edit", row);
- },
- disabled: (row) => {
- // 宸叉彁浜ゅ垯绂佺敤
- if (row.inspectState == 1) return true;
- // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
- if (row.checkName) {
- return row.checkName !== userStore.nickName;
- }
- return false;
- }
+ rules: {
+ checkName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ },
+ });
+ const { searchForm } = toRefs(data);
+ const tableColumn = ref([
+ {
+ label: "妫�娴嬫棩鏈�",
+ prop: "checkTime",
+ width: 120,
+ },
+ {
+ label: "鐢熶骇宸ュ崟鍙�",
+ prop: "workOrderNo",
+ width: 120,
+ },
+ {
+ label: "宸ュ簭",
+ prop: "process",
+ width: 230,
+ },
+ {
+ label: "妫�楠屽憳",
+ prop: "checkName",
+ },
+ {
+ label: "浜у搧鍚嶇О",
+ prop: "productName",
+ },
+ {
+ label: "瑙勬牸鍨嬪彿",
+ prop: "model",
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ },
+ {
+ label: "鎬绘暟閲�",
+ prop: "quantity",
+ width: 100,
+ },
+ {
+ label: "鍚堟牸鏁伴噺",
+ prop: "qualifiedQuantity",
+ width: 100,
+ },
+ {
+ label: "涓嶅悎鏍兼暟閲�",
+ prop: "unqualifiedQuantity",
+ width: 100,
+ },
+ {
+ label: "鍚堟牸鐜�",
+ prop: "passRate",
+ width: 100,
+ dataType: "tag",
+ formatType: params => {
+ if (!params) return "";
+ const rate = parseFloat(params);
+ if (rate < 90) {
+ return "danger";
+ } else if (rate === 100) {
+ return "success";
+ } else {
+ return "warning";
+ }
},
- {
- name: "鏌ョ湅",
- type: "text",
- clickFun: (row) => {
- openForm("view", row);
- },
+ },
+ {
+ label: "妫�娴嬪崟浣�",
+ prop: "checkCompany",
+ width: 120,
+ },
+ {
+ label: "妫�娴嬬粨鏋�",
+ prop: "checkResult",
+ dataType: "tag",
+ formatType: params => {
+ if (params == "涓嶅悎鏍�") {
+ return "danger";
+ } else if (params == "鍚堟牸") {
+ return "success";
+ } else {
+ return "danger";
+ }
},
- {
- name: "闄勪欢",
- type: "text",
- clickFun: (row) => {
- openFilesFormDia(row);
- },
+ },
+ {
+ label: "鎻愪氦鐘舵��",
+ prop: "inspectState",
+ formatData: params => {
+ if (params) {
+ return "宸叉彁浜�";
+ } else {
+ return "鏈彁浜�";
+ }
},
- {
- name: "鎻愪氦",
- type: "text",
- clickFun: (row) => {
- submit(row.id);
- },
- disabled: (row) => {
- // 宸叉彁浜ゅ垯绂佺敤
- if (row.inspectState == 1) return true;
- // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
- if (row.checkName) {
- return row.checkName !== userStore.nickName;
- }
- return false;
- }
- },
- {
- name: "鍒嗛厤妫�楠屽憳",
- type: "text",
- clickFun: (row) => {
- if (!row.checkName) {
- open(row)
- } else {
- proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
- }
- },
- disabled: (row) => {
- return row.inspectState == 1 || row.checkName;
- }
- },
- {
- name: "涓嬭浇",
- type: "text",
- clickFun: (row) => {
- downLoadFile(row);
- },
- },
- ],
- },
-]);
-const userList = ref([]);
-const currentRow = ref(null)
-const tableData = ref([]);
-const selectedRows = ref([]);
-const tableLoading = ref(false);
-const dialogFormVisible = ref(false);
-const form = ref({
- checkName: ""
-});
-const page = reactive({
- current: 1,
- size: 100,
- total: 0
-});
-const formDia = ref()
-const filesDia = ref()
-const inspectionFormDia = ref()
-const { proxy } = getCurrentInstance()
-const userStore = useUserStore()
-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 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
- qualityInspectListPage({...params, inspectType: 1}).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;
-};
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 280,
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: row => {
+ openForm("edit", row);
+ },
+ disabled: row => {
+ // 宸叉彁浜ゅ垯绂佺敤
+ if (row.inspectState == 1) return true;
+ // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
+ if (row.checkName) {
+ return row.checkName !== userStore.nickName;
+ }
+ return false;
+ },
+ },
+ {
+ name: "鏌ョ湅",
+ type: "text",
+ clickFun: row => {
+ openForm("view", row);
+ },
+ },
+ {
+ name: "闄勪欢",
+ type: "text",
+ clickFun: row => {
+ openFilesFormDia(row);
+ },
+ },
+ {
+ name: "鎻愪氦",
+ type: "text",
+ clickFun: row => {
+ submit(row.id);
+ },
+ disabled: row => {
+ // 宸叉彁浜ゅ垯绂佺敤
+ if (row.inspectState == 1) return true;
+ // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
+ if (row.checkName) {
+ return row.checkName !== userStore.nickName;
+ }
+ return false;
+ },
+ },
+ {
+ name: "鍒嗛厤妫�楠屽憳",
+ type: "text",
+ clickFun: row => {
+ if (!row.checkName) {
+ open(row);
+ } else {
+ proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
+ }
+ },
+ disabled: row => {
+ return row.inspectState == 1 || row.checkName;
+ },
+ },
+ {
+ name: "涓嬭浇",
+ type: "text",
+ clickFun: row => {
+ downLoadFile(row);
+ },
+ },
+ ],
+ },
+ ]);
+ const userList = ref([]);
+ const currentRow = ref(null);
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const tableLoading = ref(false);
+ const dialogFormVisible = ref(false);
+ const form = ref({
+ checkName: "",
+ });
+ const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const formDia = ref();
+ const filesDia = ref();
+ const inspectionFormDia = ref();
+ const { proxy } = getCurrentInstance();
+ const userStore = useUserStore();
+ 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 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;
+ qualityInspectListPage({ ...params, inspectType: 1 })
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records.map(item => {
+ const quantity = parseFloat(item.quantity);
+ const qualifiedQuantity = parseFloat(item.qualifiedQuantity);
+ let passRate = null;
+ if (!isNaN(quantity) && !isNaN(qualifiedQuantity) && quantity > 0) {
+ passRate = ((qualifiedQuantity / quantity) * 100).toFixed(2) + "%";
+ }
+ return {
+ ...item,
+ passRate: passRate,
+ };
+ });
+ 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 openInspectionForm = (type, row) => {
- nextTick(() => {
- inspectionFormDia.value?.openDialog(type, row)
- })
-};
-// 鎵撳紑闄勪欢寮规
-const openFilesFormDia = (type, row) => {
- nextTick(() => {
- filesDia.value?.openDialog(type, row)
- })
-};
-// 鎻愪环
-const submit = async (id) => {
- const res = await submitQualityInspect({id: id})
- if (res.code === 200) {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- getList();
- }
-}
-const open = async (row) => {
- let userLists = await userListNoPage();
- userList.value = userLists.data;
- currentRow.value = row
- dialogFormVisible.value = true
-}
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef");
- dialogFormVisible.value = false;
-};
-const submitForm = () => {
- if (currentRow.value) {
- const data = {
- ...form.value,
- id: currentRow.value.id
- }
- qualityInspectUpdate(data).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- getList();
- })
- }
-};
+ // 鎵撳紑寮规
+ const openForm = (type, row) => {
+ nextTick(() => {
+ formDia.value?.openDialog(type, row);
+ });
+ };
+ // 鎵撳紑鏂板妫�楠屽脊妗�
+ const openInspectionForm = (type, row) => {
+ nextTick(() => {
+ inspectionFormDia.value?.openDialog(type, row);
+ });
+ };
+ // 鎵撳紑闄勪欢寮规
+ const openFilesFormDia = (type, row) => {
+ nextTick(() => {
+ filesDia.value?.openDialog(type, row);
+ });
+ };
+ // 鎻愪环
+ const submit = async id => {
+ const res = await submitQualityInspect({ id: id });
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ getList();
+ }
+ };
+ const open = async row => {
+ let userLists = await userListNoPage();
+ userList.value = userLists.data;
+ currentRow.value = row;
+ dialogFormVisible.value = true;
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ };
+ const submitForm = () => {
+ if (currentRow.value) {
+ const data = {
+ ...form.value,
+ id: currentRow.value.id,
+ };
+ qualityInspectUpdate(data).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ }
+ };
-// 鍒犻櫎
-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 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(() => {
- qualityInspectDel(ids).then((res) => {
+ qualityInspectDel(ids).then(res => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
});
@@ -373,41 +440,45 @@
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
-};
-const downLoadFile = (row) => {
- downloadQualityInspect({ id: row.id }).then((blobData) => {
- const blob = new Blob([blobData], {
- type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
- })
- const downloadUrl = window.URL.createObjectURL(blob)
+ };
+ const downLoadFile = row => {
+ downloadQualityInspect({ id: row.id }).then(blobData => {
+ const blob = new Blob([blobData], {
+ type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ });
+ const downloadUrl = window.URL.createObjectURL(blob);
- const link = document.createElement('a')
- link.href = downloadUrl
- link.download = '杩囩▼妫�楠屾姤鍛�.docx'
- document.body.appendChild(link)
- link.click()
+ const link = document.createElement("a");
+ link.href = downloadUrl;
+ link.download = "杩囩▼妫�楠屾姤鍛�.docx";
+ document.body.appendChild(link);
+ link.click();
- document.body.removeChild(link)
- window.URL.revokeObjectURL(downloadUrl)
- })
-};
-// 瀵煎嚭
-const handleOut = () => {
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
+ document.body.removeChild(link);
+ window.URL.revokeObjectURL(downloadUrl);
+ });
+ };
+ // 瀵煎嚭
+ const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
.then(() => {
- proxy.download("/quality/qualityInspect/export", {inspectType: 1}, "杩囩▼妫�楠�.xlsx");
+ proxy.download(
+ "/quality/qualityInspect/export",
+ { inspectType: 1 },
+ "杩囩▼妫�楠�.xlsx"
+ );
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
-};
-onMounted(() => {
- getList();
-});
+ };
+ onMounted(() => {
+ getList();
+ });
</script>
<style scoped></style>
diff --git a/src/views/qualityManagement/rawMaterialInspection/index.vue b/src/views/qualityManagement/rawMaterialInspection/index.vue
index b6adb40..6d2acd5 100644
--- a/src/views/qualityManagement/rawMaterialInspection/index.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/index.vue
@@ -3,338 +3,404 @@
<div class="search_form mb20">
<div>
<span class="search_title">渚涘簲鍟嗭細</span>
- <el-input
- v-model="searchForm.supplier"
- 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.supplier"
+ 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" />
+ <span style="margin-left: 10px"
+ class="search_title">閲囪喘璁㈠崟鍙凤細</span>
+ <el-input v-model="searchForm.purchaseContractNo"
+ 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>
+ <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>
- <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia>
- <FormDia ref="formDia" @close="handleQuery"></FormDia>
- <files-dia ref="filesDia" @close="handleQuery"></files-dia>
- <el-dialog v-model="dialogFormVisible" title="缂栬緫妫�楠屽憳" width="30%"
+ <InspectionFormDia ref="inspectionFormDia"
+ @close="handleQuery"></InspectionFormDia>
+ <FormDia ref="formDia"
+ @close="handleQuery"></FormDia>
+ <files-dia ref="filesDia"
+ @close="handleQuery"></files-dia>
+ <el-dialog v-model="dialogFormVisible"
+ title="缂栬緫妫�楠屽憳"
+ width="30%"
@close="closeDia">
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
- <el-form-item label="妫�楠屽憳锛�" prop="checkName">
- <el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
- :value="item.nickName"/>
+ <el-form :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef">
+ <el-form-item label="妫�楠屽憳锛�"
+ prop="checkName">
+ <el-select v-model="form.checkName"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.nickName"
+ :label="item.nickName"
+ :value="item.nickName" />
</el-select>
</el-form-item>
</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>
-
</div>
</template>
<script setup>
-import {Search} from "@element-plus/icons-vue";
-import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
-import InspectionFormDia from "@/views/qualityManagement/rawMaterialInspection/components/inspectionFormDia.vue";
-import FormDia from "@/views/qualityManagement/rawMaterialInspection/components/formDia.vue";
-import {ElMessageBox} from "element-plus";
-import {
- downloadQualityInspect,
- qualityInspectDel,
- qualityInspectListPage, qualityInspectUpdate,
- submitQualityInspect
-} from "@/api/qualityManagement/rawMaterialInspection.js";
-import FilesDia from "@/views/qualityManagement/rawMaterialInspection/components/filesDia.vue";
-import dayjs from "dayjs";
-import {userListNoPage} from "@/api/system/user.js";
-import useUserStore from "@/store/modules/user";
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ onMounted,
+ ref,
+ reactive,
+ toRefs,
+ getCurrentInstance,
+ nextTick,
+ } from "vue";
+ import InspectionFormDia from "@/views/qualityManagement/rawMaterialInspection/components/inspectionFormDia.vue";
+ import FormDia from "@/views/qualityManagement/rawMaterialInspection/components/formDia.vue";
+ import { ElMessageBox } from "element-plus";
+ import {
+ downloadQualityInspect,
+ qualityInspectDel,
+ qualityInspectListPage,
+ qualityInspectUpdate,
+ submitQualityInspect,
+ } from "@/api/qualityManagement/rawMaterialInspection.js";
+ import FilesDia from "@/views/qualityManagement/rawMaterialInspection/components/filesDia.vue";
+ import dayjs from "dayjs";
+ import { userListNoPage } from "@/api/system/user.js";
+ import useUserStore from "@/store/modules/user";
-const data = reactive({
- searchForm: {
- supplier: "",
- entryDate: undefined, // 褰曞叆鏃ユ湡
- entryDateStart: undefined,
- entryDateEnd: undefined,
- },
- rules: {
- checkName: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
- },
-});
-const {searchForm, rules} = toRefs(data);
-const tableColumn = ref([
- {
- label: "妫�娴嬫棩鏈�",
- prop: "checkTime",
- width: 120
- },
- {
- label: "閲囪喘璁㈠崟鍙�",
- prop: "purchaseContractNo",
- width: 120
- },
- {
- label: "渚涘簲鍟�",
- prop: "supplier",
- width: 230
- },
- {
- label: "妫�楠屽憳",
- prop: "checkName",
- },
- {
- label: "浜у搧鍚嶇О",
- prop: "productName",
- },
- {
- label: "瑙勬牸鍨嬪彿",
- prop: "model",
- },
- {
- label: "鍗曚綅",
- prop: "unit",
- },
- {
- label: "鎬绘暟閲�",
- prop: "quantity",
- width: 100
- },
- {
- label: "鍚堟牸鏁伴噺",
- prop: "qualifiedQuantity",
- width: 100
- },
- {
- label: "涓嶅悎鏍兼暟閲�",
- prop: "unqualifiedQuantity",
- width: 100
- },
- {
- label: "妫�娴嬪崟浣�",
- prop: "checkCompany",
- width: 120
- },
- {
- label: "妫�娴嬪崟浣�",
- prop: "checkCompany",
- width: 120
- },
- {
- label: "妫�娴嬬粨鏋�",
- prop: "checkResult",
- dataType: "tag",
- formatType: (params) => {
- if (params === '涓嶅悎鏍�') {
- return "danger";
- } else if (params === '鍚堟牸') {
- return "success";
- } else {
- return 'danger';
- }
+ const data = reactive({
+ searchForm: {
+ supplier: "",
+ entryDate: undefined, // 褰曞叆鏃ユ湡
+ purchaseContractNo: "",
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
},
- },
- {
- label: "鎻愪氦鐘舵��",
- prop: "inspectState",
- formatData: (params) => {
- if (params) {
- return "宸叉彁浜�";
- } else {
- return "鏈彁浜�";
- }
+ rules: {
+ checkName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
},
- },
- {
- dataType: "action",
- label: "鎿嶄綔",
- align: "center",
- fixed: "right",
- width: 280,
- operation: [
- {
- name: "缂栬緫",
- type: "text",
- clickFun: (row) => {
- openForm("edit", row);
- },
- disabled: (row) => {
- // 宸叉彁浜ゅ垯绂佺敤
- if (row.inspectState == 1) return true;
- // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
- if (row.checkName) {
- return row.checkName !== userStore.nickName;
- }
- return false;
- }
+ });
+ const { searchForm, rules } = toRefs(data);
+ const tableColumn = ref([
+ {
+ label: "妫�娴嬫棩鏈�",
+ prop: "checkTime",
+ width: 120,
+ },
+ {
+ label: "閲囪喘璁㈠崟鍙�",
+ prop: "purchaseContractNo",
+ width: 120,
+ },
+ {
+ label: "渚涘簲鍟�",
+ prop: "supplier",
+ width: 230,
+ },
+ {
+ label: "妫�楠屽憳",
+ prop: "checkName",
+ },
+ {
+ label: "浜у搧鍚嶇О",
+ prop: "productName",
+ },
+ {
+ label: "瑙勬牸鍨嬪彿",
+ prop: "model",
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ },
+ {
+ label: "鎬绘暟閲�",
+ prop: "quantity",
+ width: 100,
+ },
+ {
+ label: "鍚堟牸鏁伴噺",
+ prop: "qualifiedQuantity",
+ width: 100,
+ },
+ {
+ label: "涓嶅悎鏍兼暟閲�",
+ prop: "unqualifiedQuantity",
+ width: 100,
+ },
+ {
+ label: "鍚堟牸鐜�",
+ prop: "passRate",
+ width: 100,
+ dataType: "tag",
+ formatType: params => {
+ if (!params) return "";
+ const rate = parseFloat(params);
+ if (rate < 90) {
+ return "danger";
+ } else if (rate === 100) {
+ return "success";
+ } else {
+ return "warning";
+ }
},
- {
- name: "鏌ョ湅",
- type: "text",
- clickFun: (row) => {
- openForm("view", row);
- },
+ },
+ {
+ label: "妫�娴嬪崟浣�",
+ prop: "checkCompany",
+ width: 120,
+ },
+ {
+ label: "妫�娴嬪崟浣�",
+ prop: "checkCompany",
+ width: 120,
+ },
+ {
+ label: "妫�娴嬬粨鏋�",
+ prop: "checkResult",
+ dataType: "tag",
+ formatType: params => {
+ if (params === "涓嶅悎鏍�") {
+ return "danger";
+ } else if (params === "鍚堟牸") {
+ return "success";
+ } else {
+ return "danger";
+ }
},
- {
- name: "闄勪欢",
- type: "text",
- clickFun: (row) => {
- openFilesFormDia(row);
- },
+ },
+ {
+ label: "鎻愪氦鐘舵��",
+ prop: "inspectState",
+ formatData: params => {
+ if (params) {
+ return "宸叉彁浜�";
+ } else {
+ return "鏈彁浜�";
+ }
},
- {
- name: "鎻愪氦",
- type: "text",
- clickFun: (row) => {
- submit(row.id);
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 280,
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: row => {
+ openForm("edit", row);
+ },
+ disabled: row => {
+ // 宸叉彁浜ゅ垯绂佺敤
+ if (row.inspectState == 1) return true;
+ // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
+ if (row.checkName) {
+ return row.checkName !== userStore.nickName;
+ }
+ return false;
+ },
},
- disabled: (row) => {
- // 宸叉彁浜ゅ垯绂佺敤
- if (row.inspectState == 1) return true;
- // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
- if (row.checkName) {
- return row.checkName !== userStore.nickName;
- }
- return false;
- }
- },
- {
- name: "鍒嗛厤妫�楠屽憳",
- type: "text",
- clickFun: (row) => {
- if (!row.checkName) {
- open(row)
- } else {
- proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
+ {
+ name: "鏌ョ湅",
+ type: "text",
+ clickFun: row => {
+ openForm("view", row);
+ },
+ },
+ {
+ name: "闄勪欢",
+ type: "text",
+ clickFun: row => {
+ openFilesFormDia(row);
+ },
+ },
+ {
+ name: "鎻愪氦",
+ type: "text",
+ clickFun: row => {
+ submit(row.id);
+ },
+ disabled: row => {
+ // 宸叉彁浜ゅ垯绂佺敤
+ if (row.inspectState == 1) return true;
+ // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
+ if (row.checkName) {
+ return row.checkName !== userStore.nickName;
+ }
+ return false;
+ },
+ },
+ {
+ name: "鍒嗛厤妫�楠屽憳",
+ type: "text",
+ clickFun: row => {
+ if (!row.checkName) {
+ open(row);
+ } else {
+ proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
+ }
+ },
+ disabled: row => {
+ return row.inspectState == 1 || row.checkName;
+ },
+ },
+ {
+ name: "涓嬭浇",
+ type: "text",
+ clickFun: row => {
+ downLoadFile(row);
+ },
+ },
+ ],
+ },
+ ]);
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const tableLoading = ref(false);
+ const userList = ref([]);
+ const dialogFormVisible = ref(false);
+ const form = ref({
+ checkName: "",
+ });
+ const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const currentRow = ref(null);
+ const formDia = ref();
+ const filesDia = ref();
+ const inspectionFormDia = ref();
+ const { proxy } = getCurrentInstance();
+ const userStore = useUserStore();
+ 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 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;
+ qualityInspectListPage({ ...params, inspectType: 0 })
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records.map(item => {
+ const quantity = parseFloat(item.quantity);
+ const qualifiedQuantity = parseFloat(item.qualifiedQuantity);
+ let passRate = null;
+ if (!isNaN(quantity) && !isNaN(qualifiedQuantity) && quantity > 0) {
+ passRate = ((qualifiedQuantity / quantity) * 100).toFixed(2) + "%";
}
- },
- disabled: (row) => {
- return row.inspectState == 1 || row.checkName;
- }
- },
- {
- name: "涓嬭浇",
- type: "text",
- clickFun: (row) => {
- downLoadFile(row);
- },
- },
- ],
- },
-]);
-const tableData = ref([]);
-const selectedRows = ref([]);
-const tableLoading = ref(false);
-const userList = ref([]);
-const dialogFormVisible = ref(false);
-const form = ref({
- checkName: ""
-});
-const page = reactive({
- current: 1,
- size: 100,
- total: 0
-});
-const currentRow = ref(null)
-const formDia = ref()
-const filesDia = ref()
-const inspectionFormDia = ref()
-const {proxy} = getCurrentInstance()
-const userStore = useUserStore()
-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 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
- qualityInspectListPage({...params, inspectType: 0}).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;
-};
+ return {
+ ...item,
+ passRate: passRate,
+ };
+ });
+ 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 openFilesFormDia = (type, row) => {
- nextTick(() => {
- filesDia.value?.openDialog(type, row)
- })
-};
+ // 鎵撳紑寮规
+ const openForm = (type, row) => {
+ nextTick(() => {
+ formDia.value?.openDialog(type, row);
+ });
+ };
+ // 鎵撳紑闄勪欢寮规
+ const openFilesFormDia = (type, row) => {
+ nextTick(() => {
+ filesDia.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",
- })
+ // 鍒犻櫎
+ 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(() => {
- qualityInspectDel(ids).then((res) => {
+ qualityInspectDel(ids).then(res => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
});
@@ -342,79 +408,83 @@
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
-};
-// 瀵煎嚭
-const handleOut = () => {
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
+ };
+ // 瀵煎嚭
+ const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
.then(() => {
- proxy.download("/quality/qualityInspect/export", {inspectType: 0}, "鍘熸潗鏂欐楠�.xlsx");
+ proxy.download(
+ "/quality/qualityInspect/export",
+ { inspectType: 0 },
+ "鍘熸潗鏂欐楠�.xlsx"
+ );
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
-};
+ };
-// 鎻愪环
-const submit = async (id) => {
- const res = await submitQualityInspect({id: id})
- if (res.code === 200) {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- getList();
- }
-}
-
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef");
- dialogFormVisible.value = false;
-};
-
-const submitForm = () => {
- if (currentRow.value) {
- const data = {
- ...form.value,
- id: currentRow.value.id
- }
- qualityInspectUpdate(data).then(res => {
+ // 鎻愪环
+ const submit = async id => {
+ const res = await submitQualityInspect({ id: id });
+ if (res.code === 200) {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
getList();
- })
- }
-};
+ }
+ };
-const open = async (row) => {
- let userLists = await userListNoPage();
- userList.value = userLists.data;
- currentRow.value = row
- dialogFormVisible.value = true
-}
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ };
-const downLoadFile = (row) => {
- downloadQualityInspect({ id: row.id }).then((blobData) => {
- const blob = new Blob([blobData], {
- type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
- })
- const downloadUrl = window.URL.createObjectURL(blob)
+ const submitForm = () => {
+ if (currentRow.value) {
+ const data = {
+ ...form.value,
+ id: currentRow.value.id,
+ };
+ qualityInspectUpdate(data).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ }
+ };
- const link = document.createElement('a')
- link.href = downloadUrl
- link.download = '鍘熸潗鏂欐楠屾姤鍛�.docx'
- document.body.appendChild(link)
- link.click()
+ const open = async row => {
+ let userLists = await userListNoPage();
+ userList.value = userLists.data;
+ currentRow.value = row;
+ dialogFormVisible.value = true;
+ };
- document.body.removeChild(link)
- window.URL.revokeObjectURL(downloadUrl)
- })
-};
+ const downLoadFile = row => {
+ downloadQualityInspect({ id: row.id }).then(blobData => {
+ const blob = new Blob([blobData], {
+ type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ });
+ const downloadUrl = window.URL.createObjectURL(blob);
-onMounted(() => {
- getList();
-});
+ const link = document.createElement("a");
+ link.href = downloadUrl;
+ link.download = "鍘熸潗鏂欐楠屾姤鍛�.docx";
+ document.body.appendChild(link);
+ link.click();
+
+ document.body.removeChild(link);
+ window.URL.revokeObjectURL(downloadUrl);
+ });
+ };
+
+ onMounted(() => {
+ getList();
+ });
</script>
<style scoped></style>
diff --git a/src/views/safeProduction/dangerInvestigation/index.vue b/src/views/safeProduction/dangerInvestigation/index.vue
index cb09e52..a278058 100644
--- a/src/views/safeProduction/dangerInvestigation/index.vue
+++ b/src/views/safeProduction/dangerInvestigation/index.vue
@@ -160,7 +160,7 @@
<el-form-item label="闅愭偅缂栧彿锛�"
prop="hiddenCode">
<el-input v-model="form.hiddenCode"
- placeholder="鑷姩鐢熸垚"
+ placeholder="淇濆瓨鍚庤嚜鍔ㄧ敓鎴�"
disabled
clearable />
</el-form-item>
diff --git a/src/views/safeProduction/safetyTrainingAssessment/index.vue b/src/views/safeProduction/safetyTrainingAssessment/index.vue
index 2c98308..38c2172 100644
--- a/src/views/safeProduction/safetyTrainingAssessment/index.vue
+++ b/src/views/safeProduction/safetyTrainingAssessment/index.vue
@@ -76,7 +76,21 @@
prop="courseCode">
<el-input v-model="form.courseCode"
disabled
- placeholder="鑷姩鐢熸垚" />
+ placeholder="淇濆瓨鍚庤嚜鍔ㄧ敓鎴�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鍒涘缓鏃堕棿"
+ prop="createTime">
+ <el-date-picker style="width: 100%"
+ v-model="formCreateTimeDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
</el-form-item>
</el-col>
</el-row>
@@ -445,12 +459,19 @@
trainingMode: "", // 鍩硅鏂瑰紡
placeTraining: "", // 鍩硅鍦扮偣
classHour: "", // 璇炬椂
+ createTime: "", // 鍒涘缓鏃堕棿
},
dialogVisible: false,
dialogTitle: "",
dialogType: "add",
viewDialogVisible: false,
currentKnowledge: {},
+ });
+ const formCreateTimeDate = computed({
+ get: () => (form.value.createTime ? String(form.value.createTime).split(" ")[0] : ""),
+ set: (value) => {
+ form.value.createTime = value ? `${value} ${dayjs().format("HH:mm:ss")}` : "";
+ },
});
const {
@@ -1025,6 +1046,7 @@
trainingMode: "", // 鍩硅鏂瑰紡
placeTraining: "", // 鍩硅鍦扮偣
classHour: "", // 璇炬椂
+ createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 鍒涘缓鏃堕棿
});
} else if (type === "edit" && row) {
dialogTitle.value = "缂栬緫鍩硅";
@@ -1042,6 +1064,7 @@
trainingMode: row.trainingMode, // 鍩硅鏂瑰紡
placeTraining: row.placeTraining, // 鍩硅鍦扮偣
classHour: row.classHour, // 璇炬椂
+ createTime: row.createTime || "", // 鍒涘缓鏃堕棿
});
}
dialogVisible.value = true;
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 2e58391..604ba82 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -1,42 +1,47 @@
<template>
<div class="app-container">
<div class="search_form">
- <el-form :model="searchForm"
- :inline="true">
+ <el-form :model="searchForm" :inline="true">
<el-form-item label="瀹㈡埛鍚嶇О锛�">
- <el-input v-model="searchForm.customerName"
- placeholder="璇疯緭鍏�"
- clearable
- prefix-icon="Search"
- @change="handleQuery" />
+ <el-input
+ v-model="searchForm.customerName"
+ placeholder="璇疯緭鍏�"
+ clearable
+ prefix-icon="Search"
+ @change="handleQuery"
+ />
</el-form-item>
<el-form-item label="閿�鍞悎鍚屽彿锛�">
- <el-input v-model="searchForm.salesContractNo"
- placeholder="璇疯緭鍏�"
- clearable
- prefix-icon="Search"
- @change="handleQuery" />
+ <el-input
+ v-model="searchForm.salesContractNo"
+ placeholder="璇疯緭鍏�"
+ clearable
+ prefix-icon="Search"
+ @change="handleQuery"
+ />
</el-form-item>
<el-form-item label="椤圭洰鍚嶇О锛�">
- <el-input v-model="searchForm.projectName"
- placeholder="璇疯緭鍏�"
- clearable
- prefix-icon="Search"
- @change="handleQuery" />
+ <el-input
+ v-model="searchForm.projectName"
+ placeholder="璇疯緭鍏�"
+ clearable
+ prefix-icon="Search"
+ @change="handleQuery"
+ />
</el-form-item>
<el-form-item label="褰曞叆鏃ユ湡锛�">
- <el-date-picker v-model="searchForm.entryDate"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="daterange"
- placeholder="璇烽�夋嫨"
- clearable
- @change="changeDaterange" />
+ <el-date-picker
+ v-model="searchForm.entryDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="daterange"
+ placeholder="璇烽�夋嫨"
+ clearable
+ @change="changeDaterange"
+ />
</el-form-item>
<el-form-item>
- <el-button type="primary"
- @click="handleQuery"> 鎼滅储
- </el-button>
+ <el-button type="primary" @click="handleQuery"> 鎼滅储 </el-button>
</el-form-item>
</el-form>
</div>
@@ -44,139 +49,131 @@
<div class="actions">
<div></div>
<div>
- <el-button type="primary"
- @click="openForm('add')">
+ <el-button type="primary" @click="openForm('add')">
鏂板鍙拌处
</el-button>
- <el-button type="primary"
- plain
- @click="handleImport">瀵煎叆
+ <el-button type="primary" plain @click="handleImport"
+ >瀵煎叆
</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>
- <el-table :data="tableData"
- border
- v-loading="tableLoading"
- @selection-change="handleSelectionChange"
- :expand-row-keys="expandedRowKeys"
- :row-key="(row) => row.id"
- :row-class-name="tableRowClassName"
- show-summary
- style="width: 100%"
- :summary-method="summarizeMainTable"
- @expand-change="expandChange"
- height="calc(100vh - 18.5em)">
- <el-table-column align="center"
- type="selection"
- width="55"
- fixed="left" />
- <el-table-column type="expand"
- width="60"
- fixed="left">
+ <el-table
+ :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="(row) => row.id"
+ :row-class-name="tableRowClassName"
+ show-summary
+ style="width: 100%"
+ :summary-method="summarizeMainTable"
+ @expand-change="expandChange"
+ height="calc(100vh - 18.5em)"
+ >
+ <el-table-column
+ align="center"
+ type="selection"
+ width="55"
+ fixed="left"
+ />
+ <el-table-column type="expand" width="60" fixed="left">
<template #default="props">
- <el-table :data="props.row.children"
- border
- show-summary
- :summary-method="(param) => summarizeChildrenTable(param, props.row)">
- <el-table-column align="center"
- label="搴忓彿"
- type="index" />
- <el-table-column label="浜у搧澶х被"
- prop="productCategory" />
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel" />
- <el-table-column label="鍗曚綅"
- prop="unit" />
- <el-table-column label="浜у搧鐘舵��"
- width="100px"
- align="center">
+ <el-table
+ :data="props.row.children"
+ border
+ show-summary
+ :summary-method="
+ (param) => summarizeChildrenTable(param, props.row)
+ "
+ >
+ <el-table-column align="center" label="搴忓彿" type="index" />
+ <el-table-column label="浜у搧澶х被" prop="productCategory" />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
+ <el-table-column label="鍗曚綅" prop="unit" />
+ <el-table-column label="浜у搧鐘舵��" width="100px" align="center">
<template #default="scope">
- <el-tag v-if="scope.row.approveStatus === 1 "
- type="success">鍏呰冻
+ <el-tag v-if="scope.row.approveStatus === 1" type="success"
+ >鍏呰冻
</el-tag>
- <el-tag v-else-if="scope.row.approveStatus === 0 && scope.row.noQuantity === 0"
- type="success">宸插嚭搴�
+ <el-tag
+ v-else-if="
+ scope.row.approveStatus === 0 &&
+ scope.row.noQuantity === 0
+ "
+ type="success"
+ >宸插嚭搴�
</el-tag>
- <el-tag v-else
- type="danger">涓嶈冻
- </el-tag>
+ <el-tag v-else type="danger">涓嶈冻 </el-tag>
</template>
</el-table-column>
- <el-table-column label="鍙戣揣鐘舵��"
- width="140"
- align="center">
+ <el-table-column label="鍙戣揣鐘舵��" width="140" align="center">
<template #default="scope">
- <el-tag :type="getShippingStatusType(scope.row)"
- size="small">
+ <el-tag :type="getShippingStatusType(scope.row)" size="small">
{{ getShippingStatusText(scope.row) }}
</el-tag>
</template>
</el-table-column>
- <el-table-column label="蹇�掑叕鍙�"
- prop="expressCompany"
- show-overflow-tooltip />
- <el-table-column label="蹇�掑崟鍙�"
- prop="expressNumber"
- show-overflow-tooltip />
- <el-table-column label="鍙戣揣杞︾墝"
- minWidth="100px"
- align="center">
+ <el-table-column
+ label="蹇�掑叕鍙�"
+ prop="expressCompany"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="蹇�掑崟鍙�"
+ prop="expressNumber"
+ show-overflow-tooltip
+ />
+ <el-table-column label="鍙戣揣杞︾墝" minWidth="100px" align="center">
<template #default="scope">
<div>
- <el-tag type="success"
- v-if="scope.row.shippingCarNumber">{{ scope.row.shippingCarNumber }}
+ <el-tag type="success" v-if="scope.row.shippingCarNumber"
+ >{{ scope.row.shippingCarNumber }}
</el-tag>
- <el-tag v-else
- type="info">-
- </el-tag>
+ <el-tag v-else type="info">- </el-tag>
</div>
</template>
</el-table-column>
- <el-table-column label="鍙戣揣鏃ユ湡"
- minWidth="100px"
- align="center">
+ <el-table-column label="鍙戣揣鏃ユ湡" minWidth="100px" align="center">
<template #default="scope">
<div>
- <div v-if="scope.row.shippingDate">{{ scope.row.shippingDate }}</div>
- <el-tag v-else
- type="info">-
- </el-tag>
+ <div v-if="scope.row.shippingDate">
+ {{ scope.row.shippingDate }}
+ </div>
+ <el-tag v-else type="info">- </el-tag>
</div>
</template>
</el-table-column>
- <el-table-column label="鏁伴噺"
- prop="quantity" />
- <el-table-column label="寰呭彂璐ф暟閲�"
- prop="noQuantity" />
- <el-table-column label="绋庣巼(%)"
- prop="taxRate" />
- <el-table-column label="鍚◣鍗曚环(鍏�)"
- prop="taxInclusiveUnitPrice"
- :formatter="sensitiveAmountFormatter" />
- <el-table-column label="鍚◣鎬讳环(鍏�)"
- prop="taxInclusiveTotalPrice"
- :formatter="sensitiveAmountFormatter" />
- <el-table-column label="涓嶅惈绋庢�讳环(鍏�)"
- prop="taxExclusiveTotalPrice"
- :formatter="sensitiveAmountFormatter" />
+ <el-table-column label="鏁伴噺" prop="quantity" />
+ <el-table-column label="寰呭彂璐ф暟閲�" prop="noQuantity" />
+ <el-table-column label="绋庣巼(%)" prop="taxRate" />
+ <el-table-column
+ label="鍚◣鍗曚环(鍏�)"
+ prop="taxInclusiveUnitPrice"
+ :formatter="sensitiveAmountFormatter"
+ />
+ <el-table-column
+ label="鍚◣鎬讳环(鍏�)"
+ prop="taxInclusiveTotalPrice"
+ :formatter="sensitiveAmountFormatter"
+ />
+ <el-table-column
+ label="涓嶅惈绋庢�讳环(鍏�)"
+ prop="taxExclusiveTotalPrice"
+ :formatter="sensitiveAmountFormatter"
+ />
<!--鎿嶄綔-->
- <el-table-column Width="60px"
- label="鎿嶄綔"
- align="center">
+ <el-table-column Width="60px" label="鎿嶄綔" align="center">
<template #default="scope">
- <el-button link
- type="primary"
- :disabled="!canShip(scope.row)"
- @click="openDeliveryForm(scope.row)">
+ <el-button
+ link
+ type="primary"
+ :disabled="!canShip(scope.row)"
+ @click="openDeliveryForm(scope.row)"
+ >
鍙戣揣
</el-button>
</template>
@@ -184,150 +181,198 @@
</el-table>
</template>
</el-table-column>
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60" />
- <el-table-column label="閿�鍞悎鍚屽彿"
- prop="salesContractNo"
- width="180"
- show-overflow-tooltip />
- <el-table-column label="瀹㈡埛鍚嶇О"
- prop="customerName"
- width="300"
- show-overflow-tooltip />
- <el-table-column label="涓氬姟鍛�"
- prop="salesman"
- width="100"
- show-overflow-tooltip />
- <el-table-column label="椤圭洰鍚嶇О"
- prop="projectName"
- width="180"
- show-overflow-tooltip />
- <el-table-column label="浠樻鏂瑰紡"
- prop="paymentMethod"
- show-overflow-tooltip />
- <el-table-column label="鍚堝悓閲戦(鍏�)"
- prop="contractAmount"
- width="220"
- show-overflow-tooltip
- :formatter="formattedNumber" />
- <el-table-column label="褰曞叆浜�"
- prop="entryPersonName"
- width="100"
- show-overflow-tooltip />
- <el-table-column label="褰曞叆鏃ユ湡"
- prop="entryDate"
- width="120"
- show-overflow-tooltip />
- <el-table-column label="绛捐鏃ユ湡"
- prop="executionDate"
- width="120"
- show-overflow-tooltip />
- <el-table-column label="浜や粯鏃ユ湡"
- prop="deliveryDate"
- width="120"
- show-overflow-tooltip />
- <el-table-column label="澶囨敞"
- prop="remarks"
- width="200"
- show-overflow-tooltip />
- <el-table-column fixed="right"
- label="鎿嶄綔"
- width="220"
- align="center">
+ <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table-column
+ label="閿�鍞悎鍚屽彿"
+ prop="salesContractNo"
+ width="180"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="瀹㈡埛鍚嶇О"
+ prop="customerName"
+ width="300"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="涓氬姟鍛�"
+ prop="salesman"
+ width="100"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="椤圭洰鍚嶇О"
+ prop="projectName"
+ width="180"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="浠樻鏂瑰紡"
+ prop="paymentMethod"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="鍚堝悓閲戦(鍏�)"
+ prop="contractAmount"
+ width="220"
+ show-overflow-tooltip
+ :formatter="formattedNumber"
+ />
+ <el-table-column
+ label="褰曞叆浜�"
+ prop="entryPersonName"
+ width="100"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="褰曞叆鏃ユ湡"
+ prop="entryDate"
+ width="120"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="绛捐鏃ユ湡"
+ prop="executionDate"
+ width="120"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="浜や粯鏃ユ湡"
+ prop="deliveryDate"
+ width="120"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="澶囨敞"
+ prop="remarks"
+ width="200"
+ show-overflow-tooltip
+ />
+ <el-table-column fixed="right" label="鎿嶄綔" width="220" align="center">
<template #default="scope">
- <el-button link
- type="primary"
- @click="openForm('view', scope.row)">璇︽儏
+ <el-button link type="primary" @click="openForm('view', scope.row)"
+ >璇︽儏
</el-button>
- <el-button link
- type="primary"
- @click="openForm('edit', scope.row)"
- :disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">缂栬緫
+ <el-button
+ link
+ type="primary"
+ @click="openForm('edit', scope.row)"
+ :disabled="
+ !scope.row.isEdit ||
+ scope.row.hasProductionRecord ||
+ !canEditLedger(scope.row)
+ "
+ >缂栬緫
</el-button>
- <el-button link
- type="primary"
- @click="openFileDialog(scope.row)">闄勪欢
+ <el-button link type="primary" @click="openFileDialog(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>
- <FormDialog v-model="dialogFormVisible"
- :title="operationType === 'add' ? '鏂板閿�鍞彴璐﹂〉闈�' : (operationType === 'edit' ? '缂栬緫閿�鍞彴璐﹂〉闈�' : '閿�鍞彴璐﹁鎯�')"
- :width="'70%'"
- :operation-type="operationType"
- @close="closeDia"
- @confirm="submitForm"
- @cancel="closeDia">
- <el-form :model="form"
- label-width="140px"
- label-position="top"
- :rules="rules"
- ref="formRef">
+ <FormDialog
+ v-model="dialogFormVisible"
+ :title="
+ operationType === 'add'
+ ? '鏂板閿�鍞彴璐﹂〉闈�'
+ : operationType === 'edit'
+ ? '缂栬緫閿�鍞彴璐﹂〉闈�'
+ : '閿�鍞彴璐﹁鎯�'
+ "
+ :width="'70%'"
+ :operation-type="operationType"
+ @close="closeDia"
+ @confirm="submitForm"
+ @cancel="closeDia"
+ >
+ <el-form
+ :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef"
+ >
<!-- 鎶ヤ环鍗曞鍏ュ叆鍙o細鏀惧湪琛ㄥ崟椤堕儴锛岄�夋嫨鍚庡弽鏄惧鎴�/涓氬姟鍛樼瓑 -->
- <el-row v-if="operationType === 'add'"
- style="margin-bottom: 10px;">
- <el-col :span="24"
- style="text-align: right;">
- <el-button type="primary"
- plain
- @click="openQuotationDialog">
+ <el-row v-if="operationType === 'add'" style="margin-bottom: 10px">
+ <el-col :span="24" style="text-align: right">
+ <el-button type="primary" plain @click="openQuotationDialog">
浠庨攢鍞姤浠峰鍏�
</el-button>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="閿�鍞悎鍚屽彿锛�"
- prop="salesContractNo">
- <div style="display: flex; align-items: center; gap: 12px;width: 100%;">
- <el-checkbox v-model="form.autoGenerateContractNo"
- v-if="operationType === 'add'">鑷姩鐢熸垚
+ <el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesContractNo">
+ <div
+ style="
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ width: 100%;
+ "
+ >
+ <el-checkbox
+ v-model="form.autoGenerateContractNo"
+ v-if="operationType === 'add'"
+ >鑷姩鐢熸垚
</el-checkbox>
- <el-input v-model="form.salesContractNo"
- :placeholder="form.autoGenerateContractNo ? '鑷姩鐢熸垚' : '璇疯緭鍏�'"
- clearable
- :disabled="form.autoGenerateContractNo || operationType === 'view'" />
+ <el-input
+ v-model="form.salesContractNo"
+ :placeholder="
+ form.autoGenerateContractNo ? '淇濆瓨鍚庤嚜鍔ㄧ敓鎴�' : '璇疯緭鍏�'
+ "
+ clearable
+ :disabled="
+ form.autoGenerateContractNo || operationType === 'view'
+ "
+ />
</div>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="涓氬姟鍛橈細"
- prop="salesman">
- <el-select v-model="form.salesman"
- placeholder="璇烽�夋嫨"
- clearable
- :disabled="operationType === 'view'"
- filterable>
- <el-option v-for="item in userList"
- :key="item.nickName"
- :label="item.nickName"
- :value="item.nickName" />
+ <el-form-item label="涓氬姟鍛橈細" prop="salesman">
+ <el-select
+ v-model="form.salesman"
+ placeholder="璇烽�夋嫨"
+ clearable
+ :disabled="operationType === 'view'"
+ filterable
+ >
+ <el-option
+ v-for="item in userList"
+ :key="item.nickName"
+ :label="item.nickName"
+ :value="item.nickName"
+ />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="瀹㈡埛鍚嶇О锛�"
- prop="customerId">
- <el-select v-model="form.customerId"
- placeholder="璇烽�夋嫨"
- clearable
- :disabled="operationType === 'view'"
- filterable>
- <el-option v-for="item in customerOption"
- :key="item.id"
- :label="item.customerName"
- :value="item.id">
+ <el-form-item label="瀹㈡埛鍚嶇О锛�" prop="customerId">
+ <el-select
+ v-model="form.customerId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ :disabled="operationType === 'view'"
+ filterable
+ >
+ <el-option
+ v-for="item in customerOption"
+ :key="item.id"
+ :label="item.customerName"
+ :value="item.id"
+ >
{{
item.customerName + "鈥斺��" + item.taxpayerIdentificationNumber
}}
@@ -336,400 +381,453 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="椤圭洰鍚嶇О锛�"
- prop="projectName">
- <el-input v-model="form.projectName"
- placeholder="璇疯緭鍏�"
- clearable
- :disabled="operationType === 'view'" />
+ <el-form-item label="椤圭洰鍚嶇О锛�" prop="projectName">
+ <el-input
+ v-model="form.projectName"
+ placeholder="璇疯緭鍏�"
+ clearable
+ :disabled="operationType === 'view'"
+ />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="绛捐鏃ユ湡锛�"
- prop="executionDate">
- <el-date-picker style="width: 100%"
- v-model="form.executionDate"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable
- :disabled="operationType === 'view'" />
+ <el-form-item label="绛捐鏃ユ湡锛�" prop="executionDate">
+ <el-date-picker
+ style="width: 100%"
+ v-model="form.executionDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ :disabled="operationType === 'view'"
+ />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="浠樻鏂瑰紡">
- <el-input v-model="form.paymentMethod"
- placeholder="璇疯緭鍏�"
- clearable
- :disabled="operationType === 'view'" />
+ <el-input
+ v-model="form.paymentMethod"
+ placeholder="璇疯緭鍏�"
+ clearable
+ :disabled="operationType === 'view'"
+ />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="褰曞叆浜猴細"
- prop="entryPerson">
- <el-select v-model="form.entryPerson"
- filterable
- default-first-option
- :reserve-keyword="false"
- placeholder="璇烽�夋嫨"
- clearable
- :disabled="operationType === 'view'"
- @change="changs">
- <el-option v-for="item in userList"
- :key="item.userId"
- :label="item.nickName"
- :value="item.userId" />
+ <el-form-item label="褰曞叆浜猴細" prop="entryPerson">
+ <el-select
+ v-model="form.entryPerson"
+ filterable
+ default-first-option
+ :reserve-keyword="false"
+ placeholder="璇烽�夋嫨"
+ clearable
+ :disabled="operationType === 'view'"
+ @change="changs"
+ >
+ <el-option
+ v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId"
+ />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="褰曞叆鏃ユ湡锛�"
- prop="entryDate">
- <el-date-picker style="width: 100%"
- v-model="form.entryDate"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable
- :disabled="operationType === 'view'" />
+ <el-form-item label="褰曞叆鏃ユ湡锛�" prop="entryDate">
+ <el-date-picker
+ style="width: 100%"
+ v-model="form.entryDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ :disabled="operationType === 'view'"
+ />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="浜よ揣鏃ユ湡锛�"
- prop="entryDate">
- <el-date-picker style="width: 100%"
- v-model="form.deliveryDate"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable
- :disabled="operationType === 'view'" />
+ <el-form-item label="浜よ揣鏃ユ湡锛�" prop="entryDate">
+ <el-date-picker
+ style="width: 100%"
+ v-model="form.deliveryDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ :disabled="operationType === 'view'"
+ />
</el-form-item>
</el-col>
</el-row>
<el-row>
- <el-form-item label="浜у搧淇℃伅锛�"
- prop="entryDate">
- <el-button v-if="operationType !== 'view'"
- type="primary"
- @click="openProductForm('add')">娣诲姞
+ <el-form-item label="浜у搧淇℃伅锛�" prop="entryDate">
+ <el-button
+ v-if="operationType !== 'view'"
+ type="primary"
+ @click="openProductForm('add')"
+ >娣诲姞
</el-button>
- <el-button v-if="operationType !== 'view'"
- plain
- type="danger"
- @click="deleteProduct">鍒犻櫎
+ <el-button
+ v-if="operationType !== 'view'"
+ plain
+ type="danger"
+ @click="deleteProduct"
+ >鍒犻櫎
</el-button>
</el-form-item>
</el-row>
- <el-table :data="productData"
- border
- @selection-change="productSelected"
- show-summary
- :summary-method="summarizeMainTable">
- <el-table-column align="center"
- type="selection"
- width="55"
- v-if="operationType !== 'view'"
- :selectable="(row) => !isProductShipped(row)" />
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60" />
- <el-table-column label="浜у搧澶х被"
- prop="productCategory" />
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="specificationModel" />
- <el-table-column label="鍗曚綅"
- prop="unit" />
- <el-table-column label="鏁伴噺"
- prop="quantity" />
- <el-table-column label="绋庣巼(%)"
- prop="taxRate" />
- <el-table-column label="鍚◣鍗曚环(鍏�)"
- prop="taxInclusiveUnitPrice"
- :formatter="formattedNumber" />
- <el-table-column label="鍚◣鎬讳环(鍏�)"
- prop="taxInclusiveTotalPrice"
- :formatter="formattedNumber" />
- <el-table-column label="涓嶅惈绋庢�讳环(鍏�)"
- prop="taxExclusiveTotalPrice"
- :formatter="formattedNumber" />
- <el-table-column label="鏄惁鐢熶骇"
- prop="isProduction"
- width="150">
+ <el-table
+ :data="productData"
+ border
+ @selection-change="productSelected"
+ show-summary
+ :summary-method="summarizeMainTable"
+ >
+ <el-table-column
+ align="center"
+ type="selection"
+ width="55"
+ v-if="operationType !== 'view'"
+ :selectable="(row) => !isProductShipped(row)"
+ />
+ <el-table-column
+ align="center"
+ label="搴忓彿"
+ type="index"
+ width="60"
+ />
+ <el-table-column label="浜у搧澶х被" prop="productCategory" />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
+ <el-table-column label="鍗曚綅" prop="unit" />
+ <el-table-column label="鏁伴噺" prop="quantity" />
+ <el-table-column label="绋庣巼(%)" prop="taxRate" />
+ <el-table-column
+ label="鍚◣鍗曚环(鍏�)"
+ prop="taxInclusiveUnitPrice"
+ :formatter="formattedNumber"
+ />
+ <el-table-column
+ label="鍚◣鎬讳环(鍏�)"
+ prop="taxInclusiveTotalPrice"
+ :formatter="formattedNumber"
+ />
+ <el-table-column
+ label="涓嶅惈绋庢�讳环(鍏�)"
+ prop="taxExclusiveTotalPrice"
+ :formatter="formattedNumber"
+ />
+ <el-table-column label="鏄惁鐢熶骇" prop="isProduction" width="150">
<template #default="scope">
<el-tag :type="scope.row.isProduction ? 'success' : 'info'">
- {{ scope.row.isProduction ? '鏄�' : '鍚�' }}
+ {{ scope.row.isProduction ? "鏄�" : "鍚�" }}
</el-tag>
</template>
</el-table-column>
- <el-table-column fixed="right"
- label="鎿嶄綔"
- min-width="60"
- align="center"
- v-if="operationType !== 'view'">
+ <el-table-column
+ fixed="right"
+ label="鎿嶄綔"
+ min-width="60"
+ align="center"
+ v-if="operationType !== 'view'"
+ >
<template #default="scope">
- <el-button link
- type="primary"
- size="small"
- :disabled="isProductShipped(scope.row)"
- @click="openProductForm('edit', scope.row,scope.$index)">缂栬緫
+ <el-button
+ link
+ type="primary"
+ size="small"
+ :disabled="isProductShipped(scope.row)"
+ @click="openProductForm('edit', scope.row, scope.$index)"
+ >缂栬緫
</el-button>
</template>
</el-table-column>
</el-table>
<el-row :gutter="30">
<el-col :span="24">
- <el-form-item label="澶囨敞锛�"
- prop="remarks">
- <el-input v-model="form.remarks"
- placeholder="璇疯緭鍏�"
- clearable
- type="textarea"
- :rows="2"
- :disabled="operationType === 'view'" />
+ <el-form-item label="澶囨敞锛�" prop="remarks">
+ <el-input
+ v-model="form.remarks"
+ placeholder="璇疯緭鍏�"
+ clearable
+ type="textarea"
+ :rows="2"
+ :disabled="operationType === 'view'"
+ />
</el-form-item>
</el-col>
</el-row>
- <el-row v-if="operationType !== 'view'"
- :gutter="30">
+ <el-row v-if="operationType !== 'view'" :gutter="30">
<el-col :span="24">
- <el-form-item label="闄勪欢鏉愭枡锛�"
- prop="salesLedgerFiles">
- <FileUpload v-model:file-list="fileList"
- :disabled="operationType === 'view'" />
+ <el-form-item label="闄勪欢鏉愭枡锛�" prop="salesLedgerFiles">
+ <FileUpload
+ v-model:file-list="fileList"
+ :disabled="operationType === 'view'"
+ />
</el-form-item>
</el-col>
</el-row>
</el-form>
</FormDialog>
<!-- 浠庢姤浠峰崟瀵煎叆锛堜粎瀹℃壒閫氳繃锛� -->
- <el-dialog v-model="quotationDialogVisible"
- title="閫夋嫨瀹℃壒閫氳繃鐨勯攢鍞姤浠峰崟"
- width="80%"
- :close-on-click-modal="false">
- <div style="margin-bottom: 12px; display:flex; gap: 12px; align-items:center;">
- <el-input v-model="quotationSearchForm.quotationNo"
- placeholder="璇疯緭鍏ユ姤浠峰崟鍙�"
- clearable
- style="max-width: 260px;"
- @change="fetchQuotationList" />
- <el-input v-model="quotationSearchForm.customer"
- placeholder="璇疯緭鍏ュ鎴峰悕绉�"
- clearable
- style="max-width: 260px;"
- @change="fetchQuotationList" />
- <el-button type="primary"
- @click="fetchQuotationList">鎼滅储
- </el-button>
+ <el-dialog
+ v-model="quotationDialogVisible"
+ title="閫夋嫨瀹℃壒閫氳繃鐨勯攢鍞姤浠峰崟"
+ width="80%"
+ :close-on-click-modal="false"
+ >
+ <div
+ style="
+ margin-bottom: 12px;
+ display: flex;
+ gap: 12px;
+ align-items: center;
+ "
+ >
+ <el-input
+ v-model="quotationSearchForm.quotationNo"
+ placeholder="璇疯緭鍏ユ姤浠峰崟鍙�"
+ clearable
+ style="max-width: 260px"
+ @change="fetchQuotationList"
+ />
+ <el-input
+ v-model="quotationSearchForm.customer"
+ placeholder="璇疯緭鍏ュ鎴峰悕绉�"
+ clearable
+ style="max-width: 260px"
+ @change="fetchQuotationList"
+ />
+ <el-button type="primary" @click="fetchQuotationList">鎼滅储 </el-button>
<el-button @click="resetQuotationSearch">閲嶇疆</el-button>
</div>
- <el-table :data="quotationList"
- border
- stripe
- v-loading="quotationLoading"
- height="420px">
- <el-table-column align="center"
- label="搴忓彿"
- type="index"
- width="60" />
- <el-table-column prop="quotationNo"
- label="鎶ヤ环鍗曞彿"
- width="180"
- show-overflow-tooltip />
- <el-table-column prop="customer"
- label="瀹㈡埛鍚嶇О"
- min-width="220"
- show-overflow-tooltip />
- <el-table-column prop="salesperson"
- label="涓氬姟鍛�"
- width="120"
- show-overflow-tooltip />
- <el-table-column prop="quotationDate"
- label="鎶ヤ环鏃ユ湡"
- width="140" />
- <el-table-column prop="status"
- label="瀹℃壒鐘舵��"
- width="120"
- align="center" />
- <el-table-column prop="totalAmount"
- label="鎶ヤ环閲戦(鍏�)"
- width="160"
- align="right">
+ <el-table
+ :data="quotationList"
+ border
+ stripe
+ v-loading="quotationLoading"
+ height="420px"
+ >
+ <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table-column
+ prop="quotationNo"
+ label="鎶ヤ环鍗曞彿"
+ width="180"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ prop="customer"
+ label="瀹㈡埛鍚嶇О"
+ min-width="220"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ prop="salesperson"
+ label="涓氬姟鍛�"
+ width="120"
+ show-overflow-tooltip
+ />
+ <el-table-column prop="quotationDate" label="鎶ヤ环鏃ユ湡" width="140" />
+ <el-table-column
+ prop="status"
+ label="瀹℃壒鐘舵��"
+ width="120"
+ align="center"
+ />
+ <el-table-column
+ prop="totalAmount"
+ label="鎶ヤ环閲戦(鍏�)"
+ width="160"
+ align="right"
+ >
<template #default="scope">
{{ Number(scope.row.totalAmount ?? 0).toFixed(2) }}
</template>
</el-table-column>
- <el-table-column fixed="right"
- label="鎿嶄綔"
- width="120"
- align="center">
+ <el-table-column fixed="right" label="鎿嶄綔" width="120" align="center">
<template #default="scope">
- <el-button type="primary"
- link
- @click="applyQuotation(scope.row)">閫夋嫨
+ <el-button type="primary" link @click="applyQuotation(scope.row)"
+ >閫夋嫨
</el-button>
</template>
</el-table-column>
</el-table>
- <pagination v-show="quotationPage.total > 0"
- :total="quotationPage.total"
- layout="total, sizes, prev, pager, next, jumper"
- :page="quotationPage.current"
- :limit="quotationPage.size"
- @pagination="quotationPaginationChange" />
+ <pagination
+ v-show="quotationPage.total > 0"
+ :total="quotationPage.total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="quotationPage.current"
+ :limit="quotationPage.size"
+ @pagination="quotationPaginationChange"
+ />
<template #footer>
<el-button @click="quotationDialogVisible = false">鍏抽棴</el-button>
</template>
</el-dialog>
- <FormDialog v-model="productFormVisible"
- :title="productOperationType === 'add' ? '鏂板浜у搧' : '缂栬緫浜у搧'"
- :width="'40%'"
- :operation-type="productOperationType"
- @close="closeProductDia"
- @confirm="submitProduct"
- @cancel="closeProductDia">
- <el-form :model="productForm"
- label-width="140px"
- label-position="top"
- :rules="productRules"
- ref="productFormRef">
+ <FormDialog
+ v-model="productFormVisible"
+ :title="productOperationType === 'add' ? '鏂板浜у搧' : '缂栬緫浜у搧'"
+ :width="'40%'"
+ :operation-type="productOperationType"
+ @close="closeProductDia"
+ @confirm="submitProduct"
+ @cancel="closeProductDia"
+ >
+ <el-form
+ :model="productForm"
+ label-width="140px"
+ label-position="top"
+ :rules="productRules"
+ ref="productFormRef"
+ >
<el-row :gutter="30">
<el-col :span="24">
- <el-form-item label="浜у搧澶х被锛�"
- prop="productCategory">
- <el-tree-select v-model="productForm.productCategory"
- placeholder="璇烽�夋嫨"
- clearable
- filterable
- check-strictly
- @change="getModels"
- :data="productOptions"
- :render-after-expand="false"
- style="width: 100%" />
+ <el-form-item label="浜у搧澶х被锛�" prop="productCategory">
+ <el-tree-select
+ v-model="productForm.productCategory"
+ placeholder="璇烽�夋嫨"
+ clearable
+ filterable
+ check-strictly
+ @change="getModels"
+ :data="productOptions"
+ :render-after-expand="false"
+ style="width: 100%"
+ />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="24">
- <el-form-item label="瑙勬牸鍨嬪彿锛�"
- prop="productModelId">
- <el-select v-model="productForm.productModelId"
- placeholder="璇烽�夋嫨"
- clearable
- @change="getProductModel"
- filterable>
- <el-option v-for="item in modelOptions"
- :key="item.id"
- :label="item.model"
- :value="item.id" />
+ <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productModelId">
+ <el-select
+ v-model="productForm.productModelId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ @change="getProductModel"
+ filterable
+ >
+ <el-option
+ v-for="item in modelOptions"
+ :key="item.id"
+ :label="item.model"
+ :value="item.id"
+ />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="鍗曚綅锛�"
- prop="unit">
- <el-input v-model="productForm.unit"
- placeholder="璇疯緭鍏�"
- clearable />
+ <el-form-item label="鍗曚綅锛�" prop="unit">
+ <el-input
+ v-model="productForm.unit"
+ placeholder="璇疯緭鍏�"
+ clearable
+ />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="绋庣巼(%)锛�"
- prop="taxRate">
- <el-select v-model="productForm.taxRate"
- placeholder="璇烽�夋嫨"
- clearable
- @change="calculateFromTaxRate">
- <el-option v-for="dict in tax_rate"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value" />
+ <el-form-item label="绋庣巼(%)锛�" prop="taxRate">
+ <el-select
+ v-model="productForm.taxRate"
+ placeholder="璇烽�夋嫨"
+ clearable
+ @change="calculateFromTaxRate"
+ >
+ <el-option
+ v-for="dict in tax_rate"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"
+ />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="鍚◣鍗曚环(鍏�)锛�"
- prop="taxInclusiveUnitPrice">
- <el-input-number :step="0.01"
- :min="0"
- v-model="productForm.taxInclusiveUnitPrice"
- style="width: 100%"
- :precision="2"
- placeholder="璇疯緭鍏�"
- clearable
- @change="calculateFromUnitPrice" />
+ <el-form-item label="鍚◣鍗曚环(鍏�)锛�" prop="taxInclusiveUnitPrice">
+ <el-input-number
+ :step="0.01"
+ :min="0"
+ v-model="productForm.taxInclusiveUnitPrice"
+ style="width: 100%"
+ :precision="2"
+ placeholder="璇疯緭鍏�"
+ clearable
+ @change="calculateFromUnitPrice"
+ />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏁伴噺锛�"
- prop="quantity">
- <el-input-number :step="0.1"
- :min="0"
- v-model="productForm.quantity"
- placeholder="璇疯緭鍏�"
- clearable
- :precision="2"
- @change="calculateFromQuantity"
- style="width: 100%" />
+ <el-form-item label="鏁伴噺锛�" prop="quantity">
+ <el-input-number
+ :step="0.1"
+ :min="0"
+ v-model="productForm.quantity"
+ placeholder="璇疯緭鍏�"
+ clearable
+ :precision="2"
+ @change="calculateFromQuantity"
+ style="width: 100%"
+ />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="鍚◣鎬讳环(鍏�)锛�"
- prop="taxInclusiveTotalPrice">
- <el-input v-model="productForm.taxInclusiveTotalPrice"
- placeholder="璇疯緭鍏�"
- clearable
- @change="calculateFromTotalPrice" />
+ <el-form-item label="鍚◣鎬讳环(鍏�)锛�" prop="taxInclusiveTotalPrice">
+ <el-input
+ v-model="productForm.taxInclusiveTotalPrice"
+ placeholder="璇疯緭鍏�"
+ clearable
+ @change="calculateFromTotalPrice"
+ />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="涓嶅惈绋庢�讳环(鍏�)锛�"
- prop="taxExclusiveTotalPrice">
- <el-input v-model="productForm.taxExclusiveTotalPrice"
- placeholder="璇疯緭鍏�"
- clearable
- @change="calculateFromExclusiveTotalPrice" />
+ <el-form-item
+ label="涓嶅惈绋庢�讳环(鍏�)锛�"
+ prop="taxExclusiveTotalPrice"
+ >
+ <el-input
+ v-model="productForm.taxExclusiveTotalPrice"
+ placeholder="璇疯緭鍏�"
+ clearable
+ @change="calculateFromExclusiveTotalPrice"
+ />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="鍙戠エ绫诲瀷锛�"
- prop="invoiceType">
- <el-select v-model="productForm.invoiceType"
- placeholder="璇烽�夋嫨"
- clearable>
- <el-option label="澧炴櫘绁�"
- value="澧炴櫘绁�" />
- <el-option label="澧炰笓绁�"
- value="澧炰笓绁�" />
+ <el-form-item label="鍙戠エ绫诲瀷锛�" prop="invoiceType">
+ <el-select
+ v-model="productForm.invoiceType"
+ placeholder="璇烽�夋嫨"
+ clearable
+ >
+ <el-option label="澧炴櫘绁�" value="澧炴櫘绁�" />
+ <el-option label="澧炰笓绁�" value="澧炰笓绁�" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏄惁鐢熶骇锛�"
- prop="isProduction">
+ <el-form-item label="鏄惁鐢熶骇锛�" prop="isProduction">
<el-radio-group v-model="productForm.isProduction">
- <el-radio label="鏄�"
- :value="true" />
- <el-radio label="鍚�"
- :value="false" />
+ <el-radio label="鏄�" :value="true" />
+ <el-radio label="鍚�" :value="false" />
</el-radio-group>
</el-form-item>
</el-col>
@@ -737,34 +835,35 @@
</el-form>
</FormDialog>
<!-- 瀵煎叆寮圭獥 -->
- <FormDialog v-model="importUpload.open"
- :title="importUpload.title"
- :width="'600px'"
- @close="importUpload.open = false"
- @confirm="submitImportFile"
- @cancel="importUpload.open = false">
- <el-upload ref="importUploadRef"
- :limit="1"
- accept=".xlsx,.xls"
- :action="importUpload.url"
- :headers="importUpload.headers"
- :before-upload="importUpload.beforeUpload"
- :on-success="importUpload.onSuccess"
- :on-error="importUpload.onError"
- :on-progress="importUpload.onProgress"
- :on-change="importUpload.onChange"
- :auto-upload="false"
- drag>
+ <FormDialog
+ v-model="importUpload.open"
+ :title="importUpload.title"
+ :width="'600px'"
+ @close="importUpload.open = false"
+ @confirm="submitImportFile"
+ @cancel="importUpload.open = false"
+ >
+ <el-upload
+ ref="importUploadRef"
+ :limit="1"
+ accept=".xlsx,.xls"
+ :action="importUpload.url"
+ :headers="importUpload.headers"
+ :before-upload="importUpload.beforeUpload"
+ :on-success="importUpload.onSuccess"
+ :on-error="importUpload.onError"
+ :on-progress="importUpload.onProgress"
+ :on-change="importUpload.onChange"
+ :auto-upload="false"
+ drag
+ >
<i class="el-icon-upload"></i>
- <div class="el-upload__text">
- 灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em>
- </div>
+ <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
<template #tip>
<div class="el-upload__tip">
浠呮敮鎸� xls/xlsx锛屽ぇ灏忎笉瓒呰繃 10MB銆�
- <el-button link
- type="primary"
- @click="downloadTemplate">涓嬭浇瀵煎叆妯℃澘
+ <el-button link type="primary" @click="downloadTemplate"
+ >涓嬭浇瀵煎叆妯℃澘
</el-button>
</div>
</template>
@@ -772,35 +871,50 @@
</FormDialog>
<!-- // todo 闄勪欢棰勮鐩稿叧 -->
<!-- 闄勪欢鍒楄〃寮圭獥 -->
- <FileList v-if="fileDialogVisible"
- v-model:visible="fileDialogVisible"
- record-type="sales_ledger"
- :record-id="recordId" />
+ <FileList
+ v-if="fileDialogVisible"
+ v-model:visible="fileDialogVisible"
+ record-type="sales_ledger"
+ :record-id="recordId"
+ />
<!-- 鎵撳嵃棰勮寮圭獥 -->
- <el-dialog v-model="printPreviewVisible"
- title="鎵撳嵃棰勮"
- width="90%"
- :close-on-click-modal="false"
- class="print-preview-dialog">
+ <el-dialog
+ v-model="printPreviewVisible"
+ title="鎵撳嵃棰勮"
+ width="90%"
+ :close-on-click-modal="false"
+ class="print-preview-dialog"
+ >
<div class="print-preview-container">
<div class="print-preview-header">
- <el-button type="primary"
- @click="executePrint">鎵ц鎵撳嵃
- </el-button>
+ <el-button type="primary" @click="executePrint">鎵ц鎵撳嵃 </el-button>
<el-button @click="printPreviewVisible = false">鍏抽棴棰勮</el-button>
</div>
<div class="print-preview-content">
- <div v-if="printData.length === 0"
- style="text-align: center; padding: 50px; color: #999;">
+ <div
+ v-if="printData.length === 0"
+ style="text-align: center; padding: 50px; color: #999"
+ >
鏆傛棤鎵撳嵃鏁版嵁
</div>
- <div v-else
- style="text-align: center; padding: 10px; color: #666; font-size: 14px; background: #e8f4fd; margin-bottom: 10px;">
+ <div
+ v-else
+ style="
+ text-align: center;
+ padding: 10px;
+ color: #666;
+ font-size: 14px;
+ background: #e8f4fd;
+ margin-bottom: 10px;
+ "
+ >
鍏� {{ printData.length }} 鏉℃暟鎹緟鎵撳嵃
</div>
- <div v-for="(item, index) in printData"
- :key="index"
- class="print-page">
+ <div
+ v-for="(item, index) in printData"
+ :key="index"
+ class="print-page"
+ >
<div class="delivery-note">
<div class="header">
<div class="document-title">闆跺敭鍙戣揣鍗�</div>
@@ -838,18 +952,17 @@
</tr>
</thead>
<tbody>
- <tr v-for="product in item.products"
- :key="product.id">
- <td>{{ product.productCategory || '' }}</td>
- <td>{{ product.specificationModel || '' }}</td>
- <td>{{ product.unit || '' }}</td>
- <td>{{ product.taxInclusiveUnitPrice || '0' }}</td>
- <td>{{ product.quantity || '0' }}</td>
- <td>{{ product.taxInclusiveTotalPrice || '0' }}</td>
+ <tr v-for="product in item.products" :key="product.id">
+ <td>{{ product.productCategory || "" }}</td>
+ <td>{{ product.specificationModel || "" }}</td>
+ <td>{{ product.unit || "" }}</td>
+ <td>{{ product.taxInclusiveUnitPrice || "0" }}</td>
+ <td>{{ product.quantity || "0" }}</td>
+ <td>{{ product.taxInclusiveTotalPrice || "0" }}</td>
</tr>
<tr v-if="!item.products || item.products.length === 0">
- <td colspan="6"
- style="text-align: center; color: #999;">鏆傛棤浜у搧鏁版嵁
+ <td colspan="6" style="text-align: center; color: #999">
+ 鏆傛棤浜у搧鏁版嵁
</td>
</tr>
</tbody>
@@ -859,8 +972,12 @@
<td class="total-value"></td>
<td class="total-value"></td>
<td class="total-value"></td>
- <td class="total-value">{{ getTotalQuantity(item.products) }}</td>
- <td class="total-value">{{ getTotalAmount(item.products) }}</td>
+ <td class="total-value">
+ {{ getTotalQuantity(item.products) }}
+ </td>
+ <td class="total-value">
+ {{ getTotalAmount(item.products) }}
+ </td>
</tr>
</tfoot>
</table>
@@ -883,7 +1000,9 @@
<div class="footer-row">
<div class="footer-item">
<span class="label">鎿嶄綔鍛橈細</span>
- <span class="value">{{ userStore.nickName || '鎾曞紑鍓�' }}</span>
+ <span class="value">{{
+ userStore.nickName || "鎾曞紑鍓�"
+ }}</span>
</div>
<div class="footer-item">
<span class="label">鎵撳嵃鏃ユ湡锛�</span>
@@ -897,116 +1016,127 @@
</div>
</el-dialog>
<!-- 鍙戣揣寮规 -->
- <el-dialog v-model="deliveryFormVisible"
- title="鍙戣揣淇℃伅"
- width="40%"
- @close="closeDeliveryDia">
- <el-form :model="deliveryForm"
- label-width="120px"
- label-position="top"
- :rules="deliveryRules"
- ref="deliveryFormRef">
+ <el-dialog
+ v-model="deliveryFormVisible"
+ title="鍙戣揣淇℃伅"
+ width="40%"
+ @close="closeDeliveryDia"
+ >
+ <el-form
+ :model="deliveryForm"
+ label-width="120px"
+ label-position="top"
+ :rules="deliveryRules"
+ ref="deliveryFormRef"
+ >
<el-row :gutter="30">
<el-col :span="24">
- <el-form-item label="鍙戣揣绫诲瀷锛�"
- prop="type">
- <el-select v-model="deliveryForm.type"
- placeholder="璇烽�夋嫨鍙戣揣绫诲瀷"
- style="width: 100%"
- @change="handleDeliveryTypeChange">
- <el-option label="璐ц溅"
- value="璐ц溅" />
- <el-option label="蹇��"
- value="蹇��" />
+ <el-form-item label="鍙戣揣绫诲瀷锛�" prop="type">
+ <el-select
+ v-model="deliveryForm.type"
+ placeholder="璇烽�夋嫨鍙戣揣绫诲瀷"
+ style="width: 100%"
+ @change="handleDeliveryTypeChange"
+ >
+ <el-option label="璐ц溅" value="璐ц溅" />
+ <el-option label="蹇��" value="蹇��" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="寰呭彂璐ф暟閲忥細">
- <el-input :model-value="currentDeliveryRow?.noQuantity"
- disabled />
+ <el-input
+ :model-value="currentDeliveryRow?.noQuantity"
+ disabled
+ />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
- <el-col :span="24"
- v-if="deliveryForm.type === '璐ц溅'">
- <el-form-item label="鍙戣揣杞︾墝鍙凤細"
- prop="shippingCarNumber">
- <el-input v-model="deliveryForm.shippingCarNumber"
- placeholder="璇疯緭鍏ュ彂璐ц溅鐗屽彿"
- clearable />
+ <el-col :span="24" v-if="deliveryForm.type === '璐ц溅'">
+ <el-form-item label="鍙戣揣杞︾墝鍙凤細" prop="shippingCarNumber">
+ <el-input
+ v-model="deliveryForm.shippingCarNumber"
+ placeholder="璇疯緭鍏ュ彂璐ц溅鐗屽彿"
+ clearable
+ />
</el-form-item>
</el-col>
- <el-col :span="24"
- v-else>
- <el-form-item label="蹇�掑叕鍙革細"
- prop="expressCompany">
- <el-input v-model="deliveryForm.expressCompany"
- placeholder="璇疯緭鍏ュ揩閫掑叕鍙�"
- clearable />
+ <el-col :span="24" v-else>
+ <el-form-item label="蹇�掑叕鍙革細" prop="expressCompany">
+ <el-input
+ v-model="deliveryForm.expressCompany"
+ placeholder="璇疯緭鍏ュ揩閫掑叕鍙�"
+ clearable
+ />
</el-form-item>
</el-col>
</el-row>
- <el-row :gutter="30"
- v-if="deliveryForm.type === '蹇��'">
+ <el-row :gutter="30" v-if="deliveryForm.type === '蹇��'">
<el-col :span="24">
- <el-form-item label="蹇�掑崟鍙凤細"
- prop="expressNumber">
- <el-input v-model="deliveryForm.expressNumber"
- placeholder="璇疯緭鍏ュ揩閫掑崟鍙�"
- clearable />
+ <el-form-item label="蹇�掑崟鍙凤細" prop="expressNumber">
+ <el-input
+ v-model="deliveryForm.expressNumber"
+ placeholder="璇疯緭鍏ュ揩閫掑崟鍙�"
+ clearable
+ />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="24">
<el-form-item label="鍙戣揣鍥剧墖锛�">
- <ImageUpload v-model:file-list="deliveryFileList"
- :limit="9" />
+ <ImageUpload v-model:file-list="deliveryFileList" :limit="9" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="24">
- <el-form-item label="搴撳瓨锛�"
- prop="batchNo">
- <el-table :data="deliveryForm.batchNoList"
- border
- size="small"
- max-height="260"
- style="width: 100%;">
- <el-table-column label="鎵瑰彿"
- prop="batchNo"
- min-width="180" />
- <el-table-column label="浜у搧澶х被"
- prop="productName"
- min-width="100" />
- <el-table-column label="瑙勬牸鍨嬪彿"
- prop="model"
- min-width="100" />
- <el-table-column label="鍗曚綅"
- prop="unit"
- min-width="100" />
- <el-table-column label="搴撳瓨鏁伴噺"
- min-width="120"
- align="center">
+ <el-form-item label="搴撳瓨锛�" prop="batchNo">
+ <el-table
+ :data="deliveryForm.batchNoList"
+ border
+ size="small"
+ max-height="260"
+ style="width: 100%"
+ >
+ <el-table-column label="鎵瑰彿" prop="batchNo" min-width="180" />
+ <el-table-column
+ label="浜у搧澶х被"
+ prop="productName"
+ min-width="100"
+ />
+ <el-table-column
+ label="瑙勬牸鍨嬪彿"
+ prop="model"
+ min-width="100"
+ />
+ <el-table-column label="鍗曚綅" prop="unit" min-width="100" />
+ <el-table-column
+ label="搴撳瓨鏁伴噺"
+ min-width="120"
+ align="center"
+ >
<template #default="scope">
{{ getDeliveryBatchQuantity(scope.row) }}
</template>
</el-table-column>
- <el-table-column label="鍙戣揣鏁伴噺"
- min-width="160"
- align="center">
+ <el-table-column
+ label="鍙戣揣鏁伴噺"
+ min-width="160"
+ align="center"
+ >
<template #default="scope">
- <el-input-number v-model="scope.row.deliveryQuantity"
- :min="0"
- :max="getDeliveryBatchDeliveryMax(scope.row)"
- :precision="2"
- :step="0.01"
- controls-position="right"
- @change="handleDeliveryBatchQuantityChange(scope.row)"
- style="width: 100%;" />
+ <el-input-number
+ v-model="scope.row.deliveryQuantity"
+ :min="0"
+ :max="getDeliveryBatchDeliveryMax(scope.row)"
+ :precision="2"
+ :step="0.01"
+ controls-position="right"
+ @change="handleDeliveryBatchQuantityChange(scope.row)"
+ style="width: 100%"
+ />
</template>
</el-table-column>
</el-table>
@@ -1016,8 +1146,8 @@
</el-form>
<template #footer>
<div class="dialog-footer">
- <el-button type="primary"
- @click="submitDelivery">纭鍙戣揣
+ <el-button type="primary" @click="submitDelivery"
+ >纭鍙戣揣
</el-button>
<el-button @click="closeDeliveryDia">鍙栨秷</el-button>
</div>
@@ -1027,1059 +1157,1062 @@
</template>
<script setup>
- import { getToken } from "@/utils/auth";
- import pagination from "@/components/PIMTable/Pagination.vue";
- import { onMounted, ref, getCurrentInstance } from "vue";
- import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js";
- import { ElMessageBox, ElMessage } from "element-plus";
- import useUserStore from "@/store/modules/user";
- import { userListNoPage } from "@/api/system/user.js";
- import FormDialog from "@/components/Dialog/FormDialog.vue";
- import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
- import {
- ledgerListPage,
- productList,
- customerList,
- addOrUpdateSalesLedger,
- getSalesLedgerWithProducts,
- delLedger,
- addOrUpdateSalesLedgerProduct,
- delProduct,
- delLedgerFile,
- getProductInventory,
- } from "@/api/salesManagement/salesLedger.js";
- import { getStockInventoryByModelId } from "@/api/inventoryManagement/stockInventory.js";
- import { modelList, productTreeList } from "@/api/basicData/product.js";
- import useFormData from "@/hooks/useFormData.js";
- import dayjs from "dayjs";
- import FileUpload from "@/components/AttachmentUpload/file/index.vue";
- import ImageUpload from "@/components/AttachmentUpload/image/index.vue";
- import { getCurrentDate } from "@/utils/index.js";
- import { listCustomer } from "@/api/basicData/customer.js";
+import { getToken } from "@/utils/auth";
+import pagination from "@/components/PIMTable/Pagination.vue";
+import { onMounted, ref, getCurrentInstance } from "vue";
+import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js";
+import { ElMessageBox, ElMessage } from "element-plus";
+import useUserStore from "@/store/modules/user";
+import { userListNoPage } from "@/api/system/user.js";
+import FormDialog from "@/components/Dialog/FormDialog.vue";
+import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
+import {
+ ledgerListPage,
+ productList,
+ customerList,
+ addOrUpdateSalesLedger,
+ getSalesLedgerWithProducts,
+ delLedger,
+ addOrUpdateSalesLedgerProduct,
+ delProduct,
+ delLedgerFile,
+ getProductInventory,
+} from "@/api/salesManagement/salesLedger.js";
+import { getStockInventoryByModelId } from "@/api/inventoryManagement/stockInventory.js";
+import { modelList, productTreeList } from "@/api/basicData/product.js";
+import useFormData from "@/hooks/useFormData.js";
+import dayjs from "dayjs";
+import FileUpload from "@/components/AttachmentUpload/file/index.vue";
+import ImageUpload from "@/components/AttachmentUpload/image/index.vue";
+import { getCurrentDate } from "@/utils/index.js";
+import { listCustomer } from "@/api/basicData/customer.js";
- const FileList = defineAsyncComponent(() =>
- import("@/components/Dialog/FileList.vue")
+const FileList = defineAsyncComponent(() =>
+ import("@/components/Dialog/FileList.vue")
+);
+
+const router = useRouter();
+const route = useRoute();
+const userStore = useUserStore();
+const { proxy } = getCurrentInstance();
+const { tax_rate } = proxy.useDict("tax_rate");
+const tableData = ref([]);
+const productData = ref([]);
+const selectedRows = ref([]);
+const productSelectedRows = ref([]);
+const userList = ref([]);
+const customerOption = ref([]);
+const productOptions = ref([]);
+const modelOptions = ref([]);
+const tableLoading = ref(false);
+const page = reactive({
+ current: 1,
+ size: 100,
+});
+const total = ref(0);
+const fileList = ref([]);
+const deliveryFileList = ref([]);
+
+// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
+const operationType = ref("");
+const dialogFormVisible = ref(false);
+const data = reactive({
+ searchForm: {
+ customerName: "", // 瀹㈡埛鍚嶇О
+ salesContractNo: "", // 閿�鍞悎鍚岀紪鍙�
+ entryDate: null, // 褰曞叆鏃ユ湡
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
+ },
+ form: {
+ salesContractNo: "",
+ autoGenerateContractNo: true,
+ salesman: "",
+ customerId: "",
+ entryPerson: "",
+ entryDate: "",
+ deliveryDate: "",
+ maintenanceTime: "",
+ productData: [],
+ executionDate: "",
+ hasProductionRecord: false,
+ createTime: "",
+ },
+ rules: {
+ salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ customerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ entryPerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ deliveryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ },
+});
+const { form, rules } = toRefs(data);
+const { form: searchForm } = useFormData(data.searchForm);
+// 浜у搧琛ㄥ崟寮规鏁版嵁
+const productFormVisible = ref(false);
+const productOperationType = ref("");
+const currentId = ref("");
+const productFormData = reactive({
+ productForm: {
+ productCategory: "",
+ specificationModel: "",
+ unit: "",
+ quantity: "",
+ taxInclusiveUnitPrice: "",
+ taxRate: "",
+ taxInclusiveTotalPrice: "",
+ taxExclusiveTotalPrice: "",
+ invoiceType: "",
+ isProduction: false,
+ },
+ productRules: {
+ productCategory: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ productModelId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ specificationModel: [
+ { required: true, message: "璇烽�夋嫨", trigger: "change" },
+ ],
+ unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ taxInclusiveUnitPrice: [
+ { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ ],
+ taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ taxInclusiveTotalPrice: [
+ { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ ],
+ taxExclusiveTotalPrice: [
+ { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ ],
+ invoiceType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ isProduction: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ },
+});
+const { productForm, productRules } = toRefs(productFormData);
+// 闃叉寰幆璁$畻鐨勬爣蹇�
+const isCalculating = ref(false);
+// 鎵撳嵃鐩稿叧
+const printPreviewVisible = ref(false);
+const printData = ref([]);
+
+// 鎶ヤ环鍗曞鍏ョ浉鍏�
+const quotationDialogVisible = ref(false);
+const quotationLoading = ref(false);
+const quotationList = ref([]);
+const quotationSearchForm = reactive({
+ quotationNo: "",
+ customer: "",
+});
+// 鎶ヤ环鍗曞脊妗嗗垎椤�
+const quotationPage = reactive({
+ current: 1,
+ size: 10,
+ total: 0,
+});
+const selectedQuotation = ref(null);
+
+// 鍙戣揣鐩稿叧
+const deliveryFormVisible = ref(false);
+const currentDeliveryRow = ref(null);
+const getDeliveryBatchQuantity = (item) => {
+ const quantity =
+ item?.qualitity ??
+ item?.quantity ??
+ item?.unLockedQuantity ??
+ item?.qualifiedUnLockedQuantity ??
+ item?.qualifiedQuantity ??
+ item?.stockQuantity;
+ return quantity ?? 0;
+};
+const getCurrentDeliveryRowQuantity = () => {
+ return Number(currentDeliveryRow.value?.noQuantity || 0);
+};
+const getDeliveryBatchDeliveryMax = (row) => {
+ const productQuantity = getCurrentDeliveryRowQuantity();
+ const batchQuantity = Number(getDeliveryBatchQuantity(row) || 0);
+ const otherBatchTotal = (deliveryForm.value.batchNoList || []).reduce(
+ (sum, item) => {
+ if (item?.id === row?.id) return sum;
+ return sum + Number(item?.deliveryQuantity || 0);
+ },
+ 0
);
+ const remainingProductQuantity = Math.max(
+ 0,
+ productQuantity - otherBatchTotal
+ );
+ return Math.max(0, Math.min(batchQuantity, remainingProductQuantity));
+};
+const handleDeliveryBatchQuantityChange = (row) => {
+ const productQuantity = getCurrentDeliveryRowQuantity();
+ const batchQuantity = Number(getDeliveryBatchQuantity(row) || 0);
+ const otherBatchTotal = (deliveryForm.value.batchNoList || []).reduce(
+ (sum, item) => {
+ if (item?.id === row?.id) return sum;
+ return sum + Number(item?.deliveryQuantity || 0);
+ },
+ 0
+ );
+ const remainingProductQuantity = Math.max(
+ 0,
+ productQuantity - otherBatchTotal
+ );
+ const currentValue = Number(row?.deliveryQuantity || 0);
- const router = useRouter();
- const route = useRoute();
- const userStore = useUserStore();
- const { proxy } = getCurrentInstance();
- const { tax_rate } = proxy.useDict("tax_rate");
- const tableData = ref([]);
- const productData = ref([]);
- const selectedRows = ref([]);
- const productSelectedRows = ref([]);
- const userList = ref([]);
- const customerOption = ref([]);
- const productOptions = ref([]);
- const modelOptions = ref([]);
- const tableLoading = ref(false);
- const page = reactive({
- current: 1,
- size: 100,
- });
- const total = ref(0);
- const fileList = ref([]);
- const deliveryFileList = ref([]);
-
- // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
- const operationType = ref("");
- const dialogFormVisible = ref(false);
- const data = reactive({
- searchForm: {
- customerName: "", // 瀹㈡埛鍚嶇О
- salesContractNo: "", // 閿�鍞悎鍚岀紪鍙�
- entryDate: null, // 褰曞叆鏃ユ湡
- entryDateStart: undefined,
- entryDateEnd: undefined,
- },
- form: {
- salesContractNo: "",
- autoGenerateContractNo: true,
- salesman: "",
- customerId: "",
- entryPerson: "",
- entryDate: "",
- deliveryDate: "",
- maintenanceTime: "",
- productData: [],
- executionDate: "",
- hasProductionRecord: false,
- },
- rules: {
- salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- customerId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- entryPerson: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- deliveryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- },
- });
- const { form, rules } = toRefs(data);
- const { form: searchForm } = useFormData(data.searchForm);
- // 浜у搧琛ㄥ崟寮规鏁版嵁
- const productFormVisible = ref(false);
- const productOperationType = ref("");
- const currentId = ref("");
- const productFormData = reactive({
- productForm: {
- productCategory: "",
- specificationModel: "",
- unit: "",
- quantity: "",
- taxInclusiveUnitPrice: "",
- taxRate: "",
- taxInclusiveTotalPrice: "",
- taxExclusiveTotalPrice: "",
- invoiceType: "",
- isProduction: false,
- },
- productRules: {
- productCategory: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- productModelId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- specificationModel: [
- { required: true, message: "璇烽�夋嫨", trigger: "change" },
- ],
- unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- taxInclusiveUnitPrice: [
- { required: true, message: "璇疯緭鍏�", trigger: "blur" },
- ],
- taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- taxInclusiveTotalPrice: [
- { required: true, message: "璇疯緭鍏�", trigger: "blur" },
- ],
- taxExclusiveTotalPrice: [
- { required: true, message: "璇疯緭鍏�", trigger: "blur" },
- ],
- invoiceType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- isProduction: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- },
- });
- const { productForm, productRules } = toRefs(productFormData);
- // 闃叉寰幆璁$畻鐨勬爣蹇�
- const isCalculating = ref(false);
- // 鎵撳嵃鐩稿叧
- const printPreviewVisible = ref(false);
- const printData = ref([]);
-
- // 鎶ヤ环鍗曞鍏ョ浉鍏�
- const quotationDialogVisible = ref(false);
- const quotationLoading = ref(false);
- const quotationList = ref([]);
- const quotationSearchForm = reactive({
- quotationNo: "",
- customer: "",
- });
- // 鎶ヤ环鍗曞脊妗嗗垎椤�
- const quotationPage = reactive({
- current: 1,
- size: 10,
- total: 0,
- });
- const selectedQuotation = ref(null);
-
- // 鍙戣揣鐩稿叧
- const deliveryFormVisible = ref(false);
- const currentDeliveryRow = ref(null);
- const getDeliveryBatchQuantity = item => {
- const quantity =
- item?.qualitity ??
- item?.quantity ??
- item?.unLockedQuantity ??
- item?.qualifiedUnLockedQuantity ??
- item?.qualifiedQuantity ??
- item?.stockQuantity;
- return quantity ?? 0;
- };
- const getCurrentDeliveryRowQuantity = () => {
- return Number(currentDeliveryRow.value?.noQuantity || 0);
- };
- const getDeliveryBatchDeliveryMax = row => {
- const productQuantity = getCurrentDeliveryRowQuantity();
- const batchQuantity = Number(getDeliveryBatchQuantity(row) || 0);
- const otherBatchTotal = (deliveryForm.value.batchNoList || []).reduce(
- (sum, item) => {
- if (item?.id === row?.id) return sum;
- return sum + Number(item?.deliveryQuantity || 0);
- },
- 0
- );
- const remainingProductQuantity = Math.max(
- 0,
- productQuantity - otherBatchTotal
- );
- return Math.max(0, Math.min(batchQuantity, remainingProductQuantity));
- };
- const handleDeliveryBatchQuantityChange = row => {
- const productQuantity = getCurrentDeliveryRowQuantity();
- const batchQuantity = Number(getDeliveryBatchQuantity(row) || 0);
- const otherBatchTotal = (deliveryForm.value.batchNoList || []).reduce(
- (sum, item) => {
- if (item?.id === row?.id) return sum;
- return sum + Number(item?.deliveryQuantity || 0);
- },
- 0
- );
- const remainingProductQuantity = Math.max(
- 0,
- productQuantity - otherBatchTotal
- );
- const currentValue = Number(row?.deliveryQuantity || 0);
-
- if (currentValue > batchQuantity) {
- row.deliveryQuantity = batchQuantity;
- proxy.$modal.msgWarning("鍙戣揣鏁伴噺涓嶈兘澶т簬搴撳瓨鏁伴噺");
- } else if (currentValue > remainingProductQuantity) {
- row.deliveryQuantity = remainingProductQuantity;
- proxy.$modal.msgWarning("鎵�鏈夋壒娆″彂璐ф暟閲忎箣鍜屼笉鑳藉ぇ浜庡緟鍙戣揣鏁伴噺");
- }
- };
- const getSelectedDeliveryBatchRows = () => {
- return (deliveryForm.value.batchNoList || []).filter(
- item => Number(item?.deliveryQuantity || 0) > 0
- );
- };
- const getDeliveryBatchNoList = async productModelId => {
- if (!productModelId) return [];
- const res = await getStockInventoryByModelId(productModelId);
- const rawList = Array.isArray(res?.data)
- ? res.data
- : res?.data?.records || res?.data?.rows || [];
- const seenIds = new Set();
- return rawList
- .filter(item => {
- if (!item?.id || !item?.batchNo || seenIds.has(item.id)) {
- return false;
- }
- seenIds.add(item.id);
- return true;
- })
- .map(item => ({
- ...item,
- deliveryQuantity: 0,
- }));
- };
- const validateDeliveryShippingCarNumber = (_rule, value, callback) => {
- if (deliveryForm.value.type === "璐ц溅" && !value) {
- return callback(new Error("璇疯緭鍏ュ彂璐ц溅鐗屽彿"));
- }
- callback();
- };
- const validateDeliveryExpressCompany = (_rule, value, callback) => {
- if (deliveryForm.value.type === "蹇��" && !value) {
- return callback(new Error("璇疯緭鍏ュ揩閫掑叕鍙�"));
- }
- callback();
- };
- const deliveryFormData = reactive({
- deliveryForm: {
- shippingCarNumber: "",
- expressCompany: "",
- expressNumber: "",
- type: "璐ц溅", // 璐ц溅, 蹇��
- },
- deliveryRules: {
- shippingCarNumber: [
- { validator: validateDeliveryShippingCarNumber, trigger: "blur" },
- ],
- expressCompany: [
- { validator: validateDeliveryExpressCompany, trigger: "blur" },
- ],
- type: [{ required: true, message: "璇烽�夋嫨鍙戣揣绫诲瀷", trigger: "change" }],
- },
- });
- const { deliveryForm, deliveryRules } = toRefs(deliveryFormData);
-
- // 瀵煎叆鐩稿叧
- const importUploadRef = ref(null);
- const importUpload = reactive({
- title: "瀵煎叆閿�鍞彴璐�",
- open: false,
- url: import.meta.env.VITE_APP_BASE_API + "/sales/ledger/import",
- headers: { Authorization: "Bearer " + getToken() },
- isUploading: false,
- beforeUpload: file => {
- const isExcel = file.name.endsWith(".xlsx") || file.name.endsWith(".xls");
- const isLt10M = file.size / 1024 / 1024 < 10;
- if (!isExcel) {
- proxy.$modal.msgError("涓婁紶鏂囦欢鍙兘鏄� xlsx/xls 鏍煎紡!");
+ if (currentValue > batchQuantity) {
+ row.deliveryQuantity = batchQuantity;
+ proxy.$modal.msgWarning("鍙戣揣鏁伴噺涓嶈兘澶т簬搴撳瓨鏁伴噺");
+ } else if (currentValue > remainingProductQuantity) {
+ row.deliveryQuantity = remainingProductQuantity;
+ proxy.$modal.msgWarning("鎵�鏈夋壒娆″彂璐ф暟閲忎箣鍜屼笉鑳藉ぇ浜庡緟鍙戣揣鏁伴噺");
+ }
+};
+const getSelectedDeliveryBatchRows = () => {
+ return (deliveryForm.value.batchNoList || []).filter(
+ (item) => Number(item?.deliveryQuantity || 0) > 0
+ );
+};
+const getDeliveryBatchNoList = async (productModelId) => {
+ if (!productModelId) return [];
+ const res = await getStockInventoryByModelId(productModelId);
+ const rawList = Array.isArray(res?.data)
+ ? res.data
+ : res?.data?.records || res?.data?.rows || [];
+ const seenIds = new Set();
+ return rawList
+ .filter((item) => {
+ if (!item?.id || !item?.batchNo || seenIds.has(item.id)) {
return false;
}
- if (!isLt10M) {
- proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 10MB!");
- return false;
- }
+ seenIds.add(item.id);
return true;
- },
- onChange: (file, fileList) => {
- console.log("鏂囦欢鐘舵�佹敼鍙�", file, fileList);
- },
- onProgress: (event, file, fileList) => {
- console.log("涓婁紶涓�...", event.percent);
- },
- onSuccess: (response, file, fileList) => {
- console.log("涓婁紶鎴愬姛", response, file, fileList);
- importUpload.isUploading = false;
- if (response.code === 200) {
- proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
- importUpload.open = false;
- if (importUploadRef.value) {
- importUploadRef.value.clearFiles();
- }
- getList();
- } else {
- proxy.$modal.msgError(response.msg || "瀵煎叆澶辫触");
- }
- },
- onError: (error, file, fileList) => {
- console.error("涓婁紶澶辫触", error, file, fileList);
- importUpload.isUploading = false;
- proxy.$modal.msgError("瀵煎叆澶辫触锛岃閲嶈瘯");
- },
- });
+ })
+ .map((item) => ({
+ ...item,
+ deliveryQuantity: 0,
+ }));
+};
+const validateDeliveryShippingCarNumber = (_rule, value, callback) => {
+ if (deliveryForm.value.type === "璐ц溅" && !value) {
+ return callback(new Error("璇疯緭鍏ュ彂璐ц溅鐗屽彿"));
+ }
+ callback();
+};
+const validateDeliveryExpressCompany = (_rule, value, callback) => {
+ if (deliveryForm.value.type === "蹇��" && !value) {
+ return callback(new Error("璇疯緭鍏ュ揩閫掑叕鍙�"));
+ }
+ callback();
+};
+const deliveryFormData = reactive({
+ deliveryForm: {
+ shippingCarNumber: "",
+ expressCompany: "",
+ expressNumber: "",
+ type: "璐ц溅", // 璐ц溅, 蹇��
+ },
+ deliveryRules: {
+ shippingCarNumber: [
+ { validator: validateDeliveryShippingCarNumber, trigger: "blur" },
+ ],
+ expressCompany: [
+ { validator: validateDeliveryExpressCompany, trigger: "blur" },
+ ],
+ type: [{ required: true, message: "璇烽�夋嫨鍙戣揣绫诲瀷", trigger: "change" }],
+ },
+});
+const { deliveryForm, deliveryRules } = toRefs(deliveryFormData);
- const changeDaterange = value => {
- if (value) {
- searchForm.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
- searchForm.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
- } else {
- searchForm.entryDateStart = undefined;
- searchForm.entryDateEnd = undefined;
+// 瀵煎叆鐩稿叧
+const importUploadRef = ref(null);
+const importUpload = reactive({
+ title: "瀵煎叆閿�鍞彴璐�",
+ open: false,
+ url: import.meta.env.VITE_APP_BASE_API + "/sales/ledger/import",
+ headers: { Authorization: "Bearer " + getToken() },
+ isUploading: false,
+ beforeUpload: (file) => {
+ const isExcel = file.name.endsWith(".xlsx") || file.name.endsWith(".xls");
+ const isLt10M = file.size / 1024 / 1024 < 10;
+ if (!isExcel) {
+ proxy.$modal.msgError("涓婁紶鏂囦欢鍙兘鏄� xlsx/xls 鏍煎紡!");
+ return false;
}
- handleQuery();
- };
-
- // 鏌ヨ鍒楄〃
- /** 鎼滅储鎸夐挳鎿嶄綔 */
- const handleQuery = () => {
- // 鍙湁鍦ㄧ偣鍑绘悳绱㈡寜閽椂鎵嶉噸缃〉鐮佸埌绗竴椤�
- // 閬垮厤琛ㄥ崟瀛楁change浜嬩欢骞叉壈鍒嗛〉
- if (arguments.length === 0) {
- page.current = 1;
- }
- expandedRowKeys.value = [];
- getList();
- };
- const paginationChange = obj => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
- };
- const getList = () => {
- tableLoading.value = true;
- const { entryDate, ...rest } = searchForm;
- // 灏嗚寖鍥存棩鏈熷瓧娈典紶閫掔粰鍚庣
- const params = { ...rest, ...page };
- // 绉婚櫎褰曞叆鏃ユ湡鐨勯粯璁ゅ�艰缃紝鍙繚鐣欒寖鍥存棩鏈熷瓧娈�
- delete params.entryDate;
- return ledgerListPage(params)
- .then(res => {
- tableLoading.value = false;
- tableData.value = res.records;
- tableData.value.map(item => {
- item.children = [];
- });
- total.value = res.total;
- return res;
- })
- .catch(() => {
- tableLoading.value = false;
- });
- };
- // 鑾峰彇浜у搧澶х被tree鏁版嵁
- const getProductOptions = () => {
- // 杩斿洖 Promise锛屼究浜庡湪缂栬緫浜у搧鏃剁瓑寰呭姞杞藉畬鎴�
- return productTreeList().then(res => {
- productOptions.value = convertIdToValue(res);
- return productOptions.value;
- });
- };
- const formattedNumber = (row, column, cellValue) => {
- if (cellValue === undefined || cellValue === null || cellValue === "") {
- return "0.00";
- }
- return parseFloat(cellValue).toFixed(2);
- };
- const findLedgerRecordByRow = row => {
- if (!row) return null;
- if (
- row.maintainer !== undefined ||
- row.maintainerName !== undefined ||
- row.entryPerson !== undefined ||
- row.entryPersonName !== undefined
- ) {
- return row;
- }
- if (row.salesLedgerId !== undefined && row.salesLedgerId !== null) {
- return (
- tableData.value.find(
- item => String(item.id) === String(row.salesLedgerId)
- ) || null
- );
- }
- return null;
- };
- const isCurrentUserMaintainer = row => {
- const ledgerRecord = findLedgerRecordByRow(row);
- if (!ledgerRecord) return true;
- const currentUserId = String(userStore.id ?? "");
- const currentNickName = String(userStore.nickName ?? "").trim();
- const maintainerId = ledgerRecord.maintainerId ?? ledgerRecord.entryPerson;
- const maintainerName =
- ledgerRecord.maintainerName ??
- ledgerRecord.maintainer ??
- ledgerRecord.entryPersonName;
- if (
- maintainerId !== undefined &&
- maintainerId !== null &&
- String(maintainerId) !== ""
- ) {
- return String(maintainerId) === currentUserId;
- }
- if (
- maintainerName !== undefined &&
- maintainerName !== null &&
- String(maintainerName).trim() !== ""
- ) {
- return String(maintainerName).trim() === currentNickName;
+ if (!isLt10M) {
+ proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 10MB!");
+ return false;
}
return true;
- };
- const canEditLedger = row => isCurrentUserMaintainer(row);
- const canDeleteLedger = row => isCurrentUserMaintainer(row);
- const sensitiveAmountFormatter = (row, column, cellValue) => {
- if (!isCurrentUserMaintainer(row)) {
- return "*****";
- }
- return formattedNumber(row, column, cellValue);
- };
- // 鑾峰彇tree瀛愭暟鎹�
- const getModels = value => {
- productForm.value.productCategory = findNodeById(productOptions.value, value);
- modelList({ id: value }).then(res => {
- modelOptions.value = res;
- });
- };
- const getProductModel = value => {
- const index = modelOptions.value.findIndex(item => item.id === value);
- if (index !== -1) {
- productForm.value.specificationModel = modelOptions.value[index].model;
- productForm.value.unit = modelOptions.value[index].unit;
+ },
+ onChange: (file, fileList) => {
+ console.log("鏂囦欢鐘舵�佹敼鍙�", file, fileList);
+ },
+ onProgress: (event, file, fileList) => {
+ console.log("涓婁紶涓�...", event.percent);
+ },
+ onSuccess: (response, file, fileList) => {
+ console.log("涓婁紶鎴愬姛", response, file, fileList);
+ importUpload.isUploading = false;
+ if (response.code === 200) {
+ proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
+ importUpload.open = false;
+ if (importUploadRef.value) {
+ importUploadRef.value.clearFiles();
+ }
+ getList();
} else {
- productForm.value.specificationModel = null;
- productForm.value.unit = null;
+ proxy.$modal.msgError(response.msg || "瀵煎叆澶辫触");
}
- };
- const findNodeById = (nodes, productId) => {
- for (let i = 0; i < nodes.length; i++) {
- if (nodes[i].value === productId) {
- return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
- }
- if (nodes[i].children && nodes[i].children.length > 0) {
- const foundNode = findNodeById(nodes[i].children, productId);
- if (foundNode) {
- return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
- }
- }
- }
- return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
- };
+ },
+ onError: (error, file, fileList) => {
+ console.error("涓婁紶澶辫触", error, file, fileList);
+ importUpload.isUploading = false;
+ proxy.$modal.msgError("瀵煎叆澶辫触锛岃閲嶈瘯");
+ },
+});
- function convertIdToValue(data) {
- return data.map(item => {
- const { id, children, ...rest } = item;
- const newItem = {
- ...rest,
- value: id, // 灏� id 鏀逛负 value
- };
- if (children && children.length > 0) {
- newItem.children = convertIdToValue(children);
- }
-
- return newItem;
- });
+const changeDaterange = (value) => {
+ if (value) {
+ searchForm.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
+ searchForm.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
+ } else {
+ searchForm.entryDateStart = undefined;
+ searchForm.entryDateEnd = undefined;
}
+ handleQuery();
+};
- // 鏍规嵁鍚嶇О鍙嶆煡浜у搧澶х被 id锛屼究浜庝粎瀛樺悕绉版椂鐨勫弽鏄�
- function findNodeIdByLabel(nodes, label) {
- if (!label) return null;
- for (let i = 0; i < nodes.length; i++) {
- const node = nodes[i];
- if (node.label === label) return node.value;
- if (node.children && node.children.length > 0) {
- const found = findNodeIdByLabel(node.children, label);
- if (found !== null && found !== undefined) return found;
- }
- }
- return null;
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ // 鍙湁鍦ㄧ偣鍑绘悳绱㈡寜閽椂鎵嶉噸缃〉鐮佸埌绗竴椤�
+ // 閬垮厤琛ㄥ崟瀛楁change浜嬩欢骞叉壈鍒嗛〉
+ if (arguments.length === 0) {
+ page.current = 1;
}
-
- // 琛ㄦ牸閫夋嫨鏁版嵁
- const handleSelectionChange = selection => {
- // 杩囨护鎺夊瓙鏁版嵁
- selectedRows.value = selection.filter(item => item.children !== undefined);
- console.log("selection", selectedRows.value);
- };
- const productSelected = selectedRows => {
- productSelectedRows.value = selectedRows;
- };
- const expandedRowKeys = ref([]);
- // 灞曞紑琛�
- const expandChange = (row, expandedRows) => {
- if (expandedRows.length > 0) {
- expandedRowKeys.value = [];
- try {
- productList({ salesLedgerId: row.id, type: 1 }).then(res => {
- const index = tableData.value.findIndex(item => item.id === row.id);
- if (index > -1) {
- tableData.value[index].children = res.data;
- }
- expandedRowKeys.value.push(row.id);
- });
- } catch (error) {
- console.log(error);
- }
- } else {
- expandedRowKeys.value = [];
- }
- };
-
- // 娣诲姞琛ㄨ绫诲悕鏂规硶
- const tableRowClassName = ({ row }) => {
- if (!row.deliveryDate) return "";
- if (row.isFh) return "";
-
- const diff = row.deliveryDaysDiff;
- if (diff === 15) {
- return "yellow";
- } else if (diff === 10) {
- return "pink";
- } else if (diff === 2) {
- return "purple";
- } else if (diff < 2) {
- return "red";
- }
- };
- // 涓昏〃鍚堣鏂规硶
- const summarizeMainTable = param => {
- return proxy.summarizeTable(param, [
- "contractAmount",
- "taxInclusiveTotalPrice",
- "taxExclusiveTotalPrice",
- ]);
- };
- // 瀛愯〃鍚堣鏂规硶
- const summarizeChildrenTable = (param, parentRow) => {
- if (!isCurrentUserMaintainer(parentRow)) {
- const { columns } = param;
- return columns.map((column, index) => {
- if (index === 0) {
- return "鍚堣";
- }
- if (
- [
- "taxInclusiveUnitPrice",
- "taxInclusiveTotalPrice",
- "taxExclusiveTotalPrice",
- ].includes(column.property)
- ) {
- return "*****";
- }
- return "";
+ expandedRowKeys.value = [];
+ getList();
+};
+const paginationChange = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+};
+const getList = () => {
+ tableLoading.value = true;
+ const { entryDate, ...rest } = searchForm;
+ // 灏嗚寖鍥存棩鏈熷瓧娈典紶閫掔粰鍚庣
+ const params = { ...rest, ...page };
+ // 绉婚櫎褰曞叆鏃ユ湡鐨勯粯璁ゅ�艰缃紝鍙繚鐣欒寖鍥存棩鏈熷瓧娈�
+ delete params.entryDate;
+ return ledgerListPage(params)
+ .then((res) => {
+ tableLoading.value = false;
+ tableData.value = res.records;
+ tableData.value.map((item) => {
+ item.children = [];
});
- }
- return proxy.summarizeTable(param, [
- "taxInclusiveUnitPrice",
- "taxInclusiveTotalPrice",
- "taxExclusiveTotalPrice",
- ]);
- };
- // 鎵撳紑寮规
- const openForm = async (type, row) => {
- if (type === "edit" && row && !canEditLedger(row)) {
- proxy.$modal.msgWarning("褰撳墠绯荤粺鐧诲綍浜轰笉鏄淮鎶や汉锛屼笉鑳界紪杈戞暟鎹�");
- return;
- }
- operationType.value = type;
- form.value = {};
- productData.value = [];
- selectedQuotation.value = null;
- let userLists = await userListNoPage();
- userList.value = userLists.data;
- listCustomer({ current: -1, size: -1, type: 0 }).then(res => {
- customerOption.value = res.data.records;
- });
- form.value.entryPerson = userStore.id;
- if (type === "add") {
- // 鏂板鏃惰缃綍鍏ユ棩鏈熶负褰撳ぉ
- form.value.entryDate = getCurrentDate();
- // 绛捐鏃ユ湡榛樿涓哄綋澶�
- form.value.executionDate = getCurrentDate();
- // 榛樿鑷姩鐢熸垚閿�鍞悎鍚屽彿
- form.value.autoGenerateContractNo = true;
- } else {
- currentId.value = row.id;
- getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
- form.value = { ...res };
- form.value.entryPerson = Number(res.entryPerson);
- productData.value = form.value.productData;
- fileList.value = form.value.storageBlobVOs;
- // 缂栬緫鏃惰缃嚜鍔ㄧ敓鎴愪负false锛屽厑璁告墜鍔ㄤ慨鏀�
- form.value.autoGenerateContractNo = false;
- });
- }
- // let userAll = await userStore.getInfo()
- // userList.value.forEach(element => {
- // if(userAll.user.nickName === element.nickName && userAll.user.userName === element.userName) {
- // form.value.entryPerson = userAll.user.userId // 璁剧疆榛樿涓氬姟鍛樹负褰撳墠鐢ㄦ埛
- // }
- // });
- form.value.entryDate = getCurrentDate(); // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈�
- dialogFormVisible.value = true;
- };
-
- // 鎵撳紑鎶ヤ环鍗曢�夋嫨寮圭獥锛堜粎瀹℃壒閫氳繃锛�
- const openQuotationDialog = async () => {
- if (operationType.value === "view") return;
- quotationDialogVisible.value = true;
- // 鎵撳紑寮圭獥鏃堕噸缃垎椤靛埌绗竴椤�
- quotationPage.current = 1;
- // 鍏堢‘淇濆鎴峰垪琛ㄥ凡鍔犺浇锛屼究浜庡悗缁洖濉� customerId
- if (!customerOption.value || customerOption.value.length === 0) {
- try {
- listCustomer({ current: -1, size: -1 }).then(res => {
- customerOption.value = res.data.records;
- });
- } catch (e) {
- // ignore锛屽厑璁哥敤鎴峰悗缁墜鍔ㄩ�夋嫨瀹㈡埛
- }
- }
- await fetchQuotationList();
- };
-
- const fetchQuotationList = async () => {
- quotationLoading.value = true;
- try {
- const params = {
- // 鍚庣鍒嗛〉瀛楁锛歝urrent / size
- current: quotationPage.current,
- size: quotationPage.size,
- ...quotationSearchForm,
- status: "閫氳繃",
- };
- const res = await getQuotationList(params);
- quotationList.value = res?.data?.records || [];
- quotationPage.total = res?.data?.total || 0;
- } finally {
- quotationLoading.value = false;
- }
- };
-
- const resetQuotationSearch = async () => {
- quotationSearchForm.quotationNo = "";
- quotationSearchForm.customer = "";
- quotationPage.current = 1;
- await fetchQuotationList();
- };
-
- // 鎶ヤ环鍗曞脊妗嗗垎椤靛垏鎹�
- const quotationPaginationChange = obj => {
- quotationPage.current = obj.page;
- quotationPage.size = obj.limit;
- fetchQuotationList();
- };
-
- // 閫変腑鎶ヤ环鍗曞悗鍥炲~鍒板彴璐﹁〃鍗�
- const applyQuotation = row => {
- if (!row) return;
- selectedQuotation.value = row;
-
- // 涓氬姟鍛�
- form.value.salesman = (row.salesperson || "").trim();
-
- // 瀹㈡埛鍚嶇О -> customerId
- const qCustomerName = String(row.customer || "").trim();
- const customer = (customerOption.value || []).find(c => {
- const name = String(c.customerName || "").trim();
- return (
- name === qCustomerName ||
- name.includes(qCustomerName) ||
- qCustomerName.includes(name)
- );
- });
- if (customer?.id) {
- form.value.customerId = customer.id;
- } else {
- // 濡傛灉鎵句笉鍒帮紝淇濈暀鍘熷�硷紙鍏佽鐢ㄦ埛鎵嬪姩閫夋嫨/涓嶆墦鏂凡鏈夎緭鍏ワ級
- form.value.customerId = form.value.customerId || "";
- }
-
- // 浜у搧淇℃伅鏄犲皠锛氭姤浠� products -> 鍙拌处 productData
- const products = Array.isArray(row.products) ? row.products : [];
- productData.value = products.map(p => {
- const quantity = Number(p.quantity ?? 0) || 0;
- const unitPrice = Number(p.unitPrice ?? 0) || 0;
- const taxRate = "13"; // 榛樿 13%锛屼究浜庣洿鎺ユ彁浜わ紙濡傞渶鍙湪浜у搧涓嚜琛屼慨鏀癸級
- const taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
- const taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(
- taxInclusiveTotalPrice,
- taxRate
- );
- return {
- // 鍙拌处瀛楁
- productCategory: p.product || p.productName || "",
- specificationModel: p.specification || "",
- unit: p.unit || "",
- quantity: quantity,
- taxRate: taxRate,
- taxInclusiveUnitPrice: unitPrice.toFixed(2),
- taxInclusiveTotalPrice: taxInclusiveTotalPrice,
- taxExclusiveTotalPrice: taxExclusiveTotalPrice,
- invoiceType: "澧炴櫘绁�",
- isProduction: true,
- productId: p.productId,
- productModelId: p.productModelId,
- };
- });
-
- quotationDialogVisible.value = false;
- };
-
- function changs(val) {
- console.log(val);
- }
-
- // 鎻愪氦琛ㄥ崟
- const submitForm = () => {
- proxy.$refs["formRef"].validate(valid => {
- if (valid) {
- console.log("productData.value--", productData.value);
- if (productData.value !== null && productData.value.length > 0) {
- form.value.productData = proxy.HaveJson(productData.value);
- } else {
- proxy.$modal.msgWarning("璇锋坊鍔犱骇鍝佷俊鎭�");
- return;
- }
- form.value.storageBlobDTOs = fileList;
- form.value.type = 1;
- if (form.value.autoGenerateContractNo) {
- form.value.salesContractNo = "";
- }
- addOrUpdateSalesLedger(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- expandedRowKeys.value = [];
- getList();
- });
- }
- });
- };
- // 鍏抽棴寮规
- const closeDia = () => {
- proxy.resetForm("formRef");
- dialogFormVisible.value = false;
- };
-
- const productIndex = ref(0);
- // 鎵撳紑浜у搧寮规
- const openProductForm = async (type, row, index) => {
- // 缂栬緫鏃舵鏌ヤ骇鍝佹槸鍚﹀凡鍙戣揣鎴栧鏍搁�氳繃
- if (type === "edit" && isProductShipped(row)) {
- proxy.$modal.msgWarning("宸插彂璐ф垨瀹℃牳閫氳繃鐨勪骇鍝佷笉鑳界紪杈�");
- return;
- }
-
- productOperationType.value = type;
- productForm.value = {};
- if (type === "add") {
- productForm.value.isProduction = true;
- }
- proxy.resetForm("productFormRef");
- if (type === "edit") {
- productForm.value = { ...row };
- productIndex.value = index;
- // 缂栬緫鏃舵牴鎹骇鍝佸ぇ绫诲悕绉板弽鏌� tree 鑺傜偣 id锛屽苟鍔犺浇瑙勬牸鍨嬪彿鍒楄〃
- try {
- const options =
- productOptions.value && productOptions.value.length > 0
- ? productOptions.value
- : await getProductOptions();
- const categoryId = findNodeIdByLabel(
- options,
- productForm.value.productCategory
- );
- if (categoryId) {
- const models = await modelList({ id: categoryId });
- modelOptions.value = models || [];
- // 鏍规嵁褰撳墠瑙勬牸鍨嬪彿鍚嶇О鍙嶆煡骞惰缃� productModelId锛屼究浜庝笅鎷夋鏄剧ず宸查�夊��
- const currentModel = (modelOptions.value || []).find(
- m => m.model === productForm.value.specificationModel
- );
- if (currentModel) {
- productForm.value.productModelId = currentModel.id;
- }
- }
- } catch (e) {
- // 鍔犺浇澶辫触鏃朵繚鎸佸彲缂栬緫锛屼笉涓柇寮圭獥
- console.error("鍔犺浇浜у搧瑙勬牸鍨嬪彿澶辫触", e);
- }
- } else {
- getProductOptions();
- }
- productFormVisible.value = true;
- };
- // 鎻愪氦浜у搧琛ㄥ崟
- const submitProduct = () => {
- proxy.$refs["productFormRef"].validate(valid => {
- if (valid) {
- if (operationType.value === "edit") {
- submitProductEdit();
- } else {
- if (productOperationType.value === "add") {
- productData.value.push({ ...productForm.value });
- } else {
- productData.value[productIndex.value] = { ...productForm.value };
- }
- closeProductDia();
- }
- }
- });
- };
- const submitProductEdit = () => {
- productForm.value.salesLedgerId = currentId.value;
- productForm.value.type = 1;
- addOrUpdateSalesLedgerProduct(productForm.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeProductDia();
- getSalesLedgerWithProducts({ id: currentId.value, type: 1 }).then(res => {
- productData.value = res.productData;
- });
- });
- };
- // 鍒犻櫎浜у搧
- const deleteProduct = () => {
- if (productSelectedRows.value.length === 0) {
- proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
- return;
- }
-
- // 妫�鏌ユ槸鍚︽湁宸插彂璐ф垨瀹℃牳閫氳繃鐨勪骇鍝�
- const shippedProducts = productSelectedRows.value.filter(row =>
- isProductShipped(row)
- );
- if (shippedProducts.length > 0) {
- proxy.$modal.msgWarning("宸插彂璐ф垨瀹℃牳閫氳繃鐨勪骇鍝佷笉鑳藉垹闄�");
- return;
- }
-
- if (operationType.value === "add") {
- productData.value = productData.value.filter(
- item => !productSelectedRows.value.includes(item)
- );
- productSelectedRows.value = [];
- } else {
- let ids = [];
- if (productSelectedRows.value.length > 0) {
- ids = productSelectedRows.value.map(item => item.id);
- }
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- delProduct(ids).then(res => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- closeProductDia();
- getSalesLedgerWithProducts({ id: currentId.value, type: 1 }).then(
- res => {
- productData.value = res.productData;
- }
- );
- });
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
- }
- };
- // 鍏抽棴浜у搧寮规
- const closeProductDia = () => {
- proxy.resetForm("productFormRef");
- productFormVisible.value = false;
- };
- // 瀵煎叆
- const handleImport = () => {
- importUpload.title = "瀵煎叆閿�鍞彴璐�";
- importUpload.open = true;
- if (importUploadRef.value) {
- importUploadRef.value.clearFiles();
- }
- };
-
- // 涓嬭浇瀵煎叆妯℃澘
- const downloadTemplate = () => {
- proxy.download("/sales/ledger/exportTemplate", {}, "閿�鍞彴璐﹀鍏ユā鏉�.xlsx");
- };
-
- // 鎻愪氦瀵煎叆鏂囦欢
- const submitImportFile = () => {
- importUpload.isUploading = true;
- proxy.$refs["importUploadRef"].submit();
- };
-
- // 瀵煎嚭
- const handleOut = () => {
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
+ total.value = res.total;
+ return res;
})
- .then(() => {
- proxy.download("/sales/ledger/export", {}, "閿�鍞彴璐�.xlsx");
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
- };
- /** 鍒ゆ柇鍗曚釜浜у搧鏄惁宸插彂璐э紙鏍规嵁shippingStatus鍒ゆ柇锛屽凡鍙戣揣鎴栧鏍搁�氳繃涓嶅彲缂栬緫鍜屽垹闄わ級 */
- const isProductShipped = product => {
- if (!product) return false;
- const status = String(product.shippingStatus || "").trim();
- // 濡傛灉鍙戣揣鐘舵�佹槸"宸插彂璐�"鎴�"瀹℃牳閫氳繃"锛屽垯涓嶅彲缂栬緫鍜屽垹闄�
- return status === "宸插彂璐�" || status === "瀹℃牳閫氳繃";
- };
-
- /** 鍒ゆ柇閿�鍞鍗曚笅鏄惁瀛樺湪宸插彂璐�/鍙戣揣瀹屾垚鐨勪骇鍝侊紙涓嶅彲鍒犻櫎锛� */
- const hasShippedProducts = products => {
- if (!products || !products.length) return false;
- return products.some(p => {
- const status = String(p.shippingStatus || "").trim();
- // 鏈夊彂璐ф棩鏈熸垨杞︾墝鍙疯涓哄凡鍙戣揣
- if (p.shippingDate || p.shippingCarNumber) return true;
- // 宸茶繘琛屽彂璐с�佸彂璐у畬鎴愩�佸凡鍙戣揣 鍧囦笉鍙垹闄�
- return (
- status === "宸茶繘琛屽彂璐�" || status === "鍙戣揣瀹屾垚" || status === "宸插彂璐�"
- );
+ .catch(() => {
+ tableLoading.value = false;
});
- };
-
- // 鍒犻櫎
- const handleDelete = async () => {
- if (selectedRows.value.length === 0) {
- proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
- return;
- }
- const unauthorizedRows = selectedRows.value.filter(
- row => !canDeleteLedger(row)
+};
+// 鑾峰彇浜у搧澶х被tree鏁版嵁
+const getProductOptions = () => {
+ // 杩斿洖 Promise锛屼究浜庡湪缂栬緫浜у搧鏃剁瓑寰呭姞杞藉畬鎴�
+ return productTreeList().then((res) => {
+ productOptions.value = convertIdToValue(res);
+ return productOptions.value;
+ });
+};
+const formattedNumber = (row, column, cellValue) => {
+ if (cellValue === undefined || cellValue === null || cellValue === "") {
+ return "0.00";
+ }
+ return parseFloat(cellValue).toFixed(2);
+};
+const findLedgerRecordByRow = (row) => {
+ if (!row) return null;
+ if (
+ row.maintainer !== undefined ||
+ row.maintainerName !== undefined ||
+ row.entryPerson !== undefined ||
+ row.entryPersonName !== undefined
+ ) {
+ return row;
+ }
+ if (row.salesLedgerId !== undefined && row.salesLedgerId !== null) {
+ return (
+ tableData.value.find(
+ (item) => String(item.id) === String(row.salesLedgerId)
+ ) || null
);
- if (unauthorizedRows.length > 0) {
- proxy.$modal.msgWarning("褰撳墠鐧诲綍鐢ㄦ埛涓嶆槸褰曞叆浜猴紝涓嶈兘鍒犻櫎璇ユ暟鎹�");
- return;
+ }
+ return null;
+};
+const isCurrentUserMaintainer = (row) => {
+ const ledgerRecord = findLedgerRecordByRow(row);
+ if (!ledgerRecord) return true;
+ const currentUserId = String(userStore.id ?? "");
+ const currentNickName = String(userStore.nickName ?? "").trim();
+ const maintainerId = ledgerRecord.maintainerId ?? ledgerRecord.entryPerson;
+ const maintainerName =
+ ledgerRecord.maintainerName ??
+ ledgerRecord.maintainer ??
+ ledgerRecord.entryPersonName;
+ if (
+ maintainerId !== undefined &&
+ maintainerId !== null &&
+ String(maintainerId) !== ""
+ ) {
+ return String(maintainerId) === currentUserId;
+ }
+ if (
+ maintainerName !== undefined &&
+ maintainerName !== null &&
+ String(maintainerName).trim() !== ""
+ ) {
+ return String(maintainerName).trim() === currentNickName;
+ }
+ return true;
+};
+const canEditLedger = (row) => isCurrentUserMaintainer(row);
+const canDeleteLedger = (row) => isCurrentUserMaintainer(row);
+const sensitiveAmountFormatter = (row, column, cellValue) => {
+ if (!isCurrentUserMaintainer(row)) {
+ return "*****";
+ }
+ return formattedNumber(row, column, cellValue);
+};
+// 鑾峰彇tree瀛愭暟鎹�
+const getModels = (value) => {
+ productForm.value.productCategory = findNodeById(productOptions.value, value);
+ modelList({ id: value }).then((res) => {
+ modelOptions.value = res;
+ });
+};
+const getProductModel = (value) => {
+ const index = modelOptions.value.findIndex((item) => item.id === value);
+ if (index !== -1) {
+ productForm.value.specificationModel = modelOptions.value[index].model;
+ productForm.value.unit = modelOptions.value[index].unit;
+ } else {
+ productForm.value.specificationModel = null;
+ productForm.value.unit = null;
+ }
+};
+const findNodeById = (nodes, productId) => {
+ for (let i = 0; i < nodes.length; i++) {
+ if (nodes[i].value === productId) {
+ return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
}
- const ids = selectedRows.value.map(item => item.id);
+ if (nodes[i].children && nodes[i].children.length > 0) {
+ const foundNode = findNodeById(nodes[i].children, productId);
+ if (foundNode) {
+ return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ }
+ }
+ }
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+};
- // 妫�鏌ユ槸鍚︽湁宸茶繘琛屽彂璐ф垨鍙戣揣瀹屾垚鐨勯攢鍞鍗曪紝鑻ユ湁鍒欎笉鍏佽鍒犻櫎
- const cannotDeleteNames = [];
- for (const row of selectedRows.value) {
- let products =
- row.children && row.children.length > 0 ? row.children : null;
- if (!products) {
- try {
- const res = await productList({ salesLedgerId: row.id, type: 1 });
- products = res.data || [];
- } catch {
- products = [];
+function convertIdToValue(data) {
+ return data.map((item) => {
+ const { id, children, ...rest } = item;
+ const newItem = {
+ ...rest,
+ value: id, // 灏� id 鏀逛负 value
+ };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
+ }
+
+ return newItem;
+ });
+}
+
+// 鏍规嵁鍚嶇О鍙嶆煡浜у搧澶х被 id锛屼究浜庝粎瀛樺悕绉版椂鐨勫弽鏄�
+function findNodeIdByLabel(nodes, label) {
+ if (!label) return null;
+ for (let i = 0; i < nodes.length; i++) {
+ const node = nodes[i];
+ if (node.label === label) return node.value;
+ if (node.children && node.children.length > 0) {
+ const found = findNodeIdByLabel(node.children, label);
+ if (found !== null && found !== undefined) return found;
+ }
+ }
+ return null;
+}
+
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+ // 杩囨护鎺夊瓙鏁版嵁
+ selectedRows.value = selection.filter((item) => item.children !== undefined);
+ console.log("selection", selectedRows.value);
+};
+const productSelected = (selectedRows) => {
+ productSelectedRows.value = selectedRows;
+};
+const expandedRowKeys = ref([]);
+// 灞曞紑琛�
+const expandChange = (row, expandedRows) => {
+ if (expandedRows.length > 0) {
+ expandedRowKeys.value = [];
+ try {
+ productList({ salesLedgerId: row.id, type: 1 }).then((res) => {
+ const index = tableData.value.findIndex((item) => item.id === row.id);
+ if (index > -1) {
+ tableData.value[index].children = res.data;
+ }
+ expandedRowKeys.value.push(row.id);
+ });
+ } catch (error) {
+ console.log(error);
+ }
+ } else {
+ expandedRowKeys.value = [];
+ }
+};
+
+// 娣诲姞琛ㄨ绫诲悕鏂规硶
+const tableRowClassName = ({ row }) => {
+ if (!row.deliveryDate) return "";
+ if (row.isFh) return "";
+
+ const diff = row.deliveryDaysDiff;
+ if (diff === 15) {
+ return "yellow";
+ } else if (diff === 10) {
+ return "pink";
+ } else if (diff === 2) {
+ return "purple";
+ } else if (diff < 2) {
+ return "red";
+ }
+};
+// 涓昏〃鍚堣鏂规硶
+const summarizeMainTable = (param) => {
+ return proxy.summarizeTable(param, [
+ "contractAmount",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ ]);
+};
+// 瀛愯〃鍚堣鏂规硶
+const summarizeChildrenTable = (param, parentRow) => {
+ if (!isCurrentUserMaintainer(parentRow)) {
+ const { columns } = param;
+ return columns.map((column, index) => {
+ if (index === 0) {
+ return "鍚堣";
+ }
+ if (
+ [
+ "taxInclusiveUnitPrice",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ ].includes(column.property)
+ ) {
+ return "*****";
+ }
+ return "";
+ });
+ }
+ return proxy.summarizeTable(param, [
+ "taxInclusiveUnitPrice",
+ "taxInclusiveTotalPrice",
+ "taxExclusiveTotalPrice",
+ ]);
+};
+// 鎵撳紑寮规
+const openForm = async (type, row) => {
+ if (type === "edit" && row && !canEditLedger(row)) {
+ proxy.$modal.msgWarning("褰撳墠绯荤粺鐧诲綍浜轰笉鏄淮鎶や汉锛屼笉鑳界紪杈戞暟鎹�");
+ return;
+ }
+ operationType.value = type;
+ form.value = {};
+ productData.value = [];
+ selectedQuotation.value = null;
+ let userLists = await userListNoPage();
+ userList.value = userLists.data;
+ listCustomer({ current: -1, size: -1, type: 0 }).then((res) => {
+ customerOption.value = res.data.records;
+ });
+ form.value.entryPerson = userStore.id;
+ if (type === "add") {
+ // 鏂板鏃惰缃綍鍏ユ棩鏈熶负褰撳ぉ
+ form.value.entryDate = getCurrentDate();
+ // 绛捐鏃ユ湡榛樿涓哄綋澶�
+ form.value.executionDate = getCurrentDate();
+ // 鍒涘缓鏃堕棿榛樿涓哄綋澶�
+ form.value.createTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
+ // 榛樿鑷姩鐢熸垚閿�鍞悎鍚屽彿
+ form.value.autoGenerateContractNo = true;
+ } else {
+ currentId.value = row.id;
+ getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => {
+ form.value = { ...res };
+ form.value.entryPerson = Number(res.entryPerson);
+ productData.value = form.value.productData;
+ fileList.value = form.value.storageBlobVOs;
+ // 缂栬緫鏃惰缃嚜鍔ㄧ敓鎴愪负false锛屽厑璁告墜鍔ㄤ慨鏀�
+ form.value.autoGenerateContractNo = false;
+ });
+ }
+ // let userAll = await userStore.getInfo()
+ // userList.value.forEach(element => {
+ // if(userAll.user.nickName === element.nickName && userAll.user.userName === element.userName) {
+ // form.value.entryPerson = userAll.user.userId // 璁剧疆榛樿涓氬姟鍛樹负褰撳墠鐢ㄦ埛
+ // }
+ // });
+ form.value.entryDate = getCurrentDate(); // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈�
+ dialogFormVisible.value = true;
+};
+
+// 鎵撳紑鎶ヤ环鍗曢�夋嫨寮圭獥锛堜粎瀹℃壒閫氳繃锛�
+const openQuotationDialog = async () => {
+ if (operationType.value === "view") return;
+ quotationDialogVisible.value = true;
+ // 鎵撳紑寮圭獥鏃堕噸缃垎椤靛埌绗竴椤�
+ quotationPage.current = 1;
+ // 鍏堢‘淇濆鎴峰垪琛ㄥ凡鍔犺浇锛屼究浜庡悗缁洖濉� customerId
+ if (!customerOption.value || customerOption.value.length === 0) {
+ try {
+ listCustomer({ current: -1, size: -1 }).then((res) => {
+ customerOption.value = res.data.records;
+ });
+ } catch (e) {
+ // ignore锛屽厑璁哥敤鎴峰悗缁墜鍔ㄩ�夋嫨瀹㈡埛
+ }
+ }
+ await fetchQuotationList();
+};
+
+const fetchQuotationList = async () => {
+ quotationLoading.value = true;
+ try {
+ const params = {
+ // 鍚庣鍒嗛〉瀛楁锛歝urrent / size
+ current: quotationPage.current,
+ size: quotationPage.size,
+ ...quotationSearchForm,
+ status: "閫氳繃",
+ };
+ const res = await getQuotationList(params);
+ quotationList.value = res?.data?.records || [];
+ quotationPage.total = res?.data?.total || 0;
+ } finally {
+ quotationLoading.value = false;
+ }
+};
+
+const resetQuotationSearch = async () => {
+ quotationSearchForm.quotationNo = "";
+ quotationSearchForm.customer = "";
+ quotationPage.current = 1;
+ await fetchQuotationList();
+};
+
+// 鎶ヤ环鍗曞脊妗嗗垎椤靛垏鎹�
+const quotationPaginationChange = (obj) => {
+ quotationPage.current = obj.page;
+ quotationPage.size = obj.limit;
+ fetchQuotationList();
+};
+
+// 閫変腑鎶ヤ环鍗曞悗鍥炲~鍒板彴璐﹁〃鍗�
+const applyQuotation = (row) => {
+ if (!row) return;
+ selectedQuotation.value = row;
+
+ // 涓氬姟鍛�
+ form.value.salesman = (row.salesperson || "").trim();
+
+ // 瀹㈡埛鍚嶇О -> customerId
+ const qCustomerName = String(row.customer || "").trim();
+ const customer = (customerOption.value || []).find((c) => {
+ const name = String(c.customerName || "").trim();
+ return (
+ name === qCustomerName ||
+ name.includes(qCustomerName) ||
+ qCustomerName.includes(name)
+ );
+ });
+ if (customer?.id) {
+ form.value.customerId = customer.id;
+ } else {
+ // 濡傛灉鎵句笉鍒帮紝淇濈暀鍘熷�硷紙鍏佽鐢ㄦ埛鎵嬪姩閫夋嫨/涓嶆墦鏂凡鏈夎緭鍏ワ級
+ form.value.customerId = form.value.customerId || "";
+ }
+
+ // 浜у搧淇℃伅鏄犲皠锛氭姤浠� products -> 鍙拌处 productData
+ const products = Array.isArray(row.products) ? row.products : [];
+ productData.value = products.map((p) => {
+ const quantity = Number(p.quantity ?? 0) || 0;
+ const unitPrice = Number(p.unitPrice ?? 0) || 0;
+ const taxRate = "13"; // 榛樿 13%锛屼究浜庣洿鎺ユ彁浜わ紙濡傞渶鍙湪浜у搧涓嚜琛屼慨鏀癸級
+ const taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
+ const taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(
+ taxInclusiveTotalPrice,
+ taxRate
+ );
+ return {
+ // 鍙拌处瀛楁
+ productCategory: p.product || p.productName || "",
+ specificationModel: p.specification || "",
+ unit: p.unit || "",
+ quantity: quantity,
+ taxRate: taxRate,
+ taxInclusiveUnitPrice: unitPrice.toFixed(2),
+ taxInclusiveTotalPrice: taxInclusiveTotalPrice,
+ taxExclusiveTotalPrice: taxExclusiveTotalPrice,
+ invoiceType: "澧炴櫘绁�",
+ isProduction: true,
+ productId: p.productId,
+ productModelId: p.productModelId,
+ };
+ });
+
+ quotationDialogVisible.value = false;
+};
+
+function changs(val) {
+ console.log(val);
+}
+
+// 鎻愪氦琛ㄥ崟
+const submitForm = () => {
+ proxy.$refs["formRef"].validate((valid) => {
+ if (valid) {
+ console.log("productData.value--", productData.value);
+ if (productData.value !== null && productData.value.length > 0) {
+ form.value.productData = proxy.HaveJson(productData.value);
+ } else {
+ proxy.$modal.msgWarning("璇锋坊鍔犱骇鍝佷俊鎭�");
+ return;
+ }
+ form.value.storageBlobDTOs = fileList;
+ form.value.type = 1;
+ if (form.value.autoGenerateContractNo) {
+ form.value.salesContractNo = "";
+ }
+ addOrUpdateSalesLedger(form.value).then((res) => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ expandedRowKeys.value = [];
+ getList();
+ });
+ }
+ });
+};
+// 鍏抽棴寮规
+const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+};
+
+const productIndex = ref(0);
+// 鎵撳紑浜у搧寮规
+const openProductForm = async (type, row, index) => {
+ // 缂栬緫鏃舵鏌ヤ骇鍝佹槸鍚﹀凡鍙戣揣鎴栧鏍搁�氳繃
+ if (type === "edit" && isProductShipped(row)) {
+ proxy.$modal.msgWarning("宸插彂璐ф垨瀹℃牳閫氳繃鐨勪骇鍝佷笉鑳界紪杈�");
+ return;
+ }
+
+ productOperationType.value = type;
+ productForm.value = {};
+ if (type === "add") {
+ productForm.value.isProduction = true;
+ }
+ proxy.resetForm("productFormRef");
+ if (type === "edit") {
+ productForm.value = { ...row };
+ productIndex.value = index;
+ // 缂栬緫鏃舵牴鎹骇鍝佸ぇ绫诲悕绉板弽鏌� tree 鑺傜偣 id锛屽苟鍔犺浇瑙勬牸鍨嬪彿鍒楄〃
+ try {
+ const options =
+ productOptions.value && productOptions.value.length > 0
+ ? productOptions.value
+ : await getProductOptions();
+ const categoryId = findNodeIdByLabel(
+ options,
+ productForm.value.productCategory
+ );
+ if (categoryId) {
+ const models = await modelList({ id: categoryId });
+ modelOptions.value = models || [];
+ // 鏍规嵁褰撳墠瑙勬牸鍨嬪彿鍚嶇О鍙嶆煡骞惰缃� productModelId锛屼究浜庝笅鎷夋鏄剧ず宸查�夊��
+ const currentModel = (modelOptions.value || []).find(
+ (m) => m.model === productForm.value.specificationModel
+ );
+ if (currentModel) {
+ productForm.value.productModelId = currentModel.id;
}
}
- if (hasShippedProducts(products)) {
- cannotDeleteNames.push(row.salesContractNo || `ID:${row.id}`);
+ } catch (e) {
+ // 鍔犺浇澶辫触鏃朵繚鎸佸彲缂栬緫锛屼笉涓柇寮圭獥
+ console.error("鍔犺浇浜у搧瑙勬牸鍨嬪彿澶辫触", e);
+ }
+ } else {
+ getProductOptions();
+ }
+ productFormVisible.value = true;
+};
+// 鎻愪氦浜у搧琛ㄥ崟
+const submitProduct = () => {
+ proxy.$refs["productFormRef"].validate((valid) => {
+ if (valid) {
+ if (operationType.value === "edit") {
+ submitProductEdit();
+ } else {
+ if (productOperationType.value === "add") {
+ productData.value.push({ ...productForm.value });
+ } else {
+ productData.value[productIndex.value] = { ...productForm.value };
+ }
+ closeProductDia();
}
}
- if (cannotDeleteNames.length > 0) {
- proxy.$modal.msgWarning(
- "宸茶繘琛屽彂璐ф垨鍙戣揣瀹屾垚鐨勯攢鍞鍗曚笉鑳藉垹闄わ細" + cannotDeleteNames.join("銆�")
- );
- return;
- }
+ });
+};
+const submitProductEdit = () => {
+ productForm.value.salesLedgerId = currentId.value;
+ productForm.value.type = 1;
+ addOrUpdateSalesLedgerProduct(productForm.value).then((res) => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeProductDia();
+ getSalesLedgerWithProducts({ id: currentId.value, type: 1 }).then((res) => {
+ productData.value = res.productData;
+ });
+ });
+};
+// 鍒犻櫎浜у搧
+const deleteProduct = () => {
+ if (productSelectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ // 妫�鏌ユ槸鍚︽湁宸插彂璐ф垨瀹℃牳閫氳繃鐨勪骇鍝�
+ const shippedProducts = productSelectedRows.value.filter((row) =>
+ isProductShipped(row)
+ );
+ if (shippedProducts.length > 0) {
+ proxy.$modal.msgWarning("宸插彂璐ф垨瀹℃牳閫氳繃鐨勪骇鍝佷笉鑳藉垹闄�");
+ return;
+ }
+
+ if (operationType.value === "add") {
+ productData.value = productData.value.filter(
+ (item) => !productSelectedRows.value.includes(item)
+ );
+ productSelectedRows.value = [];
+ } else {
+ let ids = [];
+ if (productSelectedRows.value.length > 0) {
+ ids = productSelectedRows.value.map((item) => item.id);
+ }
ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
confirmButtonText: "纭",
cancelButtonText: "鍙栨秷",
type: "warning",
})
.then(() => {
- delLedger(ids).then(res => {
+ delProduct(ids).then((res) => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
+ closeProductDia();
+ getSalesLedgerWithProducts({ id: currentId.value, type: 1 }).then(
+ (res) => {
+ productData.value = res.productData;
+ }
+ );
});
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
- };
+ }
+};
+// 鍏抽棴浜у搧寮规
+const closeProductDia = () => {
+ proxy.resetForm("productFormRef");
+ productFormVisible.value = false;
+};
+// 瀵煎叆
+const handleImport = () => {
+ importUpload.title = "瀵煎叆閿�鍞彴璐�";
+ importUpload.open = true;
+ if (importUploadRef.value) {
+ importUploadRef.value.clearFiles();
+ }
+};
- // 鎵撳嵃鍔熻兘
- const handlePrint = async () => {
- if (selectedRows.value.length === 0) {
- proxy.$modal.msgWarning("璇烽�夋嫨瑕佹墦鍗扮殑鏁版嵁");
- return;
- }
+// 涓嬭浇瀵煎叆妯℃澘
+const downloadTemplate = () => {
+ proxy.download("/sales/ledger/exportTemplate", {}, "閿�鍞彴璐﹀鍏ユā鏉�.xlsx");
+};
- // 鏄剧ず鍔犺浇鐘舵��
- proxy.$modal.loading("姝e湪鑾峰彇浜у搧鏁版嵁锛岃绋嶅��...");
+// 鎻愪氦瀵煎叆鏂囦欢
+const submitImportFile = () => {
+ importUpload.isUploading = true;
+ proxy.$refs["importUploadRef"].submit();
+};
- try {
- // 涓烘瘡涓�変腑鐨勯攢鍞彴璐﹁褰曟煡璇㈠搴旂殑浜у搧鏁版嵁
- const printDataWithProducts = [];
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/sales/ledger/export", {}, "閿�鍞彴璐�.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+/** 鍒ゆ柇鍗曚釜浜у搧鏄惁宸插彂璐э紙鏍规嵁shippingStatus鍒ゆ柇锛屽凡鍙戣揣鎴栧鏍搁�氳繃涓嶅彲缂栬緫鍜屽垹闄わ級 */
+const isProductShipped = (product) => {
+ if (!product) return false;
+ const status = String(product.shippingStatus || "").trim();
+ // 濡傛灉鍙戣揣鐘舵�佹槸"宸插彂璐�"鎴�"瀹℃牳閫氳繃"锛屽垯涓嶅彲缂栬緫鍜屽垹闄�
+ return status === "宸插彂璐�" || status === "瀹℃牳閫氳繃";
+};
- for (const row of selectedRows.value) {
- try {
- // 璋冪敤productList鎺ュ彛鏌ヨ浜у搧鏁版嵁
- const productRes = await productList({
- salesLedgerId: row.id,
- type: 1,
- });
+/** 鍒ゆ柇閿�鍞鍗曚笅鏄惁瀛樺湪宸插彂璐�/鍙戣揣瀹屾垚鐨勪骇鍝侊紙涓嶅彲鍒犻櫎锛� */
+const hasShippedProducts = (products) => {
+ if (!products || !products.length) return false;
+ return products.some((p) => {
+ const status = String(p.shippingStatus || "").trim();
+ // 鏈夊彂璐ф棩鏈熸垨杞︾墝鍙疯涓哄凡鍙戣揣
+ if (p.shippingDate || p.shippingCarNumber) return true;
+ // 宸茶繘琛屽彂璐с�佸彂璐у畬鎴愩�佸凡鍙戣揣 鍧囦笉鍙垹闄�
+ return (
+ status === "宸茶繘琛屽彂璐�" || status === "鍙戣揣瀹屾垚" || status === "宸插彂璐�"
+ );
+ });
+};
- // 灏嗕骇鍝佹暟鎹暣鍚堝埌閿�鍞彴璐﹁褰曚腑
- const rowWithProducts = {
- ...row,
- products: productRes.data || [],
- };
+// 鍒犻櫎
+const handleDelete = async () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const unauthorizedRows = selectedRows.value.filter(
+ (row) => !canDeleteLedger(row)
+ );
+ if (unauthorizedRows.length > 0) {
+ proxy.$modal.msgWarning("褰撳墠鐧诲綍鐢ㄦ埛涓嶆槸褰曞叆浜猴紝涓嶈兘鍒犻櫎璇ユ暟鎹�");
+ return;
+ }
+ const ids = selectedRows.value.map((item) => item.id);
- printDataWithProducts.push(rowWithProducts);
- } catch (error) {
- console.error(`鑾峰彇閿�鍞彴璐� ${row.id} 鐨勪骇鍝佹暟鎹け璐�:`, error);
- // 鍗充娇鏌愪釜璁板綍鐨勪骇鍝佹暟鎹幏鍙栧け璐ワ紝涔熻鍖呭惈璇ヨ褰�
- printDataWithProducts.push({
- ...row,
- products: [],
- });
- }
+ // 妫�鏌ユ槸鍚︽湁宸茶繘琛屽彂璐ф垨鍙戣揣瀹屾垚鐨勯攢鍞鍗曪紝鑻ユ湁鍒欎笉鍏佽鍒犻櫎
+ const cannotDeleteNames = [];
+ for (const row of selectedRows.value) {
+ let products =
+ row.children && row.children.length > 0 ? row.children : null;
+ if (!products) {
+ try {
+ const res = await productList({ salesLedgerId: row.id, type: 1 });
+ products = res.data || [];
+ } catch {
+ products = [];
}
-
- printData.value = printDataWithProducts;
- console.log("鎵撳嵃鏁版嵁锛堝寘鍚骇鍝侊級:", printData.value);
- printPreviewVisible.value = true;
- } catch (error) {
- console.error("鑾峰彇浜у搧鏁版嵁澶辫触:", error);
- proxy.$modal.msgError("鑾峰彇浜у搧鏁版嵁澶辫触锛岃閲嶈瘯");
- } finally {
- proxy.$modal.closeLoading();
}
- };
- // 鎵ц鎵撳嵃
- const executePrint = () => {
- console.log("寮�濮嬫墽琛屾墦鍗帮紝鏁版嵁鏉℃暟:", printData.value.length);
- console.log("鎵撳嵃鏁版嵁:", printData.value);
+ if (hasShippedProducts(products)) {
+ cannotDeleteNames.push(row.salesContractNo || `ID:${row.id}`);
+ }
+ }
+ if (cannotDeleteNames.length > 0) {
+ proxy.$modal.msgWarning(
+ "宸茶繘琛屽彂璐ф垨鍙戣揣瀹屾垚鐨勯攢鍞鍗曚笉鑳藉垹闄わ細" + cannotDeleteNames.join("銆�")
+ );
+ return;
+ }
- // 鍒涘缓涓�涓柊鐨勬墦鍗扮獥鍙�
- const printWindow = window.open("", "_blank", "width=800,height=600");
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ delLedger(ids).then((res) => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
- // 鏋勫缓鎵撳嵃鍐呭
- let printContent = `
+// 鎵撳嵃鍔熻兘
+ const handlePrint = async () => {
+ if (selectedRows.value.length === 0) {
+ proxy.$modal.msgWarning("璇烽�夋嫨瑕佹墦鍗扮殑鏁版嵁");
+ return;
+ }
+
+ // 鏄剧ず鍔犺浇鐘舵��
+ proxy.$modal.loading("姝e湪鑾峰彇浜у搧鏁版嵁锛岃绋嶅��...");
+
+ try {
+ // 涓烘瘡涓�変腑鐨勯攢鍞彴璐﹁褰曟煡璇㈠搴旂殑浜у搧鏁版嵁
+ const printDataWithProducts = [];
+
+ for (const row of selectedRows.value) {
+ try {
+ // 璋冪敤productList鎺ュ彛鏌ヨ浜у搧鏁版嵁
+ const productRes = await productList({
+ salesLedgerId: row.id,
+ type: 1,
+ });
+
+ // 灏嗕骇鍝佹暟鎹暣鍚堝埌閿�鍞彴璐﹁褰曚腑
+ const rowWithProducts = {
+ ...row,
+ products: productRes.data || [],
+ };
+
+ printDataWithProducts.push(rowWithProducts);
+ } catch (error) {
+ console.error(`鑾峰彇閿�鍞彴璐� ${row.id} 鐨勪骇鍝佹暟鎹け璐�:`, error);
+ // 鍗充娇鏌愪釜璁板綍鐨勪骇鍝佹暟鎹幏鍙栧け璐ワ紝涔熻鍖呭惈璇ヨ褰�
+ printDataWithProducts.push({
+ ...row,
+ products: [],
+ });
+ }
+ }
+
+ printData.value = printDataWithProducts;
+ console.log("鎵撳嵃鏁版嵁锛堝寘鍚骇鍝侊級:", printData.value);
+ printPreviewVisible.value = true;
+ } catch (error) {
+ console.error("鑾峰彇浜у搧鏁版嵁澶辫触:", error);
+ proxy.$modal.msgError("鑾峰彇浜у搧鏁版嵁澶辫触锛岃閲嶈瘯");
+ } finally {
+ proxy.$modal.closeLoading();
+ }
+};
+// 鎵ц鎵撳嵃
+const executePrint = () => {
+ console.log("寮�濮嬫墽琛屾墦鍗帮紝鏁版嵁鏉℃暟:", printData.value.length);
+ console.log("鎵撳嵃鏁版嵁:", printData.value);
+
+ // 鍒涘缓涓�涓柊鐨勬墦鍗扮獥鍙�
+ const printWindow = window.open("", "_blank", "width=800,height=600");
+
+ // 鏋勫缓鎵撳嵃鍐呭
+ let printContent = `
<!DOCTYPE html>
<html>
<head>
@@ -2214,9 +2347,9 @@
<body>
`;
- // 涓烘瘡鏉℃暟鎹敓鎴愭墦鍗伴〉闈�
- printData.value.forEach((item, index) => {
- printContent += `
+ // 涓烘瘡鏉℃暟鎹敓鎴愭墦鍗伴〉闈�
+ printData.value.forEach((item, index) => {
+ printContent += `
<div class="print-page">
<div class="delivery-note">
<div class="header">
@@ -2268,7 +2401,9 @@
0
? item.products
.map(
- product => `
+ (
+ product
+ ) => `
<tr>
<td>${
product.productCategory ||
@@ -2354,694 +2489,690 @@
</div>
</div>
`;
- });
+ });
- printContent += `
+ printContent += `
</body>
</html>
`;
- // 鍐欏叆鍐呭鍒版柊绐楀彛
- printWindow.document.write(printContent);
- printWindow.document.close();
+ // 鍐欏叆鍐呭鍒版柊绐楀彛
+ printWindow.document.write(printContent);
+ printWindow.document.close();
- // 绛夊緟鍐呭鍔犺浇瀹屾垚鍚庢墦鍗�
- printWindow.onload = () => {
- setTimeout(() => {
- printWindow.print();
- printWindow.close();
- printPreviewVisible.value = false;
- }, 500);
- };
+ // 绛夊緟鍐呭鍔犺浇瀹屾垚鍚庢墦鍗�
+ 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}`;
- };
- // 璁$畻浜у搧鎬绘暟閲�
- const getTotalQuantity = products => {
- if (!products || products.length === 0) return "0";
- const total = products.reduce((sum, product) => {
- return sum + (parseFloat(product.quantity) || 0);
- }, 0);
- return total.toFixed(2);
- };
+};
+// 鏍煎紡鍖栨棩鏈�
+const formatDate = (dateString) => {
+ if (!dateString) return getCurrentDate();
+ return dayjs(dateString).format("YYYY/MM/DD HH:mm:ss");
+};
+// 鏍煎紡鍖栨棩鏈熸椂闂�
+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}`;
+};
+// 璁$畻浜у搧鎬绘暟閲�
+const getTotalQuantity = (products) => {
+ if (!products || products.length === 0) return "0";
+ const total = products.reduce((sum, product) => {
+ return sum + (parseFloat(product.quantity) || 0);
+ }, 0);
+ return total.toFixed(2);
+};
- // 璁$畻浜у搧鎬婚噾棰�
- const getTotalAmount = products => {
- if (!products || products.length === 0) return "0";
- const total = products.reduce((sum, product) => {
- return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
- }, 0);
- return total.toFixed(2);
- };
+// 璁$畻浜у搧鎬婚噾棰�
+const getTotalAmount = (products) => {
+ if (!products || products.length === 0) return "0";
+ const total = products.reduce((sum, product) => {
+ return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
+ }, 0);
+ return total.toFixed(2);
+};
- // 鐢ㄤ簬鎵撳嵃鐨勮绠楀嚱鏁�
- const getTotalQuantityForPrint = products => {
- if (!products || products.length === 0) return "0";
- const total = products.reduce((sum, product) => {
- return sum + (parseFloat(product.quantity) || 0);
- }, 0);
- return total.toFixed(2);
- };
+// 鐢ㄤ簬鎵撳嵃鐨勮绠楀嚱鏁�
+const getTotalQuantityForPrint = (products) => {
+ if (!products || products.length === 0) return "0";
+ const total = products.reduce((sum, product) => {
+ return sum + (parseFloat(product.quantity) || 0);
+ }, 0);
+ return total.toFixed(2);
+};
- const getTotalAmountForPrint = products => {
- if (!products || products.length === 0) return "0";
- const total = products.reduce((sum, product) => {
- return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
- }, 0);
- return total.toFixed(2);
- };
+const getTotalAmountForPrint = (products) => {
+ if (!products || products.length === 0) return "0";
+ const total = products.reduce((sum, product) => {
+ return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
+ }, 0);
+ return total.toFixed(2);
+};
- const mathNum = () => {
- console.log("productForm.value", productForm.value);
- if (!productForm.value.taxInclusiveUnitPrice) {
- return;
- }
- if (!productForm.value.quantity) {
- return;
- }
- // 鍚◣鎬讳环璁$畻
- productForm.value.taxInclusiveTotalPrice =
- proxy.calculateTaxIncludeTotalPrice(
- productForm.value.taxInclusiveUnitPrice,
- productForm.value.quantity
- );
- if (productForm.value.taxRate) {
- // 涓嶅惈绋庢�讳环璁$畻
- productForm.value.taxExclusiveTotalPrice =
- proxy.calculateTaxExclusiveTotalPrice(
- productForm.value.taxInclusiveTotalPrice,
- productForm.value.taxRate
- );
- }
- };
-
- // 鏍规嵁鍚◣鎬讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
- const calculateFromTotalPrice = () => {
- if (isCalculating.value) return;
-
- const totalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice);
- const quantity = parseFloat(productForm.value.quantity);
-
- if (!totalPrice || !quantity || quantity <= 0) {
- return;
- }
-
- isCalculating.value = true;
-
- // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
- productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
-
- // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
- if (productForm.value.taxRate) {
- productForm.value.taxExclusiveTotalPrice =
- proxy.calculateTaxExclusiveTotalPrice(
- totalPrice,
- productForm.value.taxRate
- );
- }
-
- isCalculating.value = false;
- };
-
- // 鏍规嵁涓嶅惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
- const calculateFromExclusiveTotalPrice = () => {
- if (!productForm.value.taxRate) {
- proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
- return;
- }
- if (isCalculating.value) return;
-
- const exclusiveTotalPrice = parseFloat(
- productForm.value.taxExclusiveTotalPrice
+const mathNum = () => {
+ console.log("productForm.value", productForm.value);
+ if (!productForm.value.taxInclusiveUnitPrice) {
+ return;
+ }
+ if (!productForm.value.quantity) {
+ return;
+ }
+ // 鍚◣鎬讳环璁$畻
+ productForm.value.taxInclusiveTotalPrice =
+ proxy.calculateTaxIncludeTotalPrice(
+ productForm.value.taxInclusiveUnitPrice,
+ productForm.value.quantity
);
- const quantity = parseFloat(productForm.value.quantity);
- const taxRate = parseFloat(productForm.value.taxRate);
-
- if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) {
- return;
- }
-
- isCalculating.value = true;
-
- // 鍏堣绠楀惈绋庢�讳环 = 涓嶅惈绋庢�讳环 / (1 - 绋庣巼/100)
- const taxRateDecimal = taxRate / 100;
- const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
- productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
-
- // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
- productForm.value.taxInclusiveUnitPrice = (
- inclusiveTotalPrice / quantity
- ).toFixed(2);
-
- isCalculating.value = false;
- };
-
- // 鏍规嵁鏁伴噺鍙樺寲璁$畻鎬讳环
- const calculateFromQuantity = () => {
- if (!productForm.value.taxRate) {
- proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
- return;
- }
- if (isCalculating.value) return;
-
- const quantity = parseFloat(productForm.value.quantity);
- const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
-
- if (!quantity || quantity <= 0 || !unitPrice) {
- return;
- }
-
- isCalculating.value = true;
-
- // 璁$畻鍚◣鎬讳环
- productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
-
- // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
- if (productForm.value.taxRate) {
- productForm.value.taxExclusiveTotalPrice =
- proxy.calculateTaxExclusiveTotalPrice(
- productForm.value.taxInclusiveTotalPrice,
- productForm.value.taxRate
- );
- }
-
- isCalculating.value = false;
- };
-
- // 鏍规嵁鍚◣鍗曚环鍙樺寲璁$畻鎬讳环
- const calculateFromUnitPrice = () => {
- if (!productForm.value.taxRate) {
- proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
- return;
- }
- if (isCalculating.value) return;
-
- const quantity = parseFloat(productForm.value.quantity);
- const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
-
- if (!quantity || quantity <= 0 || !unitPrice) {
- return;
- }
-
- isCalculating.value = true;
-
- // 璁$畻鍚◣鎬讳环
- productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
-
- // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
- if (productForm.value.taxRate) {
- productForm.value.taxExclusiveTotalPrice =
- proxy.calculateTaxExclusiveTotalPrice(
- productForm.value.taxInclusiveTotalPrice,
- productForm.value.taxRate
- );
- }
-
- isCalculating.value = false;
- };
-
- // 鏍规嵁绋庣巼鍙樺寲璁$畻涓嶅惈绋庢�讳环
- const calculateFromTaxRate = () => {
- if (!productForm.value.taxRate) {
- proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
- return;
- }
- if (isCalculating.value) return;
-
- const inclusiveTotalPrice = parseFloat(
- productForm.value.taxInclusiveTotalPrice
- );
- const taxRate = parseFloat(productForm.value.taxRate);
-
- if (!inclusiveTotalPrice || !taxRate) {
- return;
- }
-
- isCalculating.value = true;
-
- // 璁$畻涓嶅惈绋庢�讳环
+ if (productForm.value.taxRate) {
+ // 涓嶅惈绋庢�讳环璁$畻
productForm.value.taxExclusiveTotalPrice =
- proxy.calculateTaxExclusiveTotalPrice(inclusiveTotalPrice, taxRate);
-
- isCalculating.value = false;
- };
- /**
- * 鑾峰彇鍙戣揣鐘舵�佹枃鏈�
- * @param row 琛屾暟鎹�
- */
- const getShippingStatusText = row => {
- // 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屾樉绀�"宸插彂璐�"
- // if (row.shippingDate || row.shippingCarNumber) {
- // return "宸插彂璐�";
- // }
-
- // 鑾峰彇鍙戣揣鐘舵�佸瓧娈�
- const status = row.shippingStatus;
-
- // 濡傛灉鐘舵�佷负绌烘垨鏈畾涔夛紝榛樿涓�"寰呭彂璐�"
- if (status === null || status === undefined || status === "") {
- return "寰呭彂璐�";
- }
-
- // 鐘舵�佹槸瀛楃涓�
- const statusStr = String(status).trim();
- const statusTextMap = {
- 寰呭彂璐�: "寰呭彂璐�",
- 寰呭鏍�: "寰呭鏍�",
- 瀹℃牳涓�: "瀹℃牳涓�",
- 瀹℃牳鎷掔粷: "瀹℃牳鎷掔粷",
- 瀹℃牳閫氳繃: "瀹℃牳閫氳繃",
- 宸插彂璐�: "宸插彂璐�",
- 閮ㄥ垎鍙戣揣: "閮ㄥ垎鍙戣揣",
- };
- return statusTextMap[statusStr] || "寰呭彂璐�";
- };
-
- /**
- * 鑾峰彇鍙戣揣鐘舵�佹爣绛剧被鍨嬶紙棰滆壊锛�
- * @param row 琛屾暟鎹�
- */
- const getShippingStatusType = row => {
- // 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屾樉绀虹豢鑹�
- if (row.shippingStatus === "宸插彂璐�") {
- return "success";
- }
-
- // 鑾峰彇鍙戣揣鐘舵�佸瓧娈�
- const status = row.shippingStatus;
-
- // 濡傛灉鐘舵�佷负绌烘垨鏈畾涔夛紝榛樿涓虹伆鑹诧紙寰呭彂璐э級
- if (status === null || status === undefined || status === "") {
- return "info";
- }
-
- // 鐘舵�佹槸瀛楃涓�
- const statusStr = String(status).trim();
- const typeTextMap = {
- 寰呭彂璐�: "info",
- 寰呭鏍�: "info",
- 瀹℃牳涓�: "warning",
- 瀹℃牳鎷掔粷: "danger",
- 瀹℃牳閫氳繃: "success",
- 宸插彂璐�: "success",
- 閮ㄥ垎鍙戣揣: "warning",
- };
- return typeTextMap[statusStr] || "info";
- };
-
- /**
- * 鍒ゆ柇鏄惁鍙互鍙戣揣
- * 鍙湁鍦ㄤ骇鍝佺姸鎬佹槸鍏呰冻锛屽彂璐х姸鎬佹槸寰呭彂璐у拰瀹℃牳鎷掔粷鐨勬椂鍊欐墠鍙互鍙戣揣
- * @param row 琛屾暟鎹�
- */
- const canShip = row => {
- // 浜у搧鐘舵�佸繀椤绘槸鍏呰冻锛坅pproveStatus === 1锛�
- if (row.approveStatus !== 1) {
- return false;
- }
-
- // 鑾峰彇鍙戣揣鐘舵��
- const shippingStatus = row.shippingStatus;
-
- // 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屼笉鑳藉啀娆″彂璐�
- if (shippingStatus === "宸插彂璐�") {
- return false;
- }
-
- // 鍙戣揣鐘舵�佸繀椤绘槸"寰呭彂璐�"鎴�"瀹℃牳鎷掔粷"
- const statusStr = shippingStatus ? String(shippingStatus).trim() : "";
- return (
- statusStr === "寰呭彂璐�" ||
- statusStr === "瀹℃牳鎷掔粷" ||
- statusStr === "閮ㄥ垎鍙戣揣"
- );
- };
-
- // 鎵撳紑闄勪欢寮圭獥
- const recordId = ref(0);
- const fileDialogVisible = ref(false);
-
- // 鎵撳紑闄勪欢寮规
- const openFileDialog = async row => {
- recordId.value = row.id;
- fileDialogVisible.value = true;
- };
-
- // 鎵撳紑鍙戣揣寮规
- const openDeliveryForm = async row => {
- // 妫�鏌ユ槸鍚﹀彲浠ュ彂璐�
- if (!canShip(row)) {
- proxy.$modal.msgWarning(
- "鍙湁鍦ㄤ骇鍝佺姸鎬佹槸鍏呰冻锛屽彂璐х姸鎬佹槸寰呭彂璐ф垨瀹℃牳鎷掔粷鐨勬椂鍊欐墠鍙互鍙戣揣"
+ proxy.calculateTaxExclusiveTotalPrice(
+ productForm.value.taxInclusiveTotalPrice,
+ productForm.value.taxRate
);
- return;
- }
+ }
+};
- currentDeliveryRow.value = row;
- const batchNoList = await getDeliveryBatchNoList(
- row.productModelId || row.modelId
+// 鏍规嵁鍚◣鎬讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
+const calculateFromTotalPrice = () => {
+ if (isCalculating.value) return;
+
+ const totalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice);
+ const quantity = parseFloat(productForm.value.quantity);
+
+ if (!totalPrice || !quantity || quantity <= 0) {
+ return;
+ }
+
+ isCalculating.value = true;
+
+ // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
+ productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
+
+ // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+ if (productForm.value.taxRate) {
+ productForm.value.taxExclusiveTotalPrice =
+ proxy.calculateTaxExclusiveTotalPrice(
+ totalPrice,
+ productForm.value.taxRate
+ );
+ }
+
+ isCalculating.value = false;
+};
+
+// 鏍规嵁涓嶅惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
+const calculateFromExclusiveTotalPrice = () => {
+ if (!productForm.value.taxRate) {
+ proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+ return;
+ }
+ if (isCalculating.value) return;
+
+ const exclusiveTotalPrice = parseFloat(
+ productForm.value.taxExclusiveTotalPrice
+ );
+ const quantity = parseFloat(productForm.value.quantity);
+ const taxRate = parseFloat(productForm.value.taxRate);
+
+ if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) {
+ return;
+ }
+
+ isCalculating.value = true;
+
+ // 鍏堣绠楀惈绋庢�讳环 = 涓嶅惈绋庢�讳环 / (1 - 绋庣巼/100)
+ const taxRateDecimal = taxRate / 100;
+ const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
+ productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
+
+ // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
+ productForm.value.taxInclusiveUnitPrice = (
+ inclusiveTotalPrice / quantity
+ ).toFixed(2);
+
+ isCalculating.value = false;
+};
+
+// 鏍规嵁鏁伴噺鍙樺寲璁$畻鎬讳环
+const calculateFromQuantity = () => {
+ if (!productForm.value.taxRate) {
+ proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+ return;
+ }
+ if (isCalculating.value) return;
+
+ const quantity = parseFloat(productForm.value.quantity);
+ const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
+
+ if (!quantity || quantity <= 0 || !unitPrice) {
+ return;
+ }
+
+ isCalculating.value = true;
+
+ // 璁$畻鍚◣鎬讳环
+ productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
+
+ // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+ if (productForm.value.taxRate) {
+ productForm.value.taxExclusiveTotalPrice =
+ proxy.calculateTaxExclusiveTotalPrice(
+ productForm.value.taxInclusiveTotalPrice,
+ productForm.value.taxRate
+ );
+ }
+
+ isCalculating.value = false;
+};
+
+// 鏍规嵁鍚◣鍗曚环鍙樺寲璁$畻鎬讳环
+const calculateFromUnitPrice = () => {
+ if (!productForm.value.taxRate) {
+ proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+ return;
+ }
+ if (isCalculating.value) return;
+
+ const quantity = parseFloat(productForm.value.quantity);
+ const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
+
+ if (!quantity || quantity <= 0 || !unitPrice) {
+ return;
+ }
+
+ isCalculating.value = true;
+
+ // 璁$畻鍚◣鎬讳环
+ productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
+
+ // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+ if (productForm.value.taxRate) {
+ productForm.value.taxExclusiveTotalPrice =
+ proxy.calculateTaxExclusiveTotalPrice(
+ productForm.value.taxInclusiveTotalPrice,
+ productForm.value.taxRate
+ );
+ }
+
+ isCalculating.value = false;
+};
+
+// 鏍规嵁绋庣巼鍙樺寲璁$畻涓嶅惈绋庢�讳环
+const calculateFromTaxRate = () => {
+ if (!productForm.value.taxRate) {
+ proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+ return;
+ }
+ if (isCalculating.value) return;
+
+ const inclusiveTotalPrice = parseFloat(
+ productForm.value.taxInclusiveTotalPrice
+ );
+ const taxRate = parseFloat(productForm.value.taxRate);
+
+ if (!inclusiveTotalPrice || !taxRate) {
+ return;
+ }
+
+ isCalculating.value = true;
+
+ // 璁$畻涓嶅惈绋庢�讳环
+ productForm.value.taxExclusiveTotalPrice =
+ proxy.calculateTaxExclusiveTotalPrice(inclusiveTotalPrice, taxRate);
+
+ isCalculating.value = false;
+};
+/**
+ * 鑾峰彇鍙戣揣鐘舵�佹枃鏈�
+ * @param row 琛屾暟鎹�
+ */
+const getShippingStatusText = (row) => {
+ // 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屾樉绀�"宸插彂璐�"
+ // if (row.shippingDate || row.shippingCarNumber) {
+ // return "宸插彂璐�";
+ // }
+
+ // 鑾峰彇鍙戣揣鐘舵�佸瓧娈�
+ const status = row.shippingStatus;
+
+ // 濡傛灉鐘舵�佷负绌烘垨鏈畾涔夛紝榛樿涓�"寰呭彂璐�"
+ if (status === null || status === undefined || status === "") {
+ return "寰呭彂璐�";
+ }
+
+ // 鐘舵�佹槸瀛楃涓�
+ const statusStr = String(status).trim();
+ const statusTextMap = {
+ 寰呭彂璐�: "寰呭彂璐�",
+ 寰呭鏍�: "寰呭鏍�",
+ 瀹℃牳涓�: "瀹℃牳涓�",
+ 瀹℃牳鎷掔粷: "瀹℃牳鎷掔粷",
+ 瀹℃牳閫氳繃: "瀹℃牳閫氳繃",
+ 宸插彂璐�: "宸插彂璐�",
+ 閮ㄥ垎鍙戣揣: "閮ㄥ垎鍙戣揣",
+ };
+ return statusTextMap[statusStr] || "寰呭彂璐�";
+};
+
+/**
+ * 鑾峰彇鍙戣揣鐘舵�佹爣绛剧被鍨嬶紙棰滆壊锛�
+ * @param row 琛屾暟鎹�
+ */
+const getShippingStatusType = (row) => {
+ // 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屾樉绀虹豢鑹�
+ if (row.shippingStatus === "宸插彂璐�") {
+ return "success";
+ }
+
+ // 鑾峰彇鍙戣揣鐘舵�佸瓧娈�
+ const status = row.shippingStatus;
+
+ // 濡傛灉鐘舵�佷负绌烘垨鏈畾涔夛紝榛樿涓虹伆鑹诧紙寰呭彂璐э級
+ if (status === null || status === undefined || status === "") {
+ return "info";
+ }
+
+ // 鐘舵�佹槸瀛楃涓�
+ const statusStr = String(status).trim();
+ const typeTextMap = {
+ 寰呭彂璐�: "info",
+ 寰呭鏍�: "info",
+ 瀹℃牳涓�: "warning",
+ 瀹℃牳鎷掔粷: "danger",
+ 瀹℃牳閫氳繃: "success",
+ 宸插彂璐�: "success",
+ 閮ㄥ垎鍙戣揣: "warning",
+ };
+ return typeTextMap[statusStr] || "info";
+};
+
+/**
+ * 鍒ゆ柇鏄惁鍙互鍙戣揣
+ * 鍙湁鍦ㄤ骇鍝佺姸鎬佹槸鍏呰冻锛屽彂璐х姸鎬佹槸寰呭彂璐у拰瀹℃牳鎷掔粷鐨勬椂鍊欐墠鍙互鍙戣揣
+ * @param row 琛屾暟鎹�
+ */
+const canShip = (row) => {
+ // 浜у搧鐘舵�佸繀椤绘槸鍏呰冻锛坅pproveStatus === 1锛�
+ if (row.approveStatus !== 1) {
+ return false;
+ }
+
+ // 鑾峰彇鍙戣揣鐘舵��
+ const shippingStatus = row.shippingStatus;
+
+ // 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屼笉鑳藉啀娆″彂璐�
+ if (shippingStatus === "宸插彂璐�") {
+ return false;
+ }
+
+ // 鍙戣揣鐘舵�佸繀椤绘槸"寰呭彂璐�"鎴�"瀹℃牳鎷掔粷"
+ const statusStr = shippingStatus ? String(shippingStatus).trim() : "";
+ return (
+ statusStr === "寰呭彂璐�" ||
+ statusStr === "瀹℃牳鎷掔粷" ||
+ statusStr === "閮ㄥ垎鍙戣揣"
+ );
+};
+
+// 鎵撳紑闄勪欢寮圭獥
+const recordId = ref(0);
+const fileDialogVisible = ref(false);
+
+// 鎵撳紑闄勪欢寮规
+const openFileDialog = async (row) => {
+ recordId.value = row.id;
+ fileDialogVisible.value = true;
+};
+
+// 鎵撳紑鍙戣揣寮规
+const openDeliveryForm = async (row) => {
+ // 妫�鏌ユ槸鍚﹀彲浠ュ彂璐�
+ if (!canShip(row)) {
+ proxy.$modal.msgWarning(
+ "鍙湁鍦ㄤ骇鍝佺姸鎬佹槸鍏呰冻锛屽彂璐х姸鎬佹槸寰呭彂璐ф垨瀹℃牳鎷掔粷鐨勬椂鍊欐墠鍙互鍙戣揣"
);
- deliveryForm.value = {
- shippingCarNumber: "",
- expressCompany: "",
- expressNumber: "",
- type: "璐ц溅",
- batchNo: [],
- batchNoList,
- };
- deliveryFileList.value = [];
- deliveryFormVisible.value = true;
- };
+ return;
+ }
- // 鎻愪氦鍙戣揣琛ㄥ崟
- const submitDelivery = () => {
- proxy.$refs["deliveryFormRef"].validate(valid => {
- if (valid) {
- const selectedBatchRows = getSelectedDeliveryBatchRows();
- if (selectedBatchRows.length === 0) {
- proxy.$modal.msgWarning("璇疯嚦灏戝~鍐欎竴涓壒鍙风殑鍙戣揣鏁伴噺");
- return;
- }
- const totalDeliveryQuantity = selectedBatchRows.reduce(
- (sum, item) => sum + Number(item.deliveryQuantity || 0),
- 0
- );
- const currentRowNoQuantity = Number(
- currentDeliveryRow.value?.noQuantity || 0
- );
- if (
- currentRowNoQuantity > 0 &&
- totalDeliveryQuantity > currentRowNoQuantity
- ) {
- proxy.$modal.msgWarning("鎵瑰彿鍙戣揣鎬绘暟涓嶈兘瓒呰繃寰呭彂璐ф暟閲�");
- return;
- }
- // 淇濆瓨褰撳墠灞曞紑鐨勮ID锛屼互渚垮彂璐у悗閲嶆柊鍔犺浇瀛愯〃鏍兼暟鎹�
- const currentExpandedKeys = [...expandedRowKeys.value];
- const salesLedgerId = currentDeliveryRow.value.salesLedgerId;
- deliveryForm.value.batchNo = selectedBatchRows.map(item => item.id);
- const productModelId =
- currentDeliveryRow.value.productModelId ||
- currentDeliveryRow.value.modelId;
- addShippingInfo({
- salesLedgerId: salesLedgerId,
- salesLedgerProductId: currentDeliveryRow.value.id,
- type: deliveryForm.value.type,
- shippingCarNumber:
- deliveryForm.value.type === "璐ц溅"
- ? deliveryForm.value.shippingCarNumber
- : "",
- expressCompany:
- deliveryForm.value.type === "蹇��"
- ? deliveryForm.value.expressCompany
- : "",
- expressNumber:
- deliveryForm.value.type === "蹇��"
- ? deliveryForm.value.expressNumber
- : "",
- storageBlobDTOs: deliveryFileList.value || [],
- batchNo: deliveryForm.value.batchNo,
- batchNoDetailList: selectedBatchRows.map(item => ({
- stockInventoryId: item.id,
- batchNo: item.batchNo,
- quantity: Number(item.deliveryQuantity || 0),
- productModelId: productModelId,
- })),
- }).then(() => {
- proxy.$modal.msgSuccess("鍙戣揣鎴愬姛");
- closeDeliveryDia();
- // 鍒锋柊涓昏〃鏁版嵁
- getList().then(() => {
- // 濡傛灉涔嬪墠鏈夊睍寮�鐨勮锛岄噸鏂板姞杞借繖浜涜鐨勫瓙琛ㄦ牸鏁版嵁
- if (currentExpandedKeys.length > 0) {
- // 浣跨敤 Promise.all 骞惰鍔犺浇鎵�鏈夊睍寮�琛岀殑瀛愯〃鏍兼暟鎹�
- const loadPromises = currentExpandedKeys.map(ledgerId => {
- return productList({ salesLedgerId: ledgerId, type: 1 }).then(
- res => {
- const index = tableData.value.findIndex(
- item => item.id === ledgerId
- );
- if (index > -1) {
- tableData.value[index].children = res.data;
- }
- }
- );
- });
- Promise.all(loadPromises).then(() => {
- // 鎭㈠灞曞紑鐘舵��
- expandedRowKeys.value = currentExpandedKeys;
- });
- }
- });
- });
+ currentDeliveryRow.value = row;
+ const batchNoList = await getDeliveryBatchNoList(
+ row.productModelId || row.modelId
+ );
+ deliveryForm.value = {
+ shippingCarNumber: "",
+ expressCompany: "",
+ expressNumber: "",
+ type: "璐ц溅",
+ batchNo: [],
+ batchNoList,
+ };
+ deliveryFileList.value = [];
+ deliveryFormVisible.value = true;
+};
+
+// 鎻愪氦鍙戣揣琛ㄥ崟
+const submitDelivery = () => {
+ proxy.$refs["deliveryFormRef"].validate((valid) => {
+ if (valid) {
+ const selectedBatchRows = getSelectedDeliveryBatchRows();
+ if (selectedBatchRows.length === 0) {
+ proxy.$modal.msgWarning("璇疯嚦灏戝~鍐欎竴涓壒鍙风殑鍙戣揣鏁伴噺");
+ return;
}
- });
- };
-
- // 鍏抽棴鍙戣揣寮规
- const handleDeliveryTypeChange = val => {
- if (val === "璐ц溅") {
- deliveryForm.value.expressCompany = "";
- deliveryForm.value.expressNumber = "";
- } else {
- deliveryForm.value.shippingCarNumber = "";
+ const totalDeliveryQuantity = selectedBatchRows.reduce(
+ (sum, item) => sum + Number(item.deliveryQuantity || 0),
+ 0
+ );
+ const currentRowNoQuantity = Number(
+ currentDeliveryRow.value?.noQuantity || 0
+ );
+ if (
+ currentRowNoQuantity > 0 &&
+ totalDeliveryQuantity > currentRowNoQuantity
+ ) {
+ proxy.$modal.msgWarning("鎵瑰彿鍙戣揣鎬绘暟涓嶈兘瓒呰繃寰呭彂璐ф暟閲�");
+ return;
+ }
+ // 淇濆瓨褰撳墠灞曞紑鐨勮ID锛屼互渚垮彂璐у悗閲嶆柊鍔犺浇瀛愯〃鏍兼暟鎹�
+ const currentExpandedKeys = [...expandedRowKeys.value];
+ const salesLedgerId = currentDeliveryRow.value.salesLedgerId;
+ deliveryForm.value.batchNo = selectedBatchRows.map((item) => item.id);
+ const productModelId =
+ currentDeliveryRow.value.productModelId ||
+ currentDeliveryRow.value.modelId;
+ addShippingInfo({
+ salesLedgerId: salesLedgerId,
+ salesLedgerProductId: currentDeliveryRow.value.id,
+ type: deliveryForm.value.type,
+ shippingCarNumber:
+ deliveryForm.value.type === "璐ц溅"
+ ? deliveryForm.value.shippingCarNumber
+ : "",
+ expressCompany:
+ deliveryForm.value.type === "蹇��"
+ ? deliveryForm.value.expressCompany
+ : "",
+ expressNumber:
+ deliveryForm.value.type === "蹇��"
+ ? deliveryForm.value.expressNumber
+ : "",
+ storageBlobDTOs: deliveryFileList.value || [],
+ batchNo: deliveryForm.value.batchNo,
+ batchNoDetailList: selectedBatchRows.map((item) => ({
+ stockInventoryId: item.id,
+ batchNo: item.batchNo,
+ quantity: Number(item.deliveryQuantity || 0),
+ productModelId: productModelId,
+ })),
+ }).then(() => {
+ proxy.$modal.msgSuccess("鍙戣揣鎴愬姛");
+ closeDeliveryDia();
+ // 鍒锋柊涓昏〃鏁版嵁
+ getList().then(() => {
+ // 濡傛灉涔嬪墠鏈夊睍寮�鐨勮锛岄噸鏂板姞杞借繖浜涜鐨勫瓙琛ㄦ牸鏁版嵁
+ if (currentExpandedKeys.length > 0) {
+ // 浣跨敤 Promise.all 骞惰鍔犺浇鎵�鏈夊睍寮�琛岀殑瀛愯〃鏍兼暟鎹�
+ const loadPromises = currentExpandedKeys.map((ledgerId) => {
+ return productList({ salesLedgerId: ledgerId, type: 1 }).then(
+ (res) => {
+ const index = tableData.value.findIndex(
+ (item) => item.id === ledgerId
+ );
+ if (index > -1) {
+ tableData.value[index].children = res.data;
+ }
+ }
+ );
+ });
+ Promise.all(loadPromises).then(() => {
+ // 鎭㈠灞曞紑鐘舵��
+ expandedRowKeys.value = currentExpandedKeys;
+ });
+ }
+ });
+ });
}
- };
-
- const closeDeliveryDia = () => {
- proxy.resetForm("deliveryFormRef");
- deliveryFileList.value = [];
- deliveryFormVisible.value = false;
- currentDeliveryRow.value = null;
- };
- const currentFactoryName = ref("");
- const getCurrentFactoryName = async () => {
- let res = await userStore.getInfo();
- currentFactoryName.value = res.user.currentFactoryName;
- };
- onMounted(() => {
- searchForm.salesContractNo = route.query.salesContractNo;
- getList();
- userListNoPage().then(res => {
- userList.value = res.data;
- });
- getCurrentFactoryName();
});
+};
+
+// 鍏抽棴鍙戣揣寮规
+const handleDeliveryTypeChange = (val) => {
+ if (val === "璐ц溅") {
+ deliveryForm.value.expressCompany = "";
+ deliveryForm.value.expressNumber = "";
+ } else {
+ deliveryForm.value.shippingCarNumber = "";
+ }
+};
+
+const closeDeliveryDia = () => {
+ proxy.resetForm("deliveryFormRef");
+ deliveryFileList.value = [];
+ deliveryFormVisible.value = false;
+ currentDeliveryRow.value = null;
+};
+const currentFactoryName = ref("");
+const getCurrentFactoryName = async () => {
+ let res = await userStore.getInfo();
+ currentFactoryName.value = res.user.currentFactoryName;
+};
+onMounted(() => {
+ searchForm.salesContractNo = route.query.salesContractNo;
+ getList();
+ userListNoPage().then((res) => {
+ userList.value = res.data;
+ });
+ getCurrentFactoryName();
+});
</script>
<style scoped lang="scss">
- .ml-10 {
- margin-left: 10px;
+.ml-10 {
+ margin-left: 10px;
+}
+
+:deep(.yellow) {
+ background-color: #faf0de;
+}
+
+:deep(.pink) {
+ background-color: #fae1de;
+}
+
+:deep(.red) {
+ background-color: #fae1de;
+}
+
+:deep(.purple) {
+ background-color: #f4defa;
+}
+
+.table_list {
+ margin-top: unset;
+}
+
+.actions {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 10px;
+}
+
+.print-preview-dialog {
+ .el-dialog__body {
+ padding: 0;
+ max-height: 80vh;
+ overflow-y: auto;
}
+}
- :deep(.yellow) {
- background-color: #faf0de;
- }
-
- :deep(.pink) {
- background-color: #fae1de;
- }
-
- :deep(.red) {
- background-color: #fae1de;
- }
-
- :deep(.purple) {
- background-color: #f4defa;
- }
-
- .table_list {
- margin-top: unset;
- }
-
- .actions {
- display: flex;
- justify-content: space-between;
- margin-bottom: 10px;
- }
-
- .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;
}
+
+ .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;
+ }
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3