|
@@ -6,24 +6,24 @@
|
|
<template v-else>
|
|
<template v-else>
|
|
<a-row :gutter="24">
|
|
<a-row :gutter="24">
|
|
<a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px', cursor: 'pointer' }" v-for="(item, index) in zhibiaoTotal" :key="index" @click="clickItemTotal(item, index)">
|
|
<a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px', cursor: 'pointer' }" v-for="(item, index) in zhibiaoTotal" :key="index" @click="clickItemTotal(item, index)">
|
|
- <chart-card :loading="loading" :title="item.title+'(元) / 当月'" :total="item.monthTotal+''">
|
|
|
|
|
|
+ <chart-card :loading="loading" :title="item.title+' (万元) / 当月'" :total="totalPrice(item.monthTotal)">
|
|
<a-tooltip :title="`点击查看${item.title}明细`" slot="action">
|
|
<a-tooltip :title="`点击查看${item.title}明细`" slot="action">
|
|
<a-icon type="info-circle-o" />
|
|
<a-icon type="info-circle-o" />
|
|
</a-tooltip>
|
|
</a-tooltip>
|
|
<div>
|
|
<div>
|
|
- <trend flag="up" style="margin-right: 16px;">
|
|
|
|
|
|
+ <trend :flag="setJiantou(item.monthTb)" style="margin-right: 16px;">
|
|
<span slot="term">月同比</span>
|
|
<span slot="term">月同比</span>
|
|
- {{(Number(item.monthTb)*100).toFixed(2)}}%
|
|
|
|
|
|
+ {{comTbHb(item.monthTb)}}%
|
|
</trend>
|
|
</trend>
|
|
- <trend flag="down">
|
|
|
|
|
|
+ <trend :flag="setJiantou(item.monthHb)">
|
|
<span slot="term">月环比</span>
|
|
<span slot="term">月环比</span>
|
|
- {{(Number(item.monthHb)*100).toFixed(2)}}%
|
|
|
|
|
|
+ {{comTbHb(item.monthHb)}}%
|
|
</trend>
|
|
</trend>
|
|
</div>
|
|
</div>
|
|
- <template slot="footer">年{{item.title}}<span> {{item.yearTotal}}0</span>
|
|
|
|
- <trend flag="up" style="float: right;">
|
|
|
|
|
|
+ <template slot="footer">年{{item.title}}<span> {{totalPriceYear(item.yearTotal)}}</span>
|
|
|
|
+ <trend :flag="setJiantou(item.yearTb)" style="float: right;">
|
|
<span slot="term">同比</span>
|
|
<span slot="term">同比</span>
|
|
- {{(Number(item.yearTb)*100).toFixed(2)}}%
|
|
|
|
|
|
+ {{comTbHb(item.yearTb)}}%
|
|
</trend>
|
|
</trend>
|
|
</template>
|
|
</template>
|
|
</chart-card>
|
|
</chart-card>
|
|
@@ -36,8 +36,8 @@
|
|
<a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
|
|
<a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
|
|
<div class="extra-wrapper" slot="tabBarExtraContent">
|
|
<div class="extra-wrapper" slot="tabBarExtraContent">
|
|
<div class="extra-item">
|
|
<div class="extra-item">
|
|
- <a-button :type=searchTypeMonth @click="searchTypeChange('month')">按月查询</a-button>
|
|
|
|
- <a-button :type="searchTypeYear" @click="searchTypeChange('year')">按年查询</a-button>
|
|
|
|
|
|
+ <a-button :type="searchType==='month'?'primary':'link'" @click="searchTypeChange('month')">按月查询</a-button>
|
|
|
|
+ <a-button :type="searchType==='year'?'primary':'link'" @click="searchTypeChange('year')">按年查询</a-button>
|
|
</div>
|
|
</div>
|
|
<!-- <a-range-picker :style="{width: '256px'}" /> -->
|
|
<!-- <a-range-picker :style="{width: '256px'}" /> -->
|
|
<a-range-picker
|
|
<a-range-picker
|
|
@@ -45,30 +45,42 @@
|
|
:format="searchFormat"
|
|
:format="searchFormat"
|
|
:mode="searchMode"
|
|
:mode="searchMode"
|
|
:value="dateValue"
|
|
:value="dateValue"
|
|
|
|
+ :open="datePickShow"
|
|
@panelChange="handlePanelChange"
|
|
@panelChange="handlePanelChange"
|
|
|
|
+ @openChange="datePickShow = !datePickShow"
|
|
>
|
|
>
|
|
<template slot="renderExtraFooter">
|
|
<template slot="renderExtraFooter">
|
|
- <div style="width: 100%;">
|
|
|
|
- <a-button type="primary" style="float: right;" @click="handleDateSure">确定</a-button>
|
|
|
|
|
|
+ <div style="width: 540px;">
|
|
|
|
+ <a-button type="primary" style="float: right;margin: 8px;" @click="handleDateSure">确定</a-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</a-range-picker>
|
|
</a-range-picker>
|
|
</div>
|
|
</div>
|
|
<a-tab-pane loading="true" :tab="chartTitle+'图表'" key="1">
|
|
<a-tab-pane loading="true" :tab="chartTitle+'图表'" key="1">
|
|
<a-row>
|
|
<a-row>
|
|
- <a-col :xl="16" :lg="16" :md="16" :sm="24" :xs="24">
|
|
|
|
- <!-- <bar title="销售额排行" :dataSource="barData"/> -->
|
|
|
|
- <twoYAxisChart v-if="chooseValue === 'hte'" :xAxisData="twoYAxisXAxisData" :seriesData="twoYAxisSeriesData" :title="chartTitle"
|
|
|
|
- style="height: 360px;"
|
|
|
|
- class="line-timePrice common-layout"></twoYAxisChart>
|
|
|
|
- <lineBarChart v-else :xAxisData="lineBarXAxisData" :seriesData="lineBarSeriesData" :title="chartTitle"
|
|
|
|
- style="height: 360px;"
|
|
|
|
- class="line-timePrice common-layout"></lineBarChart>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :xl="8" :lg="8" :md="8" :sm="24" :xs="24">
|
|
|
|
- <rank-list title="详情" :list="rankList"/>
|
|
|
|
- <!-- <pieContentChart style="height: 360px;"></pieContentChart> -->
|
|
|
|
- </a-col>
|
|
|
|
|
|
+ <template v-if="chooseValue !== 'chb'">
|
|
|
|
+ <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
|
|
|
|
+ <!-- <a-col :xl="chooseValue === 'chb'?16:24" :lg="chooseValue === 'chb'?16:24" :md="chooseValue === 'chb'?16:24" :sm="24" :xs="24"> -->
|
|
|
|
+ <!-- <bar title="销售额排行" :dataSource="barData"/> -->
|
|
|
|
+ <twoYAxisChart v-if="chooseValue === 'hte'" ref="twoYAxisChartRef" :twoYAxisData="twoYAxisData"
|
|
|
|
+ style="height: 360px;"
|
|
|
|
+ class="line-timePrice common-layout"></twoYAxisChart>
|
|
|
|
+ <lineBarChart v-else ref="lineBarChartRef" :xAxisData="lineBarXAxisData" :seriesData="lineBarSeriesData" :title="chartTitle"
|
|
|
|
+ style="height: 360px;"
|
|
|
|
+ class="line-timePrice common-layout"></lineBarChart>
|
|
|
|
+ </a-col>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-if="chooseValue === 'chb'">
|
|
|
|
+ <a-col :xl="16" :lg="16" :md="16" :sm="24" :xs="24">
|
|
|
|
+ <lineBarChartChb ref="lineBarChartChbRef" :xAxisData="chbXAxisData" :seriesData="chbSeriesData" :title="chartTitle"
|
|
|
|
+ style="height: 360px;"
|
|
|
|
+ class="line-timePrice common-layout"></lineBarChartChb>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :xl="8" :lg="8" :md="8" :sm="24" :xs="24">
|
|
|
|
+ <rank-list title="详情" :list="rankList"/>
|
|
|
|
+ <!-- <pieContentChart style="height: 360px;"></pieContentChart> -->
|
|
|
|
+ </a-col>
|
|
|
|
+ </template>
|
|
</a-row>
|
|
</a-row>
|
|
</a-tab-pane>
|
|
</a-tab-pane>
|
|
<!-- <a-tab-pane tab="销售趋势" key="2">
|
|
<!-- <a-tab-pane tab="销售趋势" key="2">
|
|
@@ -139,19 +151,23 @@
|
|
import Trend from '@/components/Trend'
|
|
import Trend from '@/components/Trend'
|
|
|
|
|
|
import lineBarChart from './components/lineBarChart.vue'
|
|
import lineBarChart from './components/lineBarChart.vue'
|
|
|
|
+ import lineBarChartChb from './components/lineBarChartChb.vue'
|
|
import rankingChart from './components/rankingChart.vue'
|
|
import rankingChart from './components/rankingChart.vue'
|
|
import pieContentChart from './components/pieContentChart.vue'
|
|
import pieContentChart from './components/pieContentChart.vue'
|
|
import twoYAxisChart from './components/twoYAxisChart.vue'
|
|
import twoYAxisChart from './components/twoYAxisChart.vue'
|
|
|
|
|
|
import { getLoginfo,getVisitInfo } from '@/api/api'
|
|
import { getLoginfo,getVisitInfo } from '@/api/api'
|
|
|
|
|
|
- const rankList = []
|
|
|
|
- for (let i = 0; i < 7; i++) {
|
|
|
|
- rankList.push({
|
|
|
|
- name: '费用 ' + (i+1) + '5%',
|
|
|
|
- total: 1234.56 - i * 100
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ const chb8Names = [
|
|
|
|
+ { name: '外协费', value: 'wxf' },
|
|
|
|
+ { name: '材料费', value: 'clf' },
|
|
|
|
+ { name: '专用费', value: 'zyf' },
|
|
|
|
+ { name: '事务费', value: 'swf' },
|
|
|
|
+ { name: '燃动费', value: 'rldlf' },
|
|
|
|
+ { name: '工资费', value: 'gzjlwf' },
|
|
|
|
+ { name: '固资费', value: 'gdzczj' },
|
|
|
|
+ { name: '管理费', value: 'glf' },
|
|
|
|
+ ]
|
|
export default {
|
|
export default {
|
|
name: "dashboard-Analysis",
|
|
name: "dashboard-Analysis",
|
|
components: {
|
|
components: {
|
|
@@ -160,6 +176,7 @@
|
|
RankList,
|
|
RankList,
|
|
|
|
|
|
lineBarChart,
|
|
lineBarChart,
|
|
|
|
+ lineBarChartChb,
|
|
rankingChart,
|
|
rankingChart,
|
|
pieContentChart,
|
|
pieContentChart,
|
|
twoYAxisChart,
|
|
twoYAxisChart,
|
|
@@ -167,7 +184,7 @@
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
loading: true,
|
|
loading: true,
|
|
- rankList,
|
|
|
|
|
|
+ rankList: [],
|
|
loginfo:{},
|
|
loginfo:{},
|
|
visitInfo:[],
|
|
visitInfo:[],
|
|
|
|
|
|
@@ -213,12 +230,12 @@
|
|
|
|
|
|
|
|
|
|
// 日期区间选择模块
|
|
// 日期区间选择模块
|
|
|
|
+ searchType: 'month',
|
|
searchPlaceholder: ['开始月份', '结束月份'],
|
|
searchPlaceholder: ['开始月份', '结束月份'],
|
|
- searchTypeMonth: 'primary', // 按月查询按钮
|
|
|
|
- searchTypeYear: 'link', // 按年查询按钮
|
|
|
|
searchFormat: 'YYYY-MM', // 日期区间选择器format(页面数据显示格式)
|
|
searchFormat: 'YYYY-MM', // 日期区间选择器format(页面数据显示格式)
|
|
dateValue: [null, null], // 日期区间选择器format(页面显示的数据)
|
|
dateValue: [null, null], // 日期区间选择器format(页面显示的数据)
|
|
searchMode: ['month', 'month'], // 日期区间选择器mode(选择器形式)
|
|
searchMode: ['month', 'month'], // 日期区间选择器mode(选择器形式)
|
|
|
|
+ datePickShow: false,
|
|
// 日期区间选择传参数据
|
|
// 日期区间选择传参数据
|
|
searchParams: {
|
|
searchParams: {
|
|
time: '',
|
|
time: '',
|
|
@@ -233,6 +250,8 @@
|
|
// 折线柱形总览图
|
|
// 折线柱形总览图
|
|
lineBarXAxisData: [],
|
|
lineBarXAxisData: [],
|
|
lineBarSeriesData: [],
|
|
lineBarSeriesData: [],
|
|
|
|
+ chbXAxisData: [],
|
|
|
|
+ chbSeriesData: [],
|
|
// 排行
|
|
// 排行
|
|
rankingSeriesData: [50, 42, 26, 20, 15, 14, 12, 8, 5, 1],
|
|
rankingSeriesData: [50, 42, 26, 20, 15, 14, 12, 8, 5, 1],
|
|
rankingYAxisNames: ["部门06", "部门01", "部门05", "部门10", "部门07", "部门04", "部门03", "部门08", "部门09", "部门02"],
|
|
rankingYAxisNames: ["部门06", "部门01", "部门05", "部门10", "部门07", "部门04", "部门03", "部门08", "部门09", "部门02"],
|
|
@@ -240,8 +259,7 @@
|
|
|
|
|
|
|
|
|
|
// 双y轴总览图
|
|
// 双y轴总览图
|
|
- twoYAxisXAxisData: [],
|
|
|
|
- twoYAxisSeriesData: [],
|
|
|
|
|
|
+ twoYAxisData: {},
|
|
// 排行
|
|
// 排行
|
|
|
|
|
|
|
|
|
|
@@ -297,10 +315,42 @@
|
|
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ computed: {
|
|
|
|
+ // 判断箭头样式
|
|
|
|
+ setJiantou(){
|
|
|
|
+ // 闭包实现computed中传参
|
|
|
|
+ return function (value) {
|
|
|
|
+ var item = Number(value) > 0 ? 'up' : 'down'
|
|
|
|
+ return item
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ totalPrice(){
|
|
|
|
+ return function (value) {
|
|
|
|
+ var item = (Number(value) / 10000).toFixed(2)
|
|
|
|
+ // console.log(item)
|
|
|
|
+ return '¥'+item
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ totalPriceYear(){
|
|
|
|
+ return function (value) {
|
|
|
|
+ var item = (Number(value) / 10000).toFixed(2)
|
|
|
|
+ console.log(item)
|
|
|
|
+ return item + ' 万元'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 将后端数据准换成整数%显示
|
|
|
|
+ comTbHb(){
|
|
|
|
+ return function (value) {
|
|
|
|
+ // console.log(Math.abs('-0.35'))
|
|
|
|
+ var item = (Math.abs(value) * 100).toFixed(0)
|
|
|
|
+ return item
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
created() {
|
|
created() {
|
|
this.initLogInfo();
|
|
this.initLogInfo();
|
|
this.getZhibiaoCollect()
|
|
this.getZhibiaoCollect()
|
|
- this.setNowDate('month')
|
|
|
|
|
|
+ this.setNowDate()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
getZhibiaoCollect(){
|
|
getZhibiaoCollect(){
|
|
@@ -334,16 +384,18 @@
|
|
const now = new Date()
|
|
const now = new Date()
|
|
const year = now.getFullYear(); // 年
|
|
const year = now.getFullYear(); // 年
|
|
const month = now.getMonth() + 1; // 月
|
|
const month = now.getMonth() + 1; // 月
|
|
|
|
+ const monthBetter = month > 10 ? month : '0' + month
|
|
const beginDate = `${year}-01`
|
|
const beginDate = `${year}-01`
|
|
- const endDate = `${year}-${month}`
|
|
|
|
|
|
+ const endDate = `${year}-${monthBetter}`
|
|
this.dateValue = [beginDate, endDate]
|
|
this.dateValue = [beginDate, endDate]
|
|
- if(type === 'month'){
|
|
|
|
|
|
+ var sType = this.searchType ? this.searchType : type
|
|
|
|
+ if(sType === 'month'){
|
|
this.searchParams = {
|
|
this.searchParams = {
|
|
time: 'month',
|
|
time: 'month',
|
|
beginDate: beginDate,
|
|
beginDate: beginDate,
|
|
endDate: endDate,
|
|
endDate: endDate,
|
|
}
|
|
}
|
|
- } else if (type === 'year') {
|
|
|
|
|
|
+ } else if (sType === 'year') {
|
|
this.searchParams = {
|
|
this.searchParams = {
|
|
time: 'year',
|
|
time: 'year',
|
|
beginDate: year - 1,
|
|
beginDate: year - 1,
|
|
@@ -354,11 +406,19 @@
|
|
},
|
|
},
|
|
// 点击指标转换下方数据
|
|
// 点击指标转换下方数据
|
|
clickItemTotal(item, index){
|
|
clickItemTotal(item, index){
|
|
- console.log(item, index)
|
|
|
|
|
|
+ // console.log(item, index)
|
|
this.chooseValue = item.value
|
|
this.chooseValue = item.value
|
|
this.chartTitle = item.value === 'hte' ? '合同' : item.title
|
|
this.chartTitle = item.value === 'hte' ? '合同' : item.title
|
|
|
|
+ // 调用showLoading方法--解决卡顿和数据闪等问题
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ // 定时器解决v-if下第一时间无法获取ref的问题
|
|
|
|
+ if(this.$refs.lineBarChartRef){this.$refs.lineBarChartRef.uEcharts.showLoading({text: '加载中...'});}
|
|
|
|
+ // 取消设置,因为一开始就很快
|
|
|
|
+ if(this.$refs.twoYAxisChartRef){this.$refs.twoYAxisChartRef.uEcharts.showLoading({text: '加载中...'});}
|
|
|
|
+ if(this.$refs.lineBarChartChbRef){this.$refs.lineBarChartChbRef.uEcharts.showLoading({text: '加载中...'});}
|
|
|
|
+ }, 1);
|
|
// this.lineBarSeriesData = item.lineBarSeriesData
|
|
// this.lineBarSeriesData = item.lineBarSeriesData
|
|
- console.log(this.dateValue)
|
|
|
|
|
|
+ // console.log(this.dateValue)
|
|
this.getDataByDate()
|
|
this.getDataByDate()
|
|
},
|
|
},
|
|
// 获取时间变化图表数据
|
|
// 获取时间变化图表数据
|
|
@@ -368,20 +428,7 @@
|
|
getdataByHt(this.searchParams).then(res => {
|
|
getdataByHt(this.searchParams).then(res => {
|
|
console.log(res)
|
|
console.log(res)
|
|
if (res.success) {
|
|
if (res.success) {
|
|
- this.twoYAxisXAxisData = res.result.xaxisData
|
|
|
|
- this.twoYAxisSeriesData = [
|
|
|
|
- {
|
|
|
|
- name: '合同数量',
|
|
|
|
- type: 'line',
|
|
|
|
- data: res.result.contractTotal,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '合同额',
|
|
|
|
- type: 'bar',
|
|
|
|
- barWidth: '30%',
|
|
|
|
- data: res.result.contractAmount,
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
|
|
+ this.twoYAxisData = res.result
|
|
}else{
|
|
}else{
|
|
this.$message.warning(res.message)
|
|
this.$message.warning(res.message)
|
|
}
|
|
}
|
|
@@ -407,15 +454,42 @@
|
|
// this.loading = false
|
|
// this.loading = false
|
|
})
|
|
})
|
|
break;
|
|
break;
|
|
|
|
+ case 'ske':
|
|
|
|
+ getdataBySk(this.searchParams).then(res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res.success) {
|
|
|
|
+ this.lineBarXAxisData = res.result.xaxisData
|
|
|
|
+ this.lineBarSeriesData = [
|
|
|
|
+ {
|
|
|
|
+ name: '收款额',
|
|
|
|
+ data: res.result.seriesData,
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ }else{
|
|
|
|
+ this.$message.warning(res.message)
|
|
|
|
+ }
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ // this.loading = false
|
|
|
|
+ })
|
|
|
|
+ break;
|
|
case 'chb':
|
|
case 'chb':
|
|
getdataByChb(this.searchParams).then(res => {
|
|
getdataByChb(this.searchParams).then(res => {
|
|
console.log(res)
|
|
console.log(res)
|
|
|
|
+ var chartsData = res.result[0].chartInfoList[0]
|
|
|
|
+ var chbRankingData = res.result[0].eightCostPaiHang
|
|
|
|
+ this.rankList = chbRankingData.map(res => {
|
|
|
|
+ var findItem = chb8Names.find(item => item.value === res.name)
|
|
|
|
+ return{
|
|
|
|
+ name: findItem.name + ' ' + res.proportion + '%',
|
|
|
|
+ total: res.value
|
|
|
|
+ }
|
|
|
|
+ })
|
|
if(res){
|
|
if(res){
|
|
- this.lineBarXAxisData = res[0].xaxisData
|
|
|
|
- this.lineBarSeriesData = [
|
|
|
|
|
|
+ this.chbXAxisData = chartsData.xaxisData
|
|
|
|
+ this.chbSeriesData = [
|
|
{
|
|
{
|
|
name: '成本额',
|
|
name: '成本额',
|
|
- data: res[0].seriesData,
|
|
|
|
|
|
+ data: chartsData.seriesData,
|
|
}
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|
|
@@ -430,8 +504,7 @@
|
|
// 查询类型选择:按年、按月
|
|
// 查询类型选择:按年、按月
|
|
searchTypeChange(type){
|
|
searchTypeChange(type){
|
|
// this.resetParams()
|
|
// this.resetParams()
|
|
- this.searchTypeMonth = type === 'month' ? 'primary' : 'link'
|
|
|
|
- this.searchTypeYear = type === 'year' ? 'primary' : 'link'
|
|
|
|
|
|
+ this.searchType = type
|
|
this.searchFormat = type === 'month' ? 'YYYY-MM' : 'YYYY'
|
|
this.searchFormat = type === 'month' ? 'YYYY-MM' : 'YYYY'
|
|
this.searchPlaceholder = type === 'month' ? ['开始月份', '结束月份'] : ['开始年份', '结束年份']
|
|
this.searchPlaceholder = type === 'month' ? ['开始月份', '结束月份'] : ['开始年份', '结束年份']
|
|
this.searchMode = [type, type]
|
|
this.searchMode = [type, type]
|
|
@@ -460,6 +533,7 @@
|
|
handleDateSure(){
|
|
handleDateSure(){
|
|
console.log(this.searchParams)
|
|
console.log(this.searchParams)
|
|
this.getDataByDate()
|
|
this.getDataByDate()
|
|
|
|
+ this.datePickShow = false
|
|
},
|
|
},
|
|
initLogInfo () {
|
|
initLogInfo () {
|
|
getLoginfo(null).then((res)=>{
|
|
getLoginfo(null).then((res)=>{
|