浏览代码

完善、修复检测任务主界面功能和bug

liling 1 年之前
父节点
当前提交
8ce23f090b

+ 66 - 30
src/pages/mission/components/CreateMis.vue

@@ -38,22 +38,23 @@
                             <el-option v-for="(item, index) in rmList" :label="item.name" :value="item.id" />
                         </el-select>
                     </el-form-item>
-                    <el-form-item prop="misMes" :label-class="{ 'my-red-label': true }">
+                    <el-form-item prop="misMes">
                         <template #label>
-                            <span style="color: red;">任务说明</span>
+                            <span>任务说明</span>
                         </template>
                         <el-input style="width: 1136px;" v-model="newMission.misMes"></el-input>
                     </el-form-item>
                     <el-form-item label="SCD文件">
+                        <div style="width:100%;text-align: left;">{{ scdName }}</div>
                         <el-upload ref="upload" class="upload-demo" :http-request="nowUpload" :limit="2"
                             element-loading-text="上传中..." element-loading-background="rgba(255, 255, 255, 0.8)"
                             :show-file-list="false">
                             <template #trigger>
                                 <el-button style="border-bottom: 1px solid #7BBAFD;width: calc(100vw - 1000px);"
-                                    type="primary" plain>点击选择scd文件</el-button>
+                                    type="primary" plain>选择SCD文件</el-button>
                             </template>
                         </el-upload>
-                        <span v-loading="scdLoading">{{ scdLoading ? '正在进行间隔装置分析' : '分析完成' }}
+                        <span style="margin-left: 10px;" v-loading="scdLoading">{{ scdLoading ? ' 正在进行SCD间隔装置分析' : ' SCD分析完成' }}
                         </span>
                     </el-form-item>
                 </el-form>
@@ -70,7 +71,7 @@
                         <div>
                             <img src="../../../assets/icon/DotsNine.png" alt="">
                         </div>
-                        <div>
+                        <div style="height: 24px;line-height: 22px;margin-left: 5px;">
                             <span>间隔列表</span>
                         </div>
                     </div>
@@ -86,30 +87,29 @@
                         <div>
                             <img src="../../../assets/icon/HardDrives.png" alt="">
                         </div>
-                        <div style="margin-left: 5px;">
+                        <div style="height: 24px;line-height: 22px;margin-left: 5px;">
                             <span>装置列表——间隔:<em>{{ jg }}</em></span>
                             <span>检测模型:<em>{{ flashLevel ? flashLevel + '线路保护模型' : '' }}</em></span>
                         </div>
-                        <div
-                            style="position: absolute;top: 0px;right: 0px;display: flex;justify-content: center;align-items: center;">
-
+                        <div style="position: absolute;top: 0px;right: 0px;display: flex;justify-content: center;align-items: center;">
+                            <!--
                             <div style="margin: 0 10px;">
                                 <el-checkbox label="开启检测" size="large" />
                             </div>
-                            <div>
+                            -->
+                            <div style="margin: 5px;">
                                 <el-button type="primary" size="small" plain @click="checkTime">选择装置</el-button>
                             </div>
                         </div>
-
                     </div>
-                    <div v-loading="iedLoading">
+                    <div v-loading="iedLoading" style="margin: 10px;float: left;">
                         <!-- <div v-for="(item, index) in mx">
                             {{ item.ied_name }}
                         </div> -->
                         <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'" type="info" :closable="item.isChoose" effect="plain"
-                            @close="tagClose(item, index)">
-                            {{ item.ied_name }}
+                            :class="item.isChoose ? 'mx-2' : 'mx-1'" closable="true" effect="plain"
+                            @close="tagClose(item)">
+                            {{ '['+item.ied_name+']'+(item.attr_desc||'') }}
                         </el-tag>
                     </div>
                 </div>
@@ -122,7 +122,7 @@
         <!-- 模态框组件 -->
         <div>
             <LookScd v-if="scdLooks" :scdLooks="scdLooks" @nowBack="nowBack" @lookNum="lookNum"></LookScd>
-            <ModelTree v-if="treeMool" :treeMool="treeMool" :treeNeed="treeNeed" @treeBack="treeBack" @treeNum="treeNum">
+            <ModelTree v-if="treeMool" :treeMool="treeMool" :treeNeed="treeNeed" :checkedNodeNames="checkedNodeNames" @treeBack="treeBack" @treeNum="treeNum">
             </ModelTree>
             <FlashCreate v-if="fcModal" :fcModal="fcModal" @fcBack="fcBack"></FlashCreate>
             <CheckIed v-if="iedModal" :iedModal="iedModal" :loadScdId="loadScdId" @iedBack="iedBack"
@@ -142,7 +142,7 @@ import LookScd from '../modalComp/LookScd.vue';
 import ModelTree from '../modalComp/ModelTree.vue';
 import FlashCreate from '../modalComp/FlashCreate.vue';
 import CheckIed from '../modalComp/CheckIed.vue';
-import { ElMessage, ElLoading } from 'element-plus';
+import { ElMessage,ElMessageBox, ElLoading } from 'element-plus';
 export default {
     props: {
         btnSelect: {
@@ -221,6 +221,7 @@ export default {
             id: "area_id",
         })
         let treeNeed = ref([])//modelTree.vue需要的回显数据
+        let checkedNodeNames = ref([])
         let anyData = ref([])
         let states = ref(0)
         let flashLevel = ref("")
@@ -244,17 +245,32 @@ export default {
                 if (props.editRow.name) {
                     needEdit.value = props.editRow
                     newMission.value.misName = needEdit.value.name//任务名称
-                    newMission.value.misNum = needEdit.value.id//任务id
+                    newMission.value.misNum = needEdit.value.code//任务id
                     newMission.value.flashId = needEdit.value.station_id//变电站id
                     newMission.value.misMes = needEdit.value.memo//备注或描述
                     newMission.value.reportNow = needEdit.value.report_id//报告模板
                     loadScdId.value = needEdit.value.scd_id//scdid
                     task.getTaskById({ id: needEdit.value.id - 0 }).then(res => {
                         if (res.data != null) {
+                            let modelnames = res.data.models.map((item, index) => {
+                                return item.model_name
+                            })
                             let arr = res.data.models.map((item, index) => {
-                                return item.id
+                                return item.sys_model_id
                             })
+                            cmodel.value = modelnames.join(',')
                             mxId.value = arr
+                            treeNeed.value = arr
+                            checkedNodeNames.value = modelnames
+                            loadScdId.value = res.data.scd_id
+                            scdName.value = res.data.scd_info.scd_name
+                            successScd.value = true
+                            scd.getLoadScd({ scd_id: res.data.scd_id*1 }).then(res => {
+                                if (res.code == 0) {
+                                    successScd.value = true
+                                    anyData.value = res.data
+                                }
+                            })
                         }
                     })
                 } else {
@@ -276,7 +292,6 @@ export default {
                                 value: item.id
                             }
                         })
-                        console.log(flashList.value, 'flash');
                     }
                 })
             })
@@ -347,6 +362,9 @@ export default {
 
         }
         function nowUpload(e) {
+            if( scdLoading.value ){
+                return
+            }
             const loading = ElLoading.service({
                 lock: true,
                 text: '文件上传中',
@@ -357,6 +375,7 @@ export default {
                 if (res.code == 0) {
                     loading.close()
                 }
+                scdName.value = res.data.filename
                 scd.loadScd({ station_id: newMission.value.flashId - 0, scd_path: res.data.path, scd_name: res.data.filename }).then(the => {
                     // scd.getLoadScd({ scd_id: the.data - 0 }).then(lod => {
                     //     console.log(lod,'rsasdas');
@@ -390,7 +409,7 @@ export default {
                 if (res.code == 0) {
                     ElMessage({
                         type: "success",
-                        message: "添加ied成功!",
+                        message: "间隔装置设置保存成功!",
                         duration: 1500,
                     })
                     emit("createBack", 0)
@@ -398,14 +417,16 @@ export default {
                     ElMessage({
                         type: "error",
                         message: res.msg,
-                        duration: 1500,
+                        duration: 3000,
                     })
                 }
             })
         }
         function tagClose(row, num) {
-            mx.value.splice(mx.value.indexOf(row), 1)
-            iedName.value = mx.value.map(item => item.ied_name).join(',');
+            ElMessageBox.confirm('确认从该间隔移除当前装置'+row.ied_name+'吗?','删除装置').then(() => {
+                mx.value.splice(mx.value.indexOf(row), 1)
+                iedName.value = mx.value.map(item => item.ied_name).join(',');
+            }).catch(() => {})
         }
         function tagClick(row, num) {
             // 将所有对象的 isChoose 属性设置为 false
@@ -449,6 +470,17 @@ export default {
             iedModal.value = data
         }
         function iedArrBack(data) {
+            for(let i=0; i<data.length; i++){
+                let obj = mx.value.filter(item => item.ied_name==data[i].ied_name)
+                if( obj != null && obj.length > 0){
+                    ElMessage({
+                        type: "info",
+                        message: data[i].ied_name+":该装置已存在!",
+                        duration: 3000,
+                    })
+                    return
+                }
+            }
             mx.value = mx.value.concat(data)
             iedName.value = mx.value.map(item => item.ied_name).join(',');
         }
@@ -512,6 +544,7 @@ export default {
             iedLoading,
             needEdit,//需要编辑的任务
             treeNeed,//modelTree.vue需要的回显id
+            checkedNodeNames,
             states,
             myForm,//表单ref
             resetForm,
@@ -545,7 +578,7 @@ em {
 
 .formBox {
     width: 1136px;
-    height: 339px;
+    height: 360px;
     margin: 0 auto;
     /* border-bottom: 1px dashed #dbdbdb; */
 }
@@ -568,14 +601,14 @@ em {
 
 .gapBox {
     width: 288px;
-    height: calc(100vh - 600px);
+    height: calc(100vh - 640px);
     overflow-y: auto;
     border: 1px solid #5779D7;
 }
 
 .unitBox {
     width: 832px;
-    height: calc(100vh - 600px);
+    height: calc(100vh - 640px);
     overflow-y: auto;
     border: 1px solid #5779D7;
     position: relative;
@@ -595,19 +628,23 @@ em {
 }
 
 .mx-1 {
-    width: 100px;
+    float: left;
+    min-width: 100px;
     height: 30px;
     margin-right: 10px;
     margin-top: 5px;
+    margin-bottom: 5px;
     border: 1px solid #5779D7;
     color: black;
 }
 
 .mx-2 {
-    width: 100px;
+    float: left;
+    min-width: 100px;
     height: 30px;
     margin-right: 10px;
     margin-top: 5px;
+    margin-bottom: 5px;
     border: 1px solid #5779D7;
     background-color: rgba(89, 120, 213, 0.3);
     color: #5779D7;
@@ -631,7 +668,6 @@ em {
 
 :deep(.el-tag--large .el-tag__close) {
     margin-left: 25px;
-    pointer-events: none;
 }
 
 :deep(.el-icon svg) {

+ 68 - 32
src/pages/mission/components/HaveMis.vue

@@ -3,12 +3,13 @@
     <div class="bigBox">
       <!-- 点击开始检测盒子 -->
       <div class="startBox">
-        <p class="nowIn">{{ nowRunList.name ? nowRunList.name : "暂无待检测任务" }}</p>
-        <p class="createDate">创建日期:{{ nowRunList.ct ? nowRunList.ct : "暂无时间" }}</p>
-        <img src="../../../assets/image/start_btn.png" alt="" style="cursor: pointer;" @click="startNow(nowRunList)" />
-        <p class="nowModel">
-          当前模型:<em class="nowEm">{{ nowRunList.voltage_name ? nowRunList.voltage_name + '线路保护' : "暂无数据" }}<img
-              v-if="nowRunList.voltage_name" src="../../../assets/icon/pencil.png" alt="" /></em>
+        <p class="nowIn">{{ lookingTask.name ? lookingTask.name : "请选择一个待检测任务" }}</p>
+        <p v-if="lookingTask.name" class="createDate">创建日期:{{ lookingTask.ct ? lookingTask.ct : "暂无时间" }}</p>
+        <img src="../../../assets/image/start_btn.png" alt="" style="cursor: pointer;" @click="startNow(lookingTask)" />
+        <p class="nowModel" v-if="lookingTask.name">
+          <span style="margin-right: 15px;">检测模型:</span>
+          <el-select v-model="currEditTaskModels"><el-option v-for="(item,index) in taskModels" :title="item.model_name" :key="index" :label="item.model_name" :value="item.model_id"/></el-select>
+          <span style="margin: 10px;cursor: pointer;"><img src="../../../assets/icon/pencil.png" alt="编辑所选模型"  @click="editTaskModel"/></span>
         </p>
       </div>
       <!-- 待检测任务 -->
@@ -18,24 +19,23 @@
         </div>
         <div style="display: flex;justify-content: flex-start;align-items: center;overflow-x: auto;"
           v-if="nowRunList.name || misList.length > 0">
-          <div :class="setImg(nowRunList)" v-if="nowRunList.name">
+          <div :class="setImg(nowRunList)" v-if="nowRunList.name"  @click="startNow(nowRunList)">
             <div class="intBoxOne">
               <p class="intOne">
                 <span style="font-size: 18px;color: white;">{{ nowRunList.name }}</span>
-                <span style="font-size: 12px;" @click="editItem(nowRunList)">编辑</span>
               </p>
               <p style="margin-left: 8px;">
-                <img style="width: 15px;height: 15px;" src="../../../assets/icon/white_flash.png" alt="" />
+                <img style="width: 15px;height: 15px;float: left;padding-top:2px" src="../../../assets/icon/white_flash.png" alt="" />
                 <span style="font-size: 12px;color:white" class="commonSpan">{{ nowRunList.station_name }}</span>
               </p>
               <p style="margin-left: 8px;">
-                <img style="width: 15px;height: 15px;" src="../../../assets/icon/white_clock.png" alt="" />
+                <img style="width: 15px;height: 15px;float: left;padding-top:2px" src="../../../assets/icon/white_clock.png" alt="" />
                 <span style="font-size: 12px;color:white" class="commonSpan">{{ nowRunList.ct }}</span>
               </p>
             </div>
             <!-- 点击检测 -->
             <div class="setNow">
-              <span style="font-size: 16px;color:white" class="setnowspan" @click="startNow(nowRunList)">检测中<em
+              <span style="font-size: 16px;color:white" class="setnowspan">检测中<em
                   v-loading="emLoading"></em></span>
             </div>
           </div>
@@ -47,13 +47,13 @@
                 <span style="font-size: 12px;cursor: pointer;" @click="editItem(item, index)">编辑</span>
               </p>
               <p style="margin-left: 8px;">
-                <img style="width: 15px;height: 15px;"
+                <img style="width: 15px;height: 15px;float: left;padding-top:2px"
                   :src="isImg && isIndex == index ? require('../../../assets/icon/white_flash.png') : require('../../../assets/icon/flash_darkBlue.png')"
                   alt="" />
                 <span style="font-size: 12px;" class="commonSpan">{{ item.station_name }}</span>
               </p>
               <p style="margin-left: 8px;">
-                <img style="width: 15px;height: 15px;"
+                <img style="width: 15px;height: 15px;float: left;padding-top:2px"
                   :src="isImg && isIndex == index ? require('../../../assets/icon/white_clock.png') : require('../../../assets/icon/clock_darkBlue.png')"
                   alt="" />
                 <span style="font-size: 12px;" class="commonSpan">{{ item.ut }}</span>
@@ -61,7 +61,7 @@
             </div>
             <!-- 点击检测 -->
             <div class="setNow">
-              <span style="font-size: 16px;" class="setnowspan" @click="startNow(item, index)">立即检测</span>
+              <span style="font-size: 16px;" class="setnowspan" @click="startBefore(item, index)">立即检测</span>
             </div>
           </div>
         </div>
@@ -92,13 +92,13 @@
                   </el-icon></span>
               </p>
               <p style="margin-left: 8px;">
-                <img style="width: 15px;height: 15px;"
+                <img style="width: 15px;height: 15px;float: left;padding-top:2px"
                   :src="isImgs && isIndexs == index ? require('../../../assets/icon/white_flash.png') : require('../../../assets/icon/flash_darkBlue.png')"
                   alt="" />
                 <span style="font-size: 12px;" class="commonSpan">{{ item.station_name }}</span>
               </p>
               <p style="margin-left: 8px;">
-                <img style="width: 15px;height: 15px;"
+                <img style="width: 15px;height: 15px;float: left;padding-top:2px"
                   :src="isImgs && isIndexs == index ? require('../../../assets/icon/white_clock.png') : require('../../../assets/icon/clock_darkBlue.png')"
                   alt="" />
                 <span style="font-size: 12px;" class="commonSpan">{{ item.ct }}</span>
@@ -128,9 +128,12 @@ export default {
     let imgBack = ref("@/assets/image/card_blue.png");
     let router = useRouter();
     let sizeNum = ref(1);
+    let lookingTask = ref({}) //当前点击查看的任务对象
+    let taskModels = ref([]) //任务模型列表
     let misList = ref([])//待检测任务列表
     let nowRunList = ref({})//正在检测任务列表
     let passList = ref([])//已完成检测任务列表
+    let currEditTaskModels = ref(null)
     let emLoading = ref(true)
     let isImg = ref(false)
     let isImgs = ref(false)
@@ -139,6 +142,22 @@ export default {
     function scdLink() {
       router.push("/home/scdMap");
     }
+    function startBefore(row,num){
+      lookingTask.value = row
+      taskModels.value = []
+      task.getTaskById({id:row.id}).then(res => {
+        if(res.code!=0){
+          ElMessage({
+            message: res.msg,
+            type: "error"
+          })
+          return
+        }
+        let models = res.data.models
+        if(models === null || models.length === 0) return
+        taskModels.value = models
+      })
+    }
     function startNow(row, num) {
       if (row.name == null || row.name == '' || row.name == undefined) {
         ElMessage({
@@ -150,8 +169,21 @@ export default {
         emit("hmBack", sizeNum.value, row);
       }
     }
+
+    function editTaskModel(){
+      // 跳转到内置模型编辑组件
+      let m1 = taskModels.value.filter(item => item.model_id == currEditTaskModels.value)
+      if(m1.length === 0 ) return
+      router.push({
+        path: "/home/setting",
+        query: {
+          modelid: currEditTaskModels.value,
+          modelname: m1[0].model_name
+        },
+      });
+    }
+
     function goNetStructPicture(row) {
-      console.log(row, 'push');
       router.push({
         path: "/home/netStructPicture",
         query: {
@@ -204,9 +236,11 @@ export default {
       task.getTask({ pageno: 1, pagesize: 10, state: 1 }).then(res => {
         if (res.data == null) {
           nowRunList.value = {}
+          lookingTask.value ={}
           return
         } else {
           nowRunList.value = res.data[0]
+          lookingTask.value = res.data[0] //默认查看该任务信息
         }
       })
     }
@@ -243,12 +277,17 @@ export default {
       imgBack,
       scdLink,
       startNow,
+      startBefore,
+      editTaskModel,
+      currEditTaskModels,
       sizeNum,
       goNetStructPicture,
       getList,
       misList,//待检测任务列表
       editItem,
       nowRunList,//正在检测任务列表
+      lookingTask,
+      taskModels,
       setImg,
       passList,//已完成列表
       emLoading,
@@ -283,7 +322,7 @@ p {
 }
 
 .startBox {
-  width: 320px;
+  width: 100%;
   height: 335px;
   margin: 0 auto;
   /* border: 1px solid black; */
@@ -322,18 +361,23 @@ p {
 
 .nowEm {
   font-style: normal;
-  font-size: 18px;
+  font-size: 16px;
   font-family: Source Han Sans CN-Medium, Source Han Sans CN;
   font-weight: 500;
   color: #255ce7;
   line-height: 24px;
+  margin: 0 10px;
+  width: 100px;
   border-bottom: 1px solid #255ce7;
+  float: left;
 }
 
 .noReportBox {
   width: 99%;
   height: 100%;
-  margin-left: 8px;
+  margin-left: 15px;
+  float: left;
+  min-height: 50px;
   /* border: 1px solid salmon; */
 }
 
@@ -345,9 +389,9 @@ p {
 }
 
 .intBox {
-  width: 336px;
-  height: 144px;
-  line-height: 30px;
+  width: 269px;
+  height: 116px;
+  line-height: 20px;
   background-repeat: no-repeat;
   background-size: 100% 100%;
   margin: 15px 15px;
@@ -356,16 +400,8 @@ p {
   box-shadow: inset 0px -3px 3px 0px #C8D4EC;
 }
 
-.intBox:hover {
-  width: 336px;
-  height: 144px;
-  line-height: 30px;
-  background-repeat: no-repeat;
-  background-size: 100% 100%;
-  margin: 15px 15px;
+.intBox:hover {  
   background-color: #8BA6F0;
-  border-radius: 5px;
-  box-shadow: inset 0px -3px 3px 0px #C8D4EC;
   color: white;
 }
 

+ 6 - 4
src/pages/mission/modalComp/CheckIed.vue

@@ -1,6 +1,6 @@
 <template>
     <div>
-        <el-dialog v-model="dialogVisible" draggable title="选择ied" width="30%" @close="sureclose"
+        <el-dialog v-model="dialogVisible" draggable title="选择间隔装置" width="30%" @close="sureclose"
             :close-on-click-modal="false">
             <el-tree :data="treeList" :props="treeProps" @check-change="handleNodeClick" show-checkbox
                 style="height: 300px;overflow-y: auto;" />
@@ -49,8 +49,10 @@ export default {
                 if (res.data != null) {
                     treeList.value = res.data.map(item => {
                         return {
-                            label: item.ied_name + " " + item.name,
-                            id: item.area_id,
+                            label: "["+item.ied_name + "] " + item.attr_desc,
+                            id: item.ied_id,
+                            ied_name: item.ied_name,
+                            attr_desc: item.attr_desc
                         }
                     })
                 }
@@ -66,7 +68,7 @@ export default {
             emit("iedBack", dialogVisible.value)
         }
         function handleNodeClick(e) {
-            const existingIndex = checkArr.value.findIndex(item => item.id === e.id);
+            const existingIndex = checkArr.value.findIndex(item => item.ied_id === e.id);
             if (existingIndex === -1) {
                 // 如果 e.id 不在 checkArr 中,则将 e 添加到 checkArr
                 checkArr.value.push(e);

+ 17 - 5
src/pages/mission/modalComp/ModelTree.vue

@@ -4,7 +4,7 @@
             <el-dialog v-loading="loading" v-model="dialogVisible" title="选择模型" width="30%" @close="sureclose" :close-on-click-modal="false">
                 <el-tree ref="treeRef" :data="treeData" style="height: calc(100vh - 500px);overflow-y: auto;" show-checkbox
                     node-key="id" @check-change="handleCheckChange" :check-strictly="true" default-expand-all
-                    :expand-on-click-node="false" :props="defaultProps" />
+                    :expand-on-click-node="false" :props="defaultProps" :default-checked-keys="checkKey" />
                 <template #footer>
                     <span class="dialog-footer">
                         <el-button @click="cleanBox">取消</el-button>
@@ -36,6 +36,10 @@ export default {
         treeNeed: {
             type: Array,
             required: true,
+        },
+        checkedNodeNames: {
+            type: Array,
+            required: true,
         }
     },
     setup(props, { emit }) {
@@ -53,12 +57,16 @@ export default {
         let { cleanBox, sureArr } = toRefs(props)
         let dialogVisible = ref(false)
         let checkKey = ref([])//默认选中的key
+        let checkNames = ref([])//默认选中的names
         let treeRef = ref(null)
         watch(() => props.treeNeed, (newVal) => {
             checkKey.value = newVal
-        })
-        function reload() {
-            if (props.treeNeed&&treeRef.value) {
+        },{immediate:true})
+        watch(() => props.checkedNodeNames, (newVal) => {
+            checkNames.value = newVal
+        },{immediate:true})
+        function reload() {            
+            if (props.treeNeed) {
                 checkKey.value = props.treeNeed
             }
         }
@@ -100,6 +108,11 @@ export default {
                     loading.value = false
                     lord.style.display = 'none'
                 }
+                treeRef.value.setCheckedKeys(checkKey.value)
+                if( checkKey.value != null) {
+                    mdId.value = checkKey.value
+                    mdName.value = checkNames.value
+                }
             }).catch(error => {
                 // 处理错误
                 console.error("Error:", error);
@@ -110,7 +123,6 @@ export default {
         function handleCheckChange(e) {
             const id = e.id;
             const model_name = e.model_name;
-
             if (!mdId.value.includes(id)) {
                 mdId.value.push(id);
                 mdName.value.push(model_name);