Files
2026-09-20 15:46:34 +08:00

478 lines
22 KiB
HTML
Raw Permalink 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>
.adjustDialog .el-radio__label {
display: none;
}
.adjustDialog .el-dialog__body {
max-height: 600px;
overflow-y: auto;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<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-select @change="activityChange" style="width: 100%" v-model="pageForm.activityId">
<el-option :label="item.activityName"
:value="item.id"
v-for="item in activityList"
></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="人员调整"></table-tool>
<el-table :data="tableData" :size="tableSize">
<el-table-column :index="indexMethod" align="center" header-align="center" label="序号" type:="index"
width="80px">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column :label="trainType" prop="courseName" align="center" header-align="center"
show-overflow-tooltip></el-table-column>
<el-table-column label="类型" prop="courseType" sortable align="center" header-align="center"
show-overflow-tooltip></el-table-column>
<el-table-column :label="trainType + '地点'" prop="courseLocation" sortable align="center"
header-align="center" show-overflow-tooltip></el-table-column>
<el-table-column :label="trainType === '培训班' ? '讲师' : '负责人'" prop="courseInstructor" sortable align="center" header-align="center"
show-overflow-tooltip></el-table-column>
<el-table-column label="最多报名人数" prop="coursePeopleNumber" sortable align="center" header-align="center"
show-overflow-tooltip></el-table-column>
<el-table-column label="已报名人数" prop="registerNum" sortable align="center" header-align="center"
show-overflow-tooltip>
<template scope="{row}">
<el-link @click="openView(row)" type="primary">
{{row.registerNum + row.courseReservedNumber}}
</el-link>
</template>
</el-table-column>
<el-table-column label="操作" width="150px">
<template scope="{row}">
<el-button @click="openImport(row)" size="mini" type="primary">导入</el-button>
<el-button @click="openView(row)" size="mini" type="primary">调整</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<template #view>
<vi-title :title="registerCourse.courseName + '报名人员'"></vi-title>
<div>
<div class="btn-group tool-button mt5">
<el-input v-model="registerForm.searchKeyword" placeholder="请输入内容">
<el-select slot="prepend" v-model="registerForm.searchName" placeholder="查询类型"
style="width: 120px;">
<el-option label="姓名" value="u.username"></el-option>
<el-option label="工号" value="u.loginname"></el-option>
</el-select>
</el-input>
</div>
<div class="btn-group tool-button mt5">
<el-select v-model="registerForm.unionId" clearable filterable placeholder="请选择院级工会"
@change="getUnitList()">
<el-option
v-for="item in unionList"
:key="item.id"
:label="item.unionname"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-select v-model="registerForm.unitId" clearable filterable placeholder="请选择单位">
<el-option
v-for="item in unitList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-button icon="el-icon-search" type="primary" @click="registerSearch"></el-button>
</div>
</div>
<el-table :data="registerUserTableData" :size="tableSize">
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in registerUserTableColumns"
></el-table-column>
<el-table-column label="操作" width="150px">
<template scope="{row}">
<el-button @click="adjust(row)" size="mini" type="primary">修改</el-button>
<el-button @click="deleteSignUser(row)" size="mini" type="primary">删除</el-button>
</template>
</el-table-column>
</el-table>
</template>
</guava>
<el-dialog
title="人员调整" top="6vh" class="adjustDialog" :close-on-click-modal="false"
:visible.sync="adjustDialogVisible"
width="40%">
<span style="color: #c33714">注:如单选为灰色选择不了,则表示对应的{{ trainType }}人数已满!</span>
<el-table :data="courseList">
<el-table-column label="单选" width="160">
<template scope="{row}">
<el-radio :label="row.id" @change.native="getCurrentRow(row)"
:disabled="(row.courseReservedNumber + row.registerNum) >= row.coursePeopleNumber"
v-model="afterAdjustCourse"></el-radio>
</template>
</el-table-column>
<el-table-column
:label="trainType + '列表'"
prop="courseName"
align="center"
header-align="center"
show-overflow-tooltip
>
</el-table-column>
<el-table-column label="最多报名人数" prop="coursePeopleNumber" align="center"
header-align="center"></el-table-column>
<el-table-column label="预留名额" prop="courseReservedNumber" align="center"
header-align="center"></el-table-column>
<el-table-column label="已报名人数" prop="registerNum" align="center" header-align="center"></el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="adjustDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doAdjust">确 定</el-button>
</span>
</el-dialog>
<!--上传数据文件弹出框-->
<el-dialog
title="导入数据" top="2%"
: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">
<div v-if="exportData.flag == 'success'">
<div style="display: flex;flex-direction: column;align-items: center; margin: 30px 0 10px">
<i class="el-icon-success" style="font-size: 48px; color: #67C23A"></i>
<span style="font-size: 16px;color: #5e6d82; margin-top: 10px">{{'成功导入' + exportData.data.length + '条'}}</span>
</div>
</div>
<div v-if="exportData.flag == 'error'">
<div style="display: flex;justify-content: center;align-items: center; margin: 10px 0">
<i class="el-icon-error" style="font-size: 58px; color: #F56C6C"></i>
<span style="font-size: 16px;color: #5e6d82; margin-top: 10px">请处理以下错误后,重新导入</span>
</div>
<el-table :data="exportData.data" size="mini">
<el-table-column prop="username" label="姓名" header-align="center" align="center"></el-table-column>
<el-table-column prop="loginname" label="工号" header-align="center" align="center"></el-table-column>
<el-table-column prop="errMsg" label="状态" header-align="center" align="center">
<template scope="scope">
<span class="text-danger">{{scope.row.errMsg}}</span>
</template>
</el-table-column>
</el-table>
</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;doSearch();">完成</el-button>
</span>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
trainType: '培训班',
trainTypeList: [],
afterAdjustCourse: '',
adjustDialogVisible: false,
unionList: [],
unitList: [],
registerForm: {},
activityList: [],
pageForm: {
year: new Date().getFullYear().toString(),
activityId: null
},
tableColumns: [
{label: '培训班', prop: 'courseName'},
{label: '类型', prop: 'courseType', sortable: true},
{label: '地点', prop: 'courseLocation'},
{label: '教师', prop: 'courseInstructor', sortable: true},
{label: '最多报名人数', prop: 'coursePeopleNumber', sortable: true},
{label: '已报名人数', prop: 'registerNum', sortable: true},
],
registerUserTableData: [],
registerUserTableColumns: [
{label: '姓名', prop: 'username'},
{label: '工号', prop: 'loginname'},
{label: '单位', prop: 'unitname'},
{label: '分工会', prop: 'unionname'},
{label: '报名时间', prop: 'signUpTime'},
],
registerCourse: {},
courseList: [],
userInfo: {},
chooseRow: {},
importRow: {},
exportVisible: false,
exportActive: 0,
tempFileList: [],
exportData: {},
}
},
methods: {
doExport() {
if (!this.tempFileList.length) {
this.$message.warning('请先选择文件')
return
}
let formData = new FormData();
const f = this.tempFileList[0]
formData.append("file", f.raw, f.raw.name)
formData.append("activityId", this.pageForm.activityId)
formData.append("courseId", this.importRow.id)
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
$.ajax({
url: "/platform/trainSingUp/manage/userAdjust/doExport",
type: "post",
data: formData,
processData: false,
contentType: false,
success: (data) => {
loading.close()
if (data.code === 0) {
this.$message.success(data.msg)
this.exportData = data.data
this.exportActive = 2
} else {
this.$message.warning(data.msg)
}
},
error: data => {
loading.close()
this.$message.warning(data.msg)
}
})
},
downloadTemplate() {
location.href = '/platform/trainSingUp/manage/userAdjust/downLoadTemp'
},
tempFileChange(file, fileList) {
this.tempFileList = fileList
},
openImport(row) {
this.importRow = row
this.tempFileList = []
this.exportActive = 0
this.exportVisible = true
},
activityChange(val) {
const activity = this.activityList.find(o => o.id === val)
const type = this.trainTypeList.find(o => o.code === activity.trainType)
this.trainType = type ? type.name : '培训班'
},
getCurrentRow(row) {
this.chooseRow = row
},
async doAdjust() {
if (!this.afterAdjustCourse) {
this.notifyWarning('请选择要调整的' + this.trainType + '!')
return
}
this.$confirm("您确定要将"
+ "<span style='color: red'>" + this.userInfo.username + "</span>"
+ "的报名信息调整到"
+ "<span style='color: red'>" + this.chooseRow.courseName + "</span>"
+ "中吗?", '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true,
}).then(async () => {
const loading = this.$loading({
lock: true,
text: '努力调整中,感谢您的耐心等待。。。',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
const resp = await $.post(loc() + '/adjust', {
activityId: this.pageForm.activityId,
oldCourseId: this.registerCourse.id,
newCourseId: this.afterAdjustCourse,
userId: this.userInfo.userId,
})
if (resp.code === 0) {
this.$notify({title: '成功', message: '操作成功!', type: 'success',});
this.$refs.guava.index()
this.adjustDialogVisible = false
this.doSearch()
} else {
this.$notify({title: '警告', message: '操作失败!', type: 'warning',});
}
loading.close();
}).catch(() => {
});
},
adjust(o) {
this.userInfo = o
this.afterAdjustCourse = ''
this.adjustDialogVisible = true
},
deleteSignUser(o) {
this.$confirm("您确定要删除"
+ "<span style='color: red'>" + o.username + "</span>"
+ "的报名信息吗?", '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true,
}).then(async () => {
const resp = await $.post(loc() + '/deleteSignUser', {
activityId: this.pageForm.activityId,
courseId: this.registerCourse.id,
userId: o.userId,
})
if (resp.code === 0) {
this.$notify({title: '成功', message: '操作成功!', type: 'success',});
await this.registerSearch()
this.doSearch()
} else {
this.$notify({title: '警告', message: '操作失败!', type: 'warning',});
}
}).catch(() => {
});
},
async registerSearch() {
this.registerForm.courseId = this.registerCourse.id
const resp_register = await $.get(loc() + '/registerUserList', this.registerForm)
this.registerUserTableData = resp_register.data
},
async getUnitList() {
this.registerForm.unitid = ''
this.unitList = await getUnit(this.registerForm.unionid)
},
async yearChange() {
this.pageForm.activityId = null
await this.getActivityList()
await this.doSearch()
},
async getActivityList() {
const resp = await $.get(loc() + '/activityList', {year: this.pageForm.year})
this.activityList = resp.data
if (this.activityList && this.activityList.length > 0) {
this.pageForm.activityId = this.activityList[0].id
const type = this.trainTypeList.find(o => o.code === this.activityList[0].trainType)
this.trainType = type ? type.name : '培训班'
}
},
async initData() {
await this.getActivityList()
this.unionList = await getUnion()
},
async openView(o) {
this.registerCourse = o
this.registerForm.courseId = o.id
this.$refs.guava.view()
const resp_register = await $.post(loc() + '/registerUserList', this.registerForm)
this.registerUserTableData = resp_register.data
},
async getCourse(val) {
const {data} = await $.post(loc() + '/getCourse', {activityId: val})
this.courseList = data
}
},
async created() {
this.trainTypeList = await getDictOptions("trainSignUpType")
await this.initData()
await this.pageData()
},
watch: {
'pageForm.activityId'(val) {
this.getCourse(val)
}
}
})
</script>
<!--#
}
#-->