Przeglądaj źródła

联锁条件编辑复制删除等

yuhan 9 miesięcy temu
rodzic
commit
611623f024

+ 5 - 1
src/views/module_interLock/InterlockSummary/modules/InterlockConditionForm.vue

@@ -138,7 +138,8 @@
           <template v-if="model.ifBypass === '0'">
             <a-col :span="24">
               <a-form-model-item label="旁路状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bypassNo">
-                <a-input v-model="model.bypassNo" default-value="无旁路" placeholder="无旁路"></a-input>
+                <a-input v-model="model.bypassNo" default-value="无旁路"></a-input>
+                <!-- placeholder="无旁路" -->
               </a-form-model-item>
             </a-col>
           </template>
@@ -255,6 +256,9 @@
           bypassData: [{
             required: true, message: '请选择旁路位号!',
           }],
+          bypassNo: [{
+            required: true, message: '请输入旁路状态!',
+          }],
           inputStatusData: [{
             required: true, message: '请选择!',
           }],

+ 46 - 22
src/views/module_interLock/InterlockSummary/modules/InterlockSummaryForm.vue

@@ -71,19 +71,26 @@
           bordered
           :rowKey="(record,index)=>{return index}"
           :columns="columns"
-          :dataSource="dataSource"
+          :dataSource="conditionDataSource"
           class="j-table-force-nowrap">
           <!-- :pagination="ipagination" -->
           <!-- :loading="loading" -->
           <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
-          <span slot="action" slot-scope="text, record">
-            <a @click="handleEditCondition(record)">编辑</a>
+          <!-- 是否旁路 -->
+          <span slot="ifBypass" slot-scope="text, record">
+            <span v-if="record.ifBypass === '1'">{{ record.bypassTag }}</span>
+            <span v-if="record.ifBypass === '0'">{{ record.bypass }}</span>
+          </span>
+          <!-- 操作 -->
+          <span slot="action" slot-scope="text, record, index">
+            <a @click="handleEditCondition(record, index)">编辑</a>
             <a-divider type="vertical" />
-            <a @click="handleDelete(record.id)(record)">复制</a>
+            <a @click="handleCopyCondition(record, index)">复制</a>
             <a-divider type="vertical" />
-            <a @click="handleDelete(record.id)(record)">删除</a>
+            <a-popconfirm title="确定删除吗?" @confirm="() => handleDeleteCondition(record, index)">
+              <a>删除</a>
+            </a-popconfirm>
           </span>
-
         </a-table>
         <!-- 新增联锁条件 -->
         <j-modal
@@ -168,7 +175,7 @@
         conditionTitle: '新增联锁条件',
         conditionVisible: false,
         // 联锁条件表格
-        dataSource: [],
+        conditionDataSource: [],
         columns: [
           {
             title: '序号',
@@ -201,7 +208,7 @@
             dataIndex: 'description'
           },
           {
-            title:'联锁设定值',
+            title:'联锁设定值位号',
             align:"center",
             dataIndex: 'interlockSetValue'
           },
@@ -211,22 +218,22 @@
             dataIndex: 'currentValueTag'
           },
           {
-            title:'旁路状态',
+            title:'旁路状态位号',
             align:"center",
-            dataIndex: 'bypassTag'
+            scopedSlots: { customRender: 'ifBypass' }
           },
           {
-            title:'输入卡件状态',
+            title:'输入卡件状态位号',
             align:"center",
             dataIndex: 'inputStatusTag'
           },
           {
-            title:'输出卡件状态',
+            title:'输出卡件状态位号',
             align:"center",
             dataIndex: 'outputStatusTag'
           },
           {
-            title:'MP状态',
+            title:'MP状态位号',
             align:"center",
             dataIndex: 'mpStatusTag'
           },
@@ -239,6 +246,7 @@
             scopedSlots: { customRender: 'action' }
           }
         ],
+        tableClickRowIndex: -1,
       }
     },
     computed: {
@@ -292,11 +300,13 @@
       },
       // 联锁条件弹窗-确认回调
       submitCallback(model){
-        // if(model.staticId){
-
-        // }
-        console.log(model)
-        this.dataSource.push(model)
+        if(this.tableClickRowIndex >= 0){
+          // 编辑回调
+          this.conditionDataSource[this.tableClickRowIndex] = model
+        } else {
+          // 新增回调
+          this.conditionDataSource.push(model)
+        }
         this.conditionVisible = false
       },
       // 装置选择改变时
@@ -322,16 +332,30 @@
       },
       // 新增联锁条件
       handleAddCondition(){
+        this.tableClickRowIndex = -1
         this.conditionVisible = true
       },
       // 编辑联锁条件
-      handleEditCondition(record){
-        // console.log(this.$refs)
+      handleEditCondition(record, index){
+        console.log(index)
+        this.tableClickRowIndex = index
+        this.conditionVisible = true
+        this.$nextTick(()=>{
+          this.$refs.conditionForm.edit(record);
+        })
+      },
+      // 复制联锁条件
+      handleCopyCondition(record){
+        this.tableClickRowIndex = -1
         this.conditionVisible = true
         this.$nextTick(()=>{
           this.$refs.conditionForm.edit(record);
         })
       },
+      // 删除联锁条件
+      handleDeleteCondition(record, index){
+        this.conditionDataSource.splice(index, 1)
+      },
       // 新增联锁-弹窗
       add () {  
         // this.edit(this.modelDefault);
@@ -345,7 +369,7 @@
           console.log(res)
           var resultArr = res.result
           this.model = resultArr
-          this.dataSource = resultArr.interlockDetailEditQueryVOList
+          this.conditionDataSource = resultArr.interlockDetailEditQueryVOList
           this.model.interlockOutValueData = [resultArr.deviceId, resultArr.moduleName, resultArr.interlockOutValueTag+'&'+resultArr.interlockOutValue]
         })
         this.visible = true;
@@ -366,7 +390,7 @@
                method = 'put';
             }
             // 转换数据
-            this.model.interlockDetailAddDTOList = this.dataSource
+            this.model.interlockDetailAddDTOList = this.conditionDataSource
             // 联锁输出值位号
             this.model.deviceId = this.model.interlockOutValueData[0]
             this.model.moduleName = this.model.interlockOutValueData[1]