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

fix: 修复请购单bug

parent f1d24910
......@@ -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;
// 先把全部按钮打开
......
......@@ -22,7 +22,7 @@ const AuthButton = (props: AuthButtonProps) => {
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)
const _authorityBtn = () => {
// 本地开发时直接开放权限
if (process.env.NODE_ENV === "development") return true
......
......@@ -42,7 +42,11 @@ const ContractDrawer: React.FC<ContractDrawerProps> = (props: ContractDrawerProp
title: intl.formatMessage({ id: 'balance.businessRequestFunds.components.contractDrawer.columns.billAbstract' }),
key: 'billAbstract',
dataIndex: 'billAbstract',
}, {
},{
title: "付款方式",
key: 'paymentTypeName',
dataIndex: 'paymentTypeName',
}, {
title: intl.formatMessage({ id: 'balance.businessRequestFunds.components.contractDrawer.columns.billTime' }),
key: 'billTime',
dataIndex: 'billTime',
......
......@@ -66,15 +66,21 @@ const EditSalesman: React.FC<MemberModalTableProps> = (props) => {
}
useEffect(() => {
if (record?.requisitionSalesManReqs) {
console.log(record)
if (record?.requisitionSalesManReqs && visible) {
form.setFieldsValue({ requisitionSalesManReqs: record?.requisitionSalesManReqs })
}
}, [record])
}, [visible])
const handleCancel = () => {
setVisible(false)
form.resetFields(['requisitionSalesManReqs'])
}
const renderFooter = () => {
return (
<div style={{ textAlign: 'right' }}>
<Button style={{ marginRight: 8 }} onClick={() => setVisible(false)}>
<Button style={{ marginRight: 8 }} onClick={() => handleCancel()}>
{intl.formatMessage({ id: 'transaction_components.quxiao' })}
</Button>
<Button type="primary" onClick={handleSubmit}>
......@@ -87,16 +93,33 @@ const EditSalesman: React.FC<MemberModalTableProps> = (props) => {
const otherProps = { footer: !preview ? renderFooter() : null }
const handleFormList = () => {
// const handleFormList = () => {
// const pattern = /^[1-9]\d*$/;
// let totalPrice = 0;
// let purchaseQuantity = 0;
// const requisitionSalesManReqs = form.getFieldValue(`requisitionSalesManReqs`);
// requisitionSalesManReqs.forEach((_item, _index) => {
// totalPrice += (pattern.test(_item?.purchaseQuantity) ? Number(_item?.purchaseQuantity) : 0);
// purchaseQuantity = (pattern.test((record?.quantity - totalPrice).toString()) ? (record?.quantity - totalPrice) : 0);
// })
// Object.assign(requisitionSalesManReqs[requisitionSalesManReqs.length - 1], { purchaseQuantity: pattern.test(purchaseQuantity.toString()) ? purchaseQuantity : 0 })
// form.setFieldsValue({ requisitionSalesManReqs })
// }
const handleTotal = () => {
const pattern = /^[1-9]\d*$/;
let totalPrice = 0;
let purchaseQuantity = 0;
const requisitionSalesManReqs = form.getFieldValue(`requisitionSalesManReqs`);
requisitionSalesManReqs.forEach((_item, _index) => {
totalPrice += (pattern.test(_item?.purchaseQuantity) ? Number(_item?.purchaseQuantity) : 0);
purchaseQuantity = (pattern.test((record?.quantity - totalPrice).toString()) ? (record?.quantity - totalPrice) : 0);
if (requisitionSalesManReqs.length === 1 || _index !== (requisitionSalesManReqs.length - 1)) {
totalPrice += (pattern.test(_item?.purchaseQuantity) ? Number(_item?.purchaseQuantity) : 0);
purchaseQuantity = (pattern.test((record?.quantity - totalPrice).toString()) ? (record?.quantity - totalPrice) : 0);
}
})
Object.assign(requisitionSalesManReqs[requisitionSalesManReqs.length - 1], { purchaseQuantity: pattern.test(purchaseQuantity.toString()) ? purchaseQuantity : 0 })
if (requisitionSalesManReqs.length > 1) {
Object.assign(requisitionSalesManReqs[requisitionSalesManReqs.length - 1], { purchaseQuantity: pattern.test(purchaseQuantity.toString()) ? purchaseQuantity : 0 })
}
form.setFieldsValue({ requisitionSalesManReqs })
}
......@@ -106,7 +129,7 @@ const EditSalesman: React.FC<MemberModalTableProps> = (props) => {
title='编辑业务员'
visible={visible}
width={900}
onCancel={() => setVisible(false)}
onCancel={() => handleCancel()}
onOk={handleSubmit}
{...otherProps}
>
......@@ -164,7 +187,6 @@ const EditSalesman: React.FC<MemberModalTableProps> = (props) => {
requisitionSalesManReqs.forEach(_item => {
totalPrice += (pattern.test(_item?.purchaseQuantity) ? Number(_item?.purchaseQuantity) : 0)
})
console.log(totalPrice, 'totalPrice')
if (!pattern.test(value)) {
return Promise.reject(new Error('采购数量必须大于0,仅限三位小数'))
}
......@@ -176,7 +198,7 @@ const EditSalesman: React.FC<MemberModalTableProps> = (props) => {
},
]}
>
<Input placeholder='请输入' disabled={((fields.length > 1 && (fields.length - 1 === _index) && !preview) || preview) ? true : false} />
<Input onChange={() => handleTotal()} placeholder='请输入' disabled={((fields.length > 1 && (fields.length - 1 === _index) && !preview) || preview) ? true : false} />
</Form.Item>
</Col>
{(fields.length > 1 && !preview) ? (
......@@ -194,7 +216,7 @@ const EditSalesman: React.FC<MemberModalTableProps> = (props) => {
<Form.Item>
<Button type="dashed" onClick={() => {
add({ userId: null, name: null, purchaseQuantity: null })
handleFormList()
handleTotal()
}} block icon={<PlusOutlined />}>
添加
</Button>
......
......@@ -394,8 +394,8 @@ const IncreaseRequisition: React.FC<{}> = () => {
const onChangeAddress = (res) => {
if (res.values[1]?.title === "物流") {
console.log(res, '10086')
if (res.values[1]?.value === 1) {
const list = deliveryTypeListRef.current.deliveryTypeList.map(item => { return { ...item, disabled: item.disabled = item.deliveryTypeName == '直送客户' ? false : true } })
addSchemaAction.setFieldState('deliveryAddress', state => {
state.visible = false;
......
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