Bläddra i källkod

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-bm-guide into develop

shaun-sheep 4 år sedan
förälder
incheckning
14d51c25f9
2 ändrade filer med 41 tillägg och 30 borttagningar
  1. 5 0
      src/store/index.js
  2. 36 30
      src/views/legendLibrary/addForm.vue

+ 5 - 0
src/store/index.js

@@ -9,6 +9,7 @@ export default new Vuex.Store({
     state: {
         ssoToken: "admin:lengqiang",
         // ssoToken: null,
+        isPreview: false,
         lastRoute: "",
         isrequestAuth: true, // 是否请求登录校验接口
         permissions: [], //权限信息 "GLSMS_VIEW":"说明书查看"、"GLSMS_SYMBOL_MANAGE": "图例库管理"、 "GLSMS_PLANARGRAPH_MANAGE":"平面图维护"
@@ -32,6 +33,7 @@ export default new Vuex.Store({
         currentFloor: {}, //当前选中的楼层信息
     },
     getters: {
+        isPreview: (state) => state.isPreview,
         ssoToken: (state) => state.ssoToken,
         lastRoute: (state) => state.lastRoute,
         floorsArr: (state) => state.floorsArr,
@@ -47,6 +49,9 @@ export default new Vuex.Store({
         bunkObj: (state) => state.bunkObj,
     },
     mutations: {
+        SETISPREVIEW(state, data) {
+            state.isPreview = data
+        },
         SETSSOTOKEN(state, data) {
             state.ssoToken = data
         },

+ 36 - 30
src/views/legendLibrary/addForm.vue

@@ -391,38 +391,44 @@ export default {
         },
         // 把canvas图保存到图片服务器
         saveImg() {
-            let vm = this 
-            if(!this.file){
-                 //修改图片的时候没有重新上传图片
-                this.update()
-                this.$emit('updateSuccess')
-                this.view.canvas.clearRect(0, 0, this.width, this.height)
-            }else{
-                 if (this.view) {
-                let data = this.view.canvasView.toDataURL('image/png')
-                var formData = new FormData()
-                if (this.ruleForm.Type == 'Zone' || this.ruleForm.Type == 'Line') {
-                    formData.append('file', this.base64ToFile(data))
-                } else {
-                    formData.append('file', this.file)
+            let vm = this
+            if (!this.file) {
+                //修改图片的时候没有重新上传图片
+                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)
                 }
-                let postParams = formData
-                uploadImg({ postParams }).then(res => {
-                    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.view) {
+                    let data = this.view.canvasView.toDataURL('image/png')
+                    var formData = new FormData()
+                    if (this.ruleForm.Type == 'Zone' || this.ruleForm.Type == 'Line') {
+                        formData.append('file', this.base64ToFile(data))
+                    } else {
+                        formData.append('file', this.file)
                     }
-                })
-            }
+                    let postParams = formData
+                    uploadImg({ postParams }).then(res => {
+                        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)
+                            }
+                        }
+                    })
+                }
             }
         },
         // 铺位可视化