From 5612bbd431d10589a06c7ed3584de2cad1b5ea0a Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: Thu, 18 Jun 2026 16:24:31 +0800
Subject: [PATCH] 中科大支线—订单入库

---
 src/views/hazardousChemicals/subscribeApplyManage/subscribe/components/editDialog.vue |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/src/views/hazardousChemicals/subscribeApplyManage/subscribe/components/editDialog.vue b/src/views/hazardousChemicals/subscribeApplyManage/subscribe/components/editDialog.vue
index 0ae5622..0c55b9f 100644
--- a/src/views/hazardousChemicals/subscribeApplyManage/subscribe/components/editDialog.vue
+++ b/src/views/hazardousChemicals/subscribeApplyManage/subscribe/components/editDialog.vue
@@ -13,10 +13,29 @@
           <div style="display: flex;width: 100%;margin-top: 5px">
             <el-table :data="state.form.subscribeHazmats" :border="true">
               <el-table-column type="index" label="序号" width="80" align="center"></el-table-column>
-              <el-table-column label="危化品名称" align="center"  >
+              <el-table-column label="危化品名称" align="center" width="200"  >
                 <template #default="{row,$index}">
                   <el-form-item :prop="'subscribeHazmats.' + '[' + $index + ']' + '.hazmatName'" :rules="state.formRules.hazmatName">
-                    <el-input type="textarea" :rows="1" v-model="row.hazmatName" placeholder="请输入危化品名称"></el-input>
+                    <el-select
+                        clearable
+                        v-model="row.hazmatName"
+                        filterable
+                        remote
+                        @change="selectValueHazmat(row.hazmatName,$index)"
+                        reserve-keyword
+                        placeholder="请输入危化品名称"
+                        remote-show-suffix
+                        :remote-method="getHazmaList"
+                        style="width: 100%"
+                    >
+                      <el-option
+                          v-for="item in state.hazmatList"
+                          :key="item.id"
+                          :label="item.name"
+                          :value="item.name"
+                      />
+                    </el-select>
+<!--                    <el-input type="textarea" :rows="1" v-model="row.hazmatName" placeholder="请输入危化品名称"></el-input>-->
                   </el-form-item>
                 </template>
               </el-table-column>
@@ -95,6 +114,7 @@
 import {getToken} from "@/utils/auth";
 import {renderAsync} from "docx-preview";
 import {addSubscribe, editSubscribe} from "@/api/hazardousChemicals/subscribeApply";
+import {getBasicList} from "@/api/hazardousChemicals/basicInfo";
 
 const dialogVisible = ref(false);
 const title = ref("");
@@ -118,6 +138,7 @@
   },
 
   peopleList:[],
+  hazmatList:[],
   fileList:[],
   uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile',
   header: {
@@ -129,6 +150,7 @@
 
 const openDialog = async (type, value) => {
   await getPeopleList("")
+  await getHazmaList("")
   title.value = type === 'add' ? '申购申请' : type ==='edit' ? '申购编辑' : '查看' ;
   if(type === 'edit' || type === 'view') {
     state.form = JSON.parse(JSON.stringify(value));
@@ -214,6 +236,7 @@
     }
   })
 }
+
 const getPeopleList = async (val)=>{
   let queryParams = {}
   if(val != ""){
@@ -233,6 +256,35 @@
     ElMessage.warning(res.message)
   }
 }
+const selectValueHazmat =  (val,index) => {
+  if(!val){
+    state.form.subscribeHazmats.forEach((item, i) => i === index && (item.basicId = null));
+  }
+  const match = state.hazmatList.find(item => item.name === val);
+  if (match) {
+    state.form.subscribeHazmats[index].basicId = match.id;
+    state.form.subscribeHazmats[index].hazmatName = match.name;
+  }
+}
+const getHazmaList = async (val)=>{
+  let queryParams = {}
+  if(val != ""){
+    queryParams = {
+      name: val
+    }
+  }else {
+    queryParams = {
+      pageNum: 1,
+      pageSize: 10
+    }
+  }
+  const res = await getBasicList(queryParams)
+  if(res.code == 200){
+    state.hazmatList = res.data.list
+  }else{
+    ElMessage.warning(res.message)
+  }
+}
 const handleAvatarSuccess = (res, uploadFile) => {
   if(res.code == 200){
     state.form.fileName = res.data.originName

--
Gitblit v1.9.2