shaun-sheep 4 yıl önce
ebeveyn
işleme
94930c0373

+ 3 - 2
src/api/httputils.js

@@ -21,6 +21,7 @@ axiosservice.interceptors.request.use(
     (config) => {
         config.withCredentials = true // 允许携带token ,这个是解决跨域产生的相关问题
         let token = store.getters['ssoToken']
+        let isPreview = store.getters["isPreview"]
         // if (token) {
         //     config.headers = {
         //         'sso-token': token,
@@ -28,8 +29,8 @@ axiosservice.interceptors.request.use(
         // }
         if (config.url.indexOf('mapapp') < 0) {
             config.headers = {
-                'sso-token': token,
-                isPreview: false, //默认false,当预览开启的时候是true
+                "sso-token": token,
+                isPreview: isPreview, //默认false,当预览开启的时候是true
             }
         }
         return config

+ 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 - 23
src/views/legendLibrary/addForm.vue

@@ -149,6 +149,7 @@ import { GraphView } from '@/lib/GraphView'
 export default {
     data() {
         return {
+            maxlength: 20,
             options: [
                 {
                     id: 'None',
@@ -277,7 +278,6 @@ export default {
             let postParams = {
                 Content: [this.ruleForm]
             }
-
             updateLegend({ postParams }).then(res => {
                 if (res.Result == 'success') {
                     this.$message.success('图例修改成功!')
@@ -392,30 +392,43 @@ export default {
         // 把canvas图保存到图片服务器
         saveImg() {
             let vm = this
-            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)
+            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)
+                            }
+                        }
+                    })
+                }
             }
         },
         // 铺位可视化

+ 19 - 0
src/views/legendLibrary/index.vue

@@ -418,6 +418,25 @@ export default {
                 this.total = res.Total
             })
         },
+        transformDate(arr) {
+            arr.map(({ GraphCategorys, InfoLocal, InfoSystems, InfoTypes }) => {
+                if (GraphCategorys.length) {
+                    GraphCategorys.map(i => i)
+                }
+                if (InfoLocal.length) {
+                    GraphCategorys.map(i => {
+                        i.name
+                    })
+                }
+                if (InfoSystems.length) {
+                    GraphCategorys.map()
+                }
+                if (InfoTypes.length) {
+                    GraphCategorys.map()
+                }
+            })
+            return arr
+        },
         getTableList() {
             // if (this.GraphCategoryIds || this.InfoLocals || this.InfoSystems || this.keyword) {
             //     this.currentPage = 1

+ 6 - 0
src/views/overview/index.vue

@@ -184,6 +184,7 @@
 <script>
 import PicModal from './picModal'
 import { queryFact } from '@/api/overview'
+import {mapGetter} from 'vuex'
 export default {
     data() {
         return {
@@ -235,8 +236,13 @@ export default {
         }
     },
     mounted() {
+        let previewUrl = location.href.split('?')[1].toString().split('=')[1]
+        this.$store.commit('SETISPREVIEW',previewUrl)
         this.query()
     },
+    computed:{
+        ...mapGetter(['isPreview'])
+    },
     components: {
         PicModal
     }