Переглянути джерело

图标绘制功能bug修改

haojianlong 4 роки тому
батько
коміт
b77af1dc42

+ 0 - 15
src/views/equipment/index.vue

@@ -343,19 +343,4 @@ export default {
         white-space: nowrap;
     }
 }
-#equipment {
-    //meri-design组件select的字体颜色
-    /deep/ .p-select-fakePlaceholder {
-        span {
-            span {
-                color: #606266 !important;
-                font-size: 13px;
-                font-weight: normal;
-            }
-        }
-    }
-    /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active{
-        background:linear-gradient(180deg,rgba(54,156,247,1) 0%,rgba(2,91,170,1) 100%);
-    }
-}
 </style>

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

@@ -42,7 +42,7 @@
             <div v-show='ruleForm.Type=="Zone" || ruleForm.Type=="Image" || ruleForm.Type =="Line"'>
                 <div style='color:#646C73'>展示预览</div>
                 <div class='input-right' ref='graph'>
-                    <canvas id='canvas' :width='canvasWidth' :height='canvasHeight' v-show='!ruleForm.Url'></canvas>
+                    <canvas id='canvas' :width='canvasWidth' :height='canvasHeight'></canvas>
                 </div>
             </div>
         </div>
@@ -243,7 +243,6 @@ export default {
             var reader = new FileReader()
             reader.readAsDataURL(this.file)
             reader.onload = e => {
-                console.log(this.view)
                 this.view.url = e.target.result
             }
         },
@@ -458,16 +457,15 @@ export default {
                     if (res.Result == 'success') {
                         this.$set(vm.ruleForm, 'Url', res.EntityList[0])
                         this.$message.success('图标上传成功!')
-                        // if (this.title == '添加图例库') {
-                        //     this.create()
-                        //     this.$emit('addSuccess')
-                        //     this.view.canvas.clearRect(0, 0, this.width, this.height)
-                        // } else if (this.title == '修改图例库') {
-                        //     this.update()
-                        //     this.$emit('updateSuccess')
-                        //     this.view.canvas.clearRect(0, 0, this.width, this.height)
-                        // } else {
-                        // }
+                        if (this.title == '添加图例库') {
+                            this.create()
+                            this.$emit('addSuccess')
+                            this.view.canvas.clearRect(0, 0, this.width, this.height)
+                        } else if (this.title == '修改图例库') {
+                            this.update()
+                            this.$emit('updateSuccess')
+                            this.view.canvas.clearRect(0, 0, this.width, this.height)
+                        } 
                     }
                 })
             }
@@ -544,16 +542,22 @@ export default {
             this.changeLineType(this.ruleForm.LineDash)
             this.initGraph()
         }
+    },
+    watch:{
+        'ruleForm.Id':{
+            handler(){
+                this.initQueryDeviceAndPOsition()
+                this.visualization()
+                if (this.title == '修改图例库') {
+                    if (this.ruleForm.Type != 'Image') {
+                        this.changeLineWidth(this.ruleForm.LineWidth)
+                        this.changeLineType(this.ruleForm.LineDash)
+                    }
+                    this.initGraph()
+                }
+            }
+        }
     }
-    // updated() {
-    //     this.initQueryDeviceAndPOsition()
-    //     this.visualization()
-    //     if (this.title == '修改图例库') {
-    //         this.changeLineWidth(this.ruleForm.LineWidth)
-    //         this.changeLineType(this.ruleForm.LineDash)
-    //         this.initGraph()
-    //     }
-    // }
 }
 </script>
 

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

@@ -122,7 +122,6 @@ export default {
                 this.info = row
                 this.InfosList = []
                 this.InfoTypeIdList = []
-
                 // this.InfosList = [...row.InfoLocal.map(({ id }) => id), ...row.InfoSystem]
                 this.InfosList = row.InfoLocal ? [...row.InfoLocal.map(({ id }) => id)] : []
                 this.InfoTypeIdList = row.InfoTypeId
@@ -167,6 +166,15 @@ export default {
             this.$emit('addSuccess')
             this.cancal()
         },
+        isCreateOrUpdate(){
+            if (this.title == '添加图例库') {
+                this.$refs.add.create()
+                this.$emit('addSuccess')
+            } else if (this.title == '修改图例库') {
+                this.$refs.add.update()
+                this.$emit('updateSuccess')
+            }
+        },
         save() {
             // FillColor,Color,Name
             if (this.info.Name == '') {
@@ -175,18 +183,10 @@ export default {
             } else {
                 if (this.info.Type != 'None') {
                     this.$refs.add.saveImg()
-                } 
-                if (this.title == '添加图例库') {
-                    this.$refs.add.create()
-                    this.$emit('addSuccess')
-                } else if (this.title == '修改图例库') {
-                    this.$refs.add.update()
-                    this.$emit('updateSuccess')
+                }else{
+                    this.isCreateOrUpdate()
                 }
                 this.dialogVisible = false
-                // if (!this.title || this.info.Type == 'None') {
-                //     this.$refs.add.create()
-                // }
             }
         },
         treeConfirm(ids, dataObj) {