Forráskód Böngészése

Merge branch 'master' of http://94.191.59.107:3000/houwenfeng/scd_tools_ui

“yueshang” 1 éve
szülő
commit
10d3e91566

+ 1 - 0
src/api/cid/cid.js

@@ -29,6 +29,7 @@ function fileUpload(data) {
         headers: {
             'content-Type': 'multipart/form-data',
         },
+        timeout:500000,
     })
 }
 function saveMap(data){

+ 8 - 0
src/api/task.js

@@ -38,10 +38,18 @@ function delTask(data){
         data
     })
 }
+function lookStep(data){
+    return request({
+        url:`/task/check/step_info`,
+        method:"get",
+        params:data,
+    })
+}
 export default {
     getTask,
     tackStart,
     createTask,
     stopTask,
     delTask,
+    lookStep,
 }

BIN
src/assets/icon/clock_darkBlue.png


BIN
src/assets/icon/flash_darkBlue.png


+ 15 - 10
src/pages/mission/components/CreateMis.vue

@@ -193,12 +193,16 @@ export default {
         function searchAllFlash() {
             flashPower.getAllArea({}).then(res => {
                 flashPower.getAllFlashPower({ pid: res.data[0].pid }).then(res => {
-                    flashList.value = res.data.map(item => {
-                        return {
-                            label: item.area_name,
-                            value: item.id
-                        }
-                    })
+                    if (res.data == null) {
+                        return
+                    } else {
+                        flashList.value = res.data.map(item => {
+                            return {
+                                label: item.area_name,
+                                value: item.id
+                            }
+                        })
+                    }
                 })
             })
             report.getReport({}).then(res => {
@@ -316,9 +320,9 @@ export default {
             })
         }
         function tagClose(row, num) {
-           mx.value.splice(mx.value.indexOf(row), 1)
-           iedName.value = mx.value.map(item => item.ied_name).join(', ');
-           console.log(iedName,'iedname');
+            mx.value.splice(mx.value.indexOf(row), 1)
+            iedName.value = mx.value.map(item => item.ied_name).join(', ');
+            console.log(iedName, 'iedname');
         }
         function checkTime() {
             iedModal.value = true
@@ -487,7 +491,8 @@ em {
     text-align: center;
     line-height: 30px;
 }
-.mx-1{
+
+.mx-1 {
     margin-right: 10px;
     border: 1px solid #5779D7;
 }

+ 111 - 38
src/pages/mission/components/HaveMis.vue

@@ -3,11 +3,12 @@
     <div class="bigBox">
       <!-- 点击开始检测盒子 -->
       <div class="startBox">
-        <p class="nowIn">正在检测的任务名称</p>
-        <p class="createDate">创建日期:2000-00-00</p>
-        <img src="../../../assets/image/start_btn.png" alt="" />
+        <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">110kv线路保护<img src="../../../assets/icon/pencil.png" alt="" /></em>
+          当前模型:<em class="nowEm">{{ nowRunList.voltage_name ? nowRunList.voltage_name + '线路保护' : "暂无数据" }}<img
+              v-if="nowRunList.voltage_name" src="../../../assets/icon/pencil.png" alt="" /></em>
         </p>
       </div>
       <!-- 待检测任务 -->
@@ -16,28 +17,46 @@
           <p class="norep">待检测任务</p>
         </div>
         <div style="display: flex;justify-content: flex-start;align-items: center;overflow-x: auto;">
-          <!-- <template> -->
-          <div class="intBox" v-for="(item,index) in misList">
-            <div class="intBoxOne"> 
+          <div class="intBox" v-if="nowRunList.name" :style="setImg(nowRunList)">
+            <div class="intBoxOne">
+              <p class="intOne">
+                <span style="font-size: 18px;color: #1A2447;">{{ nowRunList.name }}</span>
+                <span style="font-size: 12px;" @click="deldel(nowRunList)">删除</span>
+              </p>
+              <p>
+                <img style="width: 15px;height: 15px;" src="../../../assets/icon/flash_darkBlue.png" alt="" />
+                <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ nowRunList.station_name }}</span>
+              </p>
+              <p>
+                <img style="width: 15px;height: 15px;" src="../../../assets/icon/clock_darkBlue.png" alt="" />
+                <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ nowRunList.ct }}</span>
+              </p>
+            </div>
+            <!-- 点击检测 -->
+            <div class="setNow">
+              <span style="font-size: 16px;color:green" class="setnowspan" @click="startNow(nowRunList)">正在检测中<em v-loading="emLoading"></em></span>
+            </div>
+          </div>
+          <div class="intBox" v-for="(item, index) in misList" :style="setImg(item, index)">
+            <div class="intBoxOne">
               <p class="intOne">
                 <span style="font-size: 18px;color: #1A2447;">{{ item.name }}</span>
-                <span style="font-size: 12px;" @click="deldel(item,index)">删除</span>
+                <span style="font-size: 12px;" @click="deldel(item, index)">删除</span>
               </p>
               <p>
-                <!-- <img src="../../../assets/icon/white_flash.png" alt="" /> -->
+                <img style="width: 15px;height: 15px;" src="../../../assets/icon/flash_darkBlue.png" alt="" />
                 <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ item.station_name }}</span>
               </p>
               <p>
-                <!-- <img src="../../../assets/icon//white_clock.png" alt="" /> -->
+                <img style="width: 15px;height: 15px;" src="../../../assets/icon/clock_darkBlue.png" alt="" />
                 <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ item.ut }}</span>
               </p>
             </div>
             <!-- 点击检测 -->
             <div class="setNow">
-              <span style="font-size: 16px;color:blue" class="setnowspan" @click="startNow(item,index)">立即检测</span>
+              <span style="font-size: 16px;color:blue" class="setnowspan" @click="startNow(item, index)">立即检测</span>
             </div>
           </div>
-          <!-- </template> -->
         </div>
       </div>
       <!-- 已完成 -->
@@ -45,21 +64,20 @@
         <div>
           <p class="norep">最近检测任务-已完成</p>
         </div>
-        <div>
-          <!-- <template> -->
-          <div class="intBox" :style="{ 'background-image': `url(${imgBack})` }">
+        <div style="display: flex;justify-content: flex-start;align-items: center;overflow-x: auto;">
+          <div class="intBox" v-for="(item, index) in passList">
             <div class="intBoxOne">
               <p class="intOne">
-                <span>检测任务名称</span>
+                <span>{{ item.name }}</span>
                 <span>详情→</span>
               </p>
               <p>
                 <img src="../../../assets/icon/white_flash.png" alt="" />
-                <span class="commonSpan">某个变电站</span>
+                <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ item.station_name }}</span>
               </p>
               <p>
                 <img src="../../../assets/icon//white_clock.png" alt="" />
-                <span class="commonSpan">2000-00-00</span>
+                <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ item.ct }}</span>
               </p>
             </div>
             <!-- 点击检测 -->
@@ -69,7 +87,6 @@
               <span class="setnowspan">检测结果</span>
             </div>
           </div>
-          <!-- </template> -->
         </div>
       </div>
     </div>
@@ -81,18 +98,29 @@ import { ref, onMounted, computed, toRefs } from "vue";
 import { useRouter } from "vue-router";
 import task from "@/api/task"
 import imgs from "../jscom/img";
+import { ElLoading, ElMessage } from "element-plus";
 export default {
   setup(props, { emit }) {
     let imgBack = ref(require("@/assets/image/card_blue.png"));
     let router = useRouter();
     let sizeNum = ref(1);
-    let misList = ref([])//任务列表
+    let misList = ref([])//待检测任务列表
+    let nowRunList = ref({})//正在检测任务列表
+    let passList = ref([])//已完成检测任务列表
+    let emLoading = ref(true)
     function scdLink() {
       router.push("/home/scdMap");
     }
-    function startNow(row,num) {
-      sizeNum.value = 1;
-      emit("hmBack", sizeNum.value,row);
+    function startNow(row, num) {
+      if (row.name == null || row.name == '' || row.name == undefined) {
+        ElMessage({
+          message:"暂无检测任务",
+          type:"info"
+        })
+      } else {
+        sizeNum.value = 1;
+        emit("hmBack", sizeNum.value, row);
+      }
     }
     function goNetStructPicture() {
       router.push({
@@ -103,29 +131,68 @@ export default {
         },
       });
     }
-    function getList(){
+    function getList() {
+      const loading = ElLoading.service({
+        lock: true,
+        text: '正在查询数据',
+        background: 'rgba(0, 0, 0, 0.7)',
+      })
       // 0为待检测
-      task.getTask({pageno:1,pagesize:10,state:0}).then(res=>{
-        misList.value = res.data
-        emit("haveBack",misList.value)
+      task.getTask({ pageno: 1, pagesize: 10, state: 0 }).then(res => {
+        if (res.data == null) {
+          loading.close()
+          misList.value = []
+          return
+        } else {
+          const sortedList = res.data.sort((a, b) => {
+            // 将 state 为 0 的对象排在前面
+            if (a.state === 1 && b.state !== 1) {
+              return -1; // a排在b前面
+            } else if (a.state !== 1 && b.state === 1) {
+              return 1; // b排在a前面
+            } else {
+              return 0; // 不需要交换位置
+            }
+          });
+          misList.value = sortedList;
+          emit("haveBack", misList.value);
+          loading.close()
+        }
       })
       // 2为完成检测
-      task.getTask({pageno:1,pagesize:10,state:2}).then(res=>{
-        // misList.value = res.data
-        console.log(res,'完成');
+      task.getTask({ pageno: 1, pagesize: 10, state: 2 }).then(res => {
+        if (res.data == null) {
+          passList.value = []
+          return
+        } else {
+          passList.value = res.data
+        }
       })
       // 1为正在检测
-      task.getTask({pageno:1,pagesize:10,state:1}).then(res=>{
-        // misList.value = res.data
-        console.log(res,'正在');
+      task.getTask({ pageno: 1, pagesize: 10, state: 1 }).then(res => {
+        if (res.data == null) {
+          nowRunList.value = {}
+          return
+        } else {
+          nowRunList.value = res.data[0]
+          console.log(res.data, 'res.data');
+          console.log(nowRunList.value, 'now');
+        }
       })
     }
-    function deldel(row){
-      task.delTask({id:row.id}).then(res=>{
+    function deldel(row) {
+      task.delTask({ id: row.id }).then(res => {
         getList()
       })
     }
-    onMounted(()=>{
+    function setImg(row, num) {
+      if (row.state == "1") {
+        return { 'background-image': `url(${imgBack})` }
+      } else {
+        return {}
+      }
+    }
+    onMounted(() => {
       getList()
     })
     return {
@@ -135,8 +202,12 @@ export default {
       sizeNum,
       goNetStructPicture,
       getList,
-      misList,
+      misList,//待检测任务列表
       deldel,
+      nowRunList,//正在检测任务列表
+      setImg,
+      passList,//已完成列表
+      emLoading
     };
   },
 };
@@ -232,9 +303,11 @@ p {
 .intBoxOne {
   padding-top: 5px;
 }
-.intOne{
+
+.intOne {
   position: relative;
 }
+
 .intOne span:nth-child(2) {
   /* margin-left: 70px; */
   font-size: 14px;

+ 35 - 16
src/pages/mission/components/StartMission.vue

@@ -13,7 +13,7 @@
             <div class="stepAndEnd">
                 <!-- 步骤条 -->
                 <div class="stepBox">
-                    <StepMethod></StepMethod>
+                    <StepMethod :stepList="stepList"></StepMethod>
                 </div>
                 <!-- 结果 -->
                 <div class="endBox">
@@ -25,42 +25,60 @@
 </template>
 
 <script>
-import { ref, onMounted, toRefs,watch } from 'vue';
+import { ref, onMounted, toRefs, watch } from 'vue';
 import StepMethod from './StepMethod.vue';
 import task from '@/api/task';
 import { ElMessage } from 'element-plus';
 export default {
-    props:{
-        startMis:{
-            type:Object,
-            required:true
+    props: {
+        startMis: {
+            type: Object,
+            required: true
         }
     },
     setup(props, { emit }) {
         let arrow = ref(0)
         let loadingMis = ref({})
-        watch(()=>props.startMis,(newVal)=>{
+        let stepList = ref([])
+        watch(() => props.startMis, (newVal) => {
             loadingMis.value = newVal
-            console.log(loadingMis.value,'watch');
+            console.log(loadingMis.value, 'watch');
         })
         function misDown() {
-            task.stopTask({id:loadingMis.value.id}).then(res=>{
-                if(res.code == 0){
+            task.stopTask({ id: loadingMis.value.id }).then(res => {
+                if (res.code == 0) {
                     ElMessage({
-                        message:"取消成功",
-                        type:"success"
+                        message: "取消成功",
+                        type: "success"
                     })
                 }
             })
             emit("smBack", arrow.value)
         }
-        function picReload(){
+        function picReload() {
             loadingMis.value = props.startMis
-            task.tackStart({id:loadingMis.value.id}).then(res=>{
-                console.log(res,'开始');
+            console.log(loadingMis.value, 'loading');
+            task.tackStart({ id: loadingMis.value.id }).then(res => {
+                console.log(res, '开始');
+                let countTime = setInterval(() => {
+                    task.lookStep({ id: loadingMis.value.id - 0 }).then(res => {
+                        if (res.data) {
+                            stepList.value = res.data.map((item, index) => {
+                                return {
+                                    title: item.step_name,
+                                    content: item.step_name
+                                }
+                            })
+                            // clearInterval(countTime)
+                        }
+                    })
+                }, 2000)
+                setTimeout(() => {
+                    clearInterval(countTime)
+                }, 10000)
             })
         }
-        onMounted(()=>{
+        onMounted(() => {
             picReload()
         })
         return {
@@ -68,6 +86,7 @@ export default {
             misDown,
             loadingMis,//传递过来的任务名称
             picReload,//初始化组件
+            stepList,//步骤表
         }
     },
     components: {

+ 17 - 3
src/pages/mission/components/StepMethod.vue

@@ -2,7 +2,7 @@
     <div>
         <div class="bigBox">
             <el-steps :active="activeStep" space="10px" finish-status="success" direction="vertical">
-                <el-step v-for="(step, index) in steps" :key="index" :title="step.title">
+                <el-step v-for="(step, index) in steps" :key="index" :title="step.title" :icon="Loading">
                     {{ step.content }}
                 </el-step>
             </el-steps>
@@ -12,9 +12,16 @@
 </template>
   
 <script>
-import { ref,onMounted } from "vue";
+import { ref,onMounted,toRefs,watch } from "vue";
+import { Edit, Picture, Upload,Loading } from '@element-plus/icons-vue'
 export default {
-    setup() {
+    props:{
+        stepList:{
+            type:Array,
+            required:true,
+        }
+    },
+    setup(props,{emit}) {
         let activeStep = ref(0); // 当前激活的步骤
         let steps = ref([       // 步骤的数据
             { title: "done", content: "这是步骤 1 的内容" },
@@ -25,12 +32,19 @@ export default {
             { title: "步骤 6", content: "这是步骤 3 的内容" },
             // 添加更多步骤
         ])
+        watch(()=>props.stepList,(newVal)=>{
+            steps.value = newVal
+        })
+        function reload(){
+            steps.value = props.stepList
+        }
         function nextStep() {
             if (activeStep.value < steps.value.length) {
                 activeStep.value++;
             }
         };
         onMounted(()=>{
+            reload()
             setInterval(() => {
                 nextStep()
             }, 1000);

+ 4 - 3
src/utils/request.js

@@ -7,7 +7,7 @@ import { useRouter } from 'vue-router'
 const service = axios.create({
     // baseURL: window.STATIC_CONFIG.proxyUrl, // url = base url + request url
     baseURL: "http://8.142.173.95:9527/api",
-    timeout: 15000, // request timeout
+    timeout: 1500000000, // request timeout
     headers:{
         "Content-Type":"application/x-www-form-urlencoded"
     }
@@ -67,7 +67,7 @@ service.interceptors.request.use(
         // return Promise.reject(error)
     }
 )
-
+var router = useRouter()
 // 响应拦截
 service.interceptors.response.use(
     response => {
@@ -77,12 +77,13 @@ service.interceptors.response.use(
     },
     error => {
         console.log(error,'相应拦截器error');
+        console.log(router,'router');
         if(error.code == "ERR_NETWORK"){
             ElMessage({
                 type:"error",
                 message:"网络错误,请重新登录",
             })
-            useRouter().push("/login")
+            router.push("/login")
         }
         if (error.response.status === 401) {
             ElMessage({