Преглед на файлове

联锁条件修改时设置默认值

yuhan преди 2 месеца
родител
ревизия
1cb62ef97c
променени са 1 файла, в които са добавени 18 реда и са изтрити 8 реда
  1. 18 8
      src/views/module_interLock/interlockSummarySet/InterlockConditionForm.vue

+ 18 - 8
src/views/module_interLock/interlockSummarySet/InterlockConditionForm.vue

@@ -141,13 +141,13 @@
             </a-col>
             <a-col :span="24">
               <a-form-model-item label="高限值" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="upperLimitGd">
-                <a-auto-complete :data-source="upperLimitGdDefault" v-model="model.upperLimitGd" :filter-option="filterOption" placeholder="请输入高限"></a-auto-complete>
+                <a-auto-complete :data-source="upperLimitGdDefault" v-model="model.upperLimitGd" :filter-option="filterOption" placeholder="请输入高限" @change="instrumentStatusChange"></a-auto-complete>
                 <!-- <a-input v-model="model.upperLimitGd" placeholder="请输入高限"></a-input> -->
               </a-form-model-item>
             </a-col>
             <a-col :span="24">
               <a-form-model-item label="低限值" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lowerLimitGd">
-                <a-auto-complete :data-source="lowerLimitGdDefault" v-model="model.lowerLimitGd" :filter-option="filterOption" placeholder="请输入低限"></a-auto-complete>
+                <a-auto-complete :data-source="lowerLimitGdDefault" v-model="model.lowerLimitGd" :filter-option="filterOption" placeholder="请输入低限" @change="instrumentStatusChange"></a-auto-complete>
                 <!-- <a-input v-model="model.lowerLimitGd" placeholder="请输入低限"></a-input> -->
               </a-form-model-item>
             </a-col>
@@ -169,17 +169,17 @@
                 <div style="display: flex;">
                   <div style="width: 30px;text-align: center;">( </div>
                   <a-form-model-item prop="upperLimitTb">
-                    <a-auto-complete :data-source="upperLimitTbDefault" v-model="model.upperLimitTb" :filter-option="filterOption" placeholder="请输入高限"></a-auto-complete>
+                    <a-auto-complete :data-source="upperLimitTbDefault" v-model="model.upperLimitTb" :filter-option="filterOption" placeholder="请输入高限" @change="instrumentStatusChange"></a-auto-complete>
                     <!-- <a-input v-model="model.upperLimitTb" placeholder="请输入高限"></a-input> -->
                   </a-form-model-item>
                   <div style="width: 30px;text-align: center;"> - </div>
                   <a-form-model-item prop="lowerLimitTb">
-                    <a-auto-complete :data-source="lowerLimitTbDefault" v-model="model.lowerLimitTb" :filter-option="filterOption" placeholder="请输入低限"></a-auto-complete>
+                    <a-auto-complete :data-source="lowerLimitTbDefault" v-model="model.lowerLimitTb" :filter-option="filterOption" placeholder="请输入低限" @change="instrumentStatusChange"></a-auto-complete>
                     <!-- <a-input v-model="model.lowerLimitTb" placeholder="请输入低限"></a-input> -->
                   </a-form-model-item>
                   <div style="width: 60px;text-align: center;">)* </div>
                   <a-form-model-item prop="thresholdValueN">
-                    <a-auto-complete :data-source="['1']" v-model="model.thresholdValueN" :filter-option="filterOption" placeholder="请输入阈值"></a-auto-complete>
+                    <a-auto-complete :data-source="['1']" v-model="model.thresholdValueN" :filter-option="filterOption" placeholder="请输入阈值" @change="instrumentStatusChange"></a-auto-complete>
                     <!-- <a-input v-model="model.thresholdValueN" placeholder="请输入阈值"></a-input> -->
                   </a-form-model-item>
                   <div style="width: 30px;text-align: center;"> % </div>
@@ -391,6 +391,9 @@
         // this.$set(this.model, 'inputStatusRadio', e.target.value)
         this.model = {...this.model}
       },
+      instrumentStatusChange(){
+        this.model = {...this.model}
+      },
       // 设置状态默认值和初始化值
       setDefaultValue(){
         // this.$set(this.model, 'inputStatusDefault', this.itSystemDefaultValue.controlSystemStatusNormal)
@@ -424,7 +427,7 @@
         })
         // this.model.bypassNo = this.itSystemDefaultValue.bypassYesName +'('+ this.itSystemDefaultValue.bypassYes +')'
         // 初始化
-        this.model.thresholdValueN = '1'
+        // this.model.thresholdValueN = '1'
       },
       // 过滤
       filterOption(input, option) {
@@ -457,6 +460,7 @@
         this.model.lowerLimitGd = this.itSystemDefaultValue.systemType === '0' ? '737' : '10722'
         this.model.upperLimitTb = this.itSystemDefaultValue.systemType === '0' ? '4095' : '59577'
         this.model.lowerLimitTb = this.itSystemDefaultValue.systemType === '0' ? '819' : '11915'
+        this.model.thresholdValueN = '1'
         // 设置状态默认值
         this.setDefaultValue()
       },
@@ -478,13 +482,19 @@
           // 高低限赋值--依据转换后还保持刚刚的选择
           this.model.upperLimitGd = record.upperLimit
           this.model.lowerLimitGd = record.lowerLimit
-        }
-        if(this.model.instrumentStatusJuge === '2'){
+        }else if(this.model.instrumentStatusJuge === '2'){
           this.model.upperLimitTb = record.upperLimit
           this.model.lowerLimitTb = record.lowerLimit
           // 仪表状态-阈值Math.round解决相乘会出现很多小数的情况
           this.model.thresholdValueN = Math.round(parseInt(record.thresholdValue)*100)
           // this.model.thresholdValueN = (parseInt(record.thresholdValue)*100).toFixed(0)
+        } else {
+          // 当前为默认状态或者位号读取时,赋默认值
+          this.model.upperLimitGd = this.itSystemDefaultValue.systemType === '0' ? '4258' : '61948'
+          this.model.lowerLimitGd = this.itSystemDefaultValue.systemType === '0' ? '737' : '10722'
+          this.model.upperLimitTb = this.itSystemDefaultValue.systemType === '0' ? '4095' : '59577'
+          this.model.lowerLimitTb = this.itSystemDefaultValue.systemType === '0' ? '819' : '11915'
+          this.model.thresholdValueN = '1'
         }
         // 当前值
         // this.model.currentValueData = [record.currentValueDeviceId, record.currentValueModuleName, record.currentValueTag+'&'+record.currentValue]