Commit 4554d541 authored by 前端-许佳敏's avatar 前端-许佳敏

fix:商城跳转的订单,加入回显数据,传多一个roleId参数

parent 840d2089
......@@ -131,9 +131,10 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
// 从商城跳转, 需回显数据
if (initValue) {
const fn = async () => {
const fn = async (initValue) => {
const productInfo = initValue.orderList[0].orderList
ctx.setFieldValue('supplyMembersId', initValue.supplyMembersId)
ctx.setFieldValue('supplyMembersRoleId', initValue.supplyMembersRoleId)
ctx.setFieldValue('supplyMembersName', initValue.supplyMembersName)
ctx.setFieldValue('orderProductRequests', await filterProductDataById([], productInfo.map(v => {
......@@ -152,11 +153,14 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
}
// 回显的数据保存在表单中, 当切换下单模式时,可以再次回显
ctx.setFormState(state => {
ctx.setFieldState('orderModel', state => {
state.remoteDataFn = fn
})
// ctx.setFormState(state => {
// state.remoteDataFn = fn
// })
fn()
fn(initValue)
}
// 写入收货地址数据
......
......@@ -100,6 +100,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
// 采购订单详情页. 包含新增和编辑
const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const shopDataRef = useRef<any>({})
const memberRef = useRef<any>({})
const inquiryRef = useRef<any>({})
const demandRef = useRef<any>({})
......@@ -145,6 +146,17 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
setFormLoading(false)
})
}
if (modelType) {
shopDataRef.current.orderModel = parseInt(modelType)
}
// 订单数据
if (spam_id) {
const item = JSON.parse(window.sessionStorage.getItem(spam_id))
if (item) {
shopDataRef.current = Object.assign({}, shopDataRef.current, item)
}
}
}, [])
const handleSubmit = async (value) => {
......@@ -298,7 +310,10 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
if (editable) {
if (value === OrderModalType.PURCHASE_ORDER) {
// 进货单下单,尝试回显保存的数据
console.log(state)
console.log(shopDataRef.current)
// 初始化时绑定加载进货单数据的函数
state.remoteDataFn(shopDataRef.current)
return ;
}
ctx.reset({
......
......@@ -172,6 +172,10 @@ const basicInfo: ISchema = {
type: 'string',
display: false
},
supplyMembersRoleId: {
type: 'string',
display: false
},
orderNo: {
type: 'string',
title: '订单编号',
......
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