Commit f68d9041 by 李伟康

commit 店效盯防

1 parent b1b35f91
......@@ -50,3 +50,15 @@ export function merchantWarningMsgListWithPage(data) {
data.method = `${path}warningmsg.merchantWarningMsgListWithPage`
return request(data, RequestMethods.POST)
}
// 店效盯防首页
export function getShopGuardIndexBoard(data) {
data.method = 'dj.api.smartcarlife.risk.manage.home.page'
return request(data, RequestMethods.POST)
}
/** 店效盯防-风险榜 */
export function getMerchantPerformanceList(data) {
data.method = 'dj.api.smartcarlife.risk.manage.merchant.performance.page'
return request(data, RequestMethods.POST)
}
\ No newline at end of file
......@@ -124,7 +124,9 @@ fetch(
.then((response) => {
const { code, data } = response
// console.log("response", response)
// response.axios.baseURL = 'https://dj.test.glsx.com.cn/rop-dj-smartcarlife/router'
// response.axios.baseURL = 'http://192.168.1.104:8392/rop-dj-smartcarlife/router'
if (code == "200") {
console.log(data)
......
......@@ -43,19 +43,52 @@ export const routerName = {
],
component: _import("earlyWarningManager/staff/indexControl")
},
91502: {
path: "/storeWarn",
name: "storeWarn",
// 91502: {
// path: "/storeWarn",
// name: "storeWarn",
// meta: {
// title: "门店预警管理",
// authId: "91502",
// parentId: "915",
// cache: false
// },
// auth: [
// {
// authId: "9150201",
// parentId: "91502",
// label: "导出",
// category: "Button",
// type: "primary",
// handle: "handleExport"
// },
// {
// authId: "9150202",
// parentId: "91502",
// label: "查看",
// handle: "handleDetail"
// },
// {
// authId: "9150203",
// parentId: "91502",
// label: "处理",
// handle: "handleDeal"
// }
// ],
// component: _import("earlyWarningManager/store/indexControl")
// },
91503: {
path: "/shopGuard",
name: "shopGuard",
meta: {
title: "门店预警管理",
authId: "91502",
title: "店效盯防",
authId: "91503",
parentId: "915",
cache: false
},
auth: [
{
authId: "9150201",
parentId: "91502",
parentId: "91503",
label: "导出",
category: "Button",
type: "primary",
......@@ -63,17 +96,17 @@ export const routerName = {
},
{
authId: "9150202",
parentId: "91502",
parentId: "91503",
label: "查看",
handle: "handleDetail"
},
{
authId: "9150203",
parentId: "91502",
parentId: "91503",
label: "处理",
handle: "handleDeal"
}
],
component: _import("earlyWarningManager/store/indexControl")
}
component: _import("earlyWarningManager/shopGuard/indexControl")
},
}
<template>
<div class="search-box">
<el-form
inline
size="small"
label-width="97px"
>
<el-form-item
label="归属业务:"
v-if="!-hideSelect"
>
<el-select
class="select"
v-model="form.businessType"
@change="search('businessType')"
>
<el-option
v-for="item in bussinessTypeList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-radio-group
v-model="form.dateType"
@input="search('dateType')"
class="radio-group"
>
<el-radio-button
v-for="item in dateGroup"
:key="item.value"
:label="item.value"
>{{item.name}}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-date-picker
class="date-picker"
v-model="date"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="changeDate"
:picker-options="beforeRangePickerOptions"
>
</el-date-picker>
</el-form-item>
</el-form>
<div
class="data-config"
v-if="hasConfig"
>
<el-button size="small"><i class="el-icon-setting"></i>数据配置</el-button>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import dayjs from 'dayjs'
export default {
name: '',
props: {
hasConfig: {
type: Boolean,
default: true
},
hideToday: Boolean,
hideSelect: Boolean
},
data () {
return {
beforeRangePickerOptions: {
disabledDate: date => date > new Date()
},
form: {
businessType: 4,
dateType: 'date'
},
date: [],
bussinessTypeList: [
{ value: 2, name: '轻改' },
{ value: 3, name: '权益' },
{ value: 4, name: '延保' },
],
dateGroup: [
{ name: '今日', value: 'date' },
{ name: '本周', value: 'week' },
{ name: '本月', value: 'month' },
{ name: '全年', value: 'year' },
],
}
},
mounted () {
if (this.hideToday) {
this.dateGroup.splice(0, 1)
this.form.dateType = 'week'
}
this.initDate()
},
methods: {
initDate () {
this.dateGroup.map(e => {
let {
startDate,
endDate
} = this.getDateRange(e.value)
e.startDate = startDate
e.endDate = endDate
})
this.search()
},
getDateRange (type) {
let now = new Date();
let startDate, endDate;
if (type === 'week') {
let dayOfWeek = now.getDay();
if (dayOfWeek == 0) dayOfWeek = 7
startDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() - dayOfWeek + 1);
endDate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + (7 - dayOfWeek));
} else {
startDate = dayjs().startOf(type);
endDate = dayjs().endOf(type)
}
return {
startDate: this.formatDate(startDate, 'start'),
endDate: this.formatDate(endDate)
};
},
formatDate (date, type) {
return dayjs(date).format("YYYY-MM-DD")
// + (type == 'start' ? ' 00:00:00' : ' 23:59:59')
},
changeDate (e) {
let [startDate, endDate] = e,
{ form: {
businessType
} } = this
const date1 = dayjs(startDate),
date2 = dayjs(endDate),
day = date2.diff(date1, 'day') + 1
if (day > 93) return this.$message.error('自定义时间范围限制为93天')
this.form.dateType = ''
startDate = this.formatDate(startDate, 'start')
endDate = this.formatDate(endDate)
this.$emit('search', {
businessType,
startDate,
endDate
})
},
search (e) {
let { dateGroup, form: {
businessType,
dateType
} } = this,
params = {
businessType
}
if (this.hideSelect) delete params.businessType
if (e == 'dateType') this.date = []
if (dateType == 'year') {
params.allYear = true
} else {
let { startDate, endDate } = dateGroup.find(i => i.value == dateType)
params.startDate = startDate
params.endDate = endDate
}
this.$emit('search', params)
},
}
}
</script>
<style scoped lang='scss'>
.search-box {
padding: 15.25px 20px;
position: relative;
::v-deep.el-form-item__label {
width: fit-content;
}
.el-form-item--small.el-form-item {
margin-bottom: 0 !important;
}
.el-icon-setting {
margin-right: 4px;
}
.select {
width: 233px;
}
.radio-group {
transform: translateY(-2px);
}
.date-picker {
width: 255px;
}
.data-config {
position: absolute;
top: 50%;
right: 20px;
transform: translateY(-50%);
}
}
</style>
\ No newline at end of file
<template>
<div class="board-detail-box">
<search-box
@search="getBoardData"
:hasConfig="false"
hideToday
/>
<div class="board-content">
<div
class="line-chart"
:id="pageData.pageId"
></div>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import SearchBox from '../SearchBox'
import * as echarts from 'echarts'
export default {
components: {
SearchBox
},
name: '',
props: {
pageData: {
type: Object,
default: () => { }
}
},
data () {
return {
}
},
mounted () {
},
methods: {
async getBoardData (params) {
console.log(params)
this.chart = echarts.init(document.getElementById(this.pageData.pageId))
this.drawChart()
},
drawChart () {
let { pageData } = this
console.log(pageData)
let base = +new Date(2001, 0, 1);
let oneDay = 1000 * 3600 * 24;
let data = [[base, Math.random() * 300]];
for (let i = 1; i < 5000; i++) {
let now = new Date((base += oneDay));
data.push([+now, Math.round((Math.random() - 0.5) * 20 + data[i - 1][1])]);
}
let option = {
tooltip: {
trigger: 'axis',
position: function (pt) {
return [pt[0], '10%'];
}
},
title: {
left: '20',
text: `${pageData.name}趋势图`
},
grid: {
left: '5%',
right: '5%'
},
xAxis: {
type: 'time',
boundaryGap: false
},
yAxis: {
type: 'value',
boundaryGap: [0, '100%']
},
dataZoom: [
{
type: 'inside',
start: 0,
end: 20
},
{
start: 0,
end: 20
}
],
series: [
{
name: 'Fake Data',
type: 'line',
symbol: 'none',
data: data
}
]
};
option && this.chart.setOption(option)
}
}
}
</script>
<style scoped lang='scss'>
.board-detail-box {
margin: 0 20px;
background: #fff;
height: 100%;
border-radius: 0 4px 4px 4px;
.board-content {
box-sizing: border-box;
width: 100%;
height: calc(100% - 64px);
}
.line-chart {
width: 100%;
height: 393px;
}
}
</style>
\ No newline at end of file
<template>
<div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
</style>
\ No newline at end of file
<template>
<div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
</style>
\ No newline at end of file
<template>
<div class="funnel-box">
<div class="title">产值漏斗</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.funnel-box {
width: 100%;
height: 100%;
.title {
line-height: 48px;
height: 48px;
border-bottom: 1px solid #e5e5e5;
padding-left: 20px;
color: #101623;
font-size: 18px;
font-weight: 500;
}
}
</style>
\ No newline at end of file
<template>
<div class="line-box">
<div class="title">产值趋势</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.line-box {
width: 100%;
height: 100%;
.title {
line-height: 48px;
height: 48px;
border-bottom: 1px solid #e5e5e5;
padding-left: 20px;
color: #101623;
font-size: 18px;
font-weight: 500;
}
}
</style>
\ No newline at end of file
<template>
<div class="store-layout">
<div class="store-box">
<div class="search-component">
<search-box
@search="getBoardData"
hideSelect
:hasConfig="false"
/>
</div>
<div class="board-box">
<template v-for="(item,index) in boardList">
<board-item
:key="index"
class="board-item"
:item="item"
:data="boardData"
/>
</template>
</div>
</div>
<div class="store-chart">
<div class="funnel">
<funnel />
</div>
<div class="line">
<line-chart />
</div>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import SearchBox from '../../SearchBox'
import BoardItem from '../../shopGuardIndex/BoardItem'
import Funnel from './Funnel'
import LineChart from './LineChart'
export default {
components: {
SearchBox,
BoardItem,
Funnel,
LineChart
},
name: '',
data () {
return {
boardData: {},
boardList: [
{
name: '总产值',
value: 'output',
percent: 'outputRatio',
unit: '(元)'
},
{
name: '客单价',
value: 'customerUnitPrice',
percent: 'customerUnitPriceRatio',
unit: '(元)'
},
{
name: '交车数',
value: 'deliveryNum',
percent: 'deliveryNumRatio',
},
{
name: '触客数',
value: 'touchNum',
percent: 'touchNumRatio',
},
{
name: '转化数',
value: 'touchNum',
percent: 'touchNumRatio',
},
]
}
},
mounted () {
},
methods: {
getBoardData (params) {
console.log(params)
}
}
}
</script>
<style scoped lang='scss'>
.store-layout {
.store-box {
background: #fff;
border-radius: 0 0 4px 4px;
margin-bottom: 16px;
.search-component {
position: relative;
left: 10px;
display: flex;
justify-content: flex-end;
// transform: translateX(10px);
}
.board-box {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 0 16px;
padding: 0 20px 20px;
.board-item {
height: 163px;
border-radius: 4px;
background: #f8faff;
}
}
}
.store-chart {
display: flex;
gap: 0 16px;
.funnel,
.line {
flex: 1;
height: 429px;
border-radius: 4px;
background: #ffffff;
}
}
}
</style>
\ No newline at end of file
<template>
<div class="shop-detail-box">
<div class="shop-info">
<div class="icon"></div>
<div class="info">
<div class="merchant-name flex">
恒河猴
<div class="tag">自营</div>
</div>
<div class="text flex">
<div class="merchant-id">4456</div>
<div class="year">2024.5展业</div>
<div class="supervision-name">
<div class="supervision-icon"></div>
嚯嚯嚯
</div>
</div>
</div>
</div>
<div class="tab">
<el-tabs v-model="activeName">
<el-tab-pane
v-for="item in tabList"
:key="item.id"
:label="item.label"
:name="item.id"
/>
</el-tabs>
</div>
<div class="component">
<template v-for="i in tabList">
<component
:ref="i.name"
:key="i.id"
:is="i.componentName"
v-show="activeName == i.id"
:show="activeName == i.id"
@openWindow="$emit('openWindow',$event)"
:pageId="i.id"
/>
</template>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import Store from './Store/index'
import Human from './Human/index'
import Product from './Product/index'
export default {
components: { Store, Human, Product },
name: '',
data () {
return {
activeName: '1',
tabList: [
{
label: '店效指标',
componentName: 'Store',
id: '1'
},
{
label: '人效指标',
componentName: 'Human',
id: '2'
},
{
label: '品效指标',
componentName: 'Product',
id: '3'
}
]
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.shop-detail-box {
height: 100%;
overflow-y: auto;
.flex {
display: flex;
align-items: center;
}
padding: 0 20px;
.shop-info {
height: 121px;
background-color: #fff;
display: flex;
box-sizing: border-box;
padding: 16px 20px;
.icon {
width: 48px;
height: 48px;
border-radius: 4px;
overflow: hidden;
margin-right: 16px;
background-color: #096;
}
.info {
.merchant-name {
color: #1d2129;
font-size: 16px;
line-height: 24px;
font-weight: 500;
.tag {
font-weight: 400;
line-height: 20px;
height: 20px;
border-radius: 2px;
opacity: 1;
background: #e8ffea;
padding: 0 8px;
color: #00b42a;
font-size: 12px;
margin-left: 16px;
}
}
.text {
color: #888888;
font-size: 14px;
line-height: 22px;
.merchant-id {
line-height: 20px;
height: 20px;
border-radius: 2px;
opacity: 1;
background: #e8f3ff;
padding: 0 8px;
color: #185efe;
font-size: 12px;
margin-right: 16px;
}
.year {
margin-right: 16px;
}
.supervision-icon {
margin-right: 4px;
}
}
}
}
.tab {
background-color: #fff;
::v-deep .el-tabs__nav-wrap {
padding: 0 20px;
}
::v-deep .el-tabs__item {
height: 54px;
line-height: 54px;
}
::v-deep.el-tabs__nav-wrap::after {
height: 1px;
background: #e5e5e5;
}
}
}
</style>
\ No newline at end of file
<template>
<div class="board-box">
<search-box @search="getBoardData" />
<div class="board-content">
<div class="left-board flex-box">
<template v-for="(item,index) in currentBoardList">
<board-item
:key="index"
class="board-item"
:item="item"
:data="boardData"
/>
</template>
</div>
<div class="right-board flex-box">
<template v-for="(item,index) in boardList">
<board-item
:key="index"
class="board-item"
:item="item"
:data="boardData"
@click="$emit('openWindow',item)"
/>
</template>
</div>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import SearchBox from '../SearchBox'
import BoardItem from './BoardItem'
import { getShopGuardIndexBoard } from '@api/earlyWarningManager'
export default {
name: '',
components: {
SearchBox,
BoardItem
},
data () {
return {
boardData: {},
currentBoardList: [
{
name: '当前产值完成度',
value: 'outputCompletionProgress',
valueUnit: '%',
percent: 'outputCompletionProgressRatio',
tips: '预算',
tipsValue: 'budget'
},
{
name: '当月毛利情况',
value: 'profitSituation',
percent: 'profitSituationRatio',
tips: '毛利率',
tipsValue: 'grossProfitMargin'
}
],
boardList: [
{
name: '产值',
value: 'output',
percent: 'outputRatio',
unit: '(元)'
},
{
name: '展业门店数',
value: 'storeNum',
percent: 'storeNumRatio',
},
{
name: '客单价',
value: 'customerUnitPrice',
percent: 'customerUnitPriceRatio',
unit: '(元)'
},
{
name: '店均产值',
value: 'storeAverageOutput',
percent: 'storeAverageOutputRatio',
unit: '(元)'
},
{
name: '交车数',
value: 'deliveryNum',
percent: 'deliveryNumRatio',
},
{
name: '触客数',
value: 'touchNum',
percent: 'touchNumRatio',
},
]
}
},
mounted () {
this.boardList.map((e, index) => {
e.componentName = 'boardDetail'
e.pageId = `board-${index}`
e.tabTitle = `${e.name}详情`
})
},
methods: {
async getBoardData (params) {
const res = await getShopGuardIndexBoard(params)
Object.keys(res).map(key => {
if (res[key]) {
if (key == 'outputCompletionProgress' || key == 'grossProfitMargin') res[key] = res[key] + '%'
else res[key] = res[key].toLocaleString()
if (key == 'budget') res[key] = '¥' + res[key]
}
res[key] = res[key]
})
this.boardData = res
},
}
}
</script>
<style scoped lang='scss'>
.board-box {
background: #fff;
border-radius: 0 4px 4px 4px;
.board-content {
padding: 0 20px 20px;
display: flex;
.flex-box {
display: flex;
gap: 16px;
}
.board-item {
width: 100%;
height: 139px;
border-radius: 4px;
background: #f8faff;
}
.left-board {
flex-direction: column;
padding-right: 16px;
border-right: 1px solid #e8e8ea;
flex: 1;
}
.right-board {
flex: 3;
flex-wrap: wrap;
padding-left: 16px;
display: grid;
grid-template-columns: repeat(3, 1fr);
.board-item {
cursor: pointer;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div
class="item"
@click="$emit('click')"
>
<div class="name">{{item.name}}
<template v-if="item.unit">{{item.unit}}</template>
</div>
<div class="value">
{{data[item.value] || '--'}}
</div>
<div :class="['percent',`${percentColor(data[item.percent])}`]">
环比<div class="percent-value">{{formatted(data[item.percent])}}</div>
<template v-if="data[item.percent]">
<div :class="['icon',`${percentClass(data[item.percent])}`]"></div>
</template>
</div>
<template v-if="item.tips">
<div class="tips">
{{item.tips}}
<div class="tips-value">{{data[item.tipsValue] || '--'}}</div>
</div>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
props: {
item: {
type: Object,
default: () => { }
},
data: {
type: Object,
default: () => { }
}
},
data () {
return {
}
},
mounted () {
},
methods: {
formatted (num) {
return num ? Math.abs(num) + '%' : '--'
},
percentClass (num) {
if (num > 0) {
return 'el-icon-caret-top'
} else if (num < 0) {
return 'el-icon-caret-bottom'
} else {
return ''
}
},
percentColor (num) {
if (num > 0) {
return 'red'
} else if (num < 0) {
return 'green'
} else {
return ''
}
}
}
}
</script>
<style scoped lang='scss'>
.item {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 20px;
position: relative;
.tips {
position: absolute;
right: 20px;
bottom: 20px;
color: #888888;
font-size: 12px;
display: flex;
align-items: center;
&-value {
color: #333333;
font-size: 14px;
margin-left: 6px;
}
}
.name {
color: #333333;
font-size: 14px;
line-height: 20px;
display: flex;
align-items: center;
}
.value {
color: #1d1d1d;
font-size: 32px;
font-weight: 500;
line-height: 45px;
margin: 12px 0 2px;
}
.percent {
display: flex;
align-items: center;
color: #888888;
font-size: 12px;
&-value {
font-size: 14px;
margin-left: 6px;
line-height: 20px;
}
.icon {
margin-left: 6px;
}
}
.red {
.percent-value,
.icon {
color: #eb4e4e;
}
}
.green {
.percent-value,
.icon {
color: #43cf7c;
}
}
}
</style>
\ No newline at end of file
<template>
<div
class="filter-item"
@click="sortChange"
>
{{ item.label }}
<div class="filter-icons">
<div :class="['icon el-icon-caret-top',{active:sortNum == 1}]"></div>
<div :class="['icon el-icon-caret-bottom',{active:sortNum == 2}]"></div>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
props: {
item: {
type: Object,
default: () => {
return {}
}
}
},
name: '',
data () {
return {
sortNum: -1
}
},
mounted () {
},
methods: {
clear(){
this.sortNum = -1
},
sortChange () {
this.sortNum = {
'-1': '1',
'1': '2',
'2': '-1'
}[this.sortNum]
this.$emit('sortChange', this.sortNum)
},
}
}
</script>
<style scoped lang='scss'>
.filter-item {
width: fit-content;
height: 32px;
border-radius: 2px;
opacity: 1;
background: #f2f3f5;
min-width: 110px;
box-sizing: border-box;
padding: 0 10px 0 12px;
display: flex;
align-items: center;
color: #1d2129;
font-size: 14px;
user-select: none;
cursor: pointer;
.filter-icons {
display: flex;
flex-direction: column;
margin-left: auto;
color: #c9cdd4;
font-size: 10px;
gap: 3px 0;
.icon {
line-height: 4px;
transition: all .15s;
}
.active {
color: #2a58ad;
}
}
}
</style>
\ No newline at end of file
<template>
<div class="warn-group">
<div class="tab">
<el-tabs v-model="activeName">
<el-tab-pane
v-for="item in tabList"
:key="item.id"
:label="item.label"
:name="item.id"
/>
</el-tabs>
</div>
<div class="warn-component">
<template v-for="i in tabList">
<component
:ref="i.name"
:key="i.id"
:is="i.componentName"
v-show="activeName == i.id"
:show="activeName == i.id"
@openWindow="$emit('openWindow',$event)"
:pageId="i.id"
/>
</template>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import WarnTable from './WarnTable'
import storeWarn from '../../../store/indexControl'
export default {
name: '',
components: {
WarnTable,
storeWarn
},
data () {
return {
activeName: '1',
tabList: [
{
label: '业绩风险榜',
componentName: 'WarnTable',
id: '1'
},
{
label: '新店风险榜',
componentName: 'WarnTable',
id: '2'
},
{
label: '门店盯防预警',
componentName: 'storeWarn',
id: '3'
}
]
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.warn-group {
margin-top: 16px;
background: #fff;
// height: calc(100% - 394px);
height: 100%;
border-radius: 4px;
.tab {
::v-deep .el-tabs__nav-wrap {
padding: 0 20px;
}
::v-deep .el-tabs__item {
height: 54px;
line-height: 54px;
}
::v-deep.el-tabs__nav-wrap::after {
height: 1px;
background: #e5e5e5;
}
}
.warn-component {
position: relative;
height: calc(100% - 68px);
}
}
</style>
\ No newline at end of file
<template>
<div class="warn-table">
<div class="filter-box">
<template v-for="item in filterList">
<filter-item
:key="item.value"
:item="item"
@sortChange="sortChange($event,item.value)"
:ref="`filterItem-${item.value}`"
/>
</template>
</div>
<div class="btns">
<el-button
size="mini"
type="primary"
@click="handleSearch"
>查询</el-button>
<el-button
size="mini"
plain
type="info"
@click="handleReset"
>重置</el-button>
<el-button
size="mini"
type="primary"
>导出</el-button>
</div>
<div class="table-box">
<d2-table
ref="tableRef"
:search-form="searchFormSearch"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
<div
slot="auth-button"
slot-scope="scope"
>
<el-button
type="text"
@click="openWindow(scope.scope)"
>详情</el-button>
</div>
</d2-table>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import dayjs from 'dayjs'
import { deepClone } from "@/common/util"
import FilterItem from './FilterItem.vue'
import { getMerchantPerformanceList } from '@api/earlyWarningManager'
import { getListApi } from "@api/publicAccount"
export default {
components: {
FilterItem
},
name: '',
props: {
pageId: {
type: String,
default: '1'
}
},
data () {
return {
filterList: [
{
value: '1',
label: '产值',
},
{
value: '2',
label: '客单价',
},
{
value: '3',
label: '引流率',
},
{
value: '4',
label: '转化率',
},
{
value: '5',
label: '渗透率',
},
],
tableList: [],
searchForm: {
businessType: 4,
countDate: dayjs().subtract(1, 'month').format("YYYY-MM")
},
// getListApi: getMerchantPerformanceList,
getListApi,
searchFormSearch: {},
tableParams: {
listName: "list",
tableOption: true,
tableColumns: [
{
label: "门店名称",
prop: "merchantName",
minWidth: "120px"
},
{
label: "基础信息",
prop: "baseInfo",
minWidth: "120px"
},
{
label: "店效标签",
prop: "shopEfficiencyLabel",
minWidth: "120px"
},
{
label: "事件标签",
prop: "eventLabel",
minWidth: "180px"
},
]
},
}
},
created () {
},
mounted () {
},
methods: {
clearSort (orderBy) {
this.filterList.map(e => {
if (e.value != orderBy) {
let [ref] = this.$refs[`filterItem-${e.value}`]
ref.clear()
}
})
},
sortChange (asc, orderBy) {
if (asc == -1) this.handleReset()
else {
this.clearSort(orderBy)
this.searchForm.orderBy = orderBy
this.searchForm.asc = asc
}
},
handleSearch () {
this.$refs.tableRef.refreshTable(true, true)
},
handleReset () {
this.clearSort()
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
beforeSearchFn () {
return new Promise((resolve) => {
this.searchFormSearch = deepClone(this.getParams())
resolve()
})
},
getParams () {
let params = deepClone(this.searchForm)
params.queryType = this.pageId
return params
},
openWindow (e) {
this.$emit('openWindow', {
...e,
pageId: `merchant-${e.merchantId}`,
componentName: 'shop-detail',
tabTitle: `${e.merchantName}门店详情`
})
}
}
}
</script>
<style scoped lang='scss'>
.warn-table {
padding: 0 20px 16px;
position: relative;
background-color: #fff;
.filter-box {
display: flex;
align-items: center;
gap: 0 8px;
margin-bottom: 16px;
}
.btns {
position: absolute;
top: 0;
right: 20px;
display: flex;
align-items: center;
}
}
</style>
\ No newline at end of file
<template>
<div class="layout">
<board-box @openWindow="$emit('openWindow',$event)" />
<warn-group @openWindow="$emit('openWindow',$event)" />
</div>
</template>
<script type='text/ecmascript-6'>
import BoardBox from './BoardBox'
import WarnGroup from './WarnGroup'
export default {
components: {
BoardBox,
WarnGroup
},
name: '',
data () {
return {
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.layout {
height: 100%;
padding: 0 20px;
overflow-y: auto;
}
</style>
\ No newline at end of file
<template>
<div class="layout">
<div
class="tab"
ref="tabbox"
>
<div
:class="['tab-item', { 'item-active': windowId == -1 }]"
@click="windowId = -1"
>
盯防首页
</div>
<template v-for="(i, index) in tab">
<template>
<div
:key="i.id"
:class="['tab-item', { 'item-active': windowId == i.id }]"
@click="windowId = i.id"
:ref="`tab-${index}`"
>
{{ i.tabTitle }}
<div
class="close"
@click.stop="close(index, i.id)"
>
<i class="el-icon-close"></i>
</div>
</div>
</template>
</template>
<template v-if="dropdownList.length">
<div class="arrow-box">
<el-dropdown
trigger="click"
@command="windowId = $event"
>
<div class="dropdown-link">
<i class="el-icon-arrow-down"></i>
</div>
<el-dropdown-menu slot="dropdown">
<template v-for="(i, index) in dropdownList">
<el-dropdown-item
:class="{ 'dropdown-item-active': windowId == i.id }"
:key="i.id"
:command="i.id"
>
<div class="dropdown-item">
{{ i.tabTitle }}
<div
class="close"
@click.stop="closeDrop(index)"
>
<i class="el-icon-close"></i>
</div>
</div>
</el-dropdown-item>
</template>
</el-dropdown-menu>
</el-dropdown>
</div>
</template>
</div>
<div class="content">
<shop-guard-index
v-show="windowId == -1"
@openWindow="openWindow"
:show="windowId == -1"
ref="shopGuardIndex"
/>
<template v-for="i in [...tab, ...dropdownList]">
<component
:ref="`page-${i.id}`"
:key="i.id"
:is="i.component"
v-show="windowId == i.id"
:show="windowId == i.id"
:pageData="i.data"
/>
</template>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import shopGuardIndex from "./components/shopGuardIndex/index"
import boardDetail from './components/boardDetail/index'
import shopDetail from "./components/shopDetail/index"
export default {
name: "",
components: {
shopGuardIndex,
boardDetail,
shopDetail
},
data () {
return {
tab: [],
dropdownList: [],
windowId: -1,
tabboxWidth: 0,
}
},
// 在beforeDestroy钩子中移除事件监听
beforeDestroy () {
window.removeEventListener('popstate', this.preventBack)
},
// 在你的Vue组件的mounted钩子中添加事件监听
mounted () {
history.pushState(null, null, document.URL)
window.addEventListener('popstate', this.preventBack)
if (this.tabboxWidth == 0) this.tabboxWidth = this.$refs.tabbox.offsetWidth
},
methods: {
preventBack () {
if (this.windowId !== -1) {
this.windowId = -1
history.pushState(null, null, document.URL)
} else this.$router.go(-1)
},
openWindow (data) {
console.log(data)
let id = data.pageId,
windowList = [...this.tab, ...this.dropdownList],
windowItem = windowList.find((e) => e.id == id)
if (windowItem) return this.windowId = id
if (windowList.length == 20) return this.$message.error("最多同时打开20个tabs")
let item = {
component: data.componentName,
data,
id,
tabTitle: data.tabTitle
}
if (this.dropdownList.length) this.dropdownList.push(item)
else {
this.tab.push(item)
this.checkEl()
}
this.windowId = id
},
close (index) {
this.tab.splice(index, 1)
if (this.dropdownList.length) {
this.tab.push(this.dropdownList[0])
this.closeDrop(0)
}
this.windowId = -1
this.checkEl()
},
closeDrop (index) {
this.dropdownList.splice(index, 1)
},
checkEl () {
let { tab, tabboxWidth } = this,
len = tab.length - 1
if (len == -1) return
this.$nextTick(() => {
let [el] = this.$refs[`tab-${len}`]
if (el) {
const { offsetWidth, offsetLeft } = el
if (offsetLeft + offsetWidth / 2 > tabboxWidth - 54) {
this.dropdownList.push(tab[len])
this.tab.splice(len, 1)
}
}
})
},
}
}
</script>
<style scoped lang='scss'>
.layout {
.tab {
display: flex;
align-items: center;
margin-left: 20px;
width: calc(100% - 58px);
box-sizing: border-box;
&-item {
width: fit-content;
height: 40px;
padding: 0 20px;
background: #fafafa;
border-radius: 4px 4px 0 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
color: #666666;
cursor: pointer;
line-height: 40px;
margin-right: 1px;
flex-shrink: 0;
.close {
border-radius: 100%;
padding: 4px;
margin-left: 4px;
display: flex;
align-items: center;
justify-content: center;
&:hover {
background-color: #666;
.el-icon-close {
color: #fff;
}
}
}
.el-icon-close {
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
color: #666666;
transform: translateY(1px);
}
}
.item-active {
font-weight: 500;
color: #2a58ad;
background: #ffffff;
}
.arrow-box {
width: 32px;
height: 40px;
line-height: 40px;
text-align: center;
background: #fafafa;
cursor: pointer;
flex-shrink: 0;
.el-dropdown {
width: 100%;
}
}
}
.content {
position: relative;
width: 100%;
height: calc(100vh - 110px);
// overflow-y: scroll;
box-sizing: border-box;
padding-bottom: 70px;
}
}
::v-deep.dropdown-item {
display: flex;
align-items: center;
justify-content: center;
.close {
border-radius: 100%;
padding: 4px;
margin-left: 4px;
display: flex;
align-items: center;
justify-content: center;
&:hover {
background-color: #666;
.el-icon-close {
color: #fff;
}
}
i {
margin-right: 0;
}
}
.el-icon-close {
font-size: 12px;
color: #666666;
}
}
.dropdown-item-active {
background-color: #eaeef7;
color: #5579bd;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!