Explorar o código

圖例庫修改 回顯圖例

zhulizhen1111 %!s(int64=4) %!d(string=hai) anos
pai
achega
ab93b7cad5

+ 0 - 2
src/lib/GraphView.js

@@ -67,7 +67,6 @@ var GraphView = /** @class */ (function (_super) {
         },
         set: function (v) {
             this._lineType = v;
-            console.log(1243);
             this.update();
         },
         enumerable: true,
@@ -79,7 +78,6 @@ var GraphView = /** @class */ (function (_super) {
         },
         set: function (v) {
             this._lineWidth = v;
-            console.log(1243);
             this.update();
         },
         enumerable: true,

+ 0 - 2
src/lib/GraphView.ts

@@ -37,7 +37,6 @@ export class GraphView extends SCanvasView {
     }
     set lineType(v: string) {
         this._lineType = v;
-        console.log(1243)
         this.update()
     }
 
@@ -49,7 +48,6 @@ export class GraphView extends SCanvasView {
     }
     set lineWidth(v: number) {
         this._lineWidth = v;
-        console.log(1243)
         this.update()
     }
 

+ 25 - 15
src/views/legendLibrary/addForm.vue

@@ -141,15 +141,15 @@ export default {
             ],
             linepxOption: [
                 {
-                    id: '1',
+                    id: 1,
                     src: require('@/assets/imgs/1pxline.jpg')
                 },
                 {
-                    id: '2',
+                    id: 2,
                     src: require('@/assets/imgs/2pxline.jpg')
                 },
                 {
-                    id: '3',
+                    id: 3,
                     src: require('@/assets/imgs/3pxline.jpg')
                 }
             ],
@@ -165,10 +165,13 @@ export default {
         }
     },
     props: ['ruleForm', 'title'],
-    computed: {},
+    updated() {
+        this.changeLineWidth(this.ruleForm.LineWidth)
+        this.changeLineType(this.ruleForm.LineDash)
+        this.initGraph()
+    },
     methods: {
         getFile(file) {
-            console.log(file)
             var formData = new FormData()
             formData.append('file', file.file)
             let postParams = formData
@@ -213,12 +216,18 @@ export default {
             this.fileList = fileList.slice(-1)
         },
         clearGraphy(type) {
-            if (this.view) {
-                this.view.type = type
-                return
+            if (!(this.view instanceof GraphView)) {
+                this.view = new GraphView('canvas')
             }
-            this.view = new GraphView('canvas')
             this.view.type = type
+            if (this.ruleForm.FillColor.indexOf('#') > -1) {
+                this.view.bgcolor = this.ruleForm.FillColor
+            } else {
+                this.view.bgcolor = this.hexify(this.ruleForm.FillColor)
+            }
+            this.view.strokecolor = this.ruleForm.Color
+            this.view.lineType = this.ruleForm.LineDash
+            this.view.lineWidth = this.ruleForm.LineWidth
         },
         initGraph() {
             if (this.ruleForm.Type == 'Zone' || this.ruleForm.Type == 'Line') {
@@ -252,8 +261,7 @@ export default {
         },
         //线条类型改变
         changeLineType(val) {
-            console.log(val)
-            this.ruleForm.LineDash = 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',
@@ -265,7 +273,7 @@ export default {
         },
         //线条宽度
         changeLineWidth(val) {
-            this.ruleForm.LineWidth = 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',
@@ -292,11 +300,9 @@ export default {
         saveImg() {
             if (this.view) {
                 let data = this.view.canvasView.toDataURL('image/png')
-                console.log(data)
                 var formData = new FormData()
                 formData.append('file', this.base64ToFile(data))
                 let postParams = formData
-                console.log(postParams, 'posssss')
                 uploadImg({ postParams }).then(res => {
                     if (res.Result == 'success') {
                         this.$set(this.ruleForm, 'Url', res.EntityList[0])
@@ -316,7 +322,11 @@ export default {
             }
         }
     },
-    mounted() {}
+    mounted() {
+        this.changeLineWidth(this.ruleForm.LineWidth)
+        this.changeLineType(this.ruleForm.LineDash)
+        this.initGraph()
+    }
 }
 </script>
 

+ 3 - 3
src/views/legendLibrary/addLegend.vue

@@ -1,10 +1,10 @@
 <template>
     <div class='add-legend'>
         <el-dialog :title='title' :visible.sync='dialogVisible'>
-            <add-list v-if='title==""' ref='searchList' :GraphCategoryId='GraphCategoryId' @mesg='mesg'></add-list>
-            <add-form v-else ref='add' :ruleForm='info' @addSuccess='addSuccess' @updateSuccess='updateSuccess' :title='title'></add-form>
+            <add-list v-show='title==""' 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' size='small'>取 消</el-button>
+                <el-button @click='dialogVisible = false,cancal()' size='small'>取 消</el-button>
                 <el-button type='primary' @click='save' size='small'>确 定</el-button>
             </span>
         </el-dialog>