Commit 9729e798 authored by XieZhiXiong's avatar XieZhiXiong

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

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