Commit 5edd32dc by 李伟康

commit 盯防

1 parent e756cda9
......@@ -254,3 +254,13 @@ export function updateOneKpiMetric (data) {
data.method = 'dj.riskmanage.api.kpiMetric.updateOneKpiMetri'
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 @@
<script type='text/ecmascript-6'>
import SearchBox from '../SearchBox'
import * as echarts from 'echarts'
import { getMerchantOutputDetail, getBoardDetail } from '@api/earlyWarningManager'
import { getBoardDetail } from '@api/earlyWarningManager'
import dayjs from 'dayjs'
import { tooltipConfig, xAxisConfig, dataZoomSliderConfig } from '../chartConfig'
import { KPI_DATA } from '../kpiConfig.js'
export default {
components: {
SearchBox
......@@ -84,17 +84,18 @@ export default {
startDate,
dateType,
endDate,
code: 'A048'
code
})
this.drawChart(res)
},
drawChart (list) {
this.chart.clear()
let { pageData: { name } } = this,
let { pageData: { name, code } } = this,
_this = this,
{ allYear, dateType } = this.searchTime,
timeList = [],
data = []
data = [],
unit = KPI_DATA[code]?.valueUnit ? KPI_DATA[code].valueUnit : ''
list.map(e => {
let { startDate, endDate } = e,
axisLabel = dayjs(startDate).format("YYYY-MM-DD"),
......@@ -116,7 +117,7 @@ export default {
if (dateType == 1) title = axisValue
return `${title}<br>
<div class="tooltips">
<i class="circle"></i>${name}:${value?.toLocaleString() || 0}
<i class="circle"></i>${name}:${value?.toLocaleString() || 0}${unit}
</div>`;
}
},
......@@ -129,7 +130,20 @@ export default {
right: '60',
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: {
type: 'value',
boundaryGap: [0, '100%'],
......
<template>
<div class="data-list-box">
<div
class="data-list-box"
v-loading="loading"
>
<template v-if="boardList.length">
<div class="data-list">
......@@ -34,6 +37,7 @@
import onShowMixin from './onShowMixin'
import BoardItem from '../shopGuardIndex/BoardItem'
import { getBoardList } from '@api/earlyWarningManager'
import { KPI_DATA } from '../kpiConfig.js'
export default {
mixins: [onShowMixin],
......@@ -50,26 +54,33 @@ export default {
},
methods: {
async search () {
this.boardList = this.$options.data.call(this).boardList
let { businessType } = this.searchForm
const res = await getBoardList({
...this.searchForm,
scope: 1
})
res.map(e => {
this.boardList.push({
componentName: 'boardDetail',
pageId: `board-${e.code}`,
tabTitle: `${e.name}详情`,
definition: e.definition,
code: e.code,
name: e.name,
businessType,
data: e,
value: 'value',
percent: 'ratio'
try {
this.loading = true
this.boardList = this.$options.data.call(this).boardList
let { businessType } = this.searchForm
const res = await getBoardList({
...this.searchForm,
scope: 1
})
})
res.map(e => {
this.boardList.push({
componentName: 'boardDetail',
pageId: `board-${e.code}`,
tabTitle: `${e.name}详情`,
definition: e.definition,
code: e.code,
name: e.name,
businessType,
data: e,
value: 'value',
percent: 'ratio',
...KPI_DATA[e.code]
})
})
this.loading = false
} catch (error) {
this.loading = false
}
},
openWindow (e) {
console.log(e)
......
......@@ -63,12 +63,9 @@ export default {
businessScenarioList: [],
secondBrandIdList: [],
merchantRange: 1,
// merchantId: '',
merchantId: '',
},
// baseData: {
// storeIdList: [],
// },
showFormData: [
{
label: '归属业务',
......
......@@ -4,6 +4,7 @@
<el-button
size="small"
type="primary"
@click="handleExport"
>导出</el-button>
</div>
<d2-table
......@@ -13,13 +14,50 @@
:hasPage="false"
:has-num="false"
noDataText="暂无门店数据"
v-loading="loading"
@sortChange="sortChange"
>
<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-scope="scope"
>
<div class="sortableHtml">
{{scope.scope[scope.prop]}}
{{formatterValue(scope)}}
<div :class="['percent',`${percentColor(scope)}`]">
{{formattedPercent(scope)}}
</div>
</div>
</template>
<div
......@@ -37,8 +75,16 @@
<script type='text/ecmascript-6'>
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'
const RATIO_KEY = {
output: 'outputRatio',
orderNumber: 'orderNumberRatio',
customerUnitPrice: 'customerUnitPriceRatio',
penetrationRate: 'penetrationRateRatio',
touchConversionRate: 'touchConversionRateRatio',
}
export default {
mixins: [onShowMixin],
name: '',
......@@ -47,12 +93,8 @@ export default {
},
data () {
return {
tableTotal: 0,
page: {
pageSize: 10,
currentPage: 1
},
tableData: [],
originTableData: [],
// 表格参数
tableParams: {
tableOption: { width: '150px' },
......@@ -81,10 +123,9 @@ export default {
}
}, {
label: '督导',
width: 'supervisionList',
formatter (row) {
return "-"
}
minWidth: 150,
prop: 'supervisionNameList',
addHtml: 'popoverHtml'
}, {
label: '归属业务',
prop: 'businessType',
......@@ -98,10 +139,8 @@ export default {
}
}, {
label: '主营品牌',
prop: "brandList",
formatter (row) {
return
}
prop: "carBrandList",
addHtml: 'popoverHtml'
}, {
label: '业务性质',
prop: "businessScenario",
......@@ -119,7 +158,7 @@ export default {
width: '150',
prop: "output",
sortable: true,
addHtml: 'sortableHtml'
addHtml: 'sortableHtml',
}, {
label: '订单数',
width: '150',
......@@ -131,20 +170,20 @@ export default {
width: '130',
prop: "customerUnitPrice",
sortable: true,
addHtml: 'sortableHtml'
addHtml: 'sortableHtml',
}, {
label: '渗透率',
prop: "penetrationRate",
width: 130,
sortable: true,
addHtml: 'sortableHtml'
addHtml: 'sortableHtml',
},
{
label: '触客转化率',
prop: "touchConversionRate",
sortable: true,
width: 130,
addHtml: 'sortableHtml'
addHtml: 'sortableHtml',
}
]
},
......@@ -154,13 +193,35 @@ export default {
},
methods: {
async search () {
this.tableData = []
const res = await getBoardMerchantList({
...this.searchForm
})
console.log(res)
this.tableData = res
// this.tableTotal = total
try {
this.loading = true
this.tableData = []
this.originTableData = []
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
})
this.tableData = deepClone(res)
this.originTableData = deepClone(res)
this.loading = false
} catch (error) {
this.loading = false
}
},
handleDetail (e) {
this.$emit('openWindow', {
......@@ -172,9 +233,48 @@ export default {
merchantName: e.merchantName
})
},
pageChange (e) {
this.page = e
this.search()
handleExport () {
exportMerchantList(this.searchForm).then((res) => {
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 {
display: flex;
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>
\ No newline at end of file
......@@ -2,6 +2,7 @@ export default {
data () {
return {
initStatus: false,
loading:false
}
},
props: {
......
export const KpiList = {
'A014': {
}
export const KPI_DATA = {
"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
<template>
<div class="store-layout">
<div class="store-box">
<div class="board-box">
<template v-for="(item,index) in boardList">
<board-item
:key="index"
class="board-item"
:item="item"
:data="boardData"
@click="openWindow(item)"
/>
</template>
</div>
<div
class="store-box"
v-loading="loading"
>
<template v-if="boardList.length">
<div class="board-box">
<template v-for="(item,index) in boardList">
<board-item
:key="index"
class="board-item"
:item="item"
:data="item.data"
@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 v-else>
<div class="no-data">
暂无数据
</div>
</template>
</div>
<div class="store-chart">
......@@ -40,6 +57,7 @@ import Funnel from './Funnel'
import LineChart from './LineChart'
import { getMerchantBaseDetail, getBoardList } from '@/api/earlyWarningManager'
import onShowMixin from '../onShowMixin'
import { KPI_DATA } from '../../kpiConfig.js'
export default {
mixins: [onShowMixin],
components: {
......@@ -54,7 +72,7 @@ export default {
outputTrend: []
},
boardList: [],
loading: false
}
},
watch: {
......@@ -78,6 +96,7 @@ export default {
},
methods: {
async getData () {
this.getBoardList()
const { merchantId, businessType } = this.pageData,
{ searchTime } = this
const res = await getMerchantBaseDetail({
......@@ -89,33 +108,40 @@ export default {
if (res[key] == null) res[key] = '-'
})
this.boardData = res
this.getBoardList()
},
async getBoardList () {
this.boardList = this.$options.data.call(this).boardList
let { merchantId, merchantName, businessType } = this.pageData,
{ searchTime: { startDate, endDate } } = this
const res = await getBoardList({
businessType,
merchantId,
startDate,
endDate,
scope: 2
})
res.map(e => {
this.boardList.push({
componentName: 'boardDetail',
pageId: `board-${e.code}`,
tabTitle: `${e.name}(${merchantName})`,
definition: e.definition,
code: e.code,
name: e.name,
try {
this.loading = true
this.boardList = this.$options.data.call(this).boardList
let { merchantId, merchantName, businessType } = this.pageData,
{ searchTime: { startDate, endDate } } = this
const res = await getBoardList({
businessType,
data: e,
value: 'value',
percent: 'ratio'
merchantId,
startDate,
endDate,
scope: 2
})
})
res.map(e => {
this.boardList.push({
componentName: 'boardDetail',
pageId: `board-${merchantId}-${e.code}`,
tabTitle: `${e.name}(${merchantName})`,
definition: e.definition,
merchantId,
code: e.code,
name: e.name,
businessType,
data: e,
value: 'value',
percent: 'ratio',
...KPI_DATA[e.code]
})
})
this.loading = false
} catch (error) {
this.loading = false
}
},
openWindow (e) {
this.$emit('openWindow', e)
......@@ -132,10 +158,11 @@ export default {
border-radius: 0 0 4px 4px;
margin-bottom: 16px;
padding-top: 54px;
min-height: 200px;
.board-box {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 0 16px;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
padding: 0 20px 20px;
.board-item {
cursor: pointer;
......@@ -143,6 +170,32 @@ export default {
border-radius: 4px;
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 {
......
......@@ -166,7 +166,6 @@ export default {
const res = await getShopGuardIndexBoard(params)
Object.keys(res).map(key => {
if (res[key] != null) {
if (key == 'outputCompletionProgress' || key == 'grossProfitMargin') res[key] = res[key] + '%'
if (key == 'budget') res[key] = '¥' + res[key].toLocaleString()
} else res[key] = '-'
})
......
......@@ -3,12 +3,8 @@
class="item"
@click="$emit('click')"
>
<div class="name">{{item.name}}
<template v-if="item.unit">{{item.unit}}</template>
</div>
<div class="value">
{{formattedValue(data[item.value])}}
</div>
<div class="name">{{formattedName(item)}}</div>
<div class="value">{{formattedValue(data[item.value],item.valueUnit)}}</div>
<div :class="['percent',`${percentColor(data[item.percent])}`]">
环比<div class="percent-value">{{data[item.percent] != null ? formatted(data[item.percent]) : '-'}}</div>
<template v-if="data[item.percent] != null && data[item.percent] != '-'">
......@@ -68,10 +64,18 @@ export default {
return ''
}
},
formattedValue (num) {
if (num != null) num = num.toLocaleString()
formattedValue (num, unit) {
if (num != null) {
num = num.toLocaleString()
if (unit) num = `${num}%`
}
else 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!