|
|
|
@ -1,16 +1,7 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<el-row :gutter="40" class="panel-group"> |
|
|
|
<el-row :gutter="40" class="panel-group"> |
|
|
|
<el-col :xs="12" :sm="12" :lg="6" @click.native="jump('/system/user')"> |
|
|
|
<el-col v-for="i in list" :key="i.id" :xs="12" :sm="12" :lg="6"> |
|
|
|
<panel-group-item icon="user" :color="variables.info" :value="data.online" text="在线用户"/> |
|
|
|
<panel-group-item :ref="i.id" v-bind="i" @click.native="jump(i)"/> |
|
|
|
</el-col> |
|
|
|
|
|
|
|
<el-col :xs="12" :sm="12" :lg="6" @click.native="jump('/purchase/order')"> |
|
|
|
|
|
|
|
<panel-group-item icon="shopping" :color="variables.primary" :value="data.purchase" text="今日采购额"/> |
|
|
|
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
<el-col :xs="12" :sm="12" :lg="6" @click.native="jump('/sell/order')"> |
|
|
|
|
|
|
|
<panel-group-item icon="sell" :color="variables.danger" :value="data.sell" text="今日销售额"/> |
|
|
|
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
<el-col :xs="12" :sm="12" :lg="6"> |
|
|
|
|
|
|
|
<panel-group-item icon="money" :color="variables.success" :value="data.profit" text="今日毛利润"/> |
|
|
|
|
|
|
|
</el-col> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-row> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
@ -19,7 +10,7 @@ |
|
|
|
import PanelGroupItem from './PanelGroupItem' |
|
|
|
import PanelGroupItem from './PanelGroupItem' |
|
|
|
import variables from '@/assets/styles/variables.scss' |
|
|
|
import variables from '@/assets/styles/variables.scss' |
|
|
|
import {getFourBlock} from '@/api/statistic/index' |
|
|
|
import {getFourBlock} from '@/api/statistic/index' |
|
|
|
import {mergeObj} from "@/utils" |
|
|
|
import {isEmpty, mergeObj} from "@/utils" |
|
|
|
import {auth} from "@/utils/auth" |
|
|
|
import {auth} from "@/utils/auth" |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
@ -28,13 +19,19 @@ |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
loading: false, |
|
|
|
loading: false, |
|
|
|
variables, |
|
|
|
list: [ |
|
|
|
data: { |
|
|
|
{id: 'online', path: '/system/user', icon: 'user', color: variables.info, value: 0, text: '在线用户'}, |
|
|
|
online: 0, |
|
|
|
{ |
|
|
|
purchase: 0, |
|
|
|
id: 'purchase', |
|
|
|
sell: 0, |
|
|
|
path: '/purchase/order', |
|
|
|
profit: 0 |
|
|
|
icon: 'shopping', |
|
|
|
} |
|
|
|
color: variables.primary, |
|
|
|
|
|
|
|
value: 0, |
|
|
|
|
|
|
|
text: '今日采购额' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{id: 'sell', path: '/sell/order', icon: 'sell', color: variables.danger, value: 0, text: '今日销售额'}, |
|
|
|
|
|
|
|
{id: 'profit', icon: 'money', color: variables.info, value: 0, text: '今日毛利润'}, |
|
|
|
|
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
@ -42,11 +39,18 @@ |
|
|
|
if (this.loading) return |
|
|
|
if (this.loading) return |
|
|
|
this.loading = true |
|
|
|
this.loading = true |
|
|
|
getFourBlock() |
|
|
|
getFourBlock() |
|
|
|
.then(data => mergeObj(this.data, data)) |
|
|
|
.then(data => { |
|
|
|
|
|
|
|
this.list.forEach(i => { |
|
|
|
|
|
|
|
if (i.id in data) i.value = data[i.id] |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
.finally(() => this.loading = false) |
|
|
|
.finally(() => this.loading = false) |
|
|
|
}, |
|
|
|
}, |
|
|
|
jump(path) { |
|
|
|
jump({id, path}) { |
|
|
|
auth(path) && this.$router.push(path) |
|
|
|
if (!isEmpty(path) && auth(path)) { |
|
|
|
|
|
|
|
this.$router.push(path) |
|
|
|
|
|
|
|
this.$refs[id][0].mouseout() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
|