Commit d368b364 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

fix: 修复请购单bug

parent 9b63e2bc
......@@ -47,7 +47,7 @@ export const purchaseRequisitionRoute = [
},
// 待新增请购单-编辑请购单
{
path: '/memberCenter/tranactionAbility/purchaseRequisition/readyAddBill/edit',
path: '/memberCenter/procurementAbility/purchaseRequisition/readyAddBill/edit',
name: '待新增请购单-编辑请购单',
component: '@/pages/transaction/purchaseRequisition/increaseRequisition',
hideInMenu: true,
......
......@@ -3,7 +3,7 @@ import { getAuth } from "@/utils/auth";
export const AuthUrl = (btnCode: string) => {
const { auth } = getAuth()
const { pathname } = new URL(window.location.href);
const RoutesAuth = auth?.filter((item: any) => item?.u === pathname)
const RoutesAuth = auth?.filter((item: any) => item?.u === pathname) || []
// 默认 让所以按钮权限 打开
// return true;
// 先把全部按钮打开
......
......@@ -201,7 +201,7 @@ const BidMaterial: React.FC<BidMaterialProps> = ({ cardTitle }) => {
<div className={style.childrenContent}>
<p><span>{intl.formatMessage({ id: 'purchaseRequisition.guigexinghao', defaultMessage: '规格型号' })}:</span>{record.spec}</p>
<p><span>{intl.formatMessage({ id: 'purchaseRequisition.pinlei', defaultMessage: '品类' })}:</span>{record.category}</p>
<p><span>物料编号:</span>{record.globalMQID}</p>
<p><span>物料编号:</span>{record.productNo}</p>
<p><span>托规格(托):</span>{record.palmSpec}KG/包</p>
<p><span>柜/车规格:</span>{record.cabinetSpec}吨/柜</p>
</div>
......
......@@ -142,7 +142,7 @@ const MaterialModalTable: React.FC<MaterialModalTableProps> = (props) => {
temp.name = v.name; // 物料名称
temp.category = v?.customerCategory?.name || v?.category || null; // 物料品类
temp.brand = v?.brand?.name || v?.brand || null; // 物料品牌
temp.spec = v.type; // 物料规格
temp.type = v.type; // 物料规格
temp.unit = v?.unitName || v?.unit || null; //计价单位
// temp.price = v?.price; // 物料价格
// temp.stock = v?.stock; // 供方库存
......@@ -174,6 +174,7 @@ const MaterialModalTable: React.FC<MaterialModalTableProps> = (props) => {
tempOriginData.push(item)
}
})
console.log(tempOriginData, 'tempOriginData')
return tempOriginData
}
}
......@@ -181,6 +182,7 @@ const MaterialModalTable: React.FC<MaterialModalTableProps> = (props) => {
const handleConfirm = async () => {
const materialData = schemaAction.getFieldValue('products')
schemaAction.setFieldValue('products', addMaterialProcessField(rowSelectionCtl.selectRow, materialData))
console.log(addMaterialProcessField(rowSelectionCtl.selectRow, materialData))
confirmModal && confirmModal()
setVisible(false)
clearModalParams()
......
......@@ -33,6 +33,18 @@ import EditSalesman from './components/editSalesman'
import { useLinkageUtils } from '@/utils/formEffectUtils'
import { getPurchaseRequisitionSrmGetEnumsData } from '@/services/PurchaseV2Api'
/** 配送 */
const SUPPLY = 1
/** 自提 */
const PICK_UP = 2
/** 客户自提 */
const ClIENT_PICK_UP = 3
/** 供应商直发 */
const SUPPLIER_DIRECT = 4
const {
onFormMount$,
} = FormEffectHooks;
......@@ -54,7 +66,6 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
const intl = useIntl()
const { form } = useFormSpy({ selector: [['onFieldValueChange', 'products']], reducer: v => v })
const data = form.getFieldValue('products')
console.log(data, 'data')
const sum = data ? data.reduce((prev, next) => (prev * 1000 + (next.amount || 0) * 1000) / 1000, 0) : 0
const total = data ? data.reduce((prev, next) => (prev * 1000 + (next.quantity || 0) * 1000) / 1000, 0) : 0
......@@ -108,16 +119,16 @@ const IncreaseRequisition: React.FC<{}> = () => {
// state.visible = data.deliveryMethod != 1 || data.deliveryType == 1 ? true : false;
});
if (data.deliveryMethod === 1) {
deliveryTypeListRef.current.deliveryTypeList = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: item.disabled = item.deliveryTypeName == '直送客户' ? false : true } })
console.log(deliveryTypeListRef.current.deliveryTypeList)
// if (data.deliveryMethod === 1) {
// deliveryTypeListRef.current.deliveryTypeList = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: item.disabled = item.deliveryTypeName == '直送客户' ? false : true } })
// console.log(deliveryTypeListRef.current.deliveryTypeList)
}
if (data.deliveryMethod == 2) {
deliveryTypeListRef.current.deliveryTypeList = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: item.disabled = item.deliveryTypeName == '直送客户' ? true : false } })
// }
// if (data.deliveryMethod == 2) {
// deliveryTypeListRef.current.deliveryTypeList = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: item.disabled = item.deliveryTypeName == '直送客户' ? true : false } })
}
// }
addSchemaAction.setFieldState('deliveryType', state => {
......@@ -138,6 +149,9 @@ const IncreaseRequisition: React.FC<{}> = () => {
attachmentsRef.current.attachments = data.attachments;
setInitFormValue(() => procurmentRenderInit(data))
setTimeout(() => {
addSchemaAction.setFieldValue('currency', (data.currency).toString())
addSchemaAction.setFieldValue('business', (data.businessType).toString())
addSchemaAction.setFieldValue('arrivalArea', (data.arrivalArea).toString())
addSchemaAction.setFieldValue('products', _orderProductRequests)
addSchemaAction.setFieldValue('attachments', data.attachments)
addSchemaAction.setFieldValue('deliveryAddressId', data.receiverAddressResponse)
......@@ -156,9 +170,7 @@ const IncreaseRequisition: React.FC<{}> = () => {
addSchemaAction.setFieldValue('vendorMemberName', userInfo.orgName || '')
addSchemaAction.setFieldValue('deliveryType', userInfo.orgId || '')
}
}
}, [])
const setLik = (row) => {
......@@ -179,7 +191,6 @@ const IncreaseRequisition: React.FC<{}> = () => {
let fnResult = null
// 新增订单/编辑订单
const params = { ...value }
console.log(value)
if (formContext.innerFormErrors) {
throw new Error(intl.formatMessage({ id: 'purchaseRequisition.qingwanshandingdan', defaultMessage: '请完善订单物料数据' }))
}
......@@ -197,11 +208,9 @@ const IncreaseRequisition: React.FC<{}> = () => {
setBtnLoading(true)
const _params = procurementProcessField(params)
console.log(_params)
if (_params.deliveryAddressId) {
_params.deliveryAddressId = _params.deliveryAddressId.id;
}
console.log(_params, '_params')
if (id) {
fnResult = await postPurchaseRequisitionUpdate({ ..._params, id })
} else {
......@@ -217,7 +226,6 @@ const IncreaseRequisition: React.FC<{}> = () => {
} catch (error) {
setBtnLoading(false)
error?.message && message.error(error.message)
console.log(error)
}
}
......@@ -337,14 +345,12 @@ const IncreaseRequisition: React.FC<{}> = () => {
list.map((item: any) => {
arr.push({ label: item.name, value: item.id })
})
console.log(arr, 'arr');
enclosureRef.current.list = [...arr];
await constructedCallback()
}
useEffect(() => {
console.log(enclosureRef.current)
constructedCallback()
}, [enclosureRef.current])
......@@ -394,8 +400,7 @@ const IncreaseRequisition: React.FC<{}> = () => {
const onChangeAddress = (res) => {
console.log(res, '10086')
if (res.values[1]?.value === 1) {
if (res.values[1]?.value === SUPPLY || res.values[1]?.value === SUPPLIER_DIRECT) {
const list = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: item.disabled = item.deliveryTypeName == '直送客户' ? false : true } })
addSchemaAction.setFieldState('deliveryAddress', state => {
state.visible = false;
......@@ -411,7 +416,7 @@ const IncreaseRequisition: React.FC<{}> = () => {
state.visible = true;
});
return;
} if (res.values[1]?.title === "自提") {
} if (res.values[1]?.value === PICK_UP) {
const list = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: item.disabled = item.deliveryTypeName == '直送客户' ? true : false } })
addSchemaAction.setFieldState('deliveryType', state => {
state.visible = true;
......@@ -423,7 +428,7 @@ const IncreaseRequisition: React.FC<{}> = () => {
state.visible = false;
});
return;
} if (res.values[1]?.title === "无需配送") {
} if (res.values[1]?.value === ClIENT_PICK_UP) {
const list = deliveryTypeListRef.current.deliveryTypeList && deliveryTypeListRef.current?.deliveryTypeList.map(item => { return { ...item, disabled: true } })
addSchemaAction.setFieldState('deliveryType', state => {
state.props["x-component-props"].list = list
......@@ -507,11 +512,16 @@ const IncreaseRequisition: React.FC<{}> = () => {
formContext.useAttachmentChangeForContext(ctx)
$('onFieldChange', 'deliveryMethod').subscribe(res => {
console.log(res);
onChangeAddress(res)
})
$('onFieldInputChange', 'deliveryAddressId').subscribe(state => {
let deliveryAddress = state?.value?.fullAddress ?
`${state?.value?.name}${state?.value?.fullAddress}${state?.value?.phone}` :
`${state?.value?.name}${state?.value?.provinceName}${state?.value?.cityName}${state?.value?.districtName}${state?.value?.streetName}${state?.value?.address}${state?.value?.phone}`;
ctx.setFieldValue('deliveryAddress', deliveryAddress )
})
}}
expressionScope={{
memberBtn,
......
......@@ -130,9 +130,9 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
</Col>
<Col span={6}>
<div className={style.childrenContent}>
<p><span>{intl.formatMessage({ id: 'purchaseRequisition.guigexinghao', defaultMessage: '规格型号' })}:</span>{record.spec}</p>
<p><span>{intl.formatMessage({ id: 'purchaseRequisition.guigexinghao', defaultMessage: '规格型号' })}:</span>{record.type}</p>
<p><span>{intl.formatMessage({ id: 'purchaseRequisition.pinlei', defaultMessage: '品类' })}:</span>{record.category}</p>
<p><span>物料编号:</span>{record.globalMQID}</p>
<p><span>物料编号:</span>{record.code}</p>
<p><span>托规格(托):</span>{record.palmSpec}KG/包</p>
<p><span>柜/车规格:</span>{record.cabinetSpec}吨/柜</p>
</div>
......
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