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

fix: 修复请购单bug

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