|
@@ -1,30 +1,123 @@
|
|
|
<script setup lang="ts">
|
|
|
+import request from '@/config/axios'
|
|
|
import BarList from './BarList.vue'
|
|
|
/**
|
|
|
* 板块领导-人员情况
|
|
|
*/
|
|
|
-const personList = [
|
|
|
- {
|
|
|
- name: '博士',
|
|
|
- value: '1'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '硕士',
|
|
|
- value: '32'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '本科',
|
|
|
- value: '214'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '大专',
|
|
|
- value: '27'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '大专以下',
|
|
|
- value: '5'
|
|
|
+interface ChartValueType {
|
|
|
+ name: string
|
|
|
+ value: number
|
|
|
+}
|
|
|
+const barList = ref<ChartValueType[]>([])
|
|
|
+const staffNum = ref<number>()
|
|
|
+const boyStaffNum = ref<number>(0)
|
|
|
+const girlStaffNum = ref<number>(0)
|
|
|
+const degreeStatistic = reactive<{
|
|
|
+ ordinaryCollegeStaffNum: number
|
|
|
+ firstClassCollegeStaffNum: number
|
|
|
+ list: ChartValueType[]
|
|
|
+}>({
|
|
|
+ ordinaryCollegeStaffNum: 0,
|
|
|
+ firstClassCollegeStaffNum: 0,
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ name: '博士',
|
|
|
+ value: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '硕士',
|
|
|
+ value: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '本科',
|
|
|
+ value: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '大专',
|
|
|
+ value: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '大专以下',
|
|
|
+ value: 0
|
|
|
+ }
|
|
|
+ ]
|
|
|
+})
|
|
|
+const staffStatistic = reactive<{
|
|
|
+ formalStaffNum: number
|
|
|
+ traineeStaffNum: number
|
|
|
+ probationaryStaffNum: number
|
|
|
+ temporaryStaffNum: number
|
|
|
+ list: ChartValueType[]
|
|
|
+}>({
|
|
|
+ formalStaffNum: 0,
|
|
|
+ traineeStaffNum: 0,
|
|
|
+ probationaryStaffNum: 0,
|
|
|
+ temporaryStaffNum: 0,
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ name: '小于25',
|
|
|
+ value: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '25-30',
|
|
|
+ value: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '30-35',
|
|
|
+ value: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '35-40',
|
|
|
+ value: 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '大于40',
|
|
|
+ value: 0
|
|
|
+ }
|
|
|
+ ]
|
|
|
+})
|
|
|
+const queryStaffStatistic = async (): Promise<void> => {
|
|
|
+ const urlApi = `/adm/staff-records/statistic/get`
|
|
|
+ const result = await request.get({ url: urlApi })
|
|
|
+ staffNum.value = result.staffNum ?? 0
|
|
|
+ if (result.sexStatistic) {
|
|
|
+ boyStaffNum.value = result.sexStatistic.boyStaffNum ?? 0
|
|
|
+ girlStaffNum.value = result.sexStatistic.girlStaffNum ?? 0
|
|
|
+ }
|
|
|
+ if (result.degreeStatistic) {
|
|
|
+ degreeStatistic.ordinaryCollegeStaffNum = result.ordinaryCollegeStaffNum ?? 0
|
|
|
+ degreeStatistic.firstClassCollegeStaffNum = result.firstClassCollegeStaffNum ?? 0
|
|
|
+ degreeStatistic.list[0].value = result.degreeStatistic.doctorStaffNum
|
|
|
+ degreeStatistic.list[1].value = result.degreeStatistic.masterStaffNum
|
|
|
+ degreeStatistic.list[2].value = result.degreeStatistic.undergraduateStaffNum
|
|
|
+ degreeStatistic.list[3].value = result.degreeStatistic.juniorCollegeStaffNum
|
|
|
+ degreeStatistic.list[4].value = result.degreeStatistic.belowJuniorCollegeStaffNum
|
|
|
+ }
|
|
|
+ if (result.typeStatistic) {
|
|
|
+ staffStatistic.formalStaffNum = result.typeStatistic.formalStaffNum ?? 0
|
|
|
+ staffStatistic.traineeStaffNum = result.typeStatistic.traineeStaffNum ?? 0
|
|
|
+ staffStatistic.probationaryStaffNum = result.typeStatistic.probationaryStaffNum ?? 0
|
|
|
+ staffStatistic.probationaryStaffNum = result.typeStatistic.probationaryStaffNum ?? 0
|
|
|
}
|
|
|
-]
|
|
|
+ if (result.ageStatistic) {
|
|
|
+ staffStatistic.list[0].value = result.ageStatistic.underTwentyFiveStaffNum
|
|
|
+ staffStatistic.list[1].value = result.ageStatistic.twentyFiveToThirtyStaffNum
|
|
|
+ staffStatistic.list[2].value = result.ageStatistic.thirtyToThirtyFiveStaffNum
|
|
|
+ staffStatistic.list[3].value = result.ageStatistic.thirtyFiveToFortyStaffNum
|
|
|
+ staffStatistic.list[4].value = result.ageStatistic.overFortyStaffNum
|
|
|
+ }
|
|
|
+ switchListData(0)
|
|
|
+}
|
|
|
+queryStaffStatistic()
|
|
|
+
|
|
|
+const currentIndex = ref<number>(0)
|
|
|
+const clickHandle = (index: number): void => {
|
|
|
+ currentIndex.value = index
|
|
|
+ switchListData()
|
|
|
+}
|
|
|
+const switchListData = (): void => {
|
|
|
+ barList.value = currentIndex.value === 0 ? degreeStatistic.list : staffStatistic.list
|
|
|
+}
|
|
|
</script>
|
|
|
<template>
|
|
|
<div class="card-person">
|
|
@@ -32,37 +125,62 @@ const personList = [
|
|
|
<li>
|
|
|
<i></i>
|
|
|
<span>总计</span>
|
|
|
- <span><b>279</b>人</span>
|
|
|
+ <span
|
|
|
+ ><b>{{ staffNum }}</b
|
|
|
+ >人</span
|
|
|
+ >
|
|
|
</li>
|
|
|
<li>
|
|
|
<i></i>
|
|
|
<span>男生</span>
|
|
|
- <span><b>163</b>人</span>
|
|
|
+ <span
|
|
|
+ ><b> {{ boyStaffNum }} </b>人</span
|
|
|
+ >
|
|
|
</li>
|
|
|
<li>
|
|
|
<i></i>
|
|
|
<span>女生</span>
|
|
|
- <span><b>116</b>人</span>
|
|
|
+ <span
|
|
|
+ ><b> {{ girlStaffNum }} </b>人</span
|
|
|
+ >
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div class="card-person-chart">
|
|
|
<div class="card-person-chart-l card-flex-col-center">
|
|
|
- <span>学历构成</span>
|
|
|
- <span>工龄司龄</span>
|
|
|
+ <span @click="clickHandle(0)" :class="{ active: currentIndex === 0 }">学历构成</span>
|
|
|
+ <span @click="clickHandle(1)" :class="{ active: currentIndex === 1 }">工龄司龄</span>
|
|
|
</div>
|
|
|
- <div class="card-person-chart-m card-flex-col-center">
|
|
|
+ <div class="card-person-chart-m card-flex-col-center" v-if="currentIndex === 0">
|
|
|
<div class="school">
|
|
|
<span><i></i>普通院校</span>
|
|
|
- <span><b>198</b>人</span>
|
|
|
+ <span>
|
|
|
+ <b> {{ degreeStatistic.ordinaryCollegeStaffNum }} </b>人
|
|
|
+ </span>
|
|
|
</div>
|
|
|
<div class="school">
|
|
|
<span><i></i>双一流院校</span>
|
|
|
- <span><b>81</b>人</span>
|
|
|
+ <span>
|
|
|
+ <b> {{ degreeStatistic.firstClassCollegeStaffNum }} </b>人
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="card-person-chart-m card-flex-col-center" v-else>
|
|
|
+ <div class="school">
|
|
|
+ <span><i></i>正式员工</span>
|
|
|
+ <span>
|
|
|
+ <b> {{ staffStatistic.formalStaffNum }} </b>人
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="school">
|
|
|
+ <span><i></i>实习员工</span>
|
|
|
+ <span>
|
|
|
+ <b> {{ staffStatistic.traineeStaffNum }} </b>人
|
|
|
+ </span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="width: 60%">
|
|
|
- <BarList :list="personList" unit="人" />
|
|
|
+ <BarList :list="barList" unit="人" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -151,11 +269,17 @@ const personList = [
|
|
|
color: #fff;
|
|
|
border: solid 1px rgb(46 119 230 / 100%);
|
|
|
border-radius: 4px;
|
|
|
-
|
|
|
- &:nth-child(1) {
|
|
|
- background: linear-gradient(0deg, rgb(46 119 230 / 100%) 0%, rgb(149 191 255 / 100%) 100%);
|
|
|
+ cursor: pointer;
|
|
|
+ &.active {
|
|
|
+ background: linear-gradient(
|
|
|
+ 0deg,
|
|
|
+ rgb(46 119 230 / 100%) 0%,
|
|
|
+ rgb(149 191 255 / 100%) 100%
|
|
|
+ ) !important;
|
|
|
+ color: #fff !important;
|
|
|
}
|
|
|
|
|
|
+ &:nth-child(1),
|
|
|
&:nth-child(2) {
|
|
|
margin-top: 8px;
|
|
|
color: #000000;
|