Przeglądaj źródła

feat: 新增业务范围显示

zhangyuhan 4 lat temu
rodzic
commit
f77dd7ff07

+ 7 - 0
src/components/selector/BusinessScopeSelector.vue

@@ -41,6 +41,13 @@ export default {
   data () {
     return {}
   },
+  watch: {
+    initList () {
+      this.$nextTick(() => {
+        this.$refs.content.init()
+      })
+    }
+  },
   created () {},
   methods: {
     setState (data) {

+ 12 - 12
src/views/PotentialList.vue

@@ -52,6 +52,7 @@ import BuyerclassSelector from '@/components/selector/BuyerclassSelector.vue'
 import BusinessScopeSelector from '@/components/selector/BusinessScopeSelector.vue'
 import forLayOut from '@/components/forecast/ForLayout.vue'
 import { setFollowEnt, setRemoveEnt, setCancelEnt } from '@/api/modules'
+import { mapState } from 'vuex'
 export default {
   name: 'Potential',
   components: {
@@ -144,13 +145,13 @@ export default {
     },
     changeBusiness (item) {
       let tempArr = []
-      this.getScopeList.forEach(v => {
+      this.scope.forEach(v => {
         if (item.includes(v.key.join(' '))) {
           tempArr.push(v)
         }
       })
       if (item.length === 0) {
-        tempArr = this.getScopeList
+        tempArr = this.scope
       }
       this.filters.business_scope = tempArr
     },
@@ -172,24 +173,23 @@ export default {
     }
   },
   computed: {
+    ...mapState({
+      scope: state => state.user.scope
+    }),
     getTopInfo () {
       return this.topInfo[this.$route.params.type || 'c']
     },
-    getScopeList () {
-      const scopeData = this.$store.state.user.scope
-      if (scopeData[0] && scopeData[0].a_key) {
-        return scopeData[0].a_key
-      }
-      return []
-    },
     getScopeKeyList () {
-      return this.getScopeList.map(v => {
+      return this.scope.map(v => {
         return v.key.join(' ')
       })
     }
   },
-  created () {
-    this.filters.business_scope = this.getScopeList
+  async created () {
+    if (!this.scope.length) {
+      await this.$store.dispatch('user/getKeywordsList')
+    }
+    this.filters.business_scope = this.scope
   }
 }
 </script>