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
linweijiong
jinfa-platform
Commits
8849f054
Commit
8849f054
authored
Aug 31, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 商品批量上下架限制状态和类型,商品行操作由接口字段控制,处理采购下单删除地址后提交异常问题
parent
e6bb5ed2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
126 additions
and
196 deletions
+126
-196
index.tsx
src/components/TableOperation/index.tsx
+24
-35
index.tsx
src/pages/commodity/products/index.tsx
+57
-43
viewProducts.tsx
src/pages/commodity/products/viewProducts.tsx
+1
-1
useSelfTable.tsx
...aseOrder/addPurchaseWarehouseOrder/model/useSelfTable.tsx
+6
-10
index.tsx
src/pages/transaction/purchaseOrder/index.tsx
+7
-28
index.tsx
...r/orderCollectSrm/components/contractModalTable/index.tsx
+1
-2
index.tsx
...r/orderCollectSrm/components/materialModalTable/index.tsx
+1
-2
index.tsx
...eOrder/orderCollectSrm/components/selectAddress/index.tsx
+6
-1
index.tsx
...pages/transaction/purchaseOrder/orderCollectSrm/index.tsx
+1
-1
useReadyAddOrder.tsx
...on/purchaseOrder/readyAddOrder/model/useReadyAddOrder.tsx
+7
-28
useSelfTable.tsx
...tion/saleOrder/addSaleDelevedOrder/model/useSelfTable.tsx
+3
-8
index.tsx
src/pages/transaction/saleOrder/index.tsx
+7
-29
useSelfTable.tsx
...n/saleOrder/readyAddLogisticsOrder/model/useSelfTable.tsx
+5
-8
No files found.
src/components/TableOperation/index.tsx
View file @
8849f054
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
Popconfirm
,
Button
,
Dropdown
,
Menu
}
from
'antd'
import
React
from
'react'
import
{
Button
,
Dropdown
,
Menu
}
from
'antd'
import
{
CaretDownOutlined
}
from
'@ant-design/icons'
/**
* 表格行操作
* 操作显示隐藏受控接口返回字段
* 操作按钮大于两项 显示更多
*/
type
IButtonTextFieldMap
=
Record
<
string
,
boolean
>
;
type
IOperationHandler
=
Record
<
string
,
any
>
;
export
interface
TableOperationProps
{
record
:
any
,
/** 自定义状态字段, 默认'status' */
customField
?:
string
,
/** 所有状态和操作名称的映射 */
statusOperationMap
:
any
,
/** 所有的操作句柄函数 */
operationHandler
:
any
,
/** 优先靠前的操作名称 */
priorityOperationName
?:
string
,
/** 按钮文本和字段值映射 */
buttonTextFieldMap
:
IButtonTextFieldMap
,
/** 按钮文本和操作函数映射 */
operationHandler
:
IOperationHandler
,
}
const
TableOperation
:
React
.
FC
<
TableOperationProps
>
=
(
props
)
=>
{
const
{
buttonTextFieldMap
,
operationHandler
}
=
props
const
keyNames
=
Object
.
keys
(
buttonTextFieldMap
)
const
{
record
,
statusOperationMap
,
operationHandler
,
priorityOperationName
,
customField
=
'status'
}
=
props
const
[
operationName
,
setOperationName
]
=
useState
<
string
[]
>
([])
useEffect
(()
=>
{
let
maps
=
record
[
customField
]
?
statusOperationMap
[
record
[
customField
]]
:
[]
if
(
maps
.
length
>
2
&&
priorityOperationName
&&
maps
.
includes
(
priorityOperationName
)){
let
temp
=
maps
.
filter
(
_
=>
_
!=
priorityOperationName
)
temp
.
unshift
(
priorityOperationName
)
setOperationName
(
temp
)
}
else
{
setOperationName
(()
=>
record
[
customField
]
?
statusOperationMap
[
record
[
customField
]]
:
[])
}
},
[
record
])
return
(
<>
return
(<>
{
operationName
.
length
>
2
Object
.
values
(
buttonTextFieldMap
).
filter
(
Boolean
)
.
length
>
2
?
<>
<
Button
type=
'link'
onClick=
{
operationHandler
[
operationName
[
0
]]
}
>
{
operationName
[
0
]
}
</
Button
>
<
Button
type=
'link'
onClick=
{
operationHandler
[
keyNames
[
0
]]
}
>
{
keyNames
[
0
]
}
</
Button
>
<
Dropdown
overlay=
{
<
Menu
>
{
operationName
.
slice
(
1
,
operationName
.
length
).
map
((
e
,
i
)
=>
(
keyNames
.
slice
(
1
,
keyNames
.
length
).
map
((
item
,
i
)
=>
buttonTextFieldMap
[
item
]
?
(
<
Menu
.
Item
key=
{
`menuItem${i}`
}
>
<
Button
type=
'link'
onClick=
{
operationHandler
[
e
]
}
>
{
e
}
</
Button
>
<
Button
type=
'link'
onClick=
{
operationHandler
[
item
]
}
>
{
item
}
</
Button
>
</
Menu
.
Item
>
))
)
:
null
)
}
</
Menu
>
}
>
...
...
@@ -54,10 +44,9 @@ const TableOperation:React.FC<TableOperationProps> = (props) => {
</
Dropdown
>
</>
:
operationName
.
map
((
e
,
i
)
=>
(<
Button
key=
{
`btnItem${i}`
}
type=
'link'
onClick=
{
operationHandler
[
e
]
}
>
{
e
}
</
Button
>
))
keyNames
.
map
((
item
,
i
)
=>
(
buttonTextFieldMap
[
item
]
?
<
Button
key=
{
`btnItem${i}`
}
type=
'link'
onClick=
{
operationHandler
[
item
]
}
>
{
item
}
</
Button
>
:
null
))
}
</>
)
</>)
}
TableOperation
.
defaultProps
=
{}
...
...
src/pages/commodity/products/index.tsx
View file @
8849f054
This diff is collapsed.
Click to expand it.
src/pages/commodity/products/viewProducts.tsx
View file @
8849f054
...
...
@@ -520,7 +520,7 @@ const viewProducts: React.FC<{}> = () => {
{
/* 没有价格属性默认一行直接显示图片 */
}
<
div
className=
{
styles
.
productImgBox
}
>
{
productDetail
?.
unitPriceAndPicList
[
0
].
commodityPic
.
length
>
0
&&
productDetail
?.
unitPriceAndPicList
[
0
].
commodityPic
.
map
((
_item
,
index
)
=>
productDetail
?.
unitPriceAndPicList
?.
length
&&
productDetail
?.
unitPriceAndPicList
[
0
].
commodityPic
.
length
>
0
&&
productDetail
?.
unitPriceAndPicList
[
0
].
commodityPic
.
map
((
_item
,
index
)
=>
<
div
key=
{
index
}
className=
{
styles
.
imgItem
}
><
img
className=
{
styles
.
pic
}
src=
{
_item
}
alt=
""
/>
</
div
>)
}
...
...
src/pages/transaction/purchaseOrder/addPurchaseWarehouseOrder/model/useSelfTable.tsx
View file @
8849f054
import
React
,
{
useRef
}
from
'react'
import
{
history
,
Link
}
from
'umi'
import
{
Button
,
Row
,
Col
,
Modal
}
from
'antd'
import
{
Modal
}
from
'antd'
import
{
PublicApi
}
from
'@/services/api'
import
EyePreview
from
'@/components/EyePreview'
import
{
formatTimeString
}
from
'@/utils'
import
StatusColors
from
'@/pages/transaction/components/statusColors'
import
{
FieldTimeOutlined
}
from
'@ant-design/icons'
import
{
ORDER_TYPE
,
PurchaseOrderInsideWorkState
}
from
'@/constants/order'
import
{
DOC_TYPE_PURCHASE_RECEIPT
}
from
'@/constants/commodity'
import
TableOperation
from
'@/components/TableOperation'
// 业务hooks, 待支付订单
export
const
useSelfTable
=
()
=>
{
const
ref
=
useRef
<
any
>
({})
/** 参照后台数据生成 */
const
renderOptionButton
=
(
record
:
any
)
=>
{
const
statusAndOperationList
=
{
'
9'
:
[
'新增入库单'
]
,
'
10'
:
[
'审核'
]
,
const
buttonGroup
=
{
'
审核'
:
true
,
'
新增入库单'
:
true
,
}
const
operationHandler
=
{
'审核'
:
()
=>
handleConfirm
(
record
),
'新增入库单'
:
()
=>
handleAdd
(
record
),
}
return
(
<
TableOperation
record=
{
record
}
customField=
'button'
statusOperationMap=
{
statusAndOperationList
}
buttonTextFieldMap=
{
buttonGroup
}
operationHandler=
{
operationHandler
}
priorityOperationName=
'审核'
/>
)
}
...
...
src/pages/transaction/purchaseOrder/index.tsx
View file @
8849f054
...
...
@@ -17,6 +17,7 @@ import cx from 'classnames'
import
ModalForm
from
'@/components/ModalForm'
import
{
useHttpRequest
}
from
'@/hooks/useHttpRequest'
import
{
CaretDownOutlined
}
from
'@ant-design/icons'
import
TableOperation
from
'@/components/TableOperation'
const
SelectStyles
=
styled
((
props
)
=>
<
div
className=
'select-list'
{
...
props
}
></
div
>)
`
.select_style_border {
...
...
@@ -137,34 +138,12 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
'评价'
:
()
=>
handleEvaluate
(
record
.
orderId
),
}
const
keyNames
=
Object
.
keys
(
buttonGroup
)
return
(<>
{
Object
.
values
(
buttonGroup
).
filter
(
Boolean
).
length
>
2
?
<>
<
Button
type=
'link'
onClick=
{
operationHandler
[
keyNames
[
0
]]
}
>
{
keyNames
[
0
]
}
</
Button
>
<
Dropdown
overlay=
{
<
Menu
>
{
keyNames
.
slice
(
1
,
keyNames
.
length
).
map
((
e
,
i
)
=>
(
<
Menu
.
Item
key=
{
`menuItem${i}`
}
>
<
Button
type=
'link'
onClick=
{
operationHandler
[
e
]
}
>
{
e
}
</
Button
>
</
Menu
.
Item
>
))
}
</
Menu
>
}
>
<
a
className=
"ant-dropdown-link"
onClick=
{
e
=>
e
.
preventDefault
()
}
>
更多
<
CaretDownOutlined
/>
</
a
>
</
Dropdown
>
</>
:
keyNames
.
map
((
e
,
i
)
=>
(
buttonGroup
[
e
]
?
<
Button
key=
{
`btnItem${i}`
}
type=
'link'
onClick=
{
operationHandler
[
e
]
}
>
{
e
}
</
Button
>
:
null
))
}
</>)
return
(
<
TableOperation
buttonTextFieldMap=
{
buttonGroup
}
operationHandler=
{
operationHandler
}
/>
)
}
const
secondColumns
=
()
=>
{
...
...
src/pages/transaction/purchaseOrder/orderCollectSrm/components/contractModalTable/index.tsx
View file @
8849f054
...
...
@@ -79,8 +79,7 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => {
temp
.
brand
=
v
.
brand
;
temp
.
unit
=
v
.
unit
;
temp
.
relevanceProductId
=
v
.
associatedDataId
;
temp
.
relevanceProductName
=
v
.
associatedMaterielName
;
temp
.
relevanceProductNo
=
v
.
associatedMaterielNo
;
temp
.
relevanceProductName
=
v
.
associatedGoods
;
temp
.
relevanceProductType
=
v
.
associatedType
;
temp
.
relevanceProductCategory
=
v
.
associatedCategory
;
temp
.
relevanceProductBrand
=
v
.
associatedBrand
;
...
...
src/pages/transaction/purchaseOrder/orderCollectSrm/components/materialModalTable/index.tsx
View file @
8849f054
...
...
@@ -100,8 +100,7 @@ const MaterialModalTable:React.FC<MaterialModalTableProps> = (props) => {
temp
.
brand
=
v
.
brand
;
temp
.
unit
=
v
.
unit
;
temp
.
relevanceProductId
=
v
.
associatedDataId
;
temp
.
relevanceProductName
=
v
.
associatedMaterielName
;
temp
.
relevanceProductNo
=
v
.
associatedMaterielNo
;
temp
.
relevanceProductName
=
v
.
associatedGoods
;
temp
.
relevanceProductType
=
v
.
associatedType
;
temp
.
relevanceProductCategory
=
v
.
associatedCategory
;
temp
.
relevanceProductBrand
=
v
.
associatedBrand
;
...
...
src/pages/transaction/purchaseOrder/orderCollectSrm/components/selectAddress/index.tsx
View file @
8849f054
...
...
@@ -66,7 +66,8 @@ const SelectAddress = (props: ISchemaFieldComponentProps) => {
value
=
dataSource
.
find
(
v
=>
v
.
id
===
value
)
||
{}
}
// 当前选中的id
const
checkedId
=
value
.
id
||
dataSource
[
0
]?.
id
// const checkedId = value.id || dataSource[0]?.id
const
checkedId
=
value
.
id
const
handleAdd
=
()
=>
{
setMode
(
'add'
)
...
...
@@ -98,6 +99,10 @@ const SelectAddress = (props: ISchemaFieldComponentProps) => {
e
.
stopPropagation
()
try
{
const
result
=
await
PublicApi
.
postLogisticsReceiverAddressDelete
({
id
})
if
(
result
.
code
===
1000
)
{
// 删除后置空表单值
mutators
.
change
([])
}
reloadAddress
()
}
catch
(
error
)
{
...
...
src/pages/transaction/purchaseOrder/orderCollectSrm/index.tsx
View file @
8849f054
...
...
@@ -199,7 +199,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// 交付地址数据字段转换拼接 查询省市区冗余
const
{
data
:
addressDetail
,
code
}
=
await
PublicApi
.
getLogisticsReceiverAddressGet
({
id
:
params
.
deliveryAddresId
?.
id
||
params
.
deliveryAddresId
})
}
,
{
ctlType
:
'none'
}
)
if
(
code
===
1000
)
{
params
.
consignee
=
{
deliverDate
:
params
.
deliverDate
,
...
...
src/pages/transaction/purchaseOrder/readyAddOrder/model/useReadyAddOrder.tsx
View file @
8849f054
...
...
@@ -5,6 +5,7 @@ import { PublicApi } from '@/services/api'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
import
{
history
}
from
'umi'
import
{
CaretDownOutlined
}
from
'@ant-design/icons'
import
TableOperation
from
'@/components/TableOperation'
// 业务hooks, 待新增订单
export
const
useSelfTable
=
()
=>
{
...
...
@@ -36,34 +37,12 @@ export const useSelfTable = () => {
'删除'
:
()
=>
handleDelete
(
record
.
orderId
),
}
const
keyNames
=
Object
.
keys
(
buttonGroup
)
return
(<>
{
Object
.
values
(
buttonGroup
).
filter
(
Boolean
).
length
>
2
?
<>
<
Button
type=
'link'
onClick=
{
operationHandler
[
keyNames
[
0
]]
}
>
{
keyNames
[
0
]
}
</
Button
>
<
Dropdown
overlay=
{
<
Menu
>
{
keyNames
.
slice
(
1
,
keyNames
.
length
).
map
((
e
,
i
)
=>
(
<
Menu
.
Item
key=
{
`menuItem${i}`
}
>
<
Button
type=
'link'
onClick=
{
operationHandler
[
e
]
}
>
{
e
}
</
Button
>
</
Menu
.
Item
>
))
}
</
Menu
>
}
>
<
a
className=
"ant-dropdown-link"
onClick=
{
e
=>
e
.
preventDefault
()
}
>
更多
<
CaretDownOutlined
/>
</
a
>
</
Dropdown
>
</>
:
keyNames
.
map
((
e
,
i
)
=>
(
buttonGroup
[
e
]
?
<
Button
key=
{
`btnItem${i}`
}
type=
'link'
onClick=
{
operationHandler
[
e
]
}
>
{
e
}
</
Button
>
:
null
))
}
</>)
return
(
<
TableOperation
buttonTextFieldMap=
{
buttonGroup
}
operationHandler=
{
operationHandler
}
/>
)
}
const
secondColumns
=
()
=>
{
...
...
src/pages/transaction/saleOrder/addSaleDelevedOrder/model/useSelfTable.tsx
View file @
8849f054
...
...
@@ -19,21 +19,16 @@ export const useSelfTable = () => {
/** 参照后台数据生成 */
const
renderOptionButton
=
(
record
:
any
)
=>
{
const
statusAndOperationList
=
{
'11'
:
[
'新增发货单'
],
'12'
:
[
'审核'
],
}
const
buttonGroup
=
{
'新增发货单'
:
true
,
'审核'
:
true
}
const
operationHandler
=
{
'审核'
:
()
=>
handleConfirm
(
record
),
'新增发货单'
:
()
=>
handleAdd
(
record
),
}
return
(
<
TableOperation
record=
{
record
}
customField=
'button'
statusOperationMap=
{
statusAndOperationList
}
buttonTextFieldMap=
{
buttonGroup
}
operationHandler=
{
operationHandler
}
priorityOperationName=
'审核'
/>
)
}
...
...
src/pages/transaction/saleOrder/index.tsx
View file @
8849f054
...
...
@@ -13,10 +13,10 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke
import
Submit
from
'@/components/NiceForm/components/Submit'
import
NiceForm
from
'@/components/NiceForm'
import
{
createFormActions
}
from
'@formily/antd'
import
TableOperation
from
'@/components/TableOperation'
import
ModalForm
from
'@/components/ModalForm'
import
{
useHttpRequest
}
from
'@/hooks/useHttpRequest'
import
{
CaretDownOutlined
}
from
'@ant-design/icons'
import
TableOperation
from
'@/components/TableOperation'
// 销售订单查询
...
...
@@ -90,34 +90,12 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
'评价'
:
()
=>
handleEvaluate
(
record
.
orderId
),
}
const
keyNames
=
Object
.
keys
(
buttonGroup
)
return
(<>
{
Object
.
values
(
buttonGroup
).
filter
(
Boolean
).
length
>
2
?
<>
<
Button
type=
'link'
onClick=
{
operationHandler
[
keyNames
[
0
]]
}
>
{
keyNames
[
0
]
}
</
Button
>
<
Dropdown
overlay=
{
<
Menu
>
{
keyNames
.
slice
(
1
,
keyNames
.
length
).
map
((
e
,
i
)
=>
(
<
Menu
.
Item
key=
{
`menuItem${i}`
}
>
<
Button
type=
'link'
onClick=
{
operationHandler
[
e
]
}
>
{
e
}
</
Button
>
</
Menu
.
Item
>
))
}
</
Menu
>
}
>
<
a
className=
"ant-dropdown-link"
onClick=
{
e
=>
e
.
preventDefault
()
}
>
更多
<
CaretDownOutlined
/>
</
a
>
</
Dropdown
>
</>
:
keyNames
.
map
((
e
,
i
)
=>
(
buttonGroup
[
e
]
?
<
Button
key=
{
`btnItem${i}`
}
type=
'link'
onClick=
{
operationHandler
[
e
]
}
>
{
e
}
</
Button
>
:
null
))
}
</>)
return
(
<
TableOperation
buttonTextFieldMap=
{
buttonGroup
}
operationHandler=
{
operationHandler
}
/>
)
}
const
secondColumns
=
()
=>
{
...
...
src/pages/transaction/saleOrder/readyAddLogisticsOrder/model/useSelfTable.tsx
View file @
8849f054
...
...
@@ -18,10 +18,10 @@ export const useSelfTable = () => {
/** 参照后台数据生成 */
const
renderOptionButton
=
(
record
:
any
)
=>
{
const
statusAndOperationList
=
{
'
13'
:
[
'新增物流单'
]
,
'
14'
:
[
'查看物流单'
]
,
'
15'
:
[
'修改物流单'
]
,
const
buttonGroup
=
{
'
新增物流单'
:
true
,
'
查看物流单'
:
true
,
'
修改物流单'
:
true
,
}
const
operationHandler
=
{
'新增物流单'
:
()
=>
handleConfirm
(
record
),
...
...
@@ -30,11 +30,8 @@ export const useSelfTable = () => {
}
return
(
<
TableOperation
record=
{
record
}
customField=
'button'
statusOperationMap=
{
statusAndOperationList
}
buttonTextFieldMap=
{
buttonGroup
}
operationHandler=
{
operationHandler
}
priorityOperationName=
'审核'
/>
)
}
...
...
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