Commit 1777cf5f by lichengming

修改了统计分析

parents 2b2771e5 42781453
......@@ -67,11 +67,6 @@ export default {
year: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('noBtn')
}
},
mounted() {
this.$refs.pageTable._hideLoading()
},
......
<template>
<div>
<form id="form-customer-table">
<input name="queryDateBegin" type="hidden"/>
<input name="queryDateEnd" type="hidden"/>
</form>
<PTVXETable id="customer-contract-table" ref="pageTable"
:tableHeight="tableHeight" @on-result-change="_tableResultChange" :getPage="getPage" hide-checkbox click-value>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<a v-if="item.detail" @click.stop="_detail(scope.row)">{{scope.row[item.key]}}</a>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
<!--详情-->
<Detail ref="detailModal"/>
</div>
</template>
<script>
import { meterContract } from '../../../api'
import Detail from './Detail'
export default {
components: { Detail },
data() {
return {
pageColumns: [
{
title: '客户名称',
key: 'client',
width: 120,
fixed: 'left'
},
{ title: '委托数量', key: 'total' },
{ title: '委托额度', key: 'price' },
{ title: '已收额度', key: 'collectPrice' },
{ title: '未收额度', key: 'noCollectPrice' }
],
formObj: {
client: undefined
},
getPage: {},
customer: '',
queryDateBegin: '',
queryDateEnd: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('noBtn')
}
},
methods: {
// 查看所有委托
_detail(data) {
this.$refs.detailModal._open({
cname: data.customer,
queryDateBegin: this.queryDateBegin,
queryDateEnd: this.queryDateEnd
})
},
_openTable(data) {
this.customer = data.customer
$('input[name=queryDateBegin]').val(data.queryDateBegin)
$('input[name=queryDateEnd]').val(data.queryDateEnd)
this.queryDateBegin = data.queryDateBegin
this.queryDateEnd = data.queryDateEnd
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await meterContract.page(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
// _page() {
// const data = {}
// if (this.customer) {
// data.customer = this.customer
// }
// this.$refs.pageTable._page(
// 'form-customer-table',
// 'StatisticContract/pageCustomerContract',
// data
// )
// },
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.StatisticContract.page
break
case 'singleSelect':
// 单击
this.$emit('on-result-change', data)
break
case 'dbSelect':
// 双击
this.customer = ''
break
case 'changeSize':
// this._page()
break
}
},
/** *********************************导出客户委托分析表-begin*********************************************/
_exportSampleForm() {
let result = []
this.$store
.dispatch(
'StatisticContract/pageCustomerContract',
this._searchParams()
)
.then(() => {
result = this.$store.state.StatisticContract.page.records
if (result.length === 0) {
this.$Message.warning('暂无数据,不可导出!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定导出全部数据(最多导出5000条)?',
onOk: () => {
this.$exportExcel(
'customer-contract-table',
'客户委托分析表',
this.pageColumns,
result
)
}
})
}
})
},
// 参数
_searchParams() {
const data = this.$serialize('form-customer-table')
if (this.customer) {
data.customer = this.customer
}
return this.$extend(data, { page: 1, rows: 5000 })
}
/** *********************************导出客户委托分析表-end*********************************************/
}
}
</script>
<template>
<div class="border-chart-color">
<div class="chartTitle">
<label>{{groupName}} 客户委托量比率</label>
</div>
<div :style="heightObj" class="chartCont">
<div v-if="showStatistic" style="width:90%">
<IEcharts :option="option" :style="optionObj"></IEcharts>
</div>
<div v-else :style="noDataObj" class="no-statistic-bg"></div>
</div>
<form id="persontal-task-pie">
<input name="groupId" type="hidden"/>
<input name="beginDate" type="hidden"/>
<input name="endDate" type="hidden"/>
<input name="groupName" type="hidden"/>
<input name="serviceType" type="hidden"/>
</form>
</div>
</template>
<script>
// import IEcharts from 'vue-echarts-v3/src/full'
export default {
// components: { IEcharts },
data() {
return {
// 科室名称
groupName: '',
showStatistic: true,
heightObj: {
height: '300px'
},
option: {
title: {
x: 'center',
textStyle: {
fontSize: 14,
fontWeight: 'normal'
}
},
tooltip: {
trigger: 'item',
formatter: function(a) {
return (
a.name +
'</br>样品量: ' +
a.data.value +
'<br>占比: ' +
a.percent +
'%'
)
}
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 0,
top: 20,
bottom: 20,
data: []
},
color: this.$echartColor,
series: [
{
name: '访问来源',
type: 'pie',
radius: ['50%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '30',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: []
}
]
},
optionObj: {
height: ''
},
noDataObj: {
marginTop: ''
}
}
},
mounted() {
this._contHide()
},
methods: {
_contHide() {
this.optionObj.height = document.documentElement.clientHeight - 300 + 'px'
this.heightObj.height = document.documentElement.clientHeight - 272 + 'px'
this.noDataObj.marginTop =
(document.documentElement.clientHeight - 450) / 2 + 'px'
this.optionObj.width =
(document.documentElement.clientWidth - 200) / 2.6 + 'px'
},
_openPie(data) {
const testerList = []
const seriesList = []
let total = 0
for (let i = 0; i < data.length; i++) {
testerList.push(data[i].client)
total = total + data[i].quantity
seriesList.push({
value: data[i].quantity,
name: data[i].client,
total: data[i].quantity
})
}
this.option.title.text = '委托单总量(个):' + total
this.option.legend.data = testerList
this.option.series[0].data = seriesList
console.log(this.option.series[0].data)
},
_searchParams() {
const data = this.$serialize('persontal-task-pie')
return this.$extend(data)
}
}
}
</script>
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