From 4a811fb2cd4ee4e1cbfe284bfd1fe3a7d16204ce Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期四, 02 四月 2026 17:35:48 +0800
Subject: [PATCH] fix: 终检表单优化检验用粉剂/液情况字段

---
 src/views/salesManagement/deliveryLedger/index.vue |  258 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 152 insertions(+), 106 deletions(-)

diff --git a/src/views/salesManagement/deliveryLedger/index.vue b/src/views/salesManagement/deliveryLedger/index.vue
index 983a3e5..7927b73 100644
--- a/src/views/salesManagement/deliveryLedger/index.vue
+++ b/src/views/salesManagement/deliveryLedger/index.vue
@@ -34,30 +34,38 @@
         <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="productName" show-overflow-tooltip />
+        <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" 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">
+        <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 :type="getShippingStatusType(scope.row.status)">
+              {{ getShippingStatusText(scope.row.status) }}
             </el-tag>
           </template>
         </el-table-column>
-        <el-table-column fixed="right" label="鎿嶄綔" width="150" align="center">
+        <el-table-column fixed="right" label="鎿嶄綔" width="200" align="center">
           <template #default="scope">
             <el-button 
               link 
               type="primary" 
               size="small" 
-              :disabled="isApproving(scope.row.status)"
-              @click="openForm('edit', scope.row)">缂栬緫</el-button>
+              :disabled="isShipped(scope.row.status)"
+              @click="openForm('edit', scope.row)">琛ュ厖鍙戣揣淇℃伅</el-button>
+            <el-button
+              link
+              type="primary"
+              size="small"
+              @click="openDetail(scope.row)"
+            >璇︽儏</el-button>
             <el-button 
               link 
               type="danger" 
               size="small" 
-              :disabled="isApproving(scope.row.status)"
+              :disabled="isShipped(scope.row.status)"
               @click="handleDeleteSingle(scope.row)">鍒犻櫎</el-button>
           </template>
         </el-table-column>
@@ -166,6 +174,43 @@
         </div>
       </template>
     </el-dialog>
+
+    <!-- 璇︽儏寮规 -->
+    <el-dialog v-model="detailDialogVisible" title="鍙戣揣鍙拌处璇︽儏" width="55%" @close="closeDetail">
+      <div v-if="detailRow" class="detail-wrapper">
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="閿�鍞鍗�">{{ detailRow.salesContractNo || '--' }}</el-descriptions-item>
+          <el-descriptions-item label="鍙戣揣璁㈠崟鍙�">{{ detailRow.shippingNo || '--' }}</el-descriptions-item>
+          <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ detailRow.customerName || '--' }}</el-descriptions-item>
+          <el-descriptions-item label="浜у搧鍚嶇О">{{ detailRow.productName || '--' }}</el-descriptions-item>
+          <el-descriptions-item label="瑙勬牸鍨嬪彿">{{ detailRow.specificationModel || '--' }}</el-descriptions-item>
+          <el-descriptions-item label="鍙戣揣绫诲瀷">{{ detailRow.type || '--' }}</el-descriptions-item>
+          <el-descriptions-item label="鍙戣揣鏃ユ湡">{{ detailRow.shippingDate || '--' }}</el-descriptions-item>
+          <el-descriptions-item label="鍙戣揣鐘舵��">{{ getShippingStatusText(detailRow.status) }}</el-descriptions-item>
+          <el-descriptions-item label="鍙戣揣杞︾墝鍙�">{{ detailRow.shippingCarNumber || '--' }}</el-descriptions-item>
+          <el-descriptions-item label="蹇�掑叕鍙�">{{ detailRow.expressCompany || '--' }}</el-descriptions-item>
+          <el-descriptions-item label="蹇�掑崟鍙�" :span="2">{{ detailRow.expressNumber || '--' }}</el-descriptions-item>
+        </el-descriptions>
+
+        <div class="detail-images" v-if="detailImages.length">
+          <div class="detail-images-title">鍙戣揣鍥剧墖</div>
+          <el-image
+            v-for="img in detailImages"
+            :key="img.url"
+            :src="img.url"
+            :preview-src-list="detailImages.map(i => i.url)"
+            fit="cover"
+            class="detail-image"
+          />
+        </div>
+        <div v-else class="detail-images-empty">鏆傛棤鍙戣揣鍥剧墖</div>
+      </div>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button @click="closeDetail">鍏抽棴</el-button>
+        </div>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -177,9 +222,9 @@
 import { getToken } from "@/utils/auth";
 import { getCurrentDate } from "@/utils/index.js";
 import {
-  deliveryLedgerListPage,
-  addOrUpdateDeliveryLedger,
-  delDeliveryLedger,
+	deliveryLedgerListPage,
+	addOrUpdateDeliveryLedger,
+	delDeliveryLedger, deductStock,
 } from "@/api/salesManagement/deliveryLedger.js";
 import { delLedgerFile } from "@/api/salesManagement/salesLedger.js";
  
@@ -196,6 +241,31 @@
 const total = ref(0);
 const deliveryFileList = ref([]);
 const javaApi = proxy.javaApi;
+// 璇︽儏寮规
+const detailDialogVisible = ref(false);
+const detailRow = ref(null);
+const detailImages = ref([]);
+
+const normalizeFileUrl = (rawUrl = '') => {
+  let fileUrl = rawUrl || '';
+  // Windows 璺緞杞� URL
+  if (fileUrl && fileUrl.indexOf('\\') > -1) {
+    const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads');
+    if (uploadsIndex > -1) {
+      const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/');
+      fileUrl = '/' + relativePath;
+    } else {
+      const parts = fileUrl.split('\\');
+      const fileName = parts[parts.length - 1];
+      fileUrl = '/uploads/' + fileName;
+    }
+  }
+  if (fileUrl && !fileUrl.startsWith('http')) {
+    if (!fileUrl.startsWith('/')) fileUrl = '/' + fileUrl;
+    fileUrl = javaApi + fileUrl;
+  }
+  return fileUrl;
+};
 
 // 涓婁紶閰嶇疆
 const upload = reactive({
@@ -218,6 +288,8 @@
     id: null,
     salesContractNo: "",
     customerName: "",
+    specificationModel: "",
+    productName: "",
     type: "璐ц溅", // 璐ц溅, 蹇��
     shippingDate: "",
     shippingCarNumber: "",
@@ -284,9 +356,9 @@
 
 // 鎵撳紑寮规
 const openForm = async (type, row) => {
-  // 缂栬緫鏃舵鏌ュ鏍哥姸鎬侊紝鍙湁瀹℃牳涓笉鑳界紪杈�
-  if (type === 'edit' && row && isApproving(row.status)) {
-    proxy.$modal.msgWarning("瀹℃牳涓殑鏁版嵁涓嶈兘缂栬緫");
+  // 琛ュ厖鍙戣揣淇℃伅锛氫粎鈥滄湭鍙戣揣鈥濆厑璁哥紪杈�
+  if (type === 'edit' && row && isShipped(row.status)) {
+    proxy.$modal.msgWarning("宸插彂璐х殑鏁版嵁涓嶈兘琛ュ厖鍙戣揣淇℃伅");
     return;
   }
   
@@ -307,38 +379,7 @@
     // 濡傛灉鏈夊浘鐗囷紝灏� commonFileList 杞崲涓烘枃浠跺垪琛ㄦ牸寮�
     if (row.commonFileList && Array.isArray(row.commonFileList) && row.commonFileList.length > 0) {
       deliveryFileList.value = row.commonFileList.map((file, index) => {
-        // 澶勭悊 URL锛氬皢 Windows 璺緞杞崲涓哄彲璁块棶鐨� URL
-        let fileUrl = file.url || '';
-        console.log('鍘熷 URL:', fileUrl);
-        
-        // 濡傛灉 URL 鏄� Windows 璺緞鏍煎紡锛堝寘鍚弽鏂滄潬锛夛紝闇�瑕佽浆鎹�
-        if (fileUrl && fileUrl.indexOf('\\') > -1) {
-          // 鏌ユ壘 uploads 鍏抽敭瀛楃殑浣嶇疆锛屼粠閭i噷寮�濮嬫彁鍙栫浉瀵硅矾寰�
-          const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads');
-          if (uploadsIndex > -1) {
-            // 浠� uploads 寮�濮嬫彁鍙栬矾寰勶紝骞跺皢鍙嶆枩鏉犳浛鎹负姝f枩鏉�
-            const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/');
-            fileUrl = '/' + relativePath;
-            console.log('杞崲鍚庣殑鐩稿璺緞:', fileUrl);
-          } else {
-            // 濡傛灉娌℃湁鎵惧埌 uploads锛屾彁鍙栨渶鍚庝竴涓洰褰曞拰鏂囦欢鍚�
-            const parts = fileUrl.split('\\');
-            const fileName = parts[parts.length - 1];
-            fileUrl = '/uploads/' + fileName;
-            console.log('鏈壘鍒� uploads锛屼娇鐢ㄦ枃浠跺悕:', fileUrl);
-          }
-        }
-        
-        // 纭繚鎵�鏈夐潪 http 寮�澶寸殑 URL 閮芥嫾鎺� baseUrl
-        if (fileUrl && !fileUrl.startsWith('http')) {
-          // 纭繚璺緞浠� / 寮�澶�
-          if (!fileUrl.startsWith('/')) {
-            fileUrl = '/' + fileUrl;
-          }
-          // 鎷兼帴 baseUrl
-          fileUrl = javaApi + fileUrl;
-          console.log('鏈�缁堟嫾鎺ョ殑 URL:', fileUrl);
-        }
+        const fileUrl = normalizeFileUrl(file.url || '');
         
         return {
           uid: file.id || Date.now() + index,
@@ -375,6 +416,21 @@
   dialogFormVisible.value = true;
 };
 
+// 鎵撳紑璇︽儏寮规
+const openDetail = (row) => {
+  detailRow.value = row || null;
+  const list = Array.isArray(row?.commonFileList) ? row.commonFileList : [];
+  detailImages.value = list
+    .map((f) => ({ url: normalizeFileUrl(f?.url || '') }))
+    .filter((i) => !!i.url);
+  detailDialogVisible.value = true;
+};
+const closeDetail = () => {
+  detailDialogVisible.value = false;
+  detailRow.value = null;
+  detailImages.value = [];
+};
+
 // 鎻愪氦琛ㄥ崟
 const submitForm = () => {
   proxy.$refs["formRef"].validate((valid) => {
@@ -392,7 +448,7 @@
         expressNumber: form.value.type === "蹇��" ? form.value.expressNumber : "",
         tempFileIds: tempFileIds,
       };
-      addOrUpdateDeliveryLedger(payload).then((res) => {
+			deductStock(payload).then((res) => {
         proxy.$modal.msgSuccess("鎿嶄綔鎴愬姛");
         closeDia();
         getList();
@@ -430,10 +486,10 @@
     return;
   }
   
-  // 妫�鏌ラ�変腑鐨勮鏄惁鏈�"瀹℃牳涓�"鐘舵��
-  const approvingRows = selectedRows.value.filter(row => isApproving(row.status));
-  if (approvingRows.length > 0) {
-    proxy.$modal.msgWarning("瀹℃牳涓殑鏁版嵁涓嶈兘鍒犻櫎");
+  // 宸插彂璐ф暟鎹笉鍏佽鍒犻櫎
+  const shippedRows = selectedRows.value.filter(row => isShipped(row.status));
+  if (shippedRows.length > 0) {
+    proxy.$modal.msgWarning("宸插彂璐х殑鏁版嵁涓嶈兘鍒犻櫎");
     return;
   }
   
@@ -456,9 +512,9 @@
 
 // 鍗曚釜鍒犻櫎
 const handleDeleteSingle = (row) => {
-  // 妫�鏌ユ槸鍚︿负"瀹℃牳涓�"鐘舵��
-  if (isApproving(row.status)) {
-    proxy.$modal.msgWarning("瀹℃牳涓殑鏁版嵁涓嶈兘鍒犻櫎");
+  // 宸插彂璐ф暟鎹笉鍏佽鍒犻櫎
+  if (isShipped(row.status)) {
+    proxy.$modal.msgWarning("宸插彂璐х殑鏁版嵁涓嶈兘鍒犻櫎");
     return;
   }
   
@@ -561,92 +617,60 @@
   }
 };
 
-// 鑾峰彇瀹℃牳鐘舵�佹枃鏈�
-const getApprovalStatusText = (status) => {
+// 鑾峰彇鍙戣揣鐘舵�佹枃鏈�
+const getShippingStatusText = (status) => {
   if (status === null || status === undefined || status === '') {
-    return '寰呭鏍�';
+    return '鏈彂璐�';
   }
-  // 濡傛灉鏄暟瀛�
   if (typeof status === 'number') {
     const statusMap = {
-      0: '寰呭鏍�',
-      1: '瀹℃牳涓�',
-      2: '瀹℃牳鎷掔粷',
-      3: '瀹℃牳閫氳繃'
+      0: '鏈彂璐�',
+      1: '宸插彂璐�',
     };
-    return statusMap[status] || '寰呭鏍�';
+    return statusMap[status] || '鏈彂璐�';
   }
-  // 濡傛灉鏄瓧绗︿覆锛岀洿鎺ヨ繑鍥炴垨鏄犲皠
   const statusStr = String(status).trim();
   const statusTextMap = {
-    '寰呭鏍�': '寰呭鏍�',
-    '瀹℃牳涓�': '瀹℃牳涓�',
-    '瀹℃牳鎷掔粷': '瀹℃牳鎷掔粷',
-    '瀹℃牳閫氳繃': '瀹℃牳閫氳繃',
-    '0': '寰呭鏍�',
-    '1': '瀹℃牳涓�',
-    '2': '瀹℃牳鎷掔粷',
-    '3': '瀹℃牳閫氳繃'
+    '鏈彂璐�': '鏈彂璐�',
+    '宸插彂璐�': '宸插彂璐�',
+    '0': '鏈彂璐�',
+    '1': '宸插彂璐�',
   };
-  return statusTextMap[statusStr] || statusStr || '寰呭鏍�';
+  return statusTextMap[statusStr] || statusStr || '鏈彂璐�';
 };
 
-// 鑾峰彇瀹℃牳鐘舵�佹爣绛剧被鍨嬶紙棰滆壊锛�
-const getApprovalStatusType = (status) => {
+// 鑾峰彇鍙戣揣鐘舵�佹爣绛剧被鍨嬶紙棰滆壊锛�
+const getShippingStatusType = (status) => {
   if (status === null || status === undefined || status === '') {
     return 'info';
   }
-  // 濡傛灉鏄暟瀛�
   if (typeof status === 'number') {
     const typeMap = {
-      0: 'info',      // 寰呭鏍� - 鐏拌壊
-      1: 'warning',   // 瀹℃牳涓� - 榛勮壊
-      2: 'danger',    // 瀹℃牳鎷掔粷 - 绾㈣壊
-      3: 'success'    // 瀹℃牳閫氳繃 - 缁胯壊
+      0: 'info',     // 鏈彂璐� - 鐏拌壊
+      1: 'success',  // 宸插彂璐� - 缁胯壊
     };
     return typeMap[status] || 'info';
   }
-  // 濡傛灉鏄瓧绗︿覆
   const statusStr = String(status).trim();
   const typeTextMap = {
-    '寰呭鏍�': 'info',
-    '瀹℃牳涓�': 'warning',
-    '瀹℃牳鎷掔粷': 'danger',
-    '瀹℃牳閫氳繃': 'success',
+    '鏈彂璐�': 'info',
+    '宸插彂璐�': 'success',
     '0': 'info',
-    '1': 'warning',
-    '2': 'danger',
-    '3': 'success'
+    '1': 'success',
   };
   return typeTextMap[statusStr] || 'info';
 };
 
-// 妫�鏌ュ鏍哥姸鎬佹槸鍚︿负"瀹℃牳閫氳繃"
-const isApproved = (status) => {
+// 鏄惁宸插彂璐�
+const isShipped = (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';
-};
-
-// 妫�鏌ュ鏍哥姸鎬佹槸鍚︿负"瀹℃牳涓�"
-const isApproving = (status) => {
-  if (status === null || status === undefined || status === '') {
-    return false;
-  }
-  // 濡傛灉鏄暟瀛楋紝1 琛ㄧず瀹℃牳涓�
   if (typeof status === 'number') {
     return status === 1;
   }
-  // 濡傛灉鏄瓧绗︿覆
   const statusStr = String(status).trim();
-  return statusStr === '瀹℃牳涓�' || statusStr === '1';
+  return statusStr === '宸插彂璐�' || statusStr === '1';
 };
 
 onMounted(() => {
@@ -671,5 +695,27 @@
     display: none;
   }
 }
+.detail-wrapper {
+  padding: 8px 0;
+}
+.detail-images {
+  margin-top: 16px;
+}
+.detail-images-title {
+  font-weight: 600;
+  margin-bottom: 10px;
+  color: #303133;
+}
+.detail-image {
+  width: 120px;
+  height: 120px;
+  margin-right: 10px;
+  margin-bottom: 10px;
+  border-radius: 6px;
+}
+.detail-images-empty {
+  margin-top: 16px;
+  color: #909399;
+}
 </style>
 

--
Gitblit v1.9.3