first commit

This commit is contained in:
2026-08-26 14:25:17 +08:00
commit 06debfd1fc
10595 changed files with 1836924 additions and 0 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>
<!--#
}
#-->
@@ -0,0 +1,237 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
</style>
<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-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 :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="tableLoading" @selection-change="handleSelectionChange">
<el-table-column :reserve-selection="true"
type="selection"
width="55">
</el-table-column>
<el-table-column align="center" header-align="center" label="序号" width="60" type="index">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column label="工号" prop="loginname" header-align="center"
align="center"></el-table-column>
<el-table-column label="姓名" prop="username" header-align="center"
align="center"></el-table-column>
<el-table-column label="openid" prop="openid" header-align="center"
align="center"></el-table-column>
<el-table-column align="center" header-align="center" label="操作" fixed="right" width="240px">
<template scope="{row}">
<el-button type="danger" @click="doDelete(row._id)" size="mini"
icon="el-icon-delete"></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]"
:page-size="pageForm.pageSize"
layout="total, sizes, prev, pager, next"
:total="pageForm.totalCount">
</el-pagination>
</el-row>
</el-card>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
pageForm: {
searchName: "name",
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: ""
},
multipleSelection: [],
unionList: []
}
},
methods: {
dropdownCommand(command) {
const {type, data} = command
if (type == 'delete2') {
this.doDelete2()
} else if (type == 'delete3') {
this.doDelete3()
}
},
doDelete(id) {
this.$confirm('是否确定删除!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: (a, b) => {
if ("confirm" == a) {//确认后再执行
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'
});
}
})
}
}
})
},
doDelete2() {
if (!this.multipleSelection.length) {
this.$notify({
title: '提示',
message: '请先勾选需要删除的人员!',
type: 'warning'
});
return
}
this.$confirm('是否确定删除!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: (a, b) => {
if ("confirm" === a) {//确认后再执行
const arr = this.multipleSelection.map(v => {
return v._id
})
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'
});
}
})
}
}
})
},
doDelete3() {
this.$confirm('是否确定删除全部登录记录!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: (a, b) => {
if ("confirm" == a) {//确认后再执行
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;
}
},
created() {
this.pageData();
this.$businessTool.listUnion(null).then((res) => {
this.unionList = res
})
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,389 @@
<!--#
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-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-button @click="window.open(loc()+'/exportUnionRegCheckInNum?'+buildActivityQueryString())"
class="ml10"
size="small"
type="primary"
icon="el-icon-download">
导出报名及打卡人数
</el-button>
<el-button
@click="window.open(loc()+'/exportNotGetGiftVoucherUsers?'+buildActivityQueryString())"
class="ml10"
size="small"
type="primary"
icon="el-icon-download">
导出未取得礼品券人员
</el-button>
<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 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-column label="操作" width="300px">
<template scope="{row}">
<el-button @click="viewReg(row)" size="mini" type="primary">查看报名情况</el-button>
<el-button @click="viewCheckIn(row)" size="mini" type="primary">查看打卡情况</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</template>
<template #view>
<el-card shadow="never" v-if="viewIndex==='regTableShow'">
<template #header>
<div style="display: flex;justify-content: space-between;align-items: center">
<h4 style="color: rgb(24, 103, 176);">
{{viewUnion.unionname}}
</h4>
<el-button type="primary" size="mini" icon="el-icon-download"
@click="exportRegUsers">
导出名单
</el-button>
</div>
</template>
<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'">
<template #header>
<div style="display: flex;justify-content: space-between;align-items: center">
<h4 style="color: rgb(24, 103, 176);">
{{viewUnion.unionname}}
</h4>
<el-button type="primary" size="mini" icon="el-icon-download"
@click="exportCheckInUsers">
导出名单
</el-button>
</div>
</template>
<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>
<span v-else-if="!row.used" class="text-warning">未使用</span>
</template>
</el-table-column>
</el-table>
</el-card>
</template>
</guava>
</div>
<script nonce="${cspNonce!}">
let vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
tableColumns: [
{label: '分工会', prop: 'unionname'},
{label: '报名人数', prop: 'regCount'},
{label: '打卡人数', prop: 'checkInCount'},
],
// 礼品券列按当前需求先隐藏,代码保留便于后续恢复。
showGiftVoucherColumn: false,
unionOptions: [],
unitOptions: [],
pageForm: {
unionId: '',
unitId: '',
activityDate: [],
year: new Date().getFullYear() + '',
mainActivityId: '',
subActivityId: '',
activityId: '',
},
activityOptions: [],
subActivityOptions: [],
regTableData: [],
checkInTableData: [],
viewIndex: '',
viewUnion: {}
}
},
methods: {
viewReg({id, unionname}) {
this.viewUnion.unionId = id
this.viewUnion.unionname = unionname
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.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
let activityDate1 = []
if (activityDate && activityDate.length > 0) {
activityDate1 = JSON.stringify(activityDate)
}
window.open(loc() + '/exportExcel?hdid=' + hdid + '&unionId=' + unionId + '&unitId=' + unitId + '&activityDate=' + activityDate1)
},
activityDateChange() {
},
/**
* 统一返回当前活动查询参数。
* 后端会根据主活动、分活动和最终 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
this.$businessTool.listUnit(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
})
},
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() {
window.open(loc() + '/exportCheckInUsers?unionId=' + this.viewUnion.unionId + '&' + this.buildActivityQueryString())
},
exportRegUsers() {
window.open(loc() + '/exportRegUsers?unionId=' + this.viewUnion.unionId + '&' + this.buildActivityQueryString())
}
},
created() {
this.$businessTool.listUnion().then((res) => {
this.unionOptions = res
return this.$businessTool.listUnit()
}).then((res) => {
this.unitOptions = res
this.getCascadersActivity()
})
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,405 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
</style>
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">年份:</div>
<div class="search-item-option">
<el-date-picker 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 :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>
</table-tool>
<el-table :data="tableData" :size="tableSize">
<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"
: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 #edit>
<el-card shadow="never">
<h2 style="color: #0a84ff">抽奖规则</h2>
<span>排名位次指:一等奖,二等奖,三等奖;如您填写【1】,会按照达标总步数降序,取最高位次;填写【2】则排除【1】的中奖人数后再取抽奖人数的最高位次</span>
<el-form :model="formData" ref="formRef" label-width="100px">
<el-form-item>
<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>
</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.lotteryUserNum"
style="width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="抽奖类型" align="center">
<template scope="scope">
<el-select v-model="scope.row.raffleType">
<el-option
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in raffleTypeOptions">
</el-option>
</el-select>
</template>
</el-table-column>
<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>
</template>
</el-table-column>
<el-table-column label="是否兼得" align="center">
<template scope="scope">
<el-radio-group v-if="scope.row.raffleType == '达标'"
v-model="scope.row.isSimultaneously" size="small">
<el-radio label="true" border></el-radio>
<el-radio label="false" border></el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot="header" slot-scope="scope">
<el-button @click="formData.manualLotteryRules.push({})"
icon="el-icon-plus" size="mini" type="primary"></el-button>
</template>
<template scope="scope">
<el-button @click="formData.manualLotteryRules.splice(scope.$index,1)"
icon="el-icon-delete" size="mini" type="danger"></el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
</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>
</div>
</el-card>
</template>
<template #view>
<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="awardPageForm.searchKeyword" placeholder="请输入姓名或工号" clearable></el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">奖项名称</div>
<div class="search-item-option">
<el-select v-model="awardPageForm.lotteryTime" style="width: 100%" clearable>
<el-option
:key="item.value"
:label="item.value"
:value="item.value"
v-for="item in awardNameOptions">
</el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button @click="awardPageData" icon="el-icon-search" type="primary"></el-button>
</div>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="中奖人员列表">
<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="unitName"></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 nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins:[initTableMixins],
data() {
return {
pickerOptions: {
disabledDate(time) {
return (
time.getFullYear() > new Date().getFullYear()
);
}
},
pageForm: {
year: $moment().format('YYYY'),
unionId:'',
unitId:''
},
unionOptions: [],
unitOptions: [],
activityOptions: [],
tableColumns: [
{label: '姓名', prop: 'username'},
{label: '工号', prop: 'loginname'},
{label: '分工会', prop: 'unionname', sortable: true},
{label: '单位', prop: 'unitname'},
{label: '步数', prop: 'total_steps', sortable: true},
{label: '达标天数', prop: 'standardsDays', sortable: true},
],
raffleTypeOptions: [
{ value: '排名', label: '排名' },
{ value: '达标', label: '达标' },
],
formData: {
manualLotteryRules: []
},
awardNameOptions: [],
awardPageForm: {
searchKeyword: '',
activityId: '',
lotteryTime: ''
},
awardTableData: []
}
},
methods: {
/**
* 设置抽奖条件
*/
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.$nextTick(() => {
this.awardPageData()
})
},
awardPageData() {
this.awardPageForm.activityId = this.pageForm.activityId
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
window.open( loc() + '/exportAwardExcel?searchKeyword=' + searchKeyword +
'&activityId=' + activityId +'&lotteryTime=' + lotteryTime)
},
saveRaffle() {
console.log(this.formData)
const formData = Object.assign({}, this.formData)
formData.activityId = this.pageForm.activityId
formData.manualLotteryRules = JSON.stringify(this.formData.manualLotteryRules)
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
window.open( loc() + '/exportExcel?searchKeyword=' + searchKeyword +
'&activityId=' + activityId +'&unionId=' + unionId + '&unitId=' + unitId)
},
getAllActivity() {
this.pageForm.activityId = ''
this.activityOptions = []
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
}
})
},
unionChange(val) {
this.pageForm.unitId = null
this.$businessTool.listUnit(val).then((res) => {
this.unitOptions = res
this.doSearch()
})
},
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 = []
}
})
},
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.awardNameOptions = resp.data
}
})
},
},
created() {
this.$businessTool.listUnion().then((res) => {
this.unionOptions = res
return this.$businessTool.listUnit()
}).then((res) => {
this.unitOptions = res
this.getCascadersActivity()
this.getAwardNameOptions()
})
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,208 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
</style>
<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>
<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 :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" 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"
width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="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>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins:[initTableMixins],
data() {
return {
pickerOptions: {
disabledDate(time) {
return (
time.getFullYear() > new Date().getFullYear()
);
}
},
pageForm: {
year: new Date().getFullYear() + '',
mode:'today',
searchName:'u.username',
unionId:'',
unitId:''
},
unionOptions: [],
unitOptions: [],
activityOptions: [],
tableColumns: [
{label: '姓名', prop: 'username'},
{label: '工号', prop: 'loginname'},
{label: '分工会', prop: 'unionname', sortable: true},
{label: '单位', prop: 'unitname'},
{label: '步数', prop: 'total_steps', sortable: true},
],
}
},
methods: {
exportExcel(){
const {searchName,searchKeyword,activityId,unionId,unitId,mode} = this.pageForm
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)
},
getAllActivity() {
this.pageForm.activityId = ''
this.activityOptions = []
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
}
})
},
unionChange(val) {
this.pageForm.unitId = null
this.$businessTool.listUnit(val).then((res) => {
this.unitOptions = res
this.doSearch()
})
},
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 = []
}
})
}
},
created() {
this.$businessTool.listUnion().then((res) => {
this.unionOptions = res
return this.$businessTool.listUnit()
}).then((res) => {
this.unitOptions = res
this.getCascadersActivity()
})
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,234 @@
<!--#
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">
<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.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="mt20" shadow="never">
<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"
width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
<template scope="{row}" v-if="column.prop==='registerNum'">
<el-link @click="openView(row.id)" type="primary">
{{row.registerNum}}
</el-link>
</template>
</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: 'unitname'},
{label: '分工会', prop: 'unionname', sortable: true},
{label: '当前步数', prop: 'step', sortable: true},
{label: '日期', prop: 'prizeData', sortable: true}
],
unionOptions: [],
unitOptions: [],
pageForm: {
unionId: '',
unitId: '',
activityDate: [],
activityId: null,
year: new Date().getFullYear() + '',
},
activityOptions: [],
activityDatePickerOptions: {
disabledDate: time => {
if (!this.activityInfo.startTime || !this.activityInfo.endTime) {
return false
}
return time < $moment(this.activityInfo.startTime) || time > $moment(this.activityInfo.endTime)
}
},
activityInfo:{},
}
},
methods: {
exportExcel() {
const {activityId, unionId, unitId, activityDate} = this.pageForm
let activityDate1 = []
if (activityDate && activityDate.length > 0) {
activityDate1 = JSON.stringify(activityDate)
}
window.open(loc() + '/exportExcel?activityId=' + activityId + '&unionId=' + unionId + '&unitId=' + unitId + '&activityDate=' + activityDate1)
},
activityDateChange() {
// this.$set(this.pageForm, "activityDate", [])
},
activityChange() {
this.doSearch()
this.getActivityById()
},
unionChange(val) {
this.pageForm.unitId = null
this.$businessTool.listUnit(val).then((res) => {
this.unitOptions = res
this.doSearch()
})
},
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).then((data) => {
if (data.code === 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message.error(data.msg);
}
}).finally(() => {
sublime.closeLoadingbar();
this.tableLoading = false
});
},
getActivityById(){
this.$axios.post('/platform/fitnessWalk/activityManage/findOne', {id:this.pageForm.activityId}).then((resp) => {
if (resp.code === 0){
this.activityInfo = resp.data
}
})
}
},
created() {
this.$businessTool.listUnion().then((res) => {
this.unionOptions = res
return this.$businessTool.listUnit()
}).then((res) => {
this.unitOptions = res
this.getCascadersActivity()
this.getActivityById();
})
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,251 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.query-row {
height: 50px;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
}
.query-row:not(:last-child) {
border-bottom: 1px dashed rgb(230, 230, 230);
}
.query-row-title {
width: 120px;
}
</style>
<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>
<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">
<el-row type="flex" align="middle" class="query-row">
<el-col class="query-row-title">奖项名称:</el-col>
<el-col class="query-row-content">
<el-radio-group v-model="changKeyItem" @change="subsectionChange(changKeyItem)" size="small">
<el-radio
style="margin-right: 10px;margin-top:5px;cursor: pointer"
border
v-for="item in subsectionList"
:key="item.value"
:label="item.name">
{{ item.name }}
</el-radio>
</el-radio-group>
</el-col>
</el-row>
</el-card>
<el-card class="mt10" shadow="never">
<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">
<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"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns">
</el-table-column>
</el-table>
</el-card>
</guava>
</div>
<script nonce="${cspNonce!}">
const vue = new Vue({
el: '#app',
mixins:[initTableMixins],
data() {
return {
pickerOptions: {
disabledDate(time) {
return (
time.getFullYear() > new Date().getFullYear()
);
}
},
pageForm: {
year: new Date().getFullYear() + '',
mode:'today',
searchName:'u.username',
activityId:null
},
unionOptions: [],
unitOptions: [],
activityOptions: [],
tableColumns: [
{label: '姓名', prop: 'username'},
// {label: '工号', prop: 'loginname'},
{label: '分工会', prop: 'unionName', sortable: true},
{label: '单位', prop: 'unitName'},
{label: '奖项名称', prop: 'awardName'},
],
allDataList:[],
subsectionList:[],
subsectionIndex: 0,
changKeyItem:'',
}
},
methods: {
exportUserStepWining(){
window.open( loc() + '/exportUserStepWining?activityId=' + this.pageForm.activityId)
},
getAllActivity() {
this.pageForm.activityId = ''
this.activityOptions = []
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
}
})
},
unionChange(val) {
this.pageForm.unitId = null
this.$businessTool.listUnit(val).then((res) => {
this.unitOptions = res
this.doSearch()
})
},
subsectionChange(key) {
const data = this.allDataList.find(item => item.title === key)
this.tableData = data ? data.awardList || [] : []
},
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 = ''
}
}
})
},
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 = []
}
})
},
},
created() {
this.$businessTool.listUnion().then((res) => {
this.unionOptions = res
return this.$businessTool.listUnit()
}).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() {
this.$businessTool.listUnion().then(res => {
this.$set(this, 'unionOptions', res || [])
this.getCascadersActivity()
})
}
})
</script>
<!--#
}
#-->