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