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
a957a9cb
Commit
a957a9cb
authored
Apr 16, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加采购流程规则配置
parent
1d08a144
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1240 additions
and
3 deletions
+1240
-3
index.ts
config/routes/tranactionRoute/index.ts
+31
-0
index.ts
src/components/ModalTable/schema/index.ts
+58
-0
index.tsx
...rder/orderCollect/components/contractModalTable/index.tsx
+1
-0
index.tsx
...rder/orderCollect/components/materialModalTable/index.tsx
+221
-0
index.tsx
...transaction/purchaseOrder/orderCollect/constant/index.tsx
+2
-0
index.tsx
src/pages/transaction/purchaseOrder/orderCollect/index.tsx
+7
-2
index.ts
...es/transaction/purchaseOrder/orderCollect/schema/index.ts
+5
-0
addRule.tsx
src/pages/transaction/purchaseRules/addRule.tsx
+72
-0
RuleSetting.tsx
...ages/transaction/purchaseRules/components/RuleSetting.tsx
+358
-0
index.tsx
...saction/purchaseRules/components/selectProcesss/index.tsx
+125
-0
index.tsx
src/pages/transaction/purchaseRules/effects/index.tsx
+27
-0
index.less
src/pages/transaction/purchaseRules/index.less
+15
-0
index.tsx
src/pages/transaction/purchaseRules/index.tsx
+188
-0
index.tsx
src/pages/transaction/purchaseRules/schema/index.tsx
+126
-0
api.ts
src/services/api.ts
+3
-1
ytt.config.ts
ytt.config.ts
+1
-0
No files found.
config/routes/tranactionRoute/index.ts
View file @
a957a9cb
...
...
@@ -242,6 +242,37 @@ const TranactionRoute = {
component
:
'@/pages/transaction/transactionRules/addRule'
,
},
// 采购流程规则配置
{
path
:
'/memberCenter/tranactionAbility/purchaseRules'
,
name
:
'purchaseRules'
,
component
:
'@/pages/transaction/purchaseRules'
,
},
// 新增采购流程规则配置
{
path
:
'/memberCenter/tranactionAbility/purchaseRules/add'
,
name
:
'addRule'
,
hideInMenu
:
true
,
component
:
'@/pages/transaction/purchaseRules/addRule'
,
},
// 编辑采购流程规则配置
{
path
:
'/memberCenter/tranactionAbility/purchaseRules/edit'
,
name
:
'editRule'
,
hideInMenu
:
true
,
component
:
'@/pages/transaction/purchaseRules/addRule'
,
},
// 采购流程规则配置详情
{
path
:
'/memberCenter/tranactionAbility/purchaseRules/detail'
,
name
:
'ruleDetail'
,
hideInMenu
:
true
,
component
:
'@/pages/transaction/purchaseRules/addRule'
,
},
// 供应会员评价管理
{
path
:
'/memberCenter/tranactionAbility/supplierEvaluation'
,
...
...
src/components/ModalTable/schema/index.ts
View file @
a957a9cb
...
...
@@ -227,6 +227,64 @@ export const addOrderModalSchema: ISchema = {
}
}
/**
* 新增采购合同订单选择物料的高级筛选
*/
export
const
addContractOrderModalSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
code
:
{
type
:
'string'
,
'x-component'
:
'ModalSearch'
,
'x-component-props'
:
{
placeholder
:
'请输入物料编号'
,
align
:
'flex-left'
,
},
},
[
FORM_FILTER_PATH
]:
{
type
:
'object'
,
'x-component'
:
'flex-layout'
,
'x-component-props'
:
{
rowStyle
:
{
flexWrap
:
'nowrap'
,
style
:
{
marginRight
:
0
}
},
colStyle
:
{
marginTop
:
20
,
},
},
properties
:
{
name
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'物料名称'
,
},
},
type
:
{
type
:
'string'
,
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
placeholder
:
'物料名称'
,
}
},
submit
:
{
"x-component"
:
'Submit'
,
"x-mega-props"
:
{
span
:
1
},
"x-component-props"
:
{
children
:
'查询'
}
}
}
}
}
}
/**
* 货品列表筛选
*/
...
...
src/pages/transaction/purchaseOrder/orderCollect/components/contractModalTable/index.tsx
View file @
a957a9cb
...
...
@@ -107,6 +107,7 @@ const ContractModalTable:React.FC<ContractModalTableProps> = (props) => {
schemaAction
.
setFieldValue
(
'supplyMembersId'
,
item
.
partyBMemberId
)
schemaAction
.
setFieldValue
(
'supplyMembersRoleId'
,
item
.
partyBRoleId
)
schemaAction
.
setFieldValue
(
'orderThe'
,
item
.
contractAbstract
)
schemaAction
.
setFieldValue
(
'contractId'
,
item
.
id
)
}
confirmModal
&&
confirmModal
()
setVisible
(
false
)
...
...
src/pages/transaction/purchaseOrder/orderCollect/components/materialModalTable/index.tsx
0 → 100644
View file @
a957a9cb
import
React
,
{
useEffect
}
from
'react'
import
ModalTable
,
{
ModalTableProps
}
from
'@/components/ModalTable'
import
{
fetchOrderApi
}
from
'../../apis'
import
{
ISchemaFormActions
,
ISchemaFormAsyncActions
}
from
'@formily/antd'
import
{
DELIVERY_TYPE
}
from
'@/constants'
import
{
PublicApi
}
from
'@/services/api'
import
{
EnvironmentOutlined
}
from
'@ant-design/icons'
import
{
Popover
,
Space
,
Row
,
message
}
from
'antd'
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
addContractOrderModalSchema
}
from
'@/components/ModalTable/schema'
import
Search
from
'@/components/NiceForm/components/Search'
import
Submit
from
'@/components/NiceForm/components/Submit'
;
export
interface
MaterialModalTableProps
extends
ModalTableProps
{
type
?:
'radio'
|
'checkbox'
,
schemaAction
:
ISchemaFormActions
|
ISchemaFormAsyncActions
,
currentRef
?:
any
,
sectionProps
:
any
,
confirmModal
?()
}
export
const
materialColumns
:
any
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
},
{
title
:
'物料编号'
,
dataIndex
:
'materielNo'
,
align
:
'center'
,
key
:
'materielNo'
,
},
{
title
:
'物料名称'
,
dataIndex
:
'materielName'
,
align
:
'center'
,
key
:
'materielName'
,
},
{
title
:
'品类'
,
dataIndex
:
'category'
,
align
:
'center'
,
key
:
'category'
,
},
{
title
:
'品牌'
,
dataIndex
:
'brand'
,
align
:
'center'
,
key
:
'brand'
,
},
{
title
:
'单位'
,
dataIndex
:
'unit'
,
align
:
'center'
,
key
:
'unit'
},
{
title
:
'合同剩余'
,
dataIndex
:
'bidCount'
,
align
:
'center'
,
key
:
'bidCount'
},
{
title
:
'供方库存'
,
dataIndex
:
'bidCount'
,
align
:
'center'
,
key
:
'bidCount'
},
]
export
const
AddressPop
=
(
props
)
=>
{
const
{
pickInfo
=
null
,
children
}
=
props
let
receiveInfo
=
pickInfo
?.
render
&&
JSON
.
parse
(
pickInfo
.
render
)
return
pickInfo
&&
pickInfo
.
deliveryType
===
2
?
<
Space
>
<
EnvironmentOutlined
style=
{
{
marginRight
:
8
}
}
/>
<
Popover
content=
{
<
Row
>
<
div
>
<
h3
><
EnvironmentOutlined
/>
自提地址
</
h3
>
{
/* <p>{pickInfo.receiverName} / {pickInfo.phone}</p>
<p>{pickInfo.fullAddress}</p> */
}
{
receiveInfo
&&
<>
<
p
>
{
receiveInfo
.
shipperName
}
/
{
receiveInfo
.
phone
}
</
p
>
<
p
>
{
receiveInfo
.
provinceName
+
receiveInfo
.
cityName
+
receiveInfo
.
districtName
+
receiveInfo
.
address
}
</
p
>
</>
}
</
div
>
</
Row
>
}
>
{
children
}
</
Popover
>
</
Space
>
:
children
}
export
const
filterProductDataById
=
(
data
,
targetData
)
=>
{
return
targetData
.
reduce
(
async
(
prev
:
any
[],
next
)
=>
{
const
{
logistics
}
=
next
// 由于自选商品和进货单商品字段不一致,需手动同步
next
.
brand
=
next
.
brand
||
next
.
brandName
next
.
category
=
next
.
category
||
next
.
customerCategoryName
next
.
unit
=
next
.
unit
||
next
.
unitName
next
.
productName
=
next
.
productName
||
next
.
name
if
(
logistics
.
deliveryType
===
2
&&
logistics
.
sendAddress
)
{
const
{
code
,
data
}
=
await
PublicApi
.
getLogisticsShipperAddressGet
({
id
:
logistics
.
sendAddress
},
{
ttl
:
60
*
1000
,
useCache
:
true
})
logistics
.
render
=
data
}
else
{
logistics
.
render
=
DELIVERY_TYPE
[
logistics
.
deliveryType
]
}
// 配送方式外置, 用于接口字段冗余
next
.
deliveryType
=
logistics
.
deliveryType
// id 存在集合中, 采用target中的数据, 否则采用data中的数据
const
findResult
=
data
.
find
(
v
=>
v
.
id
===
next
.
id
)
// 由于迭代时,会出现promise的 已完成状态, 需转换一下,实现异步转同步化
if
(
!
Array
.
isArray
(
prev
))
{
prev
=
await
prev
}
if
(
findResult
)
{
// 已经选中过这一项, 则需要采用原有的商品列表
prev
.
push
(
findResult
)
}
else
{
prev
.
push
(
next
)
}
return
prev
},
[])
}
const
MaterialModalTable
:
React
.
FC
<
MaterialModalTableProps
>
=
(
props
)
=>
{
const
{
type
=
'checkbox'
,
schemaAction
,
confirmModal
,
currentRef
,
sectionProps
,
...
restProps
}
=
props
const
{
visible
,
setVisible
,
rowSelection
,
rowSelectionCtl
}
=
sectionProps
useEffect
(()
=>
{
if
(
currentRef
)
{
currentRef
.
current
=
{
setVisible
,
visible
,
rowSelectionCtl
}
}
},
[])
const
handleConfirm
=
async
()
=>
{
// 判断所选择的商品是否属于同一个工作流
// @ts-ignore
const
res
=
await
PublicApi
.
postOrderIsWorkFlow
({
memberId
:
rowSelectionCtl
.
selectRow
[
0
].
memberId
,
memberRoleId
:
rowSelectionCtl
.
selectRow
[
0
].
memberRoleId
,
productIds
:
rowSelectionCtl
.
selectedRowKeys
,
orderModel
:
schemaAction
.
getFieldValue
(
'orderModel'
)
},
{
ctlType
:
'none'
})
if
(
res
.
code
===
1000
)
{
const
productData
=
schemaAction
.
getFieldValue
(
'orderProductRequests'
)
schemaAction
.
setFieldValue
(
'orderProductRequests'
,
await
filterProductDataById
(
productData
,
rowSelectionCtl
.
selectRow
))
confirmModal
&&
confirmModal
()
setVisible
(
false
)
}
else
{
message
.
error
(
res
.
message
)
}
}
const
fetchMaterialList
=
(
values
)
=>
{
const
contractId
=
schemaAction
.
getFieldValue
(
'contractId'
)
const
params
=
{
...
values
,
contractId
,
}
return
fetchOrderApi
.
getProductList
(
params
)
}
return
(
<
ModalTable
modalTitle=
'选择采购物料'
width=
{
900
}
columns=
{
materialColumns
}
visible=
{
visible
}
confirm=
{
handleConfirm
}
cancel=
{
()
=>
setVisible
(
false
)
}
fetchTableData=
{
fetchMaterialList
}
rowSelection=
{
rowSelection
}
resetModal=
{
{
destroyOnClose
:
true
,
forceRender
:
true
}
}
modalType=
'none'
tableProps=
{
{
rowKey
:
'id'
,
onRow
:
(
record
)
=>
({
onClick
:
()
=>
{
rowSelectionCtl
.
appendSelectRow
(
record
);
rowSelectionCtl
.
appendSelectRowKeys
(
record
.
id
);
},
})
}
}
formilyProps=
{
{
ctx
:
{
schema
:
addContractOrderModalSchema
,
components
:
{
ModalSearch
:
Search
,
Submit
},
effects
:
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'code'
,
FORM_FILTER_PATH
,
);
}
}
}
}
{
...
restProps
}
/>
)
}
MaterialModalTable
.
defaultProps
=
{}
export
default
MaterialModalTable
src/pages/transaction/purchaseOrder/orderCollect/constant/index.tsx
View file @
a957a9cb
...
...
@@ -28,6 +28,8 @@ export const PriceComp = (props) => {
// @采购合同下单 字段转换
export
const
procurementProcessField
=
(
value
)
=>
{
value
.
orderProductRequests
=
value
.
orderProductRequests
.
map
(
item
=>
{
// @todo 查询商品对应的最小起订数
// const { data, code } = await PublicApi.getProductCommodityGetCommodity({id: item.relevanceProductId})
delete
item
.
id
return
{
...
item
,
...
...
src/pages/transaction/purchaseOrder/orderCollect/index.tsx
View file @
a957a9cb
...
...
@@ -266,7 +266,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// 没用的字段
orderProductRequests
:
_orderProductRequests
.
map
(
v
=>
{
v
.
price
=
1
v
.
isMemberPrice
=
Number
(
v
.
isMemberPrice
)
||
false
v
.
isMemberPrice
=
Number
(
v
.
isMemberPrice
)
||
0
v
.
memberPrice
=
v
.
memberPrice
v
.
imgUrl
=
v
.
mainPic
?
v
.
mainPic
:
v
.
imgUrl
v
.
minOrder
=
v
.
minOrder
...
...
@@ -311,9 +311,11 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
roleId
:
params
.
supplyMembersRoleId
})
params
.
orderProductRequests
=
params
.
orderProductRequests
.
map
(
item
=>
{
const
address
=
deliveryAddress
.
filter
(
item
=>
item
.
isDefault
)[
0
]
let
logistics
:
any
=
{
deliveryType
:
item
.
logistics
,
render
:
deliveryAddress
.
filter
(
item
=>
item
.
isDefault
)[
0
]
sendAddress
:
address
.
id
,
render
:
address
}
return
{
...
item
,
...
...
@@ -720,7 +722,10 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
{
/* 选择合同下单 */
}
<
ContractModalTable
currentRef=
{
contractOrderRef
}
schemaAction=
{
addSchemaAction
}
/>
{
/* @todo 选择采购物料 */
}
{
/* <MaterialModalTable currentRef={materialRef} schemaAtion={addSchemaAction} /> */
}
</
ReadyAddOrderDetailContext
.
Provider
>
...
...
src/pages/transaction/purchaseOrder/orderCollect/schema/index.ts
View file @
a957a9cb
...
...
@@ -231,6 +231,11 @@ const basicInfo: ISchema = {
title
:
'外部状态'
,
visible
:
false
},
contractId
:
{
type
:
'number'
,
title
:
'采购合同ID'
,
visible
:
false
},
}
},
...
...
src/pages/transaction/purchaseRules/addRule.tsx
0 → 100644
View file @
a957a9cb
import
React
,
{
useState
}
from
'react'
import
{
history
}
from
'umi'
import
{
Button
,
Card
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
SaveOutlined
,
}
from
'@ant-design/icons'
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
'./index.less'
import
{
ruleDetailSchema
}
from
'./schema'
import
{
createFormActions
,
ISchema
,
FormEffectHooks
}
from
'@formily/antd'
import
{
findItemAndDelete
,
omit
}
from
'@/utils'
import
{
PublicApi
}
from
'@/services/api'
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
import
RuleSetting
from
'./components/RuleSetting'
const
addSchemaAction
=
createFormActions
()
const
AddRule
:
React
.
FC
<
{}
>
=
(
props
)
=>
{
const
[
isDisabled
,
setIsDisabled
]
=
useState
<
boolean
>
(
false
)
const
{
id
,
preview
,
pageStatus
}
=
usePageStatus
()
// 整体表单提交
const
formSubmit
=
async
(
values
)
=>
{
setIsDisabled
(
true
)
const
params
=
omit
(
values
,
[
'state'
])
// 移除不需要的字段
params
.
processEnum
=
params
.
processEnumId
addSchemaAction
.
getFieldState
(
'processEnumId'
,
state
=>
{
const
process
=
state
.
dataSource
.
filter
(
item
=>
item
.
id
===
params
.
processEnumId
)[
0
]
params
.
type
=
process
.
type
})
let
res
:
any
=
{}
if
(
pageStatus
===
PageStatus
.
EDIT
){
res
=
await
PublicApi
.
postManageRuleUpdate
(
params
)
}
else
if
(
pageStatus
===
PageStatus
.
ADD
){
res
=
await
PublicApi
.
postManageRuleAdd
(
params
)
}
setIsDisabled
(
false
)
history
.
goBack
(
-
1
)
}
return
(
<
PageHeaderWrapper
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
title=
{
pageStatus
===
PageStatus
.
PREVIEW
?
'查看采购流程规则'
:
(
pageStatus
===
PageStatus
.
EDIT
?
'编辑采购流程规则'
:
'新增采购流程规则'
)
}
className=
"addRule"
extra=
{
[
<
Button
key=
"1"
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
||
isDisabled
}
>
保存
</
Button
>,
]
}
>
<
Card
className=
''
>
<
RuleSetting
addSchemaAction=
{
addSchemaAction
}
schema=
{
ruleDetailSchema
}
formSubmit=
{
formSubmit
}
/>
</
Card
>
</
PageHeaderWrapper
>
)
}
export
default
AddRule
src/pages/transaction/purchaseRules/components/RuleSetting.tsx
0 → 100644
View file @
a957a9cb
This diff is collapsed.
Click to expand it.
src/pages/transaction/purchaseRules/components/selectProcesss/index.tsx
0 → 100644
View file @
a957a9cb
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
import
styled
from
'styled-components'
import
{
ISchemaFormProps
,
ISchemaFieldProps
,
ISchemaFieldComponentProps
,
createFormActions
,
useFieldState
}
from
'@formily/antd'
import
{
Button
,
Space
,
Row
,
Col
,
Tag
}
from
'antd'
import
{
PlusOutlined
,
DeleteColumnOutlined
,
EditOutlined
,
DeleteOutlined
,
CaretUpOutlined
,
CaretDownOutlined
,
EyeOutlined
}
from
'@ant-design/icons'
import
cx
from
'classnames'
import
{
PublicApi
}
from
'@/services/api'
const
SelectStyles
=
styled
((
props
)
=>
<
div
className=
'select-list'
{
...
props
}
></
div
>)
`
.select_style_border {
border: 1px solid #EEF0F3;
margin-top: 20px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 14px;
cursor: pointer;
line-height: 28px;
position:relative;
}
.select_style_border.active {
border: 1px solid #00B382;
}
.select_style_border.active::after {
content: '';
position: absolute;
width: 0;
height: 0;
border-bottom: 12px solid #00B37A;
border-left: 12px solid transparent;
bottom: 0;
right: 0;
z-index: 5;
}
`
enum
ProcessTagColor
{
'red'
,
'orange'
,
'purple'
,
'blue'
,
'green'
}
enum
ProcessTagType
{
'订单交易流程'
,
'售后换货流程'
,
'售后退货流程'
,
'售后维修流程'
,
'加工生产流程'
}
const
SelectProcesss
=
(
props
:
ISchemaFieldComponentProps
)
=>
{
const
[
formInitValue
,
setFormInitValue
]
=
useState
<
any
>
(
null
)
const
[
state
,
setFieldState
]
=
useFieldState
({
dataSource
:
[],
showMore
:
false
})
const
{
dataSource
,
showMore
}
=
state
const
{
value
,
mutators
,
editable
}
=
props
useEffect
(()
=>
{
PublicApi
.
getOrderTradingRulesTransactionProcessList
().
then
(
res
=>
{
setFieldState
({
dataSource
:
res
.
data
,
showMore
})
})
},
[])
const
showDataSource
=
showMore
?
dataSource
:
[...
dataSource
].
splice
(
0
,
3
)
const
handleCheck
=
(
id
)
=>
{
if
(
editable
)
{
mutators
.
change
(
id
)
}
}
const
toogleMore
=
()
=>
{
setFieldState
({
dataSource
,
showMore
:
!
showMore
})
}
const
renderProcessType
=
(
v
:
any
)
=>
{
return
<
Tag
color=
{
ProcessTagColor
[
v
.
type
-
1
]
}
>
{
ProcessTagType
[
v
.
type
-
1
]
}
</
Tag
>
}
return
(
<
div
style=
{
{
width
:
'100%'
}
}
>
<
SelectStyles
>
{
showDataSource
.
map
(
v
=>
<
div
key=
{
v
.
id
}
onClick=
{
()
=>
handleCheck
(
v
.
id
)
}
className=
{
cx
(
'select_style_border'
,
value
===
v
.
id
?
'active'
:
''
)
}
>
<
div
>
<
Row
style=
{
{
color
:
'#303133'
}
}
>
<
Col
>
{
v
.
name
}
</
Col
>
<
Col
style=
{
{
marginLeft
:
6
}
}
>
{
renderProcessType
(
v
)
}
</
Col
>
</
Row
>
<
div
style=
{
{
color
:
'#909399'
}
}
>
{
v
.
explain
}
</
div
>
</
div
>
</
div
>)
}
</
SelectStyles
>
{
dataSource
.
length
>
3
&&
<
div
onClick=
{
toogleMore
}
style=
{
{
textAlign
:
'center'
,
cursor
:
'pointer'
}
}
>
显示更多
{
showMore
?
<
CaretDownOutlined
/>
:
<
CaretUpOutlined
/>
}
</
div
>
}
</
div
>
)
}
SelectProcesss
.
defaultProps
=
{}
SelectProcesss
.
isFieldComponent
=
true
;
export
default
SelectProcesss
src/pages/transaction/purchaseRules/effects/index.tsx
0 → 100644
View file @
a957a9cb
import
React
,
{
useEffect
}
from
'react'
import
{
ISchemaFormActions
,
FormEffectHooks
,
IFormActions
}
from
'@formily/antd'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
const
{
onFieldValueChange$
}
=
FormEffectHooks
export
const
createAddContractTemplateEffect
=
(
context
:
ISchemaFormActions
)
=>
{
const
fetchListContractTemplateAll
=
async
()
=>
{
const
{
data
}
=
await
PublicApi
.
getContractSelectListContractTemplate
()
context
.
setFieldState
(
'electronicContractId'
,
state
=>
{
state
.
contractTemplateLists
=
data
})
return
data
.
map
(
v
=>
({
value
:
v
.
id
,
label
:
v
.
name
}))
}
useAsyncSelect
(
'electronicContractId'
,
fetchListContractTemplateAll
)
}
export
const
useUnitPreview
=
(
initValue
,
context
)
=>
{
useEffect
(()
=>
{
context
.
setFieldValue
(
'isElectronicContract'
,
initValue
?.
isElectronicContract
?
true
:
false
)
context
.
setFieldValue
(
'isTacitlyApprove'
,
initValue
?.
isTacitlyApprove
)
},
[
initValue
])
}
src/pages/transaction/purchaseRules/index.less
0 → 100644
View file @
a957a9cb
.addRule {
.ant-input-group-addon {
padding: 0;
border: none;
}
.connectBtn {
width: 80px;
height: 32px;
line-height: 32px;
background: #909399;
color: #fff;
text-align: center;
cursor: pointer;
}
}
src/pages/transaction/purchaseRules/index.tsx
0 → 100644
View file @
a957a9cb
import
React
,
{
ReactNode
,
useRef
}
from
'react'
import
{
history
}
from
'umi'
import
{
Button
,
Popconfirm
,
Card
,
Space
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
PlusOutlined
,
PlayCircleOutlined
,
PauseCircleOutlined
,
}
from
'@ant-design/icons'
import
{
StandardTable
}
from
'god'
import
{
ColumnType
}
from
'antd/lib/table/interface'
import
moment
from
'moment'
import
EyePreview
from
'@/components/EyePreview'
;
import
{
PublicApi
}
from
'@/services/api'
import
NiceForm
from
'@/components/NiceForm'
import
{
createFormActions
}
from
'@formily/antd'
const
formActions
=
createFormActions
();
const
PurchaseRules
:
React
.
FC
<
{}
>
=
()
=>
{
const
ref
=
useRef
<
any
>
({})
const
fetchData
=
(
params
:
any
)
=>
{
if
(
!
params
?.
name
)
delete
params
.
name
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getManageRuleList
(
params
).
then
(
res
=>
{
const
{
data
}
=
res
resolve
(
data
)
})
})
}
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'流程规则ID'
,
dataIndex
:
'id'
,
key
:
'id'
,
},
{
title
:
'流程规则名称'
,
dataIndex
:
'name'
,
key
:
'name'
,
className
:
'commonPickColor'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
EyePreview
url=
{
`/memberCenter/tranactionAbility/purchaseRules/detail?id=${record.id}&preview=1`
}
>
{
text
}
</
EyePreview
>
},
{
title
:
'操作时间'
,
dataIndex
:
'updateTime'
,
key
:
'updateTime'
,
render
:
(
text
:
any
,
record
:
any
)
=>
text
&&
moment
(
text
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
},
{
title
:
'状态'
,
dataIndex
:
'state'
,
key
:
'state'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
let
component
:
ReactNode
=
null
component
=
(
<
Popconfirm
title=
"确定要执行这个操作?"
onConfirm=
{
()
=>
confirm
(
record
)
}
onCancel=
{
cancel
}
okText=
"是"
cancelText=
"否"
>
<
Button
type=
"link"
style=
{
record
.
state
?
{
color
:
'#00B37A'
}
:
{
color
:
'red'
}
}
>
{
record
.
state
?
<>
有效
<
PlayCircleOutlined
/></>
:
<>
无效
<
PauseCircleOutlined
/></>
}
</
Button
>
</
Popconfirm
>
)
return
component
}
},
{
title
:
'操作'
,
dataIndex
:
'option'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<>
{
(
record
.
state
===
0
)
?
<>
<
Popconfirm
title=
"确定要执行这个操作?"
onConfirm=
{
()
=>
handelDelete
(
record
)
}
onCancel=
{
cancel
}
okText=
"是"
cancelText=
"否"
>
<
Button
type=
'link'
>
删除
</
Button
>
</
Popconfirm
>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/memberCenter/tranactionAbility/purchaseRules/add?id=${record.id}`
)
}
>
修改
</
Button
>
</>
:
''
}
</>
)
}
}
];
const
confirm
=
(
record
:
any
)
=>
{
PublicApi
.
postManageRuleStartOrStop
({
id
:
record
.
id
,
state
:
record
.
state
?
0
:
1
}).
then
(
res
=>
{
ref
.
current
.
reload
()
})
}
const
cancel
=
()
=>
{
console
.
log
(
'cancel'
)
}
const
handelDelete
=
(
record
:
any
)
=>
{
PublicApi
.
postManageRuleDelete
({
id
:
record
.
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
ref
.
current
.
reload
()
})
}
const
Actions
=
(
<
Space
>
<
Button
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
history
.
push
(
'/memberCenter/tranactionAbility/purchaseRules/add'
)
}
>
新建
</
Button
>
</
Space
>
);
return
(
<
PageHeaderWrapper
>
<
Card
>
<
StandardTable
tableProps=
{
{
rowKey
:
'id'
,
}
}
columns=
{
columns
}
currentRef=
{
ref
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
controlRender=
{
<
NiceForm
actions=
{
formActions
}
expressionScope=
{
{
Actions
,
}
}
effects=
{
(
$
,
actions
)
=>
{
}
}
schema=
{
{
type
:
'object'
,
properties
:
{
searchWrap
:
{
type
:
'object'
,
'x-component'
:
'Mega-Layout'
,
'x-component-props'
:
{
grid
:
true
,
},
properties
:
{
actions
:
{
type
:
'object'
,
'x-component'
:
'Children'
,
'x-component-props'
:
{
children
:
'{{Actions}}'
,
},
},
name
:
{
type
:
'string'
,
'x-component'
:
'Search'
,
'x-component-props'
:
{
placeholder
:
'规则名称'
,
advanced
:
false
,
// tip: '输入 单据名称 进行搜索',
},
},
},
},
},
}
}
onSubmit=
{
values
=>
ref
.
current
.
reload
(
values
)
}
/>
}
/>
</
Card
>
</
PageHeaderWrapper
>
)
}
export
default
PurchaseRules
src/pages/transaction/purchaseRules/schema/index.tsx
0 → 100644
View file @
a957a9cb
import
React
from
'react'
import
{
ISchema
}
from
'@formily/antd'
;
import
{
padRequiredMessage
}
from
'@/utils'
;
// 新增规则
export
const
ruleDetailSchema
:
ISchema
=
padRequiredMessage
({
type
:
'object'
,
properties
:
{
REPOSIT_TABS
:
{
type
:
'object'
,
"x-component"
:
"tab"
,
"x-component-props"
:
{
type
:
'card'
,
},
properties
:
{
"tab-1"
:
{
"type"
:
"object"
,
"x-component"
:
"tabpane"
,
"x-component-props"
:
{
"tab"
:
"基本信息"
},
"properties"
:
{
MEGA_LAYOUT1
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
wrapperCol
:
8
,
labelAlign
:
'left'
,
style
:
{
height
:
'400px'
}
},
properties
:
{
"name"
:
{
type
:
'string'
,
title
:
'规则名称'
,
"x-component-props"
:
{
placeholder
:
'请输入规则名称'
},
"x-rules"
:
[
{
required
:
true
,
},
{
limitByte
:
true
,
maxByte
:
48
}
]
},
"processEnumId"
:
{
type
:
'string'
,
title
:
'流程选择'
,
"x-component"
:
'SelectProcesss'
,
"x-mega-props"
:
{
style
:
{
full
:
true
}
},
"x-component-props"
:
{
dataSource
:
[]
},
"x-rules"
:
[
{
required
:
true
,
message
:
'请选择流程配置'
}
],
},
"type"
:
{
type
:
'number'
,
title
:
'流程类型'
,
visible
:
false
,
},
}
}
}
},
"tab-2"
:
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
"tab"
:
"适用合同"
},
properties
:
{
MEGA_LAYOUT3
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
labelAlign
:
'left'
},
properties
:
{
"isApplyContract"
:
{
"type"
:
"radio"
,
enum
:
[
{
label
:
'所有合同(默认)'
,
value
:
1
},
{
label
:
'指定合同'
,
value
:
0
},
],
"title"
:
"适用合同"
,
default
:
1
,
required
:
true
,
"x-linkages"
:
[
{
type
:
'value:visible'
,
target
:
'ruleContracts'
,
"condition"
:
"{{!$value}}"
}
]
},
"ruleContracts"
:
{
type
:
'array:number'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'id'
,
columns
:
"{{tableColumns}}"
,
prefix
:
"{{tableAddButton}}"
,
}
}
}
}
}
}
}
}
}
})
src/services/api.ts
View file @
a957a9cb
...
...
@@ -16,7 +16,8 @@ import * as ContractApi from './ContractApi';
import
*
as
PurchaseV2Api
from
'./PurchaseV2Api'
;
import
*
as
TransactionV2Api
from
'./TransactionV2Api'
;
import
*
as
ContractV2Api
from
'./ContractV2Api'
;
import
*
as
OrderV2Api
from
'./OrderV2Api'
import
*
as
OrderV2Api
from
'./OrderV2Api'
;
import
*
as
PlatformApi
from
'./PlatformApi'
;
/**
* 可在这里写入自定义的接口
...
...
@@ -46,4 +47,5 @@ export const PublicApi = {
...
TransactionV2Api
,
...
ContractV2Api
,
...
OrderV2Api
,
...
PlatformApi
,
}
ytt.config.ts
View file @
a957a9cb
...
...
@@ -19,6 +19,7 @@ const tokenList = [
{
name
:
'TransactionV2'
,
token
:
'3ad04435494d01c359b9f07948338e019133a3e6c0fccdbe1bc3adc19cf1e0b1'
,
categoryIds
:
[
0
]
},
// 交易服务V2
{
name
:
'ContractV2'
,
token
:
'bbf1f327cfe7c59d1e7fd9c5d25119829dd79d238b1f1c79ed97331e220721a4'
,
categoryIds
:
[
0
]
},
// 合同能力V2
{
name
:
'OrderV2'
,
token
:
'033f83bd5f519506f65f46d1513b1f8028a1dc1b5238d22edd0a2feb53cd3a19'
,
categoryIds
:
[
0
],
},
//订单服务V2
{
name
:
'Platform'
,
token
:
'cadc3b13452c3ec67b5ef0c57063f12142e857a9eaa64669e80165adf42f5861'
,
categoryIds
:
[
0
]
}
// 平台后台v2
]
const
getConfigMap
=
(
tokens
)
=>
tokens
.
map
(
v
=>
({
...
...
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