Blame view

src/views/dashboard/index.vue 13.7 KB
b89c8760   wangming   项目初始化
1
  <template>
de382ae8   yangzhi   首页修改
2
3
4
5
6
7
8
9
10
11
    <div class="dashboard-container">
      <div class="left-container">
        <div class="panel">
          <div class="panel-title">学历分布</div>
          <div class="panel-body">
            <div class="echart-box" style="height: 35vh" id="echart1"></div>
          </div>
        </div>
        <div class="panel">
          <div class="panel-body">
ed88fd8e   yangzhi   首页数据对接
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
            <el-calendar v-model="currentDate" style="height: 35vh">
              <template slot="dateCell" slot-scope="{ date, data }">
                <p :class="data.isSelected ? 'is-selected' : ''">
                  <el-popover
                    v-if="hasInvitationComputed(date, data).length"
                    placement="top-start"
                    title="今日面试"
                    width="350"
                    trigger="hover"
                  >
                    <ul class="popover-list">
                      <li
                        v-for="invitation in hasInvitationComputed(date, data)"
                        :key="invitation.id"
                      >
                        <span style="min-width: 3em">{{
                          invitation.qujian
                        }}</span>
38bc1d53   yangzhi   基础字体改大到16px
30
                        <span style="min-width: 3em">{{
ed88fd8e   yangzhi   首页数据对接
31
32
33
                          invitation.fullName
                        }}</span>
                        <span style="min-width: 7em">{{ invitation.phone }}</span>
38bc1d53   yangzhi   基础字体改大到16px
34
                        <span style="min-width: 5em">{{
4ebb3d66   yangzhi   简历界面
35
36
                          invitation.processName
                        }}</span>
ed88fd8e   yangzhi   首页数据对接
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
                      </li>
                    </ul>
                    <el-badge
                      slot="reference"
                      :value="hasInvitationComputed(date, data).length"
                      class="item"
                      type="primary"
                    >
                      <span>{{ data.day.split("-")[2] }} </span>
                    </el-badge>
                  </el-popover>
  
                  <span v-else>{{ data.day.split("-")[2] }} </span>
                </p>
              </template>
            </el-calendar>
de382ae8   yangzhi   首页修改
53
54
55
56
57
58
59
60
61
62
63
          </div>
        </div>
        <div class="panel">
          <div class="panel-title">面试进度</div>
          <div class="panel-body">
            <div id="echart2" style="height: 35vh"></div>
          </div>
        </div>
        <div class="panel">
          <div class="panel-title">当日面试</div>
          <div class="panel-body">
ed88fd8e   yangzhi   首页数据对接
64
            <el-table :data="toDayInterviewUsers" :show-header="false">
4ebb3d66   yangzhi   简历界面
65
66
              <el-table-column>
                <template slot-scope="{ row }">
de382ae8   yangzhi   首页修改
67
                  <div class="table-td-list">
4ebb3d66   yangzhi   简历界面
68
                    <span>{{ row.fullName }}</span>
ed88fd8e   yangzhi   首页数据对接
69
                    <span>{{ row.sex }}</span>
de382ae8   yangzhi   首页修改
70
71
72
73
                    <span>32</span>
                  </div>
                </template>
              </el-table-column>
ed88fd8e   yangzhi   首页数据对接
74
              <el-table-column>
4ebb3d66   yangzhi   简历界面
75
                <template slot-scope="{ row }">
de382ae8   yangzhi   首页修改
76
                  <div class="table-td-list">
ed88fd8e   yangzhi   首页数据对接
77
78
79
                    <span>{{ row.byyx }}</span>
                    <span>{{ row.zhuanye }}</span>
                    <span>{{ row.xueli }}</span>
de382ae8   yangzhi   首页修改
80
81
82
83
                  </div>
                </template>
              </el-table-column>
              <el-table-column>
4ebb3d66   yangzhi   简历界面
84
85
86
87
88
                <template slot-scope="{ row }">
                  <span>{{
                    row.AnswerTime | dateTimeFilter("yyyy/MM/dd HH:mm")
                  }}</span>
                </template>
de382ae8   yangzhi   首页修改
89
              </el-table-column>
4ebb3d66   yangzhi   简历界面
90
              <el-table-column prop="testpaper"> </el-table-column>
de382ae8   yangzhi   首页修改
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
            </el-table>
          </div>
        </div>
      </div>
      <div class="right-container">
        <ul class="sta-list">
          <li v-for="item in staList" :key="item.title">
            <div style="justify-content: flex-start">
              <img
                style="height: 20px; margin-right: 10px"
                :src="item.icon"
                alt=""
              />
              <span class="sub-title">{{ item.title }}</span>
            </div>
            <div>
              <h3>{{ item.count }}</h3>
              <img
                src="/static/images/index/icon9.png"
                style="height: 30px"
                alt=""
              />
            </div>
          </li>
        </ul>
      </div>
    </div>
b89c8760   wangming   项目初始化
118
119
120
  </template>
  
  <script>
de382ae8   yangzhi   首页修改
121
122
123
  import { GetQuestionTotal, GetTestPaperTotal } from "@/api/index";
  import { OrderGetPriceNumber } from "@/api/order.js";
  import { mapGetters } from "vuex";
ed88fd8e   yangzhi   首页数据对接
124
125
126
127
128
129
130
  import { GetUserList, GetCompanyInvitation } from "@/api/user";
  
  import {
    GetEducationalBackgroundDistribution,
    GetInterviewProgress,
    GetSameDayInterview,
  } from "@/api/dashboard";
de382ae8   yangzhi   首页修改
131
132
133
134
135
136
137
138
139
  
  import { GetInfo } from "@/api/setting";
  
  import * as echarts from "echarts";
  
  export default {
    data() {
      return {
        currentDate: new Date(),
ed88fd8e   yangzhi   首页数据对接
140
141
142
  
        invitationList: [], //面试邀请
  
de382ae8   yangzhi   首页修改
143
144
145
        staList: [
          {
            title: "入库/人",
4ebb3d66   yangzhi   简历界面
146
            val: "入库",
ed88fd8e   yangzhi   首页数据对接
147
            count: 0,
de382ae8   yangzhi   首页修改
148
149
150
151
            icon: "/static/images/index/icon1.png",
          },
          {
            title: "面试邀请/人",
4ebb3d66   yangzhi   简历界面
152
            val: "面试邀请",
ed88fd8e   yangzhi   首页数据对接
153
            count: 0,
de382ae8   yangzhi   首页修改
154
155
156
157
            icon: "/static/images/index/icon2.png",
          },
          {
            title: "正在面试/人",
4ebb3d66   yangzhi   简历界面
158
            val: "未完成面试",
ed88fd8e   yangzhi   首页数据对接
159
            count: 0,
de382ae8   yangzhi   首页修改
160
161
162
163
            icon: "/static/images/index/icon3.png",
          },
          {
            title: "面试完成/人",
4ebb3d66   yangzhi   简历界面
164
            val: "面试完成",
ed88fd8e   yangzhi   首页数据对接
165
            count: 0,
de382ae8   yangzhi   首页修改
166
167
168
169
            icon: "/static/images/index/icon4.png",
          },
          {
            title: "线下面试/人",
4ebb3d66   yangzhi   简历界面
170
            val: "线下面试",
ed88fd8e   yangzhi   首页数据对接
171
            count: 0,
de382ae8   yangzhi   首页修改
172
173
174
175
            icon: "/static/images/index/icon5.png",
          },
          {
            title: "已录用/人",
4ebb3d66   yangzhi   简历界面
176
            val: "已录用",
ed88fd8e   yangzhi   首页数据对接
177
            count: 0,
de382ae8   yangzhi   首页修改
178
179
180
181
            icon: "/static/images/index/icon6.png",
          },
          {
            title: "未录用/人",
4ebb3d66   yangzhi   简历界面
182
            val: "未录用",
ed88fd8e   yangzhi   首页数据对接
183
            count: 0,
de382ae8   yangzhi   首页修改
184
185
            icon: "/static/images/index/icon7.png",
          },
4ebb3d66   yangzhi   简历界面
186
          {
eb117b73   yangzhi   禁用改成不符合条件
187
188
            title: "不符合条件/人",
            val: "不符合条件",
4ebb3d66   yangzhi   简历界面
189
190
191
            count: 0,
            icon: "/static/images/index/icon8.png",
          },
de382ae8   yangzhi   首页修改
192
        ],
de382ae8   yangzhi   首页修改
193
        echartOption1: {
38bc1d53   yangzhi   基础字体改大到16px
194
195
196
          textStyle: {
            fontSize: 16,
          },
de382ae8   yangzhi   首页修改
197
198
199
          legend: {
            top: "bottom",
          },
ed88fd8e   yangzhi   首页数据对接
200
201
202
          tooltip: {
            trigger: "item",
          },
de382ae8   yangzhi   首页修改
203
204
205
206
207
208
          series: [
            {
              name: "学历分布",
              type: "pie",
              radius: [0, "80%"],
              center: ["50%", "50%"],
ed88fd8e   yangzhi   首页数据对接
209
210
              // roseType: "area",
              data: [],
de382ae8   yangzhi   首页修改
211
212
213
214
            },
          ],
        },
        echartOption2: {
38bc1d53   yangzhi   基础字体改大到16px
215
216
217
          textStyle: {
            fontSize: 16,
          },
de382ae8   yangzhi   首页修改
218
219
220
221
222
223
224
225
226
          grid: {
            top: 20,
            bottom: 40,
          },
          tooltip: {},
          xAxis: {
            type: "category",
            axisLabel: {
              color: "#999999",
4ebb3d66   yangzhi   简历界面
227
              interval: 0,
de382ae8   yangzhi   首页修改
228
229
              fontSize: 16,
            },
4ebb3d66   yangzhi   简历界面
230
            data: [],
de382ae8   yangzhi   首页修改
231
232
233
234
235
236
          },
          yAxis: {
            type: "value",
          },
          series: [
            {
ed88fd8e   yangzhi   首页数据对接
237
              data: [],
de382ae8   yangzhi   首页修改
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
              type: "bar",
              label: {
                show: true,
                color: "#4e95ff",
                position: "top",
                formatter: "{c}人",
              },
              itemStyle: {
                normal: {
                  color: "#4e95ff",
                  barBorderRadius: [10, 10, 0, 0],
                },
              },
            },
          ],
        },
  
4ebb3d66   yangzhi   简历界面
255
256
        //当日面试
        toDayInterviewUsers: [],
ed88fd8e   yangzhi   首页数据对接
257
  
de382ae8   yangzhi   首页修改
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
        isAdmin: false,
        imageUrl: "",
        total: {
          questiontotal: 0,
          testpapertotal: 0,
          PriceNumber: 0,
          Count: 0,
        },
        query: {
          UserTypeEnum: 1, //0:管理员,1普通用户
          PageIndex: 1,
          PageSize: 10,
        },
      };
    },
    computed: {
      ...mapGetters(["name"]),
ed88fd8e   yangzhi   首页数据对接
275
276
277
278
279
280
281
282
283
284
285
      hasInvitationComputed() {
        return (date, data) => {
          if (!this.invitationList.length) {
            return [];
          }
          return this.invitationList.filter((t) => t.startTime == data.day);
        };
      },
    },
    created() {
      this.initInvitations();
4ebb3d66   yangzhi   简历界面
286
      this.initToDayInterviewUsers();
de382ae8   yangzhi   首页修改
287
    },
de382ae8   yangzhi   首页修改
288
289
290
291
292
293
294
295
    mounted() {
      try {
        if (this.$store.state.user.userInfo.UserType == 0) this.isAdmin = true;
      } catch {}
      this.init();
      this.GetTotalHeadler();
    },
    methods: {
4ebb3d66   yangzhi   简历界面
296
297
298
299
300
      initToDayInterviewUsers() {
        GetSameDayInterview().then((res) => {
          this.toDayInterviewUsers = res.data;
        });
      },
ed88fd8e   yangzhi   首页数据对接
301
302
303
304
305
306
307
308
309
      initInvitations() {
        GetCompanyInvitation({
          PageIndex: 1,
          PageSize: 10000,
        }).then((res) => {
          console.log("GetCompanyInvitation", res);
          this.invitationList = res.data.data.list;
        });
      },
de382ae8   yangzhi   首页修改
310
311
312
313
314
315
      initEchart() {
        this.initEchartXueli();
        this.initEchartJindu();
      },
      initEchartXueli() {
        let myChart = echarts.init(document.getElementById("echart1"));
ed88fd8e   yangzhi   首页数据对接
316
317
318
319
320
321
322
323
324
325
326
327
328
329
        GetEducationalBackgroundDistribution().then((res) => {
          console.log("GetEducationalBackgroundDistribution", res);
          let list = res.data.map((t) => {
            t.name = !t.name ? "未知" : t.name;
            return t;
          });
          this.echartOption1.series[0].data = list.map((t) => {
            return {
              name: t.name,
              value: t.count,
            };
          });
          myChart.setOption(this.echartOption1);
        });
de382ae8   yangzhi   首页修改
330
331
332
      },
      initEchartJindu() {
        let myChart = echarts.init(document.getElementById("echart2"));
ed88fd8e   yangzhi   首页数据对接
333
334
        GetInterviewProgress().then((res) => {
          console.log("GetInterviewProgress", res);
4ebb3d66   yangzhi   简历界面
335
          let list = res.data;
ed88fd8e   yangzhi   首页数据对接
336
337
338
339
340
341
          this.echartOption2.series[0].data = list.map((t) => {
            return {
              name: t.name,
              value: t.count,
            };
          });
4ebb3d66   yangzhi   简历界面
342
343
          this.echartOption2.xAxis.data = list.map((t) => t.name);
          myChart.setOption(this.echartOption2);
ed88fd8e   yangzhi   首页数据对接
344
  
4ebb3d66   yangzhi   简历界面
345
346
347
348
349
350
351
          //右边统计数据
          list.forEach((item) => {
            let index = this.staList.findIndex((t) => t.val == item.name);
            if (index) {
              this.staList[index].count = item.count;
            }
          });
ed88fd8e   yangzhi   首页数据对接
352
        });
de382ae8   yangzhi   首页修改
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
      },
      init() {
        var _this = this;
        GetInfo(1).then((res) => {
          var d = res.data;
          if (d && d.data) {
            if (d.data.home_images) {
              _this.imageUrl = _this.BASE_URL + d.data.home_images;
            }
          }
        });
        this.initEchart();
      },
      GetTotalHeadler() {
        GetQuestionTotal().then((res) => {
          this.total.questiontotal = res.data.data;
        });
        GetTestPaperTotal().then((res) => {
          this.total.testpapertotal = res.data.data;
        });
        OrderGetPriceNumber().then((res) => {
          this.total.PriceNumber = res.data.data;
        });
        GetUserList(this.query).then((res) => {
          this.total.Count = res.data.data.total;
        });
      },
    },
  };
b89c8760   wangming   项目初始化
382
383
  </script>
  
de382ae8   yangzhi   首页修改
384
  <style scoped>
ed88fd8e   yangzhi   首页数据对接
385
386
  >>> .el-calendar-table td.next {
    display: none;
de382ae8   yangzhi   首页修改
387
  }
ed88fd8e   yangzhi   首页数据对接
388
389
390
391
392
  >>> .el-calendar-day {
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
de382ae8   yangzhi   首页修改
393
  }
ed88fd8e   yangzhi   首页数据对接
394
395
396
  >>> .el-calendar-day p {
    margin: 0;
    text-align: center;
88e9d1c0   yangzhi   首页日历有个小bug
397
    height: 30px;
ed88fd8e   yangzhi   首页数据对接
398
    width: 40px;
88e9d1c0   yangzhi   首页日历有个小bug
399
    line-height: 30px;
de382ae8   yangzhi   首页修改
400
  }
ed88fd8e   yangzhi   首页数据对接
401
402
  >>> .el-calendar-table .el-calendar-day:hover {
    background-color: transparent;
de382ae8   yangzhi   首页修改
403
  }
ed88fd8e   yangzhi   首页数据对接
404
405
406
  >>> .el-calendar-table .el-calendar-day:hover p {
    background-color: #f2f8fe;
    border-radius: 30%;
de382ae8   yangzhi   首页修改
407
  }
ed88fd8e   yangzhi   首页数据对接
408
409
  >>> .el-calendar-table td.is-selected {
    background-color: transparent;
de382ae8   yangzhi   首页修改
410
  }
ed88fd8e   yangzhi   首页数据对接
411
412
413
  >>> .el-calendar-table td.is-selected .el-calendar-day p {
    background-color: #f2f8fe;
    border-radius: 30%;
de382ae8   yangzhi   首页修改
414
  }
ed88fd8e   yangzhi   首页数据对接
415
416
417
418
  >>> .el-calendar-table td.is-today .el-calendar-day p {
    color: #fff;
    background-color: #409eff;
    border-radius: 30%;
de382ae8   yangzhi   首页修改
419
  }
ed88fd8e   yangzhi   首页数据对接
420
421
  >>> .el-calendar-table td {
    border: none;
de382ae8   yangzhi   首页修改
422
  }
ed88fd8e   yangzhi   首页数据对接
423
424
  >>> .el-calendar-table tr td:first-child {
    border-left: none;
de382ae8   yangzhi   首页修改
425
  }
ed88fd8e   yangzhi   首页数据对接
426
427
  >>> .el-calendar-table tr:first-child td {
    border: none;
de382ae8   yangzhi   首页修改
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
  }
  </style>
  <style lang="scss" scoped>
  .dashboard {
    &-container {
      margin: 30px;
    }
  
    &-text {
      font-size: 30px;
      line-height: 46px;
    }
  }
  
  .el-row {
    margin-bottom: 20px;
    margin-top: 20px;
  
    &:last-child {
      margin-bottom: 0;
    }
  }
  
  .el-col {
    border-radius: 5px;
  }
  
  .bg-purple-dark {
    background: #99a9bf;
  }
  
  .bg-purple {
    background: #d3dce6;
    box-shadow: 0 0 10px #cdcdcd;
  }
  
  .bg-purple-light {
    background: #e5e9f2;
  }
  
  .grid-content {
    border-radius: 5px;
97bf7b2f   yangzhi   样式优化适配不同分辨率
470
    min-height: 100%;
de382ae8   yangzhi   首页修改
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
    text-align: center;
    padding-top: 20px;
    padding-bottom: 20px;
  
    .grid-content-number {
      font-size: 40px;
      color: red;
    }
  
    div {
      font-size: 20px;
      margin-top: 10px;
    }
  }
  
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
  </style>
b89c8760   wangming   项目初始化
491
  <style lang="scss" scoped>
ed88fd8e   yangzhi   首页数据对接
492
493
  .popover-list {
    padding-left: 10px;
38bc1d53   yangzhi   基础字体改大到16px
494
    padding-right: 10px;
ed88fd8e   yangzhi   首页数据对接
495
496
497
498
499
500
501
    li {
      list-style: none;
      height: 40px;
      line-height: 40px;
      display: flex;
      align-items: center;
      border-top: 1px dashed #eaeaea;
38bc1d53   yangzhi   基础字体改大到16px
502
503
      font-size: 16px;
      padding-right: 20px;
ed88fd8e   yangzhi   首页数据对接
504
505
506
507
508
      span {
        margin-right: 10px;
      }
    }
  }
de382ae8   yangzhi   首页修改
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
  .table-td-list {
    display: flex;
    align-items: center;
    span {
      margin-right: 10px;
    }
  }
  .dashboard-container {
    display: flex;
    justify-content: space-between;
    background-color: #f9f9f9;
    margin: 0;
    padding: 20px;
  }
  .left-container {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .panel {
      width: 49%;
      flex: none;
    }
  }
  .right-container {
  }
  .panel {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 10px 20px;
    margin-bottom: 20px;
    .panel-title {
      height: 3em;
      line-height: 3em;
38bc1d53   yangzhi   基础字体改大到16px
544
      font-size: 22px;
de382ae8   yangzhi   首页修改
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
      font-weight: bold;
    }
  }
  .sta-list {
    display: flex;
    flex-direction: column;
    padding-left: 20px;
    width: 200px;
    flex: none;
    margin: 0;
    li {
      list-style: none;
      background-color: #fff;
      border: 10px;
      border-radius: 10px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
      padding: 15px 15px 5px;
      margin-bottom: 20px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      min-height: 9vh;
      .sub-title {
        color: #999;
      }
      & > div {
        display: flex;
        align-items: center;
        justify-content: space-between;
      }
      h3 {
        margin: 0;
      }
    }
  }
b32564ca   周超   11
580
  </style>