Explorar o código

Merge branch 'Inspection' into online

wolyshaw %!s(int64=4) %!d(string=hai) anos
pai
achega
6362fe15e5

+ 15 - 4
src/views/main/baseinfo/business.vue

@@ -31,11 +31,22 @@ export default {
     },
     chartData() {
       const data = this.data[this.active] || {}
+      const values = Object.values(this.items)
+      const months = {}
+      for (const item of values) {
+        for (const row of (item.indexMonthData || [])) {
+          const key = this.$helpers.dayjs(row.month).month() + 1 + '月'
+          if (!months[key]) {
+            months[key] = {
+              '月份': key,
+            }
+          }
+          months[key][item.title] = row.percent
+        }
+      }
       return {
-        columns: ['月份', data.title],
-        rows: (data.indexMonthData || []).map(item => ({
-          '月份': this.$helpers.dayjs(item.month).month() + 1 + '月', [data.title]: item.percent,
-        }))
+        columns: ['月份', ...values.map(item => item.title)],
+        rows: Object.values(months)
       }
     }
   },

+ 15 - 4
src/views/main/baseinfo/curriculum.vue

@@ -30,11 +30,22 @@ export default {
     },
     chartData() {
       const data = this.data[this.active] || {}
+      const values = Object.values(this.items)
+      const months = {}
+      for (const item of values) {
+        for (const row of (item.indexMonthData || [])) {
+          const key = this.$helpers.dayjs(row.month).month() + 1 + '月'
+          if (!months[key]) {
+            months[key] = {
+              '月份': key,
+            }
+          }
+          months[key][item.title] = row.percent
+        }
+      }
       return {
-        columns: ['月份', data.title],
-        rows: (data.indexMonthData || []).map(item => ({
-          '月份': this.$helpers.dayjs(item.month).month() + 1 + '月', [data.title]: item.percent,
-        }))
+        columns: ['月份', ...values.map(item => item.title)],
+        rows: Object.values(months)
       }
     }
   },

+ 15 - 4
src/views/main/baseinfo/hr.vue

@@ -31,11 +31,22 @@ export default {
     },
     chartData() {
       const data = this.data[this.active] || {}
+      const values = Object.values(this.items)
+      const months = {}
+      for (const item of values) {
+        for (const row of (item.indexMonthData || [])) {
+          const key = this.$helpers.dayjs(row.month).month() + 1 + '月'
+          if (!months[key]) {
+            months[key] = {
+              '月份': key,
+            }
+          }
+          months[key][item.title] = row.percent
+        }
+      }
       return {
-        columns: ['月份', data.title],
-        rows: (data.indexMonthData || []).map(item => ({
-          '月份': this.$helpers.dayjs(item.month).month() + 1 + '月', [data.title]: item.percent,
-        }))
+        columns: ['月份', ...values.map(item => item.title)],
+        rows: Object.values(months)
       }
     }
   },

+ 12 - 1
src/views/main/baseinfo/index.vue

@@ -5,6 +5,11 @@
         <el-date-picker
           v-model="search.year"
           type="year"
+          :picker-options="{
+            disabledDate(time) {
+              return time.getTime() > Date.now()
+            }
+          }"
           placeholder="请选择年份">
         </el-date-picker>
       </el-form-item>
@@ -25,7 +30,8 @@
       <el-button native-type="submit" type="primary">搜索</el-button>
       <el-button native-type="reset" type="danger">重置</el-button>
     </save-form>
-    <el-row class="rows" :gutter="20">
+    <empty desc="暂无统计数据" v-if="isEmpty"/>
+    <el-row v-else class="rows" :gutter="20">
       <el-col :xs="24" :sm="24" :md="12" :span="7">
         <operate :data="dataInfo"/>
       </el-col>
@@ -75,6 +81,11 @@ export default {
       business: {},
     }
   },
+  computed: {
+    isEmpty() {
+      return !Object.keys(this.dataInfo).length
+    }
+  },
   mounted () {
     this.FetchDetail();
     this.$store.dispatch('setBranchs')

+ 15 - 4
src/views/main/baseinfo/management.vue

@@ -32,11 +32,22 @@ export default {
     },
     chartData() {
       const data = this.data[this.active] || {}
+      const values = Object.values(this.items)
+      const months = {}
+      for (const item of values) {
+        for (const row of (item.indexMonthData || [])) {
+          const key = this.$helpers.dayjs(row.month).month() + 1 + '月'
+          if (!months[key]) {
+            months[key] = {
+              '月份': key,
+            }
+          }
+          months[key][item.title] = row.percent
+        }
+      }
       return {
-        columns: ['月份', data.title],
-        rows: (data.indexMonthData || []).map(item => ({
-          '月份': this.$helpers.dayjs(item.month).month() + 1 + '月', [data.title]: item.percent,
-        }))
+        columns: ['月份', ...values.map(item => item.title)],
+        rows: Object.values(months)
       }
     }
   },

+ 15 - 4
src/views/main/baseinfo/operate.vue

@@ -31,11 +31,22 @@ export default {
     },
     chartData() {
       const data = this.data[this.active] || {}
+      const values = Object.values(this.items)
+      const months = {}
+      for (const item of values) {
+        for (const row of (item.indexMonthData || [])) {
+          const key = this.$helpers.dayjs(row.month).month() + 1 + '月'
+          if (!months[key]) {
+            months[key] = {
+              '月份': key,
+            }
+          }
+          months[key][item.title] = row.percent
+        }
+      }
       return {
-        columns: ['月份', data.title],
-        rows: (data.indexMonthData || []).map(item => ({
-          '月份': this.$helpers.dayjs(item.month).month() + 1 + '月', [data.title]: item.percent,
-        }))
+        columns: ['月份', ...values.map(item => item.title)],
+        rows: Object.values(months)
       }
     }
   },

+ 15 - 4
src/views/main/baseinfo/student.vue

@@ -30,11 +30,22 @@ export default {
     },
     chartData() {
       const data = this.data[this.active] || {}
+      const values = Object.values(this.items)
+      const months = {}
+      for (const item of values) {
+        for (const row of (item.indexMonthData || [])) {
+          const key = this.$helpers.dayjs(row.month).month() + 1 + '月'
+          if (!months[key]) {
+            months[key] = {
+              '月份': key,
+            }
+          }
+          months[key][item.title] = row.percent
+        }
+      }
       return {
-        columns: ['月份', data.title],
-        rows: (data.indexMonthData || []).map(item => ({
-          '月份': this.$helpers.dayjs(item.month).month() + 1 + '月', [data.title]: item.percent,
-        }))
+        columns: ['月份', ...values.map(item => item.title)],
+        rows: Object.values(months)
       }
     }
   },