Commit 444b8b50 authored by rainbowmorel@163.com's avatar rainbowmorel@163.com

选择物料 逻辑修改

parent 13deed51
......@@ -84,9 +84,9 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
}, [form, tableDataSourceContext])
const handleRemoveMaterialTableRow = (i: number) => {
const source: any[] = JSON.parse(JSON.stringify(tableDataSource));
const source: any[] = JSON.parse(JSON.stringify(tableDataSourceContext));
source.splice(i, 1);
let atpm = JSON.parse(JSON.stringify(anchors));
atpm.pop()
......@@ -203,6 +203,7 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
label={ReceivingAddress} name="receiveVO">
<ReceiverAddress
disabled={true}
hiddenBtn={true}
/>
</FormItem>
......@@ -255,38 +256,45 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<ContentBox title={DeliveryGood.name} id={DeliveryGood.key} cols={1}>
{/* 在编辑的时候不需要进行此操作 */}
<DeliveryGoodTableSelectB2B
value={tableDataSource}
form={form}
onChange={(value) => {
if (value.length > 0) {
let addr = {
provinceName: value[0].provinceName,
cityName: value[0].cityName,
districtName: value[0].districtName,
streetName: value[0].streetName,
address: value[0].address,
phone: value[0].phone,
consignee: value[0].consignee,
receiverName: value[0].consignee,
fullAddress: `${value[0].provinceName}${value[0].cityName}${value[0].districtName}${value[0].streetName}${value[0].address}`
}
form.setFieldsValue({
'receiveVO': addr
})
}
let atpm = JSON.parse(JSON.stringify(anchors));
atpm.pop()
const ft = formatTable(value);
setAnchors([
...atpm,
{
...DeliveryGood,
name: `${DeliveryGood.name}(${value.length})`
name: `${DeliveryGood.name}(${ft.length})`
}
])
if (ft.length > 0) {
let addr = {
provinceName: ft[0].provinceName,
cityName: ft[0].cityName,
districtName: ft[0].districtName,
streetName: ft[0].streetName,
address: ft[0].address,
phone: ft[0].phone,
consignee: ft[0].consignee,
receiverName: ft[0].consignee,
fullAddress: `${ft[0].provinceName}${ft[0].cityName}${ft[0].districtName}${ft[0].streetName}${ft[0].address}`
}
form.setFieldsValue({
'receiveVO': addr
})
}
setTableDataSource(value)
setTableDataSourceContext(formatTable(value))
setTableDataSourceContext(ft)
}}
/>
......
......@@ -180,7 +180,6 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
<FormItem
label={ReceivingAddress} name="receiveVO">
<ReceiverAddress
disabled={true}
hiddenBtn={true}
/>
......@@ -244,18 +243,10 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
form={form}
onChange={(value) => {
let atpm = JSON.parse(JSON.stringify(anchors));
atpm.pop()
setAnchors([
...atpm,
{
...Material,
name: `${Material.name}(${value.length})`
}
])
const ft = formatTable(value)
if (ft.length > 0) {
......@@ -275,6 +266,14 @@ const DeliveryNoticeManageSRMDetails: React.FC = () => {
})
}
setAnchors([
...atpm,
{
...Material,
name: `${Material.name}(${ft.length})`
}
])
setTableDataSource(value)
setTableDataSourceContext(ft)
}}
......
......@@ -21,6 +21,7 @@ import usePrompt from '@/hooks/usePrompt'
import FormProgress, { HandleType } from '@/components/FormProgress'
import { getMemberManageBuyerMember } from '@/services/MemberV2Api'
import { validatorByte } from '@/utils/regExp'
import { formatTable, formMapData } from '@/pages/order/components/DeliveryGoodTableSelect/useformatTable'
type PropsType = {
type: 'add' | 'edit';
......@@ -56,13 +57,19 @@ const getConst = (len = 0) => {
const DeliveryNoticeManagementAwaitB2BDetails: React.FC<PropsType> = ({ type, id, planData, btnCode }) => {
const [form] = Form.useForm()
const { renderPrompt, handleLeave } = usePrompt()
const [tableDataSource, setTableDataSource] = useState<any[]>([])
const [tableDataSource, setTableDataSource] = useState<any>([])
const [tableDataSourceContext, setTableDataSourceContext] = useState([])
const [loading, setLoading] = useState<boolean>(false)
const progressRef = useRef<HandleType>()
const changeTableSource = (data = []) => {
setTableDataSource(data)
const r = formMapData(tableDataSource, data)
setTableDataSource(r);
setTableDataSourceContext(data);
renderProgress(data)
}
......@@ -324,36 +331,40 @@ const DeliveryNoticeManagementAwaitB2BDetails: React.FC<PropsType> = ({ type, id
</BaseInfo>
<BaseInfo className='mt-16' title={DeliveryGood.name} id={DeliveryGood.key} cols={1}>
<DeliveryGoodTableSelect
value={tableDataSource}
title={`选择${DeliveryGood.name}`}
disabled={!!planData}
form={form}
onChange={(value) => {
if (value.length > 0) {
const ft = formatTable(value)
if (ft.length > 0) {
let addr = {
provinceName: value[0].provinceName,
cityName: value[0].cityName,
districtName: value[0].districtName,
streetName: value[0].streetName,
address: value[0].address,
phone: value[0].phone,
consignee: value[0].consignee,
consigneeId: value[0].consigneeId,
fullAddress: `${value[0].provinceName}${value[0].cityName}${value[0].districtName}${value[0].streetName}${value[0].address}`
provinceName: ft[0].provinceName,
cityName: ft[0].cityName,
districtName: ft[0].districtName,
streetName: ft[0].streetName,
address: ft[0].address,
phone: ft[0].phone,
consignee: ft[0].consignee,
consigneeId: ft[0].consigneeId,
fullAddress: `${ft[0].provinceName}${ft[0].cityName}${ft[0].districtName}${ft[0].streetName}${ft[0].address}`
}
form.setFieldsValue({
'receivingAddress': addr
})
}
changeTableSource(value)
setTableDataSource(value)
changeTableSource(ft)
}}
/>
<HarvestMaterialContextProvider value={{
dataSource: tableDataSource
dataSource: tableDataSourceContext
}}>
<Table
rowKey={row => row.orderNo}
columns={columns}
dataSource={tableDataSource}
dataSource={tableDataSourceContext}
/>
</HarvestMaterialContextProvider>
</BaseInfo>
......
......@@ -24,6 +24,7 @@ import usePrompt from '@/hooks/usePrompt'
import FormProgress, { HandleType } from '@/components/FormProgress'
import { getMemberManageUpperConsumerMerchantPage } from '@/services/MemberV2Api'
import { validatorByte } from '@/utils/regExp'
import { formatTable, formMapData } from '@/pages/order/components/DeliveryGoodTableSelect/useformatTable'
type PropsType = {
type: 'add' | 'edit';
......@@ -59,13 +60,21 @@ const getConst = (len = 0) => {
const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ type, id, planData, btnCode }) => {
const [form] = Form.useForm()
const { renderPrompt, handleLeave } = usePrompt()
const [tableDataSource, setTableDataSource] = useState<any[]>([])
const [tableDataSource, setTableDataSource] = useState<any>([])
const [tableDataSourceContext, setTableDataSourceContext] = useState([])
const [loading, setLoading] = useState<boolean>(false)
const progressRef = useRef<HandleType>()
const changeTableSource = (data = []) => {
setTableDataSource(data)
const r = formMapData(tableDataSource, data)
setTableDataSource(r);
setTableDataSourceContext(data);
renderProgress(data)
}
......@@ -118,9 +127,10 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ type, id
}
const handleRemoveMaterialTableRow = (i: number) => {
const source: any[] = tableDataSource;
const source: any[] = tableDataSourceContext;
const newSource = source.splice(i, 0)
changeTableSource(newSource)
}
const getDetail = async () => {
......@@ -311,7 +321,7 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ type, id
{ required: true, message: `请选择${ReceivingAddress}` }
]}
>
<ReceiverAddress disabled />
<ReceiverAddress disabled hiddenBtn={true} />
</Form.Item>
<Form.Item
......@@ -328,36 +338,43 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ type, id
</BaseInfo>
<BaseInfo className='mt-16' title={Material.name} id={Material.key} cols={1}>
<DeliveryGoodTableSelect
value={tableDataSource}
disabled={!!planData}
form={form}
orderType={2}
onChange={(value) => {
if (value.length > 0) {
const ft = formatTable(value)
if (ft.length > 0) {
let addr = {
provinceName: value[0].provinceName,
cityName: value[0].cityName,
districtName: value[0].districtName,
streetName: value[0].streetName,
address: value[0].address,
phone: value[0].phone,
consignee: value[0].consignee,
consigneeId: value[0].consigneeId,
fullAddress: `${value[0].provinceName}${value[0].cityName}${value[0].districtName}${value[0].streetName}${value[0].address}`
provinceName: ft[0].provinceName,
cityName: ft[0].cityName,
districtName: ft[0].districtName,
streetName: ft[0].streetName,
address: ft[0].address,
phone: ft[0].phone,
consignee: ft[0].consignee,
consigneeId: ft[0].consigneeId,
fullAddress: `${ft[0].provinceName}${ft[0].cityName}${ft[0].districtName}${ft[0].streetName}${ft[0].address}`
}
form.setFieldsValue({
'receivingAddress': addr
})
}
changeTableSource(value)
setTableDataSource(value)
changeTableSource(ft)
}}
/>
<HarvestMaterialContextProvider value={{
dataSource: tableDataSource
dataSource: tableDataSourceContext
}}>
<Table
rowKey={row => row.orderNo}
columns={columns}
dataSource={tableDataSource}
dataSource={tableDataSourceContext}
/>
</HarvestMaterialContextProvider>
</BaseInfo>
......
......@@ -216,6 +216,7 @@ function DeliveryNoticeFromCreate() {
label={ReceivingAddress} name="receiveVO">
<ReceiverAddress
hiddenBtn={true}
disabled={false}
/>
......
......@@ -181,6 +181,7 @@ function DeliveryNoteAddForm() {
<FormItem
label={ReceivingAddress} name="receiveVO">
<ReceiverAddress
hiddenBtn={true}
disabled={true}
/>
</FormItem>
......
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