Просмотр исходного кода

级联选择点位修改赋值方式

yuhan месяцев назад: 2
Родитель
Сommit
6e15d249e5

+ 80 - 75
src/views/module_interLock/interlockSummarySet/InterlockConditionForm.vue

@@ -12,10 +12,9 @@
                 :fieldNames="customFieldNames"
                 expand-trigger="hover"
                 placeholder="请选择点位"
-                @change="changeCascader"
+                @change="changeCascaderCondition"
                 />
                 <!-- :display-render="displayRender" -->
-                <!-- @change="dianwerChange" -->
             </a-form-model-item>
           </a-col>
           <a-col :span="24">
@@ -54,7 +53,7 @@
                   :fieldNames="customFieldNames"
                   expand-trigger="hover"
                   placeholder="请选择输入卡件状态"
-                  @change="changeCascader"
+                  @change="changeCascaderInput"
                   />
               </template>
             </a-form-model-item>
@@ -75,7 +74,7 @@
                   :fieldNames="customFieldNames"
                   expand-trigger="hover"
                   placeholder="请选择输出卡件状态"
-                  @change="changeCascader"
+                  @change="changeCascaderOutput"
                 />
               </template>
             </a-form-model-item>
@@ -96,7 +95,7 @@
                   :fieldNames="customFieldNames"
                   expand-trigger="hover"
                   placeholder="请选择MP状态"
-                  @change="changeCascader"
+                  @change="changeCascaderMp"
                 />
               </template>
             </a-form-model-item>
@@ -129,7 +128,7 @@
                   :fieldNames="customFieldNames"
                   expand-trigger="hover"
                   placeholder="请选择仪表位号"
-                  @change="changeCascader"
+                  @change="changeCascaderInstrument"
                 />
               </a-form-model-item>
             </a-col>
@@ -143,7 +142,7 @@
                   :fieldNames="customFieldNames"
                   expand-trigger="hover"
                   placeholder="请选择原始模拟量"
-                  @change="changeCascader"
+                  @change="changeCascaderYsmnl"
                 />
               </a-form-model-item>
             </a-col>
@@ -169,7 +168,7 @@
                   :fieldNames="customFieldNames"
                   expand-trigger="hover"
                   placeholder="请选择原始模拟量"
-                  @change="changeCascader"
+                  @change="changeCascaderYsmnl"
                 />
               </a-form-model-item>
             </a-col>
@@ -233,7 +232,7 @@
                   :fieldNames="customFieldNames"
                   expand-trigger="hover"
                   placeholder="请选择旁路"
-                  @change="changeCascader"
+                  @change="changeCascaderBypass"
                 />
               </a-form-model-item>
             </a-col>
@@ -380,7 +379,6 @@
           add: "/summary/interlockSummary/add",
           edit: "/summary/interlockSummary/edit",
           queryById: "/summary/interlockSummary/queryById",
-          getTagInfo: "/iotedgeCollectData/iotedgeCollectData/getTagInfo"
         },
         customFieldNames: {
           label: 'name',
@@ -391,23 +389,10 @@
       }
     },
     created () {
-      // this.getTagInfo()
        //备份model原始值
       this.modelDefault = JSON.parse(JSON.stringify(this.model));
     },
     methods: {
-      changeCascader(){
-        this.model = {...this.model}
-      },
-      statusRadioChange(e){
-      //   console.log(e)
-      //   console.log(this.model.inputStatusRadio)
-        // 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)
@@ -449,21 +434,62 @@
           option.componentOptions.children[0].text.toUpperCase().indexOf(input.toUpperCase()) >= 0
         );
       },
-      // 获取所有位号
-      // getTagInfo(){
-      //   postAction(this.url.getTagInfo).then(res => {
-      //     console.log(res)
-      //     this.tagDataOptions = res.result
-      //     this.confirmLoading = false
-      //   })
-      // },
       // displayRender({ labels }) {
       //   // 设置显示最有一位
       //   return labels[labels.length - 1];
       // },
-      // 点位选择改变
-      dianwerChange(e){
-        console.log(e)
+      // 级联选择点位时赋值
+      changeCascaderCondition(value, selectedOptions){
+        this.model.interlockConditionDeviceId = value[0]
+        this.model.interlockConditionModuleName = value[1]
+        this.model.interlockConditionTag = value[2]
+        this.model.interlockCondition = selectedOptions[2].value
+        this.model = {...this.model}
+      },
+      changeCascaderInput(value, selectedOptions){
+        this.model.inputStatus = selectedOptions[2].value
+        this.model = {...this.model}
+      },
+      changeCascaderOutput(value, selectedOptions){
+        this.model.outputStatus = selectedOptions[2].value
+        this.model = {...this.model}
+      },
+      changeCascaderMp(value, selectedOptions){
+        this.model.mpStatus = selectedOptions[2].value
+        this.model = {...this.model}
+      },
+      // 仪表状态位号改变时赋值
+      changeCascaderInstrument(value, selectedOptions){
+        this.model.instrumentStatusDeviceId = value[0]
+        this.model.instrumentStatusModuleName = value[1]
+        this.model.instrumentStatusTag = value[2]
+        this.model.instrumentStatusValue = selectedOptions[2].value
+        this.model = {...this.model}
+      },
+      // 原始模拟量改变时赋值
+      changeCascaderYsmnl(value, selectedOptions){
+        this.model.ysmnlDeviceId = value[0]
+        this.model.ysmnlModuleName = value[1]
+        this.model.ysmnlTag = value[2]
+        this.model.ysmnlValue = selectedOptions[2].value
+        this.model = {...this.model}
+      },
+      // 旁路位号改变时赋值
+      changeCascaderBypass(value, selectedOptions){
+        this.model.bypassDeviceId = value[0]
+        this.model.bypassModuleName = value[1]
+        this.model.bypassTag = value[2]
+        this.model.bypass = selectedOptions[2].value
+        this.model = {...this.model}
+      },
+      statusRadioChange(e){
+        // console.log(e)
+        // console.log(this.model.inputStatusRadio)
+        // this.$set(this.model, 'inputStatusRadio', e.target.value)
+        this.model = {...this.model}
+      },
+      instrumentStatusChange(){
+        this.model = {...this.model}
       },
       // 是否旁路改变时 
       bypassChange(){
@@ -482,15 +508,15 @@
         // console.log(record)
         this.model = Object.assign({}, record);
         // 联锁条件
-        this.model.interlockConditionData = [record.interlockConditionDeviceId, record.interlockConditionModuleName, record.interlockConditionTag+'&'+record.interlockCondition]
+        this.model.interlockConditionData = [record.interlockConditionDeviceId, record.interlockConditionModuleName, record.interlockConditionTag]
         // 仪表状态
         if(record.instrumentStatusJuge === '0'){
           // 仪表状态-仪表状态位号
-          this.model.instrumentStatusData = [record.instrumentStatusDeviceId, record.instrumentStatusModuleName, record.instrumentStatusTag+'&'+record.instrumentStatusValue]
+          this.model.instrumentStatusData = [record.instrumentStatusDeviceId, record.instrumentStatusModuleName, record.instrumentStatusTag]
         }
         if(this.model.instrumentStatusJuge === '1' || this.model.instrumentStatusJuge === '2'){
           // 仪表状态-原始模拟量位号
-          this.model.ysmnlData = [record.ysmnlDeviceId, record.ysmnlModuleName, record.ysmnlTag+'&'+record.ysmnlValue]
+          this.model.ysmnlData = [record.ysmnlDeviceId, record.ysmnlModuleName, record.ysmnlTag]
         }
         if(this.model.instrumentStatusJuge === '1'){
           // 高低限赋值--依据转换后还保持刚刚的选择
@@ -519,7 +545,7 @@
         }
         if(record.ifBypass === '1'){
           this.model.bypassNo = '0'
-          this.model.bypassData = [record.bypassDeviceId, record.bypassModuleName, record.bypassTag+'&'+record.bypass]
+          this.model.bypassData = [record.bypassDeviceId, record.bypassModuleName, record.bypassTag]
         }
         if(record.ifBypass === '2'){
           this.model.bypassNo = record.bypass
@@ -527,18 +553,18 @@
         // 输入卡件状态
         this.model.inputStatusRadio = record.inputStatusTag ? '1' : '0'
         if(record.inputStatusTag){
-          this.model.inputStatusData = [record.inputStatusDeviceId, record.inputStatusModuleName, record.inputStatusTag+'&'+record.inputStatus]
+          this.model.inputStatusData = [record.inputStatusDeviceId, record.inputStatusModuleName, record.inputStatusTag]
         }
         // 输出卡件状态
         this.model.outputStatusRadio = record.outputStatusTag ? '1' : '0'
         if(record.outputStatusTag){
-          this.model.outputStatusData = [record.outputStatusDeviceId, record.outputStatusModuleName, record.outputStatusTag+'&'+record.outputStatus]
+          this.model.outputStatusData = [record.outputStatusDeviceId, record.outputStatusModuleName, record.outputStatusTag]
         }
         // MP状态
         this.model.mpStatusRadio = record.mpStatusTag ? '1' : '0'
         if(record.mpStatusTag){
           this.model.mpStatusRadio = '1'
-          this.model.mpStatusData = [record.mpStatusDeviceId, record.mpStatusModuleName, record.mpStatusTag+'&'+record.mpStatus]
+          this.model.mpStatusData = [record.mpStatusDeviceId, record.mpStatusModuleName, record.mpStatusTag]
         }
         this.setDefaultValue()
       },
@@ -548,27 +574,9 @@
         this.$refs.form.validate(valid => {
           if (valid) {
             // 拆分级联选择器的数据传递后端使用-设备id、模块名称、点位、值
-            // var conditionTableData = {}
-            // 联锁条件
-            this.model.interlockConditionDeviceId = this.model.interlockConditionData[0]
-            this.model.interlockConditionModuleName = this.model.interlockConditionData[1]
-            this.model.interlockConditionTag = (this.model.interlockConditionData[2].split('&'))[0]
-            this.model.interlockCondition = (this.model.interlockConditionData[2].split('&'))[1]
+            // 改变了方式,有些赋值在级联选择时就赋值了
+            
             // 仪表状态
-            if(this.model.instrumentStatusJuge === '0'){
-              // 仪表状态-仪表状态位号
-              this.model.instrumentStatusDeviceId = this.model.instrumentStatusData[0]
-              this.model.instrumentStatusModuleName = this.model.instrumentStatusData[1]
-              this.model.instrumentStatusTag = (this.model.instrumentStatusData[2].split('&'))[0]
-              this.model.instrumentStatusValue = (this.model.instrumentStatusData[2].split('&'))[1]
-            }
-            if(this.model.instrumentStatusJuge === '1' || this.model.instrumentStatusJuge === '2'){
-              // 仪表状态-原始模拟量位号
-              this.model.ysmnlDeviceId = this.model.ysmnlData[0]
-              this.model.ysmnlModuleName = this.model.ysmnlData[1]
-              this.model.ysmnlTag = (this.model.ysmnlData[2].split('&'))[0]
-              this.model.ysmnlValue = (this.model.ysmnlData[2].split('&'))[1]
-            }
             if(this.model.instrumentStatusJuge === '3'){
               // 默认正常
               this.model.instrumentStatusDeviceId = null
@@ -589,7 +597,7 @@
               this.model.thresholdValue = parseInt(this.model.thresholdValueN)/100
             }
             
-            // 当前值
+            // 当前值-去掉了
             // this.model.currentValueDeviceId = this.model.currentValueData[0]
             // this.model.currentValueModuleName = this.model.currentValueData[1]
             // this.model.currentValueTag = (this.model.currentValueData[2].split('&'))[0]
@@ -600,13 +608,13 @@
               // 否
               this.model.bypass = this.itSystemDefaultValue.bypassYes
             }
-            if(this.model.ifBypass === '1'){
-              // 是
-              this.model.bypassDeviceId = this.model.bypassData[0]
-              this.model.bypassModuleName = this.model.bypassData[1]
-              this.model.bypassTag = (this.model.bypassData[2].split('&'))[0]
-              this.model.bypass = (this.model.bypassData[2].split('&'))[1]
-            }
+            // if(this.model.ifBypass === '1'){
+            //   // 是
+            //   this.model.bypassDeviceId = this.model.bypassData[0]
+            //   this.model.bypassModuleName = this.model.bypassData[1]
+            //   this.model.bypassTag = (this.model.bypassData[2].split('&'))[0]
+            //   this.model.bypass = (this.model.bypassData[2].split('&'))[1]
+            // }
             if(this.model.ifBypass === '2'){
               // 现场旁路
               this.model.bypass = this.model.bypassNo
@@ -618,8 +626,7 @@
               // 传位号
               this.model.inputStatusDeviceId = this.model.inputStatusData[0]
               this.model.inputStatusModuleName = this.model.inputStatusData[1]
-              this.model.inputStatusTag = (this.model.inputStatusData[2].split('&'))[0]
-              this.model.inputStatus = (this.model.inputStatusData[2].split('&'))[1]
+              this.model.inputStatusTag = this.model.inputStatusData[2]
             } else {
               this.model.inputStatusDeviceId = null
               this.model.inputStatusModuleName = null
@@ -634,8 +641,7 @@
             if(this.model.outputStatusRadio === '1' && this.model.outputStatusData && this.model.outputStatusData.length  > 0){
               this.model.outputStatusDeviceId = this.model.outputStatusData[0]
               this.model.outputStatusModuleName = this.model.outputStatusData[1]
-              this.model.outputStatusTag = (this.model.outputStatusData[2].split('&'))[0]
-              this.model.outputStatus = (this.model.outputStatusData[2].split('&'))[1]
+              this.model.outputStatusTag = this.model.outputStatusData[2]
             } else {
               this.model.outputStatusDeviceId = null
               this.model.outputStatusModuleName = null
@@ -647,8 +653,7 @@
             if(this.model.mpStatusRadio === '1' && this.model.mpStatusData && this.model.mpStatusData.length  > 0){
               this.model.mpStatusDeviceId = this.model.mpStatusData[0]
               this.model.mpStatusModuleName = this.model.mpStatusData[1]
-              this.model.mpStatusTag = (this.model.mpStatusData[2].split('&'))[0]
-              this.model.mpStatus = (this.model.mpStatusData[2].split('&'))[1]
+              this.model.mpStatusTag = this.model.mpStatusData[2]
             } else {
               this.model.mpStatusDeviceId = null
               this.model.mpStatusModuleName = null

Разница между файлами не показана из-за своего большого размера
+ 618 - 613
src/views/module_interLock/interlockSummarySet/InterlockSummarySet.vue