Browse Source

关系修改

zhulizhen1111 4 years ago
parent
commit
86d01d668a

+ 2 - 2
src/api/legendLibrary.js

@@ -20,8 +20,8 @@ export function getLegendTree({ getParams }) {
     return httputils.getJson(`/serve/graphCategory/queryByGroup`, getParams)
 }
 //图例库-系统tree相关表格查询
-export function queryRelation({ postParams }) {
-    return httputils.postJson(`/serve/graphRelation/query`, postParams)
+export function queryRelation({ data, postParams }) {
+    return httputils.fetchJson(`/serve/graphRelation/query`, data, postParams)
 }
 //图例库-更新关系图
 export function updateRelation({ postParams }) {

+ 14 - 8
src/views/legendLibrary/addForm.vue

@@ -174,6 +174,7 @@ export default {
         getFile(file) {
             var formData = new FormData()
             formData.append('file', file.file)
+            formData.append('uid', this.ruleForm.Url)
             let postParams = formData
             uploadImg({ postParams }).then(res => {
                 if (res.Result == 'success') {
@@ -263,10 +264,12 @@ export default {
         changeLineType(val) {
             this.$set(this.ruleForm, 'LineDash', val)
             this.borderLineOptionObject = val && this.borderLineOption.find(item => item.id == val)
-            this.$refs.select1.$el.children[0].children[0].setAttribute(
-                'style',
-                'background:url(' + this.borderLineOptionObject.src + ')  center center no-repeat;color:transparent;'
-            )
+            if (this.$refs.select1) {
+                this.$refs.select1.$el.children[0].children[0].setAttribute(
+                    'style',
+                    'background:url(' + this.borderLineOptionObject.src + ')  center center no-repeat;color:transparent;'
+                )
+            }
             if (this.view) {
                 this.view.lineType = val
             }
@@ -275,10 +278,13 @@ export default {
         changeLineWidth(val) {
             this.$set(this.ruleForm, 'LineWidth', val)
             this.linepxObject = val && this.linepxOption.find(item => item.id == val)
-            this.$refs.select.$el.children[0].children[0].setAttribute(
-                'style',
-                'background:url(' + this.linepxObject.src + ') center center no-repeat;color:transparent;'
-            )
+            if (this.$refs.select) {
+                this.$refs.select.$el.children[0].children[0].setAttribute(
+                    'style',
+                    'background:url(' + this.linepxObject.src + ') center center no-repeat;color:transparent;'
+                )
+            }
+
             if (this.view) {
                 this.view.lineWidth = Number(val)
             }

+ 4 - 6
src/views/legendLibrary/addLegend.vue

@@ -1,7 +1,7 @@
 <template>
     <div class='add-legend'>
         <el-dialog :title='title' :visible.sync='dialogVisible'>
-            <add-list v-show='title==""' ref='searchList' :GraphCategoryId='GraphCategoryId' @mesg='mesg'></add-list>
+            <add-list v-show='title=="" && GraphCategoryId' ref='searchList' :GraphCategoryId='GraphCategoryId' @mesg='mesg'></add-list>
             <add-form v-show='title!=""' ref='add' :ruleForm='info' @addSuccess='addSuccess' @updateSuccess='updateSuccess' :title='title'></add-form>
             <span slot='footer' class='dialog-footer'>
                 <el-button @click='dialogVisible = false,cancal()' size='small'>取 消</el-button>
@@ -28,7 +28,7 @@ export default {
                 LineDash: ''
             },
             title: '',
-            GraphCategoryId: ''
+            GraphCategoryId: 'DTXT'
         }
     },
     components: { addForm, addList },
@@ -45,11 +45,9 @@ export default {
                     FillColor: '',
                     Url: ''
                 }
-            }
-            if (title == '修改图例库') {
+            } else if (title == '修改图例库') {
                 this.info = row
-            }
-            if (!title && this.$refs.searchList) {
+            } else if (title == '' && this.$refs.searchList) {
                 this.$refs.searchList.queryAll()
             }
         },

+ 9 - 6
src/views/legendRules/addList.vue

@@ -39,14 +39,17 @@ export default {
                     })
                 })
             })
-            this.querySelectTab()
+            if (this.GraphCategoryId) {
+                this.querySelectTab(this.GraphCategoryId)
+            }
         },
-        querySelectTab() {
-            let postParams = {
-                GraphCategoryId: this.GraphCategoryId
+        querySelectTab(GraphCategoryId) {
+            let postParams = {}
+            let data = {
+                graphCategoryId: GraphCategoryId
             }
-            queryRelation({ postParams }).then(res => {
-                let content = res.Content
+            queryRelation({ data, postParams }).then(res => {
+                let content = res.data.Content
                 content.forEach(el => {
                     this.value.push(el.Id)
                 })

+ 6 - 6
src/views/legendRules/index.vue

@@ -43,7 +43,7 @@ export default {
     data() {
         return {
             treeData: [],
-            GraphCategoryId: 'JPSXT',
+            GraphCategoryId: 'DTXT',
             tableData: []
         }
     },
@@ -79,7 +79,6 @@ export default {
         init() {
             let getParams = {}
             getLegendTree({ getParams }).then(res => {
-                console.log(res)
                 let content = res.Content
                 content.forEach(el => {
                     el.label = el.Name
@@ -93,11 +92,12 @@ export default {
             })
         },
         getData() {
-            let postParams = {
-                GraphCategoryId: this.GraphCategoryId
+            let postParams = {}
+            let data = {
+                graphCategoryId: this.GraphCategoryId
             }
-            queryRelation({ postParams }).then(res => {
-                this.tableData = res.Content
+            queryRelation({ data, postParams }).then(res => {
+                this.tableData = res.data.Content
             })
         }
     },