Переглянути джерело

管理驾驶舱选择部门

yuhan 1 рік тому
батько
коміт
1cb14af76f
1 змінених файлів з 35 додано та 35 видалено
  1. 35 35
      src/views/module_kzks/dashboard/Analysis.vue

+ 35 - 35
src/views/module_kzks/dashboard/Analysis.vue

@@ -32,7 +32,7 @@
       </a-row>
 
       <!-- 第二级模块:折/柱形图 -->
-      <a-card :loading="loading" :bordered="false" :body-style="{padding: '0'}">
+      <a-card :loading="loading" :bordered="false" :body-style="{padding: '0'}" v-if="twoYAxisData">
         <div class="salesCard">
           <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
             <div class="extra-wrapper" slot="tabBarExtraContent">
@@ -188,7 +188,7 @@
 
       <!-- 选择部门 -->
       <div v-if="pageRoleNum === 0" class="choose-dept-container">
-        <j-select-depart v-model="selecteddeparts" :multi="true" @back="backDepartInfo" :backDepart="true" :treeOpera="true">></j-select-depart>
+        <j-select-depart v-model="selecteddeparts" :multi="true" @back="backDepartInfo" :backDepart="true" :treeOpera="true" @change="okChange"></j-select-depart>
       </div>
     </template>
     
@@ -301,6 +301,7 @@
           time: '',
           beginDate: null,
           endDate: null,
+          departNameList: []
         },
 
         // 选择指标
@@ -384,8 +385,8 @@
           zrbmCharts: [],
         },
 
-        selecteddeparts: [],
-        deptParams: []
+        // 所长选择部门查看:多选
+        selecteddeparts: [], // 用来组件选择的 
       }
     },
     computed: {
@@ -423,7 +424,7 @@
     created() {
       this.initLogInfo();
       this.getZhibiaoCollect()
-      this.setNowDate()
+      // this.setNowDate()
       // 部门指标排行
       // this.deptZhibiaoPaihang()
       this.searchZbphChange('month')
@@ -438,7 +439,7 @@
       },
       getZhibiaoCollect(){
         this.loading = true
-        getZhibiaoCollect(this.deptParams).then(res => {
+        getZhibiaoCollect(this.searchParams.departNameList).then(res => {
           console.log(res)
           if (res.success) {
             // 0:所领导,1:部门领导,2:员工;3:未赋值或选了多个前面所说角色
@@ -451,9 +452,12 @@
             for (let i = 0; i < this.zhibiaoTotal.length; i++) {
               const element = this.zhibiaoTotal[i];
               // element.data = res.result[element.hdValue]
-              arr[i] = {...element, ...res.result.data[element.hdValue]}
+              // arr[i] = {...element, ...res.result.data[element.hdValue]}
+              arr[i] = Object.assign({}, element, res.result.data[element.hdValue])
+              console.log(arr[i])
             }
             this.zhibiaoTotal = arr
+            this.setNowDate()
             this.loading = false
           }else{
             this.$message.warning(res.message)
@@ -474,19 +478,13 @@
         var sType = this.searchType ? this.searchType : type
         
         if(sType === 'month'){
-          this.searchParams = {
-            time: 'month',
-            beginDate: beginDate,
-            endDate: endDate,
-            departNameList: this.deptParams
-          }
+          this.searchParams.time = 'month'
+          this.searchParams.beginDate = beginDate
+          this.searchParams.endDate = endDate
         } else if (sType === 'year') {
-          this.searchParams = {
-            time: 'year',
-            beginDate: year,
-            endDate: year,
-            departNameList: this.deptParams
-          }
+          this.searchParams.time = 'year'
+          this.searchParams.beginDate = year
+          this.searchParams.endDate = year
         }
         this.getDataByDate()
       },
@@ -603,20 +601,14 @@
         // console.log(moment(value[0]).format('YYYY-MM'))
         this.dateValue = value;
         if(this.searchMode[0] === 'month'){
-          this.searchParams = {
-            time: 'month',
-            beginDate: moment(value[0]).format('YYYY-MM'),
-            endDate: moment(value[1]).format('YYYY-MM'),
-            departNameList: this.deptParams
-          }
+          this.searchParams.time = 'month'
+          this.searchParams.beginDate = moment(value[0]).format('YYYY-MM')
+          this.searchParams.endDate = moment(value[1]).format('YYYY-MM')
         }
         if(this.searchMode[0] === 'year'){
-          this.searchParams = {
-            time: 'year',
-            beginDate: moment(value[0]).format('YYYY'),
-            endDate: moment(value[1]).format('YYYY'),
-            departNameList: this.deptParams
-          }
+          this.searchParams.time = 'year'
+          this.searchParams.beginDate = moment(value[0]).format('YYYY')
+          this.searchParams.endDate = moment(value[1]).format('YYYY')
         }
         // this.modeMonth = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
       },
@@ -695,13 +687,21 @@
         this.zbphYearIsopen = true;
       },
 
+      // 选择部门
       backDepartInfo(info) {
-        console.log(info)
-        this.deptParams = info.map(item => item.text)
-        console.log(this.deptParams)
+        // console.log(info)
+        this.searchParams.departNameList = info.map(item => item.text)
         this.getZhibiaoCollect()
-        this.handlePanelChange()
+        this.getDataByDate()
       },
+      okChange(e){
+        // console.log(e, !e)
+        if(!e){
+          this.searchParams.departNameList = []
+          this.getZhibiaoCollect()
+          this.getDataByDate()
+        }
+      }
     }
   }
 </script>