小程序

This commit is contained in:
Paidax
2025-10-24 17:50:34 +08:00
parent d0f80f57b5
commit af130baaf7
49 changed files with 8642 additions and 6 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,287 @@
<!--#
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.name"
: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="绑定列表">
<template #func>
<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>
</template>
</table-tool>
<el-table :data="tableData" style="width: 100%" row-key="_id" @sort-change="pageOrder"
v-loading="tabLoading" @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>
const vue = new Vue({
el: '#app',
store,
data() {
return {
v: "index",
stepActive: 0,
tabLoading: false,
subDis: false,
formData: {},
tableData: [],
pageForm: {
searchName: "name",
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: ""
},
multipleSelection: [],
unionList: []
}
},
methods: {
dropdownCommand: function (command) {
const {type, data} = command
if (type == 'delete2') {
this.doDelete2()
} else if (type == 'delete3') {
this.doDelete3()
}
},
async doDelete(id) {
this.$confirm('是否确定删除!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (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'
});
}
}
}
})
},
async doDelete2() {
if (!this.multipleSelection.length) {
this.$notify({
title: '提示',
message: '请先勾选需要删除的人员!',
type: 'warning'
});
return
}
this.$confirm('是否确定删除!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (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'
});
}
}
}
})
},
async doDelete3() {
this.$confirm('是否确定删除全部登录记录!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: async (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'
});
}
}
}
})
},
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: res.msg,
type: 'error'
});
}
})
},
},
async created() {
this.pageData();
if (this.$auth.hasRoleOr("SYSADMIN, SCHOOL_UNION_ADMIN")) {
this.unionList = await this.$businessTool.listUnion()
} else {
this.unionList = await this.$businessTool.listUnion(this.$store.state.union.id)
}
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,260 @@
<!--#
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="doSearch"
v-model="pageForm.activityId"
:options="activityOptions"
:props="{ checkStrictly: true,emitPath:false}"
clearable></el-cascader>
</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="参与列表">
<template #func>
<el-button @click="window.open(loc()+'/exportUnionRegCheckInNum?activityId='+pageForm.activityId)"
class="ml10"
size="small"
type="primary"
icon="el-icon-download">
导出报名及打卡人数
</el-button>
<el-button @click="window.open(loc()+'/exportNotGetGiftVoucherUsers?activityId='+pageForm.activityId)"
class="ml10"
size="small"
type="primary"
icon="el-icon-download">
导出未取得礼品券人员
</el-button>
<el-button @click="window.open(loc()+'/exportNotGetGiftVoucherUsers?activityId='+pageForm.activityId)"
class="ml10"
size="small"
type="primary"
icon="el-icon-download">
导出未使用礼品券用户
</el-button>
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize" show-summary>
<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">
<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>
</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">
<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">
<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>
let vue = new Vue({
el: '#app',
store,
mixins: [initTableMixins],
data() {
return {
tableColumns: [
{label: '分工会', prop: 'unionname'},
{label: '报名人数', prop: 'regCount'},
{label: '打卡人数', prop: 'checkInCount'},
],
pageForm: {
unionId: '',
unitId: '',
activityDate: [],
year: new Date().getFullYear() + '',
},
activityOptions: [],
regTableData: [],
checkInTableData: [],
viewIndex: '',
viewUnion: {}
}
},
methods: {
viewReg({id, unionname}) {
this.viewUnion.unionId = id
this.viewUnion.unionname = unionname
this.$refs.guava.view()
this.viewIndex = 'regTableShow'
this.$axios.post(loc() + '/unionRegistrationData', {
unionId: id,
activityId: this.pageForm.activityId
}).then(res => {
if (res.code === 0) {
this.regTableData = res.data
} else {
this.$message.error(res.msg)
}
})
},
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)
}
})
},
exportExcel() {
const {hdid, unionId, unitId, activityDate} = this.pageForm
let activityDate1 = []
if (activityDate && activityDate.length > 0) {
activityDate1 = JSON.stringify(activityDate)
}
const pageForm = {
hdid: hdid,
unionId: unionId,
unitId: unitId,
activityDate: activityDate1
}
this.$downLoad(loc() + '/exportExcel', pageForm)
},
activityDateChange() {
},
pageData() {
this.$axios.post(loc() + '/pageData', this.pageForm).then(res => {
if (res.code === 0) {
this.tableData = res.data
} else {
this.$message.error(res.msg)
}
})
},
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 = []
}
},
exportCheckInUsers() {
window.open(loc() + '/exportCheckInUsers?unionId=' + this.viewUnion.unionId + '&activityId=' + this.pageForm.activityId)
},
exportRegUsers(){
window.open(loc() + '/exportRegUsers?unionId=' + this.viewUnion.unionId + '&activityId=' + this.pageForm.activityId)
}
},
async created() {
await this.getCascadersActivity()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,388 @@
<!--#
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>
<template v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')">
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select @change="unionChange" clearable filterable style="width: 100%"
placeholder="请选择所属工会" v-model="pageForm.unionId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unionOptions">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select @change="doSearch" clearable filterable style="width: 100%"
placeholder="请选择所属单位" v-model="pageForm.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</div>
</div>
</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">
<table-tool :app="this" label="达标人员列表">
<template #func>
<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>
</template>
</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.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="中奖人员列表">
<template #func>
<el-button @click="exportAwardExcel" icon="el-icon-download" type="primary" size="small">导出中奖人员</el-button>
</template>
</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>
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: {
/**
* 设置抽奖条件
*/
async setRaffle(){
this.$refs.guava.edit()
// 获取该活动的抽奖条件
const resp = await this.$axios.post('/platform/fitnessWalk/stepRaffle/getRaffle', {
activityId: this.pageForm.activityId
})
if (resp.code === 0) {
this.formData = resp.data
} else {
this.formData = {
manualLotteryRules: []
}
}
},
/**
* 查看中奖人员
*/
viewLotteryUsers(){
this.$refs.guava.view()
this.$nextTick(() => {
this.awardPageData()
})
},
async awardPageData() {
this.awardPageForm.activityId = this.pageForm.activityId
const resp = await this.$axios.post('/platform/fitnessWalk/stepWining/prizeUsers', this.awardPageForm)
if (resp.code === 0) {
this.awardTableData = resp.data
}
},
exportAwardExcel(){
const {searchKeyword,activityId,lotteryTime} = this.awardPageForm
window.open( loc() + '/exportAwardExcel?searchKeyword=' + searchKeyword +
'&activityId=' + activityId +'&lotteryTime=' + lotteryTime)
},
async saveRaffle() {
console.log(this.formData)
const formData = this.formData
formData.activityId = this.pageForm.activityId
formData.manualLotteryRules = JSON.stringify(this.formData.manualLotteryRules)
const resp = await this.$axios.post('/platform/fitnessWalk/stepRaffle/saveRaffle', this.formData)
if (resp.code === 0) {
this.$message.success('保存成功')
this.$refs.guava.index()
} else {
this.$message.warning(resp.msg)
}
},
exportExcel(){
const {searchKeyword,activityId,unionId,unitId} = this.pageForm
window.open( loc() + '/exportExcel?searchKeyword=' + searchKeyword +
'&activityId=' + activityId +'&unionId=' + unionId + '&unitId=' + unitId)
},
async getAllActivity() {
this.pageForm.activityId = ''
this.activityOptions = []
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
}
},
async unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
this.doSearch()
},
async getCascadersActivity() {
const {code, data} = await this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year})
this.activityOptions = data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
this.doSearch()
} else {
this.tableData = []
}
},
async getAwardUserNum(){
const resp = await this.$axios.post('/platform/fitnessWalk/stepRaffle/getAwardUserNum')
if (resp.code === 0) {
}
},
async getAwardNameOptions(){
const resp = await this.$axios.post('/platform/fitnessWalk/stepWining/prizeOption', {
activityId: this.pageForm.activityId
})
if (resp.code === 0) {
this.awardNameOptions = resp.data
}
},
},
async created() {
this.unionOptions = await this.$businessTool.listUnion()
this.unitOptions = await this.$businessTool.listUnit()
await this.getCascadersActivity()
await this.getAwardNameOptions()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,195 @@
<!--#
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>
<template v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')">
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select @change="unionChange" clearable filterable style="width: 100%"
placeholder="请选择所属工会" v-model="pageForm.unionId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unionOptions">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select @change="doSearch" clearable filterable style="width: 100%"
placeholder="请选择所属单位" v-model="pageForm.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</div>
</div>
</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">
<table-tool :app="this" label="排行榜">
<template #func>
<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>
</template>
</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>
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(){
this.$downLoad(loc()+ '/exportExcel', this.pageForm)
},
async getAllActivity() {
this.pageForm.activityId = ''
this.activityOptions = []
const {data} = await this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm)
if (data == null || data.length === 0) {
this.tableData = []
return
} else {
this.activityOptions = data.filter(item => item.activityModel === 'stepCount')
}
if (this.activityOptions) {
this.pageForm.activityId = this.activityOptions[0]._id
}
},
async unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
this.doSearch()
},
async getCascadersActivity() {
const {code, data} = await this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year})
this.activityOptions = data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
this.doSearch()
} else {
this.tableData = []
}
}
},
async created() {
this.unionOptions = await this.$businessTool.listUnion(null)
this.unitOptions = await this.$businessTool.listUnit(null)
await this.getCascadersActivity()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,228 @@
<!--#
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="doSearch();getActivityById()"
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>
<template v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')">
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select @change="unionChange" clearable filterable style="width: 100%"
placeholder="请选择所属工会" v-model="pageForm.unionId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unionOptions">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select @change="doSearch" clearable filterable style="width: 100%"
placeholder="请选择所属单位" v-model="pageForm.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</div>
</div>
</template>
<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="步数列表">
<template #func>
<el-button @click="exportExcel" class="ml10" size="small" type="primary">导出</el-button>
</template>
</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>
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 => {
return (
time <= moment(this.activityInfo.endTime) || time >= moment(this.activityInfo.startTime)
);
}
},
activityInfo:{},
}
},
methods: {
exportExcel() {
const {activityId, unionId, unitId, activityDate} = this.pageForm
let activityDate1 = []
if (activityDate && activityDate.length > 0) {
activityDate1 = JSON.stringify(activityDate)
}
const pageForm = {
activityId,
unionId,
unitId,
activityDate: activityDate1
}
this.$downLoad(loc() + '/exportExcel', pageForm)
},
activityDateChange() {
// this.$set(this.pageForm, "activityDate", [])
},
async unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
this.doSearch()
},
async getCascadersActivity() {
const {code, data} = await this.$axios.post(loc() + '/getCascadersActivity', {year: this.pageForm.year})
this.activityOptions = data
if (this.activityOptions && this.activityOptions.length > 0) {
this.pageForm.activityId = this.activityOptions[0].value
this.doSearch()
} else {
this.tableData = []
}
},
pageData() {
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.tableLoading = false
if (data.code === 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message.error(data.msg);
}
}, "json");
},
async getActivityById(){
const resp = await this.$axios.post('/platform/fitnessWalk/activityManage/findOne',{id:this.pageForm.activityId})
if (resp.code === 0){
this.activityInfo = resp.data
}
}
},
async created() {
this.unionOptions = await this.$businessTool.listUnion(null)
this.unitOptions = await this.$businessTool.listUnit(null)
await this.getCascadersActivity()
await this.getActivityById();
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,238 @@
<!--#
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 v-if="$auth.hasRoleOr('SYSADMIN, SCHOOL_UNION_ADMIN')">
<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="中奖榜">
<template #func>
<el-button @click="exportUserStepWining" class="ml10" size="small" type="primary">导出中奖名单</el-button>
</template>
</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>
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(){
this.$downLoad(loc() + '/exportUserStepWining?activityId=' + this.pageForm.activityId)
},
async getAllActivity() {
this.pageForm.activityId = ''
this.activityOptions = []
const {data} = await this.$axios.post('/platform/fitnessWalk/activityManage/getAllActivity', this.pageForm)
if (data == null || data.length === 0) {
this.tableData = []
return
} else {
this.activityOptions = data.filter(item => item.activityModel === 'stepCount')
}
if (this.activityOptions) {
this.pageForm.activityId = this.activityOptions[0]._id
}
},
async unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await this.$businessTool.listUnit(val)
this.doSearch()
},
subsectionChange(key) {
const data = this.allDataList.find(item => item.title === key)
this.tableData = 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
}
})
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 = []
}
},
},
async created() {
// this.unionOptions = await getUnions(null)
// this.unitOptions = await getUnits(null)
await this.getCascadersActivity()
}
})
</script>
<!--#
}
#-->
@@ -320,6 +320,8 @@ layout("/layouts/platform.html"){
changeWelfareMobileVisible: false,
welfareFormData: {},
changeTypeData: [],
checkedFields: []
},
components: {