体育报名外援优化;体育服装管理整改,关联选择活动;比赛名称录入可选工会补全;沿用保存活动bug修复
This commit is contained in:
@@ -27,8 +27,8 @@ layout("/layouts/platform.html"){
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
style="width: 100%"
|
||||
placeholder="选择年度"
|
||||
type="year" disabled
|
||||
placeholder="全部年度"
|
||||
type="year" clearable @change="handleYearChange"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
@@ -37,19 +37,24 @@ layout("/layouts/platform.html"){
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">项目名称:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.projectId" placeholder="请选择项目名称" filterable
|
||||
<el-select v-model="pageForm.projectId" placeholder="请选择项目名称" filterable :loading="projectLoading"
|
||||
@change="doSearch" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in projectList"
|
||||
:key="item.code"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.code">
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">近两年内:</div>
|
||||
<div class="search-item-label" style="white-space: nowrap;">
|
||||
近两年内:
|
||||
<el-tooltip content="按所选活动的报名年度,检查相邻年度活动中相同运动项目的购衣记录;补录往年活动也会查重" placement="top">
|
||||
<i class="el-icon-question" style="cursor: help;"></i>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div class="search-item-option">
|
||||
<el-radio-group @change="(val) => doSearch()" v-model="pageForm.isBuy">
|
||||
<el-radio-button :label="true">已购买</el-radio-button>
|
||||
@@ -112,22 +117,25 @@ layout("/layouts/platform.html"){
|
||||
</template>
|
||||
</vi-title2>
|
||||
</div>
|
||||
<el-table ref="multipleTable" @selection-change="handleSelectionChange" :data="userData" max-height="600"
|
||||
<el-table ref="multipleTable" v-loading="tableLoading" @selection-change="handleSelectionChange" :data="userData" max-height="600"
|
||||
:row-key="(val) => val.id">
|
||||
<el-table-column :reserve-selection="true" type="selection" width="55"></el-table-column>
|
||||
<el-table-column :reserve-selection="true" :selectable="canSelectUser" type="selection" width="55"></el-table-column>
|
||||
<el-table-column label="姓名" prop="username" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="工号" prop="loginname" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="性别" prop="sex" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="单位" prop="unitname" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="所属工会" prop="unionname" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="联系方式" prop="mobile" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column v-if="pageForm.isBuy" label="购买来源" align="center" header-align="center">
|
||||
<template slot-scope="scope">{{scope.row.canRemove ? '当前活动' : '两年内同类活动'}}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="display: flex; justify-content: space-between; margin-top: 6px">
|
||||
<div> <!--#include("/layouts/pagination.html"){}#--></div>
|
||||
<div>
|
||||
<el-row justify="end" type="flex">
|
||||
<el-button v-if="!pageForm.isBuy" @click="doHandler" type="primary">提交</el-button>
|
||||
<el-button v-else @click="doHandler" type="danger">移除</el-button>
|
||||
<el-button v-if="!pageForm.isBuy" @click="doHandler" :loading="formLoading" type="primary">提交</el-button>
|
||||
<el-button v-else @click="doHandler" :loading="formLoading" type="danger">移除</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
@@ -154,11 +162,12 @@ layout("/layouts/platform.html"){
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
year: moment().format('YYYY'),
|
||||
year: null,
|
||||
isBuy: false,
|
||||
searchName: 'u.username'
|
||||
},
|
||||
projectList: [],
|
||||
projectLoading: false,
|
||||
userData: [],
|
||||
userValue: [],
|
||||
treeUnionList: [],
|
||||
@@ -172,7 +181,11 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
methods: {
|
||||
handleSelectionChange(val) {
|
||||
this.userValue = val.length > 0 ? val.map(o => o.id) : []
|
||||
this.$set(this, 'userValue', val.length > 0 ? val.map(o => o.id) : [])
|
||||
},
|
||||
// 其他同类活动的历史购买只能查看;移除操作仅处理当前活动的登记。
|
||||
canSelectUser(row) {
|
||||
return !this.pageForm.isBuy || row.canRemove
|
||||
},
|
||||
filterNode(value, data, node) {
|
||||
if (!value || node.level === 1) return true;
|
||||
@@ -187,7 +200,7 @@ layout("/layouts/platform.html"){
|
||||
this.pageData()
|
||||
}
|
||||
},
|
||||
async doHandler() {
|
||||
doHandler() {
|
||||
if(!this.pageForm.projectId) {
|
||||
this.notifyWarning('请选择项目!')
|
||||
return
|
||||
@@ -196,50 +209,104 @@ layout("/layouts/platform.html"){
|
||||
this.notifyWarning('请选择人员!')
|
||||
return
|
||||
}
|
||||
const confirm = await this.$confirm('您选择了' + this.userValue.length + '人, 是否继续?', '提示', {
|
||||
this.$confirm('您选择了' + this.userValue.length + '人, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === "confirm") {
|
||||
const resp = await $.post('/platform/clothing/register/doHandler', {
|
||||
}).then(() => {
|
||||
this.$set(this, 'formLoading', true)
|
||||
return $.post('/platform/clothing/register/doHandler', {
|
||||
ids: JSON.stringify(this.userValue),
|
||||
projectId: this.pageForm.projectId,
|
||||
year: this.pageForm.year,
|
||||
isBuy: this.pageForm.isBuy,
|
||||
})
|
||||
if(resp.code === 0) {
|
||||
this.doSearch()
|
||||
this.notifySuccess(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
.then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.doSearch()
|
||||
this.notifySuccess(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}, () => {
|
||||
this.notifyWarning('提交失败,请刷新名单后重试')
|
||||
})
|
||||
.always(() => {
|
||||
this.$set(this, 'formLoading', false)
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
doSearch() {
|
||||
this.$refs.multipleTable.clearSelection()
|
||||
this.pageData()
|
||||
},
|
||||
//查询人员名单
|
||||
async pageData() {
|
||||
const resp = await $.post('/platform/clothing/register/pageData', this.pageForm)
|
||||
if (resp.code === 0) {
|
||||
this.userData = resp.data.list
|
||||
this.pageForm.totalCount = resp.data.totalCount
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
// 查询与所选活动报名年度相差不超过一年、同类运动项目的购买状态。
|
||||
pageData() {
|
||||
const projectId = this.pageForm.projectId
|
||||
const isBuy = this.pageForm.isBuy
|
||||
this.$set(this, 'tableLoading', true)
|
||||
return $.post('/platform/clothing/register/pageData', this.pageForm)
|
||||
.then((resp) => {
|
||||
if (this.pageForm.projectId !== projectId || this.pageForm.isBuy !== isBuy) return
|
||||
if (resp.code === 0) {
|
||||
this.$set(this, 'userData', resp.data.list)
|
||||
this.$set(this.pageForm, 'totalCount', resp.data.totalCount)
|
||||
} else {
|
||||
this.$set(this, 'userData', [])
|
||||
this.$set(this.pageForm, 'totalCount', 0)
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
}, () => {
|
||||
if (this.pageForm.projectId !== projectId || this.pageForm.isBuy !== isBuy) return
|
||||
this.$set(this, 'userData', [])
|
||||
this.$set(this.pageForm, 'totalCount', 0)
|
||||
this.$message.error('人员名单加载失败')
|
||||
})
|
||||
.always(() => {
|
||||
this.$set(this, 'tableLoading', false)
|
||||
})
|
||||
},
|
||||
//获取所有买服装的项目
|
||||
async getBuyClothesProject() {
|
||||
const {data} = await $.post('/platform/clothing/register/getBuyClothesProject')
|
||||
return data
|
||||
// 年度为空时获取全部已提交活动;指定年度时按活动报名开始时间筛选。
|
||||
getBuyClothesProject(year) {
|
||||
this.$set(this, 'projectLoading', true)
|
||||
return $.post('/platform/clothing/register/getBuyClothesProject', {year: year})
|
||||
.then((resp) => {
|
||||
if (resp.code === 0) return resp.data || []
|
||||
this.notifyWarning(resp.msg)
|
||||
return []
|
||||
}, () => {
|
||||
this.notifyWarning('活动列表加载失败')
|
||||
return []
|
||||
})
|
||||
.always(() => {
|
||||
this.$set(this, 'projectLoading', false)
|
||||
})
|
||||
},
|
||||
async unionTree() {
|
||||
const resp = await $.post('/platform/clothing/register/getTreeUnionList')
|
||||
if(resp.code === 0) {
|
||||
this.sysadmin = resp.data.sysadmin
|
||||
this.treeUnionList = [resp.data]
|
||||
// 切换年度时清除原项目,避免用上一年度的活动ID继续查询或登记。
|
||||
refreshProjects() {
|
||||
const year = this.pageForm.year
|
||||
this.$set(this.pageForm, 'projectId', null)
|
||||
this.$set(this, 'projectList', [])
|
||||
this.$set(this, 'userData', [])
|
||||
this.$set(this, 'userValue', [])
|
||||
return this.getBuyClothesProject(year).then((projects) => {
|
||||
if (this.pageForm.year !== year) return
|
||||
this.$set(this, 'projectList', projects)
|
||||
if (projects.length > 0) {
|
||||
this.$set(this.pageForm, 'projectId', projects[0].id)
|
||||
}
|
||||
})
|
||||
},
|
||||
handleYearChange() {
|
||||
const year = this.pageForm.year
|
||||
this.refreshProjects().then(() => {
|
||||
if (this.pageForm.year === year) this.doSearch()
|
||||
})
|
||||
},
|
||||
unionTree() {
|
||||
return $.post('/platform/clothing/register/getTreeUnionList').then((resp) => {
|
||||
if (resp.code !== 0) return
|
||||
this.$set(this, 'sysadmin', resp.data.sysadmin)
|
||||
this.$set(this, 'treeUnionList', [resp.data])
|
||||
if (this.sysadmin) {
|
||||
this.handleNodeClick({unioncode: ''}, {level: 1})
|
||||
} else {
|
||||
@@ -257,20 +324,19 @@ layout("/layouts/platform.html"){
|
||||
level: 2, data: data
|
||||
})
|
||||
}
|
||||
}
|
||||
}, () => {
|
||||
this.notifyWarning('工会列表加载失败')
|
||||
}).always(() => {})
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.projectList = await this.getBuyClothesProject()
|
||||
if (this.projectList && this.projectList.length > 0) {
|
||||
this.pageForm.projectId = this.projectList[0].code
|
||||
}
|
||||
await this.unionTree()
|
||||
this.pageData()
|
||||
created() {
|
||||
this.refreshProjects().then(() => {
|
||||
this.unionTree()
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
#-->
|
||||
|
||||
Reference in New Issue
Block a user