master
parent
28830c291d
commit
dbaca2d03a
@ -1,26 +1,40 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export function getCounts() {
|
export function getCounts() {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/admin/get-counts',
|
url: '/api/admin/get-counts',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function getChartsData(params) {
|
export function getChartsData(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/admin/get-charts-data',
|
url: '/api/admin/get-charts-data',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: params
|
params: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getChartsHome(params) {
|
export function getChartsHome(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/admin/chart/home',
|
url: '/api/admin/chart/home',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: params
|
params: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getBusinessData(params) {
|
||||||
|
return request({
|
||||||
|
url: '/api/admin/chart/business_data',
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function getOrderData(params) {
|
||||||
|
return request({
|
||||||
|
url: '/api/admin/chart/order_data',
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -1,342 +1,346 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<div class="block" style="padding-top: 10px;display: flex;
|
<div class="block" style="padding-top: 10px;display: flex;
|
||||||
justify-content: flex-end;">
|
justify-content: flex-end;">
|
||||||
<el-button type="primary" round style="margin-right: 10px" @click="isShowDraw = true">超龄查看</el-button>
|
<el-button type="primary" round style="margin-right: 10px" @click="isShowDraw = true">超龄查看</el-button>
|
||||||
<el-date-picker v-model="month" type="month" placeholder="选择月" @change="loadData()">
|
<el-date-picker v-model="month" type="month" placeholder="选择月" @change="loadData()">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</div>
|
</div>
|
||||||
<div class="statistics">
|
<div class="statistics">
|
||||||
<panel-group :totaldata="list" />
|
<panel-group :totaldata="list" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="chart">
|
<div class="chart">
|
||||||
<div class="chartItem" style="margin-right: 1%;">
|
<div class="chartItem" style="margin-right: 1%;">
|
||||||
<div class="chartItemTitle">营业与收入</div>
|
<div class="chartItemTitle">营业与收入</div>
|
||||||
<div id="col-chart"></div>
|
<div id="col-chart"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chartItem" style="margin-left: 1%;">
|
<div class="chartItem" style="margin-left: 1%;">
|
||||||
<div class="chartItemTitle">客户与订单</div>
|
<div class="chartItemTitle">客户与订单</div>
|
||||||
<div id="line-chart"></div>
|
<div id="line-chart"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<draw :isShow.sync="isShowDraw"></draw>
|
<draw :isShow.sync="isShowDraw"></draw>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echarts from "echarts"
|
import echarts from "echarts"
|
||||||
import PanelGroup from './components/PanelGroup'
|
import PanelGroup from './components/PanelGroup'
|
||||||
import {
|
import {
|
||||||
getChartsHome
|
getChartsHome,getBusinessData,getOrderData
|
||||||
} from "../../api/dashboard.js"
|
} from "../../api/dashboard.js"
|
||||||
import draw from './components/draw.vue'
|
import draw from './components/draw.vue'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
PanelGroup,
|
PanelGroup,
|
||||||
draw
|
draw
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isShowDraw:false,
|
isShowDraw:false,
|
||||||
col: '',
|
col: '',
|
||||||
line: '',
|
line: '',
|
||||||
business_data: [],
|
business_data: [],
|
||||||
collect_data: [],
|
collect_data: [],
|
||||||
list: {
|
list: {
|
||||||
"business": {
|
"business": {
|
||||||
"server_money_total": 0,
|
"server_money_total": 0,
|
||||||
"nurse_money_total": 0,
|
"nurse_money_total": 0,
|
||||||
"remain_money_total": 0
|
"remain_money_total": 0
|
||||||
},
|
},
|
||||||
"person_efficiency": {
|
"person_efficiency": {
|
||||||
"server_time_total": "0",
|
"server_time_total": "0",
|
||||||
"expect": 0,
|
"expect": 0,
|
||||||
"act": 0
|
"act": 0
|
||||||
},
|
},
|
||||||
"customer": {
|
"customer": {
|
||||||
"active": 0,
|
"active": 0,
|
||||||
"add": 0,
|
"add": 0,
|
||||||
"wash": 0
|
"wash": 0
|
||||||
},
|
},
|
||||||
"order": {
|
"order": {
|
||||||
"server_total": 0,
|
"server_total": 0,
|
||||||
"cycle_total": 0,
|
"cycle_total": 0,
|
||||||
"unit_total": 0
|
"unit_total": 0
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
customerArr: [],
|
customerArr: [],
|
||||||
orderArr: [],
|
orderArr: [],
|
||||||
chartData: {},
|
chartData: {},
|
||||||
month: ''
|
month: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
chartData(val, newval) {
|
chartData(val, newval) {
|
||||||
if (newval) {
|
if (newval) {
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async loadData() {
|
async loadData() {
|
||||||
await getChartsHome({
|
|
||||||
month: this.month
|
await Promise.all([getChartsHome({
|
||||||
}).then((res) => {
|
month: this.month
|
||||||
console.log(res);
|
}),getOrderData({
|
||||||
this.list = res.list;
|
month: this.month
|
||||||
this.chartData = res;
|
}),getBusinessData({
|
||||||
let _business_data = [];
|
month: this.month
|
||||||
let _collect_data = [];
|
})]).then((res) => {
|
||||||
res.business_data.map(item => {
|
this.list = res[0].list;
|
||||||
_business_data.push(item.server_money_total)
|
this.chartData = res;
|
||||||
_collect_data.push(item.collect_money)
|
let _business_data = [];
|
||||||
})
|
let _collect_data = [];
|
||||||
this.business_data = _business_data;
|
res[2].business_data.map(item => {
|
||||||
this.collect_data = _collect_data;
|
_business_data.push(item.server_money_total)
|
||||||
let _customerArr = [];
|
_collect_data.push(item.collect_money)
|
||||||
let _orderArr = [];
|
})
|
||||||
|
this.business_data = _business_data;
|
||||||
res.order_data.map(item => {
|
this.collect_data = _collect_data;
|
||||||
_customerArr.push(item.active_customer)
|
let _customerArr = [];
|
||||||
_orderArr.push(item.order_total)
|
let _orderArr = [];
|
||||||
})
|
|
||||||
this.customerArr = _customerArr;
|
res[1].order_data.map(item => {
|
||||||
this.orderArr = _orderArr;
|
_customerArr.push(item.active_customer)
|
||||||
}).catch()
|
_orderArr.push(item.order_total)
|
||||||
},
|
})
|
||||||
init() {
|
this.customerArr = _customerArr;
|
||||||
this.col = echarts.init(document.getElementById('col-chart'))
|
this.orderArr = _orderArr;
|
||||||
this.col.setOption({
|
}).catch()
|
||||||
title: {
|
},
|
||||||
text: ''
|
init() {
|
||||||
},
|
this.col = echarts.init(document.getElementById('col-chart'))
|
||||||
tooltip: {
|
this.col.setOption({
|
||||||
trigger: 'axis',
|
title: {
|
||||||
axisPointer: {
|
text: ''
|
||||||
type: 'shadow'
|
},
|
||||||
},
|
tooltip: {
|
||||||
position: 'bottom'
|
trigger: 'axis',
|
||||||
},
|
axisPointer: {
|
||||||
legend: {},
|
type: 'shadow'
|
||||||
grid: {
|
},
|
||||||
left: '3%',
|
position: 'bottom'
|
||||||
right: '4%',
|
},
|
||||||
bottom: '3%',
|
legend: {},
|
||||||
containLabel: true
|
grid: {
|
||||||
},
|
left: '3%',
|
||||||
yAxis: {
|
right: '4%',
|
||||||
type: 'value',
|
bottom: '3%',
|
||||||
boundaryGap: [0, 0.01]
|
containLabel: true
|
||||||
},
|
},
|
||||||
xAxis: {
|
yAxis: {
|
||||||
type: 'category',
|
type: 'value',
|
||||||
data: ['第一周', '第二周', '第三周', '第四周']
|
boundaryGap: [0, 0.01]
|
||||||
},
|
},
|
||||||
series: [{
|
xAxis: {
|
||||||
name: '服务金额',
|
type: 'category',
|
||||||
type: 'bar',
|
data: ['第一周', '第二周', '第三周', '第四周']
|
||||||
data: this.business_data,
|
},
|
||||||
itemStyle: {
|
series: [{
|
||||||
normal: {
|
name: '服务金额',
|
||||||
color: 'rgb(42,182,252)'
|
type: 'bar',
|
||||||
},
|
data: this.business_data,
|
||||||
},
|
itemStyle: {
|
||||||
},
|
normal: {
|
||||||
{
|
color: 'rgb(42,182,252)'
|
||||||
name: '收款',
|
},
|
||||||
type: 'bar',
|
},
|
||||||
data: this.collect_data,
|
},
|
||||||
itemStyle: {
|
{
|
||||||
normal: {
|
name: '收款',
|
||||||
color: 'rgb(34,228,255)'
|
type: 'bar',
|
||||||
},
|
data: this.collect_data,
|
||||||
},
|
itemStyle: {
|
||||||
}
|
normal: {
|
||||||
]
|
color: 'rgb(34,228,255)'
|
||||||
})
|
},
|
||||||
|
},
|
||||||
this.line = echarts.init(document.getElementById('line-chart'))
|
}
|
||||||
this.line.setOption({
|
]
|
||||||
title: {
|
})
|
||||||
text: ''
|
|
||||||
},
|
this.line = echarts.init(document.getElementById('line-chart'))
|
||||||
tooltip: {
|
this.line.setOption({
|
||||||
trigger: 'axis'
|
title: {
|
||||||
},
|
text: ''
|
||||||
legend: {
|
},
|
||||||
data: ['活跃客户', '服务订单']
|
tooltip: {
|
||||||
},
|
trigger: 'axis'
|
||||||
grid: {
|
},
|
||||||
left: '3%',
|
legend: {
|
||||||
right: '6%',
|
data: ['活跃客户', '服务订单']
|
||||||
bottom: '3%',
|
},
|
||||||
containLabel: true
|
grid: {
|
||||||
},
|
left: '3%',
|
||||||
toolbox: {
|
right: '6%',
|
||||||
|
bottom: '3%',
|
||||||
},
|
containLabel: true
|
||||||
xAxis: {
|
},
|
||||||
type: 'category',
|
toolbox: {
|
||||||
boundaryGap: false,
|
|
||||||
data: ['第一周', '第二周', '第三周', '第四周']
|
},
|
||||||
},
|
xAxis: {
|
||||||
yAxis: {
|
type: 'category',
|
||||||
type: 'value',
|
boundaryGap: false,
|
||||||
},
|
data: ['第一周', '第二周', '第三周', '第四周']
|
||||||
series: [{
|
},
|
||||||
name: '活跃客户',
|
yAxis: {
|
||||||
type: 'line',
|
type: 'value',
|
||||||
stack: 'Total',
|
},
|
||||||
data: this.customerArr,
|
series: [{
|
||||||
itemStyle: {
|
name: '活跃客户',
|
||||||
normal: {
|
type: 'line',
|
||||||
color: 'rgb(42,182,252)'
|
stack: 'Total',
|
||||||
},
|
data: this.customerArr,
|
||||||
},
|
itemStyle: {
|
||||||
},
|
normal: {
|
||||||
{
|
color: 'rgb(42,182,252)'
|
||||||
name: '服务订单',
|
},
|
||||||
type: 'line',
|
},
|
||||||
stack: 'Total',
|
},
|
||||||
data: this.orderArr,
|
{
|
||||||
itemStyle: {
|
name: '服务订单',
|
||||||
normal: {
|
type: 'line',
|
||||||
color: 'rgb(34,228,255)'
|
stack: 'Total',
|
||||||
},
|
data: this.orderArr,
|
||||||
},
|
itemStyle: {
|
||||||
}
|
normal: {
|
||||||
]
|
color: 'rgb(34,228,255)'
|
||||||
})
|
},
|
||||||
}
|
},
|
||||||
},
|
}
|
||||||
created() {
|
]
|
||||||
this.month=this.$moment().format("YYYY-MM")
|
})
|
||||||
|
}
|
||||||
this.loadData();
|
},
|
||||||
},
|
created() {
|
||||||
mounted() {
|
this.month=this.$moment().format("YYYY-MM")
|
||||||
//setInterval(()=>{ this.isShowDraw = !this.isShowDraw},3000)
|
|
||||||
|
this.loadData();
|
||||||
//this.init()
|
},
|
||||||
|
mounted() {
|
||||||
window.onresize = () => {
|
//setInterval(()=>{ this.isShowDraw = !this.isShowDraw},3000)
|
||||||
this.col.resize()
|
|
||||||
this.line.resize()
|
//this.init()
|
||||||
}
|
|
||||||
|
window.onresize = () => {
|
||||||
},
|
this.col.resize()
|
||||||
destroyed() {
|
this.line.resize()
|
||||||
window.onresize = null
|
}
|
||||||
}
|
|
||||||
}
|
},
|
||||||
</script>
|
destroyed() {
|
||||||
|
window.onresize = null
|
||||||
<style lang="scss" scoped>
|
}
|
||||||
.statistics {
|
}
|
||||||
display: flex;
|
</script>
|
||||||
|
|
||||||
margin-top: 20px;
|
<style lang="scss" scoped>
|
||||||
|
.statistics {
|
||||||
&-title {
|
display: flex;
|
||||||
|
|
||||||
padding-left: 6px;
|
margin-top: 20px;
|
||||||
}
|
|
||||||
|
&-title {
|
||||||
&-content {
|
|
||||||
text-align: center;
|
padding-left: 6px;
|
||||||
font-size: 13px;
|
}
|
||||||
|
|
||||||
&-top {
|
&-content {
|
||||||
|
text-align: center;
|
||||||
&__num {
|
font-size: 13px;
|
||||||
font-weight: 600;
|
|
||||||
}
|
&-top {
|
||||||
|
|
||||||
&__name {
|
&__num {
|
||||||
font-size: 10px;
|
font-weight: 600;
|
||||||
color: rgb(140, 140, 140);
|
}
|
||||||
}
|
|
||||||
}
|
&__name {
|
||||||
|
font-size: 10px;
|
||||||
&-bottom {
|
color: rgb(140, 140, 140);
|
||||||
display: flex;
|
}
|
||||||
justify-content: space-between;
|
}
|
||||||
|
|
||||||
&-left {
|
&-bottom {
|
||||||
|
display: flex;
|
||||||
&__num {
|
justify-content: space-between;
|
||||||
font-weight: 600;
|
|
||||||
}
|
&-left {
|
||||||
|
|
||||||
&__name {
|
&__num {
|
||||||
font-size: 10px;
|
font-weight: 600;
|
||||||
color: rgb(140, 140, 140);
|
}
|
||||||
}
|
|
||||||
}
|
&__name {
|
||||||
|
font-size: 10px;
|
||||||
&-right {
|
color: rgb(140, 140, 140);
|
||||||
|
}
|
||||||
&__num {
|
}
|
||||||
font-weight: 600;
|
|
||||||
}
|
&-right {
|
||||||
|
|
||||||
&__name {
|
&__num {
|
||||||
font-size: 10px;
|
font-weight: 600;
|
||||||
color: rgb(140, 140, 140);
|
}
|
||||||
}
|
|
||||||
}
|
&__name {
|
||||||
}
|
font-size: 10px;
|
||||||
}
|
color: rgb(140, 140, 140);
|
||||||
|
}
|
||||||
&>div {
|
}
|
||||||
flex: 1;
|
}
|
||||||
margin-right: 20px;
|
}
|
||||||
|
|
||||||
&:last-child {
|
&>div {
|
||||||
margin-right: 0;
|
flex: 1;
|
||||||
}
|
margin-right: 20px;
|
||||||
}
|
|
||||||
}
|
&:last-child {
|
||||||
|
margin-right: 0;
|
||||||
.chart {
|
}
|
||||||
display: flex;
|
}
|
||||||
|
}
|
||||||
margin-top: 20px;
|
|
||||||
|
.chart {
|
||||||
|
display: flex;
|
||||||
.chartItem {
|
|
||||||
|
margin-top: 20px;
|
||||||
width: 49%;
|
|
||||||
|
|
||||||
.chartItemTitle {
|
.chartItem {
|
||||||
font-size: 16px;
|
|
||||||
margin-bottom: 20px;
|
width: 49%;
|
||||||
}
|
|
||||||
|
.chartItemTitle {
|
||||||
#col-chart {
|
font-size: 16px;
|
||||||
background: #fff;
|
margin-bottom: 20px;
|
||||||
border-radius: 10px;
|
}
|
||||||
flex: 1;
|
|
||||||
margin-right: 20px;
|
#col-chart {
|
||||||
padding: 20px;
|
background: #fff;
|
||||||
box-sizing: border-box;
|
border-radius: 10px;
|
||||||
min-height: 400px;
|
flex: 1;
|
||||||
width: 100%;
|
margin-right: 20px;
|
||||||
}
|
padding: 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
#line-chart {
|
min-height: 400px;
|
||||||
background: #fff;
|
width: 100%;
|
||||||
border-radius: 10px;
|
}
|
||||||
flex: 1;
|
|
||||||
padding: 20px;
|
#line-chart {
|
||||||
box-sizing: border-box;
|
background: #fff;
|
||||||
min-height: 400px;
|
border-radius: 10px;
|
||||||
}
|
flex: 1;
|
||||||
}
|
padding: 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-height: 400px;
|
||||||
}
|
}
|
||||||
</style>
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Loading…
Reference in new issue