Files
zhgh_jvic/src/main/resources/views/platform/fitnessWalk/punchStatistics.html
T
2024-04-28 16:50:47 +08:00

263 lines
12 KiB
HTML

<!--#
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',
mixins: [initTableMixins],
data() {
return {
tableColumns: [
{label: '分工会', prop: 'unionname'},
{label: '报名人数', prop: 'regCount'},
{label: '打卡人数', prop: 'checkInCount'},
],
unionOptions: [],
unitOptions: [],
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'
$.get(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'
$.get(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)
}
window.open(loc() + '/exportExcel?hdid=' + hdid + '&unionId=' + unionId + '&unitId=' + unitId + '&activityDate=' + activityDate1)
},
activityDateChange() {
},
async unionChange(val) {
this.pageForm.unitId = null
this.unitOptions = await getUnits(val)
this.doSearch()
},
pageData() {
$.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 $.get(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() {
this.unionOptions = await getUnions(null)
this.unitOptions = await getUnits(null)
await this.getCascadersActivity()
}
})
</script>
<!--#
}
#-->