LabPersonMatch.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. <!-- 实验室与人员匹配 -->
  2. <template>
  3. <div class="lab-person-card">
  4. <div class="card-header">
  5. <span class="card-title">{{ $t('literal.laboratoryAndPersonnelMatching') }}</span>
  6. <div class="header-right">
  7. <el-select v-model="valueYear" @change="topChange()" size="small" style="width:220px">
  8. <el-option
  9. v-for="dict in optionList"
  10. :key="dict.value"
  11. :label="dict.label"
  12. :value="dict.value"
  13. />
  14. </el-select>
  15. <!-- 分组按钮 -->
  16. <div class="table-top-button-box">
  17. <div>
  18. <p @click="checkButton(2)" :class="checkIndex == 2?'check-table-button':''">{{ $t('literal.graduateStudent') }}</p>
  19. <p @click="checkButton(3)" :class="checkIndex == 3?'check-table-button':''">{{ $t('literal.undergraduateStudent') }}</p>
  20. <!--<p @click="checkButton(1)" :class="checkIndex == 1?'check-table-button':''">教职工</p>-->
  21. </div>
  22. </div>
  23. <p class="export-btn export-btn--blue" @click="exportButton1()">
  24. <i class="el-icon-download"></i> {{ $t('literal.exportCollegeData') }}
  25. </p>
  26. <p class="export-btn export-btn--green" @click="exportButton2()">
  27. <i class="el-icon-download"></i> {{ $t('literal.exportLaboratoryPersonnelDetails') }}
  28. </p>
  29. </div>
  30. </div>
  31. <!-- 柱状图 -->
  32. <div class="chart-wrap">
  33. <p class="bar-chart" v-if="!chartData[0]" style="color:#999;font-size:14px;line-height:260px;text-align: center;">{{ $t('literal.noData') }}</p>
  34. <div class="bar-chart" v-if="chartData[0]" id="bar-chart" ref="barChart"></div>
  35. </div>
  36. <!-- 筛选 -->
  37. <div class="filter-row">
  38. <!--<el-cascader-->
  39. <!--v-if="adminType == 1"-->
  40. <!--style="width: 180px"-->
  41. <!--clearable-->
  42. <!--v-model="queryParams.deptId"-->
  43. <!--:options="optionListA"-->
  44. <!--:props="{-->
  45. <!--emitPath:false,-->
  46. <!--checkStrictly: true,-->
  47. <!--value: 'deptId',-->
  48. <!--label: 'deptName',-->
  49. <!--children: 'child',-->
  50. <!--}"-->
  51. <!--:show-all-levels="false"-->
  52. <!--filterable-->
  53. <!--placeholder="筛选学院"-->
  54. <!--@change="examElStatisticsLabList"-->
  55. <!--&gt;</el-cascader>-->
  56. <el-select v-if="adminType == 1" v-model="queryParams.deptId" clearable @change="checkButtonFunction" :placeholder="$t('literal.college')" style="width: 180px">
  57. <el-option
  58. v-for="dict in optionListA"
  59. :key="dict.deptId"
  60. :label="dict.deptName"
  61. :value="dict.deptId"
  62. />
  63. </el-select>
  64. <!--<el-select v-model="queryParams.levelId" clearable @change="checkButtonFunction" placeholder="实验室等级" style="width:200px;">-->
  65. <!--<el-option v-for="item in optionListB" :key="item.levelId" :label="item.titleName"-->
  66. <!--:value="item.levelId"/>-->
  67. <!--</el-select>-->
  68. </div>
  69. <!-- 表格 -->
  70. <div class="page-content-box">
  71. <el-table class="table-box" :data="tableData" border size="small">
  72. <el-table-column prop="deptName" :label="$t('literal.college')" >
  73. <template slot-scope="scope">
  74. <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.deptName}}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column prop="level1Count" :label="$t('literal.levelIParticipants')" width="120" align="center" >
  78. <template slot-scope="scope">
  79. <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.level1Count}}</span>
  80. </template>
  81. </el-table-column>
  82. <el-table-column prop="level2Count" :label="$t('literal.levelIiParticipants')" width="120" align="center" >
  83. <template slot-scope="scope">
  84. <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.level2Count}}</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column prop="level3Count" :label="$t('literal.levelIiiParticipants')" width="120" align="center" >
  88. <template slot-scope="scope">
  89. <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.level3Count}}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column prop="level4Count" :label="$t('literal.levelIvParticipants')" width="120" align="center" >
  93. <template slot-scope="scope">
  94. <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.level4Count}}</span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column prop="noLabNeedCount" v-if="checkIndex == 2" :label="$t('literal.participantsNotRequiringLaboratoryAccess')" width="160" align="center">
  98. <template slot-scope="scope">
  99. <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.noLabNeedCount}}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column prop="unboundCount" v-if="checkIndex == 2" :label="$t('literal.numberOfUnmatchedUsers')" width="140" align="center">
  103. <template slot-scope="scope">
  104. <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.unboundCount}}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column prop="unboundCount" v-if="checkIndex == 3" :label="$t('literal.numberOfUnmatchedUsers')" width="140" align="center">
  108. <template slot-scope="scope">
  109. <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.unboundCount}}</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column prop="totalCount" :label="$t('literal.totalParticipants')" width="140" align="center">
  113. <template slot-scope="scope">
  114. <span :style="scope.row.type == 2?'color:#184c93;font-weight:700;':''">{{scope.row.totalCount}}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column :label="$t('tableTitle.action')" width="160" show-overflow-tooltip>
  118. <template slot-scope="scope">
  119. <div class="table-button-box">
  120. <p class="table-button-null"></p>
  121. <p class="table-button-p"
  122. @click="tableButton(1,scope.row)"
  123. >{{scope.row.deptId?$t('literal.personnelDetails'):$t('literal.allDetails')}}</p>
  124. <p class="table-button-null"></p>
  125. </div>
  126. </template>
  127. </el-table-column>
  128. </el-table>
  129. <pagination :page-sizes="[20, 30, 40, 50]"
  130. v-show="total>0"
  131. :total="total"
  132. :page.sync="queryParams.page"
  133. :limit.sync="queryParams.pageSize"
  134. @pagination="examElStatisticsLabList"
  135. />
  136. </div>
  137. <el-drawer
  138. size="100%"
  139. custom-class="labPersonMatch-index-drawer"
  140. :append-to-body="true"
  141. :title="drawerTitle"
  142. ref="drawer"
  143. :visible.sync="drawer"
  144. @close="drawerReturnButton"
  145. direction="rtl">
  146. <userListPage :drawerPropsData="drawerPropsData" v-if="drawerType == 1"></userListPage>
  147. </el-drawer>
  148. </div>
  149. </template>
  150. <script>
  151. import echarts from 'echarts'
  152. import {
  153. systemUserGetPost,
  154. } from "@/api/basicsModules/index";
  155. import {
  156. examElStatisticsLabChart,examElStatisticsLabList,examElStatisticsGetAcademicYear,
  157. laboratoryLevelConfigGetLevelTitleList,systemDeptCurrentDept,
  158. } from "@/api/safetyEducationExaminationNew/index";
  159. import userListPage from "./userListPage.vue";
  160. export default {
  161. name: 'LabPersonMatch',
  162. components: {
  163. userListPage,
  164. },
  165. data() {
  166. return {
  167. adminType:0,
  168. optionList:[],
  169. optionListA:[],
  170. optionListB:[],
  171. valueYear:'',
  172. checkIndex:2,
  173. queryParams:{
  174. page:1,
  175. pageSize:20,
  176. deptId:'',
  177. levelId:'',
  178. },
  179. chartData: [],
  180. tableData: [],
  181. total:0,
  182. //弹窗相关
  183. drawerTitle: '',
  184. drawerType: '',
  185. drawer: false,
  186. drawerPropsData:{},
  187. }
  188. },
  189. mounted() {
  190. this.systemUserGetPost();
  191. },
  192. beforeDestroy() {
  193. if (this._barChart) this._barChart.dispose()
  194. },
  195. methods: {
  196. //操作按钮
  197. tableButton(type,row){
  198. if(type == 1){
  199. this.$set(this, 'drawerTitle', this.$t('literal.laboratoryMatchedPersonnelDetails'))
  200. let obj = {
  201. adminType:this.adminType,
  202. valueYear:this.valueYear,
  203. personType:this.checkIndex,
  204. deptId:row.deptId,
  205. }
  206. this.$set(this, 'drawerPropsData', obj)
  207. this.$set(this, 'drawerType', 1)
  208. this.$set(this, 'drawer', true)
  209. }
  210. },
  211. //弹窗返回
  212. drawerReturnButton(){
  213. this.$set(this, 'drawerType', 0)
  214. },
  215. //查询当前登录用户身份-校级/院级
  216. systemUserGetPost(){
  217. systemUserGetPost({}).then(response => {
  218. for(let i=0;i<response.data.length;i++){
  219. if(response.data[i].postCode == 'school_level_admin'){
  220. if(response.data[i].isPost){
  221. this.$set(this,'adminType','1');
  222. }
  223. }else if(response.data[i].postCode == 'college_admin'){
  224. if(response.data[i].isPost){
  225. this.$set(this,'adminType','2');
  226. }
  227. }
  228. }
  229. this.examElStatisticsGetAcademicYear();
  230. this.laboratoryLevelConfigGetLevelTitleList();
  231. this.systemDeptCurrentDept();
  232. });
  233. },
  234. //顶部学年切换
  235. topChange(){
  236. this.examElStatisticsLabChart();
  237. this.examElStatisticsLabList();
  238. },
  239. //身份切换
  240. checkButton(val){
  241. if(this.checkIndex!=val){
  242. this.$set(this,'checkIndex',val);
  243. this.examElStatisticsLabChart();
  244. this.examElStatisticsLabList();
  245. }
  246. },
  247. checkButtonFunction(){
  248. this.examElStatisticsLabChart();
  249. this.examElStatisticsLabList();
  250. },
  251. //导出
  252. exportButton1(){
  253. let self = this;
  254. self.$confirm(this.$t('literal.confirmExportCollegeData'), this.$t('literal.notice'), {
  255. confirmButtonText: this.$t('literal.confirm'),
  256. cancelButtonText: this.$t('literal.cancel'),
  257. type: "warning"
  258. }).then(async () => {
  259. let obj = {
  260. academicYear:this.valueYear,
  261. personType:this.checkIndex,
  262. examTypeId:this.queryParams.examTypeId,
  263. };
  264. if(this.adminType == 1){
  265. obj.deptId = this.queryParams.deptId;
  266. }else{
  267. obj.deptId = localStorage.getItem('deptId');
  268. }
  269. self.download('/exam/elStatistics/lab/export', {...obj}, this.$t('literal.labPersonMatchByCollegeExport'))
  270. }).catch(() => {})
  271. },
  272. exportButton2(){
  273. let self = this;
  274. self.$confirm(this.$t('literal.confirmExportLabPersonnelDetails'), this.$t('literal.notice'), {
  275. confirmButtonText: this.$t('literal.confirm'),
  276. cancelButtonText: this.$t('literal.cancel'),
  277. type: "warning"
  278. }).then(async () => {
  279. let obj = {
  280. academicYear:this.valueYear,
  281. personType:this.checkIndex,
  282. examTypeId:this.queryParams.examTypeId,
  283. };
  284. if(this.adminType == 1){
  285. obj.deptId = this.queryParams.deptId;
  286. }else{
  287. obj.deptId = localStorage.getItem('deptId');
  288. }
  289. self.download('/exam/elStatistics/lab/detail-export', {...obj}, this.$t('literal.labPersonMatchDetailsExport'))
  290. }).catch(() => {})
  291. },
  292. initBarChart() {
  293. const chart = echarts.init(this.$refs.barChart)
  294. this._barChart = chart
  295. const data = this.chartData
  296. let num = 0;
  297. for(let i=0;i<data.length;i++){
  298. if(data[i].count>num){
  299. num = data[i].count
  300. }
  301. }
  302. chart.setOption({
  303. grid: { top: 30, bottom: 20, left: 50, right: 30, containLabel: false },
  304. xAxis: {
  305. type: 'category',
  306. data: data.map(d => d.levelName),
  307. axisLine: { lineStyle: { color: '#e0e0e0' } },
  308. axisTick: { show: false },
  309. axisLabel: { fontSize: 12, color: '#666' },
  310. },
  311. yAxis: {
  312. type: 'value',
  313. max: (value) => {
  314. // value.max 是三个 series 中的最大值,向上取整到 50 的倍数
  315. return Math.ceil(value.max / 50) * 50
  316. },
  317. splitNumber:5,
  318. splitLine: { lineStyle: { color: '#f0f0f0' } },
  319. axisLabel: { fontSize: 11, color: '#aaa' },
  320. axisLine: { show: false },
  321. axisTick: { show: false },
  322. },
  323. series: [
  324. {
  325. type: 'bar',
  326. barWidth: 60,
  327. data: data.map(d => ({
  328. value: d.count,
  329. itemStyle: { color: d.levelColor },
  330. })),
  331. label: {
  332. show: true,
  333. position: 'top',
  334. fontSize: 12,
  335. fontWeight: 700,
  336. color: '#555',
  337. formatter: '{c}',
  338. },
  339. },
  340. ],
  341. tooltip: {
  342. trigger: 'axis',
  343. axisPointer: { type: 'shadow' },
  344. formatter: (params) => `${params[0].name}: ${params[0].value}`,
  345. },
  346. })
  347. },
  348. //图表
  349. examElStatisticsLabChart() {
  350. let obj = {
  351. academicYear:this.valueYear,
  352. personType:this.checkIndex,
  353. };
  354. if(this.adminType == 1){
  355. obj.deptId = this.queryParams.deptId;
  356. }else{
  357. obj.deptId = localStorage.getItem('deptId');
  358. }
  359. examElStatisticsLabChart(obj).then(response => {
  360. this.$set(this, 'chartData', response.data)
  361. if(response.data[0]){
  362. this.$nextTick(() => {
  363. this.initBarChart()
  364. })
  365. }
  366. })
  367. },
  368. //列表
  369. examElStatisticsLabList() {
  370. let obj = JSON.parse(JSON.stringify(this.queryParams))
  371. obj.academicYear = this.valueYear;
  372. obj.personType = this.checkIndex;
  373. if(this.adminType == 1){
  374. obj.deptId = this.queryParams.deptId;
  375. }else{
  376. obj.deptId = localStorage.getItem('deptId');
  377. }
  378. examElStatisticsLabList(obj).then(response => {
  379. response.data.schoolSummary.type = 2
  380. let list = [];
  381. if(this.adminType == 1&&!this.queryParams.deptId){
  382. list = response.data.records.concat([response.data.schoolSummary]);
  383. }else{
  384. list = response.data.records;
  385. }
  386. this.$set(this, 'tableData', list)
  387. this.$set(this,'total',response.data.total);
  388. })
  389. },
  390. //查询风险等级
  391. laboratoryLevelConfigGetLevelTitleList() {
  392. laboratoryLevelConfigGetLevelTitleList({}).then(response => {
  393. this.$set(this, 'optionListB', response.data)
  394. })
  395. },
  396. //学院列表
  397. systemDeptCurrentDept(){
  398. systemDeptCurrentDept({}).then(response => {
  399. const list = response.data || [];
  400. this.formatTreeData(list);
  401. if(list[0]){
  402. this.$set(this,'optionListA',list[0].child);
  403. }else{
  404. this.$set(this,'optionListA',[]);
  405. }
  406. });
  407. },
  408. //学年列表
  409. examElStatisticsGetAcademicYear(){
  410. examElStatisticsGetAcademicYear({}).then(response => {
  411. this.$set(this,'optionList',response.data);
  412. this.$set(this,'valueYear',response.data[0].value);
  413. this.examElStatisticsLabChart();
  414. this.examElStatisticsLabList();
  415. });
  416. },
  417. }
  418. }
  419. </script>
  420. <style scoped lang="scss">
  421. .lab-person-card {
  422. background: #fff;
  423. /*border-radius: 6px;*/
  424. padding: 20px;
  425. margin-bottom: 12px;
  426. /*box-shadow: 0 1px 4px rgba(0,0,0,0.06);*/
  427. background: rgba(255, 255, 255, 0.95);
  428. border: 1px solid #e8edf5;
  429. border-radius: 16px;
  430. box-shadow: 0 4px 20px rgba(37, 50, 74, 0.06);
  431. .card-header {
  432. display: flex;
  433. justify-content: space-between;
  434. align-items: center;
  435. margin-bottom: 16px;
  436. .card-title { font-size: 16px; font-weight: 700; color: #222; }
  437. .header-right { display: flex; gap: 20px; }
  438. }
  439. /* 分组筛选按钮 */
  440. .table-top-button-box {
  441. display: inline-block;
  442. vertical-align: top;
  443. div {
  444. display: flex;
  445. p {
  446. border: 1px solid #DCDFE6;
  447. padding:0 20px;
  448. text-align: center;
  449. height: 40px;
  450. line-height: 40px;
  451. cursor: pointer;
  452. font-size: 14px;
  453. &:nth-child(1) { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
  454. /*&:nth-child(2) { border-left: none; border-right: none; }*/
  455. &:nth-child(2) { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
  456. &:nth-child(3) { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
  457. }
  458. .check-table-button{
  459. border: 1px solid #0183fa!important;
  460. background-color: #0183fa!important;;
  461. color:#fff!important;;
  462. }
  463. }
  464. }
  465. .export-btn {
  466. display: inline-block;
  467. padding: 0 16px;
  468. height: 40px;
  469. line-height: 40px;
  470. border-radius: 4px;
  471. font-size: 14px;
  472. cursor: pointer;
  473. color: #fff;
  474. &--blue { background-color: #0183fa; border: 1px solid #0183fa; }
  475. &--green { background-color: #00B176; border: 1px solid #00B176; }
  476. }
  477. .chart-wrap {
  478. border: 1px solid #eee;
  479. border-radius: 6px;
  480. padding: 20px 20px 30px;
  481. margin-bottom: 16px;
  482. .bar-chart {
  483. height: 260px;
  484. }
  485. }
  486. .filter-row {
  487. display: flex;
  488. gap: 20px;
  489. margin-bottom: 12px;
  490. }
  491. .page-content-box{
  492. height:500px;
  493. padding:0;
  494. }
  495. .total-link { color: #409eff; }
  496. }
  497. </style>
  498. <style lang="scss">
  499. .labPersonMatch-index-drawer{
  500. .el-drawer__body{
  501. padding:0;
  502. }
  503. .el-drawer__header{
  504. margin:0;
  505. }
  506. }
  507. </style>