体育报名外援优化;体育服装管理整改,关联选择活动;比赛名称录入可选工会补全;沿用保存活动bug修复
This commit is contained in:
@@ -906,39 +906,58 @@ layout("/layouts/platform.html"){
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item prop="username" label="姓  名">
|
||||
<el-input maxlength="50" placeholder="请填写外援姓名" v-model="formData.username"></el-input>
|
||||
<el-autocomplete style="width: 100%" maxlength="50" :trigger-on-focus="false"
|
||||
placeholder="输入姓名或工号搜索,未匹配时直接填写姓名"
|
||||
:fetch-suggestions="searchExternalUser" v-model="formData.username"
|
||||
@input="changeExternalName" @select="selectExternalUser">
|
||||
<template slot-scope="{ item }">{{item.username}}({{item.loginname}})</template>
|
||||
</el-autocomplete>
|
||||
</el-form-item>
|
||||
<el-form-item prop="loginname" label="工  号">
|
||||
<el-input disabled maxlength="50" placeholder="正在生成工号" v-model="formData.loginname"
|
||||
<el-input :disabled="!!formData.matchedUserId" maxlength="50" placeholder="留空自动生成,也可手动填写" v-model="formData.loginname"
|
||||
type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="性  别" prop="sex">
|
||||
<el-radio-group v-model="formData.sex">
|
||||
<el-radio-group v-model="formData.sex" :disabled="!!formData.matchedUserId && !!selectedExternalUser && !!selectedExternalUser.sex">
|
||||
<el-radio :label="'男'" border>男</el-radio>
|
||||
<el-radio :label="'女'" border>女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号" prop="idcard">
|
||||
<el-input maxlength="18" placeholder="请填写身份证号"
|
||||
v-model="formData.idcard" @input="updateExternalBirthday"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="出生年月" prop="birthday">
|
||||
<el-date-picker
|
||||
placeholder="选择出生年月"
|
||||
style="width: 100%"
|
||||
type="date"
|
||||
v-model="formData.birthday"
|
||||
value-format="yyyy-MM-dd">
|
||||
</el-date-picker>
|
||||
<el-date-picker style="width: 100%" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="从身份证号读取,也可手动选择" v-model="formData.birthday"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="电  话" prop="mobile">
|
||||
<el-input maxlength="11" placeholder="请填写电话" type="text"
|
||||
v-model="formData.mobile"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="unitId" label="所在单位">
|
||||
<el-input disabled v-model="formData.unitname"></el-input>
|
||||
<el-form-item prop="unitname" label="所在单位">
|
||||
<el-select v-if="formData.matchedUserId" filterable style="width: 100%"
|
||||
placeholder="请选择报名使用的单位" v-model="formData.unitId" @change="changeExternalUnit">
|
||||
<el-option v-for="item in unitOptions" :key="item.id" :label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-autocomplete v-else style="width: 100%" maxlength="100"
|
||||
placeholder="搜索选择单位,或直接输入其他单位"
|
||||
:fetch-suggestions="searchExternalUnit" v-model="formData.unitname"
|
||||
@input="changeExternalUnitInput" @select="selectExternalUnit"></el-autocomplete>
|
||||
</el-form-item>
|
||||
<el-form-item label="身体条件" prop="fitForCompetition">
|
||||
<el-radio-group v-model="formData.fitForCompetition">
|
||||
<el-radio :label="true" border>适合参赛</el-radio>
|
||||
<el-radio :label="false" border>不适合参赛</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="formLoading" @click="doAddUser(false)">确 定</el-button>
|
||||
<el-button type="primary" :loading="formLoading" :disabled="formData.fitForCompetition !== true"
|
||||
@click="doAddUser(false)">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
@@ -949,35 +968,58 @@ layout("/layouts/platform.html"){
|
||||
>
|
||||
<el-form :model="formData" ref="singleExternalForm" :rules="lsryRules" label-width="100px">
|
||||
<el-form-item prop="username" label="姓  名">
|
||||
<el-input maxlength="50" placeholder="请填写姓名" v-model="formData.username"
|
||||
type="text"></el-input>
|
||||
<el-autocomplete style="width: 100%" maxlength="50" :trigger-on-focus="false"
|
||||
placeholder="输入姓名或工号搜索,未匹配时直接填写姓名"
|
||||
:fetch-suggestions="searchExternalUser" v-model="formData.username"
|
||||
@input="changeExternalName" @select="selectExternalUser">
|
||||
<template slot-scope="{ item }">{{item.username}}({{item.loginname}})</template>
|
||||
</el-autocomplete>
|
||||
</el-form-item>
|
||||
<el-form-item prop="loginname" label="工  号">
|
||||
<el-input disabled maxlength="50" placeholder="正在生成工号" v-model="formData.loginname"
|
||||
<el-input :disabled="!!formData.matchedUserId" maxlength="50" placeholder="留空自动生成,也可手动填写" v-model="formData.loginname"
|
||||
type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="性  别" prop="sex">
|
||||
<el-radio-group v-model="formData.sex">
|
||||
<el-radio-group v-model="formData.sex" :disabled="!!formData.matchedUserId && !!selectedExternalUser && !!selectedExternalUser.sex">
|
||||
<el-radio :label="'男'" border>男</el-radio>
|
||||
<el-radio :label="'女'" border>女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号" prop="idcard">
|
||||
<el-input maxlength="18" placeholder="请填写身份证号"
|
||||
v-model="formData.idcard" @input="updateExternalBirthday"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="出生年月" prop="birthday">
|
||||
<el-date-picker placeholder="选择出生年月" style="width: 100%" type="date"
|
||||
v-model="formData.birthday" value-format="yyyy-MM-dd"></el-date-picker>
|
||||
<el-date-picker style="width: 100%" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="从身份证号读取,也可手动选择" v-model="formData.birthday"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item prop="mobile" label="电  话">
|
||||
<el-input maxlength="11" placeholder="请填写电话" v-model="formData.mobile"
|
||||
type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="unitId" label="所在单位">
|
||||
<el-input disabled v-model="formData.unitname"></el-input>
|
||||
<el-form-item prop="unitname" label="所在单位">
|
||||
<el-select v-if="formData.matchedUserId" filterable style="width: 100%"
|
||||
placeholder="请选择报名使用的单位" v-model="formData.unitId" @change="changeExternalUnit">
|
||||
<el-option v-for="item in unitOptions" :key="item.id" :label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-autocomplete v-else style="width: 100%" maxlength="100"
|
||||
placeholder="搜索选择单位,或直接输入其他单位"
|
||||
:fetch-suggestions="searchExternalUnit" v-model="formData.unitname"
|
||||
@input="changeExternalUnitInput" @select="selectExternalUnit"></el-autocomplete>
|
||||
</el-form-item>
|
||||
<el-form-item label="身体条件" prop="fitForCompetition">
|
||||
<el-radio-group v-model="formData.fitForCompetition">
|
||||
<el-radio :label="true" border>适合参赛</el-radio>
|
||||
<el-radio :label="false" border>不适合参赛</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible2 = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="formLoading" @click="doAddUser(true)">确 定</el-button>
|
||||
<el-button type="primary" :loading="formLoading" :disabled="formData.fitForCompetition !== true"
|
||||
@click="doAddUser(true)">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
@@ -1041,6 +1083,10 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
activeName: '',
|
||||
userOptions: [],
|
||||
selectedExternalUser: null,
|
||||
selectedExternalUnit: null,
|
||||
externalSearchLoading: false,
|
||||
externalSearchQuery: '',
|
||||
applyUsers: [],
|
||||
applyValue: [],
|
||||
applyData: [],
|
||||
@@ -1093,13 +1139,29 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
lsryRules: {
|
||||
username: [{required: true, message: '请填写姓名', trigger: 'blur'}],
|
||||
loginname: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
loginname: [{validator: (rule, value, callback) => {
|
||||
if (this.formData.matchedUserId && !value) {
|
||||
callback(new Error('所选系统人员没有工号'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
}, trigger: ['blur', 'change']}],
|
||||
sex: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
idcard: [{validator: (rule, value, callback) => {
|
||||
const card = (value || '').toUpperCase()
|
||||
const date = card.substring(6, 14)
|
||||
if (!/^[0-9]{17}[0-9X]$/.test(card) || !moment(date, 'YYYYMMDD', true).isValid()) {
|
||||
callback(new Error('请填写正确的18位身份证号'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
}, trigger: ['blur', 'change']}],
|
||||
birthday: [{required: true, message: '请选择出生年月', trigger: 'change'}],
|
||||
mobile: [
|
||||
{required: true, message: '手机号码', trigger: ['blur', 'change']},
|
||||
{pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码'}],
|
||||
unitId: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
unitname: [{required: true, message: '请选择或填写单位', trigger: ['blur', 'change']}],
|
||||
fitForCompetition: [{required: true, message: '请选择身体条件', trigger: 'change'}],
|
||||
},
|
||||
submitLoading: false,
|
||||
selection: [],
|
||||
@@ -1686,89 +1748,200 @@ layout("/layouts/platform.html"){
|
||||
this.leaderOptions = [];
|
||||
}
|
||||
},
|
||||
doAddUser(single) {
|
||||
this.$refs[single ? 'singleExternalForm' : 'form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.formLoading = true
|
||||
$.post(loc() + "/addExternalUser", {
|
||||
username: this.formData.username,
|
||||
sex: this.formData.sex,
|
||||
birthday: this.formData.birthday,
|
||||
mobile: this.formData.mobile
|
||||
}).then((res) => {
|
||||
if (res.code !== 0) {
|
||||
this.notifyError(res.msg || '外援创建失败')
|
||||
return
|
||||
}
|
||||
const user = res.data
|
||||
const data = {
|
||||
...this.formData,
|
||||
userId: user.id,
|
||||
loginname: user.loginname,
|
||||
username: user.username,
|
||||
sex: user.sex,
|
||||
birthday: user.birthday,
|
||||
mobile: user.mobile,
|
||||
unitId: user.unitid,
|
||||
unitname: '外援',
|
||||
age: moment().diff(moment(user.birthday), 'years'),
|
||||
eventId: this.eventData.eventId,
|
||||
activityId: this.activityData.id,
|
||||
team: single ? null : this.teams.find(x => x.id === this.formData.teamId).name,
|
||||
isAddUser: true
|
||||
}
|
||||
if (single) {
|
||||
this.appliedData3.push(data)
|
||||
} else {
|
||||
this.appliedData.push(data)
|
||||
}
|
||||
this.sortApplyed()
|
||||
this.flushApplyed(this.appliedData)
|
||||
this.notifySuccess('已添加外援')
|
||||
this.dialogVisible = false
|
||||
this.dialogVisible2 = false
|
||||
}).fail(() => {
|
||||
this.notifyError('外援创建失败,请重试')
|
||||
}).always(() => {
|
||||
this.formLoading = false
|
||||
})
|
||||
} else {
|
||||
this.$notify.error({title: '错误', message: '存在未填写的的必填项'});
|
||||
searchExternalUser(query, callback) {
|
||||
// 姓名输入框既可搜索系统人员,也可直接填写新人员姓名。
|
||||
this.externalSearchQuery = query
|
||||
if (!query || !query.trim()) {
|
||||
this.externalSearchLoading = false
|
||||
callback([])
|
||||
return
|
||||
}
|
||||
this.externalSearchLoading = true
|
||||
$.post(loc() + "/getSysUser", {queryString: query}).then((res) => {
|
||||
if (this.externalSearchQuery !== query) {
|
||||
callback([])
|
||||
return
|
||||
}
|
||||
const users = res.code === 0 ? (res.data || []) : []
|
||||
callback(users.map(user => ({...user, value: user.username})))
|
||||
}).fail(() => {
|
||||
callback([])
|
||||
}).always(() => {
|
||||
if (this.externalSearchQuery === query) this.externalSearchLoading = false
|
||||
})
|
||||
},
|
||||
changeExternalName(value) {
|
||||
if (!this.selectedExternalUser || value === this.selectedExternalUser.username) return
|
||||
// 修改已选姓名即退出匹配,清除旧人的资料,避免作为新人员误提交。
|
||||
this.selectedExternalUser = null
|
||||
this.$set(this.formData, 'matchedUserId', '')
|
||||
const fields = ['loginname', 'sex', 'idcard', 'birthday', 'mobile', 'unitname']
|
||||
fields.forEach(key => {
|
||||
this.$set(this.formData, key, '')
|
||||
})
|
||||
this.$set(this.formData, 'unitId', "${@shiro.getPrincipalProperty('unit').getId()}")
|
||||
this.selectedExternalUnit = null
|
||||
},
|
||||
selectExternalUser(user) {
|
||||
// 选中候选人后复用其账号,系统字段为空的部分可在下方补填。
|
||||
this.selectedExternalUser = user
|
||||
this.$set(this.formData, 'matchedUserId', user.id)
|
||||
const fields = ['username', 'loginname', 'sex', 'idcard', 'birthday', 'mobile']
|
||||
fields.forEach(key => {
|
||||
this.$set(this.formData, key, user[key] || '')
|
||||
})
|
||||
const card = (user.idcard || '').toUpperCase()
|
||||
const date = card.substring(6, 14)
|
||||
if (!user.birthday && /^[0-9]{17}[0-9X]$/.test(card) && moment(date, 'YYYYMMDD', true).isValid()) {
|
||||
this.$set(this.formData, 'birthday', moment(date, 'YYYYMMDD').format('YYYY-MM-DD'))
|
||||
}
|
||||
const unit = this.unitOptions.find(item => item.id === user.unitid)
|
||||
this.$set(this.formData, 'unitId', unit ? unit.id : '')
|
||||
this.$set(this.formData, 'unitname', unit ? unit.name : '')
|
||||
},
|
||||
changeExternalUnit(id) {
|
||||
const unit = this.unitOptions.find(item => item.id === id)
|
||||
this.$set(this.formData, 'unitname', unit ? unit.name : '')
|
||||
},
|
||||
searchExternalUnit(query, callback) {
|
||||
const units = this.unitOptions.filter(item => !query || item.name.indexOf(query) > -1)
|
||||
callback(units.slice(0, 30).map(item => ({...item, value: item.name})))
|
||||
},
|
||||
changeExternalUnitInput(value) {
|
||||
// 手动改写单位名称后解除已选单位 ID,报名归属仍沿用操作人的单位。
|
||||
if (this.selectedExternalUnit && value !== this.selectedExternalUnit.name) {
|
||||
this.selectedExternalUnit = null
|
||||
this.$set(this.formData, 'unitId', "${@shiro.getPrincipalProperty('unit').getId()}")
|
||||
}
|
||||
},
|
||||
selectExternalUnit(unit) {
|
||||
this.selectedExternalUnit = unit
|
||||
this.$set(this.formData, 'unitId', unit.id)
|
||||
this.$set(this.formData, 'unitname', unit.name)
|
||||
},
|
||||
updateExternalBirthday(value) {
|
||||
// 身份证号变化时重新计算出生年月,避免沿用系统中可能错误的日期。
|
||||
const card = (value || '').toUpperCase()
|
||||
const date = card.substring(6, 14)
|
||||
const birthday = /^[0-9]{17}[0-9X]$/.test(card) && moment(date, 'YYYYMMDD', true).isValid()
|
||||
? moment(date, 'YYYYMMDD').format('YYYY-MM-DD') : ''
|
||||
this.$set(this.formData, 'birthday', birthday)
|
||||
},
|
||||
addExternalToApply(user, single) {
|
||||
const data = {
|
||||
...this.formData,
|
||||
userId: user.id,
|
||||
loginname: user.loginname,
|
||||
username: user.username,
|
||||
sex: this.formData.sex,
|
||||
idcard: this.formData.idcard,
|
||||
idCard: this.formData.idcard,
|
||||
birthday: this.formData.birthday,
|
||||
mobile: this.formData.mobile,
|
||||
unitId: this.formData.unitId,
|
||||
unitname: this.formData.unitname.trim(),
|
||||
age: this.formData.birthday ? moment().diff(moment(this.formData.birthday), 'years') : null,
|
||||
eventId: this.eventData.eventId,
|
||||
activityId: this.activityData.id,
|
||||
team: single ? null : this.teams.find(item => item.id === this.formData.teamId).name,
|
||||
isAddUser: true
|
||||
}
|
||||
if (single) {
|
||||
this.appliedData3.push(data)
|
||||
} else {
|
||||
this.appliedData.push(data)
|
||||
}
|
||||
// 系统人员可能仍在左侧可报名单中,移除该选项以免同一项目重复加入。
|
||||
this.applyData = this.applyData.filter(item => item.id !== user.id)
|
||||
this.applyValue = this.applyValue.filter(id => id !== user.id)
|
||||
this.rightChecked = this.rightChecked.filter(id => id !== user.id)
|
||||
this.sortApplyed()
|
||||
this.flushApplyed(this.appliedData)
|
||||
this.notifySuccess('已添加报名人员')
|
||||
this.dialogVisible = false
|
||||
this.dialogVisible2 = false
|
||||
},
|
||||
doAddUser(single) {
|
||||
// 匹配人员直接加入报名;未匹配人员先创建账号,再加入本次报名。
|
||||
if (this.formData.fitForCompetition !== true) return
|
||||
this.$refs[single ? 'singleExternalForm' : 'form'].validate((valid) => {
|
||||
if (!valid) {
|
||||
this.$notify.error({title: '错误', message: '存在未填写或不正确的必填项'})
|
||||
return
|
||||
}
|
||||
if (!this.formData.unitname || !this.formData.unitname.trim()) {
|
||||
this.notifyError('请选择或填写单位')
|
||||
return
|
||||
}
|
||||
if (this.appliedData.concat(this.appliedData3).some(item => item.userId === this.formData.matchedUserId)) {
|
||||
this.notifyError('该人员已在当前项目报名列表中')
|
||||
return
|
||||
}
|
||||
if (this.formData.matchedUserId) {
|
||||
if (this.selectedExternalUser && this.selectedExternalUser.id === this.formData.matchedUserId) {
|
||||
this.addExternalToApply(this.selectedExternalUser, single)
|
||||
}
|
||||
return
|
||||
}
|
||||
this.formLoading = true
|
||||
$.post(loc() + "/addExternalUser", {
|
||||
username: this.formData.username,
|
||||
loginname: this.formData.loginname,
|
||||
sex: this.formData.sex,
|
||||
idcard: this.formData.idcard,
|
||||
mobile: this.formData.mobile,
|
||||
fitForCompetition: this.formData.fitForCompetition
|
||||
}).then((res) => {
|
||||
if (res.code !== 0) {
|
||||
this.notifyError(res.msg || '外援创建失败')
|
||||
return
|
||||
}
|
||||
this.addExternalToApply(res.data, single)
|
||||
}).fail(() => {
|
||||
this.notifyError('外援创建失败,请重试')
|
||||
}).always(() => {
|
||||
this.formLoading = false
|
||||
})
|
||||
})
|
||||
},
|
||||
openAddUser() {
|
||||
this.formData = {
|
||||
teamId: this.team,
|
||||
identity: ['1'],
|
||||
username: '',
|
||||
loginname: '',
|
||||
sex: '',
|
||||
idcard: '',
|
||||
birthday: '',
|
||||
mobile: '',
|
||||
unitId: "${@shiro.getPrincipalProperty('unit').getId()}",
|
||||
unitname: '外援'
|
||||
unitname: '',
|
||||
matchedUserId: '',
|
||||
fitForCompetition: null
|
||||
}
|
||||
this.selectedExternalUser = null
|
||||
this.selectedExternalUnit = null
|
||||
this.externalSearchQuery = ''
|
||||
this.dialogVisible = true
|
||||
this.previewExternalNumber()
|
||||
},
|
||||
previewExternalNumber() {
|
||||
this.formLoading = true
|
||||
$.post(loc() + "/previewExternalLoginname", {}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$set(this.formData, 'loginname', res.data)
|
||||
} else {
|
||||
this.notifyError(res.msg || '工号生成失败')
|
||||
}
|
||||
}).fail(() => {
|
||||
this.notifyError('工号生成失败,请重试')
|
||||
}).always(() => {
|
||||
this.formLoading = false
|
||||
})
|
||||
},
|
||||
openAddUserD() {
|
||||
this.formData = {
|
||||
identity: ['1'],
|
||||
username: '',
|
||||
loginname: '',
|
||||
sex: '',
|
||||
idcard: '',
|
||||
birthday: '',
|
||||
mobile: '',
|
||||
unitId: "${@shiro.getPrincipalProperty('unit').getId()}",
|
||||
unitname: '外援'
|
||||
unitname: '',
|
||||
matchedUserId: '',
|
||||
fitForCompetition: null
|
||||
}
|
||||
this.selectedExternalUser = null
|
||||
this.selectedExternalUnit = null
|
||||
this.externalSearchQuery = ''
|
||||
this.dialogVisible2 = true
|
||||
this.previewExternalNumber()
|
||||
},
|
||||
async doApplied(flag1) {
|
||||
|
||||
|
||||
@@ -121,8 +121,11 @@ layout("/layouts/platform.html"){
|
||||
</template>
|
||||
|
||||
<template v-else-if="column.prop=='startTime'" scope="{row}">
|
||||
{{moment(row.startTime).format('YYYY-MM-DD')}} -
|
||||
{{moment(row.endTime).format('YYYY-MM-DD')}}
|
||||
<span v-if="row.startTime && row.endTime">
|
||||
{{moment(row.startTime).format('YYYY-MM-DD')}} -
|
||||
{{moment(row.endTime).format('YYYY-MM-DD')}}
|
||||
</span>
|
||||
<span v-else>未设置</span>
|
||||
</template>
|
||||
|
||||
<template v-else-if="column.prop=='state'"
|
||||
|
||||
@@ -17,8 +17,8 @@ layout("/layouts/platform.html"){
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
style="width: 100%"
|
||||
placeholder="选择年度"
|
||||
type="year"
|
||||
placeholder="全部年度"
|
||||
type="year" clearable @change="handleYearChange"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
@@ -27,13 +27,13 @@ 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 clearable
|
||||
<el-select v-model="pageForm.projectId" placeholder="请选择项目名称" filterable clearable :loading="projectLoading"
|
||||
style="width: 100%" @change="doSearch">
|
||||
<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>
|
||||
@@ -113,6 +113,7 @@ layout("/layouts/platform.html"){
|
||||
],
|
||||
buyClothesUserData: [],
|
||||
projectList: [],
|
||||
projectLoading: false,
|
||||
unionList: [],
|
||||
}
|
||||
},
|
||||
@@ -128,15 +129,43 @@ layout("/layouts/platform.html"){
|
||||
this.$refs['guava'].view()
|
||||
}
|
||||
},
|
||||
//获取所有买服装的项目
|
||||
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)
|
||||
})
|
||||
},
|
||||
// 年度变化后清空不属于新年度的项目选择,再按当前条件查询台账。
|
||||
handleYearChange() {
|
||||
const year = this.pageForm.year
|
||||
this.$set(this.pageForm, 'projectId', null)
|
||||
this.$set(this, 'projectList', [])
|
||||
this.getBuyClothesProject(year).then((projects) => {
|
||||
if (this.pageForm.year !== year) return
|
||||
this.$set(this, 'projectList', projects)
|
||||
this.doSearch()
|
||||
})
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.projectList = await this.getBuyClothesProject()
|
||||
this.unionList = await getUnion()
|
||||
created() {
|
||||
const year = this.pageForm.year
|
||||
this.getBuyClothesProject(year).then((projects) => {
|
||||
if (this.pageForm.year !== year) return
|
||||
this.$set(this, 'projectList', projects)
|
||||
})
|
||||
getUnion().then((unions) => {
|
||||
this.$set(this, 'unionList', unions)
|
||||
})
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
@@ -144,4 +173,4 @@ layout("/layouts/platform.html"){
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
#-->
|
||||
|
||||
@@ -17,8 +17,8 @@ layout("/layouts/platform.html"){
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
style="width: 100%"
|
||||
placeholder="选择年度"
|
||||
type="year"
|
||||
placeholder="全部年度"
|
||||
type="year" clearable @change="handleYearChange"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
@@ -27,13 +27,13 @@ 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 clearable
|
||||
<el-select v-model="pageForm.projectId" placeholder="请选择项目名称" filterable clearable :loading="projectLoading"
|
||||
style="width: 100%" @change="doSearch">
|
||||
<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>
|
||||
@@ -111,6 +111,7 @@ layout("/layouts/platform.html"){
|
||||
],
|
||||
buyClothesUserData: [],
|
||||
projectList: [],
|
||||
projectLoading: false,
|
||||
note: '',
|
||||
clickRow: {},
|
||||
}
|
||||
@@ -177,10 +178,32 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
}
|
||||
},
|
||||
//获取所有买服装的项目
|
||||
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)
|
||||
})
|
||||
},
|
||||
// 年度变化后清空不属于新年度的项目选择,再按当前条件查询登记记录。
|
||||
handleYearChange() {
|
||||
const year = this.pageForm.year
|
||||
this.$set(this.pageForm, 'projectId', null)
|
||||
this.$set(this, 'projectList', [])
|
||||
this.getBuyClothesProject(year).then((projects) => {
|
||||
if (this.pageForm.year !== year) return
|
||||
this.$set(this, 'projectList', projects)
|
||||
this.doSearch()
|
||||
})
|
||||
},
|
||||
doExport(row) {
|
||||
const loading = this.$loading({
|
||||
@@ -221,8 +244,12 @@ layout("/layouts/platform.html"){
|
||||
}).catch((err) => {})
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.projectList = await this.getBuyClothesProject()
|
||||
created() {
|
||||
const year = this.pageForm.year
|
||||
this.getBuyClothesProject(year).then((projects) => {
|
||||
if (this.pageForm.year !== year) return
|
||||
this.$set(this, 'projectList', projects)
|
||||
})
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
@@ -230,4 +257,4 @@ layout("/layouts/platform.html"){
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
#-->
|
||||
|
||||
@@ -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