commit
This commit is contained in:
@@ -1,99 +0,0 @@
|
||||
<!--#
|
||||
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="retiredGroupId" style="width: 100%;"
|
||||
clearable="true"
|
||||
filterable="true">
|
||||
<el-option v-for="item in retiredGroupOption" :label="item.groupName" :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="groupName"></el-table-column>
|
||||
<el-table-column label="小组代码" prop="groupCode" sortable></el-table-column>
|
||||
<el-table-column label="组成单位" prop="componentUnit"></el-table-column>
|
||||
<el-table-column label="人数" prop="retireCount" sortable></el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</guava>
|
||||
</div>
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
retiredGroupId: null,
|
||||
statisticsData: [],
|
||||
retiredGroupOption: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getData() {
|
||||
const resp = await $.post(loc() + '/data', {retiredGroupId: this.retiredGroupId})
|
||||
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 === 'retireCount') {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr);
|
||||
if (!isNaN(value)) {
|
||||
return prev + curr;
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
})
|
||||
return sums
|
||||
},
|
||||
async getRetiredGroup() {
|
||||
const resp = await $.post(loc() + '/retiredGroup')
|
||||
this.retiredGroupOption = resp.data
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getData()
|
||||
this.getRetiredGroup()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user