123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- <template>
- <div class="container">
- <save-form
- inline
- :model="search"
- @submit="FetchDetail"
- @reset="reset"
- saveKey="/main/main/baseInfo"
- >
- <!-- <el-form-item prop="year">
- <el-date-picker
- v-model="search.dates"
- type="daterange"
- align="right"
- unlink-panels
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- :picker-options="pickerOptions">
- </el-date-picker>
- </el-form-item> -->
- <el-form-item prop="organId">
- <el-select
- clearable
- filterable
- placeholder="请选择分部"
- v-model="search.organId"
- >
- <el-option
- v-for="(item, index) in selects.branchs"
- :key="index"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-button native-type="submit" type="primary">搜索</el-button>
- <el-button native-type="reset" type="danger">重置</el-button>
- </save-form>
- <!-- <el-alert type="info" :closable="false" style="margin-bottom: 20px;">
- 每日0点更新前一日数据
- </el-alert> -->
- <!-- 这里显示选项卡 -->
- <empty desc="暂无统计数据" v-if="isEmpty" />
- <el-row v-else class="rows" :gutter="20">
- <el-col :xs="24" :sm="24" :md="24" :lg="9" :xl="9">
- <studentbaseinfo :data="dataInfo" />
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="6" :xl="6">
- <operate :data="dataInfo" />
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="9" :xl="9">
- <hrdata :data="dataInfo" />
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <surplusCourse :data="dataInfo" />
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
- <useCourse :data="dataInfo" />
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12">
- <management
- ref="management"
- :data="dataInfo"
- :search="search"
- @resetDate="resetDate"
- />
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12">
- <business
- ref="business"
- :data="dataInfo"
- :search="search"
- @resetDate="resetDate"
- />
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
- <curriculum :data="dataInfo" :search="search" @resetDate="resetDate" />
- </el-col>
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
- <student :data="dataInfo" :search="search" @resetDate="resetDate" />
- </el-col>
- <!-- <el-col :xs="24" :sm="24" :md="12">
- <operate :data="dataInfo"/>
- </el-col> -->
- <!-- <el-col :xs="24" :sm="24" :md="12">
- <hrdata :data="dataInfo"/>
- </el-col> -->
- </el-row>
- </div>
- </template>
- <script>
- import { getIndex } from "../api";
- import operate from "./operate";
- import business from "./business";
- import management from "./management";
- import hrdata from "./hr";
- import student from "./student";
- import curriculum from "./curriculum";
- import studentbaseinfo from "./studentBaseinfo";
- import surplusCourse from "./surplusCourse";
- import useCourse from "./useCourse";
- import { getTimes } from "@/utils";
- import { descs } from "../constant";
- export default {
- components: {
- operate,
- business,
- management,
- hrdata,
- student,
- curriculum,
- studentbaseinfo,
- surplusCourse,
- useCourse,
- },
- data() {
- return {
- pickerOptions: {
- firstDayOfWeek: 1,
- disabledDate: (a) => {
- const { dayjs } = this.$helpers;
- return dayjs(a).isAfter(dayjs().subtract(1, "day"));
- },
- shortcuts: [
- {
- text: "最近一周",
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- end.setTime(end.getTime() - 3600 * 1000 * 24 * 1);
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 8);
- picker.$emit("pick", [start, end]);
- },
- },
- {
- text: "最近一个月",
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- end.setTime(end.getTime() - 3600 * 1000 * 24 * 1);
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 31);
- picker.$emit("pick", [start, end]);
- },
- },
- {
- text: "最近三个月",
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- end.setTime(end.getTime() - 3600 * 1000 * 24 * 1);
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 91);
- picker.$emit("pick", [start, end]);
- },
- },
- ],
- },
- search: {
- dates: [],
- organId: null,
- },
- dataInfo: {},
- business: {},
- loading: false,
- };
- },
- computed: {
- isEmpty() {
- return !Object.keys(this.dataInfo).length;
- },
- },
- created() {},
- mounted() {
- this.$set(this.search, "dates", this.getInitDate());
- this.$store.dispatch("setBranchs");
- this.FetchDetail();
- },
- methods: {
- getInitDate() {
- const end = this.$helpers
- .dayjs(new Date())
- .subtract(1, "day")
- .format("YYYY-MM-DD");
- const start = this.$helpers
- .dayjs(new Date())
- .subtract(1, "day")
- .set("date", 1)
- .format("YYYY-MM-DD");
- return [start, end];
- },
- reset() {
- this.$set(this.search, "dates", this.getInitDate());
- this.$set(this.search, "organId", null);
- this.FetchDetail();
- },
- async FetchDetail() {
- 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;
- if (this.$refs.business) {
- this.$refs["business"].init();
- }
- if (this.$refs.management) {
- this.$refs["management"].init();
- }
- },
- resetDate(data) {
- this.dataInfo = {...this.dataInfo,...data};
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .container {
- overflow: hidden;
- .rows {
- > div {
- margin-bottom: 20px;
- }
- }
- /deep/ .el-card__body .statistic {
- margin-bottom: 15px;
- padding: 0;
- }
- }
- /deep/.el-card__header {
- padding: 0 20px !important;
- }
- </style>
- <style lang="scss">
- .box {
- display: flex;
- flex-direction: row;
- align-items: center;
- height: 55px;
- line-height: 55px;
- .shape {
- margin-right: 10px;
- height: 18px;
- width: 4px;
- background-color: #14928a;
- }
- }
- </style>
|