Files
2026-09-08 19:49:21 +08:00

409 lines
18 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" class="platform" v-cloak>
<guava ref="guava" padding="0 5%">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">年度:</div>
<div class="search-item-option">
<el-date-picker
:clearable="true"
@change="yearChange"
placeholder="选择年"
type="year"
style="width: 100%;"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">体检项目:</div>
<div class="search-item-option">
<el-select @change="getHealthCheckupSubject();"
style="width: 100%;"
v-model="pageForm.projectId">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in projectOptions"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="请选择所属工会" v-model="pageForm.unionId"
style="width: 100%;"
:clearable="clearable"
@change="doSearch();getUnionGroup();"
filterable="true">
<el-option v-for="item in unions" :label="item.unionname"
:value="item.id"></el-option>
</el-select>
</div>
</div>
<!--<div class="search-item">
<div class="search-item-label">工会小组:</div>
<div class="search-item-option">
<el-select v-model="pageForm.unionGroupId" style="width: 100%"
filterable
:clearable="clearable"
@change="doSearch"
placeholder="请选择">
<el-option
v-for="item in unionGroups"
:key="item.id"
:label="item.groupName"
:value="item.id">
</el-option>
</el-select>
</div>
</div>-->
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索
</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="工会列表" :app="this" ref="table_tool">
<template #func>
<template
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H04')}">
<el-button :disabled="!pageForm.projectId" type="primary"
size="small"
icon="el-icon-printer"
@click="exportReceiveDetail()">按分工会导出已选名单
</el-button>
<el-button :disabled="!pageForm.projectId" type="primary"
size="small"
icon="el-icon-printer"
@click="exportUserCompanion()">导出家属名单
</el-button>
</template>
</template>
</table-tool>
<el-table :data="tableData" style="width: 100%" row-key="id"
@sort-change="pageOrder" :size="tableSize"
v-loading="tableLoading" ref="table" class="vi-table"
show-summary :summary-method="getSummaries">
<el-table-column align="center" header-align="center" type="index"
:index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:sortable="column.sortable"
:label="column.label"
:prop="column.prop" :width="column.width" min-width="100px">
<!--<template scope="{row}" v-if="column.prop=='unionname'">
({{row.unioncode}}){{row.unionname}}
</template>-->
<template scope="{row}" v-if="column.prop==='unselectedTeacherSum'">
<el-link @click="openUnclaimed(row.id)" type="primary">
{{row.unselectedTeacherSum}}
</el-link>
</template>
</el-table-column>
<el-table-column prop="userOnline" align="center" header-align="center"
label="操作" width="200px"
fixed="right">
<template scope="{row}">
<el-button @click="openView(row.id)" size="mini"
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H04')}"
type="primary">
查看已选人员
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</template>
<template #view>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-option">
<el-input placeholder="请输入内容" clearable
v-model="pageFormUnion.searchKeyword">
<el-select v-model="pageFormUnion.searchName" slot="prepend"
placeholder="查询类型"
@keyup.enter.native="doUnionSearch"
style="width: 80px;">
<el-option label="姓名" value="u.username"></el-option>
<el-option label="工号" value="u.loginname"></el-option>
</el-select>
</el-input>
</div>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doUnionSearch">搜索
</el-button>
</div>
</div>
</el-card>
<!-- <el-button type="primary"
class="pull-right"
icon="el-icon-printer"
@click="exportReceiveDetailByUnionId(true)">导出已选名单
</el-button>-->
<el-card shadow="never" class="mt10">
<div v-if="pageFormUnion.isSelected=='0'">
<vi-title title="已选人员"></vi-title>
</div>
<div v-else>
<vi-title title="未选人员"></vi-title>
</div>
<el-table :data="receive_tableData" style="width: 100%;height: 700px" row-key="id"
height="100%"
v-loading="tableLoading" class="vi-table" :size="tableSize">
<el-table-column type="index" width="50"></el-table-column>
<el-table-column
align="center"
v-for="column in receive_tableColumns"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
</el-table-column>
</el-table>
</el-card>
<el-row class="el-pagination-container" style="margin-bottom: 0px">
<el-pagination
@size-change="pageSizeChange"
@current-change="pageNumberChange"
:current-page="pageFormUnion.pageNumber"
:page-sizes="[5,10, 20, 30, 50]"
:page-size="pageFormUnion.pageSize"
layout="total, sizes, prev, pager, next"
:total="pageFormUnion.totalCount">
</el-pagination>
</el-row>
</template>
</guava>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
pageForm: {
year: moment().format('YYYY'),
},
pageFormUnion: {
pageNumber: 1,
pageSize: 10,
totalCount: null,
searchName: 'u.username',
//0:已选人员页面 1:未选人员页面
isSelected: '',
},
unions: [],
unionGroups: [],
projectOptions: [],
receive_tableColumns: [],
receive_tableData: [],
clearable: false,
tableColumns: [
{prop: 'unionname', label: '所属工会'},
{prop: 'sumCount', label: '本次体检人数'},
],
unioncode: null,
}
},
methods: {
async yearChange() {
const resp = await $.get("/platform/healthCheckup/project/mange/getHealthCheckupProject", {year: this.pageForm.year})
if (resp.code === 0) {
this.projectOptions = resp.data
if (resp.data && resp.data.length > 0) {
this.$set(this.pageForm, "projectId", resp.data[0].id)
} else {
this.$set(this.pageForm, "projectId", null)
}
await this.getHealthCheckupSubject()
} else {
this.notifyError(resp.msg)
}
},
async getHealthCheckupSubject() {
this.projectSubjectOptions = []
const resp = await $.get("/platform/healthCheckup/project/mange/findOne", {id: this.pageForm.projectId})
if (resp.code === 0) {
if (resp.data) {
this.projectSubjectOptions = resp.data.healthCheckupProjectSubjects
}
} else {
this.notifyError(resp.msg)
}
this.doSearch()
},
async getUnionGroup() {
if (this.pageForm.unionId) {
this.unionGroups = await unionGroupsByUnionId(this.pageForm.unionId)
} else {
this.unionGroups = []
this.$set(this.pageForm, "unionGroupId", null)
}
},
async pageData() {
this.tableColumns = []
const loading = this.$loading({
lock: true,
text: '努力加载中。。。',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
sublime.showLoadingbar()
this.tableColumns.push(
{prop: 'unionname', label: '所属工会'},
{prop: 'sumCount', label: '本次体检人数'}
)
if (this.projectSubjectOptions && this.projectSubjectOptions.length > 0) {
this.projectSubjectOptions.forEach(v => {
this.tableColumns.push({prop: v.optionName, label: v.optionName})
})
}
this.tableColumns.push(
{prop: "totalCount", label: "选取人数"},
{prop: "unselectedTeacherSum", label: "未选人数"}
)
this.$refs.table_tool.getColumns()
if (!this.pageForm.projectId) {
this.tableData = []
}
const resp = await $.post(loc() + '/pageData', this.pageForm)
sublime.closeLoadingbar()
if (resp.code === 0) {
this.tableData = resp.data.tableList
}
loading.close()
},
pageNumberChange(val) {
this.pageFormUnion.pageNumber = val;
this.pageUnionData();
},
pageSizeChange(val) {
this.pageFormUnion.pageSize = val;
this.pageUnionData();
},
async init() {
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('club01')}" === 'false' && ("${@shiro.hasRole('H04')}" === 'true' || "${@shiro.hasRole('ghxzzz')}" === 'true')) {
this.unions = await getUnionList("${@shiro.getPrincipalProperty('unit').getUnionid()}")
this.$set(this.pageForm, "unionId", this.unions[0].id)
await this.getUnionGroup()
if ("${@shiro.hasRole('ghxzzz')}" === 'true') {
this.$set(this.pageForm, "unionGroupId", this.unionGroups[0].id)
} else {
this.clearable = true
}
} else {
this.unions = await getUnions(null)
this.clearable = true
}
await this.yearChange()
},
//查看未选择人数
async openUnclaimed(unionId) {
this.pageFormUnion.isSelected = '1'
this.pageFormUnion.unionId = unionId
this.pageFormUnion.projectId = this.pageForm.projectId
await this.pageUnionData();
},
//查看已选人员
async openView(unionId) {
this.pageFormUnion.isSelected = '0'
this.pageFormUnion.unionId = unionId
this.pageFormUnion.projectId = this.pageForm.projectId
await this.pageUnionData();
},
async pageUnionData() {
const resp = await $.post(loc() + '/receivePageData', this.pageFormUnion)
if (resp.code === 0) {
this.$refs.guava.view()
this.receive_tableColumns = resp.data.label
this.receive_tableData = resp.data.list.list
this.pageFormUnion.totalCount = resp.data.list.totalCount
}
},
doUnionSearch() {
this.pageFormUnion.pageNumber = 1
this.pageUnionData();
},
//按分工会导出已选名单
exportReceiveDetail(flag) {
const {year,projectId, unionId} = this.pageForm
window.open(loc() + '/exportReceiveDetail?year=' + year + '&projectId=' + projectId + '&unionId=' + (unionId ? unionId : '') + '&flag=' + flag)
},
//导出家属信息
exportUserCompanion() {
const {year, projectId, unionId} = this.pageForm
window.open(loc() + '/exportUserCompanion?year=' + year + '&projectId=' + projectId + '&unionId=' + (unionId ? unionId : ''))
},
getSummaries(param){
const {columns, data} = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总计';
return;
}
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return Math.floor((prev + curr) * 100) / 100;
} else {
return prev;
}
}, 0);
sums[index] += ' 人';
} else {
sums[index] = null;
}
});
return sums;
}
},
async created() {
this.init()
// this.pageData()
}
})
</script>
<!--#
}
#-->