first commit
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
<div class="btn-group tool-button">
|
||||
<el-select placeholder="捐款项目" v-model="pageForm.contributionName"
|
||||
style="width: 100%;"
|
||||
@change="doSearch"
|
||||
filterable="true">
|
||||
<el-option v-for="item in contributionOption" :label="item.contributionName"
|
||||
:value="item.contributionName"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
|
||||
clearable="true"
|
||||
@change="doSearch"
|
||||
filterable="true">
|
||||
<el-option v-for="item in unions" :label="item.unionname"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
|
||||
<el-card shadow="never" class="mt20">
|
||||
<table-tool label="捐款列表" :app="this">
|
||||
|
||||
</table-tool>
|
||||
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
|
||||
show-summary :summary-method="getSummaries">
|
||||
<el-table-column align="center" header-align="center" label="序号" width="120px">
|
||||
<template scope="scope">
|
||||
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
header-align="center"
|
||||
v-for="column in tableColumns"
|
||||
show-overflow-tooltip
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
sortable
|
||||
>
|
||||
|
||||
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
contributionOption: [],
|
||||
unions: [],
|
||||
units: [],
|
||||
tableColumns: [
|
||||
{prop: 'unioncode', label: '工会编码'},
|
||||
{prop: 'unionname', label: '工会名称'},
|
||||
{prop: 'contributionUserNum', label: '捐款人数'},
|
||||
{prop: 'contributionNum', label: '捐款多少笔'},
|
||||
{prop: 'money', label: '捐款总额(元)'},
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
pageData() {
|
||||
sublime.showLoadingbar();
|
||||
this.tableLoading = true
|
||||
$.post(loc() + "/pageData", this.pageForm, (data) => {
|
||||
sublime.closeLoadingbar();
|
||||
this.tableLoading = false
|
||||
if (data.code == 0) {
|
||||
this.tableData = data.data;
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
getSummaries(param) {
|
||||
const {columns, data} = param;
|
||||
const sums = [];
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '总计';
|
||||
return;
|
||||
}
|
||||
if (![3, 4, 5].includes(index)) {
|
||||
sums[index] = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const values = data.map(item => Number(item[column.property]));
|
||||
if (!values.every(value => isNaN(value))) {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr);
|
||||
if (!isNaN(value)) {
|
||||
return Math.floor((prev + curr) * 100) / 100;
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
}, 0);
|
||||
if (index === 3) {
|
||||
sums[index] += ' 人';
|
||||
} else if (index === 4) {
|
||||
sums[index] += ' 笔';
|
||||
} else {
|
||||
sums[index] += ' 元';
|
||||
}
|
||||
|
||||
} else {
|
||||
sums[index] = null;
|
||||
}
|
||||
});
|
||||
|
||||
return sums;
|
||||
},
|
||||
async getContribution() {
|
||||
const data = await $.get("/platform/contribution/list/getContribution")
|
||||
return data
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.unions = await getUnions(null)
|
||||
this.contributionOption = await this.getContribution()
|
||||
if (this.contributionOption && this.contributionOption.length > 0) {
|
||||
this.pageForm.contributionName = this.contributionOption[0].contributionName
|
||||
}
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user