YaolongHan 4 年 前
コミット
39a82e5c70

+ 237 - 209
src/App.vue

@@ -1,137 +1,153 @@
 <template>
-    <div id='app'>
-        <div :id='`fengMap${id}`' class='fengMap'></div>
-        <router-view />
-    </div>
+  <div id="app">
+    <div :id="`fengMap${id}`" class="fengMap"></div>
+    <router-view />
+  </div>
 </template>
 <script>
-import { mapGetters, mapActions, mapMutations } from 'vuex'
-import { SFengParser } from '@saga-web/feng-map'
-import { setFloor } from '@/api/public.js'
-window.fengmapData = null
+import { mapGetters, mapActions, mapMutations } from "vuex";
+import { SFengParser } from "@saga-web/feng-map";
+import { setFloor } from "@/api/public.js";
+window.fengmapData = null;
 export default {
-    data() {
-        return {
-            view: '',
-            scene: '',
-            id: '2',
-            canvasID: '',
-            key: '23f30a832a862c58637a4aadbf50a566',
-            appName: '万达可视化系统',
-            mapServerURL: `http://map.wanda.cn/editor`,
-            mapthemeUrl: `http://map.wanda.cn/editor/webtheme`,
-            isMounted: false,
-            plazaIds: ''
-        }
-    },
-    /**
-     * 刷新保存vuex信息
-     */
-    created() {
-        let beforeunload = JSON.parse(localStorage.getItem('beforeunload'))
-        // 删除 store中的ssoToken
-        beforeunload && delete beforeunload.ssoToken
-        this.$store.replaceState(Object.assign(this.$store.state, beforeunload))
-        //    刷新时,将haveFengMap 置为false,解决设备设施页面,刷新时不出新楼层图的问题
-        this.SETHAVEFENGMAP(false)
-        localStorage.removeItem('beforeunload')
-        window.addEventListener('beforeunload', () => {
-            let state = JSON.stringify(this.$store.state)
-            localStorage.setItem('beforeunload', state)
-        })
-    },
-    mounted() {
-        this.isMounted = true
-        this.plazaIds = localStorage.getItem('PLAZAID')
-    },
-    computed: {
-        ...mapGetters(['plazaId', 'fmapID', 'haveFengMap', 'accessLevel'])
+  data() {
+    return {
+      view: "",
+      scene: "",
+      id: "2",
+      canvasID: "",
+      key: "23f30a832a862c58637a4aadbf50a566",
+      appName: "万达可视化系统",
+      mapServerURL: `http://map.wanda.cn/editor`,
+      mapthemeUrl: `http://map.wanda.cn/editor/webtheme`,
+      isMounted: false,
+      plazaIds: ""
+    };
+  },
+  /**
+   * 刷新保存vuex信息
+   */
+  created() {
+    let beforeunload = JSON.parse(localStorage.getItem("beforeunload"));
+    // 删除 store中的ssoToken
+    if (beforeunload) {
+      delete beforeunload.ssoToken;
+      delete beforeunload.plazaId;
+      delete beforeunload.isPreview;
+    }
+
+    let plazaId = localStorage.getItem("PLAZAID");
+    let isPreview = sessionStorage.getItem("SETISPREVIEW");
+    this.$store.replaceState(
+      Object.assign(this.$store.state, beforeunload, { plazaId, isPreview })
+    );
+    //    刷新时,将haveFengMap 置为false,解决设备设施页面,刷新时不出新楼层图的问题
+    this.SETHAVEFENGMAP(false);
+    localStorage.removeItem("beforeunload");
+    window.addEventListener("beforeunload", () => {
+      let state = JSON.stringify(this.$store.state);
+      localStorage.setItem("beforeunload", state);
+    });
+  },
+  mounted() {
+    this.isMounted = true;
+    this.plazaIds = localStorage.getItem("PLAZAID");
+  },
+  computed: {
+    ...mapGetters(["plazaId", "fmapID", "haveFengMap", "accessLevel"])
+  },
+  methods: {
+    ...mapActions(["getfmapID"]),
+    ...mapMutations(["SETHAVEFENGMAP"]),
+    getFengMap() {
+      this.getfmapID().then(() => {
+        this.getMap();
+      });
     },
-    methods: {
-        ...mapActions(['getfmapID']),
-        ...mapMutations(['SETHAVEFENGMAP']),
-        getFengMap() {
-            this.getfmapID().then(() => {
-                this.getMap()
-            })
-        },
-        getMap() {
-            //如果项目为 南昌八一路 长春重庆路 青岛台东路 则不走楼层缓存接口
-            // if(this.plazaIds == "1001064" || this.plazaIds == "1001065" || this.plazaIds == "1001066"){
-            //     let arr = ["b2","b1","f1","f2","f3","f4","f5","f6","g80"];
-            //     setFloor({ plazaId: this.plazaIds }, arr)
-            //     .then(res => {
-            //       console.log("缓存楼层", res);
-            //     })
-            //     .catch(error => {
-            //       console.log("缓存楼层", error);
-            //     });
-            //     return
-            //   }
+    getMap() {
+      //如果项目为 南昌八一路 长春重庆路 青岛台东路 则不走楼层缓存接口
+      // if(this.plazaIds == "1001064" || this.plazaIds == "1001065" || this.plazaIds == "1001066"){
+      //     let arr = ["b2","b1","f1","f2","f3","f4","f5","f6","g80"];
+      //     setFloor({ plazaId: this.plazaIds }, arr)
+      //     .then(res => {
+      //       console.log("缓存楼层", res);
+      //     })
+      //     .catch(error => {
+      //       console.log("缓存楼层", error);
+      //     });
+      //     return
+      //   }
 
-            window.fengmapData = new SFengParser(
-                `fengMap${this.id}`,
-                `${this.mapServerURL}/fmap/${this.fmapID}`,
-                this.key,
-                this.appName,
-                null,
-                this.mapthemeUrl
-            )
-            if (this.fmapID.includes('null')) {
-                this.SETHAVEFENGMAP(0)
-            }
-            window.fengmapData.loadMap(this.fmapID, (a, b) => {
-                const dataArr = b.map(item => {
-                    return item.gname
-                })
-                // 获取主题数据
-                window.fengmapData.loadTheme(`${this.mapServerURL}/webtheme/${this.fmapID}/${this.fmapID}.theme`).then(res => {
-                    this.SETHAVEFENGMAP(1)
-                })
-                // 缓存楼层数据
-                if (dataArr.length) {
-                    //如果项目为 南昌八一路 长春重庆路 青岛台东路 则不走楼层缓存接口
-                    // if(this.plazaIds == "1001064" || this.plazaIds == "1001065" || this.plazaIds == "1001066"){
-                    //   let arr = ["b2","b1","f1","f2","f3","f4","f5","f6","g80"];
-                    //   setFloor({ plazaId: this.plazaIds }, arr)
-                    //   .then(res => {
-                    //     console.log("缓存楼层", res);
-                    //   })
-                    //   .catch(error => {
-                    //     console.log("缓存楼层", error);
-                    //   });
-                    //   return
-                    // }
-                    setFloor({ plazaId: this.plazaIds }, dataArr)
-                        .then(res => {
-                            console.log('缓存楼层', res)
-                        })
-                        .catch(error => {
-                            console.log('缓存楼层', error)
-                        })
-                }
+      window.fengmapData = new SFengParser(
+        `fengMap${this.id}`,
+        `${this.mapServerURL}/fmap/${this.fmapID}`,
+        this.key,
+        this.appName,
+        null,
+        this.mapthemeUrl
+      );
+      if (this.fmapID.includes("null")) {
+        this.SETHAVEFENGMAP(0);
+      }
+      window.fengmapData.loadMap(this.fmapID, (a, b) => {
+        const dataArr = b.map(item => {
+          return item.gname;
+        });
+        // 获取主题数据
+        window.fengmapData
+          .loadTheme(
+            `${this.mapServerURL}/webtheme/${this.fmapID}/${this.fmapID}.theme`
+          )
+          .then(res => {
+            this.SETHAVEFENGMAP(1);
+          });
+        // 缓存楼层数据
+        if (dataArr.length) {
+          //如果项目为 南昌八一路 长春重庆路 青岛台东路 则不走楼层缓存接口
+          // if(this.plazaIds == "1001064" || this.plazaIds == "1001065" || this.plazaIds == "1001066"){
+          //   let arr = ["b2","b1","f1","f2","f3","f4","f5","f6","g80"];
+          //   setFloor({ plazaId: this.plazaIds }, arr)
+          //   .then(res => {
+          //     console.log("缓存楼层", res);
+          //   })
+          //   .catch(error => {
+          //     console.log("缓存楼层", error);
+          //   });
+          //   return
+          // }
+          setFloor({ plazaId: this.plazaIds }, dataArr)
+            .then(res => {
+              console.log("缓存楼层", res);
             })
+            .catch(error => {
+              console.log("缓存楼层", error);
+            });
         }
+      });
+    }
+  },
+  watch: {
+    plazaId(plazaId) {
+      let plazaid = this.$route.query.plazaId
+        ? this.$route.query.plazaId
+        : plazaId;
+      console.log("获取到id", plazaid);
+      window.fengmapData = null;
+      // 当获取到到项目id,请求底图
+      if (plazaid) {
+        // 请求该项目下的楼层数据
+        this.getFengMap();
+      } else {
+        window.fengmapData = null;
+      }
     },
-    watch: {
-        plazaIds(plazaId) {
-            console.log('获取到id', plazaId)
-            window.fengmapData = null
-            // 当获取到到项目id,请求底图
-            if (plazaId) {
-                // 请求该项目下的楼层数据
-                this.getFengMap()
-            } else {
-                window.fengmapData = null
-            }
-        },
-        isMounted(isMounted) {
-            if (isMounted && this.plazaIds) {
-                this.getFengMap()
-            }
-        }
+    isMounted(isMounted) {
+      if (isMounted && this.plazaIds) {
+        this.getFengMap();
+      }
     }
-}
+  }
+};
 </script>
 <style lang="less">
 body,
@@ -159,8 +175,8 @@ input,
 textarea,
 th,
 td {
-    margin: 0;
-    padding: 0;
+  margin: 0;
+  padding: 0;
 }
 
 body,
@@ -168,7 +184,7 @@ button,
 input,
 select,
 textarea {
-    font: 12px/1.5 Arial, 'Microsoft YaHei', '\65b0\5b8b\4f53';
+  font: 12px/1.5 Arial, "Microsoft YaHei", "\65b0\5b8b\4f53";
 }
 
 h1,
@@ -177,7 +193,7 @@ h3,
 h4,
 h5,
 h6 {
-    font-size: 100%;
+  font-size: 100%;
 }
 
 address,
@@ -187,158 +203,170 @@ var,
 em,
 i,
 u {
-    font-style: normal;
+  font-style: normal;
 }
 
 ol,
 ul {
-    list-style: none;
+  list-style: none;
 }
 
 a {
-    text-decoration: none;
+  text-decoration: none;
 }
 
 a:hover {
-    text-decoration: underline;
+  text-decoration: underline;
 }
 
 img {
-    border: none;
-    vertical-align: middle;
+  border: none;
+  vertical-align: middle;
 }
 
 :focus {
-    outline: 0;
+  outline: 0;
 }
 
 button,
 input,
 select,
 textarea {
-    font-size: 100%;
+  font-size: 100%;
 }
 
 table {
-    border-collapse: collapse;
-    border-spacing: 0;
+  border-collapse: collapse;
+  border-spacing: 0;
 }
 
 /* 滚动条样式 */
 
 body ::-webkit-scrollbar {
-    width: 5px;
-    height: 8px;
+  width: 5px;
+  height: 8px;
 }
 
 body ::-webkit-scrollbar-track {
-    background-color: rgba(0, 0, 0, 0);
-    border-radius: 3px;
+  background-color: rgba(0, 0, 0, 0);
+  border-radius: 3px;
 }
 
 body ::-webkit-scrollbar-thumb {
-    border-radius: 3px;
-    background: #e6e6e6;
-    border: 1px solid #e6e6e6;
+  border-radius: 3px;
+  background: #e6e6e6;
+  border: 1px solid #e6e6e6;
 }
 
 body ::-webkit-scrollbar-thumb:vertical:hover {
-    background: #e6e6e6;
-    border: 1px solid #e6e6e6;
+  background: #e6e6e6;
+  border: 1px solid #e6e6e6;
 }
 
 #app {
-    //meri-design组件select的字体颜色
-    /deep/ .p-select-fakePlaceholder {
-        span {
-            span {
-                color: #606266 !important;
-                font-size: 13px;
-                font-weight: normal;
-            }
-        }
-    }
-    //element 分页组件背景色
-    /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%);
-    }
-    //element button
-    /deep/ .el-button--primary,
-    .p-button-primary {
-        background: linear-gradient(180deg, rgba(54, 156, 247, 1) 0%, rgba(2, 91, 170, 1) 100%);
+  //meri-design组件select的字体颜色
+  /deep/ .p-select-fakePlaceholder {
+    span {
+      span {
+        color: #606266 !important;
+        font-size: 13px;
+        font-weight: normal;
+      }
     }
+  }
+  //element 分页组件背景色
+  /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%
+    );
+  }
+  //element button
+  /deep/ .el-button--primary,
+  .p-button-primary {
+    background: linear-gradient(
+      180deg,
+      rgba(54, 156, 247, 1) 0%,
+      rgba(2, 91, 170, 1) 100%
+    );
+  }
 }
 .clearfix::after {
-    content: '.';
-    display: block;
-    height: 0;
-    clear: both;
-    visibility: hidden;
+  content: ".";
+  display: block;
+  height: 0;
+  clear: both;
+  visibility: hidden;
 }
 .clearfix {
-    zoom: 1;
+  zoom: 1;
 }
 
 .left {
-    float: left;
+  float: left;
 }
 
 .right {
-    float: right;
+  float: right;
 }
 html,
 body {
-    width: 100%;
-    height: 100%;
-    // min-width: 1920px;
-    //   background: url('./assets/images/back.jpg') no-repeat;
+  width: 100%;
+  height: 100%;
+  // min-width: 1920px;
+  //   background: url('./assets/images/back.jpg') no-repeat;
 }
 #app {
-    height: 100%;
-    width: 100%;
-    position: relative;
-    .fengMap {
-        position: fixed;
-        width: 100px;
-        height: 100px;
-        z-index: -1;
-        opacity: 0;
-    }
+  height: 100%;
+  width: 100%;
+  position: relative;
+  .fengMap {
+    position: fixed;
+    width: 100px;
+    height: 100px;
+    z-index: -1;
+    opacity: 0;
+  }
 }
 // element表头背景颜色修改
 .core-device-report,
 .specification-update-record {
-    .el-table thead th {
-        background-color: #f8f9fa;
-    }
-    .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%);
-    }
+  .el-table thead th {
+    background-color: #f8f9fa;
+  }
+  .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%
+    );
+  }
 }
 // 说明书更新记录 element 时间控件样式重写
 .specification-update-record,
 .core-device-report {
-    .el-input__inner {
-        height: 32px;
-        line-height: 32px;
-    }
-    .el-date-editor .el-range__icon,
-    .el-date-editor .el-range-separator {
-        line-height: 26px;
-        width: 8%;
-    }
+  .el-input__inner {
+    height: 32px;
+    line-height: 32px;
+  }
+  .el-date-editor .el-range__icon,
+  .el-date-editor .el-range-separator {
+    line-height: 26px;
+    width: 8%;
+  }
 }
 .el-dialog__header {
-    border-bottom: 1px solid rgba(239, 240, 241, 1);
+  border-bottom: 1px solid rgba(239, 240, 241, 1);
 }
 .gantt-chart .el-dialog__title {
-    font-weight: 500;
+  font-weight: 500;
 }
 .img-detail-container {
-    .el-dialog__body {
-        padding-top: 0;
-        padding-bottom: 0;
-        padding-right: 0;
-    }
+  .el-dialog__body {
+    padding-top: 0;
+    padding-bottom: 0;
+    padding-right: 0;
+  }
 }
 </style>

+ 1 - 1
src/components/Legend/src/legend.vue

@@ -361,7 +361,7 @@ export default {
             }
             const { conf } = window.__systemConf
             const editerUrl = conf[process.env.NODE_ENV + '_editerUrl'];
-            if(this.plazaId){
+            if(!this.plazaId){
                 return
             }
             let data = `categoryId=${categoryId}&projectId=${this.plazaId}&BuildingID=1&FloorID=${FloorID}&FloorName=${floorName}&fmapID=${this.fmapID}&seq=${seq}&token=${this.ssoToken}`

+ 4 - 1
src/components/menuList.vue

@@ -126,6 +126,9 @@ export default {
         toDrafts() {
             const { conf } = window.__systemConf
             // { editerUrl } = conf;
+            if(!this.plazaId){
+                return
+            }
             const editerUrl = conf[process.env.NODE_ENV + '_editerUrl']
             let data = `projectId=${this.plazaId}&fmapID=${this.fmapID}&token=${this.$store.state.ssoToken}`
             let url = editerUrl + 'drafts?' + encodeURIComponent(data)
@@ -178,7 +181,7 @@ export default {
         },
 
         dumpLegend() {
-            const { conf } = window.__systemConf
+            const { conf } = window.__systemConf;
             const wandaBmGuideUrl = conf[process.env.NODE_ENV + '_wandaBmGuideUrl']
             window.open(`${wandaBmGuideUrl}home/legendLibrary?token=${this.$store.state.ssoToken}`, "legendLibrary")
         }

+ 4 - 3
src/router/index.js

@@ -215,10 +215,11 @@ function redirectGetToken (to) {
     if (previewUrl) {
         sessionStorage.setItem("SETISPREVIEW", previewUrl)
         store.commit('SETISPREVIEW', previewUrl)
-    }else{
-        sessionStorage.setItem("SETISPREVIEW", 'false')
-        store.commit('SETISPREVIEW', 'false')
     }
+    // else{
+    //     sessionStorage.setItem("SETISPREVIEW", 'false')
+    //     store.commit('SETISPREVIEW', 'false')
+    // }
     if (plazaId) {
         localStorage.setItem('PLAZAID', plazaId)
         store.commit('STOREPLAZAID', plazaId)

+ 3 - 2
src/store/index.js

@@ -14,9 +14,9 @@ import router from '../router'
 Vue.use(Vuex)
 export default new Vuex.Store({
     state: {
-        ssoToken: 'admin:liujiandong',
+        // ssoToken: 'admin:liujiandong',
         // ssoToken: '',
-        // ssoToken: null,
+        ssoToken: null,
         plazaName: '',
         isPreview: false,
         lastRoute: '',
@@ -199,6 +199,7 @@ export default new Vuex.Store({
                                 }
                                 router.push({
                                     path: './home/overview',
+                                    query:{plazaId: res.treeData[0].ccode}
                                 })
                             } else {
                                 router.push({

+ 17 - 1
src/views/overview/index.vue

@@ -205,6 +205,9 @@
 import PicModal from './picModal'
 import { queryFact } from '@/api/overview'
 import { mapGetters } from 'vuex'
+import {
+    query
+} from "@/utils/query"
 export default {
     data() {
         return {
@@ -343,9 +346,10 @@ export default {
             // }
         },
         query() {
+            let plazaId = this.$route.query.plazaId ?this.$route.query.plazaId:this.plazaId
             let params = {
                 getParams: {
-                    plazaId: this.$store.state.plazaId || localStorage.getItem('PLAZAID'),
+                    plazaId: plazaId,
                     // plazaId: '1000303'//这个id有3条数据
                 },
             }
@@ -376,6 +380,8 @@ export default {
                     this.shuzihuayijiao = res.shuzihuayijiao ? res.shuzihuayijiao : ''
                     if (res.plazaName) {
                         this.$store.commit('SETPLAZENAME', res.plazaName)
+                    }else{
+                         this.$store.commit('SETPLAZENAME','')
                     }
                 }
             })
@@ -417,6 +423,16 @@ export default {
     components: {
         PicModal,
     },
+    watch: {
+        '$store.state.plazaId': {
+          handler(val,nel){
+           console.log('val',val,nel)
+           this.query()
+          },
+          immediate:true
+        }
+    },
+
 }
 </script>
 <style lang="less" scoped>

+ 4 - 4
src/views/statistics/index.vue

@@ -381,8 +381,8 @@ export default {
                     plazaId: data.ccode
                 }
                 this.$store.commit('SETPLAZENAME', data.cname)
-                localStorage.setItem('PLAZAID', data.ccode)
-                this.$store.commit('STOREPLAZAID', data.ccode)
+                // localStorage.setItem('PLAZAID', data.ccode)
+                // this.$store.commit('STOREPLAZAID', data.ccode)
                 this.$store.commit('SETISGETMAP',true)
             }
         },
@@ -975,8 +975,8 @@ export default {
                             plazaId: data.ccode
                         }
                         this.$store.commit('SETPLAZENAME', data.cname)
-                        localStorage.setItem('PLAZAID', data.ccode)
-                        this.$store.commit('STOREPLAZAID', data.ccode)
+                        // localStorage.setItem('PLAZAID', data.ccode)
+                        // this.$store.commit('STOREPLAZAID', data.ccode)
                         this.$store.commit('SETISGETMAP',true)
                     }
                 })

+ 2 - 2
vue.config.js

@@ -4,8 +4,8 @@ module.exports = {
         port: 8090,
         proxy: {
             '/data': {
-                target: 'http://60.205.177.43',
-                // target: 'http://10.199.143.126',
+                // 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,