From 36b909e117c3ccc22dd266a94479e2a02335d261 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 26 三月 2026 18:03:34 +0800
Subject: [PATCH] 军泰伟业 1.生产订单新增编辑逻辑重写

---
 src/views/inventoryManagement/receiptManagement/Record.vue |   99 +++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 83 insertions(+), 16 deletions(-)

diff --git a/src/views/inventoryManagement/receiptManagement/Record.vue b/src/views/inventoryManagement/receiptManagement/Record.vue
index 3000a8e..b85e79b 100644
--- a/src/views/inventoryManagement/receiptManagement/Record.vue
+++ b/src/views/inventoryManagement/receiptManagement/Record.vue
@@ -22,13 +22,22 @@
                   clearable>
           <el-option v-for="item in stockRecordTypeOptions"
                      :key="item.value"
-                     :label="item.value"
-                     :value="item.key"/>
+                     :label="item.label"
+                     :value="item.value"/>
+        </el-select>
+        <span class="search_title ml10">璐ㄦ鐘舵�侊細</span>
+        <el-select v-model="searchForm.type"
+                  style="width: 240px"
+                  placeholder="璇烽�夋嫨"
+                  clearable>
+          <el-option label="鍚堟牸" :value="0" />
+          <el-option label="涓嶅悎鏍�" :value="1" />
         </el-select>
         <el-button type="primary"
                    @click="handleQuery"
                    style="margin-left: 10px">鎼滅储
         </el-button>
+        <el-button @click="handleReset">閲嶇疆</el-button>
       </div>
       <div>
         <el-button @click="handleOut">瀵煎嚭</el-button>
@@ -64,7 +73,7 @@
         <el-table-column label="浜у搧澶х被"
                          prop="productName"
                          show-overflow-tooltip/>
-        <el-table-column label="瑙勬牸鍨嬪彿"
+        <el-table-column label="鍥剧焊缂栧彿"
                          prop="model"
                          show-overflow-tooltip/>
         <el-table-column label="鍗曚綅"
@@ -72,6 +81,19 @@
                          show-overflow-tooltip/>
         <el-table-column label="鍏ュ簱鏁伴噺"
                          prop="stockInNum"
+                         show-overflow-tooltip/>
+        <el-table-column label="璐ㄦ鐘舵��"
+                         prop="type"
+                         show-overflow-tooltip
+                         width="100">
+          <template #default="scope">
+            <el-tag :type="scope.row.type == 0 ? 'success' : 'danger'" size="small">
+              {{ scope.row.type == 0 ? '鍚堟牸' : '涓嶅悎鏍�' }}
+            </el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="搴撲綅"
+                         prop="locationName"
                          show-overflow-tooltip/>
         <el-table-column label="鍏ュ簱浜�"
                          prop="createBy"
@@ -102,21 +124,24 @@
   toRefs,
   onMounted,
   getCurrentInstance,
+  watch,
 } from "vue";
 import {ElMessageBox} from "element-plus";
 import {
   getStockInRecordListPage,
   batchDeleteStockInRecords,
 } from "@/api/inventoryManagement/stockInRecord.js";
-import {findAllStockRecordTypeOptions} from "@/api/basicData/enum.js";
+import {
+  findAllQualifiedStockInRecordTypeOptions, findAllUnQualifiedStockInRecordTypeOptions,
+} from "@/api/basicData/enum.js";
 
 const {proxy} = getCurrentInstance();
 
 const props = defineProps({
   type: {
-    type: String,
+    type: Number,
     required: true,
-    default: '0'
+    default: 1
   }
 })
 
@@ -127,7 +152,7 @@
 const stockRecordTypeOptions = ref([]);
 const page = reactive({
   current: 1,
-  size: 100,
+  size: 10,
 });
 const total = ref(0);
 
@@ -136,9 +161,11 @@
     productName: "",
     timeStr: "",
     recordType: "",
+    type: "",
   },
 });
 const {searchForm} = toRefs(data);
+
 // 鏌ヨ鍒楄〃
 /** 鎼滅储鎸夐挳鎿嶄綔 */
 const handleQuery = () => {
@@ -146,8 +173,17 @@
   getList();
 };
 
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const handleReset = () => {
+  searchForm.value.productName = "";
+  searchForm.value.timeStr = "";
+  searchForm.value.recordType = "";
+  searchForm.value.type = "";
+  handleQuery();
+};
+
 const getRecordType = (recordType) => {
-  return stockRecordTypeOptions.value.find(item => item.key === recordType)?.value || ''
+  return stockRecordTypeOptions.value.find(item => item.value === recordType)?.label || ''
 }
 
 const pageProductChange = obj => {
@@ -158,12 +194,17 @@
 
 const getList = () => {
   tableLoading.value = true;
-  const params = {...page, type: props.type};
+  const params = {...page, productType: props.type};
   params.timeStr = searchForm.value.timeStr;
   params.productName = searchForm.value.productName;
+  params.recordType = searchForm.value.recordType;
+  if (searchForm.value.type !== "") {
+    params.type = searchForm.value.type;
+  }
   getStockInRecordListPage(params)
       .then(res => {
         tableData.value = res.data.records;
+        total.value = res.data.total || 0;
       }).finally(() => {
     tableLoading.value = false;
   })
@@ -171,10 +212,27 @@
 
 // 鑾峰彇鏉ユ簮绫诲瀷閫夐」
 const fetchStockRecordTypeOptions = () => {
-  findAllStockRecordTypeOptions()
-      .then(res => {
-        stockRecordTypeOptions.value = res.data;
-      })
+  Promise.all([
+    findAllQualifiedStockInRecordTypeOptions(),
+    findAllUnQualifiedStockInRecordTypeOptions()
+  ])
+    .then(([qualifiedRes, unQualifiedRes]) => {
+      const qualifiedData = qualifiedRes.data || [];
+      const unQualifiedData = unQualifiedRes.data || [];
+      const allData = [...qualifiedData, ...unQualifiedData];
+      const uniqueData = [];
+      const valueSet = new Set();
+      allData.forEach(item => {
+        if (!valueSet.has(item.value)) {
+          valueSet.add(item.value);
+          uniqueData.push(item);
+        }
+      });
+      stockRecordTypeOptions.value = uniqueData;
+    })
+    .catch(() => {
+      stockRecordTypeOptions.value = [];
+    });
 }
 
 // 琛ㄦ牸閫夋嫨鏁版嵁
@@ -192,9 +250,12 @@
     type: "warning",
   })
       .then(() => {
-        // 鏍规嵁涓嶅悓鐨� tab 绫诲瀷璋冪敤涓嶅悓鐨勫鍑烘帴鍙�
-        let exportUrl = "/stockin/export";
-        proxy.download(exportUrl, {}, "鍏ュ簱鍙拌处.xlsx");
+        const fileNameMap = {
+          1: '鑷埗鍏ュ簱.xlsx',
+          2: '澶栬喘鍏ュ簱.xlsx',
+          3: '濮斿鍏ュ簱.xlsx'
+        };
+        proxy.download("/stockInRecord/exportStockInRecord", {productType: props.type}, fileNameMap[props.type] || '鍏ュ簱.xlsx');
       })
       .catch(() => {
         proxy.$modal.msg("宸插彇娑�");
@@ -233,6 +294,12 @@
   getList();
   fetchStockRecordTypeOptions();
 });
+
+watch(() => props.type, () => {
+  page.current = 1;
+  getList();
+  fetchStockRecordTypeOptions();
+});
 </script>
 
 <style scoped lang="scss"></style>

--
Gitblit v1.9.3