Pārlūkot izejas kodu

增加呼叫状态订阅。

zhengqiang 3 gadi atpakaļ
vecāks
revīzija
7c80eb97bb

+ 2 - 2
.env.development

@@ -1,9 +1,9 @@
 OUT_PUT_DIR=dist/jp-housekeeper-portal
 
 #VUE_APP_BACKEND_URL=http://127.0.0.1:7070/xpgj
-#VUE_APP_BACKEND_URL=http://127.0.0.1:8086/jp-housekeeper-server
+VUE_APP_BACKEND_URL=http://127.0.0.1:8086/jp-housekeeper-server
 #VUE_APP_BACKEND_URL=http://ykt-test.xiaoxinda.com/jp-housekeeper-server
-VUE_APP_BACKEND_URL=http://xpgjapi.xiaoxinda.com
+#VUE_APP_BACKEND_URL=http://xpgjapi.xiaoxinda.com
 #VUE_APP_BACKEND_URL=http://mirror.xiaoxinda.com/xpgjapi/
 
 #手机企业版

+ 12 - 18
src/store/modules/tagsView.js

@@ -1,31 +1,27 @@
 const state = {
   visitedViews: [],
-  cachedViews: [],
-  menuDict: {}
+  cachedViews: []
 }
 
 const mutations = {
-  SELECT_MENU: (state,menu)=> {
-    state.menuDict[menu.url] = menu.title;
-  },
   ADD_VISITED_VIEW: (state, view) => {
     console.log("ADD_VISITED_VIEW");
     console.log(view.path);
-    console.log(state.menuDict[view.path] );
 
-    if (state.visitedViews.some(v => v.path === view.path)) return
+    if (state.visitedViews.some(v => v.fullPath === view.fullPath)) return
 
-    // var newView =  Object.assign({}, view, {
-    //   title: state.menuDict[view.path] || view.meta.title || 'no-name'
-    // });
+    var newView =  Object.assign({}, view, {
+      title: view.meta.title || 'no-name'
+    });
 
-    // console.log(newView);
+    console.log(newView);
 
     state.visitedViews.push({
       path : view.path,
-      title: state.menuDict[view.path] || view.meta.title || 'no-name',
+      title: view.query.title || view.meta.title || 'no-name',
       meta: view.meta,
       name: view.name,
+      query: view.query,
       fullPath: view.fullPath
     })
     // state.visitedViews.push({
@@ -43,7 +39,7 @@ const mutations = {
 
   DEL_VISITED_VIEW: (state, view) => {
     for (const [i, v] of state.visitedViews.entries()) {
-      if (v.path === view.path) {
+      if (v.fullPath === view.fullPath) {
         state.visitedViews.splice(i, 1)
         break
       }
@@ -56,7 +52,7 @@ const mutations = {
 
   DEL_OTHERS_VISITED_VIEWS: (state, view) => {
     state.visitedViews = state.visitedViews.filter(v => {
-      return v.meta.affix || v.path === view.path
+      return v.meta.affix || v.fullPath === view.fullPath
     })
   },
   DEL_OTHERS_CACHED_VIEWS: (state, view) => {
@@ -80,7 +76,7 @@ const mutations = {
 
   UPDATE_VISITED_VIEW: (state, view) => {
     for (let v of state.visitedViews) {
-      if (v.path === view.path) {
+      if (v.fullPath === view.fullPath) {
         v = Object.assign(v, view)
         break
       }
@@ -89,9 +85,6 @@ const mutations = {
 }
 
 const actions = {
-  selectMenu({commit},menu) {
-    commit('SELECT_MENU', menu)
-  },
   addView({ dispatch }, view) {
     console.log("addView");
 
@@ -104,6 +97,7 @@ const actions = {
   addCachedView({ commit }, view) {
     commit('ADD_CACHED_VIEW', view)
   },
+
   delView({ dispatch, state }, view) {
     return new Promise(resolve => {
       dispatch('delVisitedView', view)

+ 9 - 0
src/views/base/deviceInfo-detail.vue

@@ -147,6 +147,15 @@
           </el-col>
         </el-row>
         <el-row>
+          <el-col :span="12">
+            <el-form-item label="呼叫状态订阅" prop="subscribe">
+              <el-switch 
+                v-model="formModel.subscribe"
+                active-color="#13ce66"
+                inactive-color="#ff4949"
+              ></el-switch>
+            </el-form-item>
+          </el-col>
         </el-row>
           <!-- <el-col :span="12">
             <el-form-item label="场景值" prop="type">

+ 1 - 1
src/views/layout/AppMain.vue

@@ -16,7 +16,7 @@ export default {
       return this.$store.state.tagsView.cachedViews
     },
     key() {
-      return this.$route.path
+      return this.$route.fullPath
     }
   }
 }

+ 18 - 18
src/views/layout/TagsView/index.vue

@@ -4,7 +4,7 @@
       <router-link
         v-for="tag in visitedViews"
         ref="tag"
-        :key="tag.path"
+        :key="tag.fullPath"
         :class="isActive(tag)?'active':''"
         :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
         tag="span"
@@ -67,7 +67,7 @@ export default {
   },
   methods: {
     isActive(route) {
-      return route.path === this.$route.path
+      return route.fullPath === this.$route.fullPath
     },
     isAffix(tag) {
       return tag.meta && tag.meta.affix
@@ -82,7 +82,7 @@ export default {
             path: tagPath,
             name: route.name,
             meta: { ...route.meta }
-          }) 
+          })
         }
         if (route.children) {
           const tempTags = this.filterAffixTags(route.children, route.path)
@@ -103,10 +103,10 @@ export default {
       }
     },
     addTags() {
-      const { name,meta } = this.$route
+      console.log("addTags");
+      console.log(this.$route);
 
-      console.log("addTags:" + name + "," + meta.title);
-      
+      const { name } = this.$route
       if (name) {
         this.$store.dispatch('tagsView/addView', this.$route)
       }
@@ -114,18 +114,18 @@ export default {
     },
     moveToCurrentTag() {
       const tags = this.$refs.tag
-      this.$nextTick(() => {
-        for (const tag of tags) {
-          if (tag.to.path === this.$route.path) {
-            this.$refs.scrollPane.moveToTarget(tag)
-            // when query is different then update
-            if (tag.to.fullPath !== this.$route.fullPath) {
-              this.$store.dispatch('tagsView/updateVisitedView', this.$route)
-            }
-            break
-          }
-        }
-      })
+      // this.$nextTick(() => {
+      //   for (const tag of tags) {
+      //     if (tag.to.path === this.$route.path) {
+      //       this.$refs.scrollPane.moveToTarget(tag)
+      //       // when query is different then update
+      //       if (tag.to.fullPath !== this.$route.fullPath) {
+      //         this.$store.dispatch('tagsView/updateVisitedView', this.$route)
+      //       }
+      //       break
+      //     }
+      //   }
+      // })
     },
     refreshSelectedTag(view) {
       this.$store.dispatch('tagsView/delCachedView', view).then(() => {