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
fa1aba15
Commit
fa1aba15
authored
Apr 13, 2022
by
Gavin Peng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复送货计划输入框限制
parent
ea457f00
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
314 additions
and
255 deletions
+314
-255
details.tsx
...r/deliveryPlanCollaboration/deliveryPlanQuery/details.tsx
+1
-2
create.tsx
...er/deliveryPlanManagement/deliveryPlanAwaitB2B/create.tsx
+13
-4
update.tsx
...er/deliveryPlanManagement/deliveryPlanAwaitB2B/update.tsx
+30
-20
create.tsx
...er/deliveryPlanManagement/deliveryPlanAwaitSRM/create.tsx
+199
-190
update.tsx
...er/deliveryPlanManagement/deliveryPlanAwaitSRM/update.tsx
+11
-2
update.tsx
...order/deliveryPlanManagement/deliveryPlanQuery/update.tsx
+11
-2
assemblyTools.ts
src/pages/order/utils/assemblyTools.ts
+49
-2
date.ts
src/pages/order/utils/date.ts
+0
-33
No files found.
src/pages/order/deliveryPlanCollaboration/deliveryPlanQuery/details.tsx
View file @
fa1aba15
...
...
@@ -193,7 +193,7 @@ const DeliveryPlanCollaborationDetails: React.FC = () => {
let
noticePath
=
{}
const
time
=
new
Date
().
getTime
()
// 判断跳转
const
url
=
deliveryPlanType
===
'1'
?
'/memberCenter/order/deliveryNoticeManagement/await
SRM/add'
:
'/memberCenter/order/deliveryNoticeManagement/awaitB2B
/add'
const
url
=
deliveryPlanType
===
'1'
?
'/memberCenter/order/deliveryNoticeManagement/await
B2B/add'
:
'/memberCenter/order/deliveryNoticeManagement/awaitSRM
/add'
noticePath
[
time
]
=
res
.
data
localStorage
.
setItem
(
'NOTICE_PATH'
,
JSON
.
stringify
(
noticePath
))
setTimeout
(()
=>
{
...
...
@@ -216,7 +216,6 @@ const DeliveryPlanCollaborationDetails: React.FC = () => {
planOrderIds
:
_ids
.
join
(),
time
:
date
}).
then
((
res
:
any
)
=>
{
console
.
log
(
'res :>> '
,
res
)
if
(
res
.
code
===
1000
)
{
let
noticePath
=
{}
const
time
=
new
Date
().
getTime
()
...
...
src/pages/order/deliveryPlanManagement/deliveryPlanAwaitB2B/create.tsx
View file @
fa1aba15
...
...
@@ -11,7 +11,7 @@ import { Button, DatePicker, Form, Input, InputNumber, message, Space, Spin, Ste
import
{
SaveOutlined
}
from
'@ant-design/icons'
import
BaseInfo
from
'@/components/BaseInfo/BaseInfo'
import
_
from
'lodash'
import
{
convertArrToObj
,
getDayAll
}
from
'../../utils'
import
{
convertArrToObj
,
disabledDate
,
getDayAll
,
limitDecimalsF
,
limitDecimalsP
}
from
'../../utils'
import
{
BrandColumn
,
ClassColumn
,
CommodityNoColumn
,
ConsigneeNumColumn
,
DeliveredNumColumn
,
OrderCreatedAtColumn
,
OrderNoColumn
,
OrderSummaryColumn
,
OrderNumColumn
,
PlannedDeliveryNumColumn
,
TradeNameColumn
,
TransitNumColumn
,
UntilColumn
}
from
'../../constants/table-column'
import
{
RoleSelect
}
from
'@/components/RoleSelect'
import
{
getMemberManageSupplyMember
}
from
'@/services/MemberV2Api'
...
...
@@ -70,7 +70,7 @@ const DeliveryPlanAwaitB2BCreate: React.FC = () => {
const
[
expandIconColumn
,
setExpandIconColumn
]
=
useState
<
any
>
(
initExpandIconColumn
)
const
expandedRowRender
=
(
record
,
index
)
=>
{
return
<
Table
rowKey=
{
'orderProductId'
}
columns=
{
expandIconColumn
}
dataSource=
{
record
.
orders
}
pagination=
{
false
}
tableLayout=
"fixed"
/>
return
<
Table
rowKey=
{
'orderProductId'
}
columns=
{
expandIconColumn
}
dataSource=
{
record
.
orders
}
pagination=
{
false
}
tableLayout=
"fixed"
/>
}
// 选中 开始时间,结束时间
...
...
@@ -147,7 +147,16 @@ const DeliveryPlanAwaitB2BCreate: React.FC = () => {
key
:
item
,
width
:
80
,
align
:
'center'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(<
InputNumber
style=
{
{
width
:
'100%'
}
}
bordered
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>)
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
InputNumber
style=
{
{
width
:
'100%'
}
}
bordered
parser=
{
limitDecimalsP
}
formatter=
{
limitDecimalsF
}
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>
)
}))
setGoodsTableColumn
([...
initGoodsTableColumn
,
...
datesColumn
])
setExpandIconColumn
([...
initExpandIconColumn
,
...
datesExpandIconColumn
])
...
...
@@ -235,7 +244,7 @@ const DeliveryPlanAwaitB2BCreate: React.FC = () => {
label=
{
PlanningCycle
}
name=
'dates'
>
<
DatePicker
.
RangePicker
style=
{
{
width
:
'100%'
}
}
onChange=
{
(
dates
)
=>
handleDateAssembleColumn
(
dates
)
}
/>
<
DatePicker
.
RangePicker
disabledDate=
{
disabledDate
}
style=
{
{
width
:
'100%'
}
}
onChange=
{
(
dates
)
=>
handleDateAssembleColumn
(
dates
)
}
/>
</
Form
.
Item
>
<
Form
.
Item
...
...
src/pages/order/deliveryPlanManagement/deliveryPlanAwaitB2B/update.tsx
View file @
fa1aba15
...
...
@@ -11,7 +11,7 @@ import { Button, Form, Input, InputNumber, message, Space, Spin, Steps, Table, T
import
{
SaveOutlined
}
from
'@ant-design/icons'
import
BaseInfo
from
'@/components/BaseInfo/BaseInfo'
import
_
from
'lodash'
import
{
getDayAll
,
godAtob
,
integrationArrToObj
,
integrationOjb
,
TagStatus
}
from
'../../utils'
import
{
getDayAll
,
godAtob
,
integrationArrToObj
,
integrationOjb
,
limitDecimalsF
,
limitDecimalsP
,
TagStatus
}
from
'../../utils'
import
{
BrandColumn
,
ClassColumn
,
CommodityNoColumn
,
ConsigneeNumColumn
,
DeliveredNumColumn
,
OrderCreatedAtColumn
,
OrderNoColumn
,
OrderSummaryColumn
,
OrderNumColumn
,
PlannedDeliveryNumColumn
,
TradeNameColumn
,
TransitNumColumn
,
UntilColumn
}
from
'../../constants/table-column'
import
{
getOrderDeliveryPlanDeliveryHistory
,
getOrderDeliveryPlanDetail
,
getOrderDeliveryPlanDetailProductPage
,
postOrderDeliveryPlanUpdate
}
from
'@/services/OrderNewV2Api'
import
moment
from
'moment'
...
...
@@ -82,7 +82,7 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
// 保存
const
save
=
()
=>
{
form
.
validateFields
().
then
(
values
=>
{
console
.
log
(
'values :>> '
,
values
)
console
.
log
(
'values :>> '
,
values
)
if
(
_
.
isEmpty
(
goodsTableDataRef
.
current
))
{
message
.
warning
(
'没有找到可执行计划送货'
)
return
...
...
@@ -130,7 +130,17 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
key
:
item
,
width
:
80
,
align
:
'center'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(<
InputNumber
style=
{
{
width
:
'100%'
}
}
bordered
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>)
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
InputNumber
style=
{
{
width
:
'100%'
}
}
// disabled={}
bordered
parser=
{
limitDecimalsP
}
formatter=
{
limitDecimalsF
}
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>
)
}))
setGoodsTableColumn
([...
goodsTableColumn
,
...
datesColumn
])
setExpandIconColumn
([...
expandIconColumn
,
...
datesExpandIconColumn
])
...
...
@@ -157,21 +167,21 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
})
}
// 获取详情
const
getDetails
=
()
=>
{
getOrderDeliveryPlanDetail
({
id
}).
then
((
res
:
any
)
=>
{
if
(
res
.
code
===
1000
)
{
setDetails
(
res
.
data
)
form
.
setFieldsValue
({
planSummaryText
:
res
.
data
.
digest
,
})
getPlannedDelivery
()
handleDateAssembleColumn
(
res
.
data
.
planStartTime
,
res
.
data
.
planEndTime
)
}
})
}
// 获取详情
const
getDetails
=
()
=>
{
getOrderDeliveryPlanDetail
({
id
}).
then
((
res
:
any
)
=>
{
if
(
res
.
code
===
1000
)
{
setDetails
(
res
.
data
)
form
.
setFieldsValue
({
planSummaryText
:
res
.
data
.
digest
,
})
getPlannedDelivery
()
handleDateAssembleColumn
(
res
.
data
.
planStartTime
,
res
.
data
.
planEndTime
)
}
})
}
// 获取流转记录
const
getExternalRoamRecordData
=
()
=>
{
...
...
@@ -189,7 +199,7 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
},
[])
return
(<>
<
Spin
spinning=
{
spinning
}
>
<
Spin
spinning=
{
spinning
}
>
<
AnchorPage
title=
{
details
?.
planNo
}
onBack=
{
()
=>
history
.
goBack
()
}
...
...
@@ -264,7 +274,7 @@ const DeliveryPlanAwaitB2BUpdate: React.FC = () => {
</
BaseInfo
>
</
Form
>
</
AnchorPage
>
</
Spin
>
</
Spin
>
</>)
}
...
...
src/pages/order/deliveryPlanManagement/deliveryPlanAwaitSRM/create.tsx
View file @
fa1aba15
...
...
@@ -3,31 +3,31 @@
* @author: Gavin
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import
React
,
{
useEffect
,
useRef
,
useState
}
from
'react'
import
{
history
}
from
'umi'
import
AnchorPage
,
{
AnchorsItem
}
from
'@/components/AnchorPage'
import
{
BaseInfo
as
base_Info
,
Remarks
,
PlanningCycle
,
SupplyMembersLabel
,
PlanSummary
,
ExternalState
,
Circulation
,
Purchaser
,
SubmitDeliveryPlan
,
Supplier
,
ConfirmDeliveryPlan
,
PlannedDelivery
,
DeliveryPlanText
,
DeliveryPlanRemark
,
CreateDeliveryPlanTitleSRM
}
from
'../../constants'
import
{
Button
,
DatePicker
,
Form
,
Input
,
InputNumber
,
message
,
Space
,
Spin
,
Steps
,
Table
}
from
'antd'
import
{
SaveOutlined
}
from
'@ant-design/icons'
import
BaseInfo
from
'@/components/BaseInfo/BaseInfo'
import
_
from
'lodash'
import
{
convertArrToObj
,
getDayAll
}
from
'../../utils'
import
{
BrandColumn
,
ClassColumn
,
ConsigneeNumColumn
,
DeliveredNumColumn
,
MaterialModelColumn
,
MaterialNameColumn
,
MaterialNoColumn
,
OrderCreatedAtColumn
,
OrderNoColumn
,
OrderSummaryColumn
,
OrderNumColumn
,
PlannedDeliveryNumColumn
,
TransitNumColumn
,
UntilColumn
}
from
'../../constants/table-column'
import
{
RoleSelect
}
from
'@/components/RoleSelect'
import
{
getOrderDeliveryPlanOrderProductPage
,
postOrderDeliveryPlanSrmCreate
}
from
'@/services/OrderNewV2Api'
import
{
getMemberManageLowerMerchantProviderPage
}
from
'@/services/MemberV2Api'
const
formItemLayout
=
{
labelCol
:
{
span
:
3
},
wrapperCol
:
{
span
:
18
}
}
// 1:查询供应商角色,2:查询采购商角色
const
ROLE_TYPE
=
'1'
// 1:b2b,2:srm
const
ORDER_TYPE
=
'2'
import
React
,
{
useEffect
,
useRef
,
useState
}
from
'react'
import
{
history
}
from
'umi'
import
AnchorPage
,
{
AnchorsItem
}
from
'@/components/AnchorPage'
import
{
BaseInfo
as
base_Info
,
Remarks
,
PlanningCycle
,
SupplyMembersLabel
,
PlanSummary
,
ExternalState
,
Circulation
,
Purchaser
,
SubmitDeliveryPlan
,
Supplier
,
ConfirmDeliveryPlan
,
PlannedDelivery
,
DeliveryPlanText
,
DeliveryPlanRemark
,
CreateDeliveryPlanTitleSRM
}
from
'../../constants'
import
{
Button
,
DatePicker
,
Form
,
Input
,
InputNumber
,
message
,
Space
,
Spin
,
Steps
,
Table
}
from
'antd'
import
{
SaveOutlined
}
from
'@ant-design/icons'
import
BaseInfo
from
'@/components/BaseInfo/BaseInfo'
import
_
from
'lodash'
import
{
convertArrToObj
,
disabledDate
,
getDayAll
,
limitDecimalsF
,
limitDecimalsP
}
from
'../../utils'
import
{
BrandColumn
,
ClassColumn
,
ConsigneeNumColumn
,
DeliveredNumColumn
,
MaterialModelColumn
,
MaterialNameColumn
,
MaterialNoColumn
,
OrderCreatedAtColumn
,
OrderNoColumn
,
OrderSummaryColumn
,
OrderNumColumn
,
PlannedDeliveryNumColumn
,
TransitNumColumn
,
UntilColumn
}
from
'../../constants/table-column'
import
{
RoleSelect
}
from
'@/components/RoleSelect'
import
{
getOrderDeliveryPlanOrderProductPage
,
postOrderDeliveryPlanSrmCreate
}
from
'@/services/OrderNewV2Api'
import
{
getMemberManageLowerMerchantProviderPage
}
from
'@/services/MemberV2Api'
const
initMaterialTableColumn
=
[
const
formItemLayout
=
{
labelCol
:
{
span
:
3
},
wrapperCol
:
{
span
:
18
}
}
// 1:查询供应商角色,2:查询采购商角色
const
ROLE_TYPE
=
'1'
// 1:b2b,2:srm
const
ORDER_TYPE
=
'2'
const
initMaterialTableColumn
=
[
{
...
MaterialNoColumn
,
dataIndex
:
'skuId'
,
width
:
80
,
},
{
...
MaterialNameColumn
,
dataIndex
:
'productName'
,
width
:
192
,
},
{
...
MaterialModelColumn
,
dataIndex
:
'productName'
,
width
:
128
,
},
...
...
@@ -50,166 +50,175 @@ const initExpandIconColumn = [
{
...
DeliveredNumColumn
,
dataIndex
:
'leftCount'
,
width
:
86
,
},
{
...
PlannedDeliveryNumColumn
,
dataIndex
:
'planCount'
,
width
:
96
,
},
]
const
DeliveryPlanAwaitSRMCreate
:
React
.
FC
=
()
=>
{
const
[
form
]
=
Form
.
useForm
()
const
datesRef
=
useRef
<
any
>
(
null
)
const
materialTableDataRef
=
useRef
(
null
)
const
DeliveryPlanAwaitSRMCreate
:
React
.
FC
=
()
=>
{
const
[
form
]
=
Form
.
useForm
()
const
datesRef
=
useRef
<
any
>
(
null
)
const
materialTableDataRef
=
useRef
(
null
)
const
[
spinning
,
setSpinning
]
=
useState
<
boolean
>
(
false
)
const
[
iAnchors
,
setIAnchors
]
=
useState
<
AnchorsItem
[]
>
([
Circulation
,
base_Info
,
PlannedDelivery
,
Remarks
,
])
// 动态 TableColumn
const
[
materialTableColumn
,
setMaterialTableColumn
]
=
useState
<
any
>
(
initMaterialTableColumn
)
// 动态 expandIconColumn
const
[
expandIconColumn
,
setExpandIconColumn
]
=
useState
<
any
>
(
initExpandIconColumn
)
const
[
spinning
,
setSpinning
]
=
useState
<
boolean
>
(
false
)
const
expandedRowRender
=
(
record
)
=>
{
return
<
Table
rowKey=
{
'orderProductId'
}
columns=
{
expandIconColumn
}
dataSource=
{
record
.
orders
}
pagination=
{
false
}
tableLayout=
"fixed"
/>
}
const
[
iAnchors
,
setIAnchors
]
=
useState
<
AnchorsItem
[]
>
([
Circulation
,
base_Info
,
PlannedDelivery
,
Remarks
,
])
// 动态 TableColumn
const
[
materialTableColumn
,
setMaterialTableColumn
]
=
useState
<
any
>
(
initMaterialTableColumn
)
// 动态 expandIconColumn
const
[
expandIconColumn
,
setExpandIconColumn
]
=
useState
<
any
>
(
initExpandIconColumn
)
const
expandedRowRender
=
(
record
)
=>
{
return
<
Table
rowKey=
{
'orderProductId'
}
columns=
{
expandIconColumn
}
dataSource=
{
record
.
orders
}
pagination=
{
false
}
tableLayout=
"fixed"
/>
}
// 选中 开始时间,结束时间
const
[
selectedDate
,
setSelectedDate
]
=
useState
<
Array
<
string
>>
([])
// 选中 会员信息
const
[
selectedMember
,
setSelectedMember
]
=
useState
<
any
>
({})
// 计划送货物料 列表
const
[
materialTableData
,
setMaterialTableData
]
=
useState
<
any
>
(
null
)
// 保存
const
save
=
()
=>
{
form
.
validateFields
().
then
(
values
=>
{
// console.log('values :>> ', values)
if
(
_
.
isEmpty
(
materialTableDataRef
.
current
))
{
message
.
warning
(
'没有找到可执行计划送货'
)
setSpinning
(
false
)
return
}
setSpinning
(
true
)
const
productList
=
materialTableDataRef
.
current
.
map
((
item
:
any
)
=>
{
return
{
...
item
,
orders
:
item
.
orders
.
map
((
o
:
any
)
=>
{
const
planDays
=
Object
.
keys
(
o
).
filter
((
f
:
any
)
=>
f
.
startsWith
(
'$'
)).
map
((
p
:
any
)
=>
o
[
p
])
return
{
...
o
,
planDays
}
})
}
})
postOrderDeliveryPlanSrmCreate
({
vendorMemberId
:
selectedMember
.
memberId
,
vendorRoleId
:
selectedMember
.
roleId
,
vendorMemberName
:
selectedMember
.
name
,
digest
:
values
.
planSummaryText
,
planStartTime
:
values
.
dates
[
0
].
format
(
'YYYY-MM-DD'
),
planEndTime
:
values
.
dates
[
1
].
format
(
'YYYY-MM-DD'
),
remark
:
values
.
remark
,
productList
}).
then
((
res
:
any
)
=>
{
// 选中 开始时间,结束时间
const
[
selectedDate
,
setSelectedDate
]
=
useState
<
Array
<
string
>>
([])
// 选中 会员信息
const
[
selectedMember
,
setSelectedMember
]
=
useState
<
any
>
({})
// 计划送货物料 列表
const
[
materialTableData
,
setMaterialTableData
]
=
useState
<
any
>
(
null
)
// 保存
const
save
=
()
=>
{
form
.
validateFields
().
then
(
values
=>
{
// console.log('values :>> ', values)
if
(
_
.
isEmpty
(
materialTableDataRef
.
current
))
{
message
.
warning
(
'没有找到可执行计划送货'
)
setSpinning
(
false
)
return
}
setSpinning
(
true
)
const
productList
=
materialTableDataRef
.
current
.
map
((
item
:
any
)
=>
{
return
{
...
item
,
orders
:
item
.
orders
.
map
((
o
:
any
)
=>
{
const
planDays
=
Object
.
keys
(
o
).
filter
((
f
:
any
)
=>
f
.
startsWith
(
'$'
)).
map
((
p
:
any
)
=>
o
[
p
])
return
{
...
o
,
planDays
}
})
}
})
postOrderDeliveryPlanSrmCreate
({
vendorMemberId
:
selectedMember
.
memberId
,
vendorRoleId
:
selectedMember
.
roleId
,
vendorMemberName
:
selectedMember
.
name
,
digest
:
values
.
planSummaryText
,
planStartTime
:
values
.
dates
[
0
].
format
(
'YYYY-MM-DD'
),
planEndTime
:
values
.
dates
[
1
].
format
(
'YYYY-MM-DD'
),
remark
:
values
.
remark
,
productList
}).
then
((
res
:
any
)
=>
{
setSpinning
(
false
)
if
(
res
.
code
===
1000
)
{
history
.
goBack
()
}
}).
catch
(
err
=>
{
setSpinning
(
false
)
if
(
res
.
code
===
1000
)
{
history
.
goBack
()
}
}).
catch
(
err
=>
{
setSpinning
(
false
)
})
})
}
// 对应日期填入的送货数量
const
inputChange
=
(
val
:
any
,
text
:
any
,
record
:
any
)
=>
{
let
{
day
}
=
text
let
dataArr
=
JSON
.
parse
(
JSON
.
stringify
(
materialTableDataRef
.
current
))
let
index
=
dataArr
.
findIndex
(
f
=>
f
.
skuId
===
record
.
skuId
)
let
childIndex
=
dataArr
[
index
].
orders
.
findIndex
(
f
=>
f
.
orderProductId
===
record
.
orderProductId
)
dataArr
[
index
].
orders
[
childIndex
][
`$
${
day
}
`
].
planCount
=
val
materialTableDataRef
.
current
=
dataArr
setMaterialTableData
(
dataArr
)
}
// 计划周期 选择日期
const
handleDateAssembleColumn
=
(
dateGroup
)
=>
{
if
(
_
.
isArray
(
dateGroup
))
{
const
startDate
=
dateGroup
[
0
].
format
(
'YYYY-MM-DD'
)
const
endDate
=
dateGroup
[
1
].
format
(
'YYYY-MM-DD'
)
const
dates
=
getDayAll
(
startDate
,
endDate
)
datesRef
.
current
=
dates
setSelectedDate
([
startDate
,
endDate
])
const
datesColumn
=
dates
.
map
((
item
,
i
)
=>
({
title
:
item
.
substr
(
1
),
dataIndex
:
item
,
key
:
item
,
width
:
120
,
align
:
'center'
,
}))
const
datesExpandIconColumn
=
dates
.
map
((
item
,
i
)
=>
({
title
:
item
.
substr
(
1
),
dataIndex
:
item
,
key
:
item
,
width
:
80
,
align
:
'center'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(<
InputNumber
style=
{
{
width
:
'100%'
}
}
bordered
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>)
}))
setMaterialTableColumn
([...
initMaterialTableColumn
,
...
datesColumn
])
setExpandIconColumn
([...
initExpandIconColumn
,
...
datesExpandIconColumn
])
}
else
{
// 清空
datesRef
.
current
=
null
materialTableDataRef
.
current
=
null
setSelectedDate
([])
setMaterialTableData
([])
setMaterialTableColumn
(
initMaterialTableColumn
)
setExpandIconColumn
(
initExpandIconColumn
)
}
}
// 选中的会员信息
const
handleMemberInfo
=
(
info
)
=>
{
setSelectedMember
(
info
)
}
// 获取计划送货 物料
const
getPlannedDelivery
=
()
=>
{
getOrderDeliveryPlanOrderProductPage
({
startDate
:
selectedDate
[
0
],
endDate
:
selectedDate
[
1
],
memberId
:
selectedMember
.
memberId
,
roleId
:
selectedMember
.
roleId
,
roleType
:
ROLE_TYPE
,
orderType
:
ORDER_TYPE
,
current
:
'1'
,
pageSize
:
'10'
}).
then
((
res
)
=>
{
if
(
res
.
code
===
1000
)
{
const
assemble
=
res
.
data
.
data
.
map
((
item
=>
{
return
{
...
item
,
...
convertArrToObj
(
datesRef
.
current
),
orders
:
item
.
orders
.
map
(
o
=>
({
...
o
,
...
convertArrToObj
(
datesRef
.
current
),
}))
}
}))
materialTableDataRef
.
current
=
assemble
setMaterialTableData
(
assemble
)
}
})
}
// 监听 选择日期 and 选择会员
useEffect
(()
=>
{
// 双条件满足 请求
if
(
!
_
.
isEmpty
(
selectedDate
)
&&
!
_
.
isEmpty
(
selectedMember
))
{
console
.
log
(
'订单能力 - 送货计划管理 - 待提交送货计划 SRM -----------:>> '
,
'双条件满足 请求 获取计划送货'
)
getPlannedDelivery
()
const
planSummaryText
=
`
${
selectedDate
[
0
]}
~
${
selectedDate
[
1
]}
${
selectedMember
.
name
}
${
DeliveryPlanText
}
`
form
.
setFieldsValue
({
planSummaryText
})
}
else
{
console
.
log
(
'订单能力 - 送货计划管理 - 待提交送货计划 SRM -----------:>> '
,
'条件暂未满足不调取接口获取'
)
}
},
[
selectedDate
,
selectedMember
])
return
(
<
Spin
spinning=
{
spinning
}
>
})
})
}
// 对应日期填入的送货数量
const
inputChange
=
(
val
:
any
,
text
:
any
,
record
:
any
)
=>
{
let
{
day
}
=
text
let
dataArr
=
JSON
.
parse
(
JSON
.
stringify
(
materialTableDataRef
.
current
))
let
index
=
dataArr
.
findIndex
(
f
=>
f
.
skuId
===
record
.
skuId
)
let
childIndex
=
dataArr
[
index
].
orders
.
findIndex
(
f
=>
f
.
orderProductId
===
record
.
orderProductId
)
dataArr
[
index
].
orders
[
childIndex
][
`$
${
day
}
`
].
planCount
=
val
materialTableDataRef
.
current
=
dataArr
setMaterialTableData
(
dataArr
)
}
// 计划周期 选择日期
const
handleDateAssembleColumn
=
(
dateGroup
)
=>
{
if
(
_
.
isArray
(
dateGroup
))
{
const
startDate
=
dateGroup
[
0
].
format
(
'YYYY-MM-DD'
)
const
endDate
=
dateGroup
[
1
].
format
(
'YYYY-MM-DD'
)
const
dates
=
getDayAll
(
startDate
,
endDate
)
datesRef
.
current
=
dates
setSelectedDate
([
startDate
,
endDate
])
const
datesColumn
=
dates
.
map
((
item
,
i
)
=>
({
title
:
item
.
substr
(
1
),
dataIndex
:
item
,
key
:
item
,
width
:
120
,
align
:
'center'
,
}))
const
datesExpandIconColumn
=
dates
.
map
((
item
,
i
)
=>
({
title
:
item
.
substr
(
1
),
dataIndex
:
item
,
key
:
item
,
width
:
80
,
align
:
'center'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
InputNumber
style=
{
{
width
:
'100%'
}
}
bordered
parser=
{
limitDecimalsP
}
formatter=
{
limitDecimalsF
}
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>
)
}))
setMaterialTableColumn
([...
initMaterialTableColumn
,
...
datesColumn
])
setExpandIconColumn
([...
initExpandIconColumn
,
...
datesExpandIconColumn
])
}
else
{
// 清空
datesRef
.
current
=
null
materialTableDataRef
.
current
=
null
setSelectedDate
([])
setMaterialTableData
([])
setMaterialTableColumn
(
initMaterialTableColumn
)
setExpandIconColumn
(
initExpandIconColumn
)
}
}
// 选中的会员信息
const
handleMemberInfo
=
(
info
)
=>
{
setSelectedMember
(
info
)
}
// 获取计划送货 物料
const
getPlannedDelivery
=
()
=>
{
getOrderDeliveryPlanOrderProductPage
({
startDate
:
selectedDate
[
0
],
endDate
:
selectedDate
[
1
],
memberId
:
selectedMember
.
memberId
,
roleId
:
selectedMember
.
roleId
,
roleType
:
ROLE_TYPE
,
orderType
:
ORDER_TYPE
,
current
:
'1'
,
pageSize
:
'10'
}).
then
((
res
)
=>
{
if
(
res
.
code
===
1000
)
{
const
assemble
=
res
.
data
.
data
.
map
((
item
=>
{
return
{
...
item
,
...
convertArrToObj
(
datesRef
.
current
),
orders
:
item
.
orders
.
map
(
o
=>
({
...
o
,
...
convertArrToObj
(
datesRef
.
current
),
}))
}
}))
materialTableDataRef
.
current
=
assemble
setMaterialTableData
(
assemble
)
}
})
}
// 监听 选择日期 and 选择会员
useEffect
(()
=>
{
// 双条件满足 请求
if
(
!
_
.
isEmpty
(
selectedDate
)
&&
!
_
.
isEmpty
(
selectedMember
))
{
console
.
log
(
'订单能力 - 送货计划管理 - 待提交送货计划 SRM -----------:>> '
,
'双条件满足 请求 获取计划送货'
)
getPlannedDelivery
()
const
planSummaryText
=
`
${
selectedDate
[
0
]}
~
${
selectedDate
[
1
]}
${
selectedMember
.
name
}
${
DeliveryPlanText
}
`
form
.
setFieldsValue
({
planSummaryText
})
}
else
{
console
.
log
(
'订单能力 - 送货计划管理 - 待提交送货计划 SRM -----------:>> '
,
'条件暂未满足不调取接口获取'
)
}
},
[
selectedDate
,
selectedMember
])
return
(
<
Spin
spinning=
{
spinning
}
>
<
AnchorPage
title=
{
CreateDeliveryPlanTitleSRM
}
onBack=
{
()
=>
history
.
goBack
()
}
...
...
@@ -240,9 +249,9 @@ const initExpandIconColumn = [
{
required
:
true
,
message
:
'请选择'
}
]
}
>
<
DatePicker
.
RangePicker
style=
{
{
width
:
'100%'
}
}
onChange=
{
(
dates
)
=>
handleDateAssembleColumn
(
dates
)
}
/>
<
DatePicker
.
RangePicker
disabledDate=
{
disabledDate
}
style=
{
{
width
:
'100%'
}
}
onChange=
{
(
dates
)
=>
handleDateAssembleColumn
(
dates
)
}
/>
</
Form
.
Item
>
<
Form
.
Item
{
...
formItemLayout
}
label=
{
SupplyMembersLabel
}
...
...
@@ -257,7 +266,7 @@ const initExpandIconColumn = [
params=
{
{
current
:
'1'
,
pageSize
:
'100'
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
{
...
formItemLayout
}
label=
{
PlanSummary
}
...
...
@@ -292,8 +301,8 @@ const initExpandIconColumn = [
</
BaseInfo
>
</
Form
>
</
AnchorPage
>
</
Spin
>
)
}
export
default
DeliveryPlanAwaitSRMCreate
\ No newline at end of file
</
Spin
>
)
}
export
default
DeliveryPlanAwaitSRMCreate
\ No newline at end of file
src/pages/order/deliveryPlanManagement/deliveryPlanAwaitSRM/update.tsx
View file @
fa1aba15
...
...
@@ -12,7 +12,7 @@ import { SaveOutlined } from '@ant-design/icons'
import
BaseInfo
from
'@/components/BaseInfo/BaseInfo'
import
{
ExternalRoamRecordTableColumn
}
from
'../../constants/page-table-column'
import
_
from
'lodash'
import
{
getDayAll
,
godAtob
,
integrationArrToObj
,
integrationOjb
,
TagStatus
}
from
'../../utils'
import
{
getDayAll
,
godAtob
,
integrationArrToObj
,
integrationOjb
,
limitDecimalsF
,
limitDecimalsP
,
TagStatus
}
from
'../../utils'
import
{
BrandColumn
,
ClassColumn
,
ConsigneeNumColumn
,
DeliveredNumColumn
,
MaterialModelColumn
,
MaterialNameColumn
,
MaterialNoColumn
,
OrderCreatedAtColumn
,
OrderNoColumn
,
OrderSummaryColumn
,
OrderNumColumn
,
PlannedDeliveryNumColumn
,
TransitNumColumn
,
UntilColumn
}
from
'../../constants/table-column'
import
{
getOrderDeliveryPlanDeliveryHistory
,
getOrderDeliveryPlanDetail
,
getOrderDeliveryPlanDetailProductPage
,
postOrderDeliveryPlanUpdate
}
from
'@/services/OrderNewV2Api'
import
moment
from
'moment'
...
...
@@ -130,7 +130,16 @@ const DeliveryPlanAwaitSRMUpdate: React.FC = () => {
key
:
item
,
width
:
80
,
align
:
'center'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(<
InputNumber
style=
{
{
width
:
'100%'
}
}
bordered
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>)
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
InputNumber
style=
{
{
width
:
'100%'
}
}
bordered
parser=
{
limitDecimalsP
}
formatter=
{
limitDecimalsF
}
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>
)
}))
setMaterialTableColumn
([...
materialTableColumn
,
...
datesColumn
])
setExpandIconColumn
([...
expandIconColumn
,
...
datesExpandIconColumn
])
...
...
src/pages/order/deliveryPlanManagement/deliveryPlanQuery/update.tsx
View file @
fa1aba15
...
...
@@ -12,7 +12,7 @@ import { Button, Form, Input, InputNumber, message, Space, Spin, Steps, Table, T
import
{
SaveOutlined
}
from
'@ant-design/icons'
import
BaseInfo
from
'@/components/BaseInfo/BaseInfo'
import
{
ExternalRoamRecordTableColumn
}
from
'../../constants/page-table-column'
import
{
getDayAll
,
godAtob
,
integrationArrToObj
,
integrationOjb
,
TagStatus
}
from
'../../utils'
import
{
getDayAll
,
godAtob
,
integrationArrToObj
,
integrationOjb
,
limitDecimalsF
,
limitDecimalsP
,
TagStatus
}
from
'../../utils'
import
{
BrandColumn
,
ClassColumn
,
ConsigneeNumColumn
,
DeliveredNumColumn
,
MaterialModelColumn
,
MaterialNameColumn
,
MaterialNoColumn
,
OrderCreatedAtColumn
,
OrderNoColumn
,
OrderSummaryColumn
,
OrderNumColumn
,
PlannedDeliveryNumColumn
,
TransitNumColumn
,
UntilColumn
,
CommodityNoColumn
,
TradeNameColumn
}
from
'../../constants/table-column'
import
{
getOrderDeliveryPlanDeliveryHistory
,
getOrderDeliveryPlanDetail
,
getOrderDeliveryPlanDetailProductPage
,
postOrderDeliveryPlanUpdate
}
from
'@/services/OrderNewV2Api'
...
...
@@ -144,7 +144,16 @@ const DeliveryPlanManagementUpdate: React.FC = () => {
key
:
item
,
width
:
80
,
align
:
'center'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(<
InputNumber
style=
{
{
width
:
'100%'
}
}
bordered
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>)
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
InputNumber
style=
{
{
width
:
'100%'
}
}
bordered
parser=
{
limitDecimalsP
}
formatter=
{
limitDecimalsF
}
value=
{
text
?.
planCount
}
onChange=
{
(
val
)
=>
inputChange
(
val
,
text
,
record
)
}
/>
)
}))
const
table_column
=
deliveryPlanType
===
'1'
?
columnB2B
:
deliveryPlanType
===
'2'
?
columnSRM
:
[]
setTableColumn
([...
table_column
,
...
datesColumn
])
...
...
src/pages/order/utils/assemblyTools.ts
View file @
fa1aba15
// 公共组装类工具
import
moment
from
"moment"
/**
* 数组转对象 默认赋值 0
* - 原数组: ['$04-01','$04-02']
...
...
@@ -29,7 +31,7 @@ const integrationOjb = (obj) => {
...
prev
,
[
`$
${
currVal
}
`
]:
obj
[
currVal
]
}
},{})
},
{})
}
/**
...
...
@@ -76,12 +78,53 @@ const godAtob = (str: string) => {
*/
const
newMapValues
=
(
newMapArr
:
Map
<
any
,
any
>
,
isFlat
?:
boolean
,
depth
?:
number
)
=>
{
let
values
=
[]
for
(
const
[
key
,
value
]
of
newMapArr
)
{
for
(
const
[
key
,
value
]
of
newMapArr
)
{
values
.
push
(
value
)
}
return
isFlat
?
values
.
flat
(
depth
??
1
)
:
values
}
/**
* InputNumber 属性 parser
* @param value
* @returns
*/
const
limitDecimalsP
=
(
value
:
any
)
=>
{
let
reg
=
/^
(\d
+
)\.(\d{4})
.*$/
return
value
.
replace
(
/
\s?
|
(
,*
)
/g
,
''
).
replace
(
reg
,
'$1$2.$3'
)
}
/**
* InputNumber 属性 formatter
* @param value
* @returns
*/
const
limitDecimalsF
=
(
value
:
moment
.
Moment
)
=>
{
let
reg
=
/^
(\d
+
)\.(\d{4})
.*$/
return
`
${
value
}
`
.
replace
(
reg
,
'$1$2.$3$4'
)
// return `${value}`.replace(/\B(?=(\d{6})+(?!\d))/g, ',').replace(reg, '$1$2.$3') // 三位一个逗号 有bug
}
/**
* 不能选择今天之前的日期和今天
* @param current
* @returns
*/
const
disabledDate
=
(
current
:
moment
.
Moment
)
=>
{
return
current
&&
current
<
moment
().
endOf
(
'day'
)
}
const
NEWDATE
=
new
Date
()
const
YEAR
=
NEWDATE
.
getFullYear
()
const
TODAY
=
NEWDATE
.
getTime
()
/**
* 判断是否在今天之后
* @param day
*/
const
afterToday
=
(
day
:
string
)
=>
{
}
export
{
convertArrToObj
,
integrationOjb
,
...
...
@@ -89,4 +132,7 @@ export {
godBtoa
,
godAtob
,
newMapValues
,
limitDecimalsP
,
limitDecimalsF
,
disabledDate
,
}
\ No newline at end of file
src/pages/order/utils/date.ts
View file @
fa1aba15
...
...
@@ -32,40 +32,8 @@ const getDayAll = (starDay: string, endDay: string) => {
// dates.pop()
return
dates
}
// deliveryPlanManagement - deliveryPlanAwaitB2B - details copy.ts 测试使用,上线前需要删除
const
getDayAll2
=
(
starDay
:
string
,
endDay
:
string
)
=>
{
let
arr
=
[]
let
dates
=
[]
// 设置两个日期UTC时间
let
db
=
new
Date
(
starDay
)
let
de
=
new
Date
(
endDay
)
// 获取两个日期GTM时间
let
s
=
db
.
getTime
()
-
24
*
60
*
60
*
1000
let
d
=
de
.
getTime
()
-
24
*
60
*
60
*
1000
// 获取到两个日期之间的每一天的毫秒数
for
(
let
i
=
s
;
i
<=
d
;
)
{
i
=
i
+
24
*
60
*
60
*
1000
arr
.
push
(
parseInt
(
String
(
i
)))
}
// 获取每一天的时间 YY-MM-DD
for
(
let
j
in
arr
)
{
let
time
=
new
Date
(
arr
[
j
])
let
year
=
time
.
getFullYear
()
let
mouth
=
time
.
getMonth
()
+
1
>=
10
?
time
.
getMonth
()
+
1
:
'0'
+
(
time
.
getMonth
()
+
1
)
let
day
=
time
.
getDate
()
>=
10
?
time
.
getDate
()
:
'0'
+
time
.
getDate
()
// year + '-' +
let
YYMMDD
=
year
+
'-'
+
mouth
+
'-'
+
day
dates
.
push
(
YYMMDD
)
}
dates
.
pop
()
return
dates
}
export
{
getDayAll
,
getDayAll2
,
}
\ No newline at end of file
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