Commit 87f9fdb9 by Jaxon

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

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