| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523 |
- <!-- 实验室与人员匹配 -->
- <template>
- <div class="lab-person-card">
- <div class="card-header">
- <span class="card-title">实验室与人员匹配</span>
- <div class="header-right">
- <el-select v-model="valueYear" @change="topChange()" size="small" style="width:220px">
- <el-option
- v-for="dict in optionList"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- <!-- 分组按钮 -->
- <div class="table-top-button-box">
- <div>
- <p @click="checkButton(2)" :class="checkIndex == 2?'check-table-button':''">研究生</p>
- <p @click="checkButton(3)" :class="checkIndex == 3?'check-table-button':''">本科生</p>
- <!--<p @click="checkButton(1)" :class="checkIndex == 1?'check-table-button':''">教职工</p>-->
- </div>
- </div>
- <p class="export-btn export-btn--blue" @click="exportButton1()">
- <i class="el-icon-download"></i> 导出各学院数据
- </p>
- <p class="export-btn export-btn--green" @click="exportButton2()">
- <i class="el-icon-download"></i> 导出实验室人员明细
- </p>
- </div>
- </div>
- <!-- 柱状图 -->
- <div class="chart-wrap">
- <p class="bar-chart" v-if="!chartData[0]" style="color:#999;font-size:14px;line-height:260px;text-align: center;">暂无数据</p>
- <div class="bar-chart" v-if="chartData[0]" id="bar-chart" ref="barChart"></div>
- </div>
- <!-- 筛选 -->
- <div class="filter-row">
- <!--<el-cascader-->
- <!--v-if="adminType == 1"-->
- <!--style="width: 180px"-->
- <!--clearable-->
- <!--v-model="queryParams.deptId"-->
- <!--:options="optionListA"-->
- <!--:props="{-->
- <!--emitPath:false,-->
- <!--checkStrictly: true,-->
- <!--value: 'deptId',-->
- <!--label: 'deptName',-->
- <!--children: 'child',-->
- <!--}"-->
- <!--:show-all-levels="false"-->
- <!--filterable-->
- <!--placeholder="筛选学院"-->
- <!--@change="examElStatisticsLabList"-->
- <!--></el-cascader>-->
- <el-select v-if="adminType == 1" v-model="queryParams.deptId" clearable @change="checkButtonFunction" placeholder="学院" style="width: 180px">
- <el-option
- v-for="dict in optionListA"
- :key="dict.deptId"
- :label="dict.deptName"
- :value="dict.deptId"
- />
- </el-select>
- <!--<el-select v-model="queryParams.levelId" clearable @change="checkButtonFunction" placeholder="实验室等级" style="width:200px;">-->
- <!--<el-option v-for="item in optionListB" :key="item.levelId" :label="item.titleName"-->
- <!--:value="item.levelId"/>-->
- <!--</el-select>-->
- </div>
- <!-- 表格 -->
- <div class="page-content-box">
- <el-table class="table-box" :data="tableData" border size="small">
- <el-table-column prop="deptName" label="学院" >
- <template slot-scope="scope">
- <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.deptName}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="level1Count" label="Ⅰ级人数" width="120" align="center" >
- <template slot-scope="scope">
- <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.level1Count}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="level2Count" label="Ⅱ级人数" width="120" align="center" >
- <template slot-scope="scope">
- <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.level2Count}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="level3Count" label="Ⅲ级人数" width="120" align="center" >
- <template slot-scope="scope">
- <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.level3Count}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="level4Count" label="Ⅳ级人数" width="120" align="center" >
- <template slot-scope="scope">
- <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.level4Count}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="noLabNeedCount" v-if="checkIndex == 2" label="无需进入实验室人数" width="160" align="center">
- <template slot-scope="scope">
- <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.noLabNeedCount}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="unboundCount" v-if="checkIndex == 2" label="未匹配人数" width="140" align="center">
- <template slot-scope="scope">
- <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.unboundCount}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="unboundCount" v-if="checkIndex == 3" label="未匹配人数" width="140" align="center">
- <template slot-scope="scope">
- <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.unboundCount}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="totalCount" label="总人数" width="140" align="center">
- <template slot-scope="scope">
- <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.totalCount}}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="160" show-overflow-tooltip>
- <template slot-scope="scope">
- <div class="table-button-box">
- <p class="table-button-null"></p>
- <p class="table-button-p"
- v-if="adminType == 1"
- @click="tableButton(1,scope.row)"
- >{{scope.row.deptId?'人员明细':'全部明细'}}</p>
- <p class="table-button-null"></p>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination :page-sizes="[20, 30, 40, 50]"
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.page"
- :limit.sync="queryParams.pageSize"
- @pagination="examElStatisticsLabList"
- />
- </div>
- <el-drawer
- size="100%"
- custom-class="labPersonMatch-index-drawer"
- :append-to-body="true"
- :title="drawerTitle"
- ref="drawer"
- :visible.sync="drawer"
- @close="drawerReturnButton"
- direction="rtl">
- <userListPage :drawerPropsData="drawerPropsData" v-if="drawerType == 1"></userListPage>
- </el-drawer>
- </div>
- </template>
- <script>
- import echarts from 'echarts'
- import {
- systemUserGetPost,
- } from "@/api/basicsModules/index";
- import {
- examElStatisticsLabChart,examElStatisticsLabList,examElStatisticsGetAcademicYear,
- laboratoryLevelConfigGetLevelTitleList,systemDeptCurrentDept,
- } from "@/api/safetyEducationExaminationNew/index";
- import userListPage from "./userListPage.vue";
- export default {
- name: 'LabPersonMatch',
- components: {
- userListPage,
- },
- data() {
- return {
- adminType:0,
- optionList:[],
- optionListA:[],
- optionListB:[],
- valueYear:'',
- checkIndex:2,
- queryParams:{
- page:1,
- pageSize:20,
- deptId:'',
- levelId:'',
- },
- chartData: [],
- tableData: [],
- total:0,
- //弹窗相关
- drawerTitle: '',
- drawerType: '',
- drawer: false,
- drawerPropsData:{},
- }
- },
- mounted() {
- this.systemUserGetPost();
- },
- beforeDestroy() {
- if (this._barChart) this._barChart.dispose()
- },
- methods: {
- //操作按钮
- tableButton(type,row){
- if(type == 1){
- this.$set(this, 'drawerTitle', '实验室匹配人员明细')
- let obj = {
- adminType:this.adminType,
- valueYear:this.valueYear,
- personType:this.checkIndex,
- deptId:row.deptId,
- }
- this.$set(this, 'drawerPropsData', obj)
- this.$set(this, 'drawerType', 1)
- this.$set(this, 'drawer', true)
- }
- },
- //弹窗返回
- drawerReturnButton(){
- this.$set(this, 'drawerType', 0)
- },
- //查询当前登录用户身份-校级/院级
- systemUserGetPost(){
- systemUserGetPost({}).then(response => {
- for(let i=0;i<response.data.length;i++){
- if(response.data[i].postCode == 'school_level_admin'){
- if(response.data[i].isPost){
- this.$set(this,'adminType','1');
- }
- }else if(response.data[i].postCode == 'college_admin'){
- if(response.data[i].isPost){
- this.$set(this,'adminType','2');
- }
- }
- }
- this.examElStatisticsGetAcademicYear();
- this.laboratoryLevelConfigGetLevelTitleList();
- this.systemDeptCurrentDept();
- });
- },
- //顶部学年切换
- topChange(){
- this.examElStatisticsLabChart();
- this.examElStatisticsLabList();
- },
- //身份切换
- checkButton(val){
- if(this.checkIndex!=val){
- this.$set(this,'checkIndex',val);
- this.examElStatisticsLabChart();
- this.examElStatisticsLabList();
- }
- },
- checkButtonFunction(){
- this.examElStatisticsLabChart();
- this.examElStatisticsLabList();
- },
- //导出
- exportButton1(){
- let self = this;
- self.$confirm(`确认导出各学院数据?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(async () => {
- let obj = {
- academicYear:this.valueYear,
- personType:this.checkIndex,
- examTypeId:this.queryParams.examTypeId,
- };
- if(this.adminType == 1){
- obj.deptId = this.queryParams.deptId;
- }else{
- obj.deptId = localStorage.getItem('deptId');
- }
- self.download('/exam/elStatistics/lab/export', {...obj}, '实验室与人员匹配学院数据.xlsx')
- }).catch(() => {})
- },
- exportButton2(){
- let self = this;
- self.$confirm(`确认导出实验室人员明细?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(async () => {
- let obj = {
- academicYear:this.valueYear,
- personType:this.checkIndex,
- examTypeId:this.queryParams.examTypeId,
- };
- if(this.adminType == 1){
- obj.deptId = this.queryParams.deptId;
- }else{
- obj.deptId = localStorage.getItem('deptId');
- }
- self.download('/exam/elStatistics/lab/detail-export', {...obj}, '实验室与人员匹配实验室人员明细.xlsx')
- }).catch(() => {})
- },
- initBarChart() {
- const chart = echarts.init(this.$refs.barChart)
- this._barChart = chart
- const data = this.chartData
- let num = 0;
- for(let i=0;i<data.length;i++){
- if(data[i].count>num){
- num = data[i].count
- }
- }
- chart.setOption({
- grid: { top: 30, bottom: 20, left: 50, right: 30, containLabel: false },
- xAxis: {
- type: 'category',
- data: data.map(d => d.levelName),
- axisLine: { lineStyle: { color: '#e0e0e0' } },
- axisTick: { show: false },
- axisLabel: { fontSize: 12, color: '#666' },
- },
- yAxis: {
- type: 'value',
- max: (value) => {
- // value.max 是三个 series 中的最大值,向上取整到 50 的倍数
- return Math.ceil(value.max / 50) * 50
- },
- splitNumber:5,
- splitLine: { lineStyle: { color: '#f0f0f0' } },
- axisLabel: { fontSize: 11, color: '#aaa' },
- axisLine: { show: false },
- axisTick: { show: false },
- },
- series: [
- {
- type: 'bar',
- barWidth: 60,
- data: data.map(d => ({
- value: d.count,
- itemStyle: { color: d.levelColor },
- })),
- label: {
- show: true,
- position: 'top',
- fontSize: 12,
- fontWeight: 700,
- color: '#555',
- formatter: '{c}',
- },
- },
- ],
- tooltip: {
- trigger: 'axis',
- axisPointer: { type: 'shadow' },
- formatter: (params) => `${params[0].name}: ${params[0].value}`,
- },
- })
- },
- //图表
- examElStatisticsLabChart() {
- let obj = {
- academicYear:this.valueYear,
- personType:this.checkIndex,
- };
- if(this.adminType == 1){
- obj.deptId = this.queryParams.deptId;
- }else{
- obj.deptId = localStorage.getItem('deptId');
- }
- examElStatisticsLabChart(obj).then(response => {
- this.$set(this, 'chartData', response.data)
- if(response.data[0]){
- this.$nextTick(() => {
- this.initBarChart()
- })
- }
- })
- },
- //列表
- examElStatisticsLabList() {
- let obj = JSON.parse(JSON.stringify(this.queryParams))
- obj.academicYear = this.valueYear;
- obj.personType = this.checkIndex;
- if(this.adminType == 1){
- obj.deptId = this.queryParams.deptId;
- }else{
- obj.deptId = localStorage.getItem('deptId');
- }
- examElStatisticsLabList(obj).then(response => {
- response.data.schoolSummary.type = 2
- let list = [];
- if(this.adminType == 1&&!this.queryParams.deptId){
- list = response.data.records.concat([response.data.schoolSummary]);
- }else{
- list = response.data.records;
- }
- this.$set(this, 'tableData', list)
- this.$set(this,'total',response.data.total);
- })
- },
- //查询风险等级
- laboratoryLevelConfigGetLevelTitleList() {
- laboratoryLevelConfigGetLevelTitleList({}).then(response => {
- this.$set(this, 'optionListB', response.data)
- })
- },
- //学院列表
- systemDeptCurrentDept(){
- systemDeptCurrentDept({}).then(response => {
- const list = response.data || [];
- this.formatTreeData(list);
- if(list[0]){
- this.$set(this,'optionListA',list[0].child);
- }else{
- this.$set(this,'optionListA',[]);
- }
- });
- },
- //学年列表
- examElStatisticsGetAcademicYear(){
- examElStatisticsGetAcademicYear({}).then(response => {
- this.$set(this,'optionList',response.data);
- this.$set(this,'valueYear',response.data[0].value);
- this.examElStatisticsLabChart();
- this.examElStatisticsLabList();
- });
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .lab-person-card {
- background: #fff;
- /*border-radius: 6px;*/
- padding: 20px;
- margin-bottom: 12px;
- /*box-shadow: 0 1px 4px rgba(0,0,0,0.06);*/
- background: rgba(255, 255, 255, 0.95);
- border: 1px solid #e8edf5;
- border-radius: 16px;
- box-shadow: 0 4px 20px rgba(37, 50, 74, 0.06);
- .card-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 16px;
- .card-title { font-size: 16px; font-weight: 700; color: #222; }
- .header-right { display: flex; gap: 20px; }
- }
- /* 分组筛选按钮 */
- .table-top-button-box {
- display: inline-block;
- vertical-align: top;
- div {
- display: flex;
- p {
- border: 1px solid #DCDFE6;
- width: 80px;
- text-align: center;
- height: 40px;
- line-height: 40px;
- cursor: pointer;
- font-size: 14px;
- &:nth-child(1) { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
- /*&:nth-child(2) { border-left: none; border-right: none; }*/
- &:nth-child(2) { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
- &:nth-child(3) { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
- }
- .check-table-button{
- border: 1px solid #0183fa!important;
- background-color: #0183fa!important;;
- color:#fff!important;;
- }
- }
- }
- .export-btn {
- display: inline-block;
- padding: 0 16px;
- height: 40px;
- line-height: 40px;
- border-radius: 4px;
- font-size: 14px;
- cursor: pointer;
- color: #fff;
- &--blue { background-color: #0183fa; border: 1px solid #0183fa; }
- &--green { background-color: #00B176; border: 1px solid #00B176; }
- }
- .chart-wrap {
- border: 1px solid #eee;
- border-radius: 6px;
- padding: 20px 20px 30px;
- margin-bottom: 16px;
- .bar-chart {
- height: 260px;
- }
- }
- .filter-row {
- display: flex;
- gap: 20px;
- margin-bottom: 12px;
- }
- .page-content-box{
- height:500px;
- padding:0;
- }
- .total-link { color: #409eff; }
- }
- </style>
- <style lang="scss">
- .labPersonMatch-index-drawer{
- .el-drawer__body{
- padding:0;
- }
- .el-drawer__header{
- margin:0;
- }
- }
- </style>
|