391 lines
18 KiB
HTML
391 lines
18 KiB
HTML
<!--#
|
|
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="${@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-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 $.post('/platform/fitnessWalk/stepRaffle/getRaffle', {
|
|
activityId: this.pageForm.activityId
|
|
})
|
|
if (resp.code === 0) {
|
|
if (resp.data) {
|
|
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 $.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 $.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 $.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 getAwardUserNum(){
|
|
const resp = await $.post('/platform/fitnessWalk/stepRaffle/getAwardUserNum')
|
|
if (resp.code === 0) {
|
|
|
|
}
|
|
},
|
|
async getAwardNameOptions(){
|
|
const resp = await $.post('/platform/fitnessWalk/stepWining/prizeOption', {
|
|
activityId: this.pageForm.activityId
|
|
})
|
|
if (resp.code === 0) {
|
|
this.awardNameOptions = resp.data
|
|
}
|
|
},
|
|
},
|
|
async created() {
|
|
this.unionOptions = await getUnions(null)
|
|
this.unitOptions = await getUnits(null)
|
|
await this.getCascadersActivity()
|
|
await this.getAwardNameOptions()
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<!--#
|
|
}
|
|
#-->
|