1) 增加商品范围删除联动

This commit is contained in:
zhangds 2022-09-07 12:08:59 +08:00
parent 16dce65170
commit 7a215ea249
2 changed files with 18 additions and 8 deletions

View File

@ -387,22 +387,19 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
};
const selectionFun = (e) => {
console.log("e =>", e);
let arr = [];
_.map(e, (res) => {
let obj = {};
obj.key = res.only;
obj.key = res;
obj.text = res.product_name;
arr.push(obj);
return obj;
});
console.log("选中 =>", arr);
setState({ rank: arr });
};
const onRankChange = (e) => {
console.log("e =>", e);
let new_table_data = state.tableData.map((item) => {
item.checked =
e.findIndex((checks) => {
@ -410,7 +407,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
}) > -1;
return item;
});
console.log("new_table_data =>", new_table_data);
setState({ tableData: new_table_data, rank: e });
};
@ -444,10 +440,24 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
//
const deleteGoodsScope = (index) => {
console.log(index);
let new_table = state.tableData;
if (index === 0) {
new_table = [];
} else {
new_table = new_table.splice(index, 1);
}
let select_opt = [];
new_table.map((item) => {
let obj = {};
obj.key = item; //
obj.text = item.product_name;
select_opt.push(obj);
});
selectionFun(new_table);
setState({
tableData: new_table,
rankoptions: select_opt,
});
};

View File

@ -31,7 +31,7 @@ const UseGoodsScopePop = forwardRef((props, ref) => {
const format_knockGold_model = () => {
let form_model = knockGold_el.current.state.model;
let table_obj = {};
table_obj.old = form_model; //
table_obj.only = form_model; //
table_obj.product_id = "-"; //
table_obj.product_name = form_model.batch_goods_name; //