Sfoglia il codice sorgente

修改点位标签配置

chuwu 5 anni fa
parent
commit
a53946848c

+ 12 - 0
src/fetch/point_http.js

@@ -265,6 +265,17 @@ export function pointTypeJsMind(param, success) {
     let data = param
     return post(`${point}/relation/check-original-equipment-type`, data, success)
 }
+//查询所有关系,从物理世界角度
+export function queryAllRela(param, success) {
+    let data = param
+    return post(`${point}/relation/check-physical`, data, success)
+}
+
+//查询所有关系,从原始点位角度
+export function queryAllPointRela(param, success) {
+    let data = param
+    return post(`${point}/relation/check-original`, data, success)
+}
 
 /******************数据字典-单位接口***************************************************** */
 
@@ -274,6 +285,7 @@ export function batchQueryUnit(param, success) {
 }
 
 
+
 /******************物理世界关系对应****************************************************** */
 //批量创建对应关系
 export function batchCreate(param, success) {

+ 1 - 0
src/views/point/config_point/steps/step1.vue

@@ -380,6 +380,7 @@
         .btns-view {
             height: 40px;
             line-height: 40px;
+            margin-bottom: 10px;
         }
         #handsontableSteps1 {
             flex: 1;

+ 1 - 0
src/views/point/config_point/steps/step2.vue

@@ -256,6 +256,7 @@
         .btns-view {
             height: 40px;
             line-height: 40px;
+            margin-bottom: 10px;
         }
         #handsontableSteps1 {
             flex: 1;

+ 6 - 5
src/views/point/config_point/steps/step3.vue

@@ -8,9 +8,9 @@
         <div id="handsontableSteps1">
             <handsontable-component @mouseDown="clickEdit" ref="handsontable"></handsontable-component>
         </div>
-        <div class="center">
+        <!-- <div class="center">
             <pagination :page="pages" @change="changePage"></pagination>
-        </div>
+        </div> -->
         <own-dialog :width="'1000px'" :dialogVisible="isDialogShow" @cancel="close">
             <dialog-main v-if="!isDataform"></dialog-main>
             <steps-main v-if="isDataform"></steps-main>
@@ -23,7 +23,7 @@
 <script>
     import handsontableComponent from "@/components/common/handsontable"
     import headerArr from "@/utils/point_edit/steps3.js"
-     import {
+    import {
         changeHeader,
         showTypes
     } from "@/utils/handsontable/delType"
@@ -119,8 +119,8 @@
                     type: this.protocolType,
                     data: {
                         DataSourceId: this.datasourceId,
-                        "PageNumber": this.pages.currentPage || 1,
-                        "PageSize": this.pages.size,
+                        // "PageNumber": this.pages.currentPage || 1,
+                        // "PageSize": this.pages.size,
                     }
                 }
                 queryPointRela(param, res => {
@@ -172,6 +172,7 @@
         .btns-view {
             height: 40px;
             line-height: 40px;
+            margin-bottom: 10px;
         }
         #handsontableSteps1 {
             flex: 1;

+ 240 - 149
src/views/point/config_point/steps/step4.vue

@@ -1,20 +1,32 @@
 <template>
     <div class="h100 steps4">
         <div class="btns-view">
-            <el-button>根据关键内容批量标准化设备标识</el-button>
-            <el-button>根据关键内容批量对应数据字典</el-button>
+            <el-button type="primary">根据关键内容批量标准化设备标识</el-button>
+            <el-button type="primary">根据关键内容批量对应数据字典</el-button>
         </div>
-        <el-tabs type="border-card" @tab-click="clickTabs" class="tabs-h" tab-position="bottom">
-            <el-tab-pane>
-                <span slot="label">
-                        从物理世界角度检查
-                    </span>
-                <js-mind-component ref="jsmind" @openNode="openNode"></js-mind-component>
-            </el-tab-pane>
-            <el-tab-pane class="h100" label="从原始点位表角度检查">
-                <js-mind-component ref="jsmind1" @openNode="openNode"></js-mind-component>
-            </el-tab-pane>
-        </el-tabs>
+        <div class="center point-border">
+            <el-radio-group v-model="activeIndex" @change="clickTabs">
+                <el-radio-button label="0">从物理世界角度检查</el-radio-button>
+                <el-radio-button label="1">从原始点位表角度检查</el-radio-button>
+            </el-radio-group>
+        </div>
+        <div class="jsmind-container" v-show="activeIndex == 0">
+            <js-mind-component ref="jsmind"></js-mind-component>
+        </div>
+        <div class="jsmind-container" v-show="activeIndex == 1">
+            <js-mind-component ref="jsmind1"></js-mind-component>
+        </div>
+        <!-- <el-tabs type="border-card" @tab-click="clickTabs" class="tabs-h" tab-position="bottom">
+                <el-tab-pane>
+                    <span slot="label">
+                            从物理世界角度检查
+                        </span>
+                    
+                </el-tab-pane>
+                <el-tab-pane class="h100" label="从原始点位表角度检查">
+                    <js-mind-component ref="jsmind1" @openNode="openNode"></js-mind-component>
+                </el-tab-pane>
+            </el-tabs> -->
     </div>
 </template>
 <script>
@@ -24,12 +36,12 @@
     } from "vuex";
     import jsMindComponent from "@/components/common/jsmind"
     import {
-        platformSysJsMind,
+        queryAllRela,
         platformEqJsMind,
         platformIdentJsMind,
         platformInfoJsMind,
         platformPointJsMind,
-        pointSytemJsMind,
+        queryAllPointRela,
         pointPostJsMind,
         pointInfoJsMind,
         pointTypeJsMind,
@@ -59,118 +71,118 @@
         },
         methods: {
             //节点选中事件
-            async openNode(node) {
-                //次级列表children,自定义id ownId,请求参数,请求函数ajaxFun,显示子集的文案text,子集的data
-                let children, ownId,param,ajaxFun,text,nodeOwnData;
-                this.jsMind.options.editable = true
-                console.log(node.data)
-                //删除已有的假节点
-                this.removeNode(node, this.jsMind)
-                if (!!node.data && node.data.pointType == "system") {
-                    //系统级
-                    param = {
-                        DataSourceId: this.datasourceId,
-                        PhysicalSystem: node.data.name
-                    }
-                    ajaxFun = this.activeIndex == 0 ? platformEqJsMind : pointTypeJsMind
-                    console.log(ajaxFun)
-                    children = await this.getList(param, ajaxFun)
-                    console.log(children)
-                    children.map(item => {
-                        text = item.EquipmentType || `${item.Description}(${item.Address})`
-                        nodeOwnData = {
-                            pointType: "eq",
-                            name: item.EquipmentType || item.Description,
-                            systemName: node.data.name
-                        }
-                        ownId = this.createRandomId()
-                        this.jsMind.add_node(node, ownId, text , nodeOwnData)
-                        this.addNodeDefault(ownId)
-                    })
-                }
-                if (!!node.data && node.data.pointType == "eq") {
-                    //标识级
-                    param = {
-                        DataSourceId: this.datasourceId,
-                        EquipmentType: node.data.name,
-                        PhysicalSystem: node.data.systemName
-                    }
-                    ajaxFun = this.activeIndex == 0 ? platformIdentJsMind : pointPostJsMind
-                    children = await this.getList(param, ajaxFun)
-                    if (!children) {
-                        return false
-                    }
-                    console.log(children)
-                    children.map(item => {
-                        text = this.activeIndex == 0 ? item.DataQuality + item.EquipmentMark : `${item.Description}(${item.Address}):${item.Data.Data}-${item.Data.Unit}-${item.Data.Time}`
-                        nodeOwnData = {
-                                pointType: "ident",
-                                name: this.activeIndex == 0 ? item.EquipmentMark : item.Description,
-                                systemName: node.data.systemName,
-                                EquipmentType: node.data.name
-                            }
-                            console.log(text,nodeOwnData)
-                        ownId = this.createRandomId()
-                        this.jsMind.add_node(node, ownId, text, nodeOwnData)
-                        this.addNodeDefault(ownId)
-                    })
-                }
-                if (!!node.data && node.data.pointType == "ident") {
-                    //信息级
-                    param = {
-                        DataSourceId: this.datasourceId,
-                        EquipmentType: node.data.EquipmentType,
-                        PhysicalSystem: node.data.systemName,
-                        [ this.activeIndex == 0 ? "EquipmentMark" : "Description"]: node.data.name
-                    }
-                    ajaxFun = this.activeIndex == 0 ? platformInfoJsMind : pointInfoJsMind
-                    children = await this.getList(param, ajaxFun)
-                    if (!children) {
-                        return false
-                    }
-                    console.log(children)
-                    children.map(item => {
-                        ownId = this.createRandomId()
-                        text = `${item.InfomationPoint}(${item.MeterFunc}):${item.Data.Data}-${item.Data.Unit}-${item.Data.Time}`
-                        nodeOwnData = {
-                            pointType: "point",
-                            InfomationPoint: item.InfomationPoint,
-                            EquipmentMark: node.data.name,
-                            systemName: node.data.systemName,
-                            EquipmentType: node.data.EquipmentType
-                        }
-                        this.jsMind.add_node(node, ownId, text, nodeOwnData)
-                        if(this.activeIndex == 0){
-                            console.log(111)
-                            this.addNodeDefault(ownId)
-                        }
-                    })
-                }
-                if (!!node.data && node.data.pointType == "point") {
-                    //信息级
-                    children = await this.getList({
-                        DataSourceId: this.datasourceId,
-                        EquipmentType: node.data.EquipmentType,
-                        PhysicalSystem: node.data.systemName,
-                        EquipmentMark: node.data.EquipmentMark,
-                        InfomationPoint: node.data.InfomationPoint
-                    }, platformPointJsMind)
-                    if (!children) {
-                        return false
-                    }
-                    console.log(children)
-                    children.map(item => {
-                        ownId = this.createRandomId()
-                        this.jsMind.add_node(node, ownId, `${item.Description}(${item.Address}):${item.Data.Data}-${item.Data.Unit}-${item.Data.Time}`, {
-                            pointType: "point",
-                            InfomationPoint: item.InfomationPoint,
-                            EquipmentMark: node.data.name,
-                            systemName: node.data.systemName,
-                            EquipmentType: node.data.EquipmentType
-                        })
-                    })
-                }
-            },
+            // async openNode(node) {
+            //     //次级列表children,自定义id ownId,请求参数,请求函数ajaxFun,显示子集的文案text,子集的data
+            //     let children, ownId, param, ajaxFun, text, nodeOwnData;
+            //     this.jsMind.options.editable = true
+            //     console.log(node.data)
+            //     //删除已有的假节点
+            //     this.removeNode(node, this.jsMind)
+            //     if (!!node.data && node.data.pointType == "system") {
+            //         //系统级
+            //         param = {
+            //             DataSourceId: this.datasourceId,
+            //             PhysicalSystem: node.data.name
+            //         }
+            //         ajaxFun = this.activeIndex == 0 ? platformEqJsMind : pointTypeJsMind
+            //         console.log(ajaxFun)
+            //         children = await this.getList(param, ajaxFun)
+            //         console.log(children)
+            //         children.map(item => {
+            //             text = item.EquipmentType || `${item.Description}(${item.Address})`
+            //             nodeOwnData = {
+            //                 pointType: "eq",
+            //                 name: item.EquipmentType || item.Description,
+            //                 systemName: node.data.name
+            //             }
+            //             ownId = this.createRandomId()
+            //             this.jsMind.add_node(node, ownId, text, nodeOwnData)
+            //             this.addNodeDefault(ownId)
+            //         })
+            //     }
+            //     if (!!node.data && node.data.pointType == "eq") {
+            //         //标识级
+            //         param = {
+            //             DataSourceId: this.datasourceId,
+            //             EquipmentType: node.data.name,
+            //             PhysicalSystem: node.data.systemName
+            //         }
+            //         ajaxFun = this.activeIndex == 0 ? platformIdentJsMind : pointPostJsMind
+            //         children = await this.getList(param, ajaxFun)
+            //         if (!children) {
+            //             return false
+            //         }
+            //         console.log(children)
+            //         children.map(item => {
+            //             text = this.activeIndex == 0 ? item.DataQuality + item.EquipmentMark : `${item.Description}(${item.Address}):${item.Data.Data}-${item.Data.Unit}-${item.Data.Time}`
+            //             nodeOwnData = {
+            //                 pointType: "ident",
+            //                 name: this.activeIndex == 0 ? item.EquipmentMark : item.Description,
+            //                 systemName: node.data.systemName,
+            //                 EquipmentType: node.data.name
+            //             }
+            //             console.log(text, nodeOwnData)
+            //             ownId = this.createRandomId()
+            //             this.jsMind.add_node(node, ownId, text, nodeOwnData)
+            //             this.addNodeDefault(ownId)
+            //         })
+            //     }
+            //     if (!!node.data && node.data.pointType == "ident") {
+            //         //信息级
+            //         param = {
+            //             DataSourceId: this.datasourceId,
+            //             EquipmentType: node.data.EquipmentType,
+            //             PhysicalSystem: node.data.systemName,
+            //             [this.activeIndex == 0 ? "EquipmentMark" : "Description"]: node.data.name
+            //         }
+            //         ajaxFun = this.activeIndex == 0 ? platformInfoJsMind : pointInfoJsMind
+            //         children = await this.getList(param, ajaxFun)
+            //         if (!children) {
+            //             return false
+            //         }
+            //         console.log(children)
+            //         children.map(item => {
+            //             ownId = this.createRandomId()
+            //             text = `${item.InfomationPoint}(${item.MeterFunc}):${item.Data.Data}-${item.Data.Unit}-${item.Data.Time}`
+            //             nodeOwnData = {
+            //                 pointType: "point",
+            //                 InfomationPoint: item.InfomationPoint,
+            //                 EquipmentMark: node.data.name,
+            //                 systemName: node.data.systemName,
+            //                 EquipmentType: node.data.EquipmentType
+            //             }
+            //             this.jsMind.add_node(node, ownId, text, nodeOwnData)
+            //             if (this.activeIndex == 0) {
+            //                 console.log(111)
+            //                 this.addNodeDefault(ownId)
+            //             }
+            //         })
+            //     }
+            //     if (!!node.data && node.data.pointType == "point") {
+            //         //信息级
+            //         children = await this.getList({
+            //             DataSourceId: this.datasourceId,
+            //             EquipmentType: node.data.EquipmentType,
+            //             PhysicalSystem: node.data.systemName,
+            //             EquipmentMark: node.data.EquipmentMark,
+            //             InfomationPoint: node.data.InfomationPoint
+            //         }, platformPointJsMind)
+            //         if (!children) {
+            //             return false
+            //         }
+            //         console.log(children)
+            //         children.map(item => {
+            //             ownId = this.createRandomId()
+            //             this.jsMind.add_node(node, ownId, `${item.Description}(${item.Address}):${item.Data.Data}-${item.Data.Unit}-${item.Data.Time}`, {
+            //                 pointType: "point",
+            //                 InfomationPoint: item.InfomationPoint,
+            //                 EquipmentMark: node.data.name,
+            //                 systemName: node.data.systemName,
+            //                 EquipmentType: node.data.EquipmentType
+            //             })
+            //         })
+            //     }
+            // },
             //统一添加默认级数
             addNodeDefault(ownId) {
                 //给下一级添加默认的级数
@@ -184,7 +196,7 @@
              * @param {jsmind实例} jsmind
              */
             removeNode(node, jsmind) {
-                if(!!node.children){
+                if (!!node.children) {
                     node.children.map(item => {
                         this.jsMind.remove_node(item)
                     })
@@ -203,7 +215,7 @@
                 })
             },
             clickTabs(val) {
-                this.activeIndex = val.index
+                this.activeIndex = this.activeIndex
                 var data = {
                         id: "root",
                         topic: this.dataName,
@@ -221,11 +233,12 @@
                         /* 数据内容 */
                         data: data
                     },
-                    id,func;
-                func = this.activeIndex == 0 ? platformSysJsMind : pointSytemJsMind
+                    id, func;
+                func = this.activeIndex == 0 ? queryAllRela : queryAllPointRela
                 func({
                     DataSourceId: this.datasourceId
                 }, res => {
+                    console.log(res)
                     data.children = res.Content.map(item => {
                         id = this.createRandomId();
                         return {
@@ -234,22 +247,25 @@
                             expanded: false,
                             pointType: "system",
                             name: item.SpecialtySystem,
-                            children: [{
-                                id: this.createRandomId(),
-                                topic: "",
-                            }]
+                            // children: [{
+                            //     id: this.createRandomId()
+                            // }]
                         }
                     })
                     console.log(data, "data")
                     this.$nextTick(_ => {
-                        if(!!this.mindArr[this.activeIndex]){
+                        if (!!this.mindArr[this.activeIndex]) {
                             this.jsMind = this.mindArr[this.activeIndex]
                             return false
                         }
-                        console.log(val.index, this.$refs.jsmind,this.$refs.jsmind1)
-                        if(this.activeIndex == 0){
+                        // console.log(val.index, this.$refs.jsmind, this.$refs.jsmind1)
+                        if (this.activeIndex == 0) {
+                            data.children = this.delPlatform(res.Content)
+                            console.log(data.children)
                             this.jsMind = this.$refs.jsmind.initData({}, mind)
-                        }else{
+                        } else {
+                            data.children = this.delPoint(res.Content)
+                            console.log(data.children)
                             this.jsMind = this.$refs.jsmind1.initData({}, mind)
                         }
                         this.mindArr[this.activeIndex] = this.jsMind
@@ -257,6 +273,76 @@
                     })
                 })
             },
+            delPlatform(arr){
+                return arr.map(item => {
+                    if(item.hasOwnProperty('EquipmentTypeList')){
+                        let obj = {
+                            id: this.createRandomId(),
+                            topic: `<div>${item.SpecialtySystem}(${item.PointCount})</div>`,
+                            expanded: false
+                        }
+                        if(item.hasOwnProperty("EquipmentTypeList")){
+                            obj.children = []
+                            obj.children = item.EquipmentTypeList.map(child => {
+                                let obj1 = {
+                                    id: this.createRandomId(),
+                                    topic: `<div>${child.EquipmentType}</div>`,
+                                    children: [],
+                                    expanded: false
+                                }
+                                if(child.hasOwnProperty("EquipmentMarkList")){
+                                    child.EquipmentMarkList.map(node => {
+                                        let obj2 = {
+                                            id: this.createRandomId(),
+                                            topic: `<div>${node.EquipmentMark}</div>`,
+                                            expanded: false,
+                                            children: []
+                                        }
+                                        if(node.hasOwnProperty("InfoList")){
+                                            node.InfoList.map(node1 => {
+                                                let obj3 = {
+                                                    id: this.createRandomId(),
+                                                    expanded: false,
+                                                    topic: `<div>${node1.InfomationPoint}(${node1.MeterFunc}):${node1.Data.Time}-${node1.Data.Data}-${node1.Data.Unit}</div>`,
+                                                    children: []
+                                                }
+                                                if(node1.hasOwnProperty("PointList")){
+                                                    node1.PointList.map(node2 => {
+                                                        let obj4 = {
+                                                            id: this.createRandomId(),
+                                                            topic: `<div>${node2.Description}(${node2.Address}):${node2.Data.Time}-${node2.Data.Data}-${node2.Data.Unit}</div>`,
+                                                        }
+                                                        obj3.children.push(obj4)
+                                                    })
+                                                }
+                                                obj2.children.push(obj3)
+                                            })
+                                        }
+                                        obj1.children.push(obj2)
+                                    })
+                                }
+                                return obj1
+                            })
+                        }
+                        return obj
+                    }
+                    if(item.hasOwnProperty("CheckTodos")){
+                        let obj = {
+                            id: this.createRandomId(),
+                            topic: `<div>${item.SpecialtySystem}(${item.PointCount})</div>`,
+                            expanded: false,
+                            children: []
+                        }
+                        obj.children = item.CheckTodos.map(node => {
+                            return {
+                                id: this.createRandomId(),
+                                topic: `<div>${node.Description}(${node.Address})</div>`,
+                            }
+                        })
+                        return obj
+                    }
+                })
+            },
             createRandomId() {
                 return (Math.random() * 10000000).toString(16).substr(0, 4) + '-' + (new Date()).getTime() + '-' + Math.random().toString().substr(2, 5);
             }
@@ -267,16 +353,21 @@
     }
 </script>
 <style lang="scss">
-    .tabs-h {
-        height: calc(100% - 50px);
-        .el-tabs__content {
-            height: calc(100% - 70px);
-            >div {
-                height: 100%;
-            }
+    .steps4 {
+        flex: 1;
+        display: flex;
+        flex-flow: column;
+        .btns-view {
+            height: 40px;
+            line-height: 40px;
+            margin-bottom: 10px;
+            text-align: right;
+        }
+        .point-border {
+            border-bottom: 1px solid #DCDFE6;
+        }
+        .jsmind-container {
+            flex: 1;
         }
-    }
-    .saga-mind-view {
-        //   height: 450px;
     }
 </style>