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

Merge branch '0518' into 'jinfa-0518'

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