first commit
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
<!--#
|
||||
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="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('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">
|
||||
<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(){
|
||||
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)
|
||||
},
|
||||
|
||||
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()
|
||||
},
|
||||
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>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user