Commit ed88fd8e7fc0bf910bdd86de960090bf87b2b142
1 parent
ef132976
首页数据对接
Showing
3 changed files
with
231 additions
and
88 deletions
src/api/dashboard.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +//学历分布 | |
| 4 | +export function GetEducationalBackgroundDistribution() { | |
| 5 | + return request({ | |
| 6 | + url: `/DashBoard/EducationalBackgroundDistribution`, | |
| 7 | + method: 'get', | |
| 8 | + }) | |
| 9 | +} | |
| 10 | + | |
| 11 | +//面试进度 | |
| 12 | +export function GetInterviewProgress() { | |
| 13 | + return request({ | |
| 14 | + url: `/DashBoard/InterviewProgress`, | |
| 15 | + method: 'get', | |
| 16 | + }) | |
| 17 | +} | |
| 18 | + | |
| 19 | +//当日面试 | |
| 20 | +export function GetSameDayInterview(data) { | |
| 21 | + return request({ | |
| 22 | + url: `/DashBoard/SameDayInterview`, | |
| 23 | + method: 'get', | |
| 24 | + data, | |
| 25 | + params: data | |
| 26 | + }) | |
| 27 | +} | |
| 0 | 28 | \ No newline at end of file | ... | ... |
src/common/mixins.js
| ... | ... | @@ -2,6 +2,7 @@ import { |
| 2 | 2 | getToken |
| 3 | 3 | } from '@/utils/auth' |
| 4 | 4 | import { BASE_URL } from '@/common/config' |
| 5 | +import { formatTime } from '@/utils/util' | |
| 5 | 6 | export default { |
| 6 | 7 | data() { |
| 7 | 8 | return { |
| ... | ... | @@ -13,6 +14,11 @@ export default { |
| 13 | 14 | created() { |
| 14 | 15 | this.Authorization = getToken(); |
| 15 | 16 | }, |
| 17 | + filters: { | |
| 18 | + dateTimeFilter(val, formatter) { | |
| 19 | + return formatTime(val, formatter) | |
| 20 | + }, | |
| 21 | + }, | |
| 16 | 22 | methods: { |
| 17 | 23 | |
| 18 | 24 | } | ... | ... |
src/views/dashboard/index.vue
| ... | ... | @@ -9,15 +9,45 @@ |
| 9 | 9 | </div> |
| 10 | 10 | <div class="panel"> |
| 11 | 11 | <div class="panel-body"> |
| 12 | - <el-calendar v-model="currentDate" style="height:35vh"> | |
| 13 | - <template | |
| 14 | - slot="dateCell" | |
| 15 | - slot-scope="{date, data}"> | |
| 16 | - <p :class="data.isSelected ? 'is-selected' : ''"> | |
| 17 | - {{ data.day.split('-')[2] }} | |
| 18 | - </p> | |
| 19 | - </template> | |
| 20 | - </el-calendar> | |
| 12 | + <el-calendar v-model="currentDate" style="height: 35vh"> | |
| 13 | + <template slot="dateCell" slot-scope="{ date, data }"> | |
| 14 | + <p :class="data.isSelected ? 'is-selected' : ''"> | |
| 15 | + <el-popover | |
| 16 | + v-if="hasInvitationComputed(date, data).length" | |
| 17 | + placement="top-start" | |
| 18 | + title="今日面试" | |
| 19 | + width="350" | |
| 20 | + trigger="hover" | |
| 21 | + > | |
| 22 | + <ul class="popover-list"> | |
| 23 | + <li | |
| 24 | + v-for="invitation in hasInvitationComputed(date, data)" | |
| 25 | + :key="invitation.id" | |
| 26 | + > | |
| 27 | + <span style="min-width: 3em">{{ | |
| 28 | + invitation.qujian | |
| 29 | + }}</span> | |
| 30 | + <span style="min-width: 4em">{{ | |
| 31 | + invitation.fullName | |
| 32 | + }}</span> | |
| 33 | + <span style="min-width: 7em">{{ invitation.phone }}</span> | |
| 34 | + <span style="min-width: 4em">{{ invitation.processName }}</span> | |
| 35 | + </li> | |
| 36 | + </ul> | |
| 37 | + <el-badge | |
| 38 | + slot="reference" | |
| 39 | + :value="hasInvitationComputed(date, data).length" | |
| 40 | + class="item" | |
| 41 | + type="primary" | |
| 42 | + > | |
| 43 | + <span>{{ data.day.split("-")[2] }} </span> | |
| 44 | + </el-badge> | |
| 45 | + </el-popover> | |
| 46 | + | |
| 47 | + <span v-else>{{ data.day.split("-")[2] }} </span> | |
| 48 | + </p> | |
| 49 | + </template> | |
| 50 | + </el-calendar> | |
| 21 | 51 | </div> |
| 22 | 52 | </div> |
| 23 | 53 | <div class="panel"> |
| ... | ... | @@ -29,30 +59,31 @@ |
| 29 | 59 | <div class="panel"> |
| 30 | 60 | <div class="panel-title">当日面试</div> |
| 31 | 61 | <div class="panel-body"> |
| 32 | - <el-table :data="userList" :show-header="false"> | |
| 33 | - <el-table-column width="120"> | |
| 34 | - <template> | |
| 62 | + <el-table :data="toDayInterviewUsers" :show-header="false"> | |
| 63 | + <el-table-column > | |
| 64 | + <template slot-scope="{row}"> | |
| 35 | 65 | <div class="table-td-list"> |
| 36 | - <span>张三</span> | |
| 37 | - <span>男</span> | |
| 66 | + <span>{{row.fullName}}</span> | |
| 67 | + <span>{{ row.sex }}</span> | |
| 38 | 68 | <span>32</span> |
| 39 | 69 | </div> |
| 40 | 70 | </template> |
| 41 | 71 | </el-table-column> |
| 42 | - <el-table-column width="280"> | |
| 43 | - <template> | |
| 72 | + <el-table-column> | |
| 73 | + <template slot-scope="{row}"> | |
| 44 | 74 | <div class="table-td-list"> |
| 45 | - <span>西南石油大学</span> | |
| 46 | - <span>计算机科学与技术</span> | |
| 47 | - <span>本科</span> | |
| 75 | + <span>{{ row.byyx }}</span> | |
| 76 | + <span>{{ row.zhuanye }}</span> | |
| 77 | + <span>{{ row.xueli }}</span> | |
| 48 | 78 | </div> |
| 49 | 79 | </template> |
| 50 | 80 | </el-table-column> |
| 51 | 81 | <el-table-column> |
| 52 | - <template> 2022/11/23 17:20 </template> | |
| 82 | + <template slot-scope="{row}"> | |
| 83 | + <span>{{ row.AnswerTime | dateTimeFilter('yyyy/MM/dd HH:mm') }}</span> | |
| 84 | + </template> | |
| 53 | 85 | </el-table-column> |
| 54 | - <el-table-column> | |
| 55 | - <template> 面试前端岗位 </template> | |
| 86 | + <el-table-column prop="testpaper"> | |
| 56 | 87 | </el-table-column> |
| 57 | 88 | </el-table> |
| 58 | 89 | </div> |
| ... | ... | @@ -87,7 +118,13 @@ |
| 87 | 118 | import { GetQuestionTotal, GetTestPaperTotal } from "@/api/index"; |
| 88 | 119 | import { OrderGetPriceNumber } from "@/api/order.js"; |
| 89 | 120 | import { mapGetters } from "vuex"; |
| 90 | -import { GetUserList } from "@/api/user"; | |
| 121 | +import { GetUserList, GetCompanyInvitation } from "@/api/user"; | |
| 122 | + | |
| 123 | +import { | |
| 124 | + GetEducationalBackgroundDistribution, | |
| 125 | + GetInterviewProgress, | |
| 126 | + GetSameDayInterview, | |
| 127 | +} from "@/api/dashboard"; | |
| 91 | 128 | |
| 92 | 129 | import { GetInfo } from "@/api/setting"; |
| 93 | 130 | |
| ... | ... | @@ -97,66 +134,69 @@ export default { |
| 97 | 134 | data() { |
| 98 | 135 | return { |
| 99 | 136 | currentDate: new Date(), |
| 137 | + | |
| 138 | + invitationList: [], //面试邀请 | |
| 139 | + | |
| 100 | 140 | staList: [ |
| 101 | 141 | { |
| 102 | 142 | title: "入库/人", |
| 103 | - count: 198, | |
| 143 | + val:'入库', | |
| 144 | + count: 0, | |
| 104 | 145 | icon: "/static/images/index/icon1.png", |
| 105 | 146 | }, |
| 106 | 147 | { |
| 107 | 148 | title: "面试邀请/人", |
| 108 | - count: 123, | |
| 149 | + val:'面试邀请', | |
| 150 | + count: 0, | |
| 109 | 151 | icon: "/static/images/index/icon2.png", |
| 110 | 152 | }, |
| 111 | 153 | { |
| 112 | 154 | title: "正在面试/人", |
| 113 | - count: 21, | |
| 155 | + val:'未完成面试', | |
| 156 | + count: 0, | |
| 114 | 157 | icon: "/static/images/index/icon3.png", |
| 115 | 158 | }, |
| 116 | 159 | { |
| 117 | 160 | title: "面试完成/人", |
| 118 | - count: 100, | |
| 161 | + val:'面试完成', | |
| 162 | + count: 0, | |
| 119 | 163 | icon: "/static/images/index/icon4.png", |
| 120 | 164 | }, |
| 121 | 165 | { |
| 122 | 166 | title: "线下面试/人", |
| 123 | - count: 98, | |
| 167 | + val:'线下面试', | |
| 168 | + count: 0, | |
| 124 | 169 | icon: "/static/images/index/icon5.png", |
| 125 | 170 | }, |
| 126 | 171 | { |
| 127 | 172 | title: "已录用/人", |
| 128 | - count: 898, | |
| 173 | + val:'已录用', | |
| 174 | + count: 0, | |
| 129 | 175 | icon: "/static/images/index/icon6.png", |
| 130 | 176 | }, |
| 131 | 177 | { |
| 132 | 178 | title: "未录用/人", |
| 133 | - count: 1088, | |
| 179 | + val:'未录用', | |
| 180 | + count: 0, | |
| 134 | 181 | icon: "/static/images/index/icon7.png", |
| 135 | 182 | }, |
| 136 | - { title: "禁用/人", count: 39, icon: "/static/images/index/icon8.png" }, | |
| 183 | + { title: "禁用/人",val:'禁用', count: 0, icon: "/static/images/index/icon8.png" }, | |
| 137 | 184 | ], |
| 138 | - userList: [{}, {}, {}, {}, {}, {} ], | |
| 139 | 185 | echartOption1: { |
| 140 | 186 | legend: { |
| 141 | 187 | top: "bottom", |
| 142 | 188 | }, |
| 189 | + tooltip: { | |
| 190 | + trigger: "item", | |
| 191 | + }, | |
| 143 | 192 | series: [ |
| 144 | 193 | { |
| 145 | 194 | name: "学历分布", |
| 146 | 195 | type: "pie", |
| 147 | 196 | radius: [0, "80%"], |
| 148 | 197 | center: ["50%", "50%"], |
| 149 | - roseType: "area", | |
| 150 | - data: [ | |
| 151 | - { value: 40, name: "博士" }, | |
| 152 | - { value: 38, name: "硕士" }, | |
| 153 | - { value: 32, name: "本科" }, | |
| 154 | - { value: 30, name: "大专" }, | |
| 155 | - { value: 28, name: "中专" }, | |
| 156 | - { value: 26, name: "高中" }, | |
| 157 | - { value: 22, name: "初中" }, | |
| 158 | - { value: 18, name: "小学" }, | |
| 159 | - ], | |
| 198 | + // roseType: "area", | |
| 199 | + data: [], | |
| 160 | 200 | }, |
| 161 | 201 | ], |
| 162 | 202 | }, |
| ... | ... | @@ -170,17 +210,11 @@ export default { |
| 170 | 210 | type: "category", |
| 171 | 211 | axisLabel: { |
| 172 | 212 | color: "#999999", |
| 213 | + interval:0, | |
| 173 | 214 | fontSize: 16, |
| 174 | 215 | }, |
| 175 | 216 | data: [ |
| 176 | - "入库", | |
| 177 | - "面试邀请", | |
| 178 | - "正在面试", | |
| 179 | - "面试完成", | |
| 180 | - "线下面试", | |
| 181 | - "已录用", | |
| 182 | - "未录用", | |
| 183 | - "禁用", | |
| 217 | + | |
| 184 | 218 | ], |
| 185 | 219 | }, |
| 186 | 220 | yAxis: { |
| ... | ... | @@ -188,7 +222,7 @@ export default { |
| 188 | 222 | }, |
| 189 | 223 | series: [ |
| 190 | 224 | { |
| 191 | - data: [120, 150, 150, 80, 70, 110, 130, 90], | |
| 225 | + data: [], | |
| 192 | 226 | type: "bar", |
| 193 | 227 | label: { |
| 194 | 228 | show: true, |
| ... | ... | @@ -206,6 +240,9 @@ export default { |
| 206 | 240 | ], |
| 207 | 241 | }, |
| 208 | 242 | |
| 243 | + //当日面试 | |
| 244 | + toDayInterviewUsers:[], | |
| 245 | + | |
| 209 | 246 | isAdmin: false, |
| 210 | 247 | imageUrl: "", |
| 211 | 248 | total: { |
| ... | ... | @@ -223,8 +260,19 @@ export default { |
| 223 | 260 | }, |
| 224 | 261 | computed: { |
| 225 | 262 | ...mapGetters(["name"]), |
| 263 | + hasInvitationComputed() { | |
| 264 | + return (date, data) => { | |
| 265 | + if (!this.invitationList.length) { | |
| 266 | + return []; | |
| 267 | + } | |
| 268 | + return this.invitationList.filter((t) => t.startTime == data.day); | |
| 269 | + }; | |
| 270 | + }, | |
| 271 | + }, | |
| 272 | + created() { | |
| 273 | + this.initInvitations(); | |
| 274 | + this.initToDayInterviewUsers(); | |
| 226 | 275 | }, |
| 227 | - created() {}, | |
| 228 | 276 | mounted() { |
| 229 | 277 | try { |
| 230 | 278 | if (this.$store.state.user.userInfo.UserType == 0) this.isAdmin = true; |
| ... | ... | @@ -233,17 +281,65 @@ export default { |
| 233 | 281 | this.GetTotalHeadler(); |
| 234 | 282 | }, |
| 235 | 283 | methods: { |
| 284 | + initToDayInterviewUsers(){ | |
| 285 | + GetSameDayInterview().then(res=>{ | |
| 286 | + this.toDayInterviewUsers = res.data; | |
| 287 | + }) | |
| 288 | + }, | |
| 289 | + initInvitations() { | |
| 290 | + GetCompanyInvitation({ | |
| 291 | + PageIndex: 1, | |
| 292 | + PageSize: 10000, | |
| 293 | + }).then((res) => { | |
| 294 | + console.log("GetCompanyInvitation", res); | |
| 295 | + this.invitationList = res.data.data.list; | |
| 296 | + }); | |
| 297 | + }, | |
| 236 | 298 | initEchart() { |
| 237 | 299 | this.initEchartXueli(); |
| 238 | 300 | this.initEchartJindu(); |
| 239 | 301 | }, |
| 240 | 302 | initEchartXueli() { |
| 241 | 303 | let myChart = echarts.init(document.getElementById("echart1")); |
| 242 | - myChart.setOption(this.echartOption1); | |
| 304 | + GetEducationalBackgroundDistribution().then((res) => { | |
| 305 | + console.log("GetEducationalBackgroundDistribution", res); | |
| 306 | + let list = res.data.map((t) => { | |
| 307 | + t.name = !t.name ? "未知" : t.name; | |
| 308 | + return t; | |
| 309 | + }); | |
| 310 | + this.echartOption1.series[0].data = list.map((t) => { | |
| 311 | + return { | |
| 312 | + name: t.name, | |
| 313 | + value: t.count, | |
| 314 | + }; | |
| 315 | + }); | |
| 316 | + myChart.setOption(this.echartOption1); | |
| 317 | + }); | |
| 243 | 318 | }, |
| 244 | 319 | initEchartJindu() { |
| 245 | 320 | let myChart = echarts.init(document.getElementById("echart2")); |
| 246 | - myChart.setOption(this.echartOption2); | |
| 321 | + GetInterviewProgress().then((res) => { | |
| 322 | + console.log("GetInterviewProgress", res); | |
| 323 | + let list = res.data; | |
| 324 | + this.echartOption2.series[0].data = list.map((t) => { | |
| 325 | + return { | |
| 326 | + name: t.name, | |
| 327 | + value: t.count, | |
| 328 | + }; | |
| 329 | + }); | |
| 330 | + this.echartOption2.xAxis.data = list.map(t=>t.name); | |
| 331 | + myChart.setOption(this.echartOption2); | |
| 332 | + | |
| 333 | + //右边统计数据 | |
| 334 | + list.forEach(item=>{ | |
| 335 | + let index = this.staList.findIndex(t=>t.val == item.name); | |
| 336 | + if(index){ | |
| 337 | + this.staList[index].count = item.count; | |
| 338 | + } | |
| 339 | + }) | |
| 340 | + | |
| 341 | + }); | |
| 342 | + | |
| 247 | 343 | }, |
| 248 | 344 | init() { |
| 249 | 345 | var _this = this; |
| ... | ... | @@ -276,49 +372,49 @@ export default { |
| 276 | 372 | </script> |
| 277 | 373 | |
| 278 | 374 | <style scoped> |
| 279 | ->>>.el-calendar-table td.next{ | |
| 280 | - display: none; | |
| 375 | +>>> .el-calendar-table td.next { | |
| 376 | + display: none; | |
| 281 | 377 | } |
| 282 | ->>>.el-calendar-day{ | |
| 283 | - height: auto; | |
| 284 | - display: flex; | |
| 285 | - justify-content: center; | |
| 286 | - align-items: center; | |
| 378 | +>>> .el-calendar-day { | |
| 379 | + height: auto; | |
| 380 | + display: flex; | |
| 381 | + justify-content: center; | |
| 382 | + align-items: center; | |
| 287 | 383 | } |
| 288 | ->>>.el-calendar-day p{ | |
| 289 | - margin: 0; | |
| 290 | - text-align: center; | |
| 291 | - height: 40px; | |
| 292 | - width: 40px; | |
| 293 | - line-height: 40px; | |
| 384 | +>>> .el-calendar-day p { | |
| 385 | + margin: 0; | |
| 386 | + text-align: center; | |
| 387 | + height: 40px; | |
| 388 | + width: 40px; | |
| 389 | + line-height: 40px; | |
| 294 | 390 | } |
| 295 | ->>>.el-calendar-table .el-calendar-day:hover{ | |
| 296 | - background-color: transparent; | |
| 391 | +>>> .el-calendar-table .el-calendar-day:hover { | |
| 392 | + background-color: transparent; | |
| 297 | 393 | } |
| 298 | ->>>.el-calendar-table .el-calendar-day:hover p{ | |
| 299 | - background-color: #F2F8FE; | |
| 300 | - border-radius: 30%; | |
| 394 | +>>> .el-calendar-table .el-calendar-day:hover p { | |
| 395 | + background-color: #f2f8fe; | |
| 396 | + border-radius: 30%; | |
| 301 | 397 | } |
| 302 | ->>>.el-calendar-table td.is-selected{ | |
| 303 | - background-color: transparent; | |
| 398 | +>>> .el-calendar-table td.is-selected { | |
| 399 | + background-color: transparent; | |
| 304 | 400 | } |
| 305 | ->>>.el-calendar-table td.is-selected .el-calendar-day p{ | |
| 306 | - background-color: #F2F8FE; | |
| 307 | - border-radius: 30%; | |
| 401 | +>>> .el-calendar-table td.is-selected .el-calendar-day p { | |
| 402 | + background-color: #f2f8fe; | |
| 403 | + border-radius: 30%; | |
| 308 | 404 | } |
| 309 | ->>>.el-calendar-table td.is-today .el-calendar-day p{ | |
| 310 | - color: #fff; | |
| 311 | - background-color: #409EFF; | |
| 312 | - border-radius: 30%; | |
| 405 | +>>> .el-calendar-table td.is-today .el-calendar-day p { | |
| 406 | + color: #fff; | |
| 407 | + background-color: #409eff; | |
| 408 | + border-radius: 30%; | |
| 313 | 409 | } |
| 314 | ->>>.el-calendar-table td{ | |
| 315 | - border: none; | |
| 410 | +>>> .el-calendar-table td { | |
| 411 | + border: none; | |
| 316 | 412 | } |
| 317 | ->>>.el-calendar-table tr td:first-child{ | |
| 318 | - border-left: none; | |
| 413 | +>>> .el-calendar-table tr td:first-child { | |
| 414 | + border-left: none; | |
| 319 | 415 | } |
| 320 | ->>>.el-calendar-table tr:first-child td{ | |
| 321 | - border: none; | |
| 416 | +>>> .el-calendar-table tr:first-child td { | |
| 417 | + border: none; | |
| 322 | 418 | } |
| 323 | 419 | </style> |
| 324 | 420 | <style lang="scss" scoped> |
| ... | ... | @@ -383,6 +479,20 @@ export default { |
| 383 | 479 | } |
| 384 | 480 | </style> |
| 385 | 481 | <style lang="scss" scoped> |
| 482 | +.popover-list { | |
| 483 | + padding-left: 10px; | |
| 484 | + li { | |
| 485 | + list-style: none; | |
| 486 | + height: 40px; | |
| 487 | + line-height: 40px; | |
| 488 | + display: flex; | |
| 489 | + align-items: center; | |
| 490 | + border-top: 1px dashed #eaeaea; | |
| 491 | + span { | |
| 492 | + margin-right: 10px; | |
| 493 | + } | |
| 494 | + } | |
| 495 | +} | |
| 386 | 496 | .table-td-list { |
| 387 | 497 | display: flex; |
| 388 | 498 | align-items: center; | ... | ... |