4 Commits 9fed79342e ... 41c9340e7d

Author SHA1 Message Date
  guoxiaohuan 41c9340e7d Merge branch 'develop' of git.sagacloud.cn:web/wanda-bm-guide into develop 4 years ago
  guoxiaohuan 9be6e97022 update 4 years ago
  guoxiaohuan 8f22aca82e Merge branch 'develop' of git.sagacloud.cn:web/wanda-bm-guide into develop 4 years ago
  guoxiaohuan 9422bb697c debug 4 years ago
4 changed files with 78 additions and 71 deletions
  1. 19 17
      src/components/floorList.vue
  2. 26 23
      src/views/equipment/index.vue
  3. 6 4
      src/views/floorFunc/index.vue
  4. 27 27
      vue.config.js

+ 19 - 17
src/components/floorList.vue

@@ -38,7 +38,7 @@ import RepeatClick from '@/directives/repeat-click'
 
 export default {
     directives: {
-        repeatClick: RepeatClick
+        repeatClick: RepeatClick,
     },
     data() {
         return {
@@ -47,17 +47,17 @@ export default {
             showB: true,
             num: 0,
             floorMapIdName: '',
-            floor: {
-            },
+            floor: {},
             currentFloorId: null,
             marginTop: 0,
             marginTopMax: 0,
             startTime: '',
             endTime: '',
+            floorObj2: {},
             showNumber: 8, //需要展示的楼层数   //TODO:
             height: 39, //一个楼层的高度
             currIndex: 0, //当前楼层在 楼层数组中的下标,上下箭头使用
-            conHeight: 0 // floor-out 的高度
+            conHeight: 0, // floor-out 的高度
         }
     },
     props: {
@@ -65,23 +65,20 @@ export default {
             type: Array,
             default: () => {
                 return []
-            }
+            },
         },
         // 默认true,
         // 1. 切换楼层后,是否触发 cookie,vuex数据修改,
         // 2. 在fenbuPic组件中为false, 1)不触发cookie,vuex , 2) 选中的楼层ID,为楼层列表数组floorIdArr的第0个
         changeDataFlag: {
             type: Boolean,
-            default: true
-        }
+            default: true,
+        },
     },
     computed: {
-        ...mapGetters(['legendTable','floorObj'])
+        ...mapGetters(['legendTable', 'floorObj']),
     },
     mounted() {
-        if (Object.keys(this.floorObj).length > 0) {
-            this.floor = this.floorObj 
-        }
         this.init()
     },
     methods: {
@@ -105,13 +102,18 @@ export default {
                 return false
             }
             this.floorIdArr = []
-            this.floorsArr.map(item => {
+            this.floorsArr.map((item) => {
                 this.floorIdArr.push(item.seq)
+                if (item.seq == this.$cookie.get('currentFloorId')) {
+                    this.floor = item
+                } else {
+                    this.floor = this.floorObj
+                }
             })
-            this.currentFloorId = Number(this.$cookie.get('currentFloorId') || this.floorObj.seq)
+            this.currentFloorId = Number(this.$cookie.get('currentFloorId') || this.floor.seq)
             // bug fix 修复 fenbuPic 弹窗中,楼层不能选中的问题
             // 如果 floorIdArr 不在 floorIdArr数组中,或者changeDataFlag为false(弹窗组件中的楼层组件),使用 floorIdArr[0], 而不使用 cookie
-            let index = this.floorIdArr.findIndex(item => item === this.currentFloorId)
+            let index = this.floorIdArr.findIndex((item) => item === this.currentFloorId)
             if (index === -1 || !this.changeDataFlag) {
                 this.currentFloorId = this.floorIdArr[0]
             }
@@ -148,7 +150,7 @@ export default {
             this.handlePosition(flag, index, len)
         },
         handleCookie() {
-            let currentFloor = this.floorsArr.filter(item => item.seq == this.currentFloorId)[0]
+            let currentFloor = this.floorsArr.filter((item) => item.seq == this.currentFloorId)[0]
             if (currentFloor) {
                 // 如果 changeDataFlag为true(不是在 分布图弹窗组件中的 楼层组件),设置cookie,vuex
                 if (this.changeDataFlag) {
@@ -219,8 +221,8 @@ export default {
                 default:
                     break
             }
-        }
-    }
+        },
+    },
 }
 </script>
 <style lang="less" scoped>

+ 26 - 23
src/views/equipment/index.vue

@@ -89,8 +89,7 @@ export default {
             systemId: 1,
             categoryId: 'GDXT',
             systemName: '供电系统',
-            floorInfo: {
-            },
+            floorInfo: {},
             smsxt: '1001',
             dialogInfo: {},
             brand: [], //品牌
@@ -102,7 +101,7 @@ export default {
             bottomOffset: 0,
             keyFL: 'keyFL' + new Date().getTime(),
             keyLd: 'keyLd_' + new Date().getTime(),
-            ShowDialog: false //是否显示弹窗
+            ShowDialog: false, //是否显示弹窗
         }
     },
     components: { floorList, eqDialog, floorMap, editList },
@@ -131,18 +130,18 @@ export default {
             this.viewLengend()
             // 发送pvUv
             const data = {
-                plazaId: this.plazaId
+                plazaId: this.plazaId,
             }
             let postParams = {
                 type: 'equipmentRouter',
                 target: item.name,
-                parameter: item.categoryId
+                parameter: item.categoryId,
             }
             getPvUv(data, postParams)
-                .then(res => {
+                .then((res) => {
                     console.log('pvuv', res)
                 })
-                .catch(res => {
+                .catch((res) => {
                     console.log('error', res)
                 })
         },
@@ -158,7 +157,6 @@ export default {
         },
         emitFloor(item) {
             this.floorInfo = item
-            console.log(item)
             this.$refs.floorMap.init(this.floorInfo.gname)
             this.init()
             this.querySmsxt()
@@ -175,19 +173,19 @@ export default {
                 // pvuv接口记录
                 // 发送pvUv
                 const data = {
-                    plazaId: this.plazaId
+                    plazaId: this.plazaId,
                 }
 
                 let postParams = {
                     type: 'modal',
                     target: eve.id,
-                    parameter: eve.label
+                    parameter: eve.label,
                 }
                 getPvUv(data, postParams)
-                    .then(res => {
+                    .then((res) => {
                         console.log('pvuv', res)
                     })
-                    .catch(res => {
+                    .catch((res) => {
                         console.log('error', res)
                     })
             }
@@ -228,15 +226,20 @@ export default {
                 module: '1003',
                 floor: picFloor,
                 system: system,
-                plazaId: this.plazaId
+                plazaId: this.plazaId,
             }
-            queryPic({ getParams }).then(res => {
+            queryPic({ getParams }).then((res) => {
                 // console.log('附加数据', res)
                 this.fqPic = res.data ? res.data : []
             })
         },
         init() {
             this.loadName = `设备设施-${this.systemName}-${this.floorInfo.code}`
+            if (this.floorsArr.length > 0 && this.$cookie.get('currentFloorId')) {
+                this.floorInfo = this.floorsArr.find((item) => {
+                    return this.$cookie.get('currentFloorId') == item.seq
+                })
+            }
         },
         // 从设备设施进入的机房
         queryType(val) {
@@ -267,19 +270,19 @@ export default {
             } else {
                 this.$cookie.set('categoryId', 'SCPZ')
             }
-        }
+        },
     },
     mounted() {
         window._vm = this
-        if (Object.keys(this.floorObj).length > 0) {
-            this.floorInfo = this.floorObj 
-            this.$refs.floorMap.init(this.floorInfo.gname)
-        }
+        // if (Object.keys(this.floorObj).length > 0) {
+        //     this.floorInfo = this.floorObj
+        // }
+        this.$refs.floorMap.init(this.floorInfo.gname)
         if (this.$route.query.smsxt) {
             console.log(this.$route.query.smsxt)
             this.smsxt = this.$route.query.smsxt
             this.smsxtQuery()
-            this.system.forEach(el => {
+            this.system.forEach((el) => {
                 if (el.smsxt == this.smsxt) {
                     this.everySystem = el.children
                     this.systemName = el.name
@@ -290,7 +293,7 @@ export default {
         this.everySystem = this.system[0].children
         // 刷新时,store中有categoryId时,选中子系统状态
         if (this.$store.state.categoryId) {
-            let item = this.system.filter(item => item.categoryId === this.$store.state.categoryId)[0]
+            let item = this.system.filter((item) => item.categoryId === this.$store.state.categoryId)[0]
             this.systemId = item.id
             this.everySystem = item.children
             this.systemName = item.name
@@ -301,8 +304,8 @@ export default {
         this.init()
     },
     computed: {
-        ...mapGetters(['floorsArr', 'plazaId', 'showView', 'legendTable','floorObj'])
-    }
+        ...mapGetters(['floorsArr', 'plazaId', 'showView', 'legendTable', 'floorObj']),
+    },
 }
 </script>
 <style lang="less" scoped>

+ 6 - 4
src/views/floorFunc/index.vue

@@ -31,6 +31,7 @@ export default {
     },
     methods: {
         emitFloor(item) {
+            console.log(item)
             this.floorInfo = item
             this.$refs.floorMap.init(this.floorInfo.gname)
             this.init()
@@ -40,13 +41,14 @@ export default {
         },
         init() {
             this.loadName = `楼层功能-${this.floorInfo.code}`
+            if (this.floorsArr.length > 0 && this.$cookie.get('currentFloorId')) {
+                this.floorInfo = this.floorsArr.find((item) => {
+                    return this.$cookie.get('currentFloorId') == item.seq
+                })
+            }
         },
     },
     mounted() {
-        if (Object.keys(this.floorObj).length > 0) {
-            this.floorInfo = this.floorObj
-        }
-        console.log('floorObj', this.floorObj)
         this.init()
         this.$refs.floorMap.init(this.floorInfo.gname)
     },

+ 27 - 27
vue.config.js

@@ -1,17 +1,17 @@
-const CompressionPlugin = require("compression-webpack-plugin")
+const CompressionPlugin = require('compression-webpack-plugin')
 module.exports = {
     devServer: {
         port: 8090,
         proxy: {
-            "/data": {
-                target: "http://60.205.177.43",
-                // target: 'http://10.199.143.126',
+            '/data': {
+                // target: "http://60.205.177.43",
+                target: 'http://10.199.143.126',
                 // target: 'http://192.168.200.11:9003', //yll
                 // target: 'http://localhost:6040/data/',
                 changeOrigin: true,
                 secure: false,
                 pathRewrite: {
-                    "^/data": "/data",
+                    '^/data': '/data',
                 },
             },
             // // 工程信息化服务
@@ -24,27 +24,27 @@ module.exports = {
             //     },
             // },
             // 万达蜂鸟服务
-            "/wdfn": {
-                target: "http://map.wanda.cn",
+            '/wdfn': {
+                target: 'http://map.wanda.cn',
                 changeOrigin: true,
                 pathRewrite: {
-                    "^/wdfn": "/editor",
+                    '^/wdfn': '/editor',
                 },
             },
             // 图例库服务
-            "/serve": {
+            '/serve': {
                 // target: 'http://192.168.200.87:8088',
-                target: "http://60.205.177.43:8080",
+                target: 'http://60.205.177.43:8080',
                 changeOrigin: true,
                 pathRewrite: {
-                    "^/serve": "",
+                    '^/serve': '',
                 },
             },
-            "/version": {
-                target: "http://mapapp.wanda.cn/",
+            '/version': {
+                target: 'http://mapapp.wanda.cn/',
                 changeOrigin: true,
                 pathRewrite: {
-                    "^/version": "/sgmap/mapversion",
+                    '^/version': '/sgmap/mapversion',
                 },
             },
         },
@@ -56,27 +56,27 @@ module.exports = {
         },
     },
     chainWebpack: (config) => {
-        const svgRule = config.module.rule("svg")
+        const svgRule = config.module.rule('svg')
         svgRule.uses.clear()
         svgRule
-            .use("babel-loader")
-            .loader("babel-loader")
+            .use('babel-loader')
+            .loader('babel-loader')
             .end()
-            .use("vue-svg-loader")
-            .loader("vue-svg-loader")
-        config.output.filename("static/js/[name].[hash].js").end()
-        config.output.chunkFilename("static/js/[name].[hash].js").end()
+            .use('vue-svg-loader')
+            .loader('vue-svg-loader')
+        config.output.filename('static/js/[name].[hash].js').end()
+        config.output.chunkFilename('static/js/[name].[hash].js').end()
     },
     lintOnSave: false,
-    publicPath: "/wandaBmGuide",
+    publicPath: '/wandaBmGuide',
     // 打包名称
-    outputDir: "wandaBmGuide",
+    outputDir: 'wandaBmGuide',
     // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
-    assetsDir: "static",
+    assetsDir: 'static',
     transpileDependencies: [
-        "@saga-web", // 指定对第三方依赖包进行babel-polyfill处理
-        "@ant-design",
-        "element-ui",
+        '@saga-web', // 指定对第三方依赖包进行babel-polyfill处理
+        '@ant-design',
+        'element-ui',
     ],
     productionSourceMap: false, //
     // CSS 相关选项