yuhan vor 3 Monaten
Ursprung
Commit
e47b19b428

+ 1 - 1
src/components/menu/index.js

@@ -82,7 +82,7 @@ export default {
       } else {
         /* IoT TPM相关 修改框架 */
         // 设置联锁添加页面高亮联锁总表
-        if(this.$route.path == '/interLock/summary/add'){
+        if(this.$route.path == '/interLock/summary/set'){
           this.selectedKeys = ['/interLock/summary']
         } else {
           this.selectedKeys = [routes.pop().path]

+ 8 - 1
src/permission.js

@@ -140,8 +140,9 @@ router.beforeEach((to, from, next) => {
               })
             })
         } else {
+          console.log(from, to)
           // 从添加页面跳转其他页面后需要删除联锁添加页面
-          if(from.path === '/interLock/summary/add' && !from.meta.replace){
+          if(from.path === '/interLock/summary/set' && !from.meta.replace){
             // 为了解决循环设置了replace
             from.meta.replace = true
             next({ ...to, replace: true })
@@ -149,6 +150,12 @@ router.beforeEach((to, from, next) => {
           } else {
             next()
           }
+          // 联锁添加页面刷新--返回联锁总表页面
+          if(from.path === '/' && to.path === '/interLock/summary/set'){
+            next({ path: '/interLock/summary'})
+          } else {
+            next()
+          }
           // next()
         }
       }

+ 2 - 1
src/store/getters.js

@@ -19,7 +19,8 @@ const getters = {
   },
   sysSafeMode: state => state.user.sysSafeMode,
   summaryEditInfo: state => state.interLock.summaryEditInfo,
-  summaryEditType: state => state.interLock.summaryEditType,
+  summaryType: state => state.interLock.summaryType,
+  clickSystemNode: state => state.interLock.clickSystemNode,
 
 }
 

+ 9 - 3
src/store/modules/interLock.js

@@ -7,7 +7,8 @@ const interLock = {
   state: {
     //存储数据,用于组件之间的数据传输
     summaryEditInfo: {},
-    summaryEditType: '新增',
+    summaryType: '新增',
+    clickSystemNode: {}, // 新增联锁时左侧选择的树节点
   },
   // (大概)区别:mutations用来修改state数据 同步
   mutations: {
@@ -16,10 +17,15 @@ const interLock = {
       // Vue.set(state, 'baseInfos', fields)
       state.summaryEditInfo = infos
     },
-    SET_SUMMARYEDITTYPE: (state, infos) => {
+    SET_SUMMARYTYPE: (state, infos) => {
       // console.log('fields',fields)
       // Vue.set(state, 'baseInfos', fields)
-      state.summaryEditType = infos
+      state.summaryType = infos
+    },
+    SET_CLICKSYSTEMNODE: (state, infos) => {
+      // console.log('fields',fields)
+      // Vue.set(state, 'baseInfos', fields)
+      state.clickSystemNode = infos
     },
   },
   // (大概)区别:actions用来设计复杂逻辑 异步

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

@@ -402,11 +402,6 @@
       //     }
       //   }
       // },
-      handleEdit(record){
-        this.$store.commit('SET_SUMMARYEDITINFO', record);
-        this.$store.commit('SET_SUMMARYEDITTYPE', '编辑');
-        this.$router.push({path: '/interLock/summary/add'})
-      },
       // 单元格点击事件
       customCellDetail(record, index, columnValue, columnTitle){
         return {
@@ -643,10 +638,18 @@
       },
       // 新增传值
       handleAdd() {
-        this.$refs.modalForm.add();
-        this.$refs.modalForm.title = "新增";
-        this.$refs.modalForm.disableSubmit = false;
-        this.$refs.modalForm.addInterlock = this.selectData;
+        // this.$refs.modalForm.add();
+        // this.$refs.modalForm.title = "新增";
+        // this.$refs.modalForm.disableSubmit = false;
+        // this.$refs.modalForm.addInterlock = this.selectData;
+        this.$store.commit('SET_CLICKSYSTEMNODE', this.selectData);
+        this.$store.commit('SET_SUMMARYTYPE', '新增');
+        this.$router.push({path: '/interLock/summary/set'})
+      },
+      handleEdit(record){
+        this.$store.commit('SET_SUMMARYEDITINFO', record);
+        this.$store.commit('SET_SUMMARYTYPE', '编辑');
+        this.$router.push({path: '/interLock/summary/set'})
       },
       initDictConfig(){
       },

+ 13 - 2
src/views/module_interLock/baseInterLock/modules/BaseInterLockModal.vue

@@ -209,8 +209,8 @@
           controlSystemStatusNormalName: '正常',
           controlSystemStatusAbnormalName: '非正常',
           
-          bypassYes	: '1', // 旁路正常状态
-          bypassNo: '0',
+          bypassYes	: '0', // 旁路正常状态
+          bypassNo: '1',
           bypassYesName: '非旁路',
           bypassNoName: '旁路',
 
@@ -424,6 +424,17 @@
             _this.$confirm({
               title: '提示',
               content: '是否确定提交',
+              okButtonProps: {
+                style: {
+                  backgroundColor: '#008cd6',
+                  fontSize: '16px',
+                }
+              },
+              cancelButtonProps: {
+                style: {
+                  fontSize: '16px',
+                }
+              },
               onOk() {
                 _this.submit()
               },

+ 12 - 0
src/views/module_interLock/baseScheduleSet/modules/BaseScheduleSetModal.vue

@@ -218,6 +218,17 @@
             _this.$confirm({
               title: '提示',
               content: '是否确定提交',
+              okButtonProps: {
+                style: {
+                  backgroundColor: '#008cd6',
+                  fontSize: '16px',
+                }
+              },
+              cancelButtonProps: {
+                style: {
+                  fontSize: '16px',
+                }
+              },
               onOk() {
                 _this.submit()
               },
@@ -227,6 +238,7 @@
         })
       },
       submit(){
+        var that = this
         // that.confirmLoading = true;
         let httpurl = '';
         let method = '';

+ 12 - 0
src/views/module_interLock/interlockHistoryDetail/InterlockHistoryDetailList.vue

@@ -54,6 +54,12 @@
             @change="handleTableChange">
             <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
 
+            <!-- 仪表状态 -->
+            <span slot="instrumentStatus" slot-scope="text, record">
+              <span :class="record.instrumentStatus === record.instrumentStatusNormal ? 'normal-tag':'abnormal-tag'">
+                {{ text }}
+              </span>
+            </span>
             <!-- 输入卡件状态 -->
             <span slot="inputStatus" slot-scope="text, record">
               <span :class="record.inputStatus === record.controlSystemStatusNormal ? 'normal-tag':'abnormal-tag'">
@@ -215,6 +221,12 @@
             },
           },
           {
+            title:'仪表状态',
+            align:"center",
+            dataIndex: 'instrumentStatusName',
+            scopedSlots: { customRender: 'instrumentStatus' }
+          },
+          {
             title:'输入卡件状态',
             align:"center",
             dataIndex: 'inputStatusName',

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

@@ -76,6 +76,12 @@
             <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
 
 
+            <!-- 仪表状态 -->
+            <span slot="instrumentStatus" slot-scope="text, record">
+              <span :class="record.instrumentStatus === record.instrumentStatusNormal ? 'normal-tag':'abnormal-tag'">
+                {{ text }}
+              </span>
+            </span>
             <!-- 输入卡件状态 -->
             <span slot="inputStatus" slot-scope="text, record">
               <span :class="record.inputStatus === record.controlSystemStatusNormal ? 'normal-tag':'abnormal-tag'">
@@ -236,6 +242,12 @@
             },
           },
           {
+            title:'仪表状态',
+            align:"center",
+            dataIndex: 'instrumentStatusName',
+            scopedSlots: { customRender: 'instrumentStatus' }
+          },
+          {
             title:'输入卡件状态',
             align:"center",
             dataIndex: 'inputStatusName',

+ 21 - 9
src/views/module_interLock/interlockSummaryAdd/InterlockConditionForm.vue

@@ -102,13 +102,13 @@
                 <a-radio :value="'1'"> 高低限判断 </a-radio>
                 <a-radio :value="'2'"> 突变超限判断 </a-radio>
               </a-radio-group>
+              <template v-if="model.instrumentStatusJuge === '3'">
+                <a-input v-model="model.instrumentStatusDefault" disabled></a-input>
+                <!-- <a-col :span="24">
+                </a-col> -->
+              </template>
             </a-form-model-item>
           </a-col>
-          <template v-if="model.instrumentStatusJuge === '3'">
-            <a-col :span="24">
-              <a-input v-model="model.instrumentStatusDefault" disabled></a-input>
-            </a-col>
-          </template>
           <template v-if="model.instrumentStatusJuge === '0'">
             <a-col :span="24">
               <a-form-model-item label="仪表位号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="instrumentStatusData">
@@ -254,7 +254,7 @@
               <a-form-model-item label="旁路状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bypassNo">
                 <!-- <a-input v-model="model.bypassNo" disabled></a-input> -->
                 <!-- placeholder="无旁路" :default-value="bypassNo" -->
-                <a-select v-model="model.bypassNo">
+                <a-select v-model="model.bypassNo" @change="bypassChange">
                   <a-select-option :value="item.value" v-for="item in byPassOptions" :key="item.value"> {{ item.title }} </a-select-option>
                 </a-select>
               </a-form-model-item>
@@ -306,7 +306,7 @@
           lowerLimitTb: null,
           thresholdValueN: '1',
           ifBypass: '1', // 是否有旁路-是
-          bypassNo: null, // 旁路默认值
+          bypassNo: '0', // 旁路默认值
           bypass: null, // MP状态默认值默认参数
         },
         labelCol: {
@@ -450,6 +450,10 @@
       dianwerChange(e){
         console.log(e)
       },
+      // 是否旁路改变时 
+      bypassChange(){
+        this.model = { ...this.model }
+      },
       // 点位状态依据改变时
       // instrumentStatusJugeChange(e){
       //   console.log(e)
@@ -562,6 +566,14 @@
               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
+              this.model.instrumentStatusModuleName = null
+              this.model.instrumentStatusTag = null
+              this.model.instrumentStatusValue = this.itSystemDefaultValue.instrumentStatusNormal
+            }
+
             if(this.model.instrumentStatusJuge === '1'){
               // 根据状态给后端高低限赋值
               this.model.upperLimit = this.model.upperLimitGd
@@ -583,8 +595,8 @@
             // 旁路位号
             if(this.model.ifBypass === '0'){
               // 否
-              // this.model.bypass = this.model.bypassNo
-              this.model.bypass = this.itSystemDefaultValue.bypassYes
+              this.model.bypass = this.model.bypassNo
+              // this.model.bypass = this.itSystemDefaultValue.bypassYes
             }
             if(this.model.ifBypass === '1'){
               // 是

+ 157 - 93
src/views/module_interLock/interlockSummaryAdd/InterlockSummaryAdd.vue

@@ -1,16 +1,16 @@
 <template>
-  <a-spin :spinning="confirmLoading">
-    <div class="u-flex-jab">
-      <div>
+  <a-spin :spinning="confirmLoading" class="interlock-summary-set">
+    <div class="u-flex-jab top-title">
+      <div class="left">
         <a-icon type="arrow-left" @click="goBack"/>
-        <span>{{ summaryEditType }}</span>
+        <span>{{ summaryType }}</span>
       </div>
       <div>
-        <a-button @click="goBack">关闭</a-button>
-        <a-button @click="submitForm" type="primary">提交</a-button>
+        <a-button @click="goBack" style="margin-right: 10px;font-size: 16px;">关闭</a-button>
+        <a-button @click="handleOk" type="primary">提交</a-button>
       </div>
     </div>
-    <j-form-container :disabled="formDisabled">
+    <j-form-container class="content-container">
       <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
         <div class="interlock-summary-item">
           <div class="interlock-summary-item-title">联锁基本信息</div>
@@ -38,7 +38,7 @@
               <a-form-model-item label="逻辑关系" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ljgx">
                 <!-- <a-input v-model="model.ljgx" placeholder="请输入逻辑关系"></a-input> -->
                 <!-- <j-dict-select-tag v-model="model.ljgx"  placeholder="请选择操作类型" dictCode="ljgx"/> -->
-                <a-auto-complete :data-source="ljgxOptions" v-model="model.ljgx" placeholder="请设置逻辑关系"></a-auto-complete>
+                <a-auto-complete :data-source="ljgxOptions" v-model="model.ljgx" :filter-option="filterOption" placeholder="请设置逻辑关系"></a-auto-complete>
               </a-form-model-item>
             </a-col>
           </a-row>
@@ -71,7 +71,7 @@
             <!-- 仪表状态内容 -->
             <span slot="instrumentStatusContent" slot-scope="text, record">
               <template v-if="record.instrumentStatusJuge === '3'">
-                <span>{{ record.instrumentStatusTag }}</span>
+                {{ (record.instrumentStatusNormalName?record.instrumentStatusNormalName:itSystemDefaultValue.instrumentStatusNormalName)+'('+record.instrumentStatusValue+')' }}
               </template>
               <template v-if="record.instrumentStatusJuge === '0'">
                 <span>位号:{{ record.instrumentStatusTag }}</span>
@@ -98,7 +98,10 @@
             <!-- 是否旁路 -->
             <span slot="ifBypass" slot-scope="text, record">
               <span v-if="record.ifBypass === '1'">{{ record.bypassTag }}</span>
-              <span v-if="record.ifBypass === '0'">{{ (record.bypassYesName?record.bypassYesName:itSystemDefaultValue.bypassYesName)+'('+record.bypass+')' }}</span>
+              <!-- 否+正常 -->
+              <span v-if="record.ifBypass === '0' && record.bypass === '0'">{{ (record.bypassYesName?record.bypassYesName:itSystemDefaultValue.bypassYesName)+'('+record.bypass+')' }}</span>
+              <!-- 否+异常 -->
+              <span v-if="record.ifBypass === '0' && record.bypass === '1'">{{ (record.bypassNoName?record.bypassNoName:itSystemDefaultValue.bypassNoName)+'('+record.bypass+')' }}</span>
             </span>
             <!-- 操作 -->
             <span slot="action" slot-scope="text, record, index">
@@ -169,20 +172,6 @@
     components: {
       InterlockConditionForm
     },
-    props: {
-      //表单禁用
-      disabled: {
-        type: Boolean,
-        default: false,
-        required: false
-      },
-      addInterlock: {
-        type: Object,
-        default: function(){
-          return {} // 使用工厂函数返回默认值
-        }
-      },
-    },
     data () {
       return {
         model:{
@@ -333,14 +322,14 @@
       }
     },
     computed: {
-      formDisabled(){
-        return this.disabled
-      },
       summaryEditInfo() {
         return this.$store.getters.summaryEditInfo
       },
-      summaryEditType() {
-        return this.$store.getters.summaryEditType
+      summaryType() {
+        return this.$store.getters.summaryType
+      },
+      clickSystemNode() {
+        return this.$store.getters.clickSystemNode
       },
     },
     // watch: {
@@ -348,8 +337,19 @@
     //     console.log('value', val);
     //   },
     // },
+    mounted(){
+      window.addEventListener('onunload', this.handleRefresh);
+    },
+    beforeDestroy() {
+      // 一定要在组件销毁前移除事件监听,避免内存泄露
+      window.removeEventListener('onunload', this.handleRefresh);
+    },
     created () {
-      this.loadData()
+      if(this.summaryType === '编辑'){
+        this.getEditData()
+      } else {
+        this.setAdd()
+      }
       this.getTagInfo()
       this.initDictData()
       // this.getData('0', 'apparatusData')
@@ -357,9 +357,10 @@
       this.modelDefault = JSON.parse(JSON.stringify(this.model));
     },
     methods: {
-      goBack(){
+      handleRefresh(){
+        console.log(1111)
         this.$router.go(-1)
-        // this.$router.push({path: '/interLock/summary'})
+        // this.$router.replace("*")
       },
       // 获取逻辑关系字典
       initDictData() {
@@ -393,6 +394,12 @@
           this.confirmLoading = false
         })
       },
+      // 逻辑关系过滤
+      filterOption(input, option) {
+        return (
+          option.componentOptions.children[0].text.toUpperCase().indexOf(input.toUpperCase()) >= 0
+        );
+      },
       // 联锁条件弹窗-取消
       handleConditionCancel(){
         this.conditionVisible = false
@@ -454,16 +461,16 @@
         this.conditionDataSource.splice(index, 1)
       },
       // 新增联锁-弹窗
-      add () {
-        if(this.addInterlock && this.addInterlock.interlockType === '1'){
+      setAdd() {
+        if(this.clickSystemNode && this.clickSystemNode.interlockType === '1'){
           // 当前是新增-用树选择的装置系统进行赋值
-          this.model.interlockApparatusId = this.addInterlock.pid
-          this.model.interlockSystemId = this.addInterlock.id
+          this.model.interlockApparatusId = this.clickSystemNode.pid
+          this.model.interlockSystemId = this.clickSystemNode.id
         }
         this.getZzXtData()
       },
       // 编辑联锁-弹窗
-      loadData() {
+      getEditData() {
         var record = this.summaryEditInfo
         console.log(record)
         // this.model = Object.assign({}, record);
@@ -476,46 +483,77 @@
           this.getZzXtData()
         })
       },
-      submitForm () {
-        const that = this;
+      goBack(){
+        this.$router.go(-1)
+        this.$store.commit('SET_SUMMARYEDITINFO', []);
+        // this.$router.push({path: '/interLock/summary'})
+      },
+      handleOk(){
+        var _this = this
         // 触发表单验证
-        this.$refs.form.validate(valid => {
-          if (valid) {
+        this.$refs.form.validate((ok, err) => {
+          if (ok) {
             if(this.conditionDataSource.length===0){
               this.$message.error('联锁条件未设置')
               return false
             }
-            that.confirmLoading = true;
-            let httpurl = '';
-            let method = '';
-            if(!this.model.id){
-              httpurl+=this.url.add;
-              method = 'post';
-            }else{
-              httpurl+=this.url.edit;
-               method = 'put';
-            }
-            // 转换数据
-            this.model.interlockDetailAddDTOList = this.conditionDataSource
-            // 联锁输出值位号
-            this.model.deviceId = this.model.interlockOutValueData[0]
-            this.model.moduleName = this.model.interlockOutValueData[1]
-            this.model.interlockOutValueTag = (this.model.interlockOutValueData[2].split('&'))[0]
-            this.model.interlockOutValue = (this.model.interlockOutValueData[2].split('&'))[1]
-            console.log(this.model)
-            httpAction(httpurl,this.model,method).then((res)=>{
-              if(res.success){
-                that.$message.success(res.message);
-                that.$emit('ok');
-              }else{
-                that.$message.warning(res.message);
-              }
-            }).finally(() => {
-              that.confirmLoading = false;
-            })
+            _this.$confirm({
+              title: '提示',
+              content: '是否确定提交',
+              okButtonProps: {
+                style: {
+                  backgroundColor: '#008cd6',
+                  fontSize: '16px',
+                }
+              },
+              cancelButtonProps: {
+                style: {
+                  fontSize: '16px',
+                }
+              },
+              onOk() {
+                _this.submitForm()
+              },
+              onCancel() {},
+            });
           }
         })
       },
+      submitForm () {
+        const that = this;
+        that.confirmLoading = true;
+        let httpurl = '';
+        let method = '';
+        if(!this.model.id){
+          httpurl+=this.url.add;
+          method = 'post';
+        }else{
+          httpurl+=this.url.edit;
+            method = 'put';
+        }
+        // 转换数据
+        this.model.interlockDetailAddDTOList = this.conditionDataSource
+        // 联锁输出值位号
+        if(this.model.interlockOutValueData && this.model.interlockOutValueData.length > 0){
+          this.model.deviceId = this.model.interlockOutValueData[0]
+          this.model.moduleName = this.model.interlockOutValueData[1]
+          this.model.interlockOutValueTag = (this.model.interlockOutValueData[2].split('&'))[0]
+          this.model.interlockOutValue = (this.model.interlockOutValueData[2].split('&'))[1]
+        }
+        console.log(this.model)
+        httpAction(httpurl,this.model,method).then((res)=>{
+          if(res.success){
+            that.$message.success(res.message);
+            this.$router.go(-1)
+            this.$store.commit('SET_SUMMARYEDITINFO', []);
+            // that.$emit('ok');
+          }else{
+            that.$message.warning(res.message);
+          }
+        }).finally(() => {
+          that.confirmLoading = false;
+        })
+      },
       // 获取装置/系统/联锁数据--默认获取装置数据-方式一需要方法
       // getData(pid, dataName){
       //   let param = {
@@ -547,29 +585,55 @@
   }
 </script>
 <style lang="less">
-  .interlock-summary-item{
-    // box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
-    margin-bottom: 12px;
-    // border-radius: 4px;
-  }
-  .interlock-summary-item-title{
-    background-color: #F5F7FA;
-    line-height: 44px;
-    font-size: 16px;
-    padding: 0 10px 0 20px;
-    margin-bottom: 10px;
-    border-bottom: 1px solid #f3f3f3;
-    color: #323233;
-    font-weight: 600;
-  }
-  .u-flex-jab{
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
+  .interlock-summary-set{
+    height: 100%;
+    overflow: hidden;
+    .ant-spin-container{
+      height: 100%;
+      overflow: hidden;
+    }
+    .top-title{
+      padding: 12px 10px 12px 20px;
+      .left{
+        font-size: 20px; 
+        font-weight: 700;
+        color: #323233;
+        line-height: 40px;
+      }
+      .anticon{
+        color: #008cd6;
+        padding-right: 8px;
+      }
+    }
+    .content-container{
+      height: calc(100% - 64px);
+      background: #fff;
+      overflow: auto;
+      .interlock-summary-item{
+        // box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
+        margin-bottom: 12px;
+        // border-radius: 4px;
+      }
+      .interlock-summary-item-title{
+        background-color: #F5F7FA;
+        line-height: 44px;
+        font-size: 16px;
+        padding: 0 10px 0 20px;
+        margin-bottom: 10px;
+        border-bottom: 1px solid #f3f3f3;
+        color: #323233;
+        font-weight: 600;
+      }
+    }
+    .u-flex-jab{
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+    }
+    .interlock-condition-form{
+      .ant-modal{
+        top: 4px;
+      }
+    }
   }
-  // .interlock-condition-form{
-  //   .ant-modal{
-  //     top: 4px;
-  //   }
-  // }
 </style>