436 lines
20 KiB
HTML
436 lines
20 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
<style>
|
|
.el-table__footer-wrapper td {
|
|
color: orangered !important;
|
|
}
|
|
|
|
.el-col .el-button {
|
|
overflow: hidden;
|
|
}
|
|
</style>
|
|
<div id="app" v-cloak>
|
|
|
|
<guava ref="guava">
|
|
<template>
|
|
<el-card shadow="never">
|
|
<div class="tool-button">
|
|
<el-row :gutter="20" type="flex">
|
|
<el-col :span="4">
|
|
<el-date-picker style="width: 100%"
|
|
class="mr5"
|
|
:picker-options="pickerOptions"
|
|
v-model="pageForm.year" :clearable="false"
|
|
type="year"
|
|
value-format="yyyy" @change="getAllHd"
|
|
placeholder="选择年">
|
|
</el-date-picker>
|
|
</el-col>
|
|
<el-col :span="10">
|
|
<el-select v-model="pageForm.activity_tag" @change="tagChange"
|
|
style="width: 100%">
|
|
<el-option v-for="o in activityOptions" :label="o.name" :value="o._id"
|
|
:key="o._id"></el-option>
|
|
</el-select>
|
|
</el-col>
|
|
|
|
<el-col :span="10">
|
|
<el-select v-model="pageForm.activity_id" @change="hdChange" clearable
|
|
style="width: 100%">
|
|
<el-option v-for="o in childActivityOptions"
|
|
:label="o.name" :value="o._id"
|
|
:key="o._id"></el-option>
|
|
</el-select>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20" type="flex" class="mt10">
|
|
<el-col :span="4">
|
|
<el-button @click="doAlreadyGiftExport" icon="el-icon-download"
|
|
style="width: 100%">导出已领取礼品用户
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-button @click="doNotGiftExport" icon="el-icon-download"
|
|
style="width: 100%">导出未领取礼品用户
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-button icon="el-icon-download" style="width: 100%;" @click="doExport">按分工会导出导出全部
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-button icon="el-icon-download" style="width: 100%;" @click="doExportRegsiter">导出报名人员
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-button icon="el-icon-download" style="width: 100%;" @click="doExportSign">导出参与人员
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-button icon="el-icon-download" style="width: 100%;" @click="doExportSummary">导出汇总表
|
|
</el-button>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
</el-card>
|
|
<el-card shadow="never" class="mt20">
|
|
<el-table :data="tableData" show-summary v-loading="tableLoading">
|
|
<el-table-column type="index" label="序号"></el-table-column>
|
|
<el-table-column prop="unionname" label="院级工会"></el-table-column>
|
|
<el-table-column prop="reg_num" label="报名人数" sortable>
|
|
<template slot-scope="{row}">
|
|
<span class="text-primary pointer" @click="dropdownCommand({type:'reg',data:row})">
|
|
{{row.reg_num}}
|
|
</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="sign_num" label="参加人数" sortable>
|
|
<template slot-scope="{row}">
|
|
<span class="text-primary pointer" @click="dropdownCommand({type:'sign',data:row})">
|
|
{{row.sign_num}}
|
|
</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" header-align="center" label="操作" fixed="right" width="120px">
|
|
<template scope="{row}">
|
|
<el-dropdown @command="dropdownCommand">
|
|
<el-button size="mini">
|
|
<i class="ti-settings"></i>
|
|
<span class="ti-angle-down"></span>
|
|
</el-button>
|
|
<el-dropdown-menu slot="dropdown">
|
|
<el-dropdown-item :command="{type:'reg',data:row}">
|
|
活动报名情况
|
|
</el-dropdown-item>
|
|
<el-dropdown-item :command="{type:'sign',data:row}">
|
|
活动参与情况
|
|
</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-card>
|
|
</template>
|
|
<template #edit>
|
|
<el-card class="box-card v-box" shadow="never">
|
|
<div slot="header" class="clearfix">
|
|
<span style="font-size: 18px;margin-left: 20px">{{vPageForm.unionname}}</span>
|
|
|
|
<el-button style="float: right; font-size: 18px" type="text"
|
|
@click="v=='reg'?doRegExport():doSignExport()"
|
|
icon="el-icon-download">导出名单
|
|
</el-button>
|
|
</div>
|
|
<div style="padding: 0 2%">
|
|
<el-row>
|
|
<el-table :data="vTableData" style="width: 100%" row-key="id" v-loading="vTableLoading">
|
|
<el-table-column align="center" header-align="center" label="序号" type="index">
|
|
<template scope="scope">
|
|
<span>{{scope.$index+(vPageForm.pageNumber - 1) * vPageForm.pageSize + 1}} </span>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<!-- <el-table-column label="活动名称" prop="activity_name" header-align="center"-->
|
|
<!-- align="center"></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="性别" prop="sex" header-align="center"
|
|
align="center"></el-table-column>
|
|
|
|
<el-table-column label="单位" prop="unitname" header-align="center"
|
|
align="center"></el-table-column>
|
|
|
|
<template v-if="v=='reg'">
|
|
<el-table-column label="报名时间" prop="register_time" header-align="center"
|
|
align="center">
|
|
<template scope="{row}">
|
|
{{row.register_time | ts2str}}
|
|
</template>
|
|
</el-table-column>
|
|
</template>
|
|
|
|
<template v-if="v=='sign'">
|
|
<el-table-column label="点位总数" prop="pts_size" header-align="center"
|
|
align="center">
|
|
<template scope="{row}">
|
|
{{row.pts_size.$numberInt}}
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column label="签到数量" prop="sign_size" header-align="center"
|
|
align="center">
|
|
<template scope="{row}">
|
|
{{row.sign_size.$numberInt > row.pts_size.$numberInt ?
|
|
row.pts_size.$numberInt:row.sign_size.$numberInt}}
|
|
</template>
|
|
</el-table-column>
|
|
</template>
|
|
|
|
</el-table>
|
|
</el-row>
|
|
|
|
<el-row class="el-pagination-container">
|
|
<el-pagination
|
|
@current-change="vPageNumberChange"
|
|
:current-page="vPageForm.pageNumber"
|
|
:page-size="vPageForm.pageSize"
|
|
layout="total, prev, pager, next"
|
|
:total="vPageForm.totalCount">
|
|
</el-pagination>
|
|
</el-row>
|
|
</div>
|
|
</el-card>
|
|
</template>
|
|
</guava>
|
|
|
|
</div>
|
|
<script>
|
|
|
|
function groupBy(arr, key) {
|
|
const result = {}
|
|
arr.forEach(v => {
|
|
if (result[v[key]]) {
|
|
result[v[key]].push(v)
|
|
} else {
|
|
result[v[key]] = [v]
|
|
}
|
|
})
|
|
return result
|
|
}
|
|
|
|
var vue = new Vue({
|
|
el: '#app',
|
|
data() {
|
|
return {
|
|
pickerOptions: {
|
|
disabledDate(time) {
|
|
return (
|
|
time.getFullYear() > new Date().getFullYear()
|
|
);
|
|
}
|
|
},
|
|
v: 'index',
|
|
tableLoading: false,
|
|
vTableLoading: false,
|
|
tableData: [],
|
|
vTableData: [],
|
|
hdOptions: [],
|
|
pageForm: {
|
|
year: new Date().getFullYear() + '',
|
|
activity_id: '',
|
|
activity_tag: [],
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
totalCount: 0
|
|
},
|
|
vPageForm: {
|
|
activity_id: '',
|
|
unionid: '',
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
totalCount: 0
|
|
},
|
|
detailVisible: false,
|
|
activityOptions: [],
|
|
childActivityOptions: []
|
|
}
|
|
},
|
|
filters: {
|
|
ts2str(val) {
|
|
return moment(val).format("YYYY-MM-DD HH:mm:ss")
|
|
},
|
|
},
|
|
methods: {
|
|
doExportRegsiter() {
|
|
window.open('/platform/jsz/union/registerInfo/doExportRegsiter?activity_id=' + this.pageForm.activity_id + "&activity_tag=" + JSON.stringify(this.pageForm.activity_tag))
|
|
},
|
|
doExportSign() {
|
|
window.open('/platform/jsz/union/registerInfo/doExportSign?activity_id=' + this.pageForm.activity_id + "&activity_tag=" + JSON.stringify(this.pageForm.activity_tag))
|
|
},
|
|
doExportSummary() {
|
|
window.open('/platform/jsz/union/registerInfo/doExportSummary?activity_id=' + this.pageForm.activity_id + "&activity_tag=" + JSON.stringify(this.pageForm.activity_tag))
|
|
},
|
|
doAlreadyGiftExport() {
|
|
location.href = "/platform/jsz/union/registerInfo/doGiftExport?activity_id=" + this.pageForm.activity_id + "&activity_tag=" + JSON.stringify(this.pageForm.activity_tag) + "&flag=" + true
|
|
},
|
|
doNotGiftExport() {
|
|
location.href = "/platform/jsz/union/registerInfo/doGiftExport?activity_id=" + this.pageForm.activity_id + "&activity_tag=" + JSON.stringify(this.pageForm.activity_tag) + "&flag=" + false
|
|
},
|
|
doRegExport() {
|
|
location.href = "/platform/jsz/union/registerInfo/regExport?unionname=" + this.vPageForm.unionname + "&activity_id=" + this.vPageForm.activity_id + "&activity_tag=" + JSON.stringify(this.vPageForm.activity_tag) + "&unionid=" + this.vPageForm.unionid
|
|
},
|
|
doSignExport() {
|
|
location.href = "/platform/jsz/union/registerInfo/signExport?unionname=" + this.vPageForm.unionname + "&activity_id=" + this.vPageForm.activity_id + "&activity_tag=" + JSON.stringify(this.vPageForm.activity_tag) + "&unionid=" + this.vPageForm.unionid
|
|
},
|
|
vPageNumberChange(val) {//分页大小更新操作
|
|
this.vPageForm.pageNumber = val;
|
|
this.vPageData();
|
|
},
|
|
vPageData() {//加载分页数据
|
|
sublime.showLoadingbar();//显示loading
|
|
this.vTableLoading = true
|
|
console.log(this.vPageForm)
|
|
$.post(base + "/platform/jsz/union/registerInfo/" + (this.v == 'reg' ? 'getRegisterUser' : 'getSignUser'), this.vPageForm, (data) => {
|
|
sublime.closeLoadingbar();//关闭loading
|
|
this.vTableLoading = false
|
|
if (data.code == 0) {
|
|
this.vTableData = data.data.list;
|
|
this.vPageForm.totalCount = data.data.totalCount;
|
|
} else {
|
|
this.$message({
|
|
message: data.msg,
|
|
type: 'error'
|
|
});
|
|
}
|
|
}, "json");
|
|
},
|
|
|
|
dropdownCommand(command) {
|
|
const {type, data} = command
|
|
|
|
this.vPageForm = {
|
|
activity_tag: this.pageForm.activity_tag,
|
|
activity_id: this.pageForm.activity_id,
|
|
unionid: data.id,
|
|
unionname: data.unionname,
|
|
pageNumber: 1,
|
|
pageSize: 20,
|
|
totalCount: 0
|
|
}
|
|
|
|
this.v = type
|
|
this.$refs.guava.edit()
|
|
this.vPageData()
|
|
},
|
|
doExport() {
|
|
let activity_name = ""
|
|
let activity_tag = []
|
|
if (this.pageForm.activity_id) {
|
|
const activity = this.hdOptions.find(v => {
|
|
return v._id === this.pageForm.activity_id
|
|
})
|
|
activity_name = activity.name
|
|
} else if (this.pageForm.activity_tag) {
|
|
const host_act = this.hdOptions.filter(v => {
|
|
return this.pageForm.activity_tag.includes(v._id)
|
|
})
|
|
activity_tag = host_act.map(v => v._id)
|
|
activity_name = host_act[0].tag + host_act.map(v => v.name).toString()
|
|
}
|
|
console.log(activity_tag.toString())
|
|
if (!activity_name) return
|
|
console.log(JSON.stringify(activity_tag))
|
|
console.log("/platform/jsz/union/registerInfo/regExport?unionname=" + this.vPageForm.unionname + "&activity_id=" + this.vPageForm.activity_id + "&activity_tag=" + JSON.stringify(this.pageForm.activity_tag) + "&unionid=" + this.vPageForm.unionid)
|
|
const exportUrl = "/platform/jsz/union/registerInfo/exportAllUnionData?activity_name=" + activity_name + "&activity_tag=" + activity_tag.toString() + "&activity_id=" + this.pageForm.activity_id
|
|
window.open(exportUrl)
|
|
console.log(exportUrl)
|
|
},
|
|
async getUnionNumData() {
|
|
if (this.hdOptions.length > 0) {
|
|
this.tableLoading = true
|
|
const {data} = await $.get('/platform/jsz/union/registerInfo/getData', this.pageForm)
|
|
this.tableData = data
|
|
this.tableLoading = false
|
|
}
|
|
},
|
|
async getAllHd() {
|
|
this.pageForm.activity_tag = ''
|
|
this.pageForm.activity_id = ''
|
|
this.activityOptions = []
|
|
this.childActivityOptions = []
|
|
const {year} = this.pageForm
|
|
if (year) {
|
|
const beforeTime = moment().year(year).startOf('year').valueOf();
|
|
const endTime = moment().year(year).endOf('year').valueOf();
|
|
this.pageForm = {...this.pageForm, beforeTime, endTime}
|
|
}
|
|
|
|
const {data} = await $.get('/jsz/common/getAllHd', this.pageForm)
|
|
if (data == null || data.length === 0) {
|
|
this.tableData = []
|
|
return
|
|
}
|
|
|
|
this.hdOptions = data
|
|
|
|
const tags = Array.from(new Set(data.map(v => v.tag && v.tag != 'null' ? v.tag : v.name)))
|
|
const host_act = []
|
|
tags.map(v => {
|
|
host_act.push({name: v})
|
|
})
|
|
|
|
console.log(host_act)
|
|
|
|
console.log(data)
|
|
host_act.map(t => {
|
|
t._id = []
|
|
data.map(v => {
|
|
if (!v.tag || v.tag == 'null') {
|
|
if (v.name === t.name) {
|
|
t._id.push(v._id)
|
|
t.isHost = true
|
|
}
|
|
} else {
|
|
if (v.tag === t.name) {
|
|
t._id.push(v._id)
|
|
t.isHost = false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
this.activityOptions = host_act
|
|
if (this.activityOptions) {
|
|
this.pageForm.activity_tag = this.activityOptions[0]._id
|
|
if (!this.activityOptions[0].isHost) {
|
|
this.childActivityOptions = this.hdOptions.filter(v => {
|
|
return v.tag === this.activityOptions[0].name
|
|
})
|
|
}
|
|
await this.getUnionNumData()
|
|
}
|
|
|
|
// this.activityOptions = groupBy(data, 'tag')
|
|
//
|
|
// if (Object.keys(this.activityOptions).length) {
|
|
// this.pageForm.activity_tag = Object.keys(this.activityOptions)[0]
|
|
// this.getUnionNumData()
|
|
// } else {
|
|
// this.tableData = []
|
|
// }
|
|
},
|
|
tagChange(val) {
|
|
this.pageForm.activity_id = ''
|
|
const act = this.activityOptions.find(v => v._id === val)
|
|
if (!act.isHost) {
|
|
this.childActivityOptions = this.hdOptions.filter(v => {
|
|
return v.tag === act.name
|
|
})
|
|
} else {
|
|
this.childActivityOptions = []
|
|
}
|
|
this.getUnionNumData()
|
|
},
|
|
hdChange(activity_id) {
|
|
this.pageForm.activity_id = activity_id
|
|
this.getUnionNumData()
|
|
},
|
|
},
|
|
async created() {
|
|
await this.getAllHd()
|
|
}
|
|
|
|
})
|
|
</script>
|
|
|
|
|
|
<!--#
|
|
}
|
|
#-->
|