99 lines
3.6 KiB
HTML
99 lines
3.6 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
|
|
<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-select placeholder="所属支部" v-model="retiredPartyBranchId" style="width: 100%;"
|
|
clearable="true"
|
|
filterable="true">
|
|
<el-option v-for="item in retiredPartyBranchOption" :label="item.partyBranchName"
|
|
:value="item.id" :key="item.id"></el-option>
|
|
</el-select>
|
|
</div>
|
|
</div>
|
|
<div class="search-query">
|
|
<el-button @click="getData" icon="el-icon-search" type="primary">搜索</el-button>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
|
|
<el-card shadow="never" class="mt10">
|
|
<el-table :data="statisticsData"
|
|
header-align="center"
|
|
align="center"
|
|
show-summary
|
|
:summary-method="summaryMethod"
|
|
border
|
|
highlight-current-row>
|
|
<el-table-column label="序号" type="index" width="70px"></el-table-column>
|
|
<el-table-column label="党支部名称" prop="partyBranchName"></el-table-column>
|
|
<el-table-column label="党支部代码" prop="partyBranchCode" sortable
|
|
:summary-method="()=>{}"></el-table-column>
|
|
<el-table-column label="党员人数" prop="userCount" sortable></el-table-column>
|
|
</el-table>
|
|
</el-card>
|
|
</guava>
|
|
</div>
|
|
<script>
|
|
var vue = new Vue({
|
|
el: '#app',
|
|
data() {
|
|
return {
|
|
retiredPartyBranchId: null,
|
|
retiredPartyBranchOption: [],
|
|
statisticsData: [],
|
|
}
|
|
},
|
|
methods: {
|
|
async getData() {
|
|
const resp = await $.post(loc() + '/data', {retiredPartyBranchId: this.retiredPartyBranchId})
|
|
if (resp.code === 0) {
|
|
this.statisticsData = resp.data
|
|
} else {
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
},
|
|
summaryMethod(param) {
|
|
const {columns, data} = param
|
|
let sums = []
|
|
|
|
columns.forEach((column, index) => {
|
|
if (index === 0) {
|
|
sums[index] = '合计';
|
|
return;
|
|
}
|
|
const values = data.map(item => Number(item[column.property]));
|
|
if (column.property === 'userCount') {
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
const value = Number(curr);
|
|
if (!isNaN(value)) {
|
|
return prev + curr;
|
|
} else {
|
|
return prev;
|
|
}
|
|
}, 0);
|
|
}
|
|
})
|
|
return sums
|
|
},
|
|
async getRetiredPartyBranch() {
|
|
const resp = await $.post(loc() + '/retiredPartyBranch')
|
|
this.retiredPartyBranchOption = resp.data
|
|
}
|
|
},
|
|
created() {
|
|
this.getData()
|
|
this.getRetiredPartyBranch()
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<!--#
|
|
}
|
|
#--> |