Files
UNION_NJUST/target/classes/views/platform/fitnessWalk/stepWining.html
T
2026-09-23 09:38:39 +08:00

239 lines
10 KiB
HTML

<!--#
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="getAllActivity"
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="${@shiro.hasRole('sysadmin')||@shiro.hasRole('H04')||@shiro.hasRole('A06')}">
<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(){
window.open( loc() + '/exportUserStepWining?activityId=' + this.pageForm.activityId)
},
async getAllActivity() {
this.pageForm.activityId = ''
this.activityOptions = []
const {data} = await $.get('/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 getUnits(val)
this.doSearch()
},
subsectionChange(key) {
const data = this.allDataList.find(item => item.title === key)
this.tableData = data.awardList
},
async pageData(){
const resp = await $.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 $.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.doSearch()
} else {
this.tableData = []
}
},
},
async created() {
this.unionOptions = await getUnions(null)
this.unitOptions = await getUnits(null)
await this.getCascadersActivity()
}
})
</script>
<!--#
}
#-->