Selaa lähdekoodia

首页数据优化

1
mo 2 vuotta sitten
vanhempi
commit
81a366d386

+ 244 - 243
src/views/main/baseinfo/business.vue

@@ -1,243 +1,244 @@
-<template
->
-  <el-card header="">
-    <div slot="header" class="clearfix">
-      <searchHeader
-        v-if="mdate.length > 0"
-        :dates="mdate"
-        :title="'业务数据'"
-        :isShowQuert="false"
-        @changeValue="changeValue"
-      />
-    </div>
-
-    <div class="wall" style="height:68px;" v-if="JSON.stringify(items) == '{}'"></div>
-    <statistic class="statistic" :cols="0">
-      <statistic-item
-        v-for="(item, key) in items"
-        :key="key"
-        :class="{ active: active === key }"
-        @click="active = key"
-      >
-        <span>
-          {{ item.title+'(%)'}}
-          <el-tooltip
-            v-if="item.desc"
-            :content="item.desc"
-            :open-delay="0.3"
-            placement="top"
-          >
-            <i
-              style="margin-left: 5px; cursor: pointer"
-              class="el-icon-warning-outline"
-            />
-          </el-tooltip>
-        </span>
-        <span> <count-to :endVal="item.percent" :decimals="2" /></span>
-      </statistic-item>
-    </statistic>
-    <!--   :data-zoom="dataZoom" -->
-    <ve-line
-      style="width: 100%"
-      height="350px"
-      :data="chartData"
-      :data-empty="dataEmpty"
-      :extend="chartExtend"
-      :legend="legend"
-    ></ve-line>
-  </el-card>
-</template>
-<script>
-import "v-charts/lib/style.css";
-import "echarts/lib/component/dataZoom";
-import countTo from "vue-count-to";
-import veLine from "v-charts/lib/line.common";
-import searchHeader from "./modals/searchHeader";
-import { getTimes } from "@/utils";
-import { getIndex } from "../api";
-import { descs, chioseNum } from "../constant";
-import { getNowDateAndSunday, getNowDateAndMonday } from "@/utils/date";
-export default {
-  props: ["data", "search"],
-  components: {
-    "count-to": countTo,
-    "ve-line": veLine,
-    searchHeader,
-  },
-  computed: {
-    legend() {
-      return {
-        left: "10px",
-      };
-    },
-    items() {
-      let obj = {}
-      let arr = ["HOMEWORK_CREATE_RATE","HOMEWORK_SUBMIT_RATE","HOMEWORK_COMMENT_RATE"]
-      arr.forEach(str=>{
-        if(this.data[str]){
-          obj[str]=this.data[str]
-        }
-      })
-      /**
-       *  {
-        HOMEWORK_CREATE_RATE:this.data["HOMEWORK_CREATE_RATE"] || {},
-        HOMEWORK_SUBMIT_RATE: this.data["HOMEWORK_SUBMIT_RATE"] || {},
-        HOMEWORK_COMMENT_RATE: this.data["HOMEWORK_COMMENT_RATE"] || {},
-      };
-       */
-      return obj
-    },
-    chartExtend() {
-      return {
-        series: {
-           type: 'line',
-          smooth: false,
-        },
-        yAxis: {
-          //纵轴标尺固定
-          minInterval: 1,
-          type: "value",
-          scale: true,
-          min: 0,
-          max: 100,
-          axisLabel: {
-            formatter: "{value}%",
-          },
-        },
-        tooltip: {
-          axisPointer: {
-            type: "shadow",
-            shadowStyle: {
-              color: "rgba(150,150,150,0.2)",
-            },
-          },
-
-          formatter: (item) => {
-            return [
-              item[0].axisValueLabel,
-              ...item.map(
-                (d) => `<br/>${d.marker}${d.seriesName}: ${d.value[1]} %`
-              ),
-            ].join("");
-          },
-        },
-      };
-    },
-    dataZoom() {
-      return [
-        {
-          grid: {
-            left: "0%",
-          },
-          type: "slider",
-          start: 40,
-          end: 100,
-        },
-      ];
-    },
-    chartData() {
-      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).format("YYYY-MM-DD");
-          if (!months[key]) {
-            months[key] = {
-              日期: key + "/" + getNowDateAndSunday(key),
-            };
-          }
-          months[key][item.title] = row.percent;
-        }
-      }
-
-      return {
-        columns: [
-          "日期",
-          ...values.map((item) => {
-            return item.title;
-          }),
-        ],
-        rows: Object.values(months),
-      };
-    },
-    dataEmpty() {
-      return !this.chartData.rows.length;
-    },
-  },
-  data() {
-    return {
-      active: "ACTIVATION_RATE",
-      mdate: [],
-      loading: false,
-    };
-  },
-  mounted() {
-    this.init()
-  },
-  methods: {
-    init() {
-      let nowTiem = this.$helpers.dayjs(new Date()).format("YYYY-MM-DD");
-      let startTime = this.$helpers
-        .dayjs(getNowDateAndMonday(nowTiem))
-        .subtract(49, "day")
-        .format("YYYY-MM-DD");
-      let endTime = getNowDateAndSunday(nowTiem);
-      this.mdate = [startTime, endTime];
-      this.FetchDetail();
-    },
-    changeValue(date) {
-      // 请求更改数据
-      this.mdate = date;
-      //  this.isDayOrMoth(date)
-      this.FetchDetail();
-    },
-    async FetchDetail() {
-      this.loading = true;
-      let data = [];
-      try {
-        const { dates, ...rest } = this.search;
-        const res = await getIndex({
-          ...rest,
-          ...getTimes(this.mdate, ["startDate", "endDate"]),
-          dataTypes:
-            "HOMEWORK_CREATE_RATE,HOMEWORK_SUBMIT_RATE,HOMEWORK_COMMENT_RATE",
-        });
-        for (const item of res.data) {
-          // 再循环一遍
-          for (const key in this.items) {
-            if (item.dataType == key) {
-              data[item.dataType] = {
-                ...item,
-                desc: descs[item.dataType],
-              };
-            }
-          }
-        }
-      } catch (error) {
-        console.log(error);
-      }
-      this.loading = false;
-      // this.dataInfo = data;
-      this.$emit("resetDate", data);
-    },
-  },
-};
-</script>
-<style lang="less" scoped>
-// .statistic{
-//   ::v-deep  .statistic-content{
-//     cursor: pointer;
-//     &.active > span{
-//       color: var(--color-primary) !important;
-//     }
-//   }
-// }
-.chioseBox {
-  position: absolute;
-  right: 20px;
-  z-index: 1000;
-}
-.wrap {
-  position: relative;
-}
-</style>
+<template
+>
+  <el-card header="">
+    <div slot="header" class="clearfix">
+      <searchHeader
+        v-if="mdate.length > 0"
+        :dates="mdate"
+        :title="'业务数据'"
+        :isShowQuert="false"
+        @changeValue="changeValue"
+      />
+    </div>
+
+    <div class="wall" style="height:68px;" v-if="JSON.stringify(items) == '{}'"></div>
+    <statistic class="statistic" :cols="0">
+      <statistic-item
+        v-for="(item, key) in items"
+        :key="key"
+        :class="{ active: active === key }"
+        @click="active = key"
+      >
+        <span>
+          {{ item.title+'(%)'}}
+          <el-tooltip
+            v-if="item.desc"
+            :content="item.desc"
+            :open-delay="0.3"
+            placement="top"
+          >
+            <i
+              style="margin-left: 5px; cursor: pointer"
+              class="el-icon-warning-outline"
+            />
+          </el-tooltip>
+        </span>
+        <span> <count-to :endVal="item.percent" :decimals="2" /></span>
+      </statistic-item>
+    </statistic>
+    <!--   :data-zoom="dataZoom" -->
+    <ve-line
+      style="width: 100%"
+      height="350px"
+      :data="chartData"
+      :data-empty="dataEmpty"
+      :extend="chartExtend"
+      :legend="legend"
+    ></ve-line>
+  </el-card>
+</template>
+<script>
+import "v-charts/lib/style.css";
+import "echarts/lib/component/dataZoom";
+import countTo from "vue-count-to";
+import veLine from "v-charts/lib/line.common";
+import searchHeader from "./modals/searchHeader";
+import { getTimes } from "@/utils";
+import { getIndex } from "../api";
+import { descs, chioseNum } from "../constant";
+import { getNowDateAndSunday, getNowDateAndMonday } from "@/utils/date";
+export default {
+  props: ["data", "search"],
+  components: {
+    "count-to": countTo,
+    "ve-line": veLine,
+    searchHeader,
+  },
+  computed: {
+    legend() {
+      return {
+        left: "10px",
+      };
+    },
+    items() {
+      let obj = {}
+      let arr = ["HOMEWORK_CREATE_RATE","HOMEWORK_SUBMIT_RATE","HOMEWORK_COMMENT_RATE"]
+      arr.forEach(str=>{
+        if(this.data[str]){
+          obj[str]=this.data[str]
+        }else {
+          obj[str] = {}
+        }
+      })
+      /**
+       *  {
+        HOMEWORK_CREATE_RATE:this.data["HOMEWORK_CREATE_RATE"] || {},
+        HOMEWORK_SUBMIT_RATE: this.data["HOMEWORK_SUBMIT_RATE"] || {},
+        HOMEWORK_COMMENT_RATE: this.data["HOMEWORK_COMMENT_RATE"] || {},
+      };
+       */
+      return obj
+    },
+    chartExtend() {
+      return {
+        series: {
+           type: 'line',
+          smooth: false,
+        },
+        yAxis: {
+          //纵轴标尺固定
+          minInterval: 1,
+          type: "value",
+          scale: true,
+          min: 0,
+          max: 100,
+          axisLabel: {
+            formatter: "{value}%",
+          },
+        },
+        tooltip: {
+          axisPointer: {
+            type: "shadow",
+            shadowStyle: {
+              color: "rgba(150,150,150,0.2)",
+            },
+          },
+
+          formatter: (item) => {
+            return [
+              item[0].axisValueLabel,
+              ...item.map(
+                (d) => `<br/>${d.marker}${d.seriesName}: ${d.value[1]} %`
+              ),
+            ].join("");
+          },
+        },
+      };
+    },
+    dataZoom() {
+      return [
+        {
+          grid: {
+            left: "0%",
+          },
+          type: "slider",
+          start: 40,
+          end: 100,
+        },
+      ];
+    },
+    chartData() {
+      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).format("YYYY-MM-DD");
+          if (!months[key]) {
+            months[key] = {
+              日期: key + "/" + getNowDateAndSunday(key),
+            };
+          }
+          months[key][item.title] = row.percent;
+        }
+      }
+
+      return {
+        columns: [
+          "日期",
+          ...values.map((item) => {
+            return item.title;
+          }),
+        ],
+        rows: Object.values(months),
+      };
+    },
+    dataEmpty() {
+      return !this.chartData.rows.length;
+    },
+  },
+  data() {
+    return {
+      active: "ACTIVATION_RATE",
+      mdate: [],
+      loading: false,
+    };
+  },
+  mounted() {
+  },
+  methods: {
+    init() {
+      let nowTiem = this.$helpers.dayjs(new Date()).format("YYYY-MM-DD");
+      let startTime = this.$helpers
+        .dayjs(getNowDateAndMonday(nowTiem))
+        .subtract(49, "day")
+        .format("YYYY-MM-DD");
+      let endTime = getNowDateAndSunday(nowTiem);
+      this.mdate = [startTime, endTime];
+      this.FetchDetail();
+    },
+    changeValue(date) {
+      // 请求更改数据
+      this.mdate = date;
+      //  this.isDayOrMoth(date)
+      this.FetchDetail();
+    },
+    async FetchDetail() {
+      this.loading = true;
+      let data = [];
+      try {
+        const { dates, ...rest } = this.search;
+        const res = await getIndex({
+          ...rest,
+          ...getTimes(this.mdate, ["startDate", "endDate"]),
+          dataTypes:
+            "HOMEWORK_CREATE_RATE,HOMEWORK_SUBMIT_RATE,HOMEWORK_COMMENT_RATE",
+        });
+        for (const item of res.data) {
+          // 再循环一遍
+          for (const key in this.items) {
+            if (item.dataType == key) {
+              data[item.dataType] = {
+                ...item,
+                desc: descs[item.dataType],
+              };
+            }
+          }
+        }
+      } catch (error) {
+        console.log(error);
+      }
+      this.loading = false;
+      // this.dataInfo = data;
+      this.$emit("resetDate", data);
+    },
+  },
+};
+</script>
+<style lang="less" scoped>
+// .statistic{
+//   ::v-deep  .statistic-content{
+//     cursor: pointer;
+//     &.active > span{
+//       color: var(--color-primary) !important;
+//     }
+//   }
+// }
+.chioseBox {
+  position: absolute;
+  right: 20px;
+  z-index: 1000;
+}
+.wrap {
+  position: relative;
+}
+</style>

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

@@ -245,8 +245,12 @@ export default {
   },
   mounted(){
      this.$refs.searchHeader.initStatue('month');
+
   },
   methods: {
+    init(){
+      this.FetchDetail()
+    },
     changeValue(date) {
       // 请求更改数据
       this.mdate = date;
@@ -267,14 +271,14 @@ export default {
         });
         for (const item of res.data) {
           // 再循环一遍
-          for (const key in this.items) {
-            if (item.dataType == key) {
+          // for (const key in this.items) {
+          //   if (item.dataType == key) {
               data[item.dataType] = {
                 ...item,
                 desc: descs[item.dataType],
               };
-            }
-          }
+          //   }
+          // }
         }
       } catch (error) {
         console.log(error);

+ 116 - 62
src/views/main/baseinfo/hr.vue

@@ -1,26 +1,37 @@
 <template>
-  <el-card >
-      <div slot="header" class="clearfix">
-        <div class="box">
-          <span class='shape'></span>
-          <span>人事数据</span>
-        </div>
-
+  <el-card>
+    <div slot="header" class="clearfix">
+      <div class="box">
+        <span class="shape"></span>
+        <span>人事数据</span>
       </div>
-       <div class="wall" style="height:68px;" v-if="JSON.stringify(items) == '{}'">
-         暂无数据
-       </div>
+    </div>
+    <div class="wall" style="height: 68px" v-if="JSON.stringify(items) == '{}'">
+      暂无数据
+    </div>
     <statistic class="statistic" :cols="0">
-
-      <statistic-item v-for="(item, key) in items" :key="key" :class="{active: active === key}" @click="active = key">
+      <statistic-item
+        v-for="(item, key) in items"
+        :key="key"
+        :class="{ active: active === key }"
+        @click="active = key"
+      >
         <span>
-          {{item.title+"(人)"}}
-          <el-tooltip v-if="item.desc" :content="item.desc" :open-delay=".3" placement="top">
-            <i style="margin-left: 5px;cursor: pointer;" class="el-icon-warning-outline"/>
+          {{ item.title + "(人)" }}
+          <el-tooltip
+            v-if="item.desc"
+            :content="item.desc"
+            :open-delay="0.3"
+            placement="top"
+          >
+            <i
+              style="margin-left: 5px; cursor: pointer"
+              class="el-icon-warning-outline"
+            />
           </el-tooltip>
         </span>
         <span>
-          <count-to :endVal="item.percent"/>
+          <count-to :endVal="item.percent" />
         </span>
       </statistic-item>
     </statistic>
@@ -35,25 +46,28 @@
   </el-card>
 </template>
 <script>
-import 'echarts/lib/component/dataZoom'
-import countTo from 'vue-count-to'
-import veHistogram from 'v-charts/lib/histogram.common'
+import "echarts/lib/component/dataZoom";
+import countTo from "vue-count-to";
+import veHistogram from "v-charts/lib/histogram.common";
+import { getIndex } from "../api";
+import { getTimes } from "@/utils";
+import { descs, chioseNum } from "../constant";
 export default {
-  props: ['data'],
+  props: ["data", "search"],
   components: {
-    've-histogram': veHistogram,
-    'count-to': countTo
+    "ve-histogram": veHistogram,
+    "count-to": countTo,
   },
   //     DIMISSION_NUM: this.data['DIMISSION_NUM'] || {},
   computed: {
     items() {
-           let obj = {}
-      let arr = ["TEACHER_NUM","FULL_TIME_NUM","PART_TIME_NUM"]
-      arr.forEach(str=>{
-        if(this.data[str]){
-          obj[str]=this.data[str]
+      let obj = {};
+      let arr = ["TEACHER_NUM", "FULL_TIME_NUM", "PART_TIME_NUM"];
+      arr.forEach((str) => {
+        if (this.data[str]) {
+          obj[str] = this.data[str];
         }
-      })
+      });
       /**
        * {
         TEACHER_NUM: this.data['TEACHER_NUM'] || {},
@@ -62,66 +76,106 @@ export default {
 
       }
        */
-      return obj
+      return obj;
     },
     chartExtend() {
       return {
         tooltip: {
           axisPointer: {
-            type: 'shadow',
+            type: "shadow",
             shadowStyle: {
-              color: 'rgba(150,150,150,0.2)'
-            }
-          }
-        }
-      }
+              color: "rgba(150,150,150,0.2)",
+            },
+          },
+        },
+      };
     },
     dataZoom() {
       return [
         {
-          type: 'slider',
+          type: "slider",
           start: 60,
-          end: 100
-        }
-      ]
+          end: 100,
+        },
+      ];
     },
     chartData() {
-      const values = Object.values(this.items)
-      const months = {}
+      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).format('YYYY-MM-DD')
+        for (const row of item.indexMonthData || []) {
+          const key = this.$helpers.dayjs(row.month).format("YYYY-MM-DD");
           if (!months[key]) {
             months[key] = {
-              '日期': key,
-            }
+              日期: key,
+            };
           }
-          months[key][item.title] = row.percent
+          months[key][item.title] = row.percent;
         }
       }
       return {
-        columns: ['日期', ...values.map(item => item.title)],
-        rows: Object.values(months)
-      }
+        columns: ["日期", ...values.map((item) => item.title)],
+        rows: Object.values(months),
+      };
     },
     dataEmpty() {
-      return !this.chartData.rows.length
+      return !this.chartData.rows.length;
     },
   },
-  data () {
+  data() {
     return {
-      active: 'TEACHER_NUM',
-    }
+      active: "TEACHER_NUM",
+    };
+  },
+  mounted() {
+  },
+  methods: {
+    init() {
+      this.FetchDetail();
+    },
+    async FetchDetail() {
+      this.loading = true;
+      let data = [];
+      try {
+        const { dates, ...rest } = this.search;
+        const res = await getIndex({
+          ...rest,
+          ...getTimes(dates, ["startDate", "endDate"]),
+          dataTypes: "TEACHER_NUM,FULL_TIME_NUM,PART_TIME_NUM",
+        });
+        for (const item of res.data) {
+          // 再循环一遍
+          // for (const key in this.items) {
+          //   if (item.dataType == key) {
+          //     data[item.dataType] = {
+          //       ...item,
+          //       desc: descs[item.dataType],
+          //     };
+          //   }
+          // }
+          data[item.dataType] = {
+            ...item,
+            desc: descs[item.dataType],
+          };
+        }
+      } catch (error) {
+        console.log(error);
+      }
+      this.loading = false;
+      console.log(data);
+      // this.dataInfo = data;
+      this.$emit("resetDate", data);
+    },
   },
-}
+};
 </script>
 <style lang="less" scoped>
-  // .statistic{
-  //   ::v-deep  .statistic-content{
-  //     cursor: pointer;
-  //     &.active > span{
-  //       color: var(--color-primary) !important;
-  //     }
-  //   }
-  // }
+// .statistic{
+//   ::v-deep  .statistic-content{
+//     cursor: pointer;
+//     &.active > span{
+//       color: var(--color-primary) !important;
+//     }
+//   }
+// }
 </style>

+ 38 - 21
src/views/main/baseinfo/index.vue

@@ -41,16 +41,16 @@
       每日0点更新前一日数据
     </el-alert> -->
     <!-- 这里显示选项卡 -->
-    <empty desc="暂无统计数据" v-if="isEmpty" />
-    <el-row v-else class="rows" :gutter="20">
+    <!-- <empty desc="暂无统计数据" v-if="isEmpty" /> v-else -->
+    <el-row  class="rows" :gutter="20">
       <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
-        <studentbaseinfo :data="dataInfo" />
+        <studentbaseinfo :data="dataInfo" :search='search'  @resetDate="resetDate"   ref="studentbaseinfo"/>
       </el-col>
       <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
-        <operate :data="dataInfo" />
+        <operate :data="dataInfo"  :search='search'  @resetDate="resetDate" ref="operate"/>
       </el-col>
       <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="8">
-        <hrdata :data="dataInfo" />
+        <hrdata :data="dataInfo"  :search='search'  @resetDate="resetDate" ref="hrdata"/>
       </el-col>
       <!-- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
         <surplusCourse :data="dataInfo" />
@@ -216,28 +216,45 @@ export default {
       // 这里改变就通知子组件重置
 
       const data = {};
-      try {
-        const { dates, ...rest } = this.search;
-        const res = await getIndex({
-          ...rest,
-          ...getTimes(dates, ["startDate", "endDate"]),
-        });
-        for (const item of res.data) {
-          data[item.dataType] = {
-            ...item,
-            desc: descs[item.dataType],
-          };
-        }
-      } catch (error) {
-        console.log(error);
-      }
-      this.dataInfo = data;
+      // try {
+      //   const { dates, ...rest } = this.search;
+      //   const res = await getIndex({
+      //     ...rest,
+      //     ...getTimes(dates, ["startDate", "endDate"]),
+      //   });
+      //   for (const item of res.data) {
+      //     data[item.dataType] = {
+      //       ...item,
+      //       desc: descs[item.dataType],
+      //     };
+      //   }
+      // } catch (error) {
+      //   console.log(error);
+      // }
+
+      // this.dataInfo = data;
+      // console.log( this.dataInfo,'dataInfo')
       if (this.$refs.business) {
         this.$refs["business"].init();
       }
       if (this.$refs.management) {
         this.$refs["management"].init();
       }
+      if (this.$refs.studentbaseinfo) {
+        this.$refs["studentbaseinfo"].init();
+      }
+      if (this.$refs.operate) {
+        this.$refs["operate"].init();
+      }
+      if (this.$refs.hrdata) {
+        this.$refs["hrdata"].init();
+      }
+      if (this.$refs.curriculum) {
+        this.$refs["curriculum"].init();
+      }
+      if (this.$refs.student) {
+        this.$refs["student"].init();
+      }
     },
     resetDate(data) {
       let arr = null;

+ 6 - 8
src/views/main/baseinfo/management.vue

@@ -258,25 +258,23 @@ export default {
           ...getTimes(this.mdate, ["startDate", "endDate"]),
           //
           dataTypes:
-            "FINANCE_AMOUNT,FINANCE_BALANCE_AMOUNT,FINANCE_PAY,TOTAL_AMOUNT,ORGAN_FINANCE_AMOUNT",
+            "FINANCE_AMOUNT,FINANCE_BALANCE_AMOUNT,FINANCE_PAY,TOTAL_AMOUNT,ORGAN_FINANCE_AMOUNT,ORGAN_APPLY_AMOUNT,ORGAN_RENEW_AMOUNT,ORGAN_VIP_AMOUNT,ORGAN_PRACTICE_AMOUNT,ORGAN_OTHER_AMOUNT,ORGAN_TOTAL_AMOUNT,APPLY_AMOUNT,RENEW_AMOUNT,VIP_AMOUNT,PRACTICE_AMOUNT,OTHER_AMOUNT",
         });
-
         for (const item of res.data) {
           // 再循环一遍
-          for (const key in { ...this.items, ...this.items2 }) {
-            // console.log(key);
-            if (item.dataType == key) {
+          // for (const key in { ...this.items, ...this.items2 }) {
+          //   // console.log(key);
+          //   if (item.dataType == key) {
               data[item.dataType] = {
                 ...item,
                 desc: descs[item.dataType],
               };
-            }
-          }
+          //   }
+          // }
         }
       } catch (error) {
         console.log(error);
       }
-      // console.log(data,'第二次请求',res.data)
       this.loading = false;
       this.$emit("resetDate", data);
     },

+ 3 - 2
src/views/main/baseinfo/modals/manageOrganAll.vue

@@ -5,7 +5,7 @@
       style="height: 68px"
       v-if="JSON.stringify(items) == '{}'"
     ></div>
-    <statistic :col="5" class="statistic" :cols="12">
+    <statistic :col="5" class="statistic" :cols="12" v-else>
       <statistic-item @click="active = 0">
         <span>
           {{ items["TOTAL_AMOUNT"].title + "(元)" }}
@@ -63,7 +63,7 @@
       <statistic-item></statistic-item>
     </statistic>
 
-    <div class="statisticWrap">
+    <div class="statisticWrap" v-if="JSON.stringify(items2) !== '{}'">
       <statistic :col="5" class="statistic" :cols="0" :isNoLine="true">
         <statistic-item
           v-for="(item, key) in items2"
@@ -224,6 +224,7 @@ export default {
           obj[str] = this.data[str];
         }
       });
+      console.log('items2',obj)
       return obj;
     },
     chartExtend() {

+ 48 - 6
src/views/main/baseinfo/operate.vue

@@ -49,7 +49,9 @@
             />
           </el-tooltip>
         </span>
-        <span> <count-to :endVal="data['TRANSACTION_TEACHER_NUM'].percent" /></span>
+        <span>
+          <count-to :endVal="data['TRANSACTION_TEACHER_NUM'].percent"
+        /></span>
       </statistic-item>
     </statistic>
     <!-- <ve-histogram
@@ -66,8 +68,11 @@
 import "echarts/lib/component/dataZoom";
 import countTo from "vue-count-to";
 import veHistogram from "v-charts/lib/histogram.common";
+import { getIndex } from "../api";
+import { getTimes } from "@/utils";
+import { descs, chioseNum } from "../constant";
 export default {
-  props: ["data"],
+  props: ["data", "search"],
   components: {
     "ve-histogram": veHistogram,
     "count-to": countTo,
@@ -75,10 +80,7 @@ export default {
   computed: {
     items() {
       let obj = {};
-      let arr = [
-        "SCHOOL",
-        "PROGRESS_MUSIC_GROUP_NUM",
-      ];
+      let arr = ["SCHOOL", "PROGRESS_MUSIC_GROUP_NUM"];
       arr.forEach((str) => {
         if (this.data[str]) {
           obj[str] = this.data[str];
@@ -141,6 +143,46 @@ export default {
       active: "SCHOOL",
     };
   },
+  mounted() {
+  },
+  methods: {
+    init() {
+      this.FetchDetail();
+    },
+    async FetchDetail() {
+      this.loading = true;
+      let data = [];
+      try {
+        const { dates, ...rest } = this.search;
+        const res = await getIndex({
+          ...rest,
+          ...getTimes(dates, ["startDate", "endDate"]),
+          dataTypes: "TRANSACTION_TEACHER_NUM,SCHOOL,PROGRESS_MUSIC_GROUP_NUM",
+        });
+        for (const item of res.data) {
+          // 再循环一遍
+          // for (const key in this.items) {
+          //   if (item.dataType == key) {
+          //     data[item.dataType] = {
+          //       ...item,
+          //       desc: descs[item.dataType],
+          //     };
+          //   }
+          // }
+          data[item.dataType] = {
+            ...item,
+            desc: descs[item.dataType],
+          };
+        }
+      } catch (error) {
+        console.log(error);
+      }
+      this.loading = false;
+      console.log(data);
+      // this.dataInfo = data;
+      this.$emit("resetDate", data);
+    },
+  },
 };
 </script>
 <style lang="less" scoped>

+ 8 - 5
src/views/main/baseinfo/student.vue

@@ -245,6 +245,9 @@ export default {
      this.$refs.searchHeader.initStatue('month');
   },
   methods: {
+    init(){
+      this.FetchDetail()
+    },
     changeValue(date) {
       // 请求更改数据
       this.mdate = date;
@@ -264,15 +267,15 @@ export default {
         });
         for (const item of res.data) {
           // 再循环一遍
-          for (const key in this.items) {
-            // console.log(key);
-            if (item.dataType == key) {
+          // for (const key in this.items) {
+          //   // console.log(key);
+          //   if (item.dataType == key) {
               data[item.dataType] = {
                 ...item,
                 desc: descs[item.dataType],
               };
-            }
-          }
+          //   }
+          // }
         }
       } catch (error) {
         console.log(error);

+ 71 - 11
src/views/main/baseinfo/studentBaseinfo.vue

@@ -10,11 +10,15 @@
       <div
         class="wall"
         style="height: 68px"
-        v-if="JSON.stringify(items) == '{}'&&!data['CHARGE_STUDENT_CHANGE_RATE']&&!data['ACTIVATION_RATE']"
+        v-if="
+          JSON.stringify(items) == '{}' &&
+          !data['CHARGE_STUDENT_CHANGE_RATE'] &&
+          !data['ACTIVATION_RATE']&&!data['STUDENT_REGISTRATION_NUM']
+        "
       >
         暂无数据
       </div>
-      <statistic :col="5" class="statistic" :cols="0">
+      <statistic :col="5" class="statistic" :cols="0" v-else>
         <statistic-item
           v-for="(item, key) in items"
           :key="key"
@@ -22,7 +26,7 @@
           @click="active = key"
         >
           <span>
-            {{ item.title+"(人)" }}
+            {{ item.title + "(人)" }}
             <el-tooltip
               v-if="item.desc"
               :content="item.desc"
@@ -40,7 +44,7 @@
 
         <statistic-item v-if="data['CHARGE_STUDENT_CHANGE_RATE']">
           <span>
-            {{ data["CHARGE_STUDENT_CHANGE_RATE"].title+"(%)" }}
+            {{ data["CHARGE_STUDENT_CHANGE_RATE"].title + "(%)" }}
             <el-tooltip
               v-if="data['CHARGE_STUDENT_CHANGE_RATE'].desc"
               :content="data['CHARGE_STUDENT_CHANGE_RATE'].desc"
@@ -59,7 +63,7 @@
         </statistic-item>
         <statistic-item v-if="data['ACTIVATION_RATE']">
           <span>
-            {{ data["ACTIVATION_RATE"].title+"(%)" }}
+            {{ data["ACTIVATION_RATE"].title + "(%)" }}
             <el-tooltip
               v-if="data['ACTIVATION_RATE'].desc"
               :content="data['ACTIVATION_RATE'].desc"
@@ -80,8 +84,11 @@
 </template>
 <script>
 import countTo from "vue-count-to";
+import { getIndex } from "../api";
+import { getTimes } from "@/utils";
+import { descs, chioseNum } from "../constant";
 export default {
-  props: ["data"],
+  props: ["data", "search"],
   components: {
     "count-to": countTo,
   },
@@ -98,16 +105,69 @@ export default {
     //    ACTIVATION_RATE: this.data['ACTIVATION_RATE'] || {},
     items() {
       let obj = {};
-      let arr = ["STUDENT_REGISTRATION_NUM",];
+      let arr = ["STUDENT_REGISTRATION_NUM"];
       arr.forEach((str) => {
         if (this.data[str]) {
           obj[str] = this.data[str];
         }
       });
-      //  {
-      //  STUDENT_REGISTRATION_NUM: this.data["STUDENT_REGISTRATION_NUM"] || {},
-      //};
-      return obj
+      return obj;
+    },
+  },
+  mounted() {
+  },
+  methods: {
+    init() {
+      this.FetchDetail();
+    },
+    async FetchDetail() {
+      this.loading = true;
+      let data = [];
+      try {
+        const { dates, ...rest } = this.search;
+        const res = await getIndex({
+          ...rest,
+          ...getTimes(dates, ["startDate", "endDate"]),
+          dataTypes:
+            "CHARGE_STUDENT_CHANGE_RATE,ACTIVATION_RATE,STUDENT_REGISTRATION_NUM",
+        });
+        for (const item of res.data) {
+          // 再循环一遍
+          // for (const key in this.items) {
+          //   if (item.dataType == key) {
+          //     data[item.dataType] = {
+          //       ...item,
+          //       desc: descs[item.dataType],
+          //     };
+          //   }
+          // }
+          if (item.dataType == "STUDENT_REGISTRATION_NUM") {
+            data[item.dataType] = {
+              ...item,
+              desc: descs[item.dataType],
+            };
+          }
+          if (item.dataType == "CHARGE_STUDENT_CHANGE_RATE") {
+            data[item.dataType] = {
+              ...item,
+              desc: descs[item.dataType],
+            };
+          }
+          if (item.dataType == "ACTIVATION_RATE") {
+            data[item.dataType] = {
+              ...item,
+              desc: descs[item.dataType],
+            };
+          }
+        }
+
+      } catch (error) {
+        console.log(error);
+      }
+      this.loading = false;
+      console.log(data);
+      // this.dataInfo = data;
+      this.$emit("resetDate", data);
     },
   },
 };