Bläddra i källkod

1、联锁增加个复制功能,可以复制相同的联锁条件
2、联锁条件编辑时,位号支持搜索
3、联锁修改后点击关闭时,需要二次确认

dongjh 7 månader sedan
förälder
incheckning
7f994f114b

+ 12 - 1
src/views/module_interLock/InterlockSummary/InterlockSummaryList.vue

@@ -356,6 +356,12 @@
                     <span class="edit-btn" onclick={() => { this.handleEdit(record) }}></span>
                   </a-tooltip>
                 )
+                var childrenCopy = (
+                  <a-tooltip>
+                    <template slot="title"> 复制 </template>
+                    <span class="copy-btn" onclick={() => { this.handleCopy(record) }}></span>
+                  </a-tooltip>
+                )
                 // var childrenEdit = (<a onclick={() => { this.handleEdit(record) }}>编辑</a>)
                 // var childrenDivider = (<a-divider type="vertical"/>)
                 // <a-popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(record.summaryid)}>
@@ -372,7 +378,7 @@
                   </a-popconfirm>
                 )
                 return {
-                  children: [childrenEdit,childrenMore],
+                  children: [childrenEdit, childrenCopy, childrenMore],
                   // children: record.limitType === '0' ? [childrenEdit,childrenMore] : [onlyViewEdit, onlyViewDel],
                   attrs: {
                     rowSpan: record.rowSpan
@@ -705,6 +711,11 @@
         this.$store.commit('SET_SUMMARYTYPE', '编辑');
         this.$router.push({path: '/interLock/summary/set'})
       },
+      handleCopy(record){
+        this.$store.commit('SET_SUMMARYEDITINFO', record);
+        this.$store.commit('SET_SUMMARYTYPE', '复制');
+        this.$router.push({path: '/interLock/summary/set'})
+      },
       initDictConfig(){
       },
       getSuperFieldList(){

+ 20 - 0
src/views/module_interLock/InterlockSummary/modules/InterlockConditionForm.vue

@@ -10,6 +10,8 @@
                 v-model="model.interlockConditionData"
                 :options="tagDataOptions"
                 :fieldNames="customFieldNames"
+                :show-search="true"
+                :filter-option="filter"
                 expand-trigger="hover"
                 placeholder="请选择点位"/>
                 <!-- :display-render="displayRender" -->
@@ -45,6 +47,8 @@
                   v-model="model.inputStatusData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择输入卡件状态"
                   />
@@ -65,6 +69,8 @@
                   v-model="model.outputStatusData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择输出卡件状态"
                 />
@@ -85,6 +91,8 @@
                   v-model="model.mpStatusData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择MP状态"
                 />
@@ -116,6 +124,8 @@
                 v-model="model.instrumentStatusData"
                 :options="tagDataOptions"
                 :fieldNames="customFieldNames"
+                :show-search="true"
+                :filter-option="filter"
                 expand-trigger="hover"
                 placeholder="请选择仪表位号"/>
               </a-form-model-item>
@@ -128,6 +138,8 @@
                   v-model="model.ysmnlData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择原始模拟量"
                 />
@@ -161,6 +173,8 @@
                   v-model="model.ysmnlData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择原始模拟量"
                 />
@@ -244,6 +258,8 @@
                 v-model="model.bypassData"
                 :options="tagDataOptions"
                 :fieldNames="customFieldNames"
+                :show-search="true"
+                :filter-option="filter"
                 expand-trigger="hover"
                 placeholder="请选择旁路"/>
               </a-form-model-item>
@@ -411,6 +427,10 @@
         // this.$set(this.model, 'inputStatusRadio', e.target.value)
         this.model = {...this.model}
       },
+      // 级联选择过滤搜索
+      filter(inputValue, path) {
+        return path.some(option => (option.label).toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
+      },
       // 设置状态默认值和初始化值
       setDefaultValue(){
         // this.$set(this.model, 'inputStatusDefault', this.itSystemDefaultValue.controlSystemStatusNormal)

+ 0 - 2
src/views/module_interLock/interlockSummaryDetail/InterlockSummaryDetailList.vue

@@ -409,8 +409,6 @@
     //     deep: true
     //   }
     // },
-    mounted() {
-    },
     created() {
       this.queryParam.detailName = sessionStorage.getItem("detail_dname")
       this.getSuperFieldList();

+ 17 - 9
src/views/module_interLock/interlockSummarySet/InterlockConditionForm.vue

@@ -10,7 +10,8 @@
                 v-model="model.interlockConditionData"
                 :options="tagDataOptions"
                 :fieldNames="customFieldNames"
-                :show-search="{ filter }"
+                :show-search="true"
+                :filter-option="filter"
                 expand-trigger="hover"
                 placeholder="请选择点位"
                 @change="changeCascaderCondition"
@@ -52,7 +53,8 @@
                   v-model="model.inputStatusData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
-                  :show-search="{ filter }"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择输入卡件状态"
                   @change="changeCascaderInput"
@@ -74,7 +76,8 @@
                   v-model="model.outputStatusData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
-                  :show-search="{ filter }"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择输出卡件状态"
                   @change="changeCascaderOutput"
@@ -96,7 +99,8 @@
                   v-model="model.mpStatusData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
-                  :show-search="{ filter }"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择MP状态"
                   @change="changeCascaderMp"
@@ -130,7 +134,8 @@
                   v-model="model.instrumentStatusData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
-                  :show-search="{ filter }"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择仪表位号"
                   @change="changeCascaderInstrument"
@@ -145,7 +150,8 @@
                   v-model="model.ysmnlData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
-                  :show-search="{ filter }"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择原始模拟量"
                   @change="changeCascaderYsmnl"
@@ -172,7 +178,8 @@
                   v-model="model.ysmnlData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
-                  :show-search="{ filter }"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择原始模拟量"
                   @change="changeCascaderYsmnl"
@@ -237,7 +244,8 @@
                   v-model="model.bypassData"
                   :options="tagDataOptions"
                   :fieldNames="customFieldNames"
-                  :show-search="{ filter }"
+                  :show-search="true"
+                  :filter-option="filter"
                   expand-trigger="hover"
                   placeholder="请选择旁路"
                   @change="changeCascaderBypass"
@@ -492,7 +500,7 @@
       },
       // 级联选择过滤搜索
       filter(inputValue, path) {
-        return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
+        return path.some(option => (option.label).toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
       },
       statusRadioChange(e){
         // console.log(e)

+ 66 - 5
src/views/module_interLock/interlockSummarySet/InterlockSummarySet.vue

@@ -6,7 +6,7 @@
           <span>{{ summaryType }}</span>
         </div>
         <div>
-          <a-button @click="goBack" style="margin-right: 10px;font-size: 16px;">关闭</a-button>
+          <a-button @click="goBackCheck" style="margin-right: 10px;font-size: 16px;">关闭</a-button>
           <a-button @click="handleOk" type="primary">提交</a-button>
         </div>
       </div>
@@ -181,6 +181,7 @@
       },
       data () {
         return {
+          originalData: null, // 原始数据,退出时新老数据比较
           model:{
           },
           labelCol: {
@@ -354,14 +355,14 @@
       created () {
         if(this.summaryType === '编辑'){
           this.getEditData()
-        } else {
+        } else if(this.summaryType === '新增'){
           this.setAdd()
+        } else {
+          this.getCopyData()
         }
         // this.getTagInfo()
         this.initDictData()
         // this.getData('0', 'apparatusData')
-         //备份model原始值
-        this.modelDefault = JSON.parse(JSON.stringify(this.model));
       },
       methods: {
         handleRefresh(){
@@ -487,11 +488,14 @@
           }
           this.getZzXtData()
           this.getTagInfo(this.clickSystemNode.groupId)
+          //备份model原始值
+          this.originalData = JSON.parse(JSON.stringify(this.model));
+          this.originalData.interlockDetailAddDTOList = [];
         },
         // 编辑联锁-弹窗
         getEditData() {
           var record = this.summaryEditInfo
-          console.log(record)
+          // console.log(record)
           // this.model = Object.assign({}, record);
           // 编辑时获取当前联锁所有详细信息
           getAction(this.url.getLsAllData, {id: record.summaryid}).then(res => {
@@ -501,8 +505,65 @@
             this.model.interlockOutValueData = [resultArr.deviceId, resultArr.moduleName, resultArr.interlockOutValueTag]
             this.getZzXtData()
             this.getTagInfo(this.model.groupId)
+            //备份model原始值
+            this.originalData = JSON.parse(JSON.stringify(this.model));
+            this.originalData.interlockDetailAddDTOList = JSON.parse(JSON.stringify(resultArr.interlockDetailEditQueryVOList));
           })
         },
+        // 复制联锁-弹窗
+        getCopyData() {
+          var record = this.summaryEditInfo
+          // this.model = Object.assign({}, record);
+          // 编辑时获取当前联锁所有详细信息
+          getAction(this.url.getLsAllData, {id: record.summaryid}).then(res => {
+            // console.log("复制model数据:", res.result)
+            var resultArr = res.result
+            this.model = resultArr
+            // 清空主表与子表的id
+            this.model.id = null;
+            this.model.interlockDetailEditQueryVOList.forEach(function(item, index, array) {
+              item.id = null;
+              item.summaryid = null;
+            });
+            this.conditionDataSource = resultArr.interlockDetailEditQueryVOList // 表格数据
+            this.model.interlockOutValueData = [resultArr.deviceId, resultArr.moduleName, resultArr.interlockOutValueTag]
+            this.getZzXtData()
+            this.getTagInfo(this.model.groupId)
+            //备份model原始值,不能直接用等于(等于的话,就传递指针了),必须用JSON.parse(JSON.stringify())方法
+            this.originalData = JSON.parse(JSON.stringify(this.model));
+            this.originalData.interlockDetailAddDTOList = JSON.parse(JSON.stringify(resultArr.interlockDetailEditQueryVOList));
+          })
+        },
+        goBackCheck(){
+          var _this = this          
+          // 转换数据
+          this.model.interlockDetailAddDTOList = this.conditionDataSource
+          console.log("原始数据:", JSON.stringify(_this.originalData), "新的数据:", JSON.stringify(_this.model))
+          if (JSON.stringify(_this.originalData) !== JSON.stringify(_this.model)) {
+            _this.$confirm({
+              title: '提示',
+              content: '联锁信息已修改,是否确定退出?',
+              okButtonProps: {
+                style: {
+                  backgroundColor: '#008cd6',
+                  fontSize: '16px',
+                }
+              },
+              cancelButtonProps: {
+                style: {
+                  fontSize: '16px',
+                }
+              },
+              onOk() {
+                _this. goBack()
+              },
+              onCancel() {},
+            });
+          }
+          else {
+            _this. goBack()
+          }
+        },
         goBack(){
           this.$router.go(-1)
           this.$store.commit('SET_SUMMARYEDITINFO', []);