qinzhipeng_v@didiglobal.com 4 年 前
コミット
018b727f2e
3 ファイル変更50 行追加30 行削除
  1. 10 10
      src/App.vue
  2. 15 2
      src/components/newLayout/Main.vue
  3. 25 18
      src/views/projectManage/taskList/taskIndex.vue

+ 10 - 10
src/App.vue

@@ -8,7 +8,6 @@
 import { mapGetters } from 'vuex'
 import { getGlobalInterface } from '@/api/data.js'
 import { getUserInfo } from '@/api/user.js'
-import { settingUserGetBiz } from '@/api/projectIndex'
 // omega埋点工具包
 import OmegaTracker from '@didi/omega-tracker/lib/index.esm'
 const config = { appKey: 'omega6b172861f4' }
@@ -34,17 +33,18 @@ export default {
   created() {
     this.initRoutes()
     this.initOmegaTracker()
-    this.settingUserGetBiz()
+    // this.settingUserGetBiz()
   },
   methods: {
-    async settingUserGetBiz() { // 刷新页面
-      if (this.$store.state.global.bizId === -1) {
-        const res = await settingUserGetBiz()
-        if (res.code === 200) {
-          this.$store.state.global.bizId = res.data.bizId
-        }
-      }
-    },
+    // async settingUserGetBiz() { // 刷新页面
+    //   if (this.$store.state.global.bizId === -1) {
+    //     const res = await settingUserGetBiz()
+    //     if (res.code === 200) {
+    //       console.log(res.data)
+    //       this.$store.dispatch('global/setBizId', res.data.bizId)
+    //     }
+    //   }
+    // },
     initOmegaTracker() {
       try {
         window.log = OmegaTracker.getTracker(config)

+ 15 - 2
src/components/newLayout/Main.vue

@@ -8,7 +8,7 @@
       'no-sidebar': !showNavTag
     }"
   >
-    <div class="main-wrapper" @click="listenClick">
+    <div v-if="showpage" class="main-wrapper" @click="listenClick">
       <router-view />
     </div>
   </div>
@@ -21,7 +21,8 @@ import { settingGetBizList, settingUserGetBiz } from '@/api/projectIndex'
 export default {
   data() {
     return {
-      bizIdList: [] // 业务线列表
+      bizIdList: [], // 业务线列表
+      showpage: false
     }
   },
   computed: {
@@ -35,7 +36,19 @@ export default {
       immediate: true
     }
   },
+  created() {
+    this.settingUserGetBiz()
+  },
   methods: {
+    async settingUserGetBiz() { // 刷新页面
+      if (this.$store.state.global.bizId === -1) {
+        const res = await settingUserGetBiz()
+        if (res.code === 200) {
+          this.showpage = true
+          this.$store.dispatch('global/setBizId', res.data.bizId)
+        }
+      }
+    },
     // 获取业务线列表
     async settingGetBizList() {
       const res = await settingGetBizList({})

+ 25 - 18
src/views/projectManage/taskList/taskIndex.vue

@@ -86,7 +86,7 @@
             <el-form :model="form_task" class="flex_start">
               <div class="Layout">
                 <div class="queryName">模块</div>
-                <el-cascader v-model="form_task.moduleIds" size="small" clearable collapse-tags :props="props" :options="business_platform_Modular" placeholder="请选择" style="width:77% !important;" @click.native="bugDataGet" />
+                <el-cascader v-model="form_task.moduleIds" size="small" clearable collapse-tags :props="props" :options="business_platform_Modular" placeholder="请选择" style="width:77% !important;" />
               </div>
               <div class="Layout marginLeft">
                 <div class="queryName">状态</div>
@@ -292,7 +292,12 @@ export default {
       },
       newTabOpen: true, // 是否新的tab页打开
       header_show: true,
-      props: { multiple: true },
+      props: {
+        value: 'id',
+        label: 'moduleName',
+        children: 'childModules',
+        multiple: true
+      },
       isFromDpmList: [{ id: true, name: '是' }, { id: false, name: '否' }],
       priorityColors: ['#F56C6C', '#FF8952', '#F5E300', '#7ED321', '#61D3B8', '#69B3FF', '#BDBDBD'],
       arr_priority: [{ value: 0, name: 'P0' }, { value: 1, name: 'P1' }, { value: 2, name: 'P2' }, { value: 3, name: 'P3' }],
@@ -319,6 +324,7 @@ export default {
       currentPage: 0,
       DetailedScreening: false,
       total: 0,
+      biz: '',
       isToOne: true,
       loading: false,
       table_loading: false,
@@ -342,6 +348,11 @@ export default {
     this.get_taskSelect()
     this.$store.state.data.status = true
   },
+  mounted() {
+    this.$nextTick(() => {
+      this.bugDataGet()
+    })
+  },
   destroyed() {
     this.$store.state.data.status = false
   },
@@ -492,23 +503,19 @@ export default {
       }
     },
     bugDataGet() { // 所属模块
-      settingQueryBizModuleList(this.bizId).then(res => {
-        this.business_platform_Modular = res.data.map(item => ({
-          ...item,
-          value: item.id,
-          label: item.moduleName,
-          children: item.childModules.length === 0 ? null : item.childModules.map(item1 => ({
-            ...item1,
-            value: item1.id,
-            label: item1.moduleName,
-            children: item1.childModules.length === 0 ? null : item1.childModules.map(item2 => ({
-              ...item2,
-              value: item2.id,
-              label: item2.moduleName
-            }))
-          }))
-        }))
+      this.biz = this.bizId
+      if (this.bizId === -1) {
+        this.biz = this.$store.state.global.bizId
+      }
+      settingQueryBizModuleList(this.biz).then(res => {
+        this.business_platform_Modular = this.getRequireData(res.data)
       })
+    },
+    getRequireData(data) {
+      for (let i = 0; i < data.length; i++) {
+        data[i].childModules && data[i].childModules.length < 1 ? delete data[i].childModules : this.getRequireData(data[i].childModules)
+      }
+      return data
     }
   }
 }