shaun-sheep 4 年之前
父节点
当前提交
409c5b9b36
共有 3 个文件被更改,包括 40 次插入66 次删除
  1. 6 0
      src/api/legendLibrary.js
  2. 19 56
      src/views/legendLibrary/addLegend.vue
  3. 15 10
      src/views/legendLibrary/index.vue

+ 6 - 0
src/api/legendLibrary.js

@@ -72,4 +72,10 @@ export function getVisualization({
 }) {
     return httputils.postJson(`/serve/topology-wanda/graphElement/type/search`, postParams)
 
+}
+// 图例分层展示 
+export function groupByCategory({
+    getParams
+}) {
+    return httputils.getJson(`/serve/topology-wanda/graphRelation/groupByCategory`, getParams)
 }

+ 19 - 56
src/views/legendLibrary/addLegend.vue

@@ -24,7 +24,7 @@
             placeholder='搜索'
             :linkage='false'
             :lastStage='true'
-            :data='treeData4'
+            :data='treeData'
             @cancel='treeCancel'
             @confirm='treeConfirm'
         />
@@ -34,60 +34,18 @@
 <script>
 import addForm from './addForm'
 import addList from '../legendRules/addList'
-const dataArr = [
-    {
-        id: '0',
-        name: '顶级',
-        open: true,
-        checked: 'uncheck',
-        children: [
-            {
-                id: '1',
-                name: '一级1',
-                open: true,
-                checked: 'uncheck',
-                children: [
-                    { id: '12', name: '一二级2', checked: 'uncheck' },
-                    { id: '121', name: '一二级3', checked: 'uncheck' },
-                    { id: '122', name: '一二级4', checked: 'uncheck' },
-                    {
-                        id: '1321',
-                        name: '二级1',
-                        open: true,
-                        checked: 'uncheck',
-                        children: [
-                            { id: '13', name: '二三级2', checked: 'uncheck' },
-                            { id: '131', name: '二三级3', checked: 'uncheck' },
-                            { id: '132', name: '二三级4', checked: 'uncheck' }
-                        ]
-                    }
-                ]
-            },
-            {
-                id: '2',
-                name: '一级2',
-                open: true,
-                checked: 'uncheck',
-                children: [
-                    { id: '222', name: '二二级2', checked: 'uncheck' },
-                    { id: '2221', name: '二二级1', checked: 'uncheck' },
-                    { id: '2222', name: '二二级3', checked: 'uncheck' }
-                ]
-            },
-            {
-                id: '3',
-                name: '一级3',
-                open: true,
-                checked: 'uncheck',
-                children: [
-                    { id: '3220', name: '三二级0', checked: 'uncheck' },
-                    { id: '3221', name: '三二级1', checked: 'uncheck' },
-                    { id: '322', name: '三二级2', checked: 'uncheck' }
-                ]
-            }
-        ]
-    }
-]
+import { groupByCategory } from '@/api/legendLibrary.js'
+import func from '../../../vue-temp/vue-editor-bridge'
+
+// function getTree(data) {
+//     data.id = data.Id
+//     data.name = data.Name
+//     for (var i = 0; i < data.Children.length; i++) {
+//         if (data.Children[i] && data.Children[i].length > 0) {
+//             getTree(data.Children[i])
+//         }
+//     }
+// }
 export default {
     data() {
         return {
@@ -104,7 +62,7 @@ export default {
             title: '',
             GraphCategoryId: 'DTXT',
             modalShow4: false,
-            treeData4: dataArr
+            treeData: []
         }
     },
     components: { addForm, addList },
@@ -114,6 +72,11 @@ export default {
             this.GraphCategoryId = GraphCategoryId
             console.log(title)
             if (GraphCategoryId) {
+                groupByCategory({}).then(res => {
+                    this.treeData = []
+                    res.Data.forEach(i => {})
+                    // console.log(getTree(this.treeData))
+                })
                 //treeSelect
                 this.modalShow4 = true
 

+ 15 - 10
src/views/legendLibrary/index.vue

@@ -200,19 +200,24 @@ export default {
         getTypeId() {
             let postParams = {}
             queryTypeId({ postParams }).then(res => {
-                console.log(res)
-                let content = res.Content
-                content.forEach(el => {
-                    this.typeIdSelect.push({
-                        id: el.Type + '',
-                        name: el.Name
-                    })
-                })
-                console.log(this.typeIdSelect)
+                console.log(res, 33333)
+                this.typeIdSelect = res.Content
+
+                // let content = res.Content
+                // content.forEach(el => {
+                //     this.typeIdSelect.push({
+                //         id: el.Type + '',
+                //         name: el.Name
+                //     })
+                // })
+                // console.log(this.typeIdSelect)
             })
         },
         visualization() {
-            getVisualization({}).then(res => {})
+            getVisualization({}).then(res => {
+                this.typeIdSelect = res.Data
+                console.log(this.typeIdSelect)
+            })
         },
         add() {
             this.$refs.addLegend.open('', '添加图例库')