From 072b7c1fa983cbfa9dc5b311fd815c8d9142ee33 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 15 五月 2026 13:25:57 +0800
Subject: [PATCH] 进销存pro 1.计量器具台账不要检定周期了,不要安装位置,加一个快到期提醒

---
 src/views/inventoryManagement/receiptManagement/Record.vue |  108 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 97 insertions(+), 11 deletions(-)

diff --git a/src/views/inventoryManagement/receiptManagement/Record.vue b/src/views/inventoryManagement/receiptManagement/Record.vue
index 17ac048..9485188 100644
--- a/src/views/inventoryManagement/receiptManagement/Record.vue
+++ b/src/views/inventoryManagement/receiptManagement/Record.vue
@@ -1,6 +1,6 @@
 <template>
-  <div class="app-container">
-    <div class="search_form">
+  <div>
+    <div class="search_form" style="margin-bottom: 10px;">
       <div>
         <span class="search_title ml10">鍏ュ簱鏃ユ湡锛�</span>
         <el-date-picker v-model="searchForm.timeStr"
@@ -31,6 +31,7 @@
         </el-button>
       </div>
       <div>
+        <el-button type="primary" @click="handleBatchApprove">瀹℃壒</el-button>
         <el-button @click="handleOut">瀵煎嚭</el-button>
         <el-button type="danger"
                    plain
@@ -49,6 +50,7 @@
                 height="calc(100vh - 18.5em)">
         <el-table-column align="center"
                          type="selection"
+                         :selectable="isRowSelectableForApprove"
                          width="55"/>
         <el-table-column align="center"
                          label="搴忓彿"
@@ -86,6 +88,15 @@
             {{ getRecordType(scope.row.recordType) }}
           </template>
         </el-table-column>
+        <el-table-column label="瀹℃壒鐘舵��"
+                         prop="approvalStatus"
+                         show-overflow-tooltip>
+          <template #default="scope">
+            <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"
@@ -109,10 +120,12 @@
 import {ElMessageBox} from "element-plus";
 import {
   getStockInRecordListPage,
-  batchDeleteStockInRecords,
+  batchDeletePendingStockInRecords,
+  batchApproveStockInRecords,
 } from "@/api/inventoryManagement/stockInRecord.js";
 import {
-  findAllQualifiedStockInRecordTypeOptions, findAllUnQualifiedStockInRecordTypeOptions,
+  findAllQualifiedStockInRecordTypeOptions, 
+  // findAllUnQualifiedStockInRecordTypeOptions,
 } from "@/api/basicData/enum.js";
 
 const {proxy} = getCurrentInstance();
@@ -159,6 +172,41 @@
   return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
 }
 
+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] || "寰呭鎵�";
+};
+
+// 閫氳繃/椹冲洖鍥哄畾鑹诧紱鍏朵綑锛堝惈寰呭鎵广�佺┖鍊笺�佹湭鏄犲皠浣嗘枃妗堜负寰呭鎵癸級缁熶竴鐢� 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 isRowSelectableForApprove = row => {
+  return isPendingApproval(row?.approvalStatus);
+};
+
 const pageProductChange = obj => {
   page.current = obj.page;
   page.size = obj.limit;
@@ -167,7 +215,7 @@
 
 const getList = () => {
   tableLoading.value = true;
-  const params = {...page, type: props.type, topParentProductId: props.topParentProductId};
+  const params = {...page,  topParentProductId: props.topParentProductId};
   params.timeStr = searchForm.value.timeStr;
   params.productName = searchForm.value.productName;
   params.recordType = searchForm.value.recordType;
@@ -189,18 +237,56 @@
         })
     return
   }
-  findAllUnQualifiedStockInRecordTypeOptions()
-      .then(res => {
-        stockRecordTypeOptions.value = res.data;
-      })
+  // findAllUnQualifiedStockInRecordTypeOptions()
+  //     .then(res => {
+  //       stockRecordTypeOptions.value = res.data;
+  //     })
 }
 
 // 琛ㄦ牸閫夋嫨鏁版嵁
 const handleSelectionChange = selection => {
-  selectedRows.value = selection.filter(item => item.id);
+  selectedRows.value = selection.filter(item => item.id && isPendingApproval(item.approvalStatus));
 };
 
 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(() => {
+        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("瀹℃壒椹冲洖鎴愬姛");
+                getList();
+              })
+              .catch(() => {
+                proxy.$modal.msgError("瀹℃壒椹冲洖澶辫触");
+              });
+          return;
+        }
+        proxy.$modal.msg("宸插彇娑�");
+      });
+};
 
 // 瀵煎嚭
 const handleOut = () => {
@@ -232,7 +318,7 @@
     type: "warning",
   })
       .then(() => {
-        batchDeleteStockInRecords(ids)
+        batchDeletePendingStockInRecords(ids)
             .then(() => {
               proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
               getList();

--
Gitblit v1.9.3