Files
zhgh_hrbnu/src/main/resources/views/platform/healthCheckup/statisticsSingle.html
T
2024-07-23 09:52:35 +08:00

505 lines
22 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<div class="platform" id="app" v-cloak>
<guava padding="0 5%" ref="guava">
<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="选择年"
style="width: 100%;"
type="year"
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 :clearable="clearable" @change="doSearch();getUnionGroup();"
filterable="true"
placeholder="请选择所属工会"
style="width: 100%;"
v-model="pageForm.unionId">
<el-option :label="item.unionname" :value="item.id"
v-for="item in unions"></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 @click="doSearch" icon="el-icon-search" type="primary">搜索
</el-button>
</div>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="工会列表" ref="table_tool">
<template #func>
<template
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H04')}">
<template v-if="projectInfo.healthCheckupType==='jzg'">
<el-button :disabled="!pageForm.projectId"
@click="exportReceiveDetail(true)"
icon="el-icon-printer"
size="small"
type="primary">导出教职工已选名单
</el-button>
<el-button :disabled="!pageForm.projectId"
@click="exportReceiveDetail(false)"
icon="el-icon-printer"
size="small"
type="primary"
v-if="projectInfo.healthCheckupType==='jzg'">导出教职工未选名单
</el-button>
<el-button @click="selectOptionByAdmin"
icon="el-icon-printer"
size="small"
type="primary"
v-if="${@shiro.hasRole('sysadmin')}">管理员代选择
</el-button>
</template>
<el-button :disabled="!pageForm.projectId"
@click="exportUserCompanion()"
icon="el-icon-printer"
size="small"
type="primary"
v-if="projectInfo.healthCheckupType==='js'">导出家属名单
</el-button>
</template>
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize" :summary-method="getSummaries"
@sort-change="pageOrder" class="vi-table"
ref="table" row-key="id" show-summary
style="width: 100%" v-loading="tableLoading">
<el-table-column :index="indexMethod" align="center" header-align="center"
label="序号" type="index"
width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
:width="column.width"
align="center"
header-align="center"
min-width="100px" show-overflow-tooltip v-for="column in tableColumns">
<!--<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 align="center" fixed="right" header-align="center"
label="操作" prop="userOnline"
width="200px">
<template scope="{row}">
<el-button @click="openView(row.id)" size="mini"
type="primary"
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H04')}">
查看已选人员
</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 clearable placeholder="请输入内容"
v-model="pageFormUnion.searchKeyword">
<el-select @keyup.enter.native="doUnionSearch" placeholder="查询类型"
slot="prepend"
style="width: 80px;"
v-model="pageFormUnion.searchName">
<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 @click="doUnionSearch" icon="el-icon-search" type="primary">搜索
</el-button>
</div>
</div>
</el-card>
<!-- <el-button type="primary"
class="pull-right"
icon="el-icon-printer"
@click="exportReceiveDetailByUnionId(true)">导出已选名单
</el-button>-->
<el-card class="mt10" shadow="never">
<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" :size="tableSize" class="vi-table"
height="100%"
row-key="id" style="width: 100%;height: 700px" v-loading="tableLoading">
<el-table-column type="index" width="50"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
show-overflow-tooltip
v-for="column in receive_tableColumns"
>
</el-table-column>
</el-table>
</el-card>
<el-row class="el-pagination-container" style="margin-bottom: 0px">
<el-pagination
:current-page="pageFormUnion.pageNumber"
:page-size="pageFormUnion.pageSize"
:page-sizes="[5,10, 20, 30, 50]"
:total="pageFormUnion.totalCount"
@current-change="pageNumberChange"
@size-change="pageSizeChange"
layout="total, sizes, prev, pager, next">
</el-pagination>
</el-row>
</template>
</guava>
<el-dialog :visible.sync="selectByAdminDialogVisible" title="管理员代选体检项目"
width="35%">
<el-form label-position="right" label-width="120px">
<el-form-item label="体检项目">
<el-select style="width: 100%" v-model="noSelectOptionId">
<el-option :key="item.id" :label="item.optionName" :value="item.id"
v-for="item in projectSubjectOptions"></el-option>
</el-select>
</el-form-item>
<el-form-item
label="院区"
prop="campus">
<el-select style="width: 100%" v-model="campus">
<el-option :key="item.id" :label="item.campusName" :value="item.id"
v-for="item in campusOptions"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-row justify="end" type="flex">
<el-button @click="selectByAdminDialogVisible=false">取消</el-button>
<el-button @click="doSelectByAdmin" type="primary" :loading="loading">提交</el-button>
</el-row>
</el-dialog>
</div>
<script>
const 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,
projectInfo: {},
selectByAdminDialogVisible: false,
projectSubjectOptions: [],
campusOptions: [],
noSelectOptionId: null,
campus: null,
loading:false,
}
},
methods: {
async doSelectByAdmin() {
if (!this.noSelectOptionId || !this.campus) {
this.notifyWarning('请选择套餐/院区')
return
}
const {optionName} = this.projectSubjectOptions.find(v => v.id === this.noSelectOptionId)
const confirm = await this.$confirm('请确定是否把【' + optionName + '】福利赋给未选择的教职工?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === "confirm") {
this.loading = true
const resp = await $.get(loc() + '/doSelectByAdmin', {
optionId: this.noSelectOptionId,
campus: this.campus,
projectId: this.pageForm.projectId
})
if (resp.code === 0) {
this.doSearch()
this.loading = false
this.selectByAdminDialogVisible = false
this.notifySuccess(resp.msg)
} else {
this.notifyWarning(resp.msg)
}
}
},
selectOptionByAdmin() {
this.noSelectOptionId = null
this.selectByAdminDialogVisible = true
},
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.projectInfo = resp.data
this.projectSubjectOptions = resp.data.healthCheckupProjectSubjects
}
} else {
this.notifyError(resp.msg)
}
this.doSearch()
},
async getCampus() {
const resp = await $.get("/mobile/healthCheckup/getCampus")
if (resp.code === 0) {
this.campusOptions = resp.data
} else {
this.notifyError(resp.msg)
}
},
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.unions = await getUnions(null)
this.clearable = true
}
await this.yearChange()
await this.getCampus()
},
//查看未选择人数
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>
<!--#
}
#-->