From ee3c7675eade6cf70de72c6448bc561c49d2f489 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 29 六月 2026 17:08:52 +0800
Subject: [PATCH] 新疆大罗素 1.库存管理页面、采购台账新增/编辑弹窗、入库记录页面添加库位字段

---
 src/views/inventoryManagement/stockManagement/New.vue              |   66 +++++++++++++++++++++
 src/views/procurementManagement/procurementLedger/index.vue        |   96 ++++++++++++++++++++++++++++++++
 src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue |    1 
 src/views/inventoryManagement/stockManagement/Record.vue           |    3 +
 4 files changed, 165 insertions(+), 1 deletions(-)

diff --git a/src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue b/src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue
index a835ef4..f37c639 100644
--- a/src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue
+++ b/src/views/inventoryManagement/stockManagement/BatchNoQtyDetail.vue
@@ -24,6 +24,7 @@
           <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="warehouse" show-overflow-tooltip />
           <el-table-column
             label="鍚堟牸搴撳瓨鏁伴噺"
             prop="qualifiedQuantity"
diff --git a/src/views/inventoryManagement/stockManagement/New.vue b/src/views/inventoryManagement/stockManagement/New.vue
index 7854e8e..b457019 100644
--- a/src/views/inventoryManagement/stockManagement/New.vue
+++ b/src/views/inventoryManagement/stockManagement/New.vue
@@ -123,6 +123,32 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="閫夋嫨璁惧"
+                          prop="deviceId">
+              <el-select v-model="formState.deviceId"
+                         placeholder="璇烽�夋嫨璁惧"
+                         filterable
+                         clearable
+                         style="width: 100%"
+                         @change="handleDeviceChange">
+                <el-option v-for="device in iotDeviceList"
+                           :key="device.id"
+                           :label="device.deviceName"
+                           :value="device.id" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="搴撲綅"
+                          prop="storageLocation">
+              <el-input v-model="formState.storageLocation"
+                        placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄨ幏鍙�"
+                        disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
         <el-form-item label="澶囨敞"
                       prop="remark">
           <el-input v-model="formState.remark"
@@ -146,10 +172,11 @@
 </template>
 
 <script setup>
-  import { ref, computed, watch, getCurrentInstance } from "vue";
+  import { ref, computed, watch, getCurrentInstance, onMounted } from "vue";
   import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
   import { addStockInRecordOnly } from "@/api/inventoryManagement/stockInventory.js";
   import { createStockUnInventory } from "@/api/inventoryManagement/stockUninventory.js";
+  import { getLedgerPage } from "@/api/equipmentManagement/ledger.js";
 
   const props = defineProps({
     visible: {
@@ -180,7 +207,12 @@
     remark: "",
     needInspect: false,
     inspectType: 0,
+    deviceId: "",
+    storageLocation: "",
   });
+
+  // IoT璁惧鍒楄〃
+  const iotDeviceList = ref([]);
 
   const isShow = computed({
     get() {
@@ -221,6 +253,8 @@
       remark: "",
       needInspect: false,
       inspectType: 0,
+      deviceId: "",
+      storageLocation: "",
     };
     isShow.value = false;
   };
@@ -240,6 +274,36 @@
     }
   };
 
+  // 鑾峰彇IoT璁惧鍒楄〃
+  const getIotDeviceList = async () => {
+    try {
+      const res = await getLedgerPage({
+        isIotDevice: 1,
+        page: 1,
+        size: 999,
+      });
+      if (res.data && res.data.records) {
+        iotDeviceList.value = res.data.records;
+      }
+    } catch (error) {
+      console.error("鑾峰彇IoT璁惧鍒楄〃澶辫触:", error);
+    }
+  };
+
+  // 璁惧閫夋嫨鍙樻洿鏃讹紝鑷姩濉厖搴撲綅
+  const handleDeviceChange = (deviceId) => {
+    const device = iotDeviceList.value.find(d => d.id === deviceId);
+    if (device) {
+      formState.value.storageLocation = device.storageLocation || '';
+    } else {
+      formState.value.storageLocation = '';
+    }
+  };
+
+  onMounted(() => {
+    getIotDeviceList();
+  });
+
   const handleSubmit = () => {
     proxy.$refs["formRef"].validate(valid => {
       if (valid) {
diff --git a/src/views/inventoryManagement/stockManagement/Record.vue b/src/views/inventoryManagement/stockManagement/Record.vue
index 1263dad..b25c570 100644
--- a/src/views/inventoryManagement/stockManagement/Record.vue
+++ b/src/views/inventoryManagement/stockManagement/Record.vue
@@ -87,6 +87,9 @@
         <el-table-column label="鎵瑰彿"
                          prop="batchNo"
                          show-overflow-tooltip />
+        <el-table-column label="搴撲綅"
+                         prop="warehouse"
+                         show-overflow-tooltip />
         <el-table-column label="鐗╄仈璁惧"
                          prop="warehouse"
                          show-overflow-tooltip
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 495f159..12b8f5a 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -587,6 +587,35 @@
               </el-tag>
             </template>
           </el-table-column>
+          <el-table-column label="閫夋嫨璁惧"
+                           prop="deviceId"
+                           width="150">
+            <template #default="scope">
+              <span v-if="scope.row.productType === 2">--</span>
+              <el-select v-else
+                         v-model="scope.row.deviceId"
+                         placeholder="璇烽�夋嫨璁惧"
+                         filterable
+                         clearable
+                         @change="handleDeviceChange(scope.row, scope.$index)">
+                <el-option v-for="device in iotDeviceList"
+                           :key="device.id"
+                           :label="device.deviceName"
+                           :value="device.id" />
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column label="搴撲綅"
+                           prop="storageLocation"
+                           width="120">
+            <template #default="scope">
+              <span v-if="scope.row.productType === 2">--</span>
+              <el-input v-else
+                        v-model="scope.row.storageLocation"
+                        placeholder="鑷姩鑾峰彇"
+                        disabled />
+            </template>
+          </el-table-column>
           <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
                            prop="stockInApprovalStatus"
                            width="120">
@@ -853,6 +882,32 @@
         </el-row>
         <el-row :gutter="30" v-if="productForm.productType !== 2">
           <el-col :span="12">
+            <el-form-item label="閫夋嫨璁惧锛�"
+                          prop="deviceId">
+              <el-select v-model="productForm.deviceId"
+                         placeholder="璇烽�夋嫨璁惧"
+                         filterable
+                         clearable
+                         style="width: 100%"
+                         @change="handleProductDeviceChange">
+                <el-option v-for="device in iotDeviceList"
+                           :key="device.id"
+                           :label="device.deviceName"
+                           :value="device.id" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="搴撲綅锛�"
+                          prop="storageLocation">
+              <el-input v-model="productForm.storageLocation"
+                        placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄨ幏鍙�"
+                        disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30" v-if="productForm.productType !== 2">
+          <el-col :span="12">
             <el-form-item label="鏄惁璐ㄦ锛�"
                           prop="isChecked">
               <el-radio-group v-model="productForm.isChecked">
@@ -950,6 +1005,7 @@
   const salesContractList = ref([]);
   const supplierList = ref([]);
   const contractList = ref([]); // 渚涘簲鍟嗗悎鍚屽垪琛�
+  const iotDeviceList = ref([]); // IoT璁惧鍒楄〃
   const contractFileDialogVisible = ref(false);
   const contractFileList = ref([]);
   const tableLoading = ref(false);
@@ -965,6 +1021,7 @@
   import { modelList, productTreeList } from "@/api/basicData/product.js";
   import { getSparePartsList } from "@/api/equipmentManagement/spareParts.js";
   import { getSupplierContractList, getSupplierContractFilesByNo } from "@/api/basicData/supplierContract.js";
+  import { getLedgerPage } from "@/api/equipmentManagement/ledger.js";
   import dayjs from "dayjs";
   import FileUpload from "@/components/AttachmentUpload/file/index.vue";
 
@@ -1185,6 +1242,8 @@
       invoiceType: "",
       warnNum: "",
       isChecked: false,
+      deviceId: "",
+      storageLocation: "",
     },
     productRules: {
       productId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -2284,6 +2343,42 @@
     }
   };
 
+  // 鑾峰彇IoT璁惧鍒楄〃
+  const getIotDeviceList = async () => {
+    try {
+      const res = await getLedgerPage({
+        isIotDevice: 1,
+        page: 1,
+        size: 999,
+      });
+      if (res.data && res.data.records) {
+        iotDeviceList.value = res.data.records;
+      }
+    } catch (error) {
+      console.error("鑾峰彇IoT璁惧鍒楄〃澶辫触:", error);
+    }
+  };
+
+  // 璁惧閫夋嫨鍙樻洿鏃讹紝鑷姩濉厖搴撲綅
+  const handleDeviceChange = (row, index) => {
+    const device = iotDeviceList.value.find(d => d.id === row.deviceId);
+    if (device) {
+      row.storageLocation = device.storageLocation || '';
+    } else {
+      row.storageLocation = '';
+    }
+  };
+
+  // 浜у搧寮圭獥涓澶囬�夋嫨鍙樻洿鏃讹紝鑷姩濉厖搴撲綅
+  const handleProductDeviceChange = (deviceId) => {
+    const device = iotDeviceList.value.find(d => d.id === deviceId);
+    if (device) {
+      productForm.value.storageLocation = device.storageLocation || '';
+    } else {
+      productForm.value.storageLocation = '';
+    }
+  };
+
   // 鏍煎紡鍖栨枃浠跺ぇ灏�
   const formatFileSize = (bytes) => {
     if (!bytes) return '0 B';
@@ -2296,6 +2391,7 @@
   onMounted(() => {
     getList();
     getTemplateList();
+    getIotDeviceList();
   });
 </script>
 

--
Gitblit v1.9.3