Explorar o código

添加间隔装置端子编号设置功能

liling hai 1 ano
pai
achega
886417104c
Modificáronse 2 ficheiros con 67 adicións e 2 borrados
  1. 12 0
      src/api/scd.js
  2. 55 2
      src/pages/mission/components/CreateMis.vue

+ 12 - 0
src/api/scd.js

@@ -94,6 +94,17 @@ function aginParseArea(data){
         params:data
     })
 }
+
+//	@Param 	area_id 	formData   int  	true 	"间隔ID"
+//	@Param 	ied_name 	formData   string  	true 	"IED装置名称"
+//	@Param  ied_no     	formData   string 	true	"IED装置在特定间隔内,端子间使用的编号"
+function setAreaIedNo(data){
+    return request({
+        url:`/admin/update/check_area/iedno`,
+        method:"post",
+        params:data
+    })
+}
 export default {
     getAllScd,
     getScdMiddle,
@@ -107,4 +118,5 @@ export default {
     getCrc,
     getScdById,
     aginParseArea,
+    setAreaIedNo,
 }

+ 55 - 2
src/pages/mission/components/CreateMis.vue

@@ -114,6 +114,9 @@
                             <div style="margin: 5px;">
                                 <el-button type="primary" size="small" plain @click="checkTime">追加装置</el-button>
                             </div>
+                            <div style="margin: 5px;">
+                                <el-button type="primary" size="small" plain @click="setIedExtrefNo">端子编号</el-button>
+                            </div>
                         </div>
                     </div>
                     <div v-loading="iedLoading" style="margin: 10px;float: left;">
@@ -123,7 +126,7 @@
                         <el-tag v-for="(item, index) in mx" :key="item.ied_name" @click="tagClick(item, index)"
                             size="large" :class="item.isChoose ? 'mx-2' : 'mx-1'" closable="true" effect="plain"
                             @close="tagClose(item)">
-                            {{ '[' + item.ied_name + ']' + (item.attr_desc || '') }}
+                            {{ '[' + item.ied_name + ']' + (item.attr_desc || '') }}   <span style="color:rgb(112, 112, 210);font-weight: bold;">{{ item.ied_no?"NO:"+item.ied_no:"" }}</span>
                         </el-tag>
                     </div>
                 </div>
@@ -462,7 +465,7 @@ export default {
             let areaInfo = anyData.value.filter((r)=>{
                 return r.area_id==e.area_id
             })
-            if(areaInfo.length>0){
+            if(areaInfo.length>0 && areaInfo.ieds!=null && areaInfo.ieds.length>0){
                 mx.value = areaInfo[0].ieds.map(item => ({ ...item, isChoose: false }));
                 iedName.value = mx.value.map(item => item.ied_name).join(',')
                 return
@@ -593,6 +596,54 @@ export default {
             mx.value = mx.value.concat(data)
             iedName.value = mx.value.map(item => item.ied_name).join(',');
         }
+        //设置装置信号端子收发编号
+        function setIedExtrefNo(){
+            if(mx.value==null || mx.value.length==0){
+                ElMessage({
+                    message: "请先选择一个装置",
+                    type: "info"
+                })
+                return
+            }
+            //获取当前选择的装置
+            const ied=mx.value.filter(item => {return item.isChoose==true});
+            if(ied.length==0 ||ied[0].attr_name==""){
+                ElMessage({
+                    message: "请先选择一个有效的装置",
+                    type: "info"
+                })
+                return
+            }
+            ElMessageBox.prompt('当装置是通过编号来确认端子信号收发(如PM接收的"线路5A相失灵"端子)时才设置此编号:', '装置端子编号', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                inputPattern: /^[^\s]{1,5}$/,
+                inputErrorMessage: '编号格式不正确:只支持不超过5位的非空字符!',
+                inputValue:ied[0].ied_no,
+            }).then(({ value }) => {
+                // 用户点击确定,value 是输入的内容
+                scd.setAreaIedNo({area_id:loadAreaId.value*1,ied_name:ied[0].attr_name,ied_no:value}).then(res=>{
+                    if(res!=null && res.code==0){
+                        ElMessage({
+                            message: "操作成功",
+                            type: "success"
+                        })
+                        ied[0].ied_no=value
+                        let areaInfo = anyData.value.filter((r)=>{
+                            return r.area_id==loadAreaId.value
+                        })
+                        areaInfo.ieds=[] //清除ieds,以便下次点击间隔时触发从后台重新获取装置列表
+                    }else{
+                        ElMessage({
+                            message: "操作失败:"+res.msg,
+                            type: "success"
+                        })
+                    }
+                })
+            }).catch(() => {
+                // 用户点击取消或关闭对话框
+            });
+        }
 
         onMounted(() => {
             searchAllFlash()
@@ -664,6 +715,7 @@ export default {
             textIs,
             saveLoading,
             filterLength,//装置筛选有无attr_desc属性时的数组长度
+            setIedExtrefNo,
         }
     },
     components: {
@@ -766,6 +818,7 @@ em {
 
 :deep(.el-form--inline .el-form-item) {
     margin-right: 12px !important;
+    margin-bottom: 10px !important;
 }
 
 :deep(.el-select .el-input__wrapper) {