Commit 48b9f0a7 by 李伟康

```

feat(api): 新增删除策略API接口

新增deleteStrategy函数用于删除策略功能
```
1 parent 8a26797e
......@@ -612,4 +612,14 @@ export function getStrategyMerchantListWarningInfo (data = {}) {
export function getStrategyMerchantDetail (data = {}) {
data.method = "dj.api.strategy.find.merchant.detail"
return request(data, RequestMethods.POST)
}
\ No newline at end of file
}
/**
删除策略
*/
export function deleteStrategy (data = {}) {
data.method = "dj.api.strategy.info.delete"
return request(data, RequestMethods.POST)
}
......@@ -488,7 +488,11 @@ export default {
courseList,
}
if (merchantList.length) params.merchantList = merchantList
else params.merchantList = paramsInfo.merchantIds
else params.merchantList = [
{
merchantId: paramsInfo.merchantIds[0]
}
]
if (dateRange.length) {
let [startDate, endDate] = dateRange
params.strategyInfo.startDate = dayjs(startDate).format('YYYY-MM-DD') + ' 00:00:00'
......
......@@ -74,7 +74,11 @@ export default {
minDate () {
let nodeDate = '',
timelineList = this.businessOverviewDetail.timelineList
if (timelineList) nodeDate = timelineList.at(-1).nodeDate
if (timelineList) {
lastNode = timelineList.at(-1)
if(lastNode.nodeType != 6) nodeDate = lastNode.nodeDate
else nodeDate = timelineList.at(-2).nodeDate
}
console.log(dayjs(nodeDate).format('YYYY-MM-DD'))
return dayjs(nodeDate).format('YYYY-MM-DD')
}
......
<template>
<div :class="['warning-item flex',`bg-${type}`]">
<div :class="['warning-item flex',`bg-${item.type || 1}`]">
<img
:src="icon"
class="warning-icon"
>
生态系数预警:整车延保生态系数低于1.0
<div class="warning-text text-hide">{{ item.text }}</div>
</div>
</template>
......@@ -19,9 +19,9 @@ const type_1 = require('@/assets/strategy/icon-strategy-type01.png'),
export default {
name: 'EarlyWarningTips',
props: {
type: {
type: Number,
default: 1
item: {
type: Object,
default: () => ({})
}
},
computed: {
......@@ -33,7 +33,7 @@ export default {
4: type_4,
5: type_5,
6: type_6
}[this.type]
}[this.item.type] || ''
}
},
data () {
......@@ -62,10 +62,20 @@ export default {
background: #2c66f714;
box-sizing: border-box;
padding: 0 8px;
word-break: break-all;
.warning-icon {
width: 18px;
height: 18px;
margin-right: 6px;
}
.warning-text {
width: calc(100% - 24px);
}
}
.bg-1 {
background: #f2472414;
}
.bg-2 {
background: #ff9d0a14;
}
</style>
\ No newline at end of file
......@@ -3,7 +3,6 @@
:is-show.sync="dialogShow"
:dialog-config="dialogConfig.config"
class="detail-content"
@handleClick="submit"
:config="config"
>
<div class="content">
......
......@@ -8,6 +8,7 @@
<div class="title flex">
{{ item.title }}
<el-button
v-if="hasEHi"
type="text"
class="target"
@click="handleTargetConfig(item)"
......@@ -21,10 +22,13 @@
:style="{width: `calc(100% / ${item.list.length})`}"
>
<div class="label">{{ i.label }}</div>
<div class="value">{{ viewData[i.key] == null ?'-' : viewData[i.key]}}</div>
<template v-if="i.subKey">
<div class="sub-value">兜底目标{{ viewData[i.subKey] }}</div>
</template>
<div class="value">
<template v-if="viewData[i.key] == null || i.hide">-</template>
<template v-else>
{{ viewData[i.key] }}<template v-if="i.unit">{{ i.unit }}</template>
</template>
</div>
<div :class="['sub-value',{show:i.subKey && viewData[i.subKey] != null}]">兜底目标{{ viewData[i.subKey] }}%</div>
</div>
</template>
</div>
......@@ -50,12 +54,14 @@ const overviewList = [
{
label: '渗透率',
key: 'vehicleWarrantyPenetrationRate',
subKey: 'vehicleWarrantyPenetrationBottomTarget'
subKey: 'vehicleWarrantyPenetrationBottomTarget',
unit: '%'
},
{
label: '转化率',
key: 'vehicleWarrantyConversionRate',
subKey: 'vehicleWarrantyConversionBottomTarget'
subKey: 'vehicleWarrantyConversionBottomTarget',
unit: '%'
}
]
},
......@@ -69,12 +75,14 @@ const overviewList = [
{
label: '渗透率',
key: 'safetyPackagePenetrationRate',
subKey: 'safetyPackagePenetrationBottomTarget'
subKey: 'safetyPackagePenetrationBottomTarget',
unit: '%'
},
{
label: '转化率',
key: 'safetyPackageConversionRate',
subKey: 'safetyPackageConversionBottomTarget'
subKey: 'safetyPackageConversionBottomTarget',
unit: '%'
}
],
},
......@@ -88,12 +96,14 @@ const overviewList = [
{
label: '渗透率',
key: 'batteryWarrantyPenetrationRate',
subKey: 'batteryWarrantyPenetrationBottomTarget'
subKey: 'batteryWarrantyPenetrationBottomTarget',
unit: '%'
},
{
label: '转化率',
key: 'batteryWarrantyConversionRate',
subKey: 'batteryWarrantyConversionBottomTarget'
subKey: 'batteryWarrantyConversionBottomTarget',
unit: '%'
}
],
},
......@@ -107,12 +117,14 @@ const overviewList = [
{
label: '渗透率',
key: 'tireWarrantyPenetrationRate',
subKey: 'tireWarrantyPenetrationBottomTarget'
subKey: 'tireWarrantyPenetrationBottomTarget',
unit: '%'
},
{
label: '转化率',
key: 'tireWarrantyConversionRate',
subKey: 'tireWarrantyConversionBottomTarget'
subKey: 'tireWarrantyConversionBottomTarget',
unit: '%'
}
],
}
......@@ -120,7 +132,7 @@ const overviewList = [
export default {
name: 'OverViewList',
components: { HistoryTarget },
inject: ['deepClone'],
inject: ['deepClone', 'GET_HARMONY'],
props: {
hasEHi: {
type: Boolean,
......@@ -142,20 +154,20 @@ export default {
overviewList () {
let { hasEHi } = this,
list = this.deepClone(overviewList)
if (hasEHi) list.map((e,index) => {
if (hasEHi) list.map((e, index) => {
e.list.push({
label: '生态系数',
key: {
0: 'vehicleWarrantyEcoCoefficient',
1: 'safetyPackageEcoCoefficient',
2: 'batteryWarrantyEcoCoefficient',
3: 'tireWarrantyEcoCoefficient'
}[index]
3: 'tireWarrantyEcoCoefficient',
}[index],
hide: !this.GET_HARMONY()
})
})
return list
}
},
},
mounted () {
},
......@@ -205,6 +217,10 @@ export default {
font-size: 13px;
margin-top: 4px;
line-height: 15px;
opacity: 0;
}
.show {
opacity: 1;
}
}
}
......
......@@ -5,14 +5,55 @@
class="detail-content"
:config="config"
>
<el-scrollbar class="content">
<div class="content">
<template v-for="(item,index) in list">
<div
class="list-box"
:key="index"
>
<div :class="['line',{'first-line':index == 0},{'last-line':index == list.length - 1}]">
<div class="icon"></div>
</div>
<div class="title">{{ item.yearMonth }}</div>
<div class="staff-list flex">
<template v-for="(i,ind) in item.staffList">
<div
class="staff-item flex"
:key="ind"
>
<div class="staff-icon">
<img src="@/assets/strategy/default-avatar.png">
<template v-if="i.temporarySupport">
<div class="temporary-support flex">临时支援</div>
</template>
</div>
</el-scrollbar>
<div class="staff-info">
<div class="name text-hide">{{ i.staffName }}</div>
<template v-if="i.deletedFlag == 'N'">
<div class="deleted flex">
禁用
<div
class="disabled-btn flex"
@click.stop="disabledStaff(item)"
>
</div>
</div>
</template>
</div>
</div>
</template>
</div>
</div>
</template>
</div>
</basedialog>
</template>
<script>
import {
disableStrategyStaff,
getStrategyMerchantAnalysisEmployeeHistory,
} from "@api/earlyWarningManager"
......@@ -64,6 +105,7 @@ export default {
width: "600px"
}
},
list: []
}
},
methods: {
......@@ -76,9 +118,26 @@ export default {
bizs: 1,
merchantId: merchantIds[0]
})
console.log(data)
}
this.list = data
},
disabledStaff (item) {
this.$confirm("对员工进行禁用操作后,对应的账户无法再使用;历史已产生的业务数据不受影响。", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
closeOnClickModal: false
}).then(async () => {
const data = await disableStrategyStaff({
staffUuid: item.staffUUid
})
if (data) {
this.getStrategyMerchantAnalysisEmployeeHistory()
this.$message.success('操作成功')
this.close()
} else this.$message.error('操作失败')
}).catch(() => {
})
},
}
}
</script>
......@@ -111,10 +170,142 @@ export default {
}
.detail-content {
.content {
display: flex;
width: 100%;
height: 558px;
box-sizing: border-box;
padding: 20px;
padding: 16px 20px 0 0;
overflow-y: auto;
.line {
position: absolute;
top: 4px;
left: 20px;
width: 16px;
height: calc(100% - 4px);
&::after {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
content: "";
width: 1.5px;
height: 100%;
background: #d4deef;
}
.icon {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 10px;
height: 10px;
background: #2a58ad;
border-radius: 100%;
z-index: 2;
}
}
.first-line {
.icon {
width: 16px;
height: 16px;
background: #2a58ad33;
&::after {
width: 10px;
height: 10px;
border: 2px solid #2a58ad;
background: #ffffff;
border-radius: 100%;
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
box-sizing: border-box;
}
}
&::after {
top: 16px;
height: calc(100% - 16px);
}
}
.last-line {
&::after {
display: none;
}
}
.list-box {
position: relative;
width: 100%;
box-sizing: border-box;
padding-left: 50px;
.title {
color: #333333;
font-size: 16px;
font-weight: 500;
line-height: 22px;
margin-bottom: 8px;
}
.staff-list {
width: 100%;
flex-wrap: wrap;
gap: 14px 0;
padding-bottom: 16px;
.staff-item {
width: 25%;
.staff-icon {
position: relative;
width: 48px;
height: 48px;
margin-right: 8px;
border-radius: 8px;
overflow: hidden;
img {
width: 100%;
height: 100%;
}
.temporary-support {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 15px;
background: #000000b3;
color: #ffffff;
font-size: 9px;
font-weight: 500;
justify-content: center;
}
}
.staff-info {
width: calc(100% - 56px);
font-size: 14px;
line-height: 17px;
.name {
margin-bottom: 6px;
color: #333333;
}
.deleted {
color: #2a58ad;
cursor: pointer;
}
.disabled-btn {
width: 14px;
height: 14px;
background: #2a58ad33;
border-radius: 50%;
margin-left: 5px;
justify-content: center;
&::after {
content: "";
width: 7.7px;
height: 2.1px;
background: #2a58ad;
display: block;
}
}
}
}
}
}
}
}
</style>
......@@ -19,7 +19,7 @@
>
</div>
<div class="info ">
<div class="name text-hide">{{merchantDetailInfo.merchantName}}</div>
<div class="name text-hide">{{merchantDetailInfo.merchantName||'-'}}</div>
<div class="control flex">
<div class="scene flex">
<img
......
......@@ -46,7 +46,7 @@
</div>
</template>
<div class="btn-list flex">
<template v-if="item.status == 0 || index == 0">
<template v-if="item.pushFlag != 1">
<el-button
:size="size"
class="btn-default"
......@@ -72,6 +72,9 @@ import {
STRATEGY_2456,
STRATEGY_3
} from './contant'
import {
deleteStrategy
} from '@/api/earlyWarningManager'
export default {
name: 'StrategyItem',
props: {
......@@ -123,7 +126,14 @@ export default {
type: "warning",
closeOnClickModal: false
}).then(async () => {
this.$emit('refresh')
const data = await deleteStrategy({
id: item.id
})
if (data) {
this.$emit('refresh')
this.$message.success('操作成功')
this.close()
} else this.$message.error('操作失败')
}).catch(() => {
})
}
......
......@@ -18,26 +18,45 @@
:style="{width: i.width}"
>
<div class="label">{{ i.label }}</div>
<div class="value">{{ summaryInfo[i.key]}}</div>
<div class="value">
<template v-if="i.isRate">{{formatMom( summaryInfo[i.key])}}</template>
<template v-else>{{ formatNumber(summaryInfo[i.key])}}</template>
</div>
<template v-if="i.percentKey">
<div class="sub-value">{{ summaryInfo[i.percentKey] }}</div>
<div class="sub-value flex">
环比{{ formatMom(summaryInfo[i.percentKey])}}
<template v-if="formatIsRatio(summaryInfo[i.percentKey])">
<img
:class="['arrow',{just:formatIsRatio(summaryInfo[i.percentKey]) === 'just01'}]"
:src="getIconSrc(formatIsRatio(summaryInfo[i.percentKey]))"
/>
</template>
</div>
</template>
</div>
</template>
</div>
<div class="summary-box">
<div class="help flex">
<!-- <div class="help flex">
帮助
<img
src="@/assets/strategy/data-info.png"
class="help-icon"
>
</div>
</div> -->
<div class="summary-item flex fixed-summary">
<div class="label flex">
渗透率<div class="num">{{ summaryInfo.penetrationRate }}</div>
渗透率<div class="num">{{ formatMom(summaryInfo.penetrationRate) }}</div>
</div>
<div class="sub-value">
环比{{ formatMom(summaryInfo.penetrationRateMom) }}
<template v-if="formatIsRatio(summaryInfo.penetrationRateMom)">
<img
:class="['arrow',{just:formatIsRatio(summaryInfo.penetrationRateMom) === 'just01'}]"
:src="getIconSrc(formatIsRatio(summaryInfo.penetrationRateMom))"
/>
</template>
</div>
<div class="sub-value">环比{{ summaryInfo.penetrationRateMom }}</div>
</div>
<template v-for="(i,index) in summaryList">
<div
......@@ -51,10 +70,18 @@
>
<div class="label flex">
{{ j.label }}
<div class="num">{{ summaryInfo[i.key] }}</div>
<div class="num">{{ formatMom(summaryInfo[j.key]) }}</div>
</div>
<div class="value">{{ formatDash(summaryInfo[j.key])}}</div>
<div class="sub-value">
环比{{ formatMom(summaryInfo[j.percentKey]) }}
<template v-if="formatIsRatio(summaryInfo[j.percentKey])">
<img
:class="['arrow',{just:formatIsRatio(summaryInfo[j.percentKey]) === 'just01'}]"
:src="getIconSrc(formatIsRatio(summaryInfo[j.percentKey]))"
/>
</template>
</div>
<div class="value">{{ summaryInfo[i.key] }}</div>
<div class="sub-value">环比{{ summaryInfo[i.percentKey] }}</div>
</div>
</template>
</div>
......@@ -65,7 +92,7 @@
<template v-for="(item,index) in leftWarningInfoList">
<EarlyWarningTips
:key="index"
:data="item"
:item="item"
/>
</template>
</div>
......@@ -74,12 +101,13 @@
<over-view-list
hasEHi
:viewData="viewData"
:isHarmony="isHarmony"
></over-view-list>
</div>
<template v-for="(item,index) in rightWarningInfoList">
<EarlyWarningTips
:key="index"
:data="item"
:item="item"
/>
</template>
</div>
......@@ -88,17 +116,20 @@
</template>
<script type='text/ecmascript-6'>
import { get } from 'sortablejs';
import EarlyWarningTips from '../EarlyWarningTips.vue'
import OverViewList from '../OverViewList.vue';
import {
getStrategyMerchantAnalysisStoreDetailSummary,
getStrategyMerchantAnalysisGoodsSummaryWithWarn,
getStrategyMerchantListWarningInfo
getStrategyMerchantListWarningInfo,
getStrategyBusinessAnalysisStoreSpecialBrand
} from '@/api/earlyWarningManager'
export default {
name: 'SummaryOverview',
inject: ['IMG_URL', 'GET_PARAMS_INFO', 'GET_HARMONY'],
inject: ['IMG_URL', 'GET_PARAMS_INFO',
'formatIsRatio', 'formatMom',
'formatDash', 'getIconSrc',
'formatNumber'],
components: {
EarlyWarningTips,
OverViewList
......@@ -106,8 +137,8 @@ export default {
data () {
return {
leftWarningInfoList: new Array(5),
rightWarningInfoList: new Array(3),
leftWarningInfoList: [],
rightWarningInfoList: [],
summaryInfo: {},
topView: [
{
......@@ -123,6 +154,7 @@ export default {
},
{
label: '达成率', //(仅月周期展示) ?
isRate: true,
key: 'achievementRate',
width: '80px'
},
......@@ -206,41 +238,55 @@ export default {
]
},
],
isHarmony: false,
viewData: {}
viewData: {},
isHarmony: false
}
},
computed: {
paramsInfo () {
return this.GET_PARAMS_INFO()
},
isHarmony () {
return this.GET_HARMONY()
}
},
mounted () {
},
methods: {
async getStrategyBusinessAnalysisStoreSpecialBrand () {
const params = this.paramsInfo,
data = await getStrategyBusinessAnalysisStoreSpecialBrand(params)
this.isHarmony = data
},
init () {
this.getStrategyMerchantAnalysisStoreDetailSummary()
this.getStrategyMerchantListWarningInfo()
this.getStrategyBusinessAnalysisStoreSpecialBrand()
},
async getStrategyMerchantAnalysisStoreDetailSummary () {
let params = this.paramsInfo,
data = await getStrategyMerchantAnalysisStoreDetailSummary(params)
this.summaryInfo = data
console.log(data, 'SummaryOverview/index.vue(查询门店经营概况)')
if (!this.isHarmony) { //是否鸿蒙 是才查商品
const summaryGoodsData = await getStrategyMerchantAnalysisGoodsSummaryWithWarn(params)
this.viewData = summaryGoodsData || {}
console.log(summaryGoodsData, 'SummaryOverview/index.vue(查询门店商品销售情况)')
}
const summaryGoodsData = await getStrategyMerchantAnalysisGoodsSummaryWithWarn(params)
this.viewData = summaryGoodsData || {}
console.log(summaryGoodsData, 'SummaryOverview/index.vue(查询门店商品销售情况)')
},
async getStrategyMerchantListWarningInfo () {
let params = this.paramsInfo,
data = await getStrategyMerchantListWarningInfo(params)
console.log(data, 'SummaryOverview/index.vue(查询门店预警信息)')
data = await getStrategyMerchantListWarningInfo(params),
leftWarningInfoList = [],
rightWarningInfoList = []
data.forEach((e, index) => {
if ((index + 1) % 2 == 0) rightWarningInfoList.push({
type: e.startsWith('兜底预警') ? 1 : 2,
text: e
})
else leftWarningInfoList.push({
type: e.startsWith('兜底预警') ? 1 : 2,
text: e
})
})
this.leftWarningInfoList = leftWarningInfoList;
this.rightWarningInfoList = rightWarningInfoList;
}
}
}
......@@ -251,6 +297,10 @@ export default {
display: flex;
align-items: center;
}
.arrow {
width: 13px;
height: 13px;
}
.summary-overview {
padding: 0 20px 20px;
border-bottom: 1px solid #e5e5e5;
......@@ -348,7 +398,7 @@ export default {
position: absolute;
top: 55px;
right: 12px;
width: 95px;
min-width: 95px;
flex-direction: column;
font-size: 13px;
.label {
......
......@@ -45,9 +45,9 @@ import StaffOverview from './components/StaffOverview/index.vue';
import { deepClone } from "@/common/util"
import qualityDetail from '@/views/residentManage/components/qualityDetail'
import newQualityDetail from '@/views/residentManage/components/newQualityDetail'
import {
getStrategyBusinessAnalysisStoreSpecialBrand
} from '@/api/earlyWarningManager'
const rise = require('@/assets/strategy/rise.png')
const just01 = require('@/assets/strategy/just01.png')
const decline = require('@/assets/strategy/decline.png')
export default {
components: {
StrategyList,
......@@ -65,7 +65,12 @@ export default {
IMG_URL: this.IMG_URL,
deepClone,
GET_PARAMS_INFO: () => this.paramsInfo,
GET_HARMONY: () => this.isHarmony
GET_HARMONY: () => this.isHarmony,
formatMom: this.formatMom,
formatDash: this.formatDash,
formatIsRatio: this.formatIsRatio,
getIconSrc: this.getIconSrc,
formatNumber: this.formatNumber
}
},
data () {
......@@ -116,18 +121,20 @@ export default {
if (merchantNo) {
console.log('接收到的 merchantNo:', merchantNo);
// 可以根据 merchantNo 更新 merchantInfo 或进行其他操作
this.paramsInfo.merchantIds = [44211227 || merchantNo]
this.$nextTick(() => this.init())
// this.paramsInfo.merchantIds = [merchantNo]
// this.$nextTick(() => this.init())
}
this.paramsInfo.merchantIds = [44210895 || 44211227 || merchantNo]
this.$nextTick(() => this.init())
history.pushState(null, null, document.URL)
window.addEventListener('popstate', this.preventBack)
},
methods: {
init () {
this.storeSignboardInfoRef.init()
this.storeSignboardInfoRef.init()
this.businessOverviewRef.init()
this.strategyListRef.init()
},
preventBack () {
if (this.isQualityVisible || this.isNewQualityVisible) {
......@@ -137,14 +144,11 @@ export default {
}
this.$router.go(-1)
},
async requireInterface (flag = false) {
if (flag) {
const data = await getStrategyBusinessAnalysisStoreSpecialBrand(params)
this.isHarmony = data
}
async requireInterface () {
this.summaryOverviewRef.init()
this.staffOverviewRef.init()
},
openReceptionDialog ({ list, row, currentNum }) {
this.currentNum = currentNum
this.qualityDetailList = list
......@@ -168,7 +172,7 @@ export default {
this.paramsInfo = {
...this.paramsInfo,
// ...e
cycleType: 4,
cycleType: 3,
startTime: '2001-01-01',
endTime: '2026-01-01'
}
......@@ -179,8 +183,48 @@ export default {
...this.paramsInfo,
merchantIds: [e]
}
this.requireInterface(true)
this.requireInterface()
this.init()
},
formatIsRatio: (v) => {
const s = typeof v === "string" ? v.trim() : v;
if (s === null || s === undefined || (typeof s === "string" && s === ""))
return "";
const n =
typeof s === "number"
? s
: parseFloat((s).replace(/[^\d.\-]/g, ""));
if (isNaN(n)) return "";
return n < 0 ? "decline" : n === 0 ? "just01" : "rise";
},
formatMom: (val) => {
if (val === null || val === undefined) return "-"
const s = String(val).trim();
if (s === "") return "-";
if (s.includes("%") || s.includes("%")) return s
return `${s}%`;
},
formatDash: (val) => {
if (val === null || val === undefined) return "-";
if (typeof val === "string" && val.trim() === "") return "-";
return val;
},
getIconSrc: (name) => {
return {
rise,
decline,
just01,
}[name] ?? ""
},
formatNumber (val) {
if (val === null || val === undefined) return "-"
// 转换为数字并验证有效性
const num = Number(val);
if (isNaN(num)) return val;
// 使用 toFixed(2) 确保两位小数,并保留千位分隔符
const [integerPart, decimalPart] = num.toFixed(2).split('.');
const formattedInteger = Number(integerPart).toLocaleString();
return `${formattedInteger}.${decimalPart}`;
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!