tech-dept-kpi.vue
3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<template>
<workbench-card title="科技部核心指标" :subtitle="deptName || '科技部当月'" icon="el-icon-cpu" tone="cyan" :loading="loading">
<template #extra>
<el-button type="text" size="mini" @click="goMore">更多</el-button>
</template>
<div v-if="techDepartmentId" class="wb-kpi-grid kpi-5">
<div class="wb-kpi-cell wb-kpi-cell--primary">
<div class="wb-kpi-cell__label">溯源金额</div>
<div class="wb-kpi-cell__value">¥{{ formatMoney(stats.TraceabilityAmount) }}</div>
</div>
<div class="wb-kpi-cell wb-kpi-cell--success">
<div class="wb-kpi-cell__label">Cell金额</div>
<div class="wb-kpi-cell__value">¥{{ formatMoney(stats.CellAmount) }}</div>
</div>
<div class="wb-kpi-cell wb-kpi-cell--danger">
<div class="wb-kpi-cell__label">Slim金额</div>
<div class="wb-kpi-cell__value">¥{{ formatMoney(stats.SlimAmount) }}</div>
</div>
<div class="wb-kpi-cell wb-kpi-cell--warning">
<div class="wb-kpi-cell__label">科美总收入</div>
<div class="wb-kpi-cell__value">¥{{ formatMoney(stats.TotalKemeiIncome) }}</div>
</div>
<div class="wb-kpi-cell wb-kpi-cell--info">
<div class="wb-kpi-cell__label">活跃门店</div>
<div class="wb-kpi-cell__value">{{ stats.ActiveStoreCount || 0 }}</div>
</div>
</div>
<div v-else class="wb-empty">
<div class="wb-empty__circle" style="background:#ecfeff;color:#06b6d4"><i class="el-icon-cpu" /></div>
<div class="wb-empty__title">暂无科技部</div>
<div class="wb-empty__desc">未获取到科技部组织,无法展示指标</div>
</div>
</workbench-card>
</template>
<script>
import request from '@/utils/request'
import WorkbenchCard from '../workbench-card.vue'
import { formatMoney, getCurrentMonthYm } from '../utils'
export default {
name: 'WidgetTechDeptKpi',
components: { WorkbenchCard },
data() {
return {
loading: false,
techDepartmentId: '',
deptName: '',
stats: {}
}
},
mounted() {
this.load()
},
methods: {
formatMoney,
async resolveDept() {
const res = await request({
url: '/api/Extend/Organize/GetByName',
method: 'get',
data: { organizeName: '科技部' }
})
const list = res.data || []
const first = list[0]
if (!first) return
this.techDepartmentId = first.Id || first.id || ''
this.deptName = first.FullName || first.fullName || '科技部'
},
async load() {
this.loading = true
try {
await this.resolveDept()
if (!this.techDepartmentId) return
const res = await request({
url: '/api/Extend/LqTechDepartmentDashboard/GetStatistics',
method: 'post',
data: {
statisticsMonth: getCurrentMonthYm(),
techDepartmentId: this.techDepartmentId,
storeIds: []
}
})
this.stats = res.data || {}
} catch (e) {
this.stats = {}
} finally {
this.loading = false
}
},
goMore() {
this.$router.push('/extend/techDepartmentDashboard').catch(() => {})
}
}
}
</script>
<style lang="scss" scoped>
@import '../widget-common.scss';
.kpi-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1200px) {
.kpi-5 { grid-template-columns: repeat(2, 1fr); }
}
</style>