Kaynağa Gözat

修复检测报告相关bug

liling 1 yıl önce
ebeveyn
işleme
0aa816ec4f

+ 8 - 0
src/api/scd.js

@@ -87,6 +87,13 @@ function getScdById(data){
         params:data
     })
 }
+function aginParseArea(data){
+    return request({
+        url:`/admin/parse/check_area`,
+        method:"post",
+        params:data
+    })
+}
 export default {
     getAllScd,
     getScdMiddle,
@@ -99,4 +106,5 @@ export default {
     scdAllIed,
     getCrc,
     getScdById,
+    aginParseArea,
 }

+ 3 - 3
src/api/system.js

@@ -16,9 +16,9 @@ function editSystemCode(data){
 // 下载附件
 function downLoad(data){
     return request({
-        url:`/attachment/download`,
-        method:'post',
-        data,
+        url:`/file/download`,
+        method:'get',
+        params:data,
     })
 }
 export default {

+ 50 - 33
src/pages/mission/components/CreateMis.vue

@@ -129,8 +129,9 @@
                 </div>
             </div>
             <div v-if="successScd">
-                <el-button style="width: 200px;height: 30px;" @click="backMent">返回</el-button>
-                <el-button style="width: 200px;height: 30px;" type="primary" @click="iedSave">保存</el-button>
+                <el-button style="width: 100px;height: 30px;" @click="backMent">返回</el-button>
+                <el-button style="width: 100px;height: 30px;" @click="aginParseArea">重新解析</el-button>
+                <el-button style="width: 100px;height: 30px;" type="primary" @click="iedSave">保存</el-button>
             </div>
         </div>
         <!-- 模态框组件 -->
@@ -290,18 +291,7 @@ export default {
                             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.map(item => {
-                                        //获取可能有问题的ied数量,比如没找到的装置
-                                        let alertieds= item.ieds==null ? [] : item.ieds.filter((r)=>{
-                                            return r.attr_desc==null || r.attr_desc=='';
-                                        })
-                                        return { ...item, isLog: alertieds.length>0 ? true : false,filterLength:alertieds.length }; // 使用展开运算符为每个对象添加一个名为 isLog 的新属性,并设置其值为 true
-                                    });
-                                }
-                            })
+                            loadAreaInfo(res.data.scd_id * 1)
                         }
                     })
                 } else {
@@ -311,6 +301,23 @@ export default {
                 return
             }
         }
+        function loadAreaInfo(scdid){
+            mx.value=[]
+            iedLoading.value = true
+            scd.getLoadScd({ scd_id: scdid}).then(res => {
+                iedLoading.value = false
+                if (res.code == 0) {
+                    successScd.value = true
+                    anyData.value = res.data.map(item => {
+                        //获取可能有问题的ied数量,比如没找到的装置
+                        let alertieds= item.ieds==null ? [] : item.ieds.filter((r)=>{
+                            return r.attr_desc==null || r.attr_desc=='';
+                        })
+                        return { ...item, isLog: alertieds.length>0 ? true : false,filterLength:alertieds.length }; // 使用展开运算符为每个对象添加一个名为 isLog 的新属性,并设置其值为 true
+                    });
+                }
+            })
+        }
         function searchAllFlash() {
             flashPower.getAllArea({}).then(res => {
                 flashPower.getAllFlashPower({ pid: res.data[0].pid }).then(res => {
@@ -394,24 +401,7 @@ export default {
                             })
                             saveLoading.value = false
                             // emit("createBack", 0)
-                            scd.getLoadScd({ scd_id: loadScdId.value - 0 }).then(res => {
-                                if (res.code == 0) {
-                                    successScd.value = true
-                                    anyData.value = res.data.map(item => {
-                                        //获取可能有问题的ied数量,比如没找到的装置
-                                        let alertieds= item.ieds==null ? [] : item.ieds.filter((r)=>{
-                                            return r.attr_desc==null || r.attr_desc=='';
-                                        })
-                                        return { ...item, isLog: alertieds.length>0 ? true : false,filterLength: alertieds.length}; // 使用展开运算符为每个对象添加一个名为 isLog 的新属性,并设置其值为 true
-                                    });
-                                } else {
-                                    ElMessage({
-                                        message: res.msg,
-                                        type: "error"
-                                    })
-
-                                }
-                            })
+                            loadAreaInfo(loadScdId.value * 1)
                         } else {
                             ElMessage({
                                 message: res.msg,
@@ -483,6 +473,32 @@ export default {
                 }
             })
         }
+        function aginParseArea(){
+            ElMessageBox.confirm('将清除原来的间隔数据,确定吗?', '间隔解析').then(() => {
+                scd.aginParseArea({scd_id:loadScdId.value*1}).then(res=>{
+                    if(res.code==0){
+                        ElMessage({
+                            type: "success",
+                            message: "间隔解析成功!",
+                            duration: 1500,
+                        })
+                        loadAreaInfo(loadScdId.value * 1)
+                    }else{
+                        ElMessage({
+                        type: "error",
+                        message: res.msg,
+                        duration: 3000,
+                    })
+                    }
+                }).catch(res=>{
+                    ElMessage({
+                        type: "error",
+                        message: "服务器发生异常!",
+                        duration: 3000,
+                    })
+                })
+            }).catch(() => { })
+        }
         function iedSave() {
             scd.stickIed({ scd_id: loadScdId.value - 0, area_id: loadAreaId.value - 0, ied_ids: iedName.value }).then(res => {
                 if (res.code == 0) {
@@ -491,7 +507,7 @@ export default {
                         message: "间隔装置设置保存成功!",
                         duration: 1500,
                     })
-                    // emit("createBack", 0)
+                    loadAreaInfo(loadScdId.value*1)
                 } else {
                     ElMessage({
                         type: "error",
@@ -630,6 +646,7 @@ export default {
             resetForm,
             flashLevel,
             tagClick,//tag标签的点击事件
+            aginParseArea,
             editAndAdd,
             textIs,
             saveLoading,

+ 4 - 2
src/pages/mission/components/HaveMis.vue

@@ -109,7 +109,7 @@
             <div class="intBoxOne">
               <p class="intOne">
                 <span>{{ item.name }}</span>
-                <span>详情<el-icon>
+                <span style="cursor: pointer;" @click="editItem(item, index)">详情<el-icon>
                     <Right />
                   </el-icon></span>
               </p>
@@ -131,6 +131,8 @@
               <span class="setnowspan" @click="goNetStructPicture(item)">scd可视化</span>
               <span style="margin: 0 10px;" class="setnowspan">|</span>
               <span class="setnowspan" @click="outcome(item, index)">检测结果</span>
+              <span style="margin: 0 10px;" class="setnowspan">|</span>
+              <span class="setnowspan" @click="startBefore(item, index)">重新检测</span>
             </div>
           </div>
         </div>
@@ -513,7 +515,7 @@ p {
 }
 
 .setnowspan {
-  font-size: 17px;
+  font-size: 14px;
   cursor: pointer;
   color: blue;
 }

+ 26 - 15
src/pages/mission/components/StartMission.vue

@@ -131,42 +131,53 @@ export default {
                     })
                 } else {
                     const countTime = setInterval(async () => {
-                        let shouldClearInterval = true;
+                        // let shouldClearInterval = true;
+                        let isallfinish=true//步骤是否全部检测完成
                         try {
                             const res = await task.lookStep({ id: loadingMis.value.id - 0 });
                             if (res.code === 0) {
+                                stepList.value = res.data;                          
                                 for (const item of res.data) {
-                                    if (!(item.state === '2' || item.state === '3')) {
-                                        shouldClearInterval = false;
-                                        await misState();
+                                    if (item.state === '0' || item.state === '1') {
+                                        isallfinish=false
+                                        //await misState();
                                         break;  // Stop checking if one item doesn't meet the condition
                                     }
                                 }
                             }
                         } catch (error) {
-                            shouldClearInterval = true;  // Handle errors as you see fit
+                            isallfinish = true;  // Handle errors as you see fit
                             showError("检查步骤时发生错误。");
                         }
-                        if (shouldClearInterval) {
+                        if (isallfinish) {
                             clearInterval(countTime);
                             end.value = false;
                         }
                     }, 1000);
-                    setTimeout(async () => {
+                    let getresulttimer=setInterval(async () => {
+                        //获取检测结果:最新20条
+                        loading.value=true
                         const res = await slc.getScdByIdFromMission({
                             scd_id: loadingMis.value.scd_id - 0,
                             pageno: 1,
                             pagesize: 20,
                         });
-                        if (res.data) {
-                            endList.value = res.data;
-                            loading.value = false;
-                            misState()
-                        } else {
-                            endList.value = [];
-                            loading.value = false;
+                        loading.value = false;
+                        if(res.code!=0){
+                            showError(res.msg);
+                        }else{
+                            if (res.data) {
+                                endList.value = res.data;
+                                //misState()
+                            } else {
+                                endList.value = [];                                
+                            }
+                            if(!end.value){
+                                //已检测完成是地,停止获取
+                                clearInterval(getresulttimer);
+                            }
                         }
-                    }, 30000);
+                    }, 3000);
                 }
             } catch (error) {
                 showError("启动任务时发生错误。");

+ 3 - 7
src/pages/report/ReportVue.vue

@@ -25,7 +25,7 @@
                             @click="lookReport(scope.row)"><el-icon>
                                 <View />
                             </el-icon>查看</el-button>
-                        <el-button style="color: #255CE7;" text type="primary" size="small"
+                        <el-button v-if="scope.row.report_doc!=''" style="color: #255CE7;" text type="primary" size="small"
                             @click="downFile(scope.row)"><el-icon>
                                 <Download />
                             </el-icon>报告下载</el-button>
@@ -100,12 +100,8 @@ export default {
         }
         // 下载报告
         function downFile(row) {
-            console.log(row, 'row');
-            system.downLoad({
-                ids: row.report_id
-            }).then(res => {
-                console.log(res, 'down');
-            })
+            location.href = window.ApiServer + "/" + row["report_doc"];
+            //console.log(row, 'row');
         }
         onMounted(() => {
             reload()

+ 13 - 5
src/pages/report/components/ReportDetails.vue

@@ -9,8 +9,7 @@
                 <img v-else src="../../../assets/image/allright.png" alt="">
                 <p style="font-size: 14px;font-weight: 400;">{{ btnType ? '还未生成报告' : "报告已生成" }}</p>
                 <el-button :type="btnType ? 'primary' : 'info'" plain @click="nowGet" :disabled="!btnType">立即生成</el-button>
-                <el-button :type="btnType ? 'info' : 'primary'" plain :disabled="btnType"
-                    @click="downReport">下载报告</el-button>
+                <el-button :type="btnType ? 'info' : 'primary'" plain :disabled="btnType" @click="downReport">下载报告</el-button>
             </div>
         </div>
         <div class="bottomBox" v-loading="loading">
@@ -123,6 +122,7 @@ export default {
         let stationNames = ref("")//变电站名称
         let relathing = ref('')//检测名称
         let loading = ref(false)
+        let reportUrl = ref('')
         let btnType = ref(true)//生成报告按钮和下载报告按钮状态
         let fileId = ref("")//需要下载的报告id'
         let totals = ref(0)
@@ -174,6 +174,10 @@ export default {
                 name: relathing.value
             }).then(res => {
                 console.log(res, 'oisaghuih');
+                if(res.code==0 && res.data.length>0){
+                    btnType.value = false //报告已生成
+                    reportUrl.value = res.data[0].doc
+                }
             })
         }
         // 筛选等级
@@ -204,6 +208,7 @@ export default {
                 if (res.data != null) {
                     fileId.value = res.data.TaskId
                     btnType.value = false
+                    reportUrl.value = res.data.doc
                     ElMessage({
                         message: "生成报告成功",
                         type: "success"
@@ -213,11 +218,13 @@ export default {
         }
         // 下载报告
         function downReport() {
+            location.href = window.ApiServer + "/" + reportUrl.value.toString();
+            /*
             system.downLoad({
-                ids: fileId.value - 0
-            }).then(res => {
-                console.log(res, '下载');
+                path: reportUrl.value,
+                save_name:''
             })
+            */
         }
         // 导出结果至excel
         function excelPort() {
@@ -289,6 +296,7 @@ export default {
             pageBack,
             nowGet,//生成报告按钮
             btnType,//按钮状态
+            reportUrl,
             fileId,//下载的报告id
             downReport,//下载报告
             excelPort,

+ 3 - 1
src/utils/request.js

@@ -85,8 +85,10 @@ service.interceptors.response.use(
             router.push('/login')
             sessionStorage.removeItem('userInfo')
             sessionStorage.removeItem('userToken')
+            return
+        }else{
+            return Promise.reject(error)
         }
-        return Promise.reject(error)
     }
 )
 const randomString = function (e) {