This commit is contained in:
2026-09-11 15:56:51 +08:00
parent a12ef31f26
commit dc63a51638
31 changed files with 5433 additions and 3068 deletions
@@ -69,11 +69,12 @@ const initTableMixins = {
const address = this.pageDataUrl ? this.pageDataUrl : loc() + "/pageData"
this.tableLoading = true
this.$axios.post(address, data ? data : this.pageForm).then((res) => {
this.tableLoading = false
if (res.code === 0) {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
}
}).finally(() => {
this.tableLoading = false
})
},
notifySuccess(msg) {
File diff suppressed because it is too large Load Diff
@@ -4,47 +4,57 @@ layout("/layouts/platform.html"){
<style>
</style>
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="姓名工号">
<el-input placeholder="请输入关键字查询" v-model="pageForm.keyWord"></el-input>
</search-item>
<search-item label="所属工会">
<el-select v-model="pageForm.unionId" clearable filterable placeholder="请选择所属工会"
style="width: 100%">
<el-option
v-for="item in unionList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</search-item>
</search>
<div class="search">
<div class="search-item">
<div class="search-item-label">姓名工号:</div>
<div class="search-item-option">
<el-input placeholder="请输入关键字查询" v-model="pageForm.keyWord"></el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select v-model="pageForm.unionId" clearable filterable placeholder="请选择院级工会"
style="width: 100%">
<el-option
v-for="item in unionList"
:key="item.id"
:label="item.unionname"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button icon="el-icon-search" type="primary" @click="doSearch"></el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="绑定列表">
<el-dropdown @command="dropdownCommand">
<el-button size="medium" type="danger">
批量删除&emsp;
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'delete2'}">
删除已选
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete3'}">
全部删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<table-tool :app="this" label="绑定列表">
<el-dropdown @command="dropdownCommand">
<el-button size="medium" type="danger">
批量删除&emsp;
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'delete2'}">
删除已选
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete3'}">
全部删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</table-tool>
<el-table :data="tableData" style="width: 100%" row-key="_id" @sort-change="pageOrder"
v-loading="tabLoading" @selection-change="handleSelectionChange">
v-loading="tableLoading" @selection-change="handleSelectionChange">
<el-table-column :reserve-selection="true"
type="selection"
width="55">
@@ -88,18 +98,13 @@ layout("/layouts/platform.html"){
</guava>
</div>
<script>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
v: "index",
stepActive: 0,
tabLoading: false,
subDis: false,
formData: {},
tableData: [],
pageForm: {
searchName: "name",
searchKeyword: "",
@@ -114,7 +119,7 @@ layout("/layouts/platform.html"){
}
},
methods: {
dropdownCommand: function (command) {
dropdownCommand(command) {
const {type, data} = command
if (type == 'delete2') {
this.doDelete2()
@@ -122,30 +127,36 @@ layout("/layouts/platform.html"){
this.doDelete3()
}
},
async doDelete(id) {
doDelete(id) {
this.$confirm('是否确定删除!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
callback: (a, b) => {
if ("confirm" == a) {//确认后再执行
const {
code,
data,
msg
} = await this.$axios.post(loc() + "/delete", {ids: JSON.stringify([id])})
if (code === 0) {
this.$message({message: msg, type: 'success'});
this.pageData()
} else {
this.$message({message: data.msg, type: 'error'});
}
this.$set(this, "formLoading", true)
this.$axios.post(loc() + "/delete", {ids: JSON.stringify([id])}).then((res) => {
if (res.code == 0) {
this.$message({
message: res.msg,
type: 'success'
});
this.pageData()
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
}).finally(() => {
this.$set(this, "formLoading", false)
})
}
}
})
},
async doDelete2() {
doDelete2() {
if (!this.multipleSelection.length) {
this.$notify({
@@ -160,104 +171,73 @@ layout("/layouts/platform.html"){
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
callback: (a, b) => {
if ("confirm" === a) {//确认后再执行
const arr = this.multipleSelection.map(v => {
return v._id
})
const {code, data, msg} = await this.$axios.post(loc() + "/delete", {ids: JSON.stringify(arr)})
if (code === 0) {
this.multipleSelection = []
this.$message({
message: msg,
type: 'success'
});
this.pageData()
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
this.$set(this, "formLoading", true)
this.$axios.post(loc() + "/delete", {ids: JSON.stringify(arr)}).then((res) => {
if (res.code == 0) {
this.$set(this, "multipleSelection", [])
this.$message({
message: res.msg,
type: 'success'
});
this.pageData()
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
}).finally(() => {
this.$set(this, "formLoading", false)
})
}
}
})
},
async doDelete3() {
doDelete3() {
this.$confirm('是否确定删除全部登录记录!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (a, b) => {
callback: (a, b) => {
if ("confirm" == a) {//确认后再执行
const {code, data, msg} = await this.$axios.post(loc() + "/deleteAll")
if (code === 0) {
this.multipleSelection = []
this.$message({
message: msg,
type: 'success'
});
this.pageData()
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
this.$set(this, "formLoading", true)
this.$axios.post(loc() + "/deleteAll").then((res) => {
if (res.code == 0) {
this.$set(this, "multipleSelection", [])
this.$message({
message: res.msg,
type: 'success'
});
this.pageData()
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
}).finally(() => {
this.$set(this, "formLoading", false)
})
}
}
})
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
doSearch() {
this.tabKey = new Date().getTime()
this.pageForm.pageNumber = 1
this.pageData()
},
pageOrder(column) {//按字段排序
this.pageForm.pageOrderName = column.prop;
this.pageForm.pageOrderBy = column.order;
this.pageData();
},
pageNumberChange(val) {//页码更新操作
this.pageForm.pageNumber = val;
this.pageData();
},
pageSizeChange(val) {//分页大小更新操作
this.pageForm.pageSize = val;
this.pageData();
},
pageData() {//加载分页数据
this.tabLoading = true
this.$axios.post(loc() + "/pageData", this.pageForm)
.then(res => {
this.tabLoading = false
if (res.code === 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
})
},
this.$set(this, "multipleSelection", val);
}
},
async created() {
created() {
this.pageData();
const hasAdminRole = this.$auth.hasRoleOr("SYSADMIN, SCHOOL_UNION_ADMIN")
if (hasAdminRole) {
this.unionList = await this.$businessTool.listUnion()
} else {
this.unionList = await this.$businessTool.listUnion(this.$store.user.union.id)
}
this.$businessTool.listUnion(null).then((res) => {
this.$set(this, "unionList", res)
})
}
})
</script>
@@ -1,59 +1,90 @@
<!--#
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年份">
<el-date-picker
:clearable="false"
placeholder="选择年"
style="width: 100%"
@change="getCascadersActivity"
type="year" v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</search-item>
<search-item label="活动">
<el-cascader
style="width: 100%"
@change="doSearch"
v-model="pageForm.activityId"
:options="activityOptions"
:props="{ checkStrictly: true,emitPath:false}"
clearable></el-cascader>
</search-item>
</search>
<div class="search">
<div class="search-item">
<div class="search-item-label">年份:</div>
<div class="search-item-option">
<el-date-picker
:clearable="false"
placeholder="选择年"
style="width: 100%"
@change="getCascadersActivity"
type="year" 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">
<div style="display: flex; align-items: center; gap: 10px;">
<el-select
:style="{width: subActivityOptions.length > 0 ? '50%' : '100%'}"
placeholder="请选择主活动"
@change="mainActivityChange"
v-model="pageForm.mainActivityId"
clearable>
<el-option
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in activityOptions"></el-option>
</el-select>
<el-select
v-if="subActivityOptions.length > 0"
style="width: 50%"
placeholder="请选择分活动"
@change="subActivityChange"
v-model="pageForm.subActivityId"
clearable>
<el-option
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in subActivityOptions"></el-option>
</el-select>
</div>
</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 label="参与列表">
<el-button @click="$downLoad(loc() + '/exportUnionRegCheckInNum', {activityId : pageForm.activityId})"
<table-tool :app="this" label="参与列表">
<el-button @click="window.open(loc()+'/exportUnionRegCheckInNum?'+buildActivityQueryString())"
class="ml10"
size="small"
type="primary"
icon="el-icon-download">
导出报名及打卡人数
</el-button>
<el-button @click="$downLoad(loc() + '/exportNotGetGiftVoucherUsers', {activityId : pageForm.activityId})"
class="ml10"
size="small"
type="primary"
icon="el-icon-download">
<el-button
@click="window.open(loc()+'/exportNotGetGiftVoucherUsers?'+buildActivityQueryString())"
class="ml10"
size="small"
type="primary"
icon="el-icon-download">
导出未取得礼品券人员
</el-button>
<el-button @click="$downLoad(loc() + '/exportNotGetGiftVoucherUsers', {activityId : pageForm.activityId})"
class="ml10"
size="small"
type="primary"
icon="el-icon-download">
<el-button
@click="window.open(loc()+'/exportNotUseGiftVoucherUsers?'+buildActivityQueryString())"
class="ml10"
size="small"
type="primary"
icon="el-icon-download">
导出未使用礼品券用户
</el-button>
</table-tool>
<el-table :data="tableData" :size="tableSize" show-summary>
<el-table :data="tableData" :size="tableSize" show-summary v-loading="tableLoading">
<el-table-column :index="indexMethod" align="center" header-align="center" label="序号" type="index"
width="80px"></el-table-column>
<el-table-column
@@ -90,13 +121,21 @@ layout("/layouts/platform.html"){
</el-button>
</div>
</template>
<el-table :data="regTableData" style="width: 100%" row-key="_id" max-height="600px">
<el-table-column label="工号" prop="loginname"></el-table-column>
<el-table-column label="姓名" prop="username"></el-table-column>
<el-table-column label="性别" prop="sex"></el-table-column>
<el-table-column label="单位" prop="unitname" show-overflow-tooltip></el-table-column>
<el-table-column label="电话" prop="mobile"></el-table-column>
<el-table-column label="报名时间" prop="register_time_str"></el-table-column>
<el-table :data="regTableData" style="width: 100%" row-key="_id" max-height="600px"
v-loading="tableLoading">
<el-table-column label="活动名称" prop="activityName" show-overflow-tooltip align="center"
header-align="center"></el-table-column>
<el-table-column label="工号" prop="loginname" align="center"
header-align="center"></el-table-column>
<el-table-column label="姓名" prop="username" align="center"
header-align="center"></el-table-column>
<el-table-column label="性别" prop="sex" align="center"
header-align="center"></el-table-column>
<el-table-column label="单位" prop="unitname" show-overflow-tooltip align="center"
header-align="center"></el-table-column>
<!-- <el-table-column label="电话" prop="mobile"></el-table-column>-->
<el-table-column label="报名时间" prop="register_time_str" align="center"
header-align="center"></el-table-column>
</el-table>
</el-card>
<el-card shadow="never" v-else-if="viewIndex==='checkInTableShow'">
@@ -111,15 +150,24 @@ layout("/layouts/platform.html"){
</el-button>
</div>
</template>
<el-table :data="regTableData" style="width: 100%" row-key="_id" max-height="600px">
<el-table-column label="工号" prop="loginname"></el-table-column>
<el-table-column label="姓名" prop="username"></el-table-column>
<el-table-column label="性别" prop="sex"></el-table-column>
<el-table-column label="单位" prop="unitname" show-overflow-tooltip></el-table-column>
<el-table-column label="电话" prop="mobile"></el-table-column>
<el-table-column label="点位总数" prop="pts_size"></el-table-column>
<el-table-column label="已打卡点位数" prop="sign_size"></el-table-column>
<el-table-column label="礼品券" prop="used">
<el-table :data="regTableData" style="width: 100%" row-key="_id" max-height="600px"
v-loading="tableLoading">
<el-table-column label="活动名称" prop="activityName" show-overflow-tooltip align="center"
header-align="center"></el-table-column>
<el-table-column label="工号" prop="loginname" align="center"
header-align="center"></el-table-column>
<el-table-column label="姓名" prop="username" align="center"
header-align="center"></el-table-column>
<el-table-column label="性别" prop="sex" align="center"
header-align="center"></el-table-column>
<el-table-column label="单位" prop="unitname" show-overflow-tooltip align="center"
header-align="center"></el-table-column>
<!-- <el-table-column label="电话" prop="mobile"></el-table-column>-->
<el-table-column label="点位总数" prop="pts_size" align="center"
header-align="center"></el-table-column>
<el-table-column label="已打卡点位数" prop="sign_size" align="center"
header-align="center"></el-table-column>
<el-table-column v-if="showGiftVoucherColumn" label="礼品券" prop="used">
<template scope="{row}">
<span v-if="row.used==null" class="text-danger">未取得</span>
<span v-else-if="row.used" class="text-success">已使用</span>
@@ -132,7 +180,7 @@ layout("/layouts/platform.html"){
</guava>
</div>
<script>
<script nonce="${cspNonce!}">
let vue = new Vue({
el: '#app',
mixins: [initTableMixins],
@@ -143,6 +191,8 @@ layout("/layouts/platform.html"){
{label: '报名人数', prop: 'regCount'},
{label: '打卡人数', prop: 'checkInCount'},
],
// 礼品券列按当前需求先隐藏,代码保留便于后续恢复。
showGiftVoucherColumn: false,
unionOptions: [],
unitOptions: [],
pageForm: {
@@ -150,9 +200,13 @@ layout("/layouts/platform.html"){
unitId: '',
activityDate: [],
year: new Date().getFullYear() + '',
mainActivityId: '',
subActivityId: '',
activityId: '',
},
activityOptions: [],
subActivityOptions: [],
regTableData: [],
checkInTableData: [],
@@ -163,38 +217,34 @@ layout("/layouts/platform.html"){
},
methods: {
viewReg({id, unionname}) {
this.viewUnion.unionId = id
this.viewUnion.unionname = unionname
this.$refs.guava.view(() => {
this.viewIndex = 'regTableShow'
this.$axios.post(loc() + '/unionRegistrationData', {
unionId: id,
activityId: this.pageForm.activityId
}).then(res => {
if (res.code === 0) {
this.regTableData = res.data
} else {
this.$message.error(res.msg)
}
})
this.$set(this.viewUnion, "unionId", id)
this.$set(this.viewUnion, "unionname", unionname)
this.$set(this, "viewIndex", 'regTableShow')
this.$axios.post(loc() + '/unionRegistrationData', Object.assign({
unionId: id
}, this.buildActivityRequestParams())).then(res => {
if (res.code === 0) {
this.$set(this, "regTableData", res.data)
} else {
this.$message.error(res.msg)
}
})
this.$refs.guava.view()
},
viewCheckIn({id, unionname}) {
this.viewUnion.unionId = id
this.viewUnion.unionname = unionname
this.$refs.guava.view(() => {
this.viewIndex = 'checkInTableShow'
this.$axios.post(loc() + '/unionCheckInData', {
unionId: id,
activityId: this.pageForm.activityId
}).then(res => {
if (res.code === 0) {
this.regTableData = res.data
} else {
this.$message.error(res.msg)
}
})
this.$set(this.viewUnion, "unionId", id)
this.$set(this.viewUnion, "unionname", unionname)
this.$set(this, "viewIndex", 'checkInTableShow')
this.$axios.post(loc() + '/unionCheckInData', Object.assign({
unionId: id
}, this.buildActivityRequestParams())).then(res => {
if (res.code === 0) {
this.$set(this, "regTableData", res.data)
} else {
this.$message.error(res.msg)
}
})
this.$refs.guava.view()
},
exportExcel() {
const {hdid, unionId, unitId, activityDate} = this.pageForm
@@ -202,58 +252,133 @@ layout("/layouts/platform.html"){
if (activityDate && activityDate.length > 0) {
activityDate1 = JSON.stringify(activityDate)
}
this.$downLoad(loc() + "/exportExcel", {
hdid: hdid,
unionId: unionId,
unitId: unitId,
activityDate: activityDate1
})
window.open(loc() + '/exportExcel?hdid=' + hdid + '&unionId=' + unionId + '&unitId=' + unitId + '&activityDate=' + activityDate1)
},
activityDateChange() {
},
async unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
/**
* 统一返回当前活动查询参数。
* 后端会根据主活动、分活动和最终 activityId 决定查单条活动还是查关联活动集合。
*/
buildActivityRequestParams() {
return {
mainActivityId: this.pageForm.mainActivityId,
subActivityId: this.pageForm.subActivityId,
activityId: this.pageForm.activityId
}
},
/**
* 导出接口使用 queryString 传参,这里统一拼接,避免多个按钮重复维护。
*/
buildActivityQueryString() {
const params = this.buildActivityRequestParams()
return 'mainActivityId=' + encodeURIComponent(params.mainActivityId || '')
+ '&subActivityId=' + encodeURIComponent(params.subActivityId || '')
+ '&activityId=' + encodeURIComponent(params.activityId || '')
},
/**
* 根据主活动构建分活动选项,并同步当前真正查询用的活动id。
* 如果主活动下没有分活动,则直接使用主活动id作为查询条件。
*/
syncActivitySelection(mainActivityId, needSearch) {
const currentMainActivity = this.activityOptions.find((item) => {
return item.value === mainActivityId
})
const children = currentMainActivity && currentMainActivity.children ? currentMainActivity.children : []
this.$set(this, 'subActivityOptions', children)
if (!currentMainActivity) {
this.$set(this.pageForm, 'mainActivityId', '')
this.$set(this.pageForm, 'subActivityId', '')
this.$set(this.pageForm, 'activityId', '')
this.$set(this, "tableData", [])
return
}
if (children.length > 0) {
const currentSubActivityId = this.pageForm.subActivityId
const subActivityId = currentSubActivityId && children.some((item) => {
return item.value === currentSubActivityId
}) ? currentSubActivityId : children[0].value
this.$set(this.pageForm, 'subActivityId', subActivityId)
this.$set(this.pageForm, 'activityId', subActivityId)
} else {
this.$set(this.pageForm, 'subActivityId', '')
this.$set(this.pageForm, 'activityId', mainActivityId)
}
if (needSearch) {
this.doSearch()
}
},
/**
* 主活动切换后,重新加载对应的分活动,并默认选中第一条可用分活动。
*/
mainActivityChange(val) {
this.$set(this.pageForm, 'mainActivityId', val || '')
this.$set(this.pageForm, 'subActivityId', '')
this.syncActivitySelection(this.pageForm.mainActivityId, true)
},
/**
* 分活动切换后,同步最终查询用的活动id。
*/
subActivityChange(val) {
this.$set(this.pageForm, 'subActivityId', val || '')
this.$set(this.pageForm, 'activityId', val || this.pageForm.mainActivityId || '')
this.doSearch()
},
unionChange(val) {
this.$set(this.pageForm, "unitId", null)
this.$businessTool.listUnit(val).then((res) => {
this.$set(this, "unitOptions", res)
this.doSearch()
})
},
pageData() {
this.$set(this, "tableLoading", true)
this.$axios.post(loc() + '/pageData', this.pageForm).then(res => {
if (res.code === 0) {
this.tableData = res.data
this.$set(this, "tableData", res.data)
} else {
this.$message.error(res.msg)
}
}).finally(() => {
this.$set(this, "tableLoading", false)
})
},
async getCascadersActivity() {
const {code, data} = await this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year})
this.activityOptions = data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
this.pageData()
} else {
this.tableData = []
}
getCascadersActivity() {
this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year}).then((res) => {
this.$set(this, 'activityOptions', res.data || [])
if (this.activityOptions && this.activityOptions.length > 0) {
this.$set(this.pageForm, 'mainActivityId', this.activityOptions[0].value)
this.$set(this.pageForm, 'subActivityId', '')
this.syncActivitySelection(this.pageForm.mainActivityId, false)
this.pageData()
} else {
this.$set(this, 'subActivityOptions', [])
this.$set(this.pageForm, 'mainActivityId', '')
this.$set(this.pageForm, 'subActivityId', '')
this.$set(this.pageForm, 'activityId', '')
this.$set(this, "tableData", [])
}
})
},
exportCheckInUsers() {
this.$downLoad(loc() + '/exportCheckInUsers', {
unionId: this.viewUnion.unionId,
activityId: this.pageForm.activityId
})
window.open(loc() + '/exportCheckInUsers?unionId=' + this.viewUnion.unionId + '&' + this.buildActivityQueryString())
},
exportRegUsers(){
this.$downLoad(loc() + '/exportRegUsers', {
unionId: this.viewUnion.unionId,
activityId: this.pageForm.activityId
})
exportRegUsers() {
window.open(loc() + '/exportRegUsers?unionId=' + this.viewUnion.unionId + '&' + this.buildActivityQueryString())
}
},
async created() {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
await this.getCascadersActivity()
created() {
this.$businessTool.listUnion().then((res) => {
this.$set(this, "unionOptions", res)
return this.$businessTool.listUnit()
}).then((res) => {
this.$set(this, "unitOptions", res)
this.getCascadersActivity()
})
}
})
</script>
@@ -7,64 +7,79 @@ layout("/layouts/platform.html"){
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年份">
<el-date-picker style="width: 100%"
class="mr5"
:picker-options="pickerOptions"
v-model="pageForm.year" :clearable="false"
type="year"
value-format="yyyy" @change="getCascadersActivity"
placeholder="选择年">
</el-date-picker>
</search-item>
<search-item label="活动">
<el-cascader
style="width: 100%"
@change="doSearch()"
v-model="pageForm.activityId"
:options="activityOptions"
:props="{ checkStrictly: true,emitPath:false}"
:clearable="false"></el-cascader>
</search-item>
<search-item label="姓名工号">
<el-input placeholder="请输入姓名或工号查询" clearable v-model="pageForm.searchKeyword"
style="width: 100%" @keyup.enter.native="doSearch">
</el-input>
</search-item>
<template v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')">
<search-item label="所属工会">
<el-select @change="unionChange" clearable filterable style="width: 100%"
placeholder="请选择所属工会" v-model="pageForm.unionId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unionOptions">
</el-option>
</el-select>
</search-item>
<search-item label="所属单位">
<el-select @change="doSearch" clearable filterable style="width: 100%"
placeholder="请选择所属单位" v-model="pageForm.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</search-item>
</template>
</search>
<div class="search">
<div class="search-item">
<div class="search-item-label">年份:</div>
<div class="search-item-option">
<el-date-picker style="width: 100%"
class="mr5"
:picker-options="pickerOptions"
v-model="pageForm.year" :clearable="false"
type="year"
value-format="yyyy" @change="getCascadersActivity"
placeholder="选择年">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">活动:</div>
<div class="search-item-option">
<el-cascader
style="width: 100%"
@change="doSearch()"
v-model="pageForm.activityId"
:options="activityOptions"
:props="{ checkStrictly: true,emitPath:false}"
:clearable="false"></el-cascader>
</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 @change="unionChange" clearable filterable style="width: 100%"
placeholder="请选择所属工会" v-model="pageForm.unionId">
<el-option
:key="item.id"
:label="item.unionname"
:value="item.id"
v-for="item in unionOptions">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select @change="doSearch" clearable filterable style="width: 100%"
placeholder="请选择所属单位" v-model="pageForm.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</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 label="达标人员列表">
<table-tool :app="this" label="达标人员列表">
<el-button @click="setRaffle" class="ml10" size="small" type="primary">设置抽奖条件</el-button>
<el-button @click="viewLotteryUsers" class="ml10" size="small" type="primary">查看中奖人员</el-button>
<el-button @click="exportExcel" class="ml10" size="small" type="primary">导出达标人员</el-button>
@@ -95,15 +110,17 @@ layout("/layouts/platform.html"){
<el-table tooltip-effect="dark" style="width: 100%" :data="formData.manualLotteryRules">
<el-table-column label="奖项名称" align="center">
<template scope="scope">
<el-input v-model="scope.row.awardName" placeholder="请输入奖项名称" max="50" clearable></el-input>
<el-input v-model="scope.row.awardName" placeholder="请输入奖项名称" max="50"
clearable></el-input>
</template>
</el-table-column>
<el-table-column label="奖项积分" align="center">
<template scope="scope">
<el-input-number v-model="scope.row.points" placeholder="请输入奖项积分"
style="width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="奖项积分" align="center">
<template scope="scope">
<el-input-number v-model="scope.row.points" placeholder="请输入奖项积分" style="width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="抽奖人数" align="center">
<template scope="scope">
@@ -128,8 +145,8 @@ layout("/layouts/platform.html"){
<el-table-column label="排名位次" align="center">
<template scope="scope">
<el-input-number v-if="scope.row.raffleType == '排名'"
v-model="scope.row.rankingPosition"
style="width: 100%"></el-input-number>
v-model="scope.row.rankingPosition"
style="width: 100%"></el-input-number>
</template>
</el-table-column>
@@ -158,7 +175,7 @@ layout("/layouts/platform.html"){
</el-form>
<div style="text-align: right">
<el-button @click="$refs.guava.index()" class="ml10">返回</el-button>
<el-button @click="saveRaffle" class="ml10" type="primary">提交</el-button>
<el-button @click="saveRaffle" class="ml10" type="primary" :loading="formLoading">提交</el-button>
</div>
</el-card>
</template>
@@ -194,27 +211,28 @@ layout("/layouts/platform.html"){
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="中奖人员列表">
<template #func>
<el-button @click="exportAwardExcel" icon="el-icon-download" type="primary" size="small">导出中奖人员</el-button>
</template>
<el-button @click="exportAwardExcel" icon="el-icon-download" type="primary" size="small">导出中奖人员
</el-button>
</table-tool>
<el-table :data="awardTableData">
<el-table-column :index="indexMethod" align="center" header-align="center" label="排名" type="index"
width="80px"></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="姓名" prop="username"></el-table-column>
<el-table-column align="center" header-align="center" label="分工会" prop="unionName"></el-table-column>
<el-table-column align="center" header-align="center" label="分工会"
prop="unionName"></el-table-column>
<el-table-column align="center" header-align="center" label="单位" prop="unitName"></el-table-column>
<el-table-column align="center" header-align="center" label="奖项名称" prop="awardName"></el-table-column>
<el-table-column align="center" header-align="center" label="奖项名称"
prop="awardName"></el-table-column>
</el-table>
</el-card>
</template>
</guava>
</div>
<script>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins:[initTableMixins],
mixins: [initTableMixins],
data() {
return {
pickerOptions: {
@@ -225,9 +243,11 @@ layout("/layouts/platform.html"){
}
},
pageForm: {
year: moment().format('YYYY'),
unionId:'',
unitId:''
year: new Date().getFullYear() + '',
activityId: null,
searchKeyword: '',
unionId: '',
unitId: ''
},
unionOptions: [],
unitOptions: [],
@@ -241,8 +261,8 @@ layout("/layouts/platform.html"){
{label: '达标天数', prop: 'standardsDays', sortable: true},
],
raffleTypeOptions: [
{ value: '排名', label: '排名' },
{ value: '达标', label: '达标' },
{value: '排名', label: '排名'},
{value: '达标', label: '达标'},
],
formData: {
manualLotteryRules: []
@@ -261,119 +281,131 @@ layout("/layouts/platform.html"){
/**
* 设置抽奖条件
*/
async setRaffle(){
this.$refs.guava.edit(async () => {
// 获取该活动的抽奖条件
const resp = await this.$axios.post('/platform/fitnessWalk/stepRaffle/getRaffle', {
activityId: this.pageForm.activityId
})
if (resp.code === 0) {
if (resp.data) {
this.formData = resp.data
}
} else {
this.formData = {
manualLotteryRules: []
}
}
setRaffle() {
this.$refs.guava.edit()
// 获取该活动的抽奖条件
this.$axios.post('/platform/fitnessWalk/stepRaffle/getRaffle', {
activityId: this.pageForm.activityId
}).then((resp) => {
if (resp.code === 0) {
if (resp.data) {
this.$set(this, "formData", resp.data)
}
} else {
this.$set(this, "formData", {
manualLotteryRules: []
})
}
})
},
/**
* 查看中奖人员
*/
viewLotteryUsers(){
this.$refs.guava.view(() => {
this.awardPageData()
viewLotteryUsers() {
this.$refs.guava.view()
this.$nextTick(() => {
this.awardPageData()
})
},
async awardPageData() {
this.awardPageForm.activityId = this.pageForm.activityId
const resp = await this.$axios.post('/platform/fitnessWalk/stepWining/prizeUsers', this.awardPageForm)
if (resp.code === 0) {
this.awardTableData = resp.data
}
awardPageData() {
this.$set(this.awardPageForm, "activityId", this.pageForm.activityId)
this.$axios.post('/platform/fitnessWalk/stepWining/prizeUsers', this.awardPageForm).then((resp) => {
if (resp.code === 0) {
this.$set(this, "awardTableData", resp.data)
}
})
},
exportAwardExcel(){
const {searchKeyword,activityId,lotteryTime} = this.awardPageForm
this.$downLoad(loc() + '/exportAwardExcel', {
searchKeyword: searchKeyword,
activityId: activityId,
lotteryTime: lotteryTime
})
exportAwardExcel() {
const {searchKeyword, activityId, lotteryTime} = this.awardPageForm
window.open(loc() + '/exportAwardExcel?searchKeyword=' + searchKeyword +
'&activityId=' + activityId + '&lotteryTime=' + lotteryTime)
},
async saveRaffle() {
const formData = this.formData
formData.activityId = this.pageForm.activityId
formData.manualLotteryRules = JSON.stringify(this.formData.manualLotteryRules)
const resp = await this.$axios.post('/platform/fitnessWalk/stepRaffle/saveRaffle', this.formData)
if (resp.code === 0) {
this.$message.success('保存成功')
this.$refs.guava.index()
} else {
this.$message.warning(resp.msg)
}
saveRaffle() {
console.log(this.formData)
const formData = Object.assign({}, this.formData)
this.$set(formData, "activityId", this.pageForm.activityId)
this.$set(formData, "manualLotteryRules", JSON.stringify(this.formData.manualLotteryRules))
this.$set(this, "formLoading", true)
this.$axios.post('/platform/fitnessWalk/stepRaffle/saveRaffle', formData).then((resp) => {
if (resp.code === 0) {
this.$message.success('保存成功')
this.$refs.guava.index()
} else {
this.$message.warning(resp.msg)
}
}).finally(() => {
this.$set(this, "formLoading", false)
})
},
exportExcel(){
const {searchKeyword,activityId,unionId,unitId} = this.pageForm
this.$downLoad(loc() + '/exportExcel', {
searchKeyword: searchKeyword,
activityId: activityId,
unionId: unionId,
unitId: unitId
})
exportExcel() {
const {searchKeyword, activityId, unionId, unitId} = this.pageForm
window.open(loc() + '/exportExcel?searchKeyword=' + searchKeyword +
'&activityId=' + activityId + '&unionId=' + unionId + '&unitId=' + unitId)
},
async getAllActivity() {
this.pageForm.activityId = ''
this.activityOptions = []
getAllActivity() {
this.$set(this.pageForm, "activityId", '')
this.$set(this, "activityOptions", [])
const {data} = await this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm)
if (data == null || data.length === 0) {
this.tableData = []
return
} else {
this.activityOptions = data.filter(item => item.activityModel === 'stepCount')
}
this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm).then((res) => {
const data = res.data
if (data == null || data.length === 0) {
this.$set(this, "tableData", [])
return
} else {
this.$set(this, "activityOptions", data.filter(item => item.activityModel === 'stepCount'))
}
if (this.activityOptions) {
this.pageForm.activityId = this.activityOptions[0]._id
}
if (this.activityOptions) {
this.$set(this.pageForm, "activityId", this.activityOptions[0]._id)
}
})
},
async unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
this.doSearch()
},
async getCascadersActivity() {
const {code, data} = await this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year})
this.activityOptions = data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
unionChange(val) {
this.$set(this.pageForm, "unitId", null)
this.$businessTool.listUnit(val).then((res) => {
this.$set(this, "unitOptions", res)
this.doSearch()
} else {
this.tableData = []
}
},
async getAwardUserNum(){
const resp = await this.$axios.post('/platform/fitnessWalk/stepRaffle/getAwardUserNum')
if (resp.code === 0) {
}
},
async getAwardNameOptions(){
const resp = await this.$axios.post('/platform/fitnessWalk/stepWining/prizeOption', {
activityId: this.pageForm.activityId
})
if (resp.code === 0) {
this.awardNameOptions = resp.data
}
},
getCascadersActivity() {
this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year}).then((res) => {
this.$set(this, "activityOptions", res.data)
if (this.activityOptions && this.activityOptions.length > 0) {
this.$set(this.pageForm, "activityId", this.activityOptions[0].value)
this.getAwardNameOptions()
this.doSearch()
} else {
this.$set(this, "tableData", [])
}
})
},
getAwardUserNum() {
this.$axios.post('/platform/fitnessWalk/stepRaffle/getAwardUserNum').then((resp) => {
if (resp.code === 0) {
}
})
},
getAwardNameOptions() {
this.$axios.post('/platform/fitnessWalk/stepWining/prizeOption', {
activityId: this.pageForm.activityId
}).then((resp) => {
if (resp.code === 0) {
this.$set(this, "awardNameOptions", resp.data)
}
})
},
},
async created() {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
await this.getCascadersActivity()
await this.getAwardNameOptions()
created() {
this.$businessTool.listUnion().then((res) => {
this.$set(this, "unionOptions", res)
return this.$businessTool.listUnit()
}).then((res) => {
this.$set(this, "unitOptions", res)
this.getCascadersActivity()
this.getAwardNameOptions()
})
}
})
</script>
@@ -7,69 +7,121 @@ layout("/layouts/platform.html"){
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年份">
<el-date-picker style="width: 100%"
class="mr5"
:picker-options="pickerOptions"
v-model="pageForm.year" :clearable="false"
type="year"
value-format="yyyy" @change="getAllActivity"
placeholder="选择年">
</el-date-picker>
</search-item>
<div class="search">
<div class="search-item">
<div class="search-item-label">年份:</div>
<div class="search-item-option">
<el-date-picker style="width: 100%"
class="mr5"
:picker-options="pickerOptions"
v-model="pageForm.year" :clearable="false"
type="year"
value-format="yyyy" @change="getCascadersActivity"
placeholder="选择年">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">活动:</div>
<div class="search-item-option">
<el-cascader
style="width: 100%"
@change="doSearch()"
v-model="pageForm.activityId"
:options="activityOptions"
:props="{ checkStrictly: true,emitPath:false}"
:clearable="false"></el-cascader>
</div>
</div>
<search-item label="活动">
<el-cascader
style="width: 100%"
@change="doSearch()"
v-model="pageForm.activityId"
:options="activityOptions"
:props="{ checkStrictly: true,emitPath:false}"
:clearable="false"></el-cascader>
</search-item>
<div class="search-item">
<div class="search-item-label">性别:</div>
<div class="search-item-option">
<el-select @change="doSearch" clearable style="width: 100%"
placeholder="请选择性别" v-model="pageForm.sex">
<el-option label="男" value="男"></el-option>
<el-option label="女" value="女"></el-option>
</el-select>
</div>
</div>
<search-item label="姓名/工号">
<el-input placeholder="请输入姓名或工号" clearable v-model="pageForm.searchKeyword"
@keyup.enter.native="doSearch"></el-input>
</search-item>
<div class="search-item">
<div class="search-item-label">年龄:</div>
<div class="search-item-option">
<el-select @change="doSearch" clearable style="width: 100%"
placeholder="请选择年龄段" v-model="pageForm.ageRange">
<el-option label="40岁及以下" value="under40"></el-option>
<el-option label="41-50岁" value="41to50"></el-option>
<el-option label="51-55岁" value="51to55"></el-option>
<el-option label="55岁以上" value="over55"></el-option>
</el-select>
</div>
</div>
<template v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')">
<search-item label="所属工会">
<el-select @change="unionChange" clearable filterable style="width: 100%"
placeholder="请选择所属工会" v-model="pageForm.unionId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unionOptions">
</el-option>
</el-select>
</search-item>
<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-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
style="width: 110px;">
<el-option label="姓名" value="u.username"></el-option>
<el-option label="工号" value="u.loginname"></el-option>
</el-select>
</el-input>
</div>
</div>
<search-item label="所属单位">
<el-select @change="doSearch" clearable filterable style="width: 100%"
placeholder="请选择所属单位" v-model="pageForm.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</search-item>
</template>
</search>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select @change="unionChange" clearable filterable style="width: 100%"
placeholder="请选择所属工会" v-model="pageForm.unionId">
<el-option
:key="item.id"
:label="item.unionname"
:value="item.id"
v-for="item in unionOptions">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select @change="doSearch" clearable filterable style="width: 100%"
placeholder="请选择所属单位" v-model="pageForm.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</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 label="排行榜">
<el-radio-group v-model="pageForm.mode" size="small" @change="doSearch" class="mr10">
<el-radio-button label="today">今日排行榜</el-radio-button>
<el-radio-button label="all">总排行榜</el-radio-button>
<table-tool :app="this" label="排行榜">
<el-radio-group v-model="pageForm.mode" size="small" @change="doSearch">
<el-radio-button v-for="item in rankingTimeOptions"
:key="item.value"
:label="item.value">{{item.name}}</el-radio-button>
</el-radio-group>
<el-button @click="exportExcel" size="small" type="primary">导出{{pageForm.mode == 'today' ? '今日排行榜' : '总排行榜'}}</el-button>
<el-button @click="exportExcel" class="ml10" size="small" type="primary">导出{{rankingTimeRangeName}}</el-button>
<!-- 独立导出查询尚未修复,暂时隐藏入口,避免用户导出只有表头的空文件。 -->
<!-- <el-button @click="exportExcel2" class="ml10" size="small" type="primary">导出参与人员总步数</el-button> -->
</table-tool>
<el-table :data="tableData" :size="tableSize">
<el-table :data="tableData"
:size="tableSize"
v-loading="tableLoading"
element-loading-text="数据加载中">
<el-table-column :index="indexMethod" align="center" header-align="center" label="排名" type="index"
width="80px"></el-table-column>
<el-table-column
@@ -87,7 +139,7 @@ layout("/layouts/platform.html"){
</el-card>
</guava>
</div>
<script>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins:[initTableMixins],
@@ -105,69 +157,96 @@ layout("/layouts/platform.html"){
mode:'today',
searchName:'u.username',
unionId:'',
unitId:''
unitId:'',
sex:'',
ageRange:''
},
unionOptions: [],
unitOptions: [],
activityOptions: [],
rankingTimeOptions: [
{name: '今日排行榜', value: 'today'},
{name: '近1个月', value: 'oneMonth'},
{name: '近半年', value: 'halfYear'},
{name: '近1年', value: 'oneYear'},
{name: '活动开始至今', value: 'activity'}
],
tableColumns: [
{label: '姓名', prop: 'username'},
{label: '工号', prop: 'loginname'},
{label: '性别', prop: 'sex'},
{label: '年龄', prop: 'age', sortable: true},
{label: '分工会', prop: 'unionname', sortable: true},
{label: '单位', prop: 'unitname'},
{label: '步数', prop: 'total_steps', sortable: true},
{label: '达标天数', prop: 'standardsDays', sortable: true},
],
}
},
computed: {
rankingTimeRangeName() {
const currentOption = this.rankingTimeOptions.find((item) => item.value === this.pageForm.mode)
return currentOption ? currentOption.name : '今日排行榜'
}
},
methods: {
exportExcel(){
const {searchName,searchKeyword,activityId,unionId,unitId,mode,sex,ageRange} = this.pageForm
window.open( loc() + '/exportExcel?searchName=' + searchName + '&searchKeyword=' + searchKeyword +
'&activityId=' + activityId +'&unionId=' + unionId + '&unitId=' + unitId + '&mode=' + mode +
'&sex=' + sex + '&ageRange=' + ageRange)
},
exportExcel2(){
const {searchName,searchKeyword,activityId,unionId,unitId,mode} = this.pageForm
this.$downLoad(loc() + '/exportExcel', {
searchName: searchName,
searchKeyword: searchKeyword,
activityId: activityId,
unionId: unionId,
unitId: unitId,
mode: mode
})
window.open( loc() + '/exportExcel2?searchName=' + searchName + '&searchKeyword=' + searchKeyword +
'&activityId=' + activityId +'&unionId=' + unionId + '&unitId=' + unitId + '&mode=' + mode)
},
async getAllActivity() {
this.pageForm.activityId = ''
this.activityOptions = []
getAllActivity() {
this.$set(this.pageForm, "activityId", '')
this.$set(this, "activityOptions", [])
const {data} = await this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm)
if (data == null || data.length === 0) {
this.tableData = []
return
} else {
this.activityOptions = data.filter(item => item.activityModel === 'stepCount')
}
this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm).then((res) => {
const data = res.data
if (data == null || data.length === 0) {
this.$set(this, "tableData", [])
return
} else {
this.$set(this, "activityOptions", data.filter(item => item.activityModel === 'stepCount'))
}
if (this.activityOptions) {
this.pageForm.activityId = this.activityOptions[0]._id
}
if (this.activityOptions) {
this.$set(this.pageForm, "activityId", this.activityOptions[0]._id)
}
})
},
async unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
this.doSearch()
},
async getCascadersActivity() {
const {code, data} = await this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year})
this.activityOptions = data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
unionChange(val) {
this.$set(this.pageForm, "unitId", null)
this.$businessTool.listUnit(val).then((res) => {
this.$set(this, "unitOptions", res)
this.doSearch()
} else {
this.tableData = []
}
})
},
getCascadersActivity() {
this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year}).then((res) => {
this.$set(this, "activityOptions", res.data)
if (this.activityOptions && this.activityOptions.length > 0) {
this.$set(this.pageForm, "activityId", this.activityOptions[0].value)
this.doSearch()
} else {
this.$set(this, "tableData", [])
}
})
}
},
async created() {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
await this.getCascadersActivity()
created() {
this.$businessTool.listUnion().then((res) => {
this.$set(this, "unionOptions", res)
return this.$businessTool.listUnit()
}).then((res) => {
this.$set(this, "unitOptions", res)
this.getCascadersActivity()
})
}
})
</script>
@@ -5,73 +5,92 @@ layout("/layouts/platform.html"){
<guava ref="guava">
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年份">
<el-date-picker
:clearable="false"
placeholder="选择年"
style="width: 100%"
@change="getCascadersActivity"
type="year" v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</search-item>
<search-item label="活动">
<el-cascader
style="width: 100%"
@change="doSearch();getActivityById()"
v-model="pageForm.activityId"
:options="activityOptions"
:props="{ checkStrictly: true,emitPath:false}"
:clearable="false"></el-cascader>
</search-item>
<search-item label="日期范围">
<el-date-picker
end-placeholder="结束日期"
range-separator="至"
start-placeholder="开始日期"
type="daterange"
style="width: 100%"
@change="activityDateChange"
value-format="yyyy-MM-dd"
v-model="pageForm.activityDate">
</el-date-picker>
</search-item>
<search-item label="姓名工号">
<el-input v-model="pageForm.searchKeyword" max="20" placeholder="请输入工号或者姓名查询" clearable></el-input>
</search-item>
<template v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')">
<search-item label="所属工会">
<el-select @change="unionChange" clearable filterable style="width: 100%"
placeholder="请选择所属工会" v-model="pageForm.unionId">
<el-option
:key="item.id"
:label="item.unionname"
:value="item.id"
v-for="item in unionOptions">
</el-option>
</el-select>
</search-item>
<search-item label="所属单位">
<el-select @change="doSearch" clearable filterable style="width: 100%"
placeholder="请选择所属单位" v-model="pageForm.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</search-item>
</template>
</search>
<div class="search">
<div class="search-item">
<div class="search-item-label">年份:</div>
<div class="search-item-option">
<el-date-picker
:clearable="false"
placeholder="选择年"
style="width: 100%"
@change="getCascadersActivity"
type="year" 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-cascader
style="width: 100%"
@change="activityChange"
v-model="pageForm.activityId"
:options="activityOptions"
:props="{ checkStrictly: true,emitPath:false}"
:clearable="false"></el-cascader>
</div>
</div>
<div class="search-item">
<div class="search-item-label">日期范围:</div>
<div class="search-item-option">
<el-date-picker
end-placeholder="结束日期"
range-separator="至"
start-placeholder="开始日期"
type="daterange"
style="width: 100%"
@change="activityDateChange"
value-format="yyyy-MM-dd"
v-model="pageForm.activityDate">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">姓名工号:</div>
<div class="search-item-option">
<el-input v-model="pageForm.searchKeyword" max="20" placeholder="请输入工号或者姓名查询" clearable></el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select @change="unionChange" clearable filterable style="width: 100%"
placeholder="请选择所属工会" v-model="pageForm.unionId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unionOptions">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select @change="doSearch" clearable filterable style="width: 100%"
placeholder="请选择所属单位" v-model="pageForm.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</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="mt20" shadow="never">
<table-tool label="步数列表">
<el-button @click="exportExcel" class="ml10" size="small" type="primary">导出</el-button>
<table-tool :app="this" label="步数列表">
<el-button @click="exportExcel" class="ml10" size="small" type="primary">导出</el-button>
</table-tool>
<el-table :data="tableData" :size="tableSize">
<el-table-column :index="indexMethod" align="center" header-align="center" label="序号" type="index"
@@ -99,7 +118,7 @@ layout("/layouts/platform.html"){
</div>
<script>
<script nonce="${cspNonce!}">
let vue = new Vue({
el: '#app',
mixins: [initTableMixins],
@@ -125,9 +144,10 @@ layout("/layouts/platform.html"){
activityOptions: [],
activityDatePickerOptions: {
disabledDate: time => {
return (
time <= moment(this.activityInfo.endTime) || time >= moment(this.activityInfo.startTime)
);
if (!this.activityInfo.startTime || !this.activityInfo.endTime) {
return false
}
return time < $moment(this.activityInfo.startTime) || time > $moment(this.activityInfo.endTime)
}
},
activityInfo:{},
@@ -140,58 +160,68 @@ layout("/layouts/platform.html"){
if (activityDate && activityDate.length > 0) {
activityDate1 = JSON.stringify(activityDate)
}
this.$downLoad(loc() + '/exportExcel', {
activityId: activityId,
unionId: unionId,
unitId: unitId,
activityDate: activityDate1
})
window.open(loc() + '/exportExcel?activityId=' + activityId + '&unionId=' + unionId + '&unitId=' + unitId + '&activityDate=' + activityDate1)
},
activityDateChange() {
// this.$set(this.pageForm, "activityDate", [])
},
async unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
activityChange() {
this.doSearch()
this.getActivityById()
},
async getCascadersActivity() {
const {code, data} = await this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year})
this.activityOptions = data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
unionChange(val) {
this.$set(this.pageForm, "unitId", null)
this.$businessTool.listUnit(val).then((res) => {
this.$set(this, "unitOptions", res)
this.doSearch()
} else {
this.tableData = []
}
})
},
getCascadersActivity() {
this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year}).then((res) => {
this.$set(this, "activityOptions", res.data)
if (this.activityOptions && this.activityOptions.length > 0) {
this.$set(this.pageForm, "activityId", this.activityOptions[0].value)
this.doSearch()
} else {
this.$set(this, "tableData", [])
}
})
},
pageData() {
this.$set(this, "tableLoading", true)
let pageForm = clone(this.pageForm)
if (pageForm.activityDate && pageForm.activityDate.length > 0) {
pageForm.activityDate = JSON.stringify(pageForm.activityDate)
this.$set(pageForm, "activityDate", JSON.stringify(pageForm.activityDate))
}
this.$axios.post(loc() + "/pageData", pageForm, (data) => {
this.$axios.post(loc() + "/pageData", pageForm).then((data) => {
if (data.code === 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
this.$set(this, "tableData", data.data.list);
this.$set(this.pageForm, "totalCount", data.data.totalCount);
} else {
this.$message.error(data.msg);
}
}, "json");
}).finally(() => {
this.$set(this, "tableLoading", false)
});
},
async getActivityById(){
const resp = await this.$axios.post('/platform/fitnessWalk/activityManage/findOne',{id:this.pageForm.activityId})
if (resp.code === 0){
this.activityInfo = resp.data
}
getActivityById(){
this.$axios.post('/platform/fitnessWalk/activityManage/findOne', {id:this.pageForm.activityId}).then((resp) => {
if (resp.code === 0){
this.$set(this, "activityInfo", resp.data)
}
})
}
},
async created() {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
await this.getCascadersActivity()
await this.getActivityById();
created() {
this.$businessTool.listUnion().then((res) => {
this.$set(this, "unionOptions", res)
return this.$businessTool.listUnit()
}).then((res) => {
this.$set(this, "unitOptions", res)
this.getCascadersActivity()
this.getActivityById();
})
}
})
</script>
@@ -21,29 +21,80 @@ layout("/layouts/platform.html"){
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年份">
<el-date-picker style="width: 100%"
class="mr5"
:picker-options="pickerOptions"
v-model="pageForm.year" :clearable="false"
type="year"
value-format="yyyy" @change="getAllActivity"
placeholder="选择年">
</el-date-picker>
</search-item>
<search-item label="活动">
<el-cascader
style="width: 100%"
@change="doSearch()"
v-model="pageForm.activityId"
:options="activityOptions"
:props="{ checkStrictly: true,emitPath:false}"
:clearable="false"></el-cascader>
</search-item>
</search>
<div class="search">
<div class="search-item">
<div class="search-item-label">年份:</div>
<div class="search-item-option">
<el-date-picker style="width: 100%"
class="mr5"
:picker-options="pickerOptions"
v-model="pageForm.year" :clearable="false"
type="year"
value-format="yyyy" @change="getCascadersActivity"
placeholder="选择年">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">活动:</div>
<div class="search-item-option">
<el-cascader
style="width: 100%"
@change="doSearch()"
v-model="pageForm.activityId"
:options="activityOptions"
:props="{ checkStrictly: true,emitPath:false}"
:clearable="false"></el-cascader>
</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-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
style="width: 110px;">
<el-option label="姓名" value="u.username"></el-option>
<el-option label="工号" value="u.loginname"></el-option>
</el-select>
</el-input>
</div>
</div>
<template>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select @change="unionChange" clearable filterable style="width: 100%"
placeholder="请选择所属工会" v-model="pageForm.unionId">
<el-option
:key="item.id"
:label="item.unionname"
:value="item.id"
v-for="item in unionOptions">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select @change="doSearch" clearable filterable style="width: 100%"
placeholder="请选择所属单位" v-model="pageForm.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</div>
</div>
</template>-->
<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" style="height: 100px">
@@ -65,7 +116,7 @@ layout("/layouts/platform.html"){
</el-card>
<el-card class="mt10" shadow="never">
<table-tool label="中奖榜">
<table-tool :app="this" label="中奖榜">
<el-button @click="exportUserStepWining" class="ml10" size="small" type="primary">导出中奖名单</el-button>
</table-tool>
<el-table :data="tableData" :size="tableSize">
@@ -84,7 +135,7 @@ layout("/layouts/platform.html"){
</el-card>
</guava>
</div>
<script>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins:[initTableMixins],
@@ -122,62 +173,78 @@ layout("/layouts/platform.html"){
},
methods: {
exportUserStepWining(){
this.$downLoad(loc() + '/exportUserStepWining', {
activityId: this.pageForm.activityId
})
window.open( loc() + '/exportUserStepWining?activityId=' + this.pageForm.activityId)
},
async getAllActivity() {
this.pageForm.activityId = ''
this.activityOptions = []
const {data} = await this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm)
if (data == null || data.length === 0) {
this.tableData = []
return
} else {
this.activityOptions = data.filter(item => item.activityModel === 'stepCount')
}
if (this.activityOptions) {
this.pageForm.activityId = this.activityOptions[0]._id
}
getAllActivity() {
this.$set(this.pageForm, "activityId", '')
this.$set(this, "activityOptions", [])
this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm).then((res) => {
const data = res.data
if (data == null || data.length === 0) {
this.$set(this, "tableData", [])
return
} else {
this.$set(this, "activityOptions", data.filter(item => item.activityModel === 'stepCount'))
}
if (this.activityOptions) {
this.$set(this.pageForm, "activityId", this.activityOptions[0]._id)
}
})
},
async unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
this.doSearch()
unionChange(val) {
this.$set(this.pageForm, "unitId", null)
this.$businessTool.listUnit(val).then((res) => {
this.$set(this, "unitOptions", res)
this.doSearch()
})
},
subsectionChange(key) {
const data = this.allDataList.find(item => item.title === key)
this.tableData = data.awardList
this.$set(this, "tableData", data ? data.awardList || [] : [])
},
async pageData(){
const resp = await this.$axios.post(loc() + '/getUserStepWining',this.pageForm)
if (resp.code === 0){
this.allDataList = resp.data
this.subsectionList = resp.data.map(v => {
return {
name: v.title,
key: v.title
pageData(){
this.$set(this, "tableLoading", true)
this.$axios.post(loc() + '/getUserStepWining', this.pageForm).then((resp) => {
if (resp.code === 0){
this.$set(this, "allDataList", resp.data || [])
this.$set(this, "subsectionList", this.allDataList.map(v => {
return {
name: v.title,
key: v.title
}
}))
if (this.allDataList.length > 0) {
this.$set(this, "tableData", this.allDataList[0].awardList || [])
this.$set(this, "changKeyItem", this.allDataList[0].title)
} else {
this.$set(this, "tableData", [])
this.$set(this, "changKeyItem", '')
}
})
this.tableData = this.allDataList[0].awardList
this.changKeyItem = this.allDataList[0].title
}
}
}).finally(() => {
this.$set(this, "tableLoading", false)
})
},
async getCascadersActivity() {
const {code, data} = await this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year})
this.activityOptions = data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
this.doSearch()
} else {
this.tableData = []
}
getCascadersActivity() {
this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year}).then((res) => {
this.$set(this, "activityOptions", res.data)
if (this.activityOptions && this.activityOptions.length > 0) {
this.$set(this.pageForm, "activityId", this.activityOptions[0].value)
this.doSearch()
} else {
this.$set(this, "tableData", [])
}
})
},
},
async created() {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
await this.getCascadersActivity()
created() {
this.$businessTool.listUnion().then((res) => {
this.$set(this, "unionOptions", res)
return this.$businessTool.listUnit()
}).then((res) => {
this.$set(this, "unitOptions", res)
this.getCascadersActivity()
})
}
})
</script>
@@ -329,7 +329,8 @@ layout("/layouts/platform.html"){
this.$set(this.formData, 'parentalLeave', 10);
} else {
this.$set(this.formData, 'maternityLeave', 98);
this.$set(this.formData, 'extendLeave', 60);
// 三胎申请的延长假为90天,其他申请保持60天。
this.$set(this.formData, 'extendLeave', row.isThreeChildren ? 90 : 60);
}
this.$refs.maternityLeaveInfoRef.onOpen(row)
})
@@ -358,7 +358,8 @@ layout("/layouts/platform_h5.html"){
this.$set(this.formData, 'parentalLeave', 10);
} else {
this.$set(this.formData, 'maternityLeave', 98);
this.$set(this.formData, 'extendLeave', 60);
// 三胎申请的延长假为90天,其他申请保持60天。
this.$set(this.formData, 'extendLeave', row.isThreeChildren ? 90 : 60);
}
this.$refs.maternityLeaveInfoRef.onOpen(row)
},