Procházet zdrojové kódy

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

“yueshang” před 1 rokem
rodič
revize
fbe6964d64

+ 76 - 0
src/api/flow/flow.js

@@ -0,0 +1,76 @@
+import request from '@/utils/request'
+// 获取模型装置端子已关联的接收端子
+/* model_id 模型ID
+from_fcda_id 输出装置端子ID*/
+function getModelOn(data) {
+    return request({
+        url: `/admin/model/function/fcda-ref/list`,
+        method: "get",
+        params: data
+    })
+}
+// 保存模型装置端子间关联关系
+/*model_id 模型ID
+from_ied_type 输出装置类型
+to_ied_type 输入装置类型
+from_fcda_id 输出装置端子ID
+to_fcda_ids 输入装置端子ID列表。多个ID间使用逗号分隔
+goosesv 信号类型。值范围:GOOSE | SV*/
+function saveModelOn(data) {
+    return request({
+        url: `/admin/model/function/fcda-ref/save`,
+        method: "post",
+        data
+    })
+}
+// 删除装置端子
+/*model_id *模型ID
+fcda_id *端子ID*/
+function delModelOn(data) {
+    return request({
+        url: `/admin/model/function/fcda/del`,
+        method: "post",
+        data,
+    })
+}
+// 获取指定模型和装置类型的端子列表
+function getModelAndIed(data){
+    return request({
+        url:`/admin/model/function/fcda/list`,
+        method:"get",
+        params:data
+    })
+}
+// 保存模型装置功能及端子信息
+/*model_id *模型ID
+ied_type *装置类型代码
+func_id *功能ID。编辑时必传。
+func_name *功能名称。必传。
+fcda_id *端子ID。编辑时必传。
+fcda_name *功能名称。必传。
+fcda_match_exp *端子匹配表达式。必传。*/
+function saveModelAndIed(data){
+    return request({
+        url:`/admin/model/function/fcda/save`,
+        method:"post",
+        data
+    })
+}
+// 获取指定模型和装置类型的功能列表
+/*model_id *模型ID
+ied_type *装置类型*/
+function getByModelAndIed(data){
+    return request({
+        url:`/admin/model/function/list`,
+        method:"get",
+        params:data
+    })
+}
+export default {
+    getModelOn,
+    saveModelOn,
+    delModelOn,
+    getModelAndIed,
+    saveModelAndIed,
+    getByModelAndIed,
+}

+ 8 - 0
src/api/task.js

@@ -45,6 +45,13 @@ function lookStep(data){
         params:data,
     })
 }
+function getTaskById(data){
+    return request({
+        url:`/task/info`,
+        method:'get',
+        params:data,
+    })
+}
 export default {
     getTask,
     tackStart,
@@ -52,4 +59,5 @@ export default {
     stopTask,
     delTask,
     lookStep,
+    getTaskById,
 }

+ 85 - 55
src/pages/components/draw/DrawDesigns.vue

@@ -3,17 +3,22 @@
         <div class="bigBox">
             <div ref="container" class="container"></div>
         </div>
+        <!-- 功能模态框 -->
+        <AbilityModal v-if="abModal" :abModal="abModal" :modelId="modelId" :iedType="iedType" @abilityBack="abilityBack">
+        </AbilityModal>
     </div>
 </template>
 
 <script>
 import { ref, onMounted, watch, onBeforeUnmount } from 'vue';
-import LogicFlow  from "@logicflow/core";
-import {PolylineEdge, PolylineEdgeModel} from "@logicflow/core";
+import LogicFlow from "@logicflow/core";
+import { PolylineEdge, PolylineEdgeModel } from "@logicflow/core";
 import cid from '@/api/cid/cid'
 import systemRow from '@/api/systemRow';
+import flow from "@/api/flow/flow"
 import { ElMessage } from 'element-plus';
 import { useRouter } from 'vue-router';
+import AbilityModal from "../drawModal/AbilityModal.vue"
 import { DndPanel, SelectionSelect, Group, Menu, MiniMap, regeister, Snapshot, lfJson2Xml, lfXml2Json } from "@logicflow/extension";
 import "@logicflow/core/dist/style/index.css";
 import "@logicflow/extension/lib/style/index.css";
@@ -71,6 +76,9 @@ export default {
         let coolObj = ref({})
         let coolName = ref('')
         let copyObj = ref({})//整个模型属性
+        let modelId = ref("")//模型id
+        let abModal = ref(false)//功能模态框
+        let iedType = ref("")//iedtype
         watch(() => props.lineMenuColor, (newVal) => {
             copyColor.value = newVal
         })
@@ -99,21 +107,23 @@ export default {
         })
         watch(() => props.coolObj, (newVal) => {
             copyObj.value = newVal
+            modelId.value = copyObj.value.id
+            console.log(modelId.value, 'watch模型id ');
             cid.getModelInfo(copyObj.value.id).then(res => {
-                if(res.data[0].relation_json==null || res.data[0].relation_json=='') return;
+                if (res.data[0].relation_json == null || res.data[0].relation_json == '') return;
                 const origiondata = JSON.parse(res.data[0].relation_json)
                 lf.value.render(origiondata);
                 //let rl = lfXml2Json(res.data[0].relation_json.replace(/[\t|\r|\n]/gi,''))
                 // console.log(rl)
                 for (let index = 0; index < origiondata.edges.length; index++) {
                     const element = origiondata.edges[index];
-                    if(element.properties!=null && element.properties["issv"]==='SV') {
+                    if (element.properties != null && element.properties["issv"] === 'SV') {
                         let lineStyle = lf.value.getEdgeModelById(element.id)//.getEdgeStyle();
                         console.log(lineStyle)
-                        lineStyle.setProperties( { svEdge: {stroke:'orange'} })
-                    }                    
+                        lineStyle.setProperties({ svEdge: { stroke: 'orange' } })
+                    }
                 }
-            })
+            }, { immediate: true })
         })
         function blue() {
             lf.value.setTheme({
@@ -141,29 +151,28 @@ export default {
         }
         function saveLine() {
             // lf.value.getSnapshot()//保存为图片
-            console.log(JSON.stringify( lf.value.getGraphData()))
+            console.log(JSON.stringify(lf.value.getGraphData()))
             const xml = lfJson2Xml(lf.value.getGraphData());
-            const data = JSON.stringify( lf.value.getGraphData())
-
-                cid.saveMap(
-                    {
-                        id: copyObj.value.id - 0,
-                        //model_name: coolName.value,
-                        //vol_id: coolObj.value.id - 0,
-                        //line_link_style: coolId.value - 0,
-                        relation_json: data,
-                        //area_type: "116329",
-                    }
-                ).then(res => {
-                    if (res.code == 0) {
-                        ElMessage({
-                            type: "success",
-                            message: "保存成功!",
-                            duration: 2000,
-                        })
-                        // window.location.reload()
-                    }
-                })
+            const data = JSON.stringify(lf.value.getGraphData())
+            cid.saveMap(
+                {
+                    id: copyObj.value.id - 0,
+                    //model_name: coolName.value,
+                    //vol_id: coolObj.value.id - 0,
+                    //line_link_style: coolId.value - 0,
+                    relation_json: data,
+                    //area_type: "116329",
+                }
+            ).then(res => {
+                if (res.code == 0) {
+                    ElMessage({
+                        type: "success",
+                        message: "保存成功!",
+                        duration: 2000,
+                    })
+                    // window.location.reload()
+                }
+            })
         }
         function cleanMap() {
             lf.value.clearData()
@@ -199,6 +208,7 @@ export default {
             //    console.log(res, 'sss');
             //})
             systemRow.getChildren({ code: "ied_type" }).then(res => {
+                console.log(res, 'res');
                 needMap.value = res.data.map(item => {
                     return {
                         type: 'rect',
@@ -206,7 +216,8 @@ export default {
                         label: item.name,
                         icon: '',
                         properties: {
-                            ied_type: item.code
+                            ied_type: item.code,
+                            id: item.id
                         }
                     }
                 })
@@ -230,31 +241,31 @@ export default {
                     snapline: true,//辅助线
                     edgeTextDraggable: true,//连接线文本可以拖拽
                 })
-                class SvEdge extends PolylineEdge {}
+                class SvEdge extends PolylineEdge { }
                 // 节点Model
                 class SvEdgeModel extends PolylineEdgeModel {
-                    getEdgeStyle(){
+                    getEdgeStyle() {
                         const stl = super.getEdgeStyle()
-                        stl.stroke='orange'
+                        stl.stroke = 'orange'
                         return stl
                     }
                 }
-                class GooseEdge extends PolylineEdge {}
+                class GooseEdge extends PolylineEdge { }
                 // 节点Model
                 class GooseEdgeModel extends PolylineEdgeModel {
-                    getEdgeStyle(){
+                    getEdgeStyle() {
                         const stl = super.getEdgeStyle()
-                        stl.stroke='#255CE7'
+                        stl.stroke = '#255CE7'
                         return stl
                     }
                 }
                 lf.value.register({
-                    type:"svEdge",
+                    type: "svEdge",
                     view: SvEdge,
                     model: SvEdgeModel,
                 })
                 lf.value.register({
-                    type:"baseEdge",
+                    type: "baseEdge",
                     view: GooseEdge,
                     model: GooseEdgeModel,
                 })
@@ -310,29 +321,38 @@ export default {
                         fontSize: 12,
                     },//节点内文字样式
                 });
-                lf.value.on("edge:click", function (data, e, position) {                    
+                lf.value.on("edge:click", function (data, e, position) {
                     delId.value = data.data.id
                 })
+                lf.value.on('edge:dbclick', function (data, e, position) {
+                    let start = lf.value.getNodeModelById(data.data.sourceNodeId)//获取连线开始节点
+                    let end = lf.value.getNodeModelById(data.data.targetNodeId)//获取连线结尾节点
+                    console.log(start, end, '边data');
+                })
                 lf.value.on("edge:add", function (data, e, position) {
-                        if (copyColor.value == '#255CE7') {
-                            blue()
-                            lf.value.changeEdgeType(data.data.id,"baseEdge")
-                            lf.value.setProperties(data.data.id,{'issv':'GOOSE'})
-                        }
-                        if (copyColor.value == 'orange') {
-                            orange()
-                            lf.value.changeEdgeType(data.data.id,"svEdge")
-                            lf.value.setProperties(data.data.id,{'issv':'SV'})
-                        }
+                    if (copyColor.value == '#255CE7') {
+                        blue()
+                        lf.value.changeEdgeType(data.data.id, "baseEdge")
+                        lf.value.setProperties(data.data.id, { 'issv': 'GOOSE' })
+                    }
+                    if (copyColor.value == 'orange') {
+                        orange()
+                        lf.value.changeEdgeType(data.data.id, "svEdge")
+                        lf.value.setProperties(data.data.id, { 'issv': 'SV' })
+                    }
                 })
                 lf.value.on('node:click', function (data, e, position) {//传送坐标轴参数到父组件
                     copyId.value = data.data.id
                     nodeId.value = data.data.id
                     setX.value = data.data.x
                     setY.value = data.data.y
-                    console.log(data.data, 'click');
                     emit("backxy", setX.value, setY.value)
                 })
+                lf.value.on('node:dbclick', function (data, e, position) {//双击打开弹窗
+                    iedType.value = data.data.properties.ied_type
+                    abModal.value = true
+                    console.log(data, '节点data');
+                })
                 lf.value.on('node:mousemove', function (data, e) {//传递坐标轴参数到父组件
                     setX.value = data.data.x
                     setY.value = data.data.y
@@ -343,13 +363,13 @@ export default {
                 lf.value.on('edge:click', function (data, e, position) {//解决点击连接线问题
                     if (copyColor.value == '#255CE7') {
                         blue()
-                        lf.value.changeEdgeType(data.data.id,"baseEdge")
-                        lf.value.setProperties(data.data.id,{'issv':'GOOSE'})
+                        lf.value.changeEdgeType(data.data.id, "baseEdge")
+                        lf.value.setProperties(data.data.id, { 'issv': 'GOOSE' })
                     }
                     if (copyColor.value == 'orange') {
                         orange()
-                        lf.value.changeEdgeType(data.data.id,"svEdge")
-                        lf.value.setProperties(data.data.id,{'issv':'SV'})
+                        lf.value.changeEdgeType(data.data.id, "svEdge")
+                        lf.value.setProperties(data.data.id, { 'issv': 'SV' })
                     }
                 })
                 // lf.value.register(logicFlows)
@@ -357,6 +377,9 @@ export default {
                 lf.value.render();
             })
         })
+        function abilityBack(data) {
+            abModal.value = data
+        }
         onBeforeUnmount(() => {
             // lf.value.remove()
             coolObj.value = {}
@@ -380,9 +403,16 @@ export default {
             needMap,
             coolId,
             coolName,
-            copyObj,
+            copyObj,//模型整个数据
+            modelId,//模型id
+            abModal,//功能模态框
+            iedType,//模型属性
+            abilityBack,//abilitymodal.vue返回模态框开关状态
         }
     },
+    components: {
+        AbilityModal,//功能模态框
+    }
 }
 </script>
 

+ 119 - 0
src/pages/components/drawModal/AbilityModal.vue

@@ -0,0 +1,119 @@
+<template>
+    <div>
+        <el-dialog v-model="dialogVisible" title="装置功能配置" width="70%" @close="handleClose">
+            <el-button type="primary" plain @click="addAbility"><el-icon>
+                    <Plus />
+                </el-icon>添加新功能</el-button>
+            <el-table :data="tableData" style="width: 100%">
+                <el-table-column label="序号" width="100">
+                    <template #default="scope">
+                        <span>{{ scope.$index + 1 }}</span>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="name" label="设计功能名称" width="220" />
+                <el-table-column prop="state" label="端子设计名称" width="220" />
+                <el-table-column prop="city" label="端子匹配关键词" width="220" />
+                <el-table-column fixed="right" label="操作" width="auto">
+                    <template #default>
+                        <el-button link type="primary" size="small">编辑</el-button>
+                        <el-button link type="primary" size="small" style="color: red;">删除</el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+            <template #footer>
+                <span class="dialog-footer">
+                    <el-button @click="cancels">取消</el-button>
+                    <el-button type="primary" @click="sureClick">确定</el-button>
+                </span>
+            </template>
+        </el-dialog>
+        <AddAbility v-if="addModal" :addModal="addModal" :modelIds="modelIds" :iedTypes="iedTypes" @addAback="addAback"
+            :tableData="tableData"></AddAbility>
+    </div>
+</template>
+
+<script>
+import { ref, onMounted, watch, toRefs } from 'vue';
+import flow from "@/api/flow/flow"
+import AddAbility from './AddAbility.vue';
+export default {
+    props: {
+        abModal: {
+            type: Boolean,
+            required: true
+        },
+        modelId: {
+            type: String,
+            required: true,
+        },
+        iedType: {
+            type: String,
+            required: true,
+        }
+    },
+    setup(props, { emit }) {
+        let dialogVisible = ref(false)//模态框开关
+        let modelIds = ref('')//模型id
+        let iedTypes = ref('')//iedtype
+        let addModal = ref(false)//新增功能模态框开关状态
+        let tableData = ref([])//表格数据
+        watch(() => props.modelId, (newVal) => {
+            modelIds.value = newVal
+        })
+        watch(() => props.iedType, (newVal) => {
+            iedTypes.value = newVal
+        })
+        // 初始化函数
+        function reload() {
+            dialogVisible.value = props.abModal
+            modelIds.value = props.modelId
+            iedTypes.value = props.iedType
+            flow.getByModelAndIed({//获取所有功能
+                model_id: modelIds.value - 0,
+                ied_type: iedTypes.value
+            }).then(res => {
+                console.log(res, '第一层res');
+                tableData.value = res.data
+            })
+        }
+        // 关闭模态框
+        function closeModal() {
+            dialogVisible.value = false
+            emit("abilityBack", dialogVisible.value)
+        }
+        // 确认后关闭模态框
+        function sureClose() {
+            dialogVisible.value = false
+            emit("abilityBack", dialogVisible.value)
+        }
+        // 打开新增或编辑模态框
+        function addAbility() {
+            addModal.value = true
+        }
+        function addAback(data) {
+            addModal.value = data
+        }
+        onMounted(() => {
+            reload()
+        })
+        return {
+            dialogVisible,//模态框开关
+            reload,//初始化组件
+            handleClose: closeModal,//关闭模态框
+            cancels: closeModal,//关闭模态框
+            sureClick: sureClose,//确认后关闭模态框
+            addModal,//新增功能模态框开关状态
+            addAbility,//打开新增功能模态框
+            addAback,//AddAbility.vue返回模态框状态
+            tableData,//表格数据
+            modelIds,//本组件需要的模型id
+            iedTypes,//本组件需要的iedtypes
+        }
+    },
+    components: {
+        AddAbility,//嵌套新增功能窗口
+    }
+}
+</script>
+
+<style scoped></style>

+ 146 - 0
src/pages/components/drawModal/AddAbility.vue

@@ -0,0 +1,146 @@
+<template>
+    <div>
+        <el-dialog v-model="dialogVisible" title="新增/编辑功能" width="30%" @close="handleClose">
+            <el-form :model="abilityFrom" :rules="rules" label-width="150px">
+                <el-form-item label="设计功能名称" prop="setAbName">
+                    <el-select @change="abNameChange" style="width: 350px;" v-model="abilityFrom.setAbName" filterable
+                        allow-create default-first-option :reserve-keyword="false" placeholder="选择或输入">
+                        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
+                    </el-select>
+                    <p style="color: #2C5BE5;font-size: 16px;">新功能可直接输入但不能重复;已有功能可选择</p>
+                </el-form-item>
+                <el-form-item label="设计端子名称" prop="setSon">
+                    <el-input style="width: 350px;" v-model="abilityFrom.setSon"></el-input>
+                </el-form-item>
+                <el-form-item label="端子描述关键词" prop="setMemo">
+                    <el-input style="width: 350px;" v-model="abilityFrom.setMemo"></el-input>
+                    <p style="color: #2C5BE5;font-size: 16px;">关键词之间“:”表示或者,“&”表示并且</p>
+                </el-form-item>
+            </el-form>
+            <template #footer>
+                <span class="dialog-footer">
+                    <el-button @click="cancels">取消</el-button>
+                    <el-button type="primary" @click="sureClick">确定</el-button>
+                </span>
+            </template>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { ref, onMounted, watch, toRefs, reactive } from 'vue'
+import flow from '@/api/flow/flow'
+export default {
+    props: {
+        addModal: {
+            type: Boolean,
+            required: true,
+        },
+        tableData: {
+            type: Array,
+            required: true
+        },
+        modelIds: {
+            type: String,
+            required: true
+        },//模型id
+        iedTypes: {
+            type: String,
+            required: true
+        },//iedtype
+    },
+    setup(props, { emit }) {
+        let dialogVisible = ref(false)//模态框开关
+        let abilityFrom = ref({
+            setAbName: "",//设计功能名称
+            setSon: "",//设计端子名称
+            setMemo: "",//端子描述关键词
+        })
+        let options = ref([])//多选选项
+        let fatherToSon = ref([])//AbilityModal.vue传过来的表格数据,制作为选项
+        let needModel = ref('')//需要的模型id
+        let needIedType = ref('')//需要的iedtype
+        const rules = reactive({
+            setAbName: [
+                { required: true, message: '请选择设计功能名称', trigger: 'change' },
+            ],
+            setSon: [
+                { required: true, message: '请输入设计端子关系', trigger: 'blur' },
+            ],
+            setMemo: [
+                { required: true, message: '请输入端子描述关键词', trigger: 'blur' },
+            ]
+        })//表单验证
+        // 监听props.tabledata变化赋值
+        watch(() => props.tableData, (newVal) => {
+            fatherToSon.value = newVal
+        })
+        // 监听props.modelids变化并赋值
+        watch(() => props.modelIds, (newVal) => {
+            needModel.value = newVal
+            console.log(needModel.value,'watch');
+        }, { immediate: true })
+        // 监听props.iedtypes变化并赋值
+        watch(() => props.iedTypes, (newVal) => {
+            needIedType.value = newVal
+        })
+        // 初始化组件
+        function reload() {
+            dialogVisible.value = props.addModal//模态框状态
+            fatherToSon.value = props.tableData//表格数据,制作为下拉菜单
+            needModel.value = props.modelIds//模型id
+            needIedType.value = props.iedTypes//iedtype
+            console.log(props,'子props');
+        }
+        // 关闭模态框
+        function closeModal() {
+            dialogVisible.value = false
+            emit("addAback", dialogVisible.value)
+        }
+        // 确认关闭模态框
+        function sureClose() {
+            flow.saveModelAndIed({
+                model_id:needModel.value - 0,
+                ied_type:needIedType.value,
+                func_name:abilityFrom.value.setAbName,
+                fcda_name:abilityFrom.value.setSon,
+                fcda_match_exp:abilityFrom.value.setMemo,
+            }).then(res=>{
+                console.log(res,'添加功能');
+            })
+            dialogVisible.value = false
+            emit("addAback", dialogVisible.value)
+        }
+        // 设计功能名称change事件
+        function abNameChange(e) {
+            abilityFrom.value.setAbName = e
+        }
+        onMounted(() => {
+            reload()
+            setTimeout(() => {
+                reload()
+            }, 1500);
+        })
+        return {
+            dialogVisible,//模态框开关
+            reload,//初始化组件
+            handleClose: closeModal,//关闭模态框
+            cancels: closeModal,//关闭模态框
+            sureClick: sureClose,// 确认关闭模态框
+            abilityFrom,//表单项value
+            options,//多选选项
+            rules,//表单验证
+            abNameChange,//设计功能名称change事件
+            needModel,//需要的模型id
+            needIedType,//需要的iedtype
+        }
+    }
+}
+</script>
+
+<style scoped>
+p {
+    margin: 0;
+    padding: 0;
+}
+</style>

+ 38 - 6
src/pages/mission/MissionVue.vue

@@ -15,10 +15,11 @@
                 <NoBox v-if="btnSelect == 0 && taskList.length == 0 && sizeNum == 0" :btnSelect="btnSelect"
                     :taskList="taskList" @backToMission="backToMission"></NoBox>
                 <!-- 有检测任务的盒子 -->
-                <HaveMis v-if="btnSelect == 0 && taskList.length != 0 && sizeNum == 0" @hmBack="hmBack"
-                    @haveBack="haveBack"></HaveMis>
+                <HaveMis v-if="btnSelect == 0 && taskList.length != 0 && sizeNum == 0" @hmBack="hmBack" @haveBack="haveBack"
+                    @haveInCreate="haveInCreate"></HaveMis>
                 <!-- 新建任务盒子 -->
-                <CreateNew v-if="btnSelect == 1" :btnSelect="btnSelect" :taskList="taskList" @createBack="createBack">
+                <CreateNew v-if="btnSelect == 1" :btnSelect="btnSelect" :taskList="taskList" :editRow="editRow"
+                    :status="status" @createBack="createBack">
                 </CreateNew>
                 <!-- 正在检测盒子 -->
                 <StartMission v-if="btnSelect == 0 && sizeNum == 1" @smBack="smBack" :startMis="startMis"></StartMission>
@@ -57,16 +58,39 @@ export default {
         let taskList = ref([])//任务表单
         let btnSelect = ref(0)//选择的菜单
         let startMis = ref({})//开始检测
+        let editRow = ref({})//需要编辑的任务
+        let status = ref(0)
         function searchAllTask() {
-            task.getTask({}).then(res => {
-                if (res.data) {
+            // 0为待检测
+            task.getTask({ pageno: 1, pagesize: 10, state: 0 }).then(res => {
+                if (res.data == null) {
+                    return
+                } else {
+                    taskList.value = res.data
+                }
+            })
+            // 2为完成检测
+            task.getTask({ pageno: 1, pagesize: 10, state: 2 }).then(res => {
+                if (res.data == null) {
+                    return
+                } else {
+                    taskList.value = res.data
+                }
+            })
+            // 1为正在检测
+            task.getTask({ pageno: 1, pagesize: 10, state: 1 }).then(res => {
+                if (res.data == null) {
+                    return
+                } else {
                     taskList.value = res.data
                 }
             })
         }
         function misChange(row, num) {
             btnSelect.value = num
-            console.log(num,'num');
+            if (num == 1) {
+                status.value = 1
+            }
         }
         function createMis() {
             btnSelect.value = 1
@@ -91,6 +115,11 @@ export default {
                 taskList.value = data
             }
         }
+        function haveInCreate(data, row, num) {
+            btnSelect.value = data
+            editRow.value = row
+            status.value = num
+        }
         onMounted(() => {
             searchAllTask()
         })
@@ -108,6 +137,9 @@ export default {
             haveBack,
             createBack,//createMix.vue返回的菜单栏
             startMis,//需要检测的任务名称
+            haveInCreate,//havemis.vue返回的进入到创建任务vue
+            editRow,//需要编辑的任务
+            status,
         }
     },
     components: {

+ 67 - 4
src/pages/mission/components/CreateMis.vue

@@ -5,7 +5,7 @@
                 <p>新建检测任务</p>
             </div>
             <div class="formBox">
-                <el-form :inline="true" label-position="top" :model="newMission" class="demo-form-inline"
+                <el-form ref="myForm" :inline="true" label-position="top" :model="newMission" class="demo-form-inline"
                     style="width: 1200px;margin: 0 auto;" :rules="missionRules" require-asterisk-position="right"
                     label-width="500px">
                     <el-form-item label="检测任务名称" prop="misName">
@@ -109,7 +109,8 @@
         <!-- 模态框组件 -->
         <div>
             <LookScd v-if="scdLooks" :scdLooks="scdLooks" @nowBack="nowBack" @lookNum="lookNum"></LookScd>
-            <ModelTree v-if="treeMool" :treeMool="treeMool" @treeBack="treeBack" @treeNum="treeNum"></ModelTree>
+            <ModelTree v-if="treeMool" :treeMool="treeMool" :treeNeed="treeNeed" @treeBack="treeBack" @treeNum="treeNum">
+            </ModelTree>
             <FlashCreate v-if="fcModal" :fcModal="fcModal" @fcBack="fcBack"></FlashCreate>
             <CheckIed v-if="iedModal" :iedModal="iedModal" :loadScdId="loadScdId" @iedBack="iedBack"
                 @iedArrBack="iedArrBack"></CheckIed>
@@ -118,7 +119,7 @@
 </template>
 
 <script>
-import { ref, onMounted, reactive } from 'vue';
+import { ref, onMounted, reactive, watch, onBeforeUnmount } from 'vue';
 import flashPower from '../../../api/flashPower'
 import report from '@/api/report';
 import scd from "@/api/scd"
@@ -138,6 +139,14 @@ export default {
         taskList: {
             type: Array,
             require: true
+        },
+        editRow: {
+            type: Object,
+            require: true
+        },
+        status: {
+            type: Number,
+            require: true
         }
     },
     setup(props, { emit }) {
@@ -150,6 +159,7 @@ export default {
             reportNow: "",
             misMes: "",
             scdFolder: "",
+            misId: "",
         })//创建任务提交表单
         let missionRules = ref({
             misName: [
@@ -185,11 +195,54 @@ export default {
         let loadAreaId = ref("")
         let iedName = ref("")//一串ied名称字符串
         let iedLoading = ref(false)//加载ied
+        let needEdit = ref({})//需要编辑的任务
         let anyProps = ref({
             label: "area_name",
             id: "area_id",
         })
+        let treeNeed = ref([])//modelTree.vue需要的回显数据
         let anyData = ref([])
+        let states = ref(0)
+        const myForm = ref(null)//表单ref
+        watch(() => props.editRow, (newVal) => {
+            needEdit.value = newVal
+        })
+        watch(() => props.status, (newValue, oldValue) => {
+            if (newValue !== 2) {
+                resetForm(); // 重置表单数据
+            }
+        });
+        function resetForm() {
+            if (myForm.value) {
+                myForm.value.resetFields();
+            }
+        };
+        function reload() {
+            states.value = props.status
+            if (states.value == 2) {
+                if (props.editRow.name) {
+                    needEdit.value = props.editRow
+                    newMission.value.misName = needEdit.value.name//任务名称
+                    newMission.value.misNum = needEdit.value.id//任务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 arr = res.data.models.map((item, index) => {
+                                return item.id
+                            })
+                            mxId.value = arr
+                        }
+                    })
+                } else {
+                    return
+                }
+            } else {
+                return
+            }
+        }
         function searchAllFlash() {
             flashPower.getAllArea({}).then(res => {
                 flashPower.getAllFlashPower({ pid: res.data[0].pid }).then(res => {
@@ -202,6 +255,7 @@ export default {
                                 value: item.id
                             }
                         })
+                        console.log(flashList.value, 'flash');
                     }
                 })
             })
@@ -242,6 +296,7 @@ export default {
         }
         function saveMent() {//保存检测任务
             task.createTask({
+                id: newMission.value.misNum - 0,
                 name: newMission.value.misName,
                 station_id: newMission.value.flashId - 0,
                 memo: newMission.value.misMes,
@@ -322,7 +377,6 @@ 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');
         }
         function checkTime() {
             iedModal.value = true
@@ -364,6 +418,10 @@ export default {
 
         onMounted(() => {
             searchAllFlash()
+            reload()
+        })
+        onBeforeUnmount(() => {
+            resetForm()
         })
         return {
             selects,
@@ -415,6 +473,11 @@ export default {
             iedSave,//保存ied状态
             iedName,//一串ied字符串
             iedLoading,
+            needEdit,//需要编辑的任务
+            treeNeed,//modelTree.vue需要的回显id
+            states,
+            myForm,//表单ref
+            resetForm,
         }
     },
     components: {

+ 12 - 9
src/pages/mission/components/HaveMis.vue

@@ -21,7 +21,7 @@
             <div class="intBoxOne">
               <p class="intOne">
                 <span style="font-size: 18px;color: white;">{{ nowRunList.name }}</span>
-                <span style="font-size: 12px;" @click="deldel(nowRunList)">删除</span>
+                <span style="font-size: 12px;" @click="editItem(nowRunList)">编辑</span>
               </p>
               <p>
                 <img style="width: 15px;height: 15px;" src="../../../assets/icon/white_flash.png" alt="" />
@@ -42,7 +42,7 @@
             <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;cursor: pointer;" @click="editItem(item, index)">编辑</span>
               </p>
               <p>
                 <img style="width: 15px;height: 15px;" src="../../../assets/icon/flash_darkBlue.png" alt="" />
@@ -180,10 +180,8 @@ export default {
         }
       })
     }
-    function deldel(row) {
-      task.delTask({ id: row.id }).then(res => {
-        getList()
-      })
+    function editItem(row) {
+      emit("haveInCreate", 1, row, 2)
     }
     function setImg(row, num) {
       if (row.state == "1") {
@@ -203,13 +201,15 @@ export default {
       goNetStructPicture,
       getList,
       misList,//待检测任务列表
-      deldel,
+      editItem,
       nowRunList,//正在检测任务列表
       setImg,
       passList,//已完成列表
       emLoading,
     };
   },
+  components: {
+  }
 };
 </script>
 
@@ -299,7 +299,8 @@ p {
   /* border: 1px solid brown; */
   /* background-image: url(../../../assets/image/card_blue.png); */
 }
-.intBoxCopy{
+
+.intBoxCopy {
   width: 269px;
   height: 116px;
   line-height: 20px;
@@ -311,6 +312,7 @@ p {
   box-shadow: inset 0px -3px 3px 0px #C8D4EC;
   background-image: url(../../../assets/image/card_blue.png);
 }
+
 .intBoxOne {
   padding-top: 5px;
 }
@@ -349,7 +351,8 @@ p {
 :deep(.el-loading-spinner .circular) {
   width: 16px;
 }
-:deep(.el-loading-spinner .path){
+
+:deep(.el-loading-spinner .path) {
   stroke: #ffffff;
 }
 </style>

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

@@ -17,7 +17,24 @@
                 </div>
                 <!-- 结果 -->
                 <div class="endBox">
-
+                    <el-table :data="endList" stripe style="width: 100%;height: calc(100vh - 600px);">
+                        <el-table-column prop="ied_name" label="装置名称" width="180" />
+                        <el-table-column prop="ied_desc" label="装置描述" width="180" :show-overflow-tooltip="true" />
+                        <el-table-column label="等级" width="180">
+                            <template #default="scope">
+                                <span :style="{ 'color': scope.row.alert_level == 'error' ? 'red' : 'yellow' }">{{
+                                    levelChoose(scope.row.alert_level) }}</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column prop="line_no" label="行号" width="180" />
+                        <el-table-column prop="parse_result" label="描述" width="180" :show-overflow-tooltip="true" />
+                        <el-table-column width="180" label="标准及条款" :show-overflow-tooltip="true">
+                            <template #default="scope">
+                                <p>{{ scope.row.apply_standard }}</p>
+                                <p>{{ scope.row.apply_standard_no }}</p>
+                            </template>
+                        </el-table-column>
+                    </el-table>
                 </div>
             </div>
         </div>
@@ -28,6 +45,7 @@
 import { ref, onMounted, toRefs, watch } from 'vue';
 import StepMethod from './StepMethod.vue';
 import task from '@/api/task';
+import slc from '@/api/slc/slc';
 import { ElMessage } from 'element-plus';
 export default {
     props: {
@@ -40,6 +58,7 @@ export default {
         let arrow = ref(0)
         let loadingMis = ref({})
         let stepList = ref([])
+        let endList = ref([])//结果表格
         watch(() => props.startMis, (newVal) => {
             loadingMis.value = newVal
             console.log(loadingMis.value, 'watch');
@@ -57,25 +76,40 @@ export default {
         }
         function picReload() {
             loadingMis.value = props.startMis
-            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
-                                }
+                            stepList.value = res.data
+                        } else {
+                            ElMessage({
+                                message: res.msg,
+                                type: "error"
                             })
                         }
                     })
                 }, 2000)
                 setTimeout(() => {
                     clearInterval(countTime)
-                }, 10000)
+                }, 20000)
             })
+            setTimeout(() => {
+                slc.getScdByIdFromMission({
+                    scd_id: loadingMis.value.scd_id - 0,
+                    pageno: 1,
+                    pagesize: 20,
+                }).then(res => {
+                    endList.value = res.data
+                    console.log(endList.value, 'end');
+                })
+            }, 10000)
+        }
+        function levelChoose(bit) {
+            if (bit == "error") {
+                return '错误'
+            } else if (bit == 'warning') {
+                return '告警'
+            }
         }
         onMounted(() => {
             picReload()
@@ -86,6 +120,8 @@ export default {
             loadingMis,//传递过来的任务名称
             picReload,//初始化组件
             stepList,//步骤表
+            endList,//结果表格
+            levelChoose,//等级筛选
         }
     },
     components: {
@@ -103,7 +139,7 @@ p {
 .bigBox {
     width: 98%;
     height: calc(100vh - 150px);
-    border: 1px solid black;
+    /* border: 1px solid black; */
     display: flex;
     justify-content: space-around;
     align-items: center;
@@ -112,7 +148,7 @@ p {
 .missionBox {
     width: 30%;
     height: 100%;
-    border: 1px solid purple;
+    /* border: 1px solid purple; */
     text-align: center;
     line-height: 30px;
 }
@@ -120,21 +156,21 @@ p {
 .stepAndEnd {
     width: 68%;
     height: 100%;
-    border: 1px solid brown;
+    /* border: 1px solid brown; */
 }
 
 .stepBox {
     width: 100%;
     height: calc(100vh - 530px);
-    border: 1px solid red;
+    /* border: 1px solid red; */
     overflow-y: auto;
     background-color: #F7F8FB;
 }
 
 .endBox {
     width: 100%;
-    height: calc(100vh - 420px);
-    border: 1px solid green;
+    height: calc(100vh - 600px);
+    /* border: 1px solid green; */
     margin-top: 20px;
 }
 

+ 51 - 28
src/pages/mission/components/StepMethod.vue

@@ -1,8 +1,9 @@
 <template>
     <div>
         <div class="bigBox">
+            <h1 style="margin: 0;padding: 0;">检测详情</h1>
             <el-steps :active="activeStep" space="10px" finish-status="success" direction="vertical">
-                <el-step v-for="(step, index) in steps" :key="index" :title="step.title" :icon="Loading">
+                <el-step v-for="(step, index) in steps" :key="index" :title="step.title">
                     {{ step.content }}
                 </el-step>
             </el-steps>
@@ -12,38 +13,62 @@
 </template>
   
 <script>
-import { ref,onMounted,toRefs,watch } from "vue";
-import { Edit, Picture, Upload,Loading } from '@element-plus/icons-vue'
+import { ref, onMounted, toRefs, watch } from "vue";
+import { Edit, Picture, Upload } from '@element-plus/icons-vue'
+import { ElMessage } from "element-plus";
 export default {
-    props:{
-        stepList:{
-            type:Array,
-            required:true,
+    props: {
+        stepList: {
+            type: Array,
+            required: true,
         }
     },
-    setup(props,{emit}) {
+    setup(props, { emit }) {
         let activeStep = ref(0); // 当前激活的步骤
-        let steps = ref([       // 步骤的数据
-            { title: "done", content: "这是步骤 1 的内容" },
-            { title: "步骤 2", content: "这是步骤 2 的内容" },
-            { title: "步骤 3", content: "这是步骤 3 的内容" },
-            { title: "步骤 4", content: "这是步骤 3 的内容" },
-            { title: "步骤 5", content: "这是步骤 3 的内容" },
-            { title: "步骤 6", content: "这是步骤 3 的内容" },
-            // 添加更多步骤
-        ])
-        watch(()=>props.stepList,(newVal)=>{
-            steps.value = newVal
+        let steps = ref([])
+        watch(() => props.stepList, (newVal) => {
+            steps.value = newVal.map((item, index) => {
+                return {
+                    title: item.step_name,
+                    description: item.state_name,
+                    status: item.state,
+                    msg: item.state_msg
+                }
+            })
         })
-        function reload(){
-            steps.value = props.stepList
+        function reload() {
+            console.log(steps.value, '组件内');
         }
         function nextStep() {
-            if (activeStep.value < steps.value.length) {
-                activeStep.value++;
+            if (activeStep.value > 0 && activeStep.value < steps.value.length) {
+                const prevStep = steps.value[activeStep.value - 1];
+                if (prevStep.status === "2") {
+                    activeStep.value++;
+                } else {
+                    // ElMessage({
+                    //     message: prevStep.msg || '前一步骤未完成',
+                    //     type: "error"
+                    // });
+                }
+            } else if (activeStep.value === 0) {
+                // 如果当前是第一步,直接跳到第二步,或者根据需要处理其他逻辑
+                activeStep.value = 1;
+            } else {
+                console.log("无法进行下一步,索引越界");
             }
-        };
-        onMounted(()=>{
+        }
+
+        // 2完成,1检测中,0未开始
+        function setStatus(num) {
+            if (num == 1) {
+                return 'wait'
+            } else if (num == 2) {
+                return 'success'
+            } else if (num == 0) {
+                return "process"
+            }
+        }
+        onMounted(() => {
             reload()
             setInterval(() => {
                 nextStep()
@@ -57,7 +82,5 @@ export default {
     },
 };
 </script>
-<style>
-
-</style>
+<style></style>
   

+ 20 - 3
src/pages/mission/modalComp/ModelTree.vue

@@ -2,8 +2,8 @@
     <div>
         <div class="bigBox">
             <el-dialog v-loading="loading" v-model="dialogVisible" title="选择模型" width="30%" @close="sureclose">
-                <el-tree :data="treeData" style="height: calc(100vh - 500px);overflow-y: auto;" show-checkbox node-key="id"
-                    @check-change="handleCheckChange" :check-strictly="true" default-expand-all
+                <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" />
                 <template #footer>
                     <span class="dialog-footer">
@@ -23,7 +23,7 @@
 </template>
 
 <script>
-import { ref, onMounted, toRefs } from 'vue';
+import { ref, onMounted, toRefs, watch } from 'vue';
 import litLine from '@/api/litLine';
 import systemRow from '@/api/systemRow';
 import { ElLoading } from 'element-plus';
@@ -32,6 +32,10 @@ export default {
         treeMool: {
             type: Boolean,
             required: true
+        },
+        treeNeed: {
+            type: Array,
+            required: true,
         }
     },
     setup(props, { emit }) {
@@ -48,6 +52,16 @@ export default {
         let mdName = ref([])
         let { cleanBox, sureArr } = toRefs(props)
         let dialogVisible = ref(false)
+        let checkKey = ref([])//默认选中的key
+        let treeRef = ref(null)
+        watch(() => props.treeNeed, (newVal) => {
+            checkKey.value = newVal
+        })
+        function reload() {
+            if (props.treeNeed&&treeRef.value) {
+                checkKey.value = props.treeNeed
+            }
+        }
         function getLine() {
             let lord = document.getElementById("lord")
             loading.value = true
@@ -121,6 +135,7 @@ export default {
         }
         onMounted(() => {
             getLine()
+            reload()
         })
         return {
             treeData,
@@ -134,6 +149,8 @@ export default {
             handleCheckChange,
             mdName,
             loading,
+            checkKey,
+            treeRef,
         }
     }
 }