From 0bc2784f60f30108cf6fa133b774703bda861721 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期四, 13 二月 2025 16:56:35 +0800
Subject: [PATCH] 特性、分类信息等修改

---
 src/views/hazardousChemicals/warehouseManage/components/addProDialog.vue |   39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/views/hazardousChemicals/warehouseManage/components/addProDialog.vue b/src/views/hazardousChemicals/warehouseManage/components/addProDialog.vue
index 3a5451c..31c6a3d 100644
--- a/src/views/hazardousChemicals/warehouseManage/components/addProDialog.vue
+++ b/src/views/hazardousChemicals/warehouseManage/components/addProDialog.vue
@@ -51,6 +51,20 @@
             />
           </el-select>
         </el-form-item>
+        <el-form-item label="存储柜:" prop="cupboardId" >
+          <el-select
+              v-model="state.form.cupboardId"
+              placeholder="请选择存储柜"
+              style="width: 100%"
+          >
+            <el-option
+                v-for="item in state.cupList"
+                :key="item.id"
+                :label="item.cupboardName"
+                :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
         <el-form-item label="数量:" prop="num" >
           <el-input v-model.trim="state.form.num" oninput="value=value.replace(/^\.+|[^\d]/g,'')" placeholder="请输入最小包装数量" @input="changeNum"></el-input>
         </el-form-item>
@@ -73,7 +87,7 @@
 <script setup>
 import {reactive, ref, toRefs} from 'vue'
 import {ElMessage} from "element-plus";
-import {getWarehouse} from "@/api/hazardousChemicals/warehouse";
+import {getCupById, getWarehouse} from "@/api/hazardousChemicals/warehouse";
 import {addProductRecord, editProductRecord, getProductRecord} from "@/api/hazardousChemicals/productRecord";
 import {getFinishBasicList} from "@/api/hazardousChemicals/finishedBasicInfo";
 import moment from "moment";
@@ -105,13 +119,16 @@
     warehouseName: '',
     warehouseId: null,
     num: null,
-    batchNo: ''
+    batchNo: '',
+    cupboardName: '',
+    cupboardId: null,
 
   },
   formRules:{
     num: [{ required: true, trigger: "blur", validator: validateNum }],
     warehouseName: [{ required: true, trigger: "blur", message: '请选择入库仓库' }],
     basicName: [{ required: true, trigger: "blur", message: '请选择入库成品' }],
+    cupboardId: [{ required: true, trigger: "blur", message: '请选择存储柜' }]
     // batchNo: [{ required: true, trigger: "blur", message: '请输入批号' }]
   },
   proList: [],
@@ -126,7 +143,9 @@
   state.form.batchNo = moment(new Date()).format("YYYYMMDD")
   title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑':'' ;
   if(type === 'edit' ) {
-    state.form = value;
+    await getCupList(value.warehouseId)
+    state.form = JSON.parse(JSON.stringify(value));
+    state.form.cupboardId = state.form.cupboard && state.form.cupboard.id ?state.form.cupboard.id : null
     state.form.basicName = value.productBasic.name + '—' + value.productBasic.productSn + ' (' + value.productBasic.metering +value.productBasic.unit+') '
     state.form.warehouseName = value.warehouse.name;
     choosePro.value = value.productBasic
@@ -238,13 +257,23 @@
   state.message = `您将入库 { ${choosePro.value.name.substring(0,choosePro.value.name.lastIndexOf('—'))    } },编号:{ ${choosePro.value.productSn} },最小包装${choosePro.value.metering}${choosePro.value.unit},类别:${minPackageType}。 \n 共计:${state.form.num}${minPackageType}`
 }
 const selectWareValue = (val) => {
+  state.form.cupboardId = null
   state.wareHouseList.forEach(item => {
     if(item.name === val){
       state.form.warehouseId = item.id
+      getCupList(item.id)
     }
   })
 }
 
+const getCupList = async (val) => {
+  const res = await getCupById(val)
+  if(res.code == 200) {
+    state.cupList = res.data
+  }else {
+    ElMessage.warning(res.message)
+  }
+}
 const handleClose = () => {
   busRef.value.clearValidate();
   reset();
@@ -259,7 +288,9 @@
     warehouseName: '',
     warehouseId: null,
     num: null,
-    batchNo: ''
+    batchNo: '',
+    cupboardName: '',
+    cupboardId: null,
   }
   state.proList = [];
   state.wareHouseList = [];

--
Gitblit v1.9.2