From bfb838d1c3aba72fe6b3de37f065902279a7d40c Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期四, 06 三月 2025 08:30:56 +0800
Subject: [PATCH] 需求新增

---
 src/views/hazardousChemicals/warehouseManage/components/productTable.vue |   89 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 85 insertions(+), 4 deletions(-)

diff --git a/src/views/hazardousChemicals/warehouseManage/components/productTable.vue b/src/views/hazardousChemicals/warehouseManage/components/productTable.vue
index 16bb840..c6854c4 100644
--- a/src/views/hazardousChemicals/warehouseManage/components/productTable.vue
+++ b/src/views/hazardousChemicals/warehouseManage/components/productTable.vue
@@ -16,6 +16,42 @@
         <el-form-item label="产品编号:" >
           <el-input v-model="data.queryParams.params.productSn" placeholder="请输入产品编号" clearable></el-input>
         </el-form-item>
+        <el-form-item label="仓库:" prop="warehouseName" >
+          <el-select
+              clearable
+              v-model="data.queryParams.params.warehouseName"
+              filterable
+              remote
+              reserve-keyword
+              placeholder="请输入所入仓库"
+              remote-show-suffix
+              :remote-method="getWareHouseList"
+              style="width: 100%"
+              @change="selectWareValue"
+          >
+            <el-option
+                v-for="item in data.wareHouseList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.name"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="存储柜:" prop="cupboardId" >
+          <el-select
+              clearable
+              v-model="data.queryParams.params.cupboardId"
+              placeholder="请选择存储柜"
+              style="width: 100%"
+          >
+            <el-option
+                v-for="item in data.cupList"
+                :key="item.id"
+                :label="item.cupboardName"
+                :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
         <el-form-item >
           <el-button
               type="primary"
@@ -84,7 +120,7 @@
 import {ElMessage, ElMessageBox} from "element-plus";
 import proDialog from "./addProDialog.vue";
 import printcode from './printCode.vue'
-import {delWarehouse, getWarehouse} from "@/api/hazardousChemicals/warehouse";
+import {delWarehouse, getCupById, getWarehouse} from "@/api/hazardousChemicals/warehouse";
 import {
   delProductRecord,
   doEntryPro,
@@ -105,17 +141,22 @@
     pageSize: 10,
     params :{
       name: '',
-      productSn: ''
+      productSn: '',
+      cupboardId: null,
+      warehouseId: null
     }
   },
   total: 0,
-  dataList: []
+  dataList: [],
+  wareHouseList: [],
+  cupList: []
 });
 
 const { queryParams, total, dataList } = toRefs(data);
 const classHourRef = ref();
 onMounted(()=>{
   getList()
+  getWareHouseList("")
 })
 
 const getList = async () => {
@@ -141,10 +182,14 @@
     pageSize: 10,
     params :{
       name: '',
-      productSn: ''
+      productSn: '',
+      cupboardId: null,
+      warehouseId: null
     }
   }
+  data.cupList = []
   getList()
+  getWareHouseList("")
 }
 const handleDelete = (val) => {
   ElMessageBox.confirm(
@@ -198,6 +243,42 @@
   const v = JSON.stringify(obj)
   router.push({ path: "/whProDetail", query: { val: v } });
 }
+const getWareHouseList = async (val) => {
+  let param = {}
+  if(val != ""){
+    param = {
+      name: val
+    }
+  }else {
+    param = {
+      pageNum: 1,
+      pageSize: 10
+    }
+  }
+  const res = await getWarehouse(param)
+  if(res.code == 200){
+    data.wareHouseList = res.data.list
+  }else{
+    ElMessage.warning(res.message)
+  }
+}
+const selectWareValue = (val) => {
+  data.queryParams.params.cupboardId = null
+  data.wareHouseList.forEach(item => {
+    if(item.name === val){
+      data.queryParams.params.warehouseId = item.id
+      getCupList(item.id)
+    }
+  })
+}
+const getCupList = async (val) => {
+  const res = await getCupById(val)
+  if(res.code == 200) {
+    data.cupList = res.data
+  }else {
+    ElMessage.warning(res.message)
+  }
+}
 
 defineExpose({
   getList

--
Gitblit v1.9.2