first commit
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
.center-col {
|
||||
background-color: white;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding: 20px;
|
||||
width: calc((100% - (20px * 2)) / 2);
|
||||
}
|
||||
|
||||
.col-title {
|
||||
color: rgba(0, 0, 0, .45);
|
||||
font-size: 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<div class="btn-group tool-button">
|
||||
<el-date-picker
|
||||
v-model="year"
|
||||
type="year"
|
||||
value-format="yyyy"
|
||||
placeholder="选择年"
|
||||
style="width: 100%" @change="doSearch">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-radio-group @change="doSearch()" v-model="regionalNature">
|
||||
<el-radio-button label="省内">省内({{snNum}})人</el-radio-button>
|
||||
<el-radio-button label="省外">省外({{swNum}})人</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-card shadow="never" class="mr5 mt20">
|
||||
<div class="col-title">线路报名人数</div>
|
||||
<div id="lineBar"></div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-card shadow="never" class="ml5 mt20">
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
const chart = {
|
||||
lineBar: undefined
|
||||
}
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
snNum: 0,
|
||||
swNum: 0,
|
||||
year: moment().format('YYYY'),
|
||||
regionalNature: '省内'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async doSearch() {
|
||||
await this.getLineBar()
|
||||
await this.getSnSwNum()
|
||||
},
|
||||
async getLineBar() {
|
||||
let data = []
|
||||
const refs = await $.post(loc() + "/getLineBar", {regionalNature: this.regionalNature, year: this.year})
|
||||
refs.data.forEach(v => {
|
||||
data.push({lineName: v.lineName, lineNum: (v.enrollNum + v.companionNum)})
|
||||
})
|
||||
if (chart.lineBar) {
|
||||
chart.lineBar.changeData(data)
|
||||
return
|
||||
}
|
||||
setTimeout(() => {
|
||||
chart.lineBar = new G2Plot.Bar(document.getElementById("lineBar"), {
|
||||
data,
|
||||
xField: 'lineNum',
|
||||
yField: 'lineName',
|
||||
meta: {
|
||||
lineName: {
|
||||
alias: '线路名称',
|
||||
},
|
||||
lineNum: {
|
||||
alias: '报名人数',
|
||||
},
|
||||
},
|
||||
minBarWidth: 20,
|
||||
maxBarWidth: 20,
|
||||
});
|
||||
chart.lineBar.render();
|
||||
}, 300)
|
||||
},
|
||||
async getSnSwNum() {
|
||||
const {data} = await $.post(loc() + "/getSnSwNum", {year: this.year})
|
||||
this.snNum = data.snNum
|
||||
this.swNum = data.snNum
|
||||
}
|
||||
|
||||
},
|
||||
async created() {
|
||||
await this.getLineBar()
|
||||
await this.getSnSwNum()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user