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
陈智峰
jinfa-platform
Commits
90a73683
Commit
90a73683
authored
Feb 04, 2021
by
GuanHua
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://10.0.0.22:3000/lingxi/lingxi-business-paltform
into dev
parents
87d2f00a
601f76d0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
154 additions
and
105 deletions
+154
-105
index.ts
src/components/ModalTable/schema/index.ts
+12
-0
index.tsx
...er/orderCollect/components/mergeOrderModalTable/index.tsx
+18
-11
index.tsx
...Order/orderCollect/components/productModalTable/index.tsx
+7
-2
index.tsx
...eOrder/orderCollect/components/productTableCell/index.tsx
+2
-2
index.ts
...s/transaction/purchaseOrder/orderCollect/effects/index.ts
+12
-0
index.tsx
src/pages/transaction/purchaseOrder/orderCollect/index.tsx
+3
-3
useProductTable.tsx
...tion/purchaseOrder/orderCollect/model/useProductTable.tsx
+14
-1
useReadyAddOrder.tsx
...on/purchaseOrder/readyAddOrder/model/useReadyAddOrder.tsx
+86
-86
No files found.
src/components/ModalTable/schema/index.ts
View file @
90a73683
...
@@ -189,6 +189,18 @@ export const addOrderModalSchema: ISchema = {
...
@@ -189,6 +189,18 @@ export const addOrderModalSchema: ISchema = {
queryParams
:
{},
queryParams
:
{},
}
}
},
},
// customerCategoryId: {
// type: 'string',
// 'x-component': 'CustomCategorySearch',
// 'x-component-props': {
// placeholder: '商品品类',
// showSearch: true,
// notFoundContent: null,
// style: { width: '174px' },
// dataoption: [],
// fieldNames: { label: 'title', value: 'id', children: 'children' },
// },
// },
brandId
:
{
brandId
:
{
type
:
'string'
,
type
:
'string'
,
"x-component"
:
'SearchSelect'
,
"x-component"
:
'SearchSelect'
,
...
...
src/pages/transaction/purchaseOrder/orderCollect/components/mergeOrderModalTable/index.tsx
View file @
90a73683
...
@@ -13,6 +13,7 @@ import { mergeSearchSchema } from './schema'
...
@@ -13,6 +13,7 @@ import { mergeSearchSchema } from './schema'
import
NestTable
from
'@/components/NestTable'
import
NestTable
from
'@/components/NestTable'
import
{
PublicApi
}
from
'@/services/api'
import
{
PublicApi
}
from
'@/services/api'
import
{
getUnitPriceTotal
}
from
'../../model/useProductTable'
import
{
getUnitPriceTotal
}
from
'../../model/useProductTable'
import
{
usePageStatus
}
from
'@/hooks/usePageStatus'
export
interface
MergeOrderModalTableProps
{
export
interface
MergeOrderModalTableProps
{
title
:
string
,
title
:
string
,
...
@@ -23,6 +24,7 @@ export interface MergeOrderModalTableProps {
...
@@ -23,6 +24,7 @@ export interface MergeOrderModalTableProps {
handleUpdate
?:
any
,
handleUpdate
?:
any
,
}
}
// const { pageStatus } = usePageStatus()
const
formActions
=
createFormActions
();
const
formActions
=
createFormActions
();
...
@@ -188,11 +190,12 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
...
@@ -188,11 +190,12 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
message
.
error
(
"请选择待合并订单"
)
message
.
error
(
"请选择待合并订单"
)
return
;
return
;
}
}
let
_originSource
=
[...
dataSource
.
data
]
let
_selectedRows
=
dataSource
.
data
.
filter
(
item
=>
selectedRowKeys
.
includes
(
item
.
id
))
// 只选一个子级 selectedRowKeys可能为空
let
_selectedRows
=
_originSource
.
filter
(
item
=>
selectedRowKeys
.
includes
(
item
.
id
))
setSelectedRows
(()
=>
_selectedRows
)
setSelectedRows
(()
=>
_selectedRows
)
let
allchildren
=
dataSource
.
data
.
map
(
item
=>
item
[
"productDateilss"
]).
reduce
((
prev
,
next
)
=>
prev
.
concat
(
next
),
[])
let
allchildren
=
_originSource
.
map
(
item
=>
item
[
"productDateilss"
]).
reduce
((
prev
,
next
)
=>
prev
.
concat
(
next
),
[])
let
_childSelectedRows
=
allchildren
.
filter
(
item
=>
childSelectedRowKeys
.
includes
(
item
.
id
))
let
_childSelectedRows
=
allchildren
.
filter
(
item
=>
childSelectedRowKeys
.
includes
(
item
.
id
))
setChildSelectedRows
(()
=>
_childSelectedRows
)
setChildSelectedRows
(()
=>
_childSelectedRows
)
...
@@ -203,24 +206,29 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
...
@@ -203,24 +206,29 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
// 开始数量合并
// 开始数量合并
let
processOrderProductRequests
=
schemaAction
.
getFieldValue
(
"orderProductRequests"
)
let
processOrderProductRequests
=
schemaAction
.
getFieldValue
(
"orderProductRequests"
)
processOrderProductRequests
.
map
(
item
=>
{
let
__
=
processOrderProductRequests
.
map
(
item
=>
{
item
[
"productId"
]
=
item
.
id
item
[
"productId"
]
=
item
.
id
if
(
item
.
id
===
currentClickRow
.
id
)
{
if
(
item
.
id
===
currentClickRow
.
id
)
{
let
count
=
_childSelectedRows
.
length
>
1
?
_childSelectedRows
.
reduce
((
a
,
b
)
=>
a
.
purchaseCount
+
b
.
purchaseCount
)
:
_childSelectedRows
[
0
].
purchaseCount
// let count = _childSelectedRows.length > 1 ? _childSelectedRows.reduce((a, b) => a.purchaseCount + b.purchaseCount) : _childSelectedRows[0].purchaseCount
item
.
purchaseCount
=
count
+
item
.
purchaseCount
||
0
// @to fix 第一次合并无法填入采购数量 新增情况下:手工模式不累加,报价单模式累加;编辑模式都累加
// item["purchaseCount"] = count + (item?.purchaseCount || 0)
item
[
"purchaseCount"
]
=
_childSelectedRows
.
length
>
1
?
_childSelectedRows
.
reduce
((
a
,
b
)
=>
a
.
purchaseCount
+
b
.
purchaseCount
)
:
_childSelectedRows
[
0
].
purchaseCount
item
[
'money'
]
=
getUnitPriceTotal
(
item
)
item
[
'money'
]
=
getUnitPriceTotal
(
item
)
}
}
return
item
return
item
})
})
schemaAction
.
setFieldValue
(
"orderProductRequests"
,
processOrderProductRequests
)
console
.
log
(
"开始合并"
,
__
)
schemaAction
.
setFieldValue
(
"orderProductRequests"
,
__
)
console
.
log
(
_originSource
,
selectedRowKeys
,
childSelectedRowKeys
,
selectedRows
,
childSelectedRows
,
_selectedRows
,
_childSelectedRows
)
// 生成orderProducts参数
// 生成orderProducts参数
let
_orderProducts
=
_childSelectedRows
.
map
(
item
=>
{
let
_orderProducts
=
_childSelectedRows
.
map
(
item
=>
{
for
(
let
_index
in
_
selectedRows
)
{
for
(
let
_index
in
_
originSource
)
{
let
_childKey
=
_
selectedRows
[
_index
][
"productDateilss"
].
map
(
_
=>
_
.
id
)
let
_childKey
=
_
originSource
[
_index
][
"productDateilss"
].
map
(
_
=>
_
.
id
)
if
(
_childKey
.
includes
(
item
.
id
))
{
if
(
_childKey
.
includes
(
item
.
id
))
{
return
{
return
{
mergeOrderId
:
_
selectedRows
[
_index
][
"id"
],
mergeOrderId
:
_
originSource
[
_index
][
"id"
],
productId
:
item
[
"productId"
]
productId
:
item
[
"productId"
]
}
}
}
}
...
@@ -230,7 +238,6 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
...
@@ -230,7 +238,6 @@ const MergeOrderModalTable:React.FC<MergeOrderModalTableProps> = (props) => {
let
hasVal
=
schemaAction
.
getFieldValue
(
"ordeProducts"
)
||
[]
let
hasVal
=
schemaAction
.
getFieldValue
(
"ordeProducts"
)
||
[]
schemaAction
.
setFieldValue
(
"ordeProducts"
,
[...
_orderProducts
,
...
hasVal
])
schemaAction
.
setFieldValue
(
"ordeProducts"
,
[...
_orderProducts
,
...
hasVal
])
// console.log("开始合并", currentClickRow, schemaAction.getFieldValue("orderProductRequests"), processOrderProductRequests, _orderProducts)
// 执行update 更新总价
// 执行update 更新总价
handleUpdate
()
handleUpdate
()
...
...
src/pages/transaction/purchaseOrder/orderCollect/components/productModalTable/index.tsx
View file @
90a73683
...
@@ -3,7 +3,7 @@ import ModalTable, { ModalTableProps } from '@/components/ModalTable'
...
@@ -3,7 +3,7 @@ import ModalTable, { ModalTableProps } from '@/components/ModalTable'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
import
{
fetchOrderApi
}
from
'../../apis'
import
{
fetchOrderApi
}
from
'../../apis'
import
{
useModalTable
}
from
'../../model/useModalTable'
import
{
useModalTable
}
from
'../../model/useModalTable'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
import
{
FormEffectHooks
,
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
import
{
DELIVERY_TYPE
,
OrderModalType
}
from
'@/constants'
import
{
DELIVERY_TYPE
,
OrderModalType
}
from
'@/constants'
import
{
PublicApi
}
from
'@/services/api'
import
{
PublicApi
}
from
'@/services/api'
import
{
EnvironmentOutlined
}
from
'@ant-design/icons'
import
{
EnvironmentOutlined
}
from
'@ant-design/icons'
...
@@ -16,6 +16,8 @@ import SearchSelect from '@/components/NiceForm/components/SearchSelect';
...
@@ -16,6 +16,8 @@ import SearchSelect from '@/components/NiceForm/components/SearchSelect';
import
Submit
from
'@/components/NiceForm/components/Submit'
;
import
Submit
from
'@/components/NiceForm/components/Submit'
;
import
DateSelect
from
'@/components/NiceForm/components/DateSelect'
;
import
DateSelect
from
'@/components/NiceForm/components/DateSelect'
;
import
{
action
}
from
'mobx'
import
{
action
}
from
'mobx'
import
{
searchCustomerCategoryOptionEffect
}
from
'../../effects'
import
CustomCategorySearch
from
'@/components/NiceForm/components/CustomCategorySearch'
export
interface
ProductModalTableProps
extends
ModalTableProps
{
export
interface
ProductModalTableProps
extends
ModalTableProps
{
type
?:
'radio'
|
'checkbox'
,
type
?:
'radio'
|
'checkbox'
,
...
@@ -216,7 +218,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
...
@@ -216,7 +218,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
formilyProps=
{
{
formilyProps=
{
{
ctx
:
{
ctx
:
{
schema
:
addOrderModalSchema
,
schema
:
addOrderModalSchema
,
components
:
{
ModalSearch
:
Search
,
SearchSelect
,
Submit
,
DateSelect
},
components
:
{
ModalSearch
:
Search
,
SearchSelect
,
Submit
,
DateSelect
,
CustomCategorySearch
},
effects
:
(
$
,
actions
)
=>
{
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
useStateFilterSearchLinkageEffect
(
$
,
$
,
...
@@ -230,6 +232,9 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
...
@@ -230,6 +232,9 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
memberRoleId
:
schemaAction
.
getFieldValue
(
'supplyMembersRoleId'
)
memberRoleId
:
schemaAction
.
getFieldValue
(
'supplyMembersRoleId'
)
}
}
})
})
// FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state =>
{
// searchCustomerCategoryOptionEffect(actions, 'customerCategoryId')
//
})
actions
.
setFieldState
(
'brandId'
,
state
=>
{
actions
.
setFieldState
(
'brandId'
,
state
=>
{
state
.
props
[
'x-component-props'
].
queryParams
=
{
state
.
props
[
'x-component-props'
].
queryParams
=
{
memberId
:
schemaAction
.
getFieldValue
(
'supplyMembersId'
),
memberId
:
schemaAction
.
getFieldValue
(
'supplyMembersId'
),
...
...
src/pages/transaction/purchaseOrder/orderCollect/components/productTableCell/index.tsx
View file @
90a73683
...
@@ -45,7 +45,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
...
@@ -45,7 +45,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
formItemProps
=
{},
formItemProps
=
{},
...
restProps
...
restProps
})
=>
{
})
=>
{
//
const formItemRef = useRef<any>();
const
formItemRef
=
useRef
<
any
>
();
const
{
form
}
=
useContext
(
EditableContext
);
const
{
form
}
=
useContext
(
EditableContext
);
const
save
=
async
e
=>
{
const
save
=
async
e
=>
{
try
{
try
{
...
@@ -73,7 +73,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
...
@@ -73,7 +73,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
return
<
Input
return
<
Input
style=
{
{
width
:
140
}
}
style=
{
{
width
:
140
}
}
type=
'number'
type=
'number'
//
ref={formItemRef}
ref=
{
formItemRef
}
onChange=
{
save
}
onChange=
{
save
}
{
...
formItemProps
}
{
...
formItemProps
}
id=
{
dataIndex
+
record
.
id
}
id=
{
dataIndex
+
record
.
id
}
...
...
src/pages/transaction/purchaseOrder/orderCollect/effects/index.ts
View file @
90a73683
...
@@ -354,3 +354,15 @@ export const useOrderUpdateChangeOther = (ctx: ISchemaFormActions | ISchemaFormA
...
@@ -354,3 +354,15 @@ export const useOrderUpdateChangeOther = (ctx: ISchemaFormActions | ISchemaFormA
})
})
}
}
// 高级筛选schema中用于输入搜索商品品类的Effect
export
const
searchCustomerCategoryOptionEffect
=
(
context
:
any
,
fieldName
:
string
)
=>
{
context
.
getFieldState
(
fieldName
,
state
=>
{
PublicApi
.
getProductCustomerGetCustomerCategoryTree
().
then
(
res
=>
{
context
.
setFieldState
(
fieldName
,
state
=>
{
state
.
props
[
'x-component-props'
].
dataoption
=
res
.
data
})
})
})
}
src/pages/transaction/purchaseOrder/orderCollect/index.tsx
View file @
90a73683
...
@@ -560,18 +560,18 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
...
@@ -560,18 +560,18 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
$
(
'onFieldValueChange'
,
'supplyMembersName'
).
subscribe
(
state
=>
{
$
(
'onFieldValueChange'
,
'supplyMembersName'
).
subscribe
(
state
=>
{
const
quotationOrderValue
=
ctx
.
getFieldValue
(
'quotationNo'
)
const
quotationOrderValue
=
ctx
.
getFieldValue
(
'quotationNo'
)
const
modelType
=
ctx
.
getFieldValue
(
'orderModel'
)
const
modelType
=
ctx
.
getFieldValue
(
'orderModel'
)
if
(
state
.
value
&&
!
quotationOrderValue
&&
modelType
===
9
)
{
if
(
state
.
value
&&
!
quotationOrderValue
&&
modelType
===
OrderModalType
[
"CONSOLIDATED_ORDER"
]
)
{
addSchemaAction
.
setFieldState
(
'orderProductRequests'
,
productState
=>
{
addSchemaAction
.
setFieldState
(
'orderProductRequests'
,
productState
=>
{
productState
.
props
[
"x-component-props"
]
=
{
productState
.
props
[
"x-component-props"
]
=
{
...
productState
.
props
[
"x-component-props"
],
...
productState
.
props
[
"x-component-props"
],
prefix
:
p
roductAddButton
,
prefix
:
p
ageStatus
===
PageStatus
.
ADD
?
productAddButton
:
""
,
}
}
})
})
}
}
})
})
$
(
'onFieldValueChange'
,
'quotationNo'
).
subscribe
(
state
=>
{
$
(
'onFieldValueChange'
,
'quotationNo'
).
subscribe
(
state
=>
{
const
modelType
=
ctx
.
getFieldValue
(
'orderModel'
)
const
modelType
=
ctx
.
getFieldValue
(
'orderModel'
)
if
(
state
.
value
&&
modelType
===
9
)
{
if
(
state
.
value
&&
modelType
===
OrderModalType
[
"CONSOLIDATED_ORDER"
]
)
{
addSchemaAction
.
setFieldState
(
'orderProductRequests'
,
productState
=>
{
addSchemaAction
.
setFieldState
(
'orderProductRequests'
,
productState
=>
{
productState
.
props
[
"x-component-props"
]
=
{
productState
.
props
[
"x-component-props"
]
=
{
...
productState
.
props
[
"x-component-props"
],
...
productState
.
props
[
"x-component-props"
],
...
...
src/pages/transaction/purchaseOrder/orderCollect/model/useProductTable.tsx
View file @
90a73683
...
@@ -6,6 +6,7 @@ import ProductTableCell, { ProductEditableRow } from '../components/productTable
...
@@ -6,6 +6,7 @@ import ProductTableCell, { ProductEditableRow } from '../components/productTable
import
{
useModalTable
}
from
'./useModalTable'
;
import
{
useModalTable
}
from
'./useModalTable'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
OrderModalType
}
from
'@/constants'
;
import
{
OrderModalType
}
from
'@/constants'
;
import
{
history
}
from
"umi"
;
const
{
pageStatus
}
=
usePageStatus
()
const
{
pageStatus
}
=
usePageStatus
()
...
@@ -132,7 +133,19 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
...
@@ -132,7 +133,19 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
}
}
}
else
{
}
else
{
return
[...
productInfoColumns
].
slice
(
0
,
productInfoColumns
.
length
-
1
)
// 渲染单价
productInfoColumns
[
5
].
render
=
(
t
,
r
)
=>
<
span
style=
{
{
color
:
'red'
}
}
>
¥
{
r
.
price
}
</
span
>
// 渲染商品ID
productInfoColumns
[
0
].
render
=
(
t
,
r
)
=>
r
.
productId
// 编辑并且为合并下单模式 显示合并按钮 url type===4判断类型
if
(
pageStatus
===
PageStatus
.
EDIT
&&
history
.
location
.
query
?.
type
)
{
productInfoColumns
[
productInfoColumns
.
length
-
1
].
render
=
(
text
,
record
)
=>
<
Button
type=
'link'
className=
"selectMerge"
onClick=
{
()
=>
clickMergeButton
(
record
)
}
>
选择合并订单
</
Button
>
return
[...
productInfoColumns
]
}
else
{
return
[...
productInfoColumns
].
slice
(
0
,
productInfoColumns
.
length
-
1
)
}
}
}
return
productInfoColumns
return
productInfoColumns
...
...
src/pages/transaction/purchaseOrder/readyAddOrder/model/useReadyAddOrder.tsx
View file @
90a73683
import
React
,
{
useRef
}
from
'react'
import
React
,
{
useRef
}
from
'react'
import
{
Button
,
Popconfirm
}
from
'antd'
import
{
Button
,
Popconfirm
}
from
'antd'
import
{
baseOrderListColumns
}
from
'../../constant'
import
{
baseOrderListColumns
}
from
'../../constant'
import
{
PublicApi
}
from
'@/services/api'
import
{
PublicApi
}
from
'@/services/api'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
import
{
history
}
from
'umi'
import
{
history
}
from
'umi'
import
{
PurchaseOrderInsideWorkState
,
PurchaseOrderOutWorkState
}
from
'@/constants'
import
{
PurchaseOrderInsideWorkState
,
PurchaseOrderOutWorkState
}
from
'@/constants'
// 业务hooks, 待新增订单
// 业务hooks, 待新增订单
export
const
useSelfTable
=
()
=>
{
export
const
useSelfTable
=
()
=>
{
const
ref
=
useRef
<
any
>
({})
const
ref
=
useRef
<
any
>
({})
const
[
rowSelection
,
rowSelectionCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
,
extendsSelection
:
{
const
[
rowSelection
,
rowSelectionCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
,
extendsSelection
:
{
getCheckboxProps
:
record
=>
({
getCheckboxProps
:
record
=>
({
// 不等于可提交审核的 都无法通过批量提交
// 不等于可提交审核的 都无法通过批量提交
disabled
:
record
.
interiorState
!==
PurchaseOrderInsideWorkState
.
ADD_PURCHASE_ORDER
,
disabled
:
record
.
interiorState
!==
PurchaseOrderInsideWorkState
.
ADD_PURCHASE_ORDER
,
interiorState
:
record
.
interiorState
,
interiorState
:
record
.
interiorState
,
})
})
}})
}})
const
handleSubmit
=
async
(
id
)
=>
{
const
handleSubmit
=
async
(
id
)
=>
{
// 从待新增订单直接传到一级审核, 状态写死, 默认传-1
// 从待新增订单直接传到一级审核, 状态写死, 默认传-1
await
PublicApi
.
postOrderProcurementOrderSubmitExamine
({
id
,
state
:
-
1
})
await
PublicApi
.
postOrderProcurementOrderSubmitExamine
({
id
,
state
:
-
1
})
ref
.
current
.
reload
()
ref
.
current
.
reload
()
}
}
const
handleDelete
=
async
(
id
)
=>
{
const
handleDelete
=
async
(
id
)
=>
{
await
PublicApi
.
postOrderProcurementOrderDelete
({
id
})
await
PublicApi
.
postOrderProcurementOrderDelete
({
id
})
ref
.
current
.
reload
()
ref
.
current
.
reload
()
}
}
const
handleEdit
=
(
id
)
=>
{
const
handleEdit
=
(
record
:
any
)
=>
{
history
.
push
(
`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/edit?id=
${
id
}
`
)
history
.
push
(
`/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/edit?id=
${
record
.
id
}${
record
.
type
===
4
?
'&type=4'
:
''
}
`
)
}
}
const
handleCancel
=
async
(
id
)
=>
{
const
handleCancel
=
async
(
id
)
=>
{
await
PublicApi
.
postOrderPurchaseOrderCancel
({
id
})
await
PublicApi
.
postOrderPurchaseOrderCancel
({
id
})
ref
.
current
.
reload
()
ref
.
current
.
reload
()
}
}
const
secondColumns
:
any
[]
=
baseOrderListColumns
.
concat
([
const
secondColumns
:
any
[]
=
baseOrderListColumns
.
concat
([
{
{
title
:
'操作'
,
title
:
'操作'
,
align
:
'center'
,
align
:
'center'
,
dataIndex
:
'ctl'
,
dataIndex
:
'ctl'
,
key
:
'ctl'
,
key
:
'ctl'
,
render
:
(
text
,
record
)
=>
{
render
:
(
text
,
record
)
=>
{
// 当内部状态为待审核状态,审核不通过, 或者外部状态为不接受订单时才可修改订单
// 当内部状态为待审核状态,审核不通过, 或者外部状态为不接受订单时才可修改订单
const
showEditOrCancel
=
PurchaseOrderInsideWorkState
.
ONE_LEVEL_AUDIT_ORDER_NOT_ALLOWED
||
const
showEditOrCancel
=
PurchaseOrderInsideWorkState
.
ONE_LEVEL_AUDIT_ORDER_NOT_ALLOWED
||
PurchaseOrderInsideWorkState
.
TWO_LEVEL_AUDIT_ORDER_NOT_ALLOWED
||
PurchaseOrderInsideWorkState
.
TWO_LEVEL_AUDIT_ORDER_NOT_ALLOWED
||
PurchaseOrderInsideWorkState
.
ADD_PURCHASE_ORDER
||
PurchaseOrderInsideWorkState
.
ADD_PURCHASE_ORDER
||
PurchaseOrderOutWorkState
.
NOT_ACCEPTED_ORDER
PurchaseOrderOutWorkState
.
NOT_ACCEPTED_ORDER
// 待提交审核且从未提交过审核的订单才可删除
// 待提交审核且从未提交过审核的订单才可删除
const
showDeleteOrSubmit
=
record
.
interiorState
===
PurchaseOrderInsideWorkState
.
ADD_PURCHASE_ORDER
const
showDeleteOrSubmit
=
record
.
interiorState
===
PurchaseOrderInsideWorkState
.
ADD_PURCHASE_ORDER
return
<>
return
<>
{
{
showDeleteOrSubmit
&&
showDeleteOrSubmit
&&
<
Button
type=
'link'
onClick=
{
()
=>
handleSubmit
(
record
.
id
)
}
>
提交审核
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
handleSubmit
(
record
.
id
)
}
>
提交审核
</
Button
>
}
}
{
{
showEditOrCancel
&&
<
Button
type=
'link'
onClick=
{
()
=>
handleEdit
(
record
.
id
)
}
>
修改订单
</
Button
>
showEditOrCancel
&&
<
Button
type=
'link'
onClick=
{
()
=>
handleEdit
(
record
)
}
>
修改订单
</
Button
>
}
}
{
{
showDeleteOrSubmit
&&
showDeleteOrSubmit
&&
<
Popconfirm
title=
'是否要删除该订单'
onConfirm=
{
()
=>
handleDelete
(
record
.
id
)
}
>
<
Popconfirm
title=
'是否要删除该订单'
onConfirm=
{
()
=>
handleDelete
(
record
.
id
)
}
>
<
Button
type=
'link'
>
删除订单
</
Button
>
<
Button
type=
'link'
>
删除订单
</
Button
>
</
Popconfirm
>
</
Popconfirm
>
}
}
{
{
showEditOrCancel
&&
showEditOrCancel
&&
<
Popconfirm
title=
'是否要取消该订单'
onConfirm=
{
()
=>
handleCancel
(
record
.
id
)
}
>
<
Popconfirm
title=
'是否要取消该订单'
onConfirm=
{
()
=>
handleCancel
(
record
.
id
)
}
>
<
Button
type=
'link'
>
取消订单
</
Button
>
<
Button
type=
'link'
>
取消订单
</
Button
>
</
Popconfirm
>
</
Popconfirm
>
}
}
</>
</>
}
}
}
}
])
])
return
{
return
{
columns
:
secondColumns
,
columns
:
secondColumns
,
ref
,
ref
,
rowSelection
,
rowSelection
,
rowSelectionCtl
rowSelectionCtl
}
}
}
}
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