first commit
This commit is contained in:
@@ -0,0 +1,223 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<div class="btn-group tool-button">
|
||||
<el-date-picker :clearable="false"
|
||||
:picker-options="pickerOptions"
|
||||
@change="getAllHd"
|
||||
class="mr5" placeholder="选择年"
|
||||
type="year" v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-select filterable placeholder="请选择活动"
|
||||
@change="hdidChange" v-model="pageForm.hdid">
|
||||
<el-option :key="o._id" :label="o.name" :value="o._id"
|
||||
v-for="o in hdOptions"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-date-picker
|
||||
:picker-options="activityDatePickerOptions"
|
||||
end-placeholder="结束日期"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
type="daterange"
|
||||
@change="activityDateChange"
|
||||
value-format="yyyy-MM-dd"
|
||||
v-model="pageForm.activityDate">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-select @change="unionChange" clearable filterable
|
||||
placeholder="请选择所属工会" style="width: 350px" 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 class="btn-group tool-button">
|
||||
<el-select @change="doSearch" clearable filterable
|
||||
placeholder="请选择所属单位" style="width: 350px" 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 class="btn-group tool-button">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary"></el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card class="mt20" shadow="never">
|
||||
<table-tool :app="this" label="参与列表">
|
||||
<template #func>
|
||||
|
||||
|
||||
<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"
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop==='registerNum'">
|
||||
<el-link @click="openView(row.id)" type="primary">
|
||||
{{row.registerNum}}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{label: '姓名', prop: 'username'},
|
||||
{label: '工号', prop: 'loginname'},
|
||||
{label: '单位', prop: 'unitname'},
|
||||
{label: '分工会', prop: 'unionname', sortable: true},
|
||||
{label: '当前步数', prop: 'step', sortable: true},
|
||||
{label: '日期', prop: 'prizeData', sortable: true}
|
||||
],
|
||||
unionOptions: [],
|
||||
unitOptions: [],
|
||||
hdOptions: [],
|
||||
pageForm: {
|
||||
unionId: '',
|
||||
unitId: '',
|
||||
activityDate: [],
|
||||
year: new Date().getFullYear() + '',
|
||||
},
|
||||
pickerOptions: {
|
||||
disabledDate(time) {
|
||||
return (
|
||||
time.getFullYear() > new Date().getFullYear()
|
||||
);
|
||||
}
|
||||
},
|
||||
activityDatePickerOptions: {
|
||||
disabledDate: time => {
|
||||
/* return (
|
||||
time <= moment(this.pageForm.end_time).toDate() || time >= moment(this.pageForm.start_time).toDate()
|
||||
);*/
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
hdidChange(id) {
|
||||
const aa = clone(this.hdOptions)
|
||||
const bb = aa.find(v => v._id === id)
|
||||
this.$set(this.pageForm, "activityDate", [bb.start_time, bb.end_time])
|
||||
},
|
||||
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() {
|
||||
// this.$set(this.pageForm, "activityDate", [])
|
||||
},
|
||||
async unionChange(val) {
|
||||
this.pageForm.unitId = null
|
||||
this.unitOptions = await getUnits(val)
|
||||
this.doSearch()
|
||||
},
|
||||
async getAllHd() {
|
||||
this.pageForm.hdid = ''
|
||||
this.activityOptions = []
|
||||
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
|
||||
}
|
||||
data.map(v => {
|
||||
v.start_time = moment(v.start_time).format('YYYY-MM-DD')
|
||||
v.end_time = moment(v.end_time).format('YYYY-MM-DD')
|
||||
if (v.tag !== "") {
|
||||
v.name = (v.tag + "——" + v.name)
|
||||
}
|
||||
})
|
||||
|
||||
this.hdOptions = data
|
||||
if (this.hdOptions) {
|
||||
this.pageForm.hdid = this.hdOptions[0]._id
|
||||
this.pageForm.start_time = this.hdOptions[0].start_time
|
||||
this.pageForm.end_time = this.hdOptions[0].end_time
|
||||
this.$set(this.pageForm, "activityDate", [this.pageForm.start_time, this.pageForm.end_time])
|
||||
}
|
||||
},
|
||||
pageData() {
|
||||
sublime.showLoadingbar();
|
||||
this.tableLoading = true
|
||||
let pageForm = clone(this.pageForm)
|
||||
if (pageForm.activityDate && pageForm.activityDate.length > 0) {
|
||||
pageForm.activityDate = JSON.stringify(pageForm.activityDate)
|
||||
}
|
||||
$.post(loc() + "/pageData", pageForm, (data) => {
|
||||
sublime.closeLoadingbar();
|
||||
this.tableLoading = false
|
||||
if (data.code == 0) {
|
||||
this.tableData = data.data.list;
|
||||
this.pageForm.totalCount = data.data.totalCount;
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
}, "json");
|
||||
},
|
||||
|
||||
},
|
||||
async created() {
|
||||
this.unionOptions = await getUnions(null)
|
||||
this.unitOptions = await getUnits(null)
|
||||
await this.getAllHd()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user