Files
UNION_HUTB/target/classes/views/platform/jf/yjgh/ghys.html
T
2026-09-09 09:14:28 +08:00

447 lines
17 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
}
input[type="number"] {
-moz-appearance: textfield;
}
</style>
<div id="app" v-cloak>
<el-row class="header navbar bg-white shadow">
<div class="btn-group tool-button mt5">
<el-date-picker
@change="doSearch"
style="width: 100%"
v-model="pageForm.year"
type="year"
value-format="yyyy"
placeholder="选择年度">
</el-date-picker>
</div>
<!--按院级工会-->
<div class="btn-group tool-button mt5">
<el-select v-model="pageForm.union_id" filterable placeholder="按院级工会" clearable>
<el-option
v-for="item in unionOptions"
:key="item.id"
:label="item.unionname"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-button icon="el-icon-search" type="primary" @click="doSearch"></el-button>
</div>
<!--文件上传弹出框-->
<div class="btn-group tool-button mt5" style="float: right;padding-right: 5px">
<el-button type="primary" icon="el-icon-edit" @click="openExport" plain>导入数据</el-button>
</div>
<div class="btn-group tool-button mt5" style="float: right;padding-right: 5px">
<el-button type="success" @click="issue" v-if="!this.flag">年度分配</el-button>
<el-button type="danger" @click="reset" v-else>分配重置</el-button>
</div>
</el-row>
<el-row class="el-table-container">
<el-table :data="tableData" @sort-change="pageOrder" v-loading="tab_loading">
<el-table-column label="序号" type="index" header-align="center" align="center">
<template scope="scope"><span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column label="年度" show-overflow-tooltip header-align="center" align="center">
<template slot-scope="scope">
<span>{{scope.row.year}}</span>
</template>
</el-table-column>
<el-table-column label="院级工会名称" prop="unionname" show-overflow-tooltip header-align="center" align="center">
</el-table-column>
<el-table-column label="会员人数" prop="history_member" show-overflow-tooltip header-align="center"
align="center">
</el-table-column>
<el-table-column label="标准" show-overflow-tooltip header-align="center" align="center">
<template slot-scope="scope">
<!-- <span>{{scope.row.totalquota>0?(scope.row.totalquota/scope.row.hyzs).toFixed(2)+' 元':'暂未分配总额度'}}</span>-->
<span>{{scope.row.history_union_avg!=null?scope.row.history_union_avg+' 元':'暂未分配平均额度'}}</span>
</template>
</el-table-column>
<el-table-column label="总额度" sortable="custom" prop="totalquota" show-overflow-tooltip align="center"
header-align="center"
align="center">
<template slot-scope="scope">
<el-input v-if="scope.row.edit" maxlength="8" min="0" type="number" style="width: 70%" size="small"
onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
v-model="scope.row.totalquota2" placeholder="填写总额度">
<template slot="append"></template>
</el-input>
<div v-else>
<span v-if="!scope.row.totalquota">暂未分配</span>
<span v-else><i>{{scope.row.totalquota}}</i></span>
</div>
</template>
</el-table-column>
<el-table-column label="操作" header-align="center" width="180px" align="center">
<template slot-scope="scope">
<div v-if="scope.row.edit">
<el-button type="success" icon="el-icon-check" size="mini" @click="doChangeYs(scope.row)"
circle></el-button>
<el-button type="danger" icon="el-icon-close" size="mini" @click="$set(scope.row,'edit',false)"
circle></el-button>
</div>
<el-button v-else size="mini"
@click="$set(scope.row,'edit',true);$set(scope.row,'totalquota2',scope.row.totalquota);"
type="primary" plain>
{{!scope.row.unid?'分配':'编辑'}}
</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
<el-row class="el-pagination-container">
<el-pagination
@current-change="pageNumberChange"
:current-page="pageForm.pageNumber"
layout="total, prev, pager, next, jumper"
:total="pageForm.totalCount">
</el-pagination>
</el-row>
<!--上传数据文件弹出框-->
<el-dialog
title="导入数据"
:visible.sync="exportVisible" :close-on-click-modal="false"
width="60%">
<el-steps :active="exportActive" finish-status="success" simple>
<el-step title="下载模板"></el-step>
<el-step title="上传文件"></el-step>
<el-step title="导入结果"></el-step>
</el-steps>
<div v-if="exportActive==0"
style="padding: 20px ;display: flex;justify-content: center;align-content: center;align-items: center;;width: 100%">
<div class="el-upload-dragger" @click="downloadTemplate">
<i class="el-icon-download"></i>
<div class="el-upload__text">点击下载模板</div>
</div>
</div>
<div v-if="exportActive==1"
style="padding: 20px ;display: flex;justify-content: center;align-content: center;align-items: center;;width: 100%">
<el-upload
class="upload-demo"
drag
:on-change="tempFileChange"
:file-list="tempFileList" :auto-upload="false" accept=".xls,.xlsx"
:limit="1">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
</el-upload>
</div>
<div v-if="exportActive==2"
style="padding: 20px ;display: flex;justify-content: center;align-content: center;align-items: center;;width: 100%">
<div class="el-upload-dragger">
<i class="el-icon-success"></i>
<div class="el-upload__text">共检出 <span class="text-info">{{exportData.count}}</span> 条数据,入库成功 <span
class="text-success">{{exportData.success_count}}</span> 条。
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="exportVisible = false">取 消</el-button>
<el-button v-if="exportActive>0" @click="exportActive -= 1">上一步</el-button>
<el-button type="primary" v-if="exportActive==0" @click="exportActive = 1">我已下载</el-button>
<el-button type="primary" v-if="exportActive==1" @click="doExport">导入</el-button>
<el-button type="primary" v-if="exportActive==2" @click="exportVisible = false; window.location.reload();">完成</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: "#app",
data: function () {
return {
flag: false,
unionOptions: [],
tab_loading: false,
pageForm: {
pageNumber: 1,
pageSize: 10,
pageOrderName: '',
pageOrderBy: '',
totalCount: 0,
year: new Date().getFullYear() + ""
},
tableData: [],
//数据文件导入
tempFileList: [],
exportActive: 0,
exportVisible: false,
}
},
methods: {
doExport() {
if (!this.tempFileList.length) {
this.$notify({
title: '警告',
message: '请先选择文件',
type: 'warning'
});
return
}
let formData = new FormData();
const f = this.tempFileList[0]
formData.append("file", f.raw, f.raw.name);
// formData.append("park_id", parkId);
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
$.ajax({
url: "/platform/jf/yjgh/dataInput/doExport",
type: "post",
data: formData,
processData: false,
contentType: false,
success: (data) => {
loading.close()
if (data.code === 0) {
this.$message({
message: data.msg,
type: 'success'
});
this.exportData = {...data.data}
this.exportActive = 2
window.vue.pageData()
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
},
error: data => {
loading.close()
this.$message({
message: data.msg,
type: 'error'
});
}
});
},
tempFileChange(file, fileList) {
this.tempFileList = fileList
},
// 模板下载
downloadTemplate() {
location.href = '/platform/jf/yjgh/dataInput/downLoadTemp'
},
//数据文件弹出框
openExport() {
this.tempFileList = []
this.exportActive = 0
this.exportVisible = true
},
// 查询今年是否已经设置了人均额度
async isSetUnionAvg() {
const resp = await $.get("/platform/jf/yjgh/ghys/isSetUnionAvg")
if (resp.data == 0) {
this.$confirm('暂未设置人均额度无法下发,是否立即前往人均额度设置页面?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 重定向到设置页面
window.location.href = "/platform/jf/costsSet/costsSet";
}).catch(() => {
});
}
},
// 查询当前最大的一年
async lastYear() {
const resp = await $.get("/platform/jf/yjgh/ghys/lastYear")
if (resp.data.year != new Date().getFullYear() + "") {
this.pageForm.year = resp.data.year;
}
},
// 重置下发
async reset() {
// 确认弹出框
this.$confirm('您确定要重置年度费用吗, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const loading = this.$loading({
lock: true,
text: '正在重置...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
const resp = $.get("/platform/jf/yjgh/ghys/reset")
// 重新加载页面
window.location.reload();
loading.close()
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
// 判断是否已经下发并改变下发按钮的状态
async isSet() {
const resp = await $.get("/platform/jf/yjgh/ghys/isSet")
if (resp.data > 0) {
this.textView = "已下发"
this.flag = true
}
},
// 下发
async issue() {
this.$confirm('生成年度费用前,请确认院级工会是否已在会员管理系统中调整会员数量。', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
const loading = this.$loading({
lock: true,
text: '正在下发...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
// 查询是否设置了人均值
const resp = await $.get("/platform/jf/yjgh/ghys/isSetUnionAvg")
if (resp.data == 0) {
this.$confirm('暂未设置人均额度无法下发,是否立即前往人均额度设置页面?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 重定向到设置页面
window.location.href = "/platform/jf/costsSet/costsSet";
}).catch(() => {
});
} else {
if ("confirm" == a) {
const resp = await $.get("/platform/jf/yjgh/ghys/issue")
requestLaterFun(resp, () => {
this.$notify.success({title: '下发成功'});
// 重新加载页面
/* window.location.reload();*/
this.pageData()
}, () => {
this.$notify.error({title: '失败'});
}, () => {
loading.close()
})
}
}
}
});
},
doChangeYs(row) {
let self = this;
// self.avg= parseDouble(row.totalquota2)>0?parseDouble(row.totalquota2)/(row.hyzs):"暂未分配总额度"
$.post(base + "/platform/jf/yjgh/ghys/changeYs", {
unionId: row.unid,
year: self.pageForm.year,
totalQuota: row.totalquota2,
}, function (data) {
if (data.code === 0) {
vue.$message.success("分配成功!");
row.edit = false
self.pageData()
} else {
vue.$message.error(data.msg);
}
});
},
// 封装了分页查询等
...pageSomeThing
},
async created() {
// 弹框 生成年度费用前,请确认基层工会已在会员管理系统中调整会员数量
// alert("生成年度费用前,请确认基层工会已在会员管理系统中调整会员数量")
/* await this.lastYear();*/
await this.isSet();
this.unionOptions = await getUnions();
this.pageData();
},
});
</script>
<!--#
}
#-->