Commit 6c1d9e21 authored by 前端-许佳敏's avatar 前端-许佳敏

111

parent d917c071
...@@ -131,23 +131,32 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn ...@@ -131,23 +131,32 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
// 从商城跳转, 需回显数据 // 从商城跳转, 需回显数据
if (initValue) { if (initValue) {
const productInfo = initValue.orderList[0].orderList const fn = async () => {
ctx.setFieldValue('supplyMembersId', initValue.supplyMembersId) const productInfo = initValue.orderList[0].orderList
ctx.setFieldValue('supplyMembersName', initValue.supplyMembersName) ctx.setFieldValue('supplyMembersId', initValue.supplyMembersId)
ctx.setFieldValue('supplyMembersName', initValue.supplyMembersName)
ctx.setFieldValue('orderProductRequests', await filterProductDataById([], productInfo.map(v => {
return { ctx.setFieldValue('orderProductRequests', await filterProductDataById([], productInfo.map(v => {
...v, return {
unitPrice: v.priceRange.reduce((prev, next) => { ...v,
prev[next.range] = next.price unitPrice: v.priceRange.reduce((prev, next) => {
return prev prev[next.range] = next.price
}, {}), return prev
isMemberPrice: !!v.memberDiscount, }, {}),
purchaseCount: v.count, isMemberPrice: !!v.memberDiscount,
money: v.count * v.unitPrice, purchaseCount: v.count,
productId: v.id money: v.count * v.unitPrice,
} productId: v.id
}))) }
})))
}
// 回显的数据保存在表单中, 当切换下单模式时,可以再次回显
ctx.setFormState(state => {
state.remoteDataFn = fn
})
fn()
} }
// 写入收货地址数据 // 写入收货地址数据
......
...@@ -278,7 +278,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -278,7 +278,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
<NiceForm <NiceForm
loading={formLoading} loading={formLoading}
previewPlaceholder=' ' previewPlaceholder=' '
editable={pageStatus !== PageStatus.PREVIEW} // editable={pageStatus !== PageStatus.PREVIEW}
value={initFormValue} value={initFormValue}
actions={addSchemaAction} actions={addSchemaAction}
schema={mergeAllSchemas[page_type]} schema={mergeAllSchemas[page_type]}
...@@ -293,9 +293,14 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -293,9 +293,14 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
setProductSumPrice(payload) setProductSumPrice(payload)
}) })
$('onFieldInputChange', 'orderModel').subscribe(state => { $('onFieldInputChange', 'orderModel').subscribe(state => {
const { editable } = state const { editable, value } = state
// 手动切换过下单模式, 需重置受下单模式影响的字段 // 手动切换过下单模式, 需重置受下单模式影响的字段
if (editable) { if (editable) {
if (value === OrderModalType.PURCHASE_ORDER) {
// 进货单下单,尝试回显保存的数据
console.log(state)
return ;
}
ctx.reset({ ctx.reset({
validate: false, validate: false,
selector: '*(quotationNo,supplyMembersName,orderProductRequests)' selector: '*(quotationNo,supplyMembersName,orderProductRequests)'
......
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