import { updateUnitPriceExcludingTax, updateUnitPriceTax } from '../../ui/default/GoodsList/hook/useColumns/autoFillFn'; import { InvoiceControllerState, IGood } from '../'; /** * 项目名称智能赋码 */ export default async (s: InvoiceControllerState, record: any, controller:any) => { Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] }); // 没用 被编辑的货物 和 form 就退出 if (!s.goodsListState.editGood || !s.goodsListState.form) return; // 中间数据 const between: any = {...record }; between.taxClassificationCode = record.taxClassificationCode; between.shorthand = record.shorthand; // 设置编辑货物 const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between }; // 导入FORM里 if (s.goodsListState.isMyShow) { s.goodsListState.form.setFieldsValue({ ...editGood, itemName: editGood.itemNameSelf, itemModelName: editGood.itemModelNameSelf, }); } else { s.goodsListState.form.setFieldsValue({ ...editGood, }); } s.goodsListState.isTaxIncluded ? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record) : await updateUnitPriceTax(controller, s.goodsListState.form, record) }