Commit 8fecf06c by Jaxon

fix(performance-scheme): 提成方式变更, 清空两种表格下对应的值

1 parent 735c1915
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
</template> </template>
<script> <script>
import { mapGetters, mapState } from "vuex"; import { mapGetters, mapMutations, mapState } from "vuex";
import EditableText from "@/components/editableText/index.vue"; import EditableText from "@/components/editableText/index.vue";
import GoodsCategoryCascader from "../goodsCategoryCascader/index.vue"; import GoodsCategoryCascader from "../goodsCategoryCascader/index.vue";
import { assessmentFactorOptions, commissionTypeEnum } from "../performanceRuleSelection/options"; import { assessmentFactorOptions, commissionTypeEnum } from "../performanceRuleSelection/options";
...@@ -207,6 +207,8 @@ export default { ...@@ -207,6 +207,8 @@ export default {
}, },
methods: { methods: {
...mapMutations("PerformanceFormStore", ["clearParamsType1ProductValue"]),
// 验证价格范围:结束值必须大于起始值 // 验证价格范围:结束值必须大于起始值
handlePriceRangeChange(rowIndex, rangeIndex) { handlePriceRangeChange(rowIndex, rangeIndex) {
console.log("asda"); console.log("asda");
...@@ -232,6 +234,7 @@ export default { ...@@ -232,6 +234,7 @@ export default {
this.validatedRows.delete(rowIndex); this.validatedRows.delete(rowIndex);
} }
}, },
// TODO: 清空当列的值
handleProductChange(value) { handleProductChange(value) {
console.log("product change", value); console.log("product change", value);
}, },
...@@ -247,8 +250,10 @@ export default { ...@@ -247,8 +250,10 @@ export default {
// 清空该行所有productValue // 清空该行所有productValue
handleCommissionTypesChange(row) { handleCommissionTypesChange(row) {
this.curParamsConfig.ParamsType1Products.forEach((product) => { // 清空值
this.$set(product.productValue, row, undefined); this.clearParamsType1ProductValue({
params1Index: this.configIndex,
row,
}); });
}, },
// 删除行 // 删除行
......
...@@ -167,8 +167,9 @@ export default { ...@@ -167,8 +167,9 @@ export default {
handleChangeGoodsConfigTypes() { handleChangeGoodsConfigTypes() {
this.goodsCategory = this.goodsCategory === 0 ? 1 : 0; this.goodsCategory = this.goodsCategory === 0 ? 1 : 0;
}, },
// TODO: 提成方式改变 // 提成方式改变
handleCommissionTypesChange() { handleCommissionTypesChange() {
// 清空值
this.clearParamsType2Condition(this.configIndex); this.clearParamsType2Condition(this.configIndex);
}, },
// 删除行 // 删除行
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
<script> <script>
import { isArray } from "lodash-es"; import { isArray } from "lodash-es";
import { mapMutations, mapState } from "vuex"; import { mapActions, mapMutations, mapState } from "vuex";
import DefineProductsDialog from "@/views/residentManage/salaryPerformance/components/defineProductsDialog.vue"; import DefineProductsDialog from "@/views/residentManage/salaryPerformance/components/defineProductsDialog.vue";
import { bindFormFields } from "../../store/helper"; import { bindFormFields } from "../../store/helper";
import FormItemHelp from "../formItemHelp/index.vue"; import FormItemHelp from "../formItemHelp/index.vue";
...@@ -147,11 +147,13 @@ export default { ...@@ -147,11 +147,13 @@ export default {
...mapMutations("PerformanceFormStore", [ ...mapMutations("PerformanceFormStore", [
"setProductDefineList", "setProductDefineList",
"touchAssessment", "touchAssessment",
"setCommissionTypesOptions",
"setCommissionBases", "setCommissionBases",
"setCommissionTypes", "setCommissionTypes",
"checkAllTableGoods", "checkAllTableGoods",
]), ]),
...mapActions("PerformanceFormStore", [
"setCommissionTypesOptions",
]),
handleGoodsConfigTypesGroupChange(e) { handleGoodsConfigTypesGroupChange(e) {
// 检查设置表格内的所有goodType是否一致 // 检查设置表格内的所有goodType是否一致
......
...@@ -93,31 +93,6 @@ export default { ...@@ -93,31 +93,6 @@ export default {
state.productDefineList = data; state.productDefineList = data;
}, },
// 设置提成方式的下拉框选项
setCommissionTypesOptions(state, options) {
state.commissionTypesOptions = options.map((item, index) => ({
label: commissionTypeEnum[item].label,
value: commissionTypeEnum[item].value,
}));
// 清空下方表格所有提成方式的值
if (isArray(state.formData.paramConfigList)) {
for (const table of state.formData.paramConfigList) {
if (table.templateType === "ParamsType1" && isArray(table.ParamsType1)) {
for (const row of table.ParamsType1) {
if (!options.includes(row.commissionTypes)) {
row.commissionTypes = undefined;
}
}
}
if (table.templateType === "ParamsType2") {
if (!options.includes(table.ParamsType2CommissionTypes)) {
table.ParamsType2CommissionTypes = undefined;
}
}
}
}
},
// goodsConfigType改变的时候 // goodsConfigType改变的时候
checkAllTableGoods(state, goodsConfigTypes) { checkAllTableGoods(state, goodsConfigTypes) {
console.log("goodsConfigTypes", goodsConfigTypes); console.log("goodsConfigTypes", goodsConfigTypes);
...@@ -253,9 +228,45 @@ export default { ...@@ -253,9 +228,45 @@ export default {
} }
} }
}, },
// 模板1的提成方式改变 , 需要清空当个模板1的table中, 对应的商品的值
clearParamsType1ProductValue(state, { params1Index, row }) {
const params1Table = state.formData.paramConfigList[params1Index].ParamsType1Products;
if (isArray(params1Table) && params1Table.length) {
params1Table.forEach((item, index) => {
item.productValue[row] = undefined;
});
}
},
}, },
actions: { actions: {
// 设置提成方式的下拉框选项
setCommissionTypesOptions({ state, commit }, options) {
state.commissionTypesOptions = options.map((item, index) => ({
label: commissionTypeEnum[item].label,
value: commissionTypeEnum[item].value,
}));
// 清空下方表格所有提成方式的值
if (isArray(state.formData.paramConfigList)) {
for (const [tableIndex, table] of state.formData.paramConfigList.entries()) {
if (table.templateType === "ParamsType1" && isArray(table.ParamsType1)) {
for (const [rowIndex, rowItem] of table.ParamsType1.entries()) {
if (!options.includes(rowItem.commissionTypes)) {
// 清空设置的值
rowItem.commissionTypes = undefined;
commit("clearParamsType1ProductValue", { params1Index: tableIndex, row: rowIndex });
}
}
}
if (table.templateType === "ParamsType2") {
if (!options.includes(table.ParamsType2CommissionTypes)) {
table.ParamsType2CommissionTypes = undefined;
commit("clearParamsType2Condition", tableIndex);
}
}
}
}
},
setFormField({ commit }, payload) { setFormField({ commit }, payload) {
commit("updateFormField", payload); commit("updateFormField", payload);
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!