Commit 5edd32dc by 李伟康

commit 盯防

1 parent e756cda9
...@@ -254,3 +254,13 @@ export function updateOneKpiMetric (data) { ...@@ -254,3 +254,13 @@ export function updateOneKpiMetric (data) {
data.method = 'dj.riskmanage.api.kpiMetric.updateOneKpiMetri' data.method = 'dj.riskmanage.api.kpiMetric.updateOneKpiMetri'
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST)
} }
/**
*
* 店效盯防-更多看板-门店列表导出
*/
export function exportMerchantList (data) {
data.method = 'dj.api.smartcarlife.risk.manage.notice.board.merchant.list.export'
return request(data, RequestMethods.POST)
}
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import SearchBox from '../SearchBox' import SearchBox from '../SearchBox'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { getMerchantOutputDetail, getBoardDetail } from '@api/earlyWarningManager' import { getBoardDetail } from '@api/earlyWarningManager'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { tooltipConfig, xAxisConfig, dataZoomSliderConfig } from '../chartConfig' import { tooltipConfig, xAxisConfig, dataZoomSliderConfig } from '../chartConfig'
import { KPI_DATA } from '../kpiConfig.js'
export default { export default {
components: { components: {
SearchBox SearchBox
...@@ -84,17 +84,18 @@ export default { ...@@ -84,17 +84,18 @@ export default {
startDate, startDate,
dateType, dateType,
endDate, endDate,
code: 'A048' code
}) })
this.drawChart(res) this.drawChart(res)
}, },
drawChart (list) { drawChart (list) {
this.chart.clear() this.chart.clear()
let { pageData: { name } } = this, let { pageData: { name, code } } = this,
_this = this, _this = this,
{ allYear, dateType } = this.searchTime, { allYear, dateType } = this.searchTime,
timeList = [], timeList = [],
data = [] data = [],
unit = KPI_DATA[code]?.valueUnit ? KPI_DATA[code].valueUnit : ''
list.map(e => { list.map(e => {
let { startDate, endDate } = e, let { startDate, endDate } = e,
axisLabel = dayjs(startDate).format("YYYY-MM-DD"), axisLabel = dayjs(startDate).format("YYYY-MM-DD"),
...@@ -116,7 +117,7 @@ export default { ...@@ -116,7 +117,7 @@ export default {
if (dateType == 1) title = axisValue if (dateType == 1) title = axisValue
return `${title}<br> return `${title}<br>
<div class="tooltips"> <div class="tooltips">
<i class="circle"></i>${name}:${value?.toLocaleString() || 0} <i class="circle"></i>${name}:${value?.toLocaleString() || 0}${unit}
</div>`; </div>`;
} }
}, },
...@@ -129,7 +130,20 @@ export default { ...@@ -129,7 +130,20 @@ export default {
right: '60', right: '60',
bottom: '80' bottom: '80'
}, },
xAxis: xAxisConfig(_this), xAxis: {
...xAxisConfig(_this),
axisLabel: {
showMaxLabel: true,
formatter: function (value, index) {
let str = ''
str = allYear ? dayjs(value).format('YYYY年MM月') : dayjs(value).format('MM-DD')
if (dateType == 1) str = value
return str
}
}
},
yAxis: { yAxis: {
type: 'value', type: 'value',
boundaryGap: [0, '100%'], boundaryGap: [0, '100%'],
......
<template> <template>
<div class="data-list-box"> <div
class="data-list-box"
v-loading="loading"
>
<template v-if="boardList.length"> <template v-if="boardList.length">
<div class="data-list"> <div class="data-list">
...@@ -34,6 +37,7 @@ ...@@ -34,6 +37,7 @@
import onShowMixin from './onShowMixin' import onShowMixin from './onShowMixin'
import BoardItem from '../shopGuardIndex/BoardItem' import BoardItem from '../shopGuardIndex/BoardItem'
import { getBoardList } from '@api/earlyWarningManager' import { getBoardList } from '@api/earlyWarningManager'
import { KPI_DATA } from '../kpiConfig.js'
export default { export default {
mixins: [onShowMixin], mixins: [onShowMixin],
...@@ -50,6 +54,8 @@ export default { ...@@ -50,6 +54,8 @@ export default {
}, },
methods: { methods: {
async search () { async search () {
try {
this.loading = true
this.boardList = this.$options.data.call(this).boardList this.boardList = this.$options.data.call(this).boardList
let { businessType } = this.searchForm let { businessType } = this.searchForm
const res = await getBoardList({ const res = await getBoardList({
...@@ -67,9 +73,14 @@ export default { ...@@ -67,9 +73,14 @@ export default {
businessType, businessType,
data: e, data: e,
value: 'value', value: 'value',
percent: 'ratio' percent: 'ratio',
...KPI_DATA[e.code]
}) })
}) })
this.loading = false
} catch (error) {
this.loading = false
}
}, },
openWindow (e) { openWindow (e) {
console.log(e) console.log(e)
......
...@@ -63,12 +63,9 @@ export default { ...@@ -63,12 +63,9 @@ export default {
businessScenarioList: [], businessScenarioList: [],
secondBrandIdList: [], secondBrandIdList: [],
merchantRange: 1, merchantRange: 1,
// merchantId: '', merchantId: '',
}, },
// baseData: {
// storeIdList: [],
// },
showFormData: [ showFormData: [
{ {
label: '归属业务', label: '归属业务',
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<el-button <el-button
size="small" size="small"
type="primary" type="primary"
@click="handleExport"
>导出</el-button> >导出</el-button>
</div> </div>
<d2-table <d2-table
...@@ -13,13 +14,50 @@ ...@@ -13,13 +14,50 @@
:hasPage="false" :hasPage="false"
:has-num="false" :has-num="false"
noDataText="暂无门店数据" noDataText="暂无门店数据"
v-loading="loading"
@sortChange="sortChange"
> >
<template <template
slot="popoverHtml"
slot-scope="scope"
>
<template v-if="scope.scope[scope.prop] && scope.scope[scope.prop].length > 1">
<span>{{ scope.scope[scope.prop].slice(0, 1).join("") }}</span>
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div :class="{scrollHeight: scope.scope[scope.prop].length >= 10}">
<div
v-for="(item, index) in scope.scope[scope.prop]"
:key="index"
>
{{ item }}
</div>
</div>
<span
class="more-info"
slot="reference"
>...({{ scope.scope[scope.prop].length }})</span>
</el-popover>
</template>
<template v-else>
<span v-if="
!scope.scope[scope.prop] || !scope.scope[scope.prop].length
">-</span>
<span v-else>{{ scope.scope[scope.prop].join("") }}</span>
</template>
</template>
<template
slot="sortableHtml" slot="sortableHtml"
slot-scope="scope" slot-scope="scope"
> >
<div class="sortableHtml"> <div class="sortableHtml">
{{scope.scope[scope.prop]}} {{formatterValue(scope)}}
<div :class="['percent',`${percentColor(scope)}`]">
{{formattedPercent(scope)}}
</div>
</div> </div>
</template> </template>
<div <div
...@@ -37,8 +75,16 @@ ...@@ -37,8 +75,16 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import onShowMixin from './onShowMixin' import onShowMixin from './onShowMixin'
import { getBoardMerchantList } from '@api/earlyWarningManager' import { getBoardMerchantList, exportMerchantList } from '@api/earlyWarningManager'
import { deepClone, downLoadFile } from '@/common/util'
import dayjs from 'dayjs' import dayjs from 'dayjs'
const RATIO_KEY = {
output: 'outputRatio',
orderNumber: 'orderNumberRatio',
customerUnitPrice: 'customerUnitPriceRatio',
penetrationRate: 'penetrationRateRatio',
touchConversionRate: 'touchConversionRateRatio',
}
export default { export default {
mixins: [onShowMixin], mixins: [onShowMixin],
name: '', name: '',
...@@ -47,12 +93,8 @@ export default { ...@@ -47,12 +93,8 @@ export default {
}, },
data () { data () {
return { return {
tableTotal: 0,
page: {
pageSize: 10,
currentPage: 1
},
tableData: [], tableData: [],
originTableData: [],
// 表格参数 // 表格参数
tableParams: { tableParams: {
tableOption: { width: '150px' }, tableOption: { width: '150px' },
...@@ -81,10 +123,9 @@ export default { ...@@ -81,10 +123,9 @@ export default {
} }
}, { }, {
label: '督导', label: '督导',
width: 'supervisionList', minWidth: 150,
formatter (row) { prop: 'supervisionNameList',
return "-" addHtml: 'popoverHtml'
}
}, { }, {
label: '归属业务', label: '归属业务',
prop: 'businessType', prop: 'businessType',
...@@ -98,10 +139,8 @@ export default { ...@@ -98,10 +139,8 @@ export default {
} }
}, { }, {
label: '主营品牌', label: '主营品牌',
prop: "brandList", prop: "carBrandList",
formatter (row) { addHtml: 'popoverHtml'
return
}
}, { }, {
label: '业务性质', label: '业务性质',
prop: "businessScenario", prop: "businessScenario",
...@@ -119,7 +158,7 @@ export default { ...@@ -119,7 +158,7 @@ export default {
width: '150', width: '150',
prop: "output", prop: "output",
sortable: true, sortable: true,
addHtml: 'sortableHtml' addHtml: 'sortableHtml',
}, { }, {
label: '订单数', label: '订单数',
width: '150', width: '150',
...@@ -131,20 +170,20 @@ export default { ...@@ -131,20 +170,20 @@ export default {
width: '130', width: '130',
prop: "customerUnitPrice", prop: "customerUnitPrice",
sortable: true, sortable: true,
addHtml: 'sortableHtml' addHtml: 'sortableHtml',
}, { }, {
label: '渗透率', label: '渗透率',
prop: "penetrationRate", prop: "penetrationRate",
width: 130, width: 130,
sortable: true, sortable: true,
addHtml: 'sortableHtml' addHtml: 'sortableHtml',
}, },
{ {
label: '触客转化率', label: '触客转化率',
prop: "touchConversionRate", prop: "touchConversionRate",
sortable: true, sortable: true,
width: 130, width: 130,
addHtml: 'sortableHtml' addHtml: 'sortableHtml',
} }
] ]
}, },
...@@ -154,13 +193,35 @@ export default { ...@@ -154,13 +193,35 @@ export default {
}, },
methods: { methods: {
async search () { async search () {
try {
this.loading = true
this.tableData = [] this.tableData = []
const res = await getBoardMerchantList({ this.originTableData = []
...this.searchForm const res = await getBoardMerchantList(this.searchForm)
res.map(e => {
// e.output = Math.floor(Math.random() * 10001)
// e.orderNumber = Math.floor(Math.random() * 10001)
// e.customerUnitPrice = Math.floor(Math.random() * 10001)
// e.penetrationRate = Math.floor(Math.random() * 100)
// e.touchConversionRate = Math.floor(Math.random() * 100)
// e.outputRatio = Math.floor(Math.random() * 201) - 100
let carBrandList = [],
supervisionNameList = []
e.brandList?.map(i => {
carBrandList.push(i.name)
})
e.supervisionList?.map(i => {
supervisionNameList.push(i.supervisionName)
})
e.carBrandList = carBrandList
e.supervisionNameList = supervisionNameList
}) })
console.log(res) this.tableData = deepClone(res)
this.tableData = res this.originTableData = deepClone(res)
// this.tableTotal = total this.loading = false
} catch (error) {
this.loading = false
}
}, },
handleDetail (e) { handleDetail (e) {
this.$emit('openWindow', { this.$emit('openWindow', {
...@@ -172,9 +233,48 @@ export default { ...@@ -172,9 +233,48 @@ export default {
merchantName: e.merchantName merchantName: e.merchantName
}) })
}, },
pageChange (e) { handleExport () {
this.page = e exportMerchantList(this.searchForm).then((res) => {
this.search() res && downLoadFile(res)
})
},
sortChange (sortObj, sortColum, sort) {
if (sort) {
if (sort == 'ascending') this.tableData.sort((a, b) => {
return a[sortColum] - b[sortColum]
})
else this.tableData.sort((a, b) => {
return b[sortColum] - a[sortColum]
})
} else this.tableData = deepClone(this.originTableData)
},
formatterValue (e) {
const { scope, prop } = e
let str = scope[prop]
if (str != null) {
str = str.toLocaleString()
if (['output', 'customerUnitPrice'].includes(prop)) str = `¥${str}`
if (['penetrationRate', 'touchConversionRate'].includes(prop)) str = `${str}%`
} else str = '-'
return str
},
percentColor (e) {
const { scope, prop } = e,
key = RATIO_KEY[prop]
if (scope[key] > 0) {
return 'red'
} else if (scope[key] < 0) {
return 'green'
} else {
return ''
}
},
formattedPercent (e) {
const { scope, prop } = e,
key = RATIO_KEY[prop]
let str = ''
if (scope[key] != null) str = `环${scope[key]}%`
return str
} }
} }
} }
...@@ -187,5 +287,26 @@ export default { ...@@ -187,5 +287,26 @@ export default {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
} }
.sortableHtml {
color: #1d1d1d;
font-size: 14px;
font-weight: 500;
line-height: 20px;
.percent {
font-weight: 400;
color: #333333;
}
.red {
color: #eb4e4e;
}
.green {
color: #43cf7c;
}
}
.more-info {
white-space: nowrap;
color: #5850ff;
cursor: pointer;
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,7 @@ export default { ...@@ -2,6 +2,7 @@ export default {
data () { data () {
return { return {
initStatus: false, initStatus: false,
loading:false
} }
}, },
props: { props: {
......
export const KpiList = { export const KPI_DATA = {
'A014': { "A014": {unit: '(元)'},//产值
"A004": {},//触客数
} "A020": { unit: '(元)' },//客单价
"A010": {},//订单数
"A001": {},//交车数
"A046": {},//日均触客数
"A044": { unit: '(元)' },//店均产值
"A025": { valueUnit: '%' },//引流率
"A047": {},//日均交车数
"A023": { valueUnit: '%' },//触客转化率
"A021": { valueUnit: '%' },//触客转化率(售前)
"A022": { valueUnit: '%' },//触客转化率(售后)
"A026": { valueUnit: '%' },//溇透率
"A048": { unit: '(元)' },//日均产值
"A049": {},//新增门店数
"A050": {},//累计门店数
"A045": {},//展业门店数
"A051": {},//累计展业门店数
"A052": {},//新展业门店数
"A053": {},//疑似流失门店数
"A054": { valueUnit: '%' },//展业门店流失率
"A055": {},//疑似流失新门店数
"A056": { valueUnit: '%' }//新展业门店流失率
} }
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="store-layout"> <div class="store-layout">
<div class="store-box"> <div
class="store-box"
v-loading="loading"
>
<template v-if="boardList.length">
<div class="board-box"> <div class="board-box">
<template v-for="(item,index) in boardList"> <template v-for="(item,index) in boardList">
<board-item <board-item
:key="index" :key="index"
class="board-item" class="board-item"
:item="item" :item="item"
:data="boardData" :data="item.data"
@click="openWindow(item)" @click="openWindow(item)"
/> >
<div class="board-tips">
<el-tooltip placement="top">
<div slot="content">{{item.definition}}</div>
<div class="board-tips-icon">?</div>
</el-tooltip>
</div>
</board-item>
</template>
</div>
</template> </template>
<template v-else>
<div class="no-data">
暂无数据
</div> </div>
</template>
</div> </div>
<div class="store-chart"> <div class="store-chart">
...@@ -40,6 +57,7 @@ import Funnel from './Funnel' ...@@ -40,6 +57,7 @@ import Funnel from './Funnel'
import LineChart from './LineChart' import LineChart from './LineChart'
import { getMerchantBaseDetail, getBoardList } from '@/api/earlyWarningManager' import { getMerchantBaseDetail, getBoardList } from '@/api/earlyWarningManager'
import onShowMixin from '../onShowMixin' import onShowMixin from '../onShowMixin'
import { KPI_DATA } from '../../kpiConfig.js'
export default { export default {
mixins: [onShowMixin], mixins: [onShowMixin],
components: { components: {
...@@ -54,7 +72,7 @@ export default { ...@@ -54,7 +72,7 @@ export default {
outputTrend: [] outputTrend: []
}, },
boardList: [], boardList: [],
loading: false
} }
}, },
watch: { watch: {
...@@ -78,6 +96,7 @@ export default { ...@@ -78,6 +96,7 @@ export default {
}, },
methods: { methods: {
async getData () { async getData () {
this.getBoardList()
const { merchantId, businessType } = this.pageData, const { merchantId, businessType } = this.pageData,
{ searchTime } = this { searchTime } = this
const res = await getMerchantBaseDetail({ const res = await getMerchantBaseDetail({
...@@ -89,9 +108,10 @@ export default { ...@@ -89,9 +108,10 @@ export default {
if (res[key] == null) res[key] = '-' if (res[key] == null) res[key] = '-'
}) })
this.boardData = res this.boardData = res
this.getBoardList()
}, },
async getBoardList () { async getBoardList () {
try {
this.loading = true
this.boardList = this.$options.data.call(this).boardList this.boardList = this.$options.data.call(this).boardList
let { merchantId, merchantName, businessType } = this.pageData, let { merchantId, merchantName, businessType } = this.pageData,
{ searchTime: { startDate, endDate } } = this { searchTime: { startDate, endDate } } = this
...@@ -105,17 +125,23 @@ export default { ...@@ -105,17 +125,23 @@ export default {
res.map(e => { res.map(e => {
this.boardList.push({ this.boardList.push({
componentName: 'boardDetail', componentName: 'boardDetail',
pageId: `board-${e.code}`, pageId: `board-${merchantId}-${e.code}`,
tabTitle: `${e.name}(${merchantName})`, tabTitle: `${e.name}(${merchantName})`,
definition: e.definition, definition: e.definition,
merchantId,
code: e.code, code: e.code,
name: e.name, name: e.name,
businessType, businessType,
data: e, data: e,
value: 'value', value: 'value',
percent: 'ratio' percent: 'ratio',
...KPI_DATA[e.code]
}) })
}) })
this.loading = false
} catch (error) {
this.loading = false
}
}, },
openWindow (e) { openWindow (e) {
this.$emit('openWindow', e) this.$emit('openWindow', e)
...@@ -132,10 +158,11 @@ export default { ...@@ -132,10 +158,11 @@ export default {
border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;
margin-bottom: 16px; margin-bottom: 16px;
padding-top: 54px; padding-top: 54px;
min-height: 200px;
.board-box { .board-box {
display: grid; display: grid;
grid-template-columns: repeat(5, 1fr); grid-template-columns: repeat(4, 1fr);
gap: 0 16px; gap: 16px;
padding: 0 20px 20px; padding: 0 20px 20px;
.board-item { .board-item {
cursor: pointer; cursor: pointer;
...@@ -143,6 +170,32 @@ export default { ...@@ -143,6 +170,32 @@ export default {
border-radius: 4px; border-radius: 4px;
background: #f8faff; background: #f8faff;
} }
.board-tips {
position: absolute;
top: 20px;
right: 20px;
&-icon {
width: 14px;
height: 14px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #999;
color: #999;
border-radius: 100%;
font-size: 10px;
font-weight: 500;
}
}
}
.no-data {
background: white;
padding: 20px 0;
min-height: 60px;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
} }
} }
.store-chart { .store-chart {
......
...@@ -166,7 +166,6 @@ export default { ...@@ -166,7 +166,6 @@ export default {
const res = await getShopGuardIndexBoard(params) const res = await getShopGuardIndexBoard(params)
Object.keys(res).map(key => { Object.keys(res).map(key => {
if (res[key] != null) { if (res[key] != null) {
if (key == 'outputCompletionProgress' || key == 'grossProfitMargin') res[key] = res[key] + '%'
if (key == 'budget') res[key] = '¥' + res[key].toLocaleString() if (key == 'budget') res[key] = '¥' + res[key].toLocaleString()
} else res[key] = '-' } else res[key] = '-'
}) })
......
...@@ -3,12 +3,8 @@ ...@@ -3,12 +3,8 @@
class="item" class="item"
@click="$emit('click')" @click="$emit('click')"
> >
<div class="name">{{item.name}} <div class="name">{{formattedName(item)}}</div>
<template v-if="item.unit">{{item.unit}}</template> <div class="value">{{formattedValue(data[item.value],item.valueUnit)}}</div>
</div>
<div class="value">
{{formattedValue(data[item.value])}}
</div>
<div :class="['percent',`${percentColor(data[item.percent])}`]"> <div :class="['percent',`${percentColor(data[item.percent])}`]">
环比<div class="percent-value">{{data[item.percent] != null ? formatted(data[item.percent]) : '-'}}</div> 环比<div class="percent-value">{{data[item.percent] != null ? formatted(data[item.percent]) : '-'}}</div>
<template v-if="data[item.percent] != null && data[item.percent] != '-'"> <template v-if="data[item.percent] != null && data[item.percent] != '-'">
...@@ -68,10 +64,18 @@ export default { ...@@ -68,10 +64,18 @@ export default {
return '' return ''
} }
}, },
formattedValue (num) { formattedValue (num, unit) {
if (num != null) num = num.toLocaleString() if (num != null) {
num = num.toLocaleString()
if (unit) num = `${num}%`
}
else num = '-' else num = '-'
return num return num
},
formattedName (item) {
let name = item.name
if (item.unit) name = `${name}${item.unit}`
return name
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!