387 lines
18 KiB
HTML
387 lines
18 KiB
HTML
<!--#
|
||
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>
|
||
<template scope="{row}">
|
||
<span v-if="row.reserveMode === 1">
|
||
{{row.coursePeopleNumber}}
|
||
</span>
|
||
<span v-if="row.reserveMode === 2">
|
||
{{row.coursePeopleNumber + row.courseReservedNumber}}
|
||
</span>
|
||
</template>
|
||
</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="courseReservedNumber" 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}">
|
||
<template v-if="row.isAddFamily && row.isBringFamily">
|
||
<el-link v-if="row.selfAddFamily" @click="openView(row)" type="primary">
|
||
{{row.registerNum + '家属(' + row.familyCount + ')'}}
|
||
</el-link>
|
||
<el-link v-else @click="openView(row)" type="primary">
|
||
{{row.familyCount}}
|
||
</el-link>
|
||
</template>
|
||
<template v-else>
|
||
<el-link v-if="row.reserveMode === 1" @click="openView(row)" type="primary">
|
||
{{row.registerNum + row.courseReservedNumber}}
|
||
</el-link>
|
||
<el-link v-if="row.reserveMode === 2" @click="openView(row)" type="primary">
|
||
{{row.registerNum}}
|
||
</el-link>
|
||
</template>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="操作" width="150px">
|
||
<template scope="{row}">
|
||
<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"
|
||
>
|
||
<template scope="{row}" v-if="column.prop === 'state'">
|
||
<span class="text-success" v-if="row.state === 1">正常报名</span>
|
||
<span class="text-warning" v-else-if="row.state === 2">候补报名</span>
|
||
<span class="text-success" v-else-if="row.state === 3">正常报名(候补)</span>
|
||
<span class="text-info" v-else-if="row.state === 4">无效报名(缺席)</span>
|
||
</template>
|
||
</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>
|
||
</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: 'mobile'},
|
||
{label: '报名时间', prop: 'signUpTime'},
|
||
{label: '报名状态', prop: 'state'},
|
||
],
|
||
registerCourse: {},
|
||
courseList: [],
|
||
userInfo: {},
|
||
chooseRow: {},
|
||
}
|
||
},
|
||
methods: {
|
||
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>
|
||
|
||
<!--#
|
||
}
|
||
#-->
|