heyang 6 ay önce
ebeveyn
işleme
c388aa14c4

+ 75 - 24
src/views/chemicalManage/basicManagement/chemicalsCabinetManage/addPage.vue

@@ -13,26 +13,48 @@
             <el-input v-model="newData.cabinetName" placeholder="请输入化学品柜名称" maxLength="20" style="width:500px;"></el-input>
           </el-form-item>
           <el-form-item label="学院:" prop="deptId">
-            <el-select v-model="newData.deptId" @change="deptChange" placeholder="请选择所属学院" style="width: 500px">
+            <el-select
+              v-model="newData.deptId"
+              filterable
+              remote
+              clearable
+              reserve-keyword
+              @change="(val)=>deptChange()"
+              @clear="deptClearClick"
+              placeholder="请选择所属学院"
+              style="width: 500px"
+              :remote-method="(val)=>deptSelect(val)">
               <el-option
                 v-for="item in deptOptions"
                 :key="item.deptId"
                 :label="item.deptName"
-                :value="item.deptId"
-              />
+                :value="item.deptId">
+              </el-option>
             </el-select>
+
           </el-form-item>
         </div>
         <div class="form-max-box">
           <el-form-item label="实验室:" prop="subId">
-            <el-select v-model="newData.subId" @change="subChange" placeholder="请选择实验室" style="width: 500px">
+            <el-select
+              v-model="newData.subId"
+              filterable
+              remote
+              clearable
+              reserve-keyword
+              @change="(val)=>subChange()"
+              @clear="subClearClick"
+              placeholder="请选择实验室"
+              style="width: 500px"
+              :remote-method="(val)=>subSelect(val)">
               <el-option
                 v-for="item in subOptions"
                 :key="item.subId"
                 :label="item.subName"
-                :value="item.subId"
-              />
+                :value="item.subId">
+              </el-option>
             </el-select>
+
           </el-form-item>
           <!--<el-form-item label="摄像头:" prop="cameraId">-->
             <!--<el-select v-model="newData.cameraId" placeholder="请选择摄像头" style="width: 500px">-->
@@ -173,7 +195,11 @@
 
 <script>
   import { getDeptDropList, systemUserSelect,iotDeviceFindByType } from '@/api/commonality/permission'
-  import { laboratorySubRelInfoGetRelList } from '@/api/commonality/noPermission'
+  import {
+    laboratorySubRelInfoGetRelList,
+    laboratorySubRelInfoList,
+    systemSubjectGetList
+  } from '@/api/commonality/noPermission'
   import {
     chemicalCabinetAdd, chemicalCabinetGetLockList,
     chemicalCabinetUpdate,
@@ -312,7 +338,6 @@
     mounted(){
       let self=this;
       this.initialize();
-      this.getDeptDropList();
 
 
     },
@@ -471,12 +496,7 @@
           }
         });
       },
-      //查询学院列表
-      getDeptDropList(){
-        getDeptDropList({deptName:"",level:2,deptType:1}).then(response => {
-          this.$set(this, 'deptOptions', response.data)
-        });
-      },
+
       //学院选中
       deptChange(){
         this.$set(this.newData,'subId','');
@@ -495,19 +515,30 @@
             this.$set(this.newData, 'deptName', this.deptOptions[i].deptName)
           }
         }
-        this.laboratorySubRelInfoGetRelList(this.newData.deptId,'');
+        console.log(2222222222)
+        this.subSelect('');
       },
-      //根据学院id查询实验室列表
-      laboratorySubRelInfoGetRelList(deptId,subId){
-        let obj = {
-          deptId:deptId,
-          subId:subId,
-          subName:'',
+      //学院清空触发
+      deptClearClick(){
+      },
+      //学院查询
+      deptSelect(query){
+        if (query !== '') {
+          let obj = {
+            level:'2',
+            deptType:'1',
+            deptName:query,
+          }
+          getDeptDropList(obj).then(response => {
+            this.$set(this, 'deptOptions', response.data)
+          });
+        } else {
+          this.deptOptions = [];
         }
-        laboratorySubRelInfoGetRelList(obj).then(response => {
-          this.subOptions = response.data;
-        });
       },
+
+
+
       //实验室选中
       subChange(val){
         let list = [];
@@ -557,6 +588,26 @@
         })
         this.iotDeviceFindByType(this.newData.subId);
       },
+      //实验室清空触发
+      subClearClick(){
+      },
+      //实验室查询
+      subSelect(query){
+        console.log(33)
+        let obj = {
+          deptId:this.newData.deptId,
+          subId:'',
+          searchValue:query,
+        }
+        laboratorySubRelInfoGetRelList(obj).then(response => {
+          this.subOptions = response.data;
+        });
+      /*   if (query !== '') {
+
+        } else {
+          this.subOptions = [];
+        } */
+      },
       //人员选中触发
       userSelectClick(val,index){
         let self = this;