Commit ad97a337 authored by rainbowmorel@163.com's avatar rainbowmorel@163.com

修改页面问题

parent e4470521
import { useState } from "react";
import { Prompt, useIntl } from "umi";
export default function usePrompt() {
const [isFormChange, setIsFormChange] = useState<boolean>(false);
const intl = useIntl()
const renderPrompt = () => {
return (
<Prompt when={isFormChange} message={intl.formatMessage({ id: 'common.tip.save.confirm' })} />
)
}
const handleLeave = () => {
setIsFormChange(true)
}
return {
handleLeave,
renderPrompt
}
}
......@@ -24,10 +24,12 @@ import { addrFormatValue } from '../../assets/format/addrValue';
import DeliveryGoodTableSelectB2B from '../../components/DeliveryGoodTableSelect/DeliveryGoodTableSelectB2B';
import { PATTERN_MAPS } from '@/constants/regExp';
import { size } from 'lodash';
import usePrompt from '@/hooks/usePrompt';
const DeliveryNoticeManageSRMDetails: React.FC = () => {
const [tableDataSource, setTableDataSource] = useState<any[]>();
const { renderPrompt, handleLeave } = usePrompt()
const [form] = Form.useForm()
const service = new ReceivingNoteB2BAddService(form);
......@@ -88,8 +90,9 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
>
<Form
form={form}
onValuesChange={() => { handleLeave() }}
>
<FormItem name="sourceType">
<FormItem hidden name="sourceType">
<Input type="hidden" />
</FormItem>
......@@ -285,7 +288,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
]}
dataSource={tableDataSource}
pagination={{
size:"small"
size: "small"
}}
/>
</HarvestMaterialContextProvider>
......@@ -293,7 +296,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
</ContentBox>
</Form>
{renderPrompt()}
</AnchorPage>
)
}
......
......@@ -120,15 +120,15 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<ContentBoxItem label={DeliverySlefAddrLabel}>
<div>
{info?.receiveVO?.provinceName??''}
{info?.receiveVO?.cityName??''}
{info?.receiveVO?.districtName??''}
{info?.receiveVO?.streetName??''}
{info?.receiveVO?.address??''}
{info?.receiverBO?.provinceName??''}
{info?.receiverBO?.cityName??''}
{info?.receiverBO?.districtName??''}
{info?.receiverBO?.streetName??''}
{info?.receiverBO?.address??''}
</div>
<div>
{info?.receiveVO.phone}
{info?.receiveVO.consignee}
{info?.receiverBO?.phone}
{info?.receiverBO?.consignee}
</div>
</ContentBoxItem>
......
......@@ -24,6 +24,7 @@ import { useLocation } from 'umi';
import { DeliveryNumColumn } from '../../constants/table-column';
import { addrFormatValue } from '../../assets/format/addrValue';
import { PATTERN_MAPS } from '@/constants/regExp';
import usePrompt from '@/hooks/usePrompt';
const ContentBoxItem = ContentBox.BaseInfoItem;
......@@ -32,6 +33,7 @@ const DeliveryNoticeManageSRMEdit: React.FC = () => {
const [tableDataSource, setTableDataSource] = useState<any>([]);
const [outerHistoryList, setOuterHistoryList] = useState<any>([]);
const { renderPrompt, handleLeave } = usePrompt()
const location: any = useLocation()
const { id } = location.query
......@@ -90,8 +92,10 @@ const DeliveryNoticeManageSRMEdit: React.FC = () => {
</Button.Group>
}
>
{renderPrompt()}
<Form
form={form}
onValuesChange={() => handleLeave()}
>
<FormItem hidden name="sourceType">
<Input type="hidden" />
......@@ -156,11 +160,11 @@ const DeliveryNoticeManageSRMEdit: React.FC = () => {
</FormItem>
<FormItem
rules={[
required('请出入正确的手机号'),
{pattern:PATTERN_MAPS.phone,message:"手机号是否正确"}
]}
label={DeliveryPhoneLabel} name="executorVO.phone">
rules={[
required('请出入正确的手机号'),
{ pattern: PATTERN_MAPS.phone, message: "手机号是否正确" }
]}
label={DeliveryPhoneLabel} name="executorVO.phone">
<Input />
</FormItem>
</ContentBox>
......
......@@ -26,6 +26,7 @@ import { DeliveryNumColumn, OrderNumColumn } from '../../constants/table-column'
import { addrFormatValue } from '../../assets/format/addrValue';
import DeliveryGoodTableSelectSRM from '../../components/DeliveryGoodTableSelect/DeliveryGoodTableSelectSRM';
import { PATTERN_MAPS } from '@/constants/regExp';
import usePrompt from '@/hooks/usePrompt';
const ContentBoxItem = ContentBox.BaseInfoItem;
......@@ -33,6 +34,8 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
const [tableDataSource, setTableDataSource] = useState();
const { renderPrompt, handleLeave } = usePrompt()
const [form] = Form.useForm()
const service = new DeliveryNoteAddService(form);
......@@ -86,6 +89,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
>
<Form
form={form}
onValuesChange={()=>{handleLeave()}}
>
<FormItem name="sourceType">
<Input type="hidden" />
......@@ -275,7 +279,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
</ContentBox>
</Form>
{renderPrompt()}
</AnchorPage>
)
......
......@@ -122,15 +122,15 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<ContentBoxItem label={DeliveryAddrLabel}>
<div>
{info?.receiveVO?.provinceName ?? ''}
{info?.receiveVO?.cityName ?? ''}
{info?.receiveVO?.districtName ?? ''}
{info?.receiveVO?.streetName ?? ''}
{info?.receiveVO?.address ?? ''}
{info?.receiverBO?.provinceName ?? ''}
{info?.receiverBO?.cityName ?? ''}
{info?.receiverBO?.districtName ?? ''}
{info?.receiverBO?.streetName ?? ''}
{info?.receiverBO?.address ?? ''}
</div>
<div>
{info?.receiveVO.phone}
{info?.receiveVO.consignee}
{info?.receiverBO?.phone}
{info?.receiverBO?.consignee}
</div>
</ContentBoxItem>
......
......@@ -25,6 +25,7 @@ import { useLocation } from 'umi';
import { DeliveryNumColumn } from '../../constants/table-column';
import { addrFormatValue } from '../../assets/format/addrValue';
import { PATTERN_MAPS } from '@/constants/regExp';
import usePrompt from '@/hooks/usePrompt';
const ContentBoxItem = ContentBox.BaseInfoItem;
......@@ -36,6 +37,8 @@ const DeliveryNoticeManageSRMEdit: React.FC = () => {
const location: any = useLocation()
const { id } = location.query
const { renderPrompt, handleLeave } = usePrompt()
const [form] = Form.useForm()
const service = new DeliveryNoteUploadService(form);
......@@ -91,8 +94,10 @@ const DeliveryNoticeManageSRMEdit: React.FC = () => {
</Button.Group>
}
>
{renderPrompt()}
<Form
form={form}
onValuesChange={() => handleLeave()}
>
<FormItem hidden name="sourceType">
<Input type="hidden" />
......
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