This commit is contained in:
2026-05-28 19:52:20 +08:00
parent daac940f3f
commit 8915ace193
48 changed files with 5333 additions and 1644 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,223 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">主活动名称:</div>
<div class="search-item-option">
<el-input v-model="pageForm.searchKeyword"
clearable
placeholder="请输入主活动名称"
@keyup.enter.native="doSearch">
</el-input>
</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 :app="this" label="关联项目列表">
<el-button type="primary" size="small" icon="el-icon-plus" @click="openAdd">创建关联项目</el-button>
</table-tool>
<el-table :data="tableData"
:size="tableSize"
class="vi-table"
row-key="id"
style="width: 100%"
v-loading="tableLoading">
<el-table-column type="index"
label="序号"
width="80px"
align="center"
header-align="center"
:index="indexMethod"></el-table-column>
<el-table-column prop="masterActivityName"
label="主活动名称"
align="center"
header-align="center"
show-overflow-tooltip></el-table-column>
<el-table-column prop="standardActivityNum"
label="达标活动数量"
align="center"
header-align="center"></el-table-column>
<el-table-column label="创建时间"
align="center"
header-align="center">
<template scope="{row}">
{{row.createdAt ? $moment(row.createdAt).format('YYYY-MM-DD HH:mm:ss') : ''}}
</template>
</el-table-column>
<el-table-column label="操作"
width="240px"
align="center"
header-align="center">
<template scope="{row}">
<el-button type="success" size="mini" @click="openView(row)">查看</el-button>
<el-button type="primary" size="mini" @click="openEdit(row)">编辑</el-button>
<el-button type="danger" size="mini" @click="doDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container">
<el-pagination
@size-change="pageSizeChange"
@current-change="pageNumberChange"
:current-page="pageForm.pageNumber"
:page-sizes="[10, 20, 30, 50]"
:page-size="pageForm.pageSize"
layout="total, sizes, prev, pager, next"
:total="pageForm.totalCount">
</el-pagination>
</el-row>
</el-card>
<template #edit>
<el-form :model="formData" :rules="rules" label-width="120px" ref="form">
<el-form-item label="主活动名称" prop="masterActivityName">
<el-input v-model="formData.masterActivityName" maxlength="100" placeholder="请填写主活动名称"></el-input>
</el-form-item>
<el-form-item label="达标活动数量" prop="standardActivityNum">
<el-input-number v-model="formData.standardActivityNum"
:min="1"
:precision="0"
style="width: 100%"></el-input-number>
</el-form-item>
</el-form>
<div style="display:flex;justify-content:flex-end">
<el-button type="primary" @click="doSubmit">确定</el-button>
</div>
</template>
<template #view>
<el-form label-width="120px">
<el-form-item label="主活动名称">
{{viewData.masterActivityName}}
</el-form-item>
<el-form-item label="达标活动数量">
{{viewData.standardActivityNum}}
</el-form-item>
<el-form-item label="关联活动数">
{{viewActivityList.length}}
</el-form-item>
</el-form>
<el-table :data="viewActivityList" border style="width:100%">
<el-table-column prop="activityName"
label="活动名称"
align="center"
header-align="center"
show-overflow-tooltip></el-table-column>
<el-table-column prop="activityModelName"
label="活动模式"
width="120"
align="center"
header-align="center"></el-table-column>
<el-table-column label="创建时间"
width="180"
align="center"
header-align="center">
<template scope="{row}">
{{row.createdAt ? $moment(row.createdAt).format('YYYY-MM-DD HH:mm:ss') : ''}}
</template>
</el-table-column>
</el-table>
</template>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
viewData: {},
viewActivityList: [],
rules: {
masterActivityName: [{required: true, message: '请填写主活动名称', trigger: ['change', 'blur']}],
standardActivityNum: [{required: true, message: '请填写达标活动数量', trigger: ['change', 'blur']}]
}
}
},
methods: {
openView(row) {
this.$axios.post(loc() + '/relationActivityList', {id: row.id}).then((resp) => {
if (resp.code === 0) {
this.viewData = Object.assign({}, row)
this.viewActivityList = resp.data || []
this.$refs.guava.view()
} else {
this.notifyWarning(resp.msg)
}
})
},
openAdd() {
this.$refs.guava.edit()
this.$nextTick(() => {
this.formData = {
standardActivityNum: 1
}
if (this.$refs.form) {
this.$refs.form.clearValidate()
}
})
},
openEdit(row) {
this.$refs.guava.edit()
this.$nextTick(() => {
this.formData = Object.assign({}, row)
if (this.$refs.form) {
this.$refs.form.clearValidate()
}
})
},
doSubmit() {
this.$refs.form.validate((valid) => {
if (!valid) {
return
}
this.$axios.post(loc() + '/doSave', this.formData).then((resp) => {
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.$refs.guava.index()
this.pageData()
} else {
this.notifyWarning(resp.msg)
}
})
})
},
doDelete(id) {
this.$confirm('您确定要删除该关联项目吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$axios.post(loc() + '/doRemove', {id: id}).then((resp) => {
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.pageData()
} else {
this.notifyWarning(resp.msg)
}
})
}).catch(() => {
})
}
},
created() {
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -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">
@@ -92,14 +102,9 @@ layout("/layouts/platform.html"){
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,33 @@ 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.$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'
});
}
})
}
}
})
},
async doDelete2() {
doDelete2() {
if (!this.multipleSelection.length) {
this.$notify({
@@ -160,104 +168,67 @@ 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.$axios.post(loc() + "/delete", {ids: JSON.stringify(arr)}).then((res) => {
if (res.code == 0) {
this.multipleSelection = []
this.$message({
message: res.msg,
type: 'success'
});
this.pageData()
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
})
}
}
})
},
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.$axios.post(loc() + "/deleteAll").then((res) => {
if (res.code == 0) {
this.multipleSelection = []
this.$message({
message: res.msg,
type: 'success'
});
this.pageData()
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
})
}
}
})
},
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'
});
}
})
},
}
},
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.unionList = res
})
}
})
</script>
@@ -5,55 +5,86 @@ 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"
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>
@@ -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: [],
@@ -165,36 +219,32 @@ layout("/layouts/platform.html"){
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.viewIndex = 'regTableShow'
this.$axios.post(loc() + '/unionRegistrationData', Object.assign({
unionId: id
}, this.buildActivityRequestParams())).then(res => {
if (res.code === 0) {
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.viewIndex = 'checkInTableShow'
this.$axios.post(loc() + '/unionCheckInData', Object.assign({
unionId: id
}, this.buildActivityRequestParams())).then(res => {
if (res.code === 0) {
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.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.pageForm.unitId = null
getUnits(val).then((res) => {
this.unitOptions = res
this.doSearch()
})
},
pageData() {
this.tableLoading = true
this.$axios.post(loc() + '/pageData', this.pageForm).then(res => {
if (res.code === 0) {
this.tableData = res.data
} else {
this.$message.error(res.msg)
}
}).finally(() => {
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.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() {
getUnions(null).then((res) => {
this.unionOptions = res
return getUnits(null)
}).then((res) => {
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">
<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 @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>
<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>
<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>
<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 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-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>
@@ -194,9 +209,7 @@ 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"
@@ -225,7 +238,7 @@ layout("/layouts/platform.html"){
}
},
pageForm: {
year: moment().format('YYYY'),
year: $moment().format('YYYY'),
unionId:'',
unitId:''
},
@@ -261,119 +274,128 @@ 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.formData = resp.data
}
} else {
this.formData = {
manualLotteryRules: []
}
}
})
},
/**
* 查看中奖人员
*/
viewLotteryUsers(){
this.$refs.guava.view(() => {
this.awardPageData()
this.$refs.guava.view()
this.$nextTick(() => {
this.awardPageData()
})
},
async awardPageData() {
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
}
this.$axios.post('/platform/fitnessWalk/stepWining/prizeUsers', this.awardPageForm).then((resp) => {
if (resp.code === 0) {
this.awardTableData = resp.data
}
})
},
exportAwardExcel(){
const {searchKeyword,activityId,lotteryTime} = this.awardPageForm
this.$downLoad(loc() + '/exportAwardExcel', {
searchKeyword: searchKeyword,
activityId: activityId,
lotteryTime: lotteryTime
})
window.open( loc() + '/exportAwardExcel?searchKeyword=' + searchKeyword +
'&activityId=' + activityId +'&lotteryTime=' + lotteryTime)
},
async saveRaffle() {
const formData = this.formData
saveRaffle() {
console.log(this.formData)
const formData = Object.assign({}, 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)
}
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)
}
})
},
exportExcel(){
const {searchKeyword,activityId,unionId,unitId} = this.pageForm
this.$downLoad(loc() + '/exportExcel', {
searchKeyword: searchKeyword,
activityId: activityId,
unionId: unionId,
unitId: unitId
})
window.open( loc() + '/exportExcel?searchKeyword=' + searchKeyword +
'&activityId=' + activityId +'&unionId=' + unionId + '&unitId=' + unitId)
},
async getAllActivity() {
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')
}
this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm).then((res) => {
const data = res.data
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
}
if (this.activityOptions) {
this.pageForm.activityId = this.activityOptions[0]._id
}
})
},
async unionChange(val) {
unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
this.doSearch()
getUnits(val).then((res) => {
this.unitOptions = res
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
this.doSearch()
} else {
this.tableData = []
}
getCascadersActivity() {
this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year}).then((res) => {
this.activityOptions = res.data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
this.getAwardNameOptions()
this.doSearch()
} else {
this.tableData = []
}
})
},
async getAwardUserNum(){
const resp = await this.$axios.post('/platform/fitnessWalk/stepRaffle/getAwardUserNum')
if (resp.code === 0) {
getAwardUserNum(){
this.$axios.post('/platform/fitnessWalk/stepRaffle/getAwardUserNum').then((resp) => {
if (resp.code === 0) {
}
}
})
},
async getAwardNameOptions(){
const resp = await this.$axios.post('/platform/fitnessWalk/stepWining/prizeOption', {
getAwardNameOptions(){
this.$axios.post('/platform/fitnessWalk/stepWining/prizeOption', {
activityId: this.pageForm.activityId
}).then((resp) => {
if (resp.code === 0) {
this.awardNameOptions = resp.data
}
})
if (resp.code === 0) {
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() {
getUnions(null).then((res) => {
this.unionOptions = res
return getUnits(null)
}).then((res) => {
this.unitOptions = res
this.getCascadersActivity()
this.getAwardNameOptions()
})
}
})
</script>
@@ -7,67 +7,90 @@ 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-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-input placeholder="请输入姓名或工号" clearable v-model="pageForm.searchKeyword"
@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>
<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>
<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-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">
<table-tool :app="this" label="排行榜">
<el-radio-group v-model="pageForm.mode" size="small" @change="doSearch">
<el-radio-button label="today">今日排行榜</el-radio-button>
<el-radio-button label="all">总排行榜</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">导出{{pageForm.mode == 'today' ? '今日排行榜' : '总排行榜'}}</el-button>
<el-button @click="exportExcel2" 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"
@@ -122,52 +145,60 @@ layout("/layouts/platform.html"){
methods: {
exportExcel(){
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() + '/exportExcel?searchName=' + searchName + '&searchKeyword=' + searchKeyword +
'&activityId=' + activityId +'&unionId=' + unionId + '&unitId=' + unitId + '&mode=' + mode)
},
exportExcel2(){
const {searchName,searchKeyword,activityId,unionId,unitId,mode} = this.pageForm
window.open( loc() + '/exportExcel2?searchName=' + searchName + '&searchKeyword=' + searchKeyword +
'&activityId=' + activityId +'&unionId=' + unionId + '&unitId=' + unitId + '&mode=' + mode)
},
async getAllActivity() {
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')
}
this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm).then((res) => {
const data = res.data
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
}
if (this.activityOptions) {
this.pageForm.activityId = this.activityOptions[0]._id
}
})
},
async unionChange(val) {
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
getUnits(val).then((res) => {
this.unitOptions = res
this.doSearch()
} else {
this.tableData = []
}
})
},
getCascadersActivity() {
this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year}).then((res) => {
this.activityOptions = res.data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
this.doSearch()
} else {
this.tableData = []
}
})
}
},
async created() {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
await this.getCascadersActivity()
created() {
getUnions(null).then((res) => {
this.unionOptions = res
return getUnits(null)
}).then((res) => {
this.unitOptions = res
this.getCascadersActivity()
})
}
})
</script>
@@ -5,73 +5,92 @@ layout("/layouts/platform.html"){
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">年份:</div>
<div class="search-item-option">
<el-date-picker
:clearable="false"
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>
<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>
<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>
<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>
<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>
</search>
<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"
@@ -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,70 @@ 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.pageForm.unitId = null
getUnits(val).then((res) => {
this.unitOptions = res
this.doSearch()
} else {
this.tableData = []
}
})
},
getCascadersActivity() {
this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year}).then((res) => {
this.activityOptions = res.data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
this.doSearch()
} else {
this.tableData = []
}
})
},
pageData() {
sublime.showLoadingbar();
this.tableLoading = true
let pageForm = clone(this.pageForm)
if (pageForm.activityDate && pageForm.activityDate.length > 0) {
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;
} else {
this.$message.error(data.msg);
}
}, "json");
}).finally(() => {
sublime.closeLoadingbar();
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.activityInfo = resp.data
}
})
}
},
async created() {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
await this.getCascadersActivity()
await this.getActivityById();
created() {
getUnions(null).then((res) => {
this.unionOptions = res
return getUnits(null)
}).then((res) => {
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">
<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>
<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>
<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">
@@ -122,62 +173,75 @@ layout("/layouts/platform.html"){
},
methods: {
exportUserStepWining(){
this.$downLoad(loc() + '/exportUserStepWining', {
activityId: this.pageForm.activityId
})
window.open( loc() + '/exportUserStepWining?activityId=' + this.pageForm.activityId)
},
async getAllActivity() {
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
}
this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm).then((res) => {
const data = res.data
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
}
})
},
async unionChange(val) {
unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
this.doSearch()
getUnits(val).then((res) => {
this.unitOptions = res
this.doSearch()
})
},
subsectionChange(key) {
const data = this.allDataList.find(item => item.title === key)
this.tableData = data.awardList
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.$axios.post(loc() + '/getUserStepWining', this.pageForm).then((resp) => {
if (resp.code === 0){
this.allDataList = resp.data || []
this.subsectionList = this.allDataList.map(v => {
return {
name: v.title,
key: v.title
}
})
if (this.allDataList.length > 0) {
this.tableData = this.allDataList[0].awardList || []
this.changKeyItem = this.allDataList[0].title
} else {
this.tableData = []
this.changKeyItem = ''
}
})
this.tableData = this.allDataList[0].awardList
this.changKeyItem = this.allDataList[0].title
}
}
})
},
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.activityOptions = res.data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
this.doSearch()
} else {
this.tableData = []
}
})
},
},
async created() {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
await this.getCascadersActivity()
created() {
getUnions(null).then((res) => {
this.unionOptions = res
return getUnits(null)
}).then((res) => {
this.unitOptions = res
this.getCascadersActivity()
})
}
})
</script>
@@ -0,0 +1,298 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">年份:</div>
<div class="search-item-option">
<el-date-picker
:clearable="false"
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-item">
<div class="search-item-label">分工会:</div>
<div class="search-item-option">
<el-select
@change="doSearch"
clearable
filterable
placeholder="请选择分工会"
style="width: 100%"
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-input
@keyup.enter.native="doSearch"
clearable
placeholder="请输入姓名或工号"
v-model="pageForm.searchKeyword"></el-input>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary"></el-button>
</div>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="人员打卡情况">
<el-radio-group
v-model="pageForm.qualifiedStatus"
@change="doSearch"
size="mini">
<el-radio-button label="qualified">已达标人员</el-radio-button>
<el-radio-button label="unqualified">未达标人员</el-radio-button>
<el-radio-button label="all">全部</el-radio-button>
</el-radio-group>
<el-button
@click="exportExcel"
class="ml10"
icon="el-icon-download"
size="small"
type="primary">
导出
</el-button>
</table-tool>
<el-table :data="tableData" :size="tableSize" v-loading="tableLoading">
<el-table-column :index="indexMethod" align="center" header-align="center" label="序号" type="index"
width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:key="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns">
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
</guava>
</div>
<script nonce="${cspNonce!}">
let vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
tableColumns: [
{label: '姓名', prop: 'username'},
{label: '工号', prop: 'loginname'},
{label: '分工会', prop: 'unionname'},
{label: '单位', prop: 'unitname'},
{label: '达标几个活动', prop: 'qualifiedActivityNum', sortable: true},
{label: '点位总数', prop: 'pts_size', sortable: true},
{label: '已打卡点位数', prop: 'sign_size', sortable: true},
{label: '是否全部打卡完全部点位', prop: 'isAllSigned', sortable: true}
],
unionOptions: [],
pageForm: {
unionId: '',
year: new Date().getFullYear() + '',
mainActivityId: '',
subActivityId: '',
activityId: '',
qualifiedStatus: 'all',
searchKeyword: '',
pageNumber: 1,
pageSize: 10,
totalCount: 0
},
activityOptions: [],
subActivityOptions: []
}
},
methods: {
/**
* 根据当前页面选择,统一返回活动查询参数。
* 后端会按主活动、分活动与最终 activityId 自动判断查询单个活动还是整个关联活动集合。
*/
buildActivityRequestParams() {
return {
mainActivityId: this.pageForm.mainActivityId,
subActivityId: this.pageForm.subActivityId,
activityId: this.pageForm.activityId,
qualifiedStatus: this.pageForm.qualifiedStatus
}
},
/**
* 导出与列表复用同一套筛选条件,保证当前可见条件与导出结果一致。
*/
buildExportQueryString() {
const params = Object.assign({
unionId: this.pageForm.unionId,
searchKeyword: this.pageForm.searchKeyword
}, this.buildActivityRequestParams())
return 'mainActivityId=' + encodeURIComponent(params.mainActivityId || '')
+ '&subActivityId=' + encodeURIComponent(params.subActivityId || '')
+ '&activityId=' + encodeURIComponent(params.activityId || '')
+ '&unionId=' + encodeURIComponent(params.unionId || '')
+ '&searchKeyword=' + encodeURIComponent(params.searchKeyword || '')
+ '&qualifiedStatus=' + encodeURIComponent(params.qualifiedStatus || 'all')
},
exportExcel() {
window.open(loc() + '/exportExcel?' + this.buildExportQueryString())
},
/**
* 根据主活动构建分活动选项,并同步当前真正查询用的 activityId。
* 当主活动存在分活动时,默认保持“只选主活动”的聚合查询,用户手动选择分活动后再切到单活动查询。
*/
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', [])
this.$set(this.pageForm, 'totalCount', 0)
return
}
if (children.length > 0) {
const currentSubActivityId = this.pageForm.subActivityId
const hasMatchedSubActivity = currentSubActivityId && children.some(item => {
return item.value === currentSubActivityId
})
this.$set(this.pageForm, 'subActivityId', hasMatchedSubActivity ? currentSubActivityId : '')
this.$set(this.pageForm, 'activityId', hasMatchedSubActivity ? currentSubActivityId : mainActivityId)
} 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)
},
/**
* 分活动切换后,更新最终查询 activityId 并刷新列表。
*/
subActivityChange(val) {
this.$set(this.pageForm, 'subActivityId', val || '')
this.$set(this.pageForm, 'activityId', val || this.pageForm.mainActivityId || '')
this.doSearch()
},
pageData() {
this.tableLoading = true
this.$axios.post(loc() + '/pageData', Object.assign({
unionId: this.pageForm.unionId,
searchKeyword: this.pageForm.searchKeyword,
pageNumber: this.pageForm.pageNumber,
pageSize: this.pageForm.pageSize
}, this.buildActivityRequestParams())).then(res => {
if (res.code === 0) {
this.$set(this, 'tableData', res.data.list || [])
this.$set(this.pageForm, 'totalCount', res.data.totalCount || 0)
} else {
this.$message.error(res.msg)
}
}).finally(() => {
this.tableLoading = false
})
},
/**
* 年份切换后重载活动级联数据,并默认选中首个可用活动。
*/
getCascadersActivity() {
this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year}).then(res => {
if (res.code !== 0) {
this.$message.error(res.msg)
return
}
this.$set(this, 'activityOptions', res.data || [])
if (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', [])
this.$set(this.pageForm, 'totalCount', 0)
}
})
}
},
created() {
getUnions(null).then(res => {
this.$set(this, 'unionOptions', res || [])
this.getCascadersActivity()
})
}
})
</script>
<!--#
}
#-->