Commit 87f9fdb9 by Jaxon

feat(绩效方案): 优化系数提成配置逻辑和UI交互

- 更新配置中心模块URL为sj环境
- 当选择系数提成时,限制商品列数为1列并自动设置商品分类和业务类型
- 为商品级联选择器添加disabled属性支持,在系数提成时禁用选择
- 优化模板2的价格区间校验逻辑,支持系数提成的严格区间验证
- 重构商品列UI布局,使用图标按钮替代文字按钮,优化视觉一致性
1 parent c3c67410
......@@ -115,7 +115,7 @@ let baseConfig = config;
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
fetch(
"https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config",
"https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-car-life-system-config-sj",
)
.then(
(response) => {
......
<template>
<div class="">
<el-cascader clearable
:disabled="disabled"
:options="getGoodsCategory"
placeholder="请选择商品品类"
:props="{ checkStrictly: true, label: 'categoryName', value: 'categoryType' }"
......@@ -21,6 +22,10 @@ export default {
type: Number,
require: true,
},
disabled: {
type: Boolean,
default: false,
},
value: {
type: Array,
default: () => [],
......
......@@ -2,16 +2,30 @@
width: 100%;
margin-bottom: 20px !important;
::v-deep .el-table {
.el-form-item__error {
display: none;
}
// &:has(.is-error) {
// border-color: red;
// }
.product-cascader-wrapper {
position: relative;
.delete-icon {
left: calc(50% + 90px);
}
.change-type-icon {
left: calc(50% - 90px);
}
.icon {
line-height: normal;
z-index: 99;
height: 14px;
top: 50%;
transform: translate(-50%, -50%);
font-size: 16px;
color: #2a58ad;
vertical-align: middle;
position: absolute;
left: 6px;
top: 50%;
transform: rotate(90deg);
transform: translate(0, -50%);
padding: 0;
cursor: pointer;
}
......
......@@ -88,6 +88,14 @@ export default {
}
if (this.curParamsConfig.ParamsType1Products.length >= 10) {
this.$message.warning("最多添加10列商品");
return;
}
const hasXs = this.curParamsConfig.ParamsType1.some(
item => item.commissionTypes === "XS",
);
if (hasXs) {
this.$message.warning("选择系数时,只能有一列商品");
return;
}
this.curParamsConfig.ParamsType1Products.push({
...structuredClone(paramConfigListTemplate.ParamsType1Products[0]),
......
......@@ -65,53 +65,30 @@
prop="productLabel">
<template #header="{ $index }">
<div class="product-cascader-wrapper">
<span v-if="showGoodsConfigTypesBtn"
class="el-icon-sort icon"
@click="handleChangeGoodsConfigTypes($index)">
</span>
<!-- <el-button style="position: absolute;left:6px;top:50%; transform: translate(0, -50%);padding:0"
title="删除列"
type="text"
@click="handleRemoveProductsCol(index)">
<i class="el-icon-delete" />
</el-button> -->
<!-- -->
<div v-if="showGoodsConfigTypesBtn"
class="el-icon-sort change-type-icon icon"
title="切换商品分类"
@click="handleChangeGoodsConfigTypes($index)">
</div>
<el-form-item :prop="`paramConfigList.${configIndex}.ParamsType1Products.${index}.productLabel`"
:rules="[
{ required: true, trigger: 'blur', message: '商品不能为空' },
]">
<ProductCascader v-model="curParamsConfig.ParamsType1Products[index].productLabel"
class="cascader-wrapper"
:config-index="configIndex"
:disabled="checkXsInRow"
:row-index="index"
:use-goods-cascader-type="goodsCategory === 0"
@change="handleProductChange" />
<!-- <GoodsCategoryCascader v-if="goodsCategory === 0"
v-model="curParamsConfig.ParamsType1Products[index].productLabel"
:goods-category="goodsCategory"
@change="handleProductChange" />
<el-cascader v-else
v-model="curParamsConfig.ParamsType1Products[index].productLabel"
clearable
:options="productDefineListOptions"
:placeholder="goodsCategory === 2 ? '请选择' : '请选择圈定商品/套餐'"
:props="{ checkStrictly: true }"
:show-all-levels="false"
@change="handleProductChange">
</el-cascader> -->
</el-form-item>
<el-button v-if="index !== 0"
style="position: absolute;right:6px;top:50%; transform: translate(0, -50%);padding:0"
title="删除列"
type="text"
@click="handleRemoveProductsCol(index)">
<i class="el-icon-delete" />
</el-button>
<div v-if="index !== 0"
class="el-icon-delete delete-icon icon"
title="删除列"
@click="handleRemoveProductsCol(index)">
</div>
</div>
</template>
......@@ -218,6 +195,12 @@ export default {
this.formData.paramConfigList[this.configIndex] = value;
},
},
// 行里有无 系数
checkXsInRow() {
return this.curParamsConfig.ParamsType1.some(
item => item.commissionTypes === "XS",
);
},
// 考核因子序号(从1递增)
assessmentFactorSort() {
return this.configIndex + 1;
......
......@@ -51,12 +51,14 @@
<GoodsCategoryCascader v-if="goodsCategory === 0"
v-model="curParamsConfig.ParamsType2[$index].productLabel"
clearable
:disabled="checkXsInRow"
:goods-category="goodsCategory"
@change="handleProductChange" />
<!-- 圈定套餐/商品 cascader -->
<el-cascader v-else
v-model="curParamsConfig.ParamsType2[$index].productLabel"
clearable
:disabled="checkXsInRow"
:options="getProductDefineListOptions"
:show-all-levels="false"
@change="handleProductChange">
......@@ -173,6 +175,10 @@ export default {
this.formData.paramConfigList[this.configIndex].goodsCategory = value;
},
},
// 有无 系数
checkXsInRow() {
return this.curParamsConfig.ParamsType2CommissionTypes === "XS";
},
curParamsConfig() {
return this.formData.paramConfigList[this.configIndex];
},
......@@ -186,16 +192,17 @@ export default {
},
mounted() {},
methods: {
...mapMutations("PerformanceFormStore", ["clearParamsType2Condition"]),
...mapMutations("PerformanceFormStore", ["clearParamsType2Condition", "onParamsType2CommissionTypesChange"]),
validGoodsCategory,
validPriceRangeType2,
handleChangeGoodsConfigTypes() {
this.goodsCategory = this.goodsCategory === 0 ? 1 : 0;
},
// 提成方式改变
handleCommissionTypesChange() {
handleCommissionTypesChange(e) {
// 清空值
this.clearParamsType2Condition(this.configIndex);
this.onParamsType2CommissionTypesChange({ params2Index: this.configIndex, value: e });
},
// 删除行
handleRemoveTableRow(row) {
......
<template>
<div class="">
<el-cascader clearable
:disabled="disabled"
:options="computedGoodsCategory"
placeholder="请选择商品品类"
:props="{
......@@ -26,6 +27,10 @@ export default {
type: Array,
default: () => [],
},
disabled: {
type: Boolean,
default: false,
},
/**
* Config Index in formData.paramConfigList
* Used to isolate the scope of disabled checks to the current assessment factor table.
......
<template>
<el-cascader clearable
:disabled="disabled"
:options="computedOptions"
placeholder="请选择"
:show-all-levels="false"
......@@ -23,6 +24,10 @@ export default {
type: Array,
default: () => [],
},
disabled: {
type: Boolean,
default: false,
},
/**
* Config Index in formData.paramConfigList
* Used to isolate the scope of disabled checks to the current assessment factor table.
......
......@@ -3,6 +3,7 @@
<GoodsCategoryCascader v-if="useGoodsCascaderType"
:business-type="formData.businessType"
:config-index="configIndex"
:disabled="disabled"
:index="rowIndex"
:value="value"
@change="handleProductChange" />
......@@ -10,6 +11,7 @@
<!-- 圈定套餐/商品 cascader -->
<ProductDefine v-else
:config-index="configIndex"
:disabled="disabled"
:index="rowIndex"
:value="value"
@change="handleProductChange" />
......@@ -33,6 +35,10 @@ export default {
type: Array,
default: () => ([]),
},
disabled: {
type: Boolean,
default: false,
},
useGoodsCascaderType: {
type: Boolean,
default: false,
......
......@@ -296,6 +296,30 @@ export default {
});
}
},
onParamsType2CommissionTypesChange(state, { params2Index, value }) {
// 如果选择了系数 检查商品分类,是否选择了 品类 , 如果没有, 强行赋上 . 且适配业务如果没有选, 也要强行设置
// 将商品的值都设置为 -1,条件的不用
if (value === "XS") {
// 检查商品分类,是否选择了 品类 , 如果没有, 强行赋上
if (!state.formData.goodsConfigTypes) {
state.formData.goodsConfigTypes = ["0"];
}
if (!state.formData.goodsConfigTypes.includes("0")) {
state.formData.goodsConfigTypes.unshift("0");
}
// 且适配业务如果没有选, 也要强行设置;
if (state.formData.businessType === undefined || state.formData.businessType === null) {
state.formData.businessType = 0;
}
if (state.formData.paramConfigList[params2Index].ParamsType2.length) {
for (const rowItem of state.formData.paramConfigList[params2Index].ParamsType2) {
rowItem.productLabel = [-1];
}
}
}
},
onParamsType1CommissionTypesChange(state, { params1Index, value }) {
// 如果选择了系数 检查商品分类,是否选择了 品类 , 如果没有, 强行赋上 . 且适配业务如果没有选, 也要强行设置
......
......@@ -237,7 +237,22 @@ export function validPriceRangeType2(rule, value, cb) {
// maxLimit = 100,
// mustReachMax = true,
// const { templateType, tableIndex, rowIndex, field } = rule;
const { templateType, tableIndex, rowIndex, field } = rule;
if (templateType === "ParamsType2") {
const table = store.state.PerformanceFormStore.formData.paramConfigList[tableIndex];
// 当为系数时,模板2 只能有一组商品,所以可以直接校验
if (table.ParamsType2CommissionTypes === "XS") {
const priceList = table[templateType].map(item => item.priceRange);
const error = validateStrictIntervals({
intervals: priceList,
tolerance: 0.01,
mustReachMax: true,
});
if (error) {
return cb(new Error(error));
}
}
}
// const formData = store.state.PerformanceFormStore.formData;
// const table = formData.paramConfigList[tableIndex];
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!