liyangzheng 1 年之前
父節點
當前提交
3e2c8f21fe

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

@@ -81,6 +81,13 @@ function excelInData(data) {
         },
     })
 }
+function updateIedType(data){
+    return request({
+        url:`/admin/sysmodel/update/iedtype`,
+        method:"post",
+        data
+    })
+}
 // 导入前删除所有端子
 function delAll(data){
     return request({
@@ -98,4 +105,5 @@ export default {
     getByModelAndIed,
     excelInData,
     delAll,
+    updateIedType,
 }

+ 36 - 6
src/pages/components/draw/DrawDesigns.vue

@@ -4,11 +4,11 @@
             <div ref="container" class="container" v-loading="loading"></div>
         </div>
         <!-- 功能模态框 -->
-        <AbilityModal v-if="abModal" :abModal="abModal" :modelId="modelId" :iedType="iedType"
+        <AbilityModal v-if="abModal" :fun="fun" :funOne="funOne" :listMap="listMap" :abModal="abModal" :modelId="modelId" :iedType="iedType" :nodeid="nodeid"
             @abilityBack="abilityBack">
         </AbilityModal>
         <LineDouble v-if="ldModal" :ldModal="ldModal" :modelId="modelId" :startTarget="startTarget"
-            :endTarget="endTarget" :numCase="numCase" :startText="startText" :endText="endText" :lineType="lineType"
+            :endTarget="endTarget"  :numCase="numCase" :startText="startText" :endText="endText" :lineType="lineType"
             @lineBack="lineBack">
         </LineDouble>
     </div>
@@ -76,7 +76,15 @@ export default {
         svOrGoose: {
             type: Number,
             required: true,
-        }
+        },
+        searchModule:{
+            type:Function,
+            required:true
+        },//父组件insideModule的方法
+        cleanAll:{
+            type:Function,
+            required:true
+        },//父组件insideModule的方法
     },
     setup(props, { emit }) {
         let router = useRouter()
@@ -105,6 +113,9 @@ export default {
         let endText = ref("")//结束节点名称
         let lineType = ref("")//连接线
         let loading = ref(false)
+        let nodeid = ref("")//节点的id
+        let fun = ref()//储存父节点传来的函数
+        let funOne = ref()//储存父节点传来的函数
         watch(() => props.lineMenuColor, (newVal) => {
             copyColor.value = newVal
         })
@@ -157,6 +168,8 @@ export default {
                     })
                 }, 2000);
             }
+        },{
+            deep:true
         })
         watch(() => props.svOrGoose, (newVal) => {
             numCase.value = newVal
@@ -274,17 +287,25 @@ export default {
                 }
             }, { immediate: true })
         }
-        onMounted(() => {
+        function listMap(){
+            fun.value = props.searchModule
+            funOne.value = props.cleanAll
             coolId.value = props.needId
             coolName.value = props.needName//模型名称
             copyObj.value = props.coolObj//需要的模型信息对象
             numCase.value = props.svOrGoose//判断sv或者goose类型
             copyColor.value = props.lineMenuColor//颜色
             setTimeout(() => {
+                console.log('定时器执行');
                 cid.getModelInfo({ id: copyObj.value.id ? copyObj.value.id : route.query.modelid - 0, pageno: 1, pagesize: 20 }).then(res => {
                     emit("drawCor", res.data)
                     const filteredArray = res.data[0].ied_type.filter(param => param !== null)
-                    console.log(filteredArray,'asd');
+                    let groups = {
+                        type:"group",
+                        text:"分组",
+                        label:"分组",
+                        id:"952",
+                    }
                     needMap.value = filteredArray.map(item => {
                         return {
                             type: 'rect',
@@ -299,7 +320,7 @@ export default {
                             children:["129007"]
                         }
                     })
-                  
+                    needMap.value.push(groups)
                     lf.value = new LogicFlow({
                         // 通过选项指定了渲染的容器和需要显示网格
                         container: container.value,//需要显示画布的容器ref
@@ -438,6 +459,7 @@ export default {
                     lf.value.on('node:dbclick', function (data, e, position) {//双击打开弹窗
                         console.log(data, 'datas');
                         iedType.value = data.data.properties.ied_type
+                        nodeid.value = data.data.properties.id
                         abModal.value = true
                     })
                     lf.value.on('edge:dbclick', function (data, e, position) {//双击连接线
@@ -480,6 +502,7 @@ export default {
                     // lf.value.register(logicFlows)
                     lf.value.extension.dndPanel.setPatternItems(needMap.value);
                     lf.value.render();
+                    console.log('执行了渲染');
                     if (route.query.modelid != '' && route.query.modelid != null && route.query.modelid != undefined) {
                         lastRender()
                     }
@@ -488,6 +511,9 @@ export default {
                     }, 10000)
                 })
             }, 1000);
+        }
+        onMounted(() => {
+            listMap()
         })
         function abilityBack(data) {
             abModal.value = data
@@ -534,6 +560,10 @@ export default {
             lineType,//连接线
             lastRender,//路由跳转的渲染
             loading,
+            nodeid,//节点的id
+            fun,//储存父节点传来的函数
+            listMap,//组件初始化
+            funOne,//储存父节点传来的函数
         }
     },
     components: {

+ 96 - 36
src/pages/components/drawModal/AbilityModal.vue

@@ -1,36 +1,48 @@
 <template>
     <div>
-        <el-dialog v-model="dialogVisible" title="装置功能配置" width="70%" @close="handleClose" :close-on-click-modal="false">
-            <el-button style="height: 30px;" type="primary" plain @click="addAbility(0)"><el-icon>
-                    <Plus />
-                </el-icon>添加新功能</el-button>
-            <el-upload style="display: inline-block;margin: 0 10px;" v-model:file-list="fileList" class="upload-demo"
-                :show-file-list="false" :http-request="upTemplate" multiple :limit="1">
-                <el-button style="height: 30px;" type="primary" plain>Excel上传</el-button>
-            </el-upload>
-            <el-button style="height: 30px;" type="success" plain @click="downloadFile">模板下载</el-button>
-            <el-button style="height: 30px;" type="danger" plain @click="clearAll">清除所有端子</el-button>
-            <el-table :data="tableData" style="width: 100%;height: calc(100vh - 600px);">
-                <el-table-column label="序号" width="100">
-                    <template #default="scope">
-                        <span>{{ scope.$index + 1 }}</span>
-                    </template>
-                </el-table-column>
-                <el-table-column prop="func_name" label="设计功能名称" width="220" />
-                <el-table-column prop="fcda_name" label="端子设计名称" width="220" />
-                <el-table-column prop="fcda_match_exp" label="端子匹配关键词" width="220" />
-                <el-table-column fixed="right" label="操作" width="auto">
-                    <template #default="scope">
-                        <el-button link type="primary" size="small" @click="addAbility(1, scope.row)">编辑</el-button>
-                        <!-- <el-popconfirm title="确认删除吗?" @confirm="firmSure">
+        <el-dialog v-model="dialogVisible" title="装置功能配置" width="70%" @close="handleClose"
+            :close-on-click-modal="false">
+            <div>
+                <span>旧的装置编码:</span>
+                <el-input style="width:300px;margin: 10px 10px;" v-model="oldType" disabled></el-input>
+                <span>新的装置编码:</span>
+                <el-input style="width:300px;margin: 10px 10px;" v-model="newType" placeholder="请输入新的装置编码"></el-input>
+                <el-button type="primary" plain @click="saveIedType">保存</el-button>
+            </div>
+            <div>
+                <el-button style="height: 30px;" type="primary" plain @click="addAbility(0)"><el-icon>
+                        <Plus />
+                    </el-icon>添加新功能</el-button>
+                <el-upload style="display: inline-block;margin: 0 10px;" v-model:file-list="fileList"
+                    class="upload-demo" :show-file-list="false" :http-request="upTemplate" multiple :limit="1">
+                    <el-button style="height: 30px;" type="primary" plain>Excel上传</el-button>
+                </el-upload>
+                <el-button style="height: 30px;" type="success" plain @click="downloadFile">模板下载</el-button>
+                <el-button style="height: 30px;" type="danger" plain @click="clearAll">清除所有端子</el-button>
+                <el-table :data="tableData" style="width: 100%;height: calc(100vh - 600px);">
+                    <el-table-column label="序号" width="100">
+                        <template #default="scope">
+                            <span>{{ scope.$index + 1 }}</span>
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="func_name" label="设计功能名称" width="220" />
+                    <el-table-column prop="fcda_name" label="端子设计名称" width="220" />
+                    <el-table-column prop="fcda_match_exp" label="端子匹配关键词" width="220" />
+                    <el-table-column fixed="right" label="操作" width="auto">
+
+                        <template #default="scope">
+                            <el-button link type="primary" size="small" @click="addAbility(1, scope.row)">编辑</el-button>
+                            <!-- <el-popconfirm title="确认删除吗?" @confirm="firmSure">
                             <template #reference> -->
-                        <el-button link type="primary" size="small" style="color: red;"
-                            @click="delAbility(scope.row)">删除</el-button>
-                        <!-- </template>
-                        </el-popconfirm> -->
-                    </template>
-                </el-table-column>
-            </el-table>
+                            <el-button link type="primary" size="small" style="color: red;"
+                                @click="delAbility(scope.row)">删除</el-button>
+                            <!-- </template>
+    </el-popconfirm> -->
+                        </template>
+                    </el-table-column>
+                </el-table>
+            </div>
+
             <template #footer>
                 <span class="dialog-footer">
                     <el-button @click="cancels">取消</el-button>
@@ -38,10 +50,11 @@
                 </span>
             </template>
         </el-dialog>
-        <AddAbility v-if="addModal" :addModal="addModal" :modelIds="modelIds" :iedTypes="iedTypes" :copyReload="copyReload"
-            :editOrAdd="editOrAdd" :editRow="editRow" @addAback="addAback" :tableData="tableData"></AddAbility>
-        <DelAbility v-if="delModal" :delModal="delModal" :modelIds="modelIds" :delFcda="delFcda" :copyReload="copyReload"
-            @delBack="delBack"></DelAbility>
+        <AddAbility v-if="addModal" :addModal="addModal" :modelIds="modelIds" :iedTypes="iedTypes"
+            :copyReload="copyReload" :editOrAdd="editOrAdd" :editRow="editRow" @addAback="addAback"
+            :tableData="tableData"></AddAbility>
+        <DelAbility v-if="delModal" :delModal="delModal" :modelIds="modelIds" :delFcda="delFcda"
+            :copyReload="copyReload" @delBack="delBack"></DelAbility>
     </div>
 </template>
 
@@ -62,11 +75,27 @@ export default {
         modelId: {
             type: String,
             required: true,
-        },
+        },//模型id
         iedType: {
             type: String,
             required: true,
-        }
+        },//节点装置编码
+        nodeid: {
+            type: String,
+            required: true,
+        },//节点id
+        fun: {
+            type: Function,
+            required: true,
+        },//insideModule传过来的方法
+        listMap: {
+            type: Function,
+            required: true
+        },
+        funOne: {
+            type: Function,
+            required: true,
+        },//insideModule传过来的方法
     },
     setup(props, { emit }) {
         let dialogVisible = ref(false)//模态框开关
@@ -78,6 +107,9 @@ export default {
         let editOrAdd = ref(0)//0为新增,1为编辑
         let editRow = ref({})//编辑的对象
         let delFcda = ref("")//需要删除的fcda_id
+        let oldType = ref("")//旧的装置编码
+        let newType = ref("")//新的装置编码
+        let iedId = ref("")//节点的id
         watch(() => props.modelId, (newVal) => {
             modelIds.value = newVal
         })
@@ -89,10 +121,13 @@ export default {
             dialogVisible.value = props.abModal
             modelIds.value = props.modelId
             iedTypes.value = props.iedType
+            oldType.value = props.iedType
+            iedId.value = props.nodeid
             flow.getModelAndIed({//获取所有功能
                 model_id: modelIds.value - 0,
                 ied_type: iedTypes.value
             }).then(res => {
+                console.log(res, 'asdasdsa');
                 tableData.value = res.data
             })
         }
@@ -215,6 +250,27 @@ export default {
                 }, 5000);
             })
         }
+        function saveIedType() {
+            flow.updateIedType({
+                id: modelIds.value - 0,
+                old_iedtype: oldType.value,
+                new_iedtype: newType.value
+            }).then(res => {
+                if (res.code == 0) {
+                    sureClose()
+                    props.funOne()
+                    ElMessage({
+                        message: "修改成功",
+                        type: 'success'
+                    })
+                } else {
+                    ElMessage({
+                        message: res.msg,
+                        type: "error"
+                    })
+                }
+            })
+        }
         // 确认删除功能
         function firmSure() {
 
@@ -253,6 +309,10 @@ export default {
             downloadFile,
             portExcel,//需要被下载的excel文件
             clearAll,//清除所有端子
+            iedId,//节点的id
+            oldType,//旧的装置编码
+            newType,//新的装置编码
+            saveIedType,//保存装置编码函数
         }
     },
     components: {

+ 6 - 1
src/pages/components/drawModal/LineDouble.vue

@@ -227,7 +227,12 @@ export default {
                     });
                 }
             });
-
+            curList.value.sort((obj1, obj2) => {
+                const nameB = outList.value[0].fcda_name;
+                if (obj1.fcda_name === nameB) return -1; // 将 name 与数组 b 中第一个对象的 name 属性相等的对象移到数组的第一位
+                if (obj2.fcda_name === nameB) return 1;
+                return 0;
+            });
         }
         // 关闭模态框
         function closeModal() {

+ 5 - 3
src/pages/system/components/InsideModule.vue

@@ -56,7 +56,8 @@
                             <div style="width: calc(100%);">
                                 <el-button style="width: 80px;height: 30px;" type="primary" @click="cleanAll"
                                     plain>关闭</el-button>
-                                <el-button style="width: 80px;height: 30px;" type="primary" @click="saveMap">保存</el-button>
+                                <el-button style="width: 80px;height: 30px;" type="primary"
+                                    @click="saveMap">保存</el-button>
                             </div>
                         </div>
                     </div>
@@ -67,8 +68,9 @@
                     <div class="tableBox">
                         <!-- 建议使用这个 -->
                         <DrawDesigns ref="designsRef" :lineMenuColor="lineMenuColor" :needObj="needObj" :fatX="fatX"
-                            :fatY="fatY" :nowLook="nowLook" :needId="needId" :needName="needName" :coolObj="coolObj"
-                            :svOrGoose="svOrGoose" @backxy="backxy" @drawCor="drawCor"></DrawDesigns>
+                            :fatY="fatY" :nowLook="nowLook" :cleanAll="cleanAll" :needId="needId" :needName="needName"
+                            :searchModule="searchModule" :coolObj="coolObj" :svOrGoose="svOrGoose" @backxy="backxy"
+                            @drawCor="drawCor"></DrawDesigns>
                     </div>
                 </div>
             </div>