Commit defcd248 by wangweidong

统计查询修改

parent aabfa498
...@@ -203,5 +203,9 @@ export default { ...@@ -203,5 +203,9 @@ export default {
pagePersonalTaskStatistics: data => pagePersonalTaskStatistics: data =>
http http
.post('meter/v1/sample/page_personal_task_statistics', data) .post('meter/v1/sample/page_personal_task_statistics', data)
.then(res => res),
pageAnnualEntrustStatistics: data =>
http
.post('meter/v1/sample/page_annual_entrust_statistics', data)
.then(res => res) .then(res => res)
} }
...@@ -8,14 +8,14 @@ ...@@ -8,14 +8,14 @@
<div class="fl"> <div class="fl">
<Form id="search-form" :label-width="70" inline onsubmit="return false"> <Form id="search-form" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item label="签订日期:"> <Form-item label="委托日期:">
<DatePicker v-model="date" :editable="false" @on-change="_dateChange" :clearable="false" type="year" <DatePicker v-model="entrustDate" :editable="false" :clearable="false" type="year" style="width:90px"
style="width:90px"></DatePicker> @on-change="_dateChange"></DatePicker>
</Form-item> </Form-item>
</Form> </Form>
</div> </div>
<div class="fr"> <div class="fr">
<Button @click="_export" class="width-80">导出</Button> <Button class="width-80" @click="_export">导出</Button>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</Col> </Col>
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
</template> </template>
<script> <script>
import { meterSample } from '../../../api'
import YearContractTable from './YearContractTable' import YearContractTable from './YearContractTable'
import YearContractBar from './YearContractBar' import YearContractBar from './YearContractBar'
import YearContractPie from './YearContractPie' import YearContractPie from './YearContractPie'
...@@ -55,22 +56,28 @@ export default { ...@@ -55,22 +56,28 @@ export default {
}, },
data() { data() {
return { return {
date: new Date() entrustDate: new Date(),
formObj: {}
} }
}, },
mounted() { mounted() {
this._open() this._getData(this.entrustDate.getFullYear())
}, },
methods: { methods: {
_open() { _getData: async function(data) {
this.$refs.tableModal._openTable(this.date.getFullYear()) this.formObj.entrustDate = data
this.$refs.barModal._openBar(this.date.getFullYear()) const result = await meterSample.pageAnnualEntrustStatistics(this.formObj)
this.$refs.pieModal._openPie(this.date.getFullYear()) if (result) {
this._open(result)
}
},
_open(data) {
this.$refs.tableModal._openTable(this.entrustDate.getFullYear(), data)
this.$refs.barModal._openBar(this.entrustDate.getFullYear(), data)
this.$refs.pieModal._openPie(this.entrustDate.getFullYear(), data)
}, },
_dateChange(data) { _dateChange(data) {
this.$refs.tableModal._openTable(data) this._getData(data)
this.$refs.barModal._openBar(data)
this.$refs.pieModal._openPie(data)
}, },
_export() { _export() {
this.$refs.tableModal._exportSampleForm() this.$refs.tableModal._exportSampleForm()
......
...@@ -92,13 +92,13 @@ export default { ...@@ -92,13 +92,13 @@ export default {
{ {
name: '委托量', name: '委托量',
type: 'bar', type: 'bar',
data: [0, 100, 80, 90, 0, 200, 0, 0, 0, 0, 0, 0] data: []
}, },
{ {
name: '委托金额', name: '委托金额',
type: 'line', type: 'line',
yAxisIndex: 1, yAxisIndex: 1,
data: [0, 200, 150, 60, 0, 100, 0, 0, 0, 0, 0, 0] data: []
} }
] ]
}, },
...@@ -120,17 +120,22 @@ export default { ...@@ -120,17 +120,22 @@ export default {
this.heightObj.height = this.heightObj.height =
(document.documentElement.clientHeight - 272) * (2 / 3) + 'px' (document.documentElement.clientHeight - 272) * (2 / 3) + 'px'
}, },
_openBar(data) { _openBar(data, result) {
console.log('data', data) console.log('data', data)
this.year = data this.year = data
this.option.xAxis[0].data = [] this.option.xAxis[0].data = []
for (let i = 1; i < 13; i++) { if (result.length === 0) {
if (i < 10) { this.option.xAxis[0].data = []
this.option.xAxis[0].data.push(data + '-0' + i) this.option.series[0].data = []
} else { this.option.series[1].data = []
this.option.xAxis[0].data.push(data + '-' + i) } else {
for (let i = 0; i < result.length; i++) {
this.option.xAxis[0].data.push(result[i].entrustDate)
this.option.series[0].data.push(result[i].quantity)
this.option.series[1].data.push(result[i].fee)
} }
} }
// this.$store // this.$store
// .dispatch('StatisticContract/pageYearContract', { year: data }) // .dispatch('StatisticContract/pageYearContract', { year: data })
// .then(() => { // .then(() => {
......
...@@ -61,13 +61,7 @@ export default { ...@@ -61,13 +61,7 @@ export default {
type: 'pie', type: 'pie',
radius: ['30%', '65%'], radius: ['30%', '65%'],
center: ['40%', '50%'], center: ['40%', '50%'],
data: [ data: [],
{ value: 335, name: '直接访问' },
{ value: 310, name: '邮件营销' },
{ value: 234, name: '联盟广告' },
{ value: 135, name: '视频广告' },
{ value: 1548, name: '搜索引擎' }
],
label: { label: {
normal: { normal: {
show: false show: false
...@@ -102,36 +96,23 @@ export default { ...@@ -102,36 +96,23 @@ export default {
this.heightObj.height = this.heightObj.height =
(document.documentElement.clientHeight - 272) * (2 / 3) + 'px' (document.documentElement.clientHeight - 272) * (2 / 3) + 'px'
}, },
_openPie(data) { _openPie(data, result) {
this.showStatistic = true this.showStatistic = true
// this._page(data) this._page(data, result)
}, },
_page(data) { _page(data, result) {
this.year = data this.year = data
this.$store if (result.length === 0) {
.dispatch('StatisticContract/pageYearContract', { year: data }) this.option.series[0].data = []
.then(() => { } else {
const pie = this.$store.state.StatisticContract.page for (let i = 0; i < result.length; i++) {
let num = 0 const obj = {}
this.option.series[0].data = [] obj.name = result[i].entrustDate
this.option.legend.data = [] obj.value = result[i].quantity
obj.fee = result[i].fee
for (let i = 0; i < pie.length; i++) { this.option.series[0].data.push(obj)
this.option.series[0].data.push({ }
value: pie[i].price, }
name: pie[i].yearMonth,
items: pie[i].radio
})
this.option.legend.data.push(pie[i].yearMonth)
num += pie[i].price
}
this.option.title.text = data + '年委托总金额(元):' + num
if (pie.length === 0) {
this.showStatistic = false
} else {
this.showStatistic = true
}
})
}, },
_searchParams() { _searchParams() {
const data = this.$serialize('customer-contract-pie') const data = this.$serialize('customer-contract-pie')
......
...@@ -20,16 +20,16 @@ ...@@ -20,16 +20,16 @@
<!--</PTVXETable>--> <!--</PTVXETable>-->
<!--合计 暂时用此表格--> <!--合计 暂时用此表格-->
<ElTableNoPage id="table-year" ref="pageTable" :tableHeight="tableHeight" <ElTableNoPage id="table-year" ref="pageTable" :table-height="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" hide-checkbox show-summary="true"> :get-page="getPage" hide-checkbox show-summary="true" @on-result-change="_tableResultChange">
<el-table-column <el-table-column
v-for="item in pageColumns"
:key="item.key"
:prop="item.key" :prop="item.key"
:label="item.title" :label="item.title"
:width="item.width" :width="item.width"
:min-width="200" :min-width="200"
:fixed="item.fixed?item.fixed:undefined" :fixed="item.fixed?item.fixed:undefined" sortable>
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a></div> <div v-if="item.detail"><a @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a></div>
<span v-else>{{scope.row[item.key]}}</span> <span v-else>{{scope.row[item.key]}}</span>
...@@ -53,60 +53,31 @@ export default { ...@@ -53,60 +53,31 @@ export default {
pageColumns: [ pageColumns: [
{ {
title: '签订日期', title: '签订日期',
key: 'yearMonth', key: 'entrustDate',
width: 200, width: 200,
detail: true, detail: true,
month: true month: true
}, },
{ title: '委托数量', key: 'total' }, { title: '委托数量', key: 'quantity' },
{ title: '委托额度', key: 'price' }, { title: '委托额度', key: 'fee' }
{ title: '实收额度', key: 'collectPrice' },
{ title: '未收额度', key: 'noCollectPrice' }
], ],
getPage: { getPage: {
records: [ records: []
{
yearMonth: '2020-6',
price: '230',
total: '1',
collectPrice: '200',
noCollectPrice: '30'
},
{
yearMonth: '2020-7',
price: '260',
total: '2',
collectPrice: '230',
noCollectPrice: '30'
}
]
}, },
year: '' year: ''
} }
}, },
methods: { methods: {
_openTable(data) { _openTable(data, result) {
this.year = data this.year = data
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
// this._page() this._page(result)
}, },
_page() { _page(data) {
const data = {} this.getPage.records = data
if (this.year) {
data.year = this.year
}
this.$refs.pageTable._page(
'year-contract-table',
'StatisticContract/pageYearContract',
data
)
}, },
_tableResultChange(msg, data) { _tableResultChange(msg, data) {
switch (msg) { switch (msg) {
case 'page':
this.getPage.records = this.$store.state.StatisticContract.page
this.$refs.pageTable._hideLoading()
break
case 'changeSize': case 'changeSize':
// this._page() // this._page()
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment