Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
89b1531e
Commit
89b1531e
authored
Apr 14, 2022
by
xiexiuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
cea42e18
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
56 deletions
+77
-56
index.tsx
...saction/purchaseRequisition/increaseRequisition/index.tsx
+77
-56
No files found.
src/pages/transaction/purchaseRequisition/increaseRequisition/index.tsx
View file @
89b1531e
...
...
@@ -90,27 +90,26 @@ const IncreaseRequisition: React.FC<{}> = () => {
const
_orderProductRequests
=
procurementRenderField
(
data
)
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
props
.
isDefaultAddress
=
false
;
state
.
visible
=
data
.
deliveryMethod
==
1
?
true
:
false
;
state
.
visible
=
data
.
deliveryMethod
==
1
&&
data
.
deliveryType
!=
1
?
true
:
false
;
});
addSchemaAction
.
setFieldState
(
'deliveryAddress'
,
state
=>
{
state
.
visible
=
data
.
deliveryMethod
!=
1
?
true
:
false
;
state
.
visible
=
data
.
deliveryMethod
!=
1
||
data
.
deliveryType
==
1
?
true
:
false
;
});
if
(
data
.
delivery
Type
)
{
if
(
data
.
deliveryMethod
==
1
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
false
}
}
)
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
if
(
data
.
delivery
Method
===
1
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
item
.
disabled
=
item
.
deliveryTypeName
==
'直送客户'
?
false
:
true
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
console
.
log
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
}
if
(
data
.
deliveryMethod
==
2
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
item
.
disabled
=
item
.
deliveryTypeName
==
'直送客户'
?
true
:
false
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
}
addSchemaAction
.
setFieldState
(
'deliveryType'
,
state
=>
{
state
.
visible
=
true
;
});
setdeliveryType
(
data
.
deliveryType
)
}
if
(
data
.
deliveryMethod
==
2
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
item
.
disabled
=
item
.
deliveryTypeName
==
'直送客户'
?
true
:
false
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
}
addSchemaAction
.
setFieldState
(
'deliveryType'
,
state
=>
{
state
.
visible
=
true
;
});
setdeliveryType
(
data
.
deliveryType
)
rowvendorMemberInfoRef
.
current
=
{
memberId
:
data
.
vendorMemberId
,
roleId
:
data
.
vendorRoleId
,
...
...
@@ -214,18 +213,34 @@ const IncreaseRequisition: React.FC<{}> = () => {
const
handleOrderMember
=
()
=>
{
memberRef
.
current
.
setVisible
(
true
)
}
// 配送方式
const
changeDeliveryType
=
(
e
)
=>
{
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
e
.
target
.
value
)
setdeliveryType
(
e
.
target
.
value
)
const
Address
=
addSchemaAction
.
getFieldState
(
'deliveryAddressId'
)
console
.
log
(
Address
)
const
name
=
Address
.
value
.
name
?
Address
.
value
.
name
:
Address
.
value
.
receiverName
;
const
addres
=
Address
.
value
.
fullAddress
?
Address
.
value
.
fullAddress
:
Address
.
value
.
streetName
+
Address
.
value
.
address
+
Address
.
value
.
phone
;
console
.
log
(
addres
,
name
)
if
(
Address
.
value
)
{
addSchemaAction
.
setFieldState
(
'deliveryAddress'
,
state
=>
{
state
.
visible
=
true
;
state
.
value
=
name
+
Address
.
value
.
provinceName
+
Address
.
value
.
cityName
+
Address
.
value
.
districtName
+
addres
});
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
visible
=
false
;
});
}
}
// 自定义组建
const
RadioNode
=
()
=>
{
const
value
=
deliveryTypeList
.
filter
((
item
)
=>
!
item
.
disabled
);
return
(
// defaultValue={id ? deliveryType : value ? value.deliveryType : ''}
<
Radio
.
Group
onChange=
{
changeDeliveryType
}
defaultValue=
{
id
?
deliveryType
:
value
.
length
?
value
[
0
].
deliveryType
:
''
}
>
<
Radio
.
Group
onChange=
{
changeDeliveryType
}
value=
{
deliveryType
}
defaultValue=
{
id
?
deliveryType
:
''
}
>
<
div
className=
{
styles
.
RadioMian
}
>
{
deliveryTypeList
.
map
((
item
)
=>
(
...
...
@@ -357,9 +372,8 @@ const IncreaseRequisition: React.FC<{}> = () => {
dataIndex
:
'goodsName'
,
render
:
(
text
,
record
,
index
)
=>
{
let
goodsName
=
id
||
text
?
enclosureRef
.
current
.
list
.
find
(
item
=>
item
.
label
===
text
)
:
''
console
.
log
(
goodsName
)
return
(
<
Select
style=
{
{
width
:
230
}
}
defaultValue=
{
id
||
goodsName
?
goodsName
.
label
:
''
}
onChange=
{
(
value
)
=>
handleFirstChange
(
value
,
index
)
}
>
<
Select
style=
{
{
width
:
230
}
}
defaultValue=
{
id
||
goodsName
?
goodsName
?
.
label
:
''
}
onChange=
{
(
value
)
=>
handleFirstChange
(
value
,
index
)
}
>
{
Object
.
keys
(
enclosureRef
.
current
).
length
&&
enclosureRef
.
current
.
list
.
map
((
item
:
any
)
=>
{
return
(
...
...
@@ -388,6 +402,48 @@ const IncreaseRequisition: React.FC<{}> = () => {
},
500
)
}
const
onChangeAddress
=
(
res
)
=>
{
if
(
res
.
values
[
1
]?.
title
===
"物流"
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
item
.
disabled
=
item
.
deliveryTypeName
==
'直送客户'
?
false
:
true
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
addSchemaAction
.
setFieldState
(
'deliveryAddress'
,
state
=>
{
state
.
visible
=
false
;
});
setdeliveryType
(
''
)
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
""
)
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
visible
=
true
;
});
addSchemaAction
.
setFieldState
(
'deliveryType'
,
state
=>
{
state
.
visible
=
true
;
});
return
;
}
if
(
res
.
values
[
1
]?.
title
===
"自提"
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
item
.
disabled
=
item
.
deliveryTypeName
==
'直送客户'
?
true
:
false
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
addSchemaAction
.
setFieldState
(
'deliveryType'
,
state
=>
{
state
.
visible
=
true
;
});
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
""
)
addSchemaAction
.
setFieldValue
(
'deliveryAddressId'
,
""
)
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
visible
=
false
;
});
setdeliveryType
(
''
)
return
;
}
if
(
res
.
values
[
1
]?.
title
===
"无需配送"
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
&&
deliveryTypeListRef
.
current
?.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
true
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
addSchemaAction
.
setFieldState
(
'deliveryAddress'
,
state
=>
{
state
.
visible
=
false
;
});
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
visible
=
false
;
});
setdeliveryType
(
''
)
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
""
)
}
}
return
(<
div
className=
{
styles
[
'mian'
]
}
>
<
FormDetailContext
.
Provider
value=
{
providerValue
}
>
<
FormDetailHeader
...
...
@@ -428,42 +484,7 @@ const IncreaseRequisition: React.FC<{}> = () => {
formContext
.
useAttachmentChangeForContext
(
ctx
)
$
(
'onFieldChange'
,
'deliveryMethod'
).
subscribe
(
res
=>
{
if
(
res
.
values
[
1
]?.
title
===
"物流"
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
item
.
disabled
=
item
.
deliveryTypeName
==
'直送客户'
?
false
:
true
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
addSchemaAction
.
setFieldState
(
'deliveryAddress'
,
state
=>
{
state
.
visible
=
false
;
});
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
""
)
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
visible
=
true
;
});
addSchemaAction
.
setFieldState
(
'deliveryType'
,
state
=>
{
state
.
visible
=
true
;
});
}
if
(
res
.
values
[
1
]?.
title
===
"自提"
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
item
.
disabled
=
item
.
deliveryTypeName
==
'直送客户'
?
true
:
false
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
addSchemaAction
.
setFieldState
(
'deliveryType'
,
state
=>
{
state
.
visible
=
true
;
});
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
""
)
addSchemaAction
.
setFieldValue
(
'deliveryAddressId'
,
""
)
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
visible
=
false
;
});
}
if
(
res
.
values
[
1
]?.
title
===
"无需配送"
)
{
deliveryTypeListRef
.
current
.
deliveryTypeList
=
deliveryTypeListRef
.
current
.
deliveryTypeList
&&
deliveryTypeListRef
.
current
?.
deliveryTypeList
.
map
(
item
=>
{
return
{
...
item
,
disabled
:
true
}
})
setdeliveryTypeList
(
deliveryTypeListRef
.
current
.
deliveryTypeList
)
addSchemaAction
.
setFieldState
(
'deliveryAddress'
,
state
=>
{
state
.
visible
=
true
;
});
addSchemaAction
.
setFieldState
(
'deliveryAddressId'
,
state
=>
{
state
.
visible
=
false
;
});
addSchemaAction
.
setFieldValue
(
'deliveryType'
,
""
)
}
onChangeAddress
(
res
)
})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment