Commit 9729e798 authored by XieZhiXiong's avatar XieZhiXiong

取消货品联动,货品选择只做新增操作

parent 42e2522f
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-23 16:00:01
* @LastEditTime: 2020-11-20 16:25:08
* @Description: 联动逻辑相关
*/
import { Modal } from 'antd';
......
......@@ -179,9 +179,6 @@ const BillsForm: React.FC<BillsFormProps> = ({
invoicesDetailsRequests: details,
...rest,
});
productRowCtl.setSelectRow(details);
productRowCtl.setSelectedRowKeys(details.map(item => item.id));
}).finally(() => {
setInfoLoading(false);
});
......@@ -537,29 +534,27 @@ const BillsForm: React.FC<BillsFormProps> = ({
const values = [];
productRowCtl.selectRow.forEach(item => {
const existing = preValues.find(val => val.goodsId === item.id);
const atom =
existing ?
existing :
{
itemNo: item.code,
goodsId: item.id,
itemNmae: item.name,
specifications: item.type,
category: item.customerCategory ? item.customerCategory.name : '',
brand: item.brand ? item.brand.name : '',
unit: item.unitName,
costPrice: item.costPrice,
product: undefined,
productName: item.productName,
productId: '',
price: '',
productCount: 0,
amount: '',
};
const atom = {
itemNo: item.code,
goodsId: item.id,
itemNmae: item.name,
specifications: item.type,
category: item.customerCategory ? item.customerCategory.name : '',
brand: item.brand ? item.brand.name : '',
unit: item.unitName,
costPrice: item.costPrice,
product: undefined,
productName: item.productName,
productId: '',
price: '',
productCount: 0,
amount: '',
};
values.push(atom);
});
addSchemaAction.setFieldValue('invoicesDetailsRequests', values);
addSchemaAction.setFieldValue('invoicesDetailsRequests', preValues.concat(values));
productRowCtl.setSelectRow([]);
productRowCtl.setSelectedRowKeys([]);
setVisible(false);
}
......@@ -575,15 +570,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
}
const handleRemoveItem = (index: number) => {
const newSelectRow = [...productRowCtl.selectRow];
const newSelectedRowKeys = [...productRowCtl.selectedRowKeys];
const newValue = [...addSchemaAction.getFieldValue('invoicesDetailsRequests')];
newSelectRow.splice(index, 1);
newSelectedRowKeys.splice(index, 1);
productRowCtl.setSelectRow(newSelectRow);
productRowCtl.setSelectedRowKeys(newSelectedRowKeys);
newValue.splice(index, 1);
addSchemaAction.setFieldValue('invoicesDetailsRequests', newValue);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment