Files
UNION_NSI/target/classes/views/platform/jf/childrenFaculty/mine.html
T
2026-09-08 19:49:21 +08:00

498 lines
22 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--#
layout("/layouts/platform.html"){
#-->
<style>
</style>
<div id="app" v-cloak>
<guava 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="false"
@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-input placeholder="请输入姓名或工号查询" clearable v-model="pageForm.searchKeyword"
style="width: 100%"
@keyup.enter.native="doSearch">
</el-input>
</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="true"-->
<!-- @change="flushUnits" @clear="flushUnits"-->
<!-- 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 placeholder="请选择所属单位" v-model="pageForm.unitId" style="width: 100%;"-->
<!-- @change="getThreeUnits"-->
<!-- clearable="true"-->
<!-- filterable="true">-->
<!-- <el-option v-for="item in units" :label="item.name" :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 shadow="never" class="mt10">
<table-tool label="数据列表" :app="this">
<template #func>
<el-button type="primary" size="small" @click="openImport">
导入
</el-button>
<el-button type="primary" size="small" @click="exportByUnion">
导出
</el-button>
<el-button type="primary" size="small" @click="openAdd">
新增
</el-button>
</template>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder">
<el-table-column align="center" header-align="center" label="序号" type="index">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="年度" prop="year"
sortable></el-table-column>
<el-table-column align="center" header-align="center" label="姓名" prop="userName"
sortable></el-table-column>
<el-table-column align="center" header-align="center" label="工号"
prop="loginName"></el-table-column>
<el-table-column align="center" header-align="center" label="单位" width="200px" show-overflow-tooltip
prop="unitName"></el-table-column>
<el-table-column align="center" header-align="center" label="联系方式"
prop="mobile"></el-table-column>
<el-table-column align="center" header-align="center" label="申请时间"
prop="applyTime"></el-table-column>
<el-table-column align="center" header-align="center" label="子女出生年月"
prop="childBirthday"></el-table-column>
<el-table-column align="center" header-align="center" label="备注" prop="bz"></el-table-column>
<el-table-column label="操作" width="200" header-align="center" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="openEdit(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="doDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<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-card>
</template>
<template #edit>
<vi-title title="基础信息"></vi-title>
<el-form :model="formData" :rules="formRules" label-width="120px" ref="form">
<el-form-item prop="loginName" label="教职工信息">
<el-select
:disabled="formData.id"
style="width: 100%"
v-model="formData.loginName"
filterable
clearable
remote
reserve-keyword
placeholder="请输入姓名或工号查找"
:remote-method="userRemoteMethod"
:loading="userLoading"
@change="userChange">
<el-option
v-for="item in userOptions"
:key="item.loginName"
:label="item.userName+''+item.loginName+''+'('+item.unionName+')'"
:value="item.loginName">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="子女出生年月" prop="childBirthday">
<el-date-picker
style="width: 100%"
v-model="formData.childBirthday"
placeholder="请选择子女出生年月"
:picker-options="pickerOptions"
type="month"
value-format="yyyy-MM">
</el-date-picker>
<span class="text-primary">
子女年龄为:2009年6月1日以后出生,含二孩、三孩
</span>
</el-form-item>
<el-form-item label="备注" prop="bz">
<el-input v-model="formData.bz" placeholder="请输入备注"></el-input>
</el-form-item>
<el-form-item label="签字" prop="signData">
<sign :qz.sync="formData.signData"></sign>
</el-form-item>
</el-form>
<div style="float: right;margin: 20px 0">
<el-button @click="$refs.guava.index()">取 消</el-button>
<el-button type="primary" @click="doHandle">确 定</el-button>
</div>
</template>
</guava>
<el-dialog
title="会员导入"
:visible.sync="importVisible"
:close-on-click-modal="false"
width="50%">
<div style="margin-left: 68px;padding-bottom: 10px">
<span style="color: red">填写时,请按一孩一列(一个出生日期一条记录)填写</span>
</div>
<el-timeline>
<el-timeline-item timestamp="下载模板" placement="top">
<el-card>
<el-button size="medium" style="width: 200px"
@click="location.href='/platform/jf/childrenFaculty/mine/downloadTemplate'"
icon="el-icon-download">下载模板
</el-button>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="上传文件" placement="top">
<el-card>
<el-form>
<el-upload
name="file"
ref="upload"
:on-remove="(file, fileList) => {
importData.fileList = fileHandleRemove(file, fileList);
importResult={
errorCount:0,
successCount:0,
totalCount:0,
errorList:[]
}
}"
:on-change="(file, fileList) => {
importData.fileList = fileHandleChange(file, fileList,{type:['xls','xlsx']})
}"
:auto-upload="false"
:limit="1"
:file-list="importData.fileList">
<el-button size="medium" type="" icon="el-icon-upload"
style="width: 200px">选择文件
</el-button>
<div class="el-upload__tip" slot="tip" style="color: #F56C6C">
只能上传 xls/xlsx 文件
</div>
</el-upload>
</el-form>
</el-card>
</el-timeline-item>
<el-timeline-item placement="top" timestamp="导入结果">
<el-card shadow="never">
<p>总记录数:{{errorInfoData.totalCount}}</p>
<p>成功数:<span class="text-success">{{errorInfoData.successCount}}</span></p>
<p>错误数:<span class="text-danger">{{errorInfoData.errorCount}}</span></p>
<el-link @click="exportErrors" type="primary" v-if="errorInfoData.errorCount>0">下载错误记录
</el-link>
</el-card>
</el-timeline-item>
<el-timeline-item placement="top" timestamp="签字">
<sign :qz.sync="signData"></sign>
</el-timeline-item>
</el-timeline>
<span slot="footer" class="dialog-footer">
<el-button @click="importVisible = false">取 消</el-button>
<el-button type="primary" @click="doImport">确定</el-button>
</span>
</el-dialog>
</div>
<!--<script src="https://cdn.staticfile.org/xlsx/0.18.5/xlsx.full.min.js"></script>-->
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
year: new Date().getFullYear() + '',
searchKeyword: '',
unionId: '',
unitId: '',
},
formData: {
childBirthday: '',
},
formRules: {
loginName: [{required: true, message: '必填', trigger: ['change', 'blur']}],
childBirthday: [{required: true, message: '必填', trigger: ['change', 'blur']}],
signData: [{required: true, message: '必填', trigger: ['change', 'blur']}],
},
tableData: [],
units: [],
unions: [],
importVisible: false,
importLoading: false,
importData: {
fileList: [],
},
errorInfoData: {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: 0,
},
signData: null,
userLoading: false,
userOptions: [],
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < moment('2009-06-01').toDate().getTime()
},
}
}
},
methods: {
exportByUnion() {
window.open('/platform/jf/childrenFaculty/mine/doExport?year=' + this.pageForm.year)
},
async userRemoteMethod(query) {
if (query) {
this.userLoading = true
const arr = await this.queryUser(query)
this.userOptions = arr
this.userLoading = false
}
},
async queryUser(query) {
const {data} = await $.get(loc() + "/queryUser", {query})
return data
},
async userChange(val) {
const {userName, unitId, unitName, unionId, unionName} = this.userOptions.find(v => v.loginName === val)
this.$set(this.formData, 'userName', userName)
this.$set(this.formData, 'unitId', unitId)
this.$set(this.formData, 'unitName', unitName)
this.$set(this.formData, 'unionId', unionId)
this.$set(this.formData, 'unionName', unionName)
},
openImport() {
this.importData = {
fileList: [],
}
this.errorInfoData = {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: 0,
}
this.importVisible = true;
},
doImport() {
if (this.importData.fileList.length === 0) {
this.$message.warning("请选择文件!")
return
}
if (this.signData == null || this.signData === '') {
this.$message.warning("请签字后再上传!")
// return
}
const data = new FormData();
this.importData.fileList.forEach((val) => {
data.append("file", val.raw, val.raw.name);
});
data.append("signData", this.signData)
this.importLoading = true
$.ajax({
url: loc() + "/doImportUser",
type: "post",
data: data,
processData: false,
contentType: false,
success: (data) => {
this.importLoading = false
if (data.code === 0 && !data.data) {
this.pageData();
this.notifySuccess("导入成功")
this.importVisible = false
} else {
this.importLoading = false
this.notifyWarning("导入失败")
this.errorInfoData = data.data
}
},
error: (data) => {
this.notifyWarning("导入失败")
this.importLoading = false
}
});
},
exportErrors() {
const data = this.errorInfoData.errorList
// 创建工作簿
const workbook = XLSX.utils.book_new();
// 创建工作表
const worksheet = XLSX.utils.json_to_sheet(data);
// 将工作表添加到工作簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// 将工作簿转换为二进制对象
const excelBuffer = XLSX.write(workbook, {bookType: 'xlsx', type: 'array'});
// 将二进制对象转换为Blob对象
const blob = new Blob([excelBuffer], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
// 创建下载链接并设置相关属性
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = '错误记录.xlsx';
// 模拟点击下载链接
document.body.appendChild(link);
link.click();
// 清理下载链接
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
},
openEdit(row) {
this.userOptions = [{
userName: row.userName,
loginName: row.loginName,
unionName: row.unionName
}]
this.formData = clone(row)
this.$refs.guava.edit()
},
doDelete(row) {
this.$confirm('此操作无法撤回,确认删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$.post(loc() + '/doDelete', {id: row.id}).then(res => {
if (res.code === 0) {
this.doSearch()
this.$message.success(res.msg)
}
})
}).catch(() => {
})
},
openAdd() {
this.$set(this.formData, 'userName', null)
this.$set(this.formData, 'loginName', null)
this.$set(this.formData, 'childBirthday', null)
this.$set(this.formData, 'bz', null)
this.$refs.guava.edit()
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
},
doHandle() {
this.$refs['form'].validate(valid => {
if (valid) {
$.post(loc() + '/doAddOrModify', this.formData).then(res => {
if (res.code === 0) {
this.pageData()
this.$refs.guava.index()
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
})
}
})
},
async yearChange() {
await this.doSearch()
},
pageData() {
sublime.showLoadingbar()
$.post(loc() + '/pageData', this.pageForm).then(res => {
sublime.closeLoadingbar()
if (res.code === 0) {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
}
})
},
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
},
async flushUnits() {
this.$set(this.pageForm, "unitId", "")
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.units = await getUnits(this.pageForm.unionId)
} else {
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
}
},
},
async created() {
this.pageData()
this.unions = await getUnions()
this.flushUnits()
}
})
</script>
<!--#
}
#-->