heyang %!s(int64=2) %!d(string=hai) anos
pai
achega
ac68dac8e1

+ 15 - 1
src/views/comprehensive/laboratoryManagement/subject/addSubject.vue

@@ -86,7 +86,7 @@
         />
       </el-form-item>
       <el-form-item label="准入设备"  class="form-item">
-        <el-select v-model="form.hardwareType" placeholder="请选择整改类型" style="width:230px;">
+        <el-select v-model="form.hardwareType" placeholder="请选择整改类型" style="width:230px;" @change="hardwareTypeFun()">
           <el-option label="无"  :value="0" />
           <el-option label="海康智能门禁" :value="1" />
           <el-option label="电子信息牌" :value="2" />
@@ -215,6 +215,7 @@
             details:"",
             hardwareType:0,
           },
+          hardwareTypeTow:0,//临时存储准入设备状态
           // 表单校验
           rules: {
             name:[
@@ -288,6 +289,7 @@
           this.$set(this.form,'floorId',this.subjectData.floorId)
           this.$set(this.form,'room',this.subjectData.room)
           this.$set(this.form,'hardwareType',this.subjectData.hardwareType==null?0:this.subjectData.hardwareType)
+          this.$set(this,'hardwareTypeTow',this.subjectData.hardwareType==null?0:this.subjectData.hardwareType)
           this.$set(this.form,'details',this.subjectData.details)
           this.$refs.UEditor.text=unescape(this.subjectData.details)
           this.$set(this.form,'moldId',this.subjectData.moldId)
@@ -360,6 +362,18 @@
         }
       },
       methods:{
+        hardwareTypeFun(){
+
+          if(this.hardwareTypeTow==1 && this.subjectData.cardInfoCount>0){
+            this.msgError("删除现有准入设备后,才能更改准入设备类型!");
+            this.form.hardwareType=this.hardwareTypeTow
+          }else if(this.hardwareTypeTow==2 && this.subjectData.hKCount>0){
+            this.msgError("删除现有准入设备后,才能更改准入设备类型!");
+            this.form.hardwareType=this.hardwareTypeTow
+          }else{
+            console.log(this.form.hardwareType)
+          }
+        },
         //获取实验室类型列表
         labMoldQueryOption(){
           labMoldQueryOption({}).then(response => {