From 0c116b0f5624786bd06990b86c467be25e2411fd Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 26 一月 2026 17:51:38 +0800
Subject: [PATCH] feat: BOM导入模板下载,导入导出接口添加菜单权限

---
 src/views/salesManagement/deliveryLedger/index.vue |  122 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 116 insertions(+), 6 deletions(-)

diff --git a/src/views/salesManagement/deliveryLedger/index.vue b/src/views/salesManagement/deliveryLedger/index.vue
index 7b94a29..688741b 100644
--- a/src/views/salesManagement/deliveryLedger/index.vue
+++ b/src/views/salesManagement/deliveryLedger/index.vue
@@ -32,15 +32,33 @@
         <el-table-column align="center" type="selection" width="55" />
         <el-table-column align="center" label="搴忓彿" type="index" width="60" />
         <el-table-column label="閿�鍞鍗�" prop="salesContractNo" show-overflow-tooltip />
+        <el-table-column label="鍙戣揣璁㈠崟鍙�" prop="shippingNo" show-overflow-tooltip />
         <el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" show-overflow-tooltip />
         <el-table-column label="鍙戣揣鏃堕棿" prop="shippingDate" show-overflow-tooltip />
         <el-table-column label="鍙戣揣杞︾墝鍙�" prop="shippingCarNumber" show-overflow-tooltip />
         <el-table-column label="蹇�掑叕鍙�" prop="expressCompany" show-overflow-tooltip />
         <el-table-column label="蹇�掑崟鍙�" prop="expressNumber" show-overflow-tooltip />
+        <el-table-column label="瀹℃牳鐘舵��" prop="status" align="center" width="120">
+          <template #default="scope">
+            <el-tag :type="getApprovalStatusType(scope.row.status)">
+              {{ getApprovalStatusText(scope.row.status) }}
+            </el-tag>
+          </template>
+        </el-table-column>
         <el-table-column fixed="right" label="鎿嶄綔" width="150" align="center">
           <template #default="scope">
-            <el-button link type="primary" size="small" @click="openForm('edit', scope.row)">缂栬緫</el-button>
-            <el-button link type="danger" size="small" @click="handleDeleteSingle(scope.row)">鍒犻櫎</el-button>
+            <el-button 
+              link 
+              type="primary" 
+              size="small" 
+              :disabled="!isApproved(scope.row.status)"
+              @click="openForm('edit', scope.row)">缂栬緫</el-button>
+            <el-button 
+              link 
+              type="danger" 
+              size="small" 
+              :disabled="!isApproved(scope.row.status)"
+              @click="handleDeleteSingle(scope.row)">鍒犻櫎</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -266,6 +284,12 @@
 
 // 鎵撳紑寮规
 const openForm = async (type, row) => {
+  // 缂栬緫鏃舵鏌ュ鏍哥姸鎬�
+  if (type === 'edit' && row && !isApproved(row.status)) {
+    proxy.$modal.msgWarning("鍙兘缂栬緫瀹℃牳閫氳繃鐨勬暟鎹�");
+    return;
+  }
+  
   operationType.value = type;
   const baseUrl = import.meta.env.VITE_APP_BASE_API;
   
@@ -401,13 +425,19 @@
 
 // 鎵归噺鍒犻櫎
 const handleDelete = () => {
-  let ids = [];
-  if (selectedRows.value.length > 0) {
-    ids = selectedRows.value.map((item) => item.id);
-  } else {
+  if (selectedRows.value.length === 0) {
     proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
     return;
   }
+  
+  // 妫�鏌ラ�変腑鐨勮鏄惁閮芥槸"瀹℃牳閫氳繃"鐘舵��
+  const notApprovedRows = selectedRows.value.filter(row => !isApproved(row.status));
+  if (notApprovedRows.length > 0) {
+    proxy.$modal.msgWarning("鍙兘鍒犻櫎瀹℃牳閫氳繃鐨勬暟鎹�");
+    return;
+  }
+  
+  const ids = selectedRows.value.map((item) => item.id);
   ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
     confirmButtonText: "纭",
     cancelButtonText: "鍙栨秷",
@@ -426,6 +456,12 @@
 
 // 鍗曚釜鍒犻櫎
 const handleDeleteSingle = (row) => {
+  // 妫�鏌ユ槸鍚︿负"瀹℃牳閫氳繃"鐘舵��
+  if (!isApproved(row.deliveryLedger)) {
+    proxy.$modal.msgWarning("鍙兘鍒犻櫎瀹℃牳閫氳繃鐨勬暟鎹�");
+    return;
+  }
+  
   ElMessageBox.confirm("姝ゆ搷浣滃皢鍒犻櫎璇ヨ褰曪紝鏄惁纭锛�", "鍒犻櫎", {
     confirmButtonText: "纭",
     cancelButtonText: "鍙栨秷",
@@ -525,6 +561,80 @@
   }
 };
 
+// 鑾峰彇瀹℃牳鐘舵�佹枃鏈�
+const getApprovalStatusText = (status) => {
+  if (status === null || status === undefined || status === '') {
+    return '寰呭鏍�';
+  }
+  // 濡傛灉鏄暟瀛�
+  if (typeof status === 'number') {
+    const statusMap = {
+      0: '寰呭鏍�',
+      1: '瀹℃牳涓�',
+      2: '瀹℃牳鎷掔粷',
+      3: '瀹℃牳閫氳繃'
+    };
+    return statusMap[status] || '寰呭鏍�';
+  }
+  // 濡傛灉鏄瓧绗︿覆锛岀洿鎺ヨ繑鍥炴垨鏄犲皠
+  const statusStr = String(status).trim();
+  const statusTextMap = {
+    '寰呭鏍�': '寰呭鏍�',
+    '瀹℃牳涓�': '瀹℃牳涓�',
+    '瀹℃牳鎷掔粷': '瀹℃牳鎷掔粷',
+    '瀹℃牳閫氳繃': '瀹℃牳閫氳繃',
+    '0': '寰呭鏍�',
+    '1': '瀹℃牳涓�',
+    '2': '瀹℃牳鎷掔粷',
+    '3': '瀹℃牳閫氳繃'
+  };
+  return statusTextMap[statusStr] || statusStr || '寰呭鏍�';
+};
+
+// 鑾峰彇瀹℃牳鐘舵�佹爣绛剧被鍨嬶紙棰滆壊锛�
+const getApprovalStatusType = (status) => {
+  if (status === null || status === undefined || status === '') {
+    return 'info';
+  }
+  // 濡傛灉鏄暟瀛�
+  if (typeof status === 'number') {
+    const typeMap = {
+      0: 'info',      // 寰呭鏍� - 鐏拌壊
+      1: 'warning',   // 瀹℃牳涓� - 榛勮壊
+      2: 'danger',    // 瀹℃牳鎷掔粷 - 绾㈣壊
+      3: 'success'    // 瀹℃牳閫氳繃 - 缁胯壊
+    };
+    return typeMap[status] || 'info';
+  }
+  // 濡傛灉鏄瓧绗︿覆
+  const statusStr = String(status).trim();
+  const typeTextMap = {
+    '寰呭鏍�': 'info',
+    '瀹℃牳涓�': 'warning',
+    '瀹℃牳鎷掔粷': 'danger',
+    '瀹℃牳閫氳繃': 'success',
+    '0': 'info',
+    '1': 'warning',
+    '2': 'danger',
+    '3': 'success'
+  };
+  return typeTextMap[statusStr] || 'info';
+};
+
+// 妫�鏌ュ鏍哥姸鎬佹槸鍚︿负"瀹℃牳閫氳繃"
+const isApproved = (status) => {
+  if (status === null || status === undefined || status === '') {
+    return false;
+  }
+  // 濡傛灉鏄暟瀛楋紝3 琛ㄧず瀹℃牳閫氳繃
+  if (typeof status === 'number') {
+    return status === 3;
+  }
+  // 濡傛灉鏄瓧绗︿覆
+  const statusStr = String(status).trim();
+  return statusStr === '瀹℃牳閫氳繃' || statusStr === '3';
+};
+
 onMounted(() => {
   getList();
 });

--
Gitblit v1.9.3