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
b6e61238
Commit
b6e61238
authored
May 09, 2022
by
前端-甘科
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '220518-feat' into 'v2-220518'
新增规则引擎各类型列表/调整流程引擎-请购单规则/新增规则引擎配置 See merge request linkseeks-design/pro-platform!639
parents
2d4f711e
bb13e5d3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
828 additions
and
378 deletions
+828
-378
api.config.js
api.config.js
+2
-1
index.tsx
src/components/FetchSelect/index.tsx
+1
-1
index.ts
src/pages/systemSetting/constants/index.ts
+1
-1
index.tsx
...ingRequisitionProcess/components/AddEditContent/index.tsx
+36
-15
index.tsx
.../buyingRequisitionProcess/components/RadioBlock/index.tsx
+8
-8
index.tsx
...stemSetting/processEng/buyingRequisitionProcess/index.tsx
+35
-23
index.tsx
...ges/systemSetting/ruleEng/buyingRequisitionRule/index.tsx
+7
-4
index.tsx
src/pages/systemSetting/ruleEng/columns/index.tsx
+2
-2
index.tsx
...ges/systemSetting/ruleEng/component/CommonTable/index.tsx
+1
-1
index.tsx
.../systemSetting/ruleEng/contractCoordinationRule/index.tsx
+6
-4
index.tsx
src/pages/systemSetting/ruleEng/contractManageRule/index.tsx
+6
-4
index.tsx
src/pages/systemSetting/ruleEng/materialManageRule/index.tsx
+6
-4
index.tsx
...pages/systemSetting/ruleEng/purchaseProcessRule/index.tsx
+6
-4
index.tsx
...es/systemSetting/ruleEng/requestFundsManageRule/index.tsx
+6
-4
index.tsx
...ruleEng/ruleEngConfig/components/CategoryDrawer/index.tsx
+70
-61
index.tsx
.../ruleEngConfig/components/CategoryDrawer/schema/index.tsx
+0
-76
index.tsx
...g/ruleEng/ruleEngConfig/components/CommonDrawer/index.tsx
+8
-7
index.tsx
...ng/ruleEng/ruleEngConfig/components/CommonValue/index.tsx
+39
-0
index.tsx
...g/ruleEng/ruleEngConfig/components/ConfigDrawer/index.tsx
+56
-5
index.tsx
...ting/ruleEng/ruleEngConfig/components/FlowChart/index.tsx
+13
-11
index.tsx
...ruleEng/ruleEngConfig/components/MaterialDrawer/index.tsx
+97
-55
index.tsx
.../ruleEngConfig/components/MaterialDrawer/schema/index.tsx
+41
-14
index.less
.../ruleEng/ruleEngConfig/components/ProcessRules/index.less
+17
-0
index.tsx
...g/ruleEng/ruleEngConfig/components/ProcessRules/index.tsx
+0
-0
index.tsx
.../ruleEng/ruleEngConfig/components/SeeUserDrawer/index.tsx
+27
-20
index.tsx
...ruleEng/ruleEngConfig/components/SelectCategory/index.tsx
+26
-14
index.tsx
...ruleEng/ruleEngConfig/components/SelectMaterial/index.tsx
+34
-7
index.tsx
...ng/ruleEng/ruleEngConfig/components/SelectRoles/index.tsx
+10
-10
index.tsx
...leEng/ruleEngConfig/components/StringDatePicker/index.tsx
+23
-0
index.tsx
...ing/ruleEng/ruleEngConfig/components/WrapSelect/index.tsx
+3
-2
index.ts
...ges/systemSetting/ruleEng/ruleEngConfig/constant/index.ts
+103
-0
index.ts
...ages/systemSetting/ruleEng/ruleEngConfig/effects/index.ts
+62
-0
index.tsx
src/pages/systemSetting/ruleEng/ruleEngConfig/index.tsx
+76
-20
No files found.
api.config.js
View file @
b6e61238
...
...
@@ -18,5 +18,6 @@ module.exports = [
{
name
:
'MessageV2'
,
token
:
'7fc4a903c8ce9318fe925b1d95a39a42d7df4ba8d88df2b1260b714e24ab0db8'
,
categoryIds
:
[
0
],
},
// 消息中心v2
{
name
:
'MarketingV2'
,
token
:
'0b705237f97ac68774bfcbbcbeaaf2a8f2c9381c42f6d5d0eaee219ef041701b'
,
categoryIds
:
[
0
],
},
// 营销能力
{
name
:
'AfterServiceV2'
,
token
:
'906dfe7bb2cb64b40c45cd9ccc8e7bab09003779e8103be2c7bd11a1ba9dcbb9'
,
categoryIds
:
[
0
],
},
// 售后能力V2
{
name
:
'ManageV2'
,
token
:
'b4a98fa71fa56ff34161166e714621810455c790e64f407f8788ef69cdafe234'
,
categoryIds
:
[
0
]
},
// 平台后台v2 // 平台后台v2
{
name
:
'ManageV2'
,
token
:
'9ed658e616fbc3d317fdbbbaeb16c2f21613903f13787745c460358c41a438ae'
,
categoryIds
:
[
0
]
},
// 平台后台v2
{
name
:
'RuleEngineV2'
,
token
:
'4fb3cff10950aa9c237a6797e01a8ca4c9f339004efca915ecef5f96989c2519'
,
categoryIds
:
[
0
]
},
// 规则引擎服务v2
]
src/components/FetchSelect/index.tsx
View file @
b6e61238
...
...
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
import
{
Select
,
SelectProps
}
from
'antd'
export
interface
PropsType
<
VT
>
extends
SelectProps
<
VT
>
{
requestApi
:
Function
requestApi
?
:
Function
params
?:
Object
labelKey
?:
string
valueKey
?:
string
...
...
src/pages/systemSetting/constants/index.ts
View file @
b6e61238
...
...
@@ -5,7 +5,7 @@ export const formItemLayout = {
export
enum
STATUS
{
Effective
=
1
,
// 有效
invalid
=
2
,
// 无效
invalid
=
0
,
// 无效
}
/**
...
...
src/pages/systemSetting/processEng/buyingRequisitionProcess/components/AddEditContent/index.tsx
View file @
b6e61238
...
...
@@ -9,12 +9,12 @@ import BaseInfo from '@/components/BaseInfo/BaseInfo'
import
{
Button
,
Form
,
Input
,
Radio
,
Checkbox
}
from
'antd'
import
{
SaveOutlined
}
from
'@ant-design/icons'
import
AuthButton
from
'@/components/AuthButton'
import
{
postOrderDeliveryNoticeOrderSrmCreate
,
getOrderDeliveryNoticeOrderDetail
,
postOrderDeliveryNoticeOrderUpdate
}
from
'@/services/OrderNewV2Api'
import
usePrompt
from
'@/hooks/usePrompt'
import
FormProgress
,
{
HandleType
}
from
'@/components/FormProgress'
import
{
validatorByte
}
from
'@/utils/regExp'
import
{
buyingRequisitionTypeOptions
}
from
'../../../../constants/buyingRequisitionProcess'
import
RadioBlock
from
'../RadioBlock'
import
{
getPurchaseRequisitionProcessBaseList
,
postPurchaseRequisitionProcessSave
,
postPurchaseRequisitionProcessUpdate
,
getPurchaseRequisitionProcessGet
}
from
'@/services/PurchaseV2Api'
enum
TYPE
{
ADD
=
'add'
,
...
...
@@ -41,17 +41,22 @@ const processOptionsMock = [
{
value
:
3
,
label
:
'请购单流程-2级'
,
detail
:
'1.1.待审核请购单(一级) - 2.待审核请购单(二级) - 3.待提交请购单'
,
type
:
'请购单流程'
},
]
const
DeliveryNoticeManagementAwaitSRMDetails
:
React
.
FC
<
PropsType
>
=
({
i
d
,
btnCode
,
title
,
type
})
=>
{
const
AddEditContent
:
React
.
FC
<
PropsType
>
=
({
id
:
processI
d
,
btnCode
,
title
,
type
})
=>
{
const
[
form
]
=
Form
.
useForm
()
const
{
renderPrompt
,
handleLeave
}
=
usePrompt
()
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
)
const
[
processBaseList
,
setProcessBaseList
]
=
useState
<
any
[]
>
([])
const
progressRef
=
useRef
<
HandleType
>
()
const
handleSubmit
=
()
=>
{
form
.
validateFields
().
then
((
values
)
=>
{
const
params
:
any
=
{}
const
requestApi
=
id
?
postOrderDeliveryNoticeOrderUpdate
:
postOrderDeliveryNoticeOrderSrmCreate
const
params
:
any
=
{
processId
,
...
values
,
allPurchaseRequisition
:
true
// 请购单类型,默认为包含所有请购单
}
const
requestApi
=
processId
?
postPurchaseRequisitionProcessUpdate
:
postPurchaseRequisitionProcessSave
setLoading
(
true
)
requestApi
(
params
).
then
(({
code
,
data
})
=>
{
if
(
code
===
1000
)
{
...
...
@@ -63,17 +68,34 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ id, btnC
})
})
}
// getPurchaseRequisitionProcessBaseList
const
getProcessBaseList
=
async
()
=>
{
const
{
code
,
data
}
=
await
getPurchaseRequisitionProcessBaseList
();
if
(
code
===
1000
)
{
setProcessBaseList
(
data
)
}
}
const
getDetail
=
async
()
=>
{
if
(
i
d
)
{
const
{
code
,
data
}
=
await
get
OrderDeliveryNoticeOrderDetail
({
i
d
});
if
(
processI
d
)
{
const
{
code
,
data
}
=
await
get
PurchaseRequisitionProcessGet
({
processI
d
});
if
(
code
===
1000
)
{
form
.
setFieldsValue
({
name
:
data
.
name
,
baseProcessId
:
data
.
baseProcessId
,
allPurchaseRequisition
:
[
buyingRequisitionTypeOptions
[
0
].
value
]
// 请购单类型,默认为包含所有请购单
})
progressRef
.
current
.
render
(
form
)
}
}
}
useEffect
(()
=>
{
getDetail
()
const
getData
=
async
()
=>
{
await
getProcessBaseList
()
getDetail
()
}
getData
()
},
[])
return
(
...
...
@@ -83,7 +105,7 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ id, btnC
anchors=
{
anchors
}
extra=
{
<
AuthButton
btnCode=
{
btnCode
}
>
{
type
!==
TYPE
.
VIEW
&&
<
Button
icon=
{
<
SaveOutlined
/>
}
loading=
{
loading
}
onClick=
{
handleSubmit
}
type=
'primary'
>
保存
</
Button
>
}
{
type
!==
TYPE
.
VIEW
&&
<
Button
icon=
{
<
SaveOutlined
/>
}
loading=
{
loading
}
onClick=
{
handleSubmit
}
type=
'primary'
>
保存
</
Button
>
}
</
AuthButton
>
}
>
...
...
@@ -111,17 +133,16 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ id, btnC
</
BaseInfo
>
<
BaseInfo
cols=
{
1
}
className=
'mt-16'
title=
{
anchors
[
1
].
name
}
id=
{
anchors
[
1
].
key
}
>
<
Form
.
Item
name=
'
process
'
name=
'
baseProcessId
'
rules=
{
[
{
required
:
true
,
message
:
`请选择流程`
}
]
}
initialValue=
{
processOptionsMock
[
0
].
value
}
>
<
Radio
.
Group
style=
{
{
width
:
'100%'
}
}
disabled=
{
type
===
TYPE
.
VIEW
}
>
{
process
OptionsMock
.
map
(
item
=>
(
process
BaseList
.
map
(
item
=>
(
<
RadioBlock
key=
{
item
.
value
}
key=
{
item
.
baseProcessId
}
options=
{
item
}
/>
))
...
...
@@ -131,13 +152,13 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ id, btnC
</
BaseInfo
>
<
BaseInfo
cols=
{
1
}
className=
'mt-16'
title=
{
anchors
[
2
].
name
}
id=
{
anchors
[
2
].
key
}
>
<
Form
.
Item
name=
'
buyingRequisitionType
'
name=
'
allPurchaseRequisition
'
initialValue=
{
[
buyingRequisitionTypeOptions
[
0
].
value
]
}
rules=
{
[
{
required
:
true
,
message
:
`请选择请购类型`
}
]
}
>
<
Checkbox
.
Group
disabled
=
{
type
===
TYPE
.
VIEW
}
options=
{
buyingRequisitionTypeOptions
}
/>
<
Checkbox
.
Group
disabled
options=
{
buyingRequisitionTypeOptions
}
/>
</
Form
.
Item
>
</
BaseInfo
>
</
Form
>
...
...
@@ -146,4 +167,4 @@ const DeliveryNoticeManagementAwaitSRMDetails: React.FC<PropsType> = ({ id, btnC
)
}
export
default
DeliveryNoticeManagementAwaitSRMDetails
export
default
AddEditContent
src/pages/systemSetting/processEng/buyingRequisitionProcess/components/RadioBlock/index.tsx
View file @
b6e61238
...
...
@@ -8,22 +8,22 @@ import styles from './index.less'
type
PropsType
=
{
options
:
{
label
:
string
,
value
:
string
|
number
,
de
tail
?:
string
,
typ
e
?:
string
processName
:
string
,
baseProcessId
:
string
|
number
,
de
scription
?:
string
,
processTypeNam
e
?:
string
}
}
const
RadioBlock
:
React
.
FC
<
PropsType
>
=
({
options
})
=>
{
return
(
<
Radio
className=
{
styles
.
radioBlock
}
value=
{
options
.
value
}
>
<
Radio
className=
{
styles
.
radioBlock
}
value=
{
options
.
baseProcessId
}
>
<
div
>
<
div
className=
{
styles
.
label
}
>
{
options
.
label
}
</
div
>
<
div
className=
{
styles
.
detail
}
>
{
options
.
de
tail
}
</
div
>
<
div
className=
{
styles
.
label
}
>
{
options
.
processName
}
</
div
>
<
div
className=
{
styles
.
detail
}
>
{
options
.
de
scription
}
</
div
>
</
div
>
<
div
className=
{
styles
.
tag
}
><
span
>
{
options
.
typ
e
}
</
span
></
div
>
<
div
className=
{
styles
.
tag
}
><
span
>
{
options
.
processTypeNam
e
}
</
span
></
div
>
</
Radio
>
)
}
...
...
src/pages/systemSetting/processEng/buyingRequisitionProcess/index.tsx
View file @
b6e61238
...
...
@@ -4,7 +4,7 @@
*/
import
React
,
{
useMemo
,
useRef
}
from
'react'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
Button
,
Card
,
Space
,
Switch
}
from
'antd'
import
{
Button
,
Card
,
Modal
,
Space
,
Switch
}
from
'antd'
import
StandardTable
from
'@/components/StandardTable'
import
{
ColumnType
}
from
'antd/lib/table'
import
TableOperation
from
'@/components/TableOperation'
...
...
@@ -15,12 +15,13 @@
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
{
schema
}
from
'./schema'
import
{
getOrderDeliveryNoticeOrderVendorPage
}
from
'@/services/OrderNewV2Api'
import
{
history
}
from
'umi'
import
{
history
,
useIntl
}
from
'umi'
import
{
PlusOutlined
}
from
'@ant-design/icons'
import
StatusSwitch
from
'@/components/StatusSwitch'
import
{
getPurchaseRequisitionProcessDelete
,
getPurchaseRequisitionProcessPage
,
postPurchaseRequisitionProcessUpdateStatus
}
from
'@/services/PurchaseV2Api'
const
BuyingRequisitionProcess
:
React
.
FC
=
()
=>
{
const
intl
=
useIntl
()
const
ref
=
useRef
<
any
>
({})
const
formActions
=
createFormActions
()
...
...
@@ -45,14 +46,26 @@ const BuyingRequisitionProcess: React.FC = () => {
'删除'
:
'buyingRequisitionProcess.delete'
,
}
const
buttonGroup
=
{
'修改'
:
true
,
'修改'
:
record
.
status
===
0
,
'查看'
:
true
,
'删除'
:
true
,
'删除'
:
record
.
status
===
0
,
}
const
operationHandler
=
{
'修改'
:
()
=>
{
history
.
push
(
`/memberCenter/systemSetting/processManagement/buyingRequisitionProcess/edit?id=
${
record
.
id
}
`
)
},
'查看'
:
()
=>
{
history
.
push
(
`/memberCenter/systemSetting/processManagement/buyingRequisitionProcess/detail?id=
${
record
.
id
}
`
)
},
'删除'
:
()
=>
{}
'修改'
:
()
=>
{
history
.
push
(
`/memberCenter/systemSetting/processManagement/buyingRequisitionProcess/edit?id=
${
record
.
processId
}
`
)
},
'查看'
:
()
=>
{
history
.
push
(
`/memberCenter/systemSetting/processManagement/buyingRequisitionProcess/detail?id=
${
record
.
processId
}
`
)
},
'删除'
:
()
=>
{
Modal
.
confirm
({
content
:
intl
.
formatMessage
({
id
:
'common.tip.save.confirm'
}),
okText
:
intl
.
formatMessage
({
id
:
'common.button.confirm'
}),
cancelText
:
intl
.
formatMessage
({
id
:
'common.button.cancel'
}),
onOk
:
async
()
=>
{
const
{
code
}
=
await
getPurchaseRequisitionProcessDelete
({
processId
:
record
.
processId
})
if
(
code
===
1000
)
{
ref
.
current
.
reload
()
}
}
})
}
}
return
(
<
TableOperation
...
...
@@ -63,13 +76,19 @@ const BuyingRequisitionProcess: React.FC = () => {
)
}
const
handleModify
=
(
record
)
=>
{
const
handleStatus
=
async
({
processId
},
status
:
number
)
=>
{
const
res
=
await
postPurchaseRequisitionProcessUpdateStatus
({
processId
,
status
})
if
(
res
.
code
===
1000
)
{
ref
.
current
.
reload
()
}
}
const
fetchData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
)
=>
{
get
OrderDeliveryNoticeOrderVendor
Page
({
get
PurchaseRequisitionProcess
Page
({
...
params
,
}).
then
(({
code
,
data
})
=>
{
if
(
code
===
1000
)
{
...
...
@@ -83,12 +102,12 @@ const BuyingRequisitionProcess: React.FC = () => {
{
title
:
'流程规则ID'
,
dataIndex
:
'processId'
,
key
:
'processId'
},
{
title
:
'流程规则名称'
,
dataIndex
:
'
processRuleN
ame'
,
key
:
'
processRuleN
ame'
,
dataIndex
:
'
n
ame'
,
key
:
'
n
ame'
,
width
:
160
,
ellipsis
:
true
,
render
:
(
text
:
unknown
,
record
:
any
)
=>
(
<
EyePreview
url=
{
`/memberCenter/systemSetting/processManagement/buyingRequisitionProcess/detail?id=${record.
i
d}`
}
>
{
text
}
</
EyePreview
>
<
EyePreview
url=
{
`/memberCenter/systemSetting/processManagement/buyingRequisitionProcess/detail?id=${record.
processI
d}`
}
>
{
text
}
</
EyePreview
>
)
},
{
title
:
'流程名称'
,
dataIndex
:
'processName'
,
key
:
'processName'
},
...
...
@@ -97,14 +116,7 @@ const BuyingRequisitionProcess: React.FC = () => {
dataIndex
:
'status'
,
key
:
'status'
,
render
:
(
text
:
string
,
record
:
any
)
=>
(
// <AuthButton btnCode='buyingRequisitionProcess.state' >
// <StatusSwitch
// fieldNames="status"
// handleConfirm={() => handleModify(record)}
// record={record}
// />
// </AuthButton>
<
Switch
/>
<
Switch
checked=
{
!!
text
}
onChange=
{
()
=>
handleStatus
(
record
,
!!
text
?
0
:
1
)
}
/>
)
},
{
title
:
'操作时间'
,
dataIndex
:
'createTime'
,
key
:
'createTime'
},
...
...
@@ -121,7 +133,7 @@ const BuyingRequisitionProcess: React.FC = () => {
<
StandardTable
currentRef=
{
ref
}
columns=
{
columns
}
tableProps=
{
{
rowKey
:
'
id'
,
}
}
tableProps=
{
{
rowKey
:
'
processId'
}
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
controlRender=
{
<
NiceForm
...
...
src/pages/systemSetting/ruleEng/buyingRequisitionRule/index.tsx
View file @
b6e61238
...
...
@@ -5,16 +5,19 @@
import
React
from
'react'
import
{
ColumnType
}
from
'antd/lib/table'
import
TableOperation
from
'@/components/TableOperation'
import
{
get
OrderDeliveryNoticeOrderVendorPage
}
from
'@/services/OrderNew
V2Api'
import
{
get
PurchaseRequisitionProcessEnginePage
}
from
'@/services/Purchase
V2Api'
import
CommonTable
from
'../component/CommonTable'
import
{
column_id
,
column_name
,
column_processName
,
column_status
,
column_createTime
,
column_operation
}
from
'../columns'
;
import
{
history
}
from
'umi'
const
MaterialManageRule
:
React
.
FC
=
()
=>
{
const
renderOptionButton
=
(
record
:
any
)
=>
{
const
btnAuthOfOperationTextMap
=
{
'配置'
:
'buyingRequisitionRule.config'
}
const
buttonGroup
=
{
'配置'
:
true
}
const
operationHandler
=
{
'配置'
:
()
=>
{
}
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
`/memberCenter/systemSetting/ruleEng/ruleEngConfig?type=BUYING_REQUISITION&processId=
${
record
.
processId
}
`
)
}}
return
(
<
TableOperation
buttonTextFieldMap=
{
buttonGroup
}
...
...
@@ -38,13 +41,13 @@ const MaterialManageRule: React.FC = () => {
// 操作
{
...
column_operation
,
render
:
(
record
)
=>
renderOptionButton
(
record
)
render
:
(
_
,
record
)
=>
renderOptionButton
(
record
)
}
]
return
(
<
CommonTable
fetchApi=
{
get
OrderDeliveryNoticeOrderVendor
Page
}
fetchApi=
{
get
PurchaseRequisitionProcessEngine
Page
}
columns=
{
columns
}
/>
)
...
...
src/pages/systemSetting/ruleEng/columns/index.tsx
View file @
b6e61238
...
...
@@ -12,8 +12,8 @@ export const column_name = name
/** 流程规则类型 */
export
const
column_processRuleType
:
ColumnType
<
any
>
=
{
title
:
'流程规则类型'
,
key
:
'process
RuleTyp
e'
,
dataIndex
:
'process
RuleTyp
e'
,
key
:
'process
TypeNam
e'
,
dataIndex
:
'process
TypeNam
e'
,
}
/** 流程名称 */
...
...
src/pages/systemSetting/ruleEng/component/CommonTable/index.tsx
View file @
b6e61238
...
...
@@ -25,7 +25,7 @@ type PropsType = {
}
const
CommonTable
:
React
.
FC
<
PropsType
>
=
(
props
)
=>
{
const
{
schema
=
tableFormSchema
,
fetchApi
,
fetchParams
=
{},
columns
,
searchKey
=
'name'
,
rowKey
=
'
i
d'
}
=
props
const
{
schema
=
tableFormSchema
,
fetchApi
,
fetchParams
=
{},
columns
,
searchKey
=
'name'
,
rowKey
=
'
processI
d'
}
=
props
const
ref
=
useRef
<
any
>
({})
const
formActions
=
createFormActions
()
...
...
src/pages/systemSetting/ruleEng/contractCoordinationRule/index.tsx
View file @
b6e61238
...
...
@@ -5,7 +5,7 @@
import
React
from
'react'
import
{
ColumnType
}
from
'antd/lib/table'
import
TableOperation
from
'@/components/TableOperation'
import
{
get
OrderDeliveryNoticeOrderVendorPage
}
from
'@/services/OrderNew
V2Api'
import
{
get
ContractRuleEngineCoordinationPage
}
from
'@/services/Contract
V2Api'
import
CommonTable
from
'../component/CommonTable'
import
{
column_id
,
column_name
,
column_processName
,
column_status
,
column_createTime
,
column_operation
}
from
'../columns'
;
import
{
history
}
from
'umi'
...
...
@@ -15,7 +15,9 @@ const ContractCoordinationRule: React.FC = () => {
const
renderOptionButton
=
(
record
:
any
)
=>
{
const
btnAuthOfOperationTextMap
=
{
'配置'
:
'contractCoordinationRule.config'
}
const
buttonGroup
=
{
'配置'
:
true
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
'/memberCenter/systemSetting/ruleEng/ruleEngConfig'
)
}
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
`/memberCenter/systemSetting/ruleEng/ruleEngConfig?type=CONTRACT_COORDINATION&processId=
${
record
.
processId
}
`
)
}}
return
(
<
TableOperation
buttonTextFieldMap=
{
buttonGroup
}
...
...
@@ -42,13 +44,13 @@ const ContractCoordinationRule: React.FC = () => {
// 操作
{
...
column_operation
,
render
:
(
record
)
=>
renderOptionButton
(
record
)
render
:
(
_
,
record
)
=>
renderOptionButton
(
record
)
}
]
return
(
<
CommonTable
fetchApi=
{
get
OrderDeliveryNoticeOrderVendor
Page
}
fetchApi=
{
get
ContractRuleEngineCoordination
Page
}
columns=
{
columns
}
/>
)
...
...
src/pages/systemSetting/ruleEng/contractManageRule/index.tsx
View file @
b6e61238
...
...
@@ -5,7 +5,7 @@
import
React
from
'react'
import
{
ColumnType
}
from
'antd/lib/table'
import
TableOperation
from
'@/components/TableOperation'
import
{
get
OrderDeliveryNoticeOrderVendorPage
}
from
'@/services/OrderNew
V2Api'
import
{
get
ContractRuleEngineProcessPage
}
from
'@/services/Contract
V2Api'
import
CommonTable
from
'../component/CommonTable'
import
{
column_id
,
column_name
,
column_processName
,
column_status
,
column_createTime
,
column_operation
}
from
'../columns'
;
import
{
history
}
from
'umi'
...
...
@@ -15,7 +15,9 @@ const ContractManageRule: React.FC = () => {
const
renderOptionButton
=
(
record
:
any
)
=>
{
const
btnAuthOfOperationTextMap
=
{
'配置'
:
'contractManageRule.config'
}
const
buttonGroup
=
{
'配置'
:
true
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
'/memberCenter/systemSetting/ruleEng/ruleEngConfig'
)
}
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
`/memberCenter/systemSetting/ruleEng/ruleEngConfig?type=CONTRACT_MANAGE&processId=
${
record
.
processId
}
`
)
}}
return
(
<
TableOperation
buttonTextFieldMap=
{
buttonGroup
}
...
...
@@ -42,13 +44,13 @@ const ContractManageRule: React.FC = () => {
// 操作
{
...
column_operation
,
render
:
(
record
)
=>
renderOptionButton
(
record
)
render
:
(
_
,
record
)
=>
renderOptionButton
(
record
)
}
]
return
(
<
CommonTable
fetchApi=
{
get
OrderDeliveryNoticeOrderVendor
Page
}
fetchApi=
{
get
ContractRuleEngineProcess
Page
}
columns=
{
columns
}
/>
)
...
...
src/pages/systemSetting/ruleEng/materialManageRule/index.tsx
View file @
b6e61238
...
...
@@ -5,7 +5,7 @@
import
React
from
'react'
import
{
ColumnType
}
from
'antd/lib/table'
import
TableOperation
from
'@/components/TableOperation'
import
{
get
OrderDeliveryNoticeOrderVendorPage
}
from
'@/services/OrderNew
V2Api'
import
{
get
ProductMaterialProcessEnginePage
}
from
'@/services/Product
V2Api'
import
CommonTable
from
'../component/CommonTable'
import
{
column_id
,
column_name
,
column_processName
,
column_status
,
column_createTime
,
column_operation
}
from
'../columns'
;
import
{
history
}
from
'umi'
...
...
@@ -15,7 +15,9 @@ const BuyingRequisitionRule: React.FC = () => {
const
renderOptionButton
=
(
record
:
any
)
=>
{
const
btnAuthOfOperationTextMap
=
{
'配置'
:
'materialManageRule.config'
}
const
buttonGroup
=
{
'配置'
:
true
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
'/memberCenter/systemSetting/ruleEng/ruleEngConfig'
)
}
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
`/memberCenter/systemSetting/ruleEng/ruleEngConfig?type=MATERIAL_MANAGE&processId=
${
record
.
processId
}
`
)
}}
return
(
<
TableOperation
buttonTextFieldMap=
{
buttonGroup
}
...
...
@@ -42,13 +44,13 @@ const BuyingRequisitionRule: React.FC = () => {
// 操作
{
...
column_operation
,
render
:
(
record
)
=>
renderOptionButton
(
record
)
render
:
(
_
,
record
)
=>
renderOptionButton
(
record
)
}
]
return
(
<
CommonTable
fetchApi=
{
get
OrderDeliveryNoticeOrderVendor
Page
}
fetchApi=
{
get
ProductMaterialProcessEngine
Page
}
columns=
{
columns
}
/>
)
...
...
src/pages/systemSetting/ruleEng/purchaseProcessRule/index.tsx
View file @
b6e61238
...
...
@@ -5,7 +5,7 @@
import
React
from
'react'
import
{
ColumnType
}
from
'antd/lib/table'
import
TableOperation
from
'@/components/TableOperation'
import
{
getOrder
DeliveryNoticeOrderVendor
Page
}
from
'@/services/OrderNewV2Api'
import
{
getOrder
PurchaseProcessEngine
Page
}
from
'@/services/OrderNewV2Api'
import
CommonTable
from
'../component/CommonTable'
import
{
column_id
,
column_name
,
column_processRuleType
,
column_processName
,
column_status
,
column_createTime
,
column_operation
}
from
'../columns'
;
import
{
history
}
from
'umi'
...
...
@@ -15,7 +15,9 @@ const PurchaseProcessRule: React.FC = () => {
const
renderOptionButton
=
(
record
:
any
)
=>
{
const
btnAuthOfOperationTextMap
=
{
'配置'
:
'purchaseProcessRule.config'
}
const
buttonGroup
=
{
'配置'
:
true
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
'/memberCenter/systemSetting/ruleEng/ruleEngConfig'
)
}
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
`/memberCenter/systemSetting/ruleEng/ruleEngConfig?type=PURCHASE_PROCESS&processId=
${
record
.
processId
}
`
)
}}
return
(
<
TableOperation
buttonTextFieldMap=
{
buttonGroup
}
...
...
@@ -44,13 +46,13 @@ const PurchaseProcessRule: React.FC = () => {
// 操作
{
...
column_operation
,
render
:
(
record
)
=>
renderOptionButton
(
record
)
render
:
(
_
,
record
)
=>
renderOptionButton
(
record
)
}
]
return
(
<
CommonTable
fetchApi=
{
getOrder
DeliveryNoticeOrderVendor
Page
}
fetchApi=
{
getOrder
PurchaseProcessEngine
Page
}
columns=
{
columns
}
/>
)
...
...
src/pages/systemSetting/ruleEng/requestFundsManageRule/index.tsx
View file @
b6e61238
...
...
@@ -5,7 +5,7 @@
import
React
from
'react'
import
{
ColumnType
}
from
'antd/lib/table'
import
TableOperation
from
'@/components/TableOperation'
import
{
get
OrderDeliveryNoticeOrderVendorPage
}
from
'@/services/OrderNew
V2Api'
import
{
get
SettleAccountsApplyAmountProcessEffectiveStatus
}
from
'@/services/Settle
V2Api'
import
CommonTable
from
'../component/CommonTable'
import
{
column_id
,
column_name
,
column_processName
,
column_status
,
column_createTime
,
column_operation
}
from
'../columns'
;
import
{
history
}
from
'umi'
...
...
@@ -15,7 +15,9 @@ const RequestFundsManageRule: React.FC = () => {
const
renderOptionButton
=
(
record
:
any
)
=>
{
const
btnAuthOfOperationTextMap
=
{
'配置'
:
'requestFundsManageRule.config'
}
const
buttonGroup
=
{
'配置'
:
true
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
'/memberCenter/systemSetting/ruleEng/ruleEngConfig'
)
}
}
const
operationHandler
=
{
'配置'
:
()
=>
{
history
.
push
(
`/memberCenter/systemSetting/ruleEng/ruleEngConfig?type=REQUEST_FUNDS_MANAGE&processId=
${
record
.
processId
}
`
)
}}
return
(
<
TableOperation
buttonTextFieldMap=
{
buttonGroup
}
...
...
@@ -42,13 +44,13 @@ const RequestFundsManageRule: React.FC = () => {
// 操作
{
...
column_operation
,
render
:
(
record
)
=>
renderOptionButton
(
record
)
render
:
(
_
,
record
)
=>
renderOptionButton
(
record
)
}
]
return
(
<
CommonTable
fetchApi=
{
get
OrderDeliveryNoticeOrderVendorPage
}
fetchApi=
{
get
SettleAccountsApplyAmountProcessEffectiveStatus
}
columns=
{
columns
}
/>
)
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/CategoryDrawer/index.tsx
View file @
b6e61238
import
React
,
{
useRef
,
useState
,
useCallback
,
forwardRef
,
memo
}
from
'react'
import
{
Form
}
from
'antd'
import
StandardTable
from
'@/components/StandardTable'
import
{
ColumnType
}
from
'antd/lib/table'
import
NiceForm
from
'@/components/NiceForm'
import
{
createFormActions
}
from
'@formily/antd'
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
{
schema
}
from
'./schema'
import
React
,
{
useRef
,
useState
,
useCallback
,
forwardRef
,
memo
,
useEffect
,
useImperativeHandle
}
from
'react'
import
{
Tree
}
from
'antd'
import
CommonDrawer
from
'../CommonDrawer'
import
{
get
OrderDeliveryNoticeOrderVendorPage
}
from
'@/services/OrderNew
V2Api'
import
{
get
ProductPlatformGetCategoryTree
}
from
'@/services/Product
V2Api'
interface
PropsType
{
onOk
?:
()
=>
void
onOk
?:
(
values
:
any
)
=>
void
fieldCode
?:
string
selectCache
?:
any
[]
}
const
ConfigDrawer
=
(
props
:
PropsType
,
ref
)
=>
{
const
[
form
]
=
Form
.
useForm
()
const
formActions
=
createFormActions
()
const
{
onOk
}
=
props
const
CategoryDrawer
=
(
props
:
PropsType
,
ref
)
=>
{
const
{
onOk
,
fieldCode
,
selectCache
}
=
props
const
tableRef
=
useRef
<
any
>
({})
const
[
categoryTree
,
setCategoryTree
]
=
useState
<
any
[]
>
([])
const
[
checkedKeys
,
setCheckedKeys
]
=
useState
<
any
[]
>
([])
const
drawRef
=
useRef
<
any
>
()
const
handleOk
=
useCallback
(()
=>
{
form
.
validateFields
().
then
((
values
)
=>
{
onOk
?.()
})
},
[])
onOk
?.(
checkedKeys
.
map
(
item
=>
({
id
:
item
.
id
,
value
:
item
[
fieldCode
]
})))
},
[
checkedKeys
])
const
handleShow
=
useCallback
((
params
:
Object
)
=>
{
},
[])
const
fetchData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
)
=>
{
getOrderDeliveryNoticeOrderVendorPage
(
params
).
then
(({
code
,
data
})
=>
{
if
(
code
===
1000
)
{
resolve
(
data
)
const
getCategoryTree
=
async
()
=>
{
const
{
code
,
data
}
=
await
getProductPlatformGetCategoryTree
()
if
(
code
===
1000
)
{
setCategoryTree
(
data
)
}
}
const
_onCheck
=
(
checked
:
string
[],
e
:
any
)
=>
{
const
newChecks
=
e
.
checkedNodes
.
flatMap
(
item
=>
!!
item
.
children
.
length
?
[]
:
[
item
])
setCheckedKeys
(
newChecks
)
}
const
checkAbleCategoryTree
=
()
=>
{
const
newTree
=
JSON
.
parse
(
JSON
.
stringify
(
categoryTree
))
function
delTree
(
tree
,
delItem
)
{
if
(
delItem
)
{
if
(
delItem
.
children
.
length
)
{
delItem
.
children
.
forEach
(
item
=>
{
delTree
(
tree
,
item
)
})
}
else
{
if
(
selectCache
.
includes
(
delItem
.
id
))
{
delItem
.
disableCheckbox
=
true
}
}
})
}
}
newTree
.
forEach
(
item
=>
{
delTree
(
newTree
,
item
)
})
return
newTree
}
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'通知单号'
,
dataIndex
:
'noticeNo'
,
key
:
'noticeNo'
,
width
:
160
,
useImperativeHandle
(
ref
,
()
=>
({
show
(
flag
:
boolean
,
params
=
{},
data
)
{
drawRef
?.
current
?.
show
(
flag
,
params
)
if
(
data
)
{
setCheckedKeys
(
data
?.
selectData
||
[])
}
},
{
title
:
'通知单摘要'
,
dataIndex
:
'digest'
,
key
:
'digest'
},
{
title
:
'送货日期'
,
dataIndex
:
'deliveryTime'
,
key
:
'deliveryTime'
},
{
title
:
'采购会员'
,
dataIndex
:
'memberName'
,
key
:
'memberName'
},
{
title
:
'单据时间'
,
dataIndex
:
'createTime'
,
key
:
'createTime'
},
]
setKeys
(
keys
:
any
[])
{
setCheckedKeys
(
keys
)
}
}))
useEffect
(()
=>
{
getCategoryTree
()
},
[])
return
(
<
CommonDrawer
ref=
{
r
ef
}
title=
'
编辑
'
width=
{
4
00
}
ref=
{
drawR
ef
}
title=
'
选择品类
'
width=
{
6
00
}
onOk=
{
handleOk
}
onCancel=
{
()
=>
{}
}
onShow=
{
handleShow
}
destroyOnClose
>
<
StandardTable
currentRef=
{
tableRef
}
columns=
{
columns
}
tableProps=
{
{
rowKey
:
'id'
,
}
}
fetchTableData=
{
(
params
:
unknown
)
=>
fetchData
(
params
)
}
controlRender=
{
<
NiceForm
actions=
{
formActions
}
onSubmit=
{
values
=>
ref
.
current
.
reload
(
values
)
}
effects=
{
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'noticeNo'
,
FORM_FILTER_PATH
,
)
}
}
schema=
{
schema
}
/>
}
<
Tree
checkable=
{
true
}
onCheck=
{
_onCheck
}
treeData=
{
checkAbleCategoryTree
()
}
blockNode=
{
true
}
checkedKeys=
{
checkedKeys
.
map
(
item
=>
item
.
id
)
}
fieldNames=
{
{
key
:
'id'
}
}
/>
</
CommonDrawer
>
)
}
export
default
memo
(
forwardRef
(
C
onfig
Drawer
))
export
default
memo
(
forwardRef
(
C
ategory
Drawer
))
src/pages/systemSetting/ruleEng/ruleEngConfig/components/CategoryDrawer/schema/index.tsx
deleted
100644 → 0
View file @
2d4f711e
import
{
ISchema
}
from
'@formily/antd'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
export
const
schema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
mageLayout
:
{
type
:
'object'
,
'x-component'
:
'mega-layout'
,
properties
:
{
topLayout
:
{
type
:
'object'
,
'x-component'
:
'mega-layout'
,
'x-component-props'
:
{
className
:
'useMegaStart'
},
properties
:
{
noticeNo
:
{
type
:
'string'
,
'x-component'
:
'Search'
,
'x-component-props'
:
{
allowClear
:
true
,
placeholder
:
'请输入通知单号查询'
},
},
},
},
[
FORM_FILTER_PATH
]:
{
type
:
'object'
,
'x-component'
:
'flex-layout'
,
'x-component-props'
:
{
rowStyle
:
{
flexWrap
:
'nowrap'
,
justifyContent
:
'flex-start'
},
colStyle
:
{
marginRight
:
20
,
},
},
properties
:
{
digest
:
{
type
:
'string'
,
'x-component-props'
:
{
allowClear
:
true
,
placeholder
:
'通知单摘要'
}
},
'[startDate, endDate]'
:
{
type
:
'daterange'
,
'x-component-props'
:
{
allowClear
:
true
,
placeholder
:
[
'送货开始日期'
,
'送货结束日期'
],
},
},
memberName
:
{
type
:
'string'
,
'x-component-props'
:
{
allowClear
:
true
,
placeholder
:
'采购会员'
}
},
submit
:
{
'x-component'
:
'Submit'
,
'x-mega-props'
:
{
span
:
1
,
},
'x-component-props'
:
{
children
:
'查询'
,
},
},
}
}
}
}
}
}
src/pages/systemSetting/ruleEng/ruleEngConfig/components/CommonDrawer/index.tsx
View file @
b6e61238
...
...
@@ -3,7 +3,7 @@ import { Drawer, Space, Button, DrawerProps } from 'antd'
import
styles
from
'./index.less'
export
type
HandleType
=
{
show
:
(
flag
?:
boolean
,
params
?:
Object
)
=>
void
;
show
:
(
flag
?:
boolean
,
params
?:
any
)
=>
void
;
}
interface
PropsType
extends
DrawerProps
{
...
...
@@ -12,23 +12,24 @@ interface PropsType extends DrawerProps {
onCancel
?:
()
=>
void
cancelText
?:
string
children
?:
React
.
ReactNode
onShow
?:
(
params
:
Object
)
=>
void
onShow
?:
(
params
:
any
,
flag
?:
boolean
)
=>
void
specialFooter
?:
React
.
ReactNode
confirmLoading
?:
boolean
}
const
CommonDrawer
=
(
props
:
PropsType
,
ref
:
any
)
=>
{
const
{
onOk
,
onCancel
,
onShow
,
okText
=
'确定'
,
cancelText
=
'取消'
,
specialFooter
,
children
,
...
rest
}
=
props
const
{
onOk
,
onCancel
,
onShow
,
okText
=
'确定'
,
cancelText
=
'取消'
,
specialFooter
,
children
,
confirmLoading
,
...
rest
}
=
props
const
[
visible
,
setVisible
]
=
useState
<
boolean
>
(
false
)
console
.
log
(
'confirmLoading'
,
confirmLoading
)
const
_onCancel
=
()
=>
{
setVisible
(
false
)
onCancel
?.()
}
useImperativeHandle
(
ref
,
()
=>
({
show
(
flag
=
true
,
params
=
{})
{
show
(
flag
,
params
=
{})
{
setVisible
(
flag
)
onShow
?.(
params
)
onShow
?.(
params
,
flag
)
}
}))
...
...
@@ -43,7 +44,7 @@ const CommonDrawer = (props: PropsType, ref: any) => {
<
div
style=
{
{
textAlign
:
'right'
}
}
>
<
Space
size=
{
12
}
>
{
onCancel
&&
<
Button
onClick=
{
_onCancel
}
>
{
cancelText
}
</
Button
>
}
{
onOk
&&
<
Button
type=
"primary"
onClick=
{
onOk
}
>
{
okText
}
</
Button
>
}
{
onOk
&&
<
Button
type=
"primary"
onClick=
{
onOk
}
loading=
{
confirmLoading
}
>
{
okText
}
</
Button
>
}
</
Space
>
</
div
>
</
div
>
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/CommonValue/index.tsx
0 → 100644
View file @
b6e61238
import
React
from
'react'
interface
PropsType
{
onChange
?:
(
val
:
any
)
=>
void
value
?:
any
valueType
?:
'string'
|
'number'
|
'array'
children
?:
React
.
ReactNode
}
const
CommonValue
=
(
props
:
PropsType
)
=>
{
const
{
onChange
,
value
,
children
,
valueType
=
'string'
}
=
props
const
_handleValue
=
(
val
)
=>
{
if
(
Array
.
isArray
(
val
))
{
return
val
}
return
[{
value
:
val
}]
}
const
_onChange
=
(
val
)
=>
{
const
newValue
=
_handleValue
(
val
)
onChange
?.(
newValue
)
}
return
(
<
div
>
{
children
&&
React
.
Children
.
map
(
children
,
(
child
:
any
)
=>
{
return
React
.
cloneElement
(
child
,
{
value
:
valueType
===
'array'
?
value
:
value
?.
value
,
onChange
:
_onChange
});
})
}
</
div
>
)
}
export
default
CommonValue
src/pages/systemSetting/ruleEng/ruleEngConfig/components/ConfigDrawer/index.tsx
View file @
b6e61238
import
React
,
{
useState
,
forwardRef
,
memo
,
useCallback
}
from
'react'
import
React
,
{
useState
,
forwardRef
,
memo
,
useCallback
,
useRef
}
from
'react'
import
{
Form
}
from
'antd'
import
CommonDrawer
from
'../CommonDrawer'
import
ProcessRules
from
'../ProcessRules'
import
{
getRuleEngineProcessRuleConfigGetProcessRuleConfig
,
postRuleEngineConfigBatchSaveOrUpdate
}
from
'@/services/RuleEngineV2Api'
interface
PropsType
{
onChange
?:
()
=>
void
...
...
@@ -11,17 +12,62 @@ const ConfigDrawer = (props: PropsType, ref) => {
const
[
form
]
=
Form
.
useForm
()
const
{
onChange
}
=
props
const
[
filedTypeOptions
,
setFiledTypeOptions
]
=
useState
<
any
[]
>
([])
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
)
const
paramsRef
=
useRef
<
any
>
({})
// 获取字段类型下拉数据
const
getFiledTypeData
=
async
(
params
:
any
)
=>
{
const
{
code
,
data
}
=
await
getRuleEngineProcessRuleConfigGetProcessRuleConfig
(
params
)
if
(
code
===
1000
)
{
// Select组件options参数字段不支持驼峰法,这里处理一下
const
newData
=
data
.
map
(({
selectContent
,
...
rest
})
=>
({
...
rest
,
select_content
:
selectContent
}))
setFiledTypeOptions
(
newData
)
}
}
const
handleOk
=
useCallback
(()
=>
{
form
.
validateFields
().
then
((
values
)
=>
{
onChange
?.()
const
{
id
,
ruleEngineConfigFieldRelations
}
=
values
const
params
=
{
...
paramsRef
.
current
,
id
,
ruleEngineConfigFieldRelations
:
ruleEngineConfigFieldRelations
?.
map
(
item
=>
{
let
temp
=
item
.
ruleEngineConfigFields
||
[]
let
ruleEngineConfigFields
:
any
[]
=
temp
?.
filter
(
i
=>
!
[
''
,
undefined
,
null
].
includes
(
i
.
value
))
return
{
...
item
,
ruleEngineConfigFields
:
ruleEngineConfigFields
.
length
?
ruleEngineConfigFields
:
undefined
}
})
}
console
.
log
(
'params'
,
params
)
setLoading
(
true
)
postRuleEngineConfigBatchSaveOrUpdate
(
params
).
then
(({
code
})
=>
{
if
(
code
===
1000
)
{
onChange
?.()
ref
.
current
.
show
(
false
)
}
}).
finally
(()
=>
{
setLoading
(
false
)
})
})
},
[])
},
[
loading
])
const
handleCancel
=
useCallback
(()
=>
{
onChange
?.()
},
[])
const
handleShow
=
useCallback
((
params
:
Object
)
=>
{
const
handleShow
=
useCallback
(
async
({
process
,
formData
}:
any
,
flag
:
boolean
)
=>
{
if
(
flag
)
{
form
.
resetFields
()
paramsRef
.
current
=
process
await
getFiledTypeData
({
processId
:
process
?.
processId
,
processStep
:
process
?.
processStep
})
console
.
log
(
'formData'
,
formData
)
formData
&&
form
.
setFieldsValue
(
formData
)
}
},
[])
return
(
...
...
@@ -32,8 +78,13 @@ const ConfigDrawer = (props: PropsType, ref) => {
onOk=
{
handleOk
}
onCancel=
{
handleCancel
}
onShow=
{
handleShow
}
confirmLoading=
{
loading
}
destroyOnClose
>
<
ProcessRules
form=
{
form
}
/>
<
ProcessRules
form=
{
form
}
filedTypeOptions=
{
filedTypeOptions
}
/>
</
CommonDrawer
>
)
}
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/FlowChart/index.tsx
View file @
b6e61238
...
...
@@ -4,7 +4,8 @@ import styles from './index.less'
export
type
FlowChartOptionsType
=
{
label
:
string
,
value
:
string
|
number
value
:
string
|
number
,
other
?:
any
}
export
type
RefHandleType
=
{
...
...
@@ -14,7 +15,8 @@ export type RefHandleType = {
type
PropsType
=
{
children
?:
React
.
ReactNode
options
?:
FlowChartOptionsType
[]
onChange
?:
(
value
:
string
|
number
)
=>
void
onChange
?:
(
value
:
string
|
number
,
item
?:
any
)
=>
void
fieldNames
?:
{
label
?:
string
,
value
?:
string
}
}
type
ItemPropsType
=
{
...
...
@@ -25,12 +27,12 @@ type ItemPropsType = {
value
?:
string
|
number
}
const
FlowChart
=
({
children
,
options
,
onChange
}:
PropsType
,
ref
)
=>
{
const
FlowChart
=
({
children
,
options
,
onChange
,
fieldNames
=
{
label
:
'label'
,
value
:
'value'
}
}:
PropsType
,
ref
)
=>
{
const
[
activeValue
,
setActiveValue
]
=
useState
<
string
|
number
>
()
const
onItemChange
=
(
value
:
string
|
number
)
=>
{
const
onItemChange
=
(
value
:
string
|
number
,
item
?:
any
)
=>
{
setActiveValue
(
value
)
onChange
?.(
value
)
onChange
?.(
value
,
item
)
}
useImperativeHandle
(
ref
,
()
=>
({
...
...
@@ -46,18 +48,18 @@ const FlowChart = ({ children, options, onChange }: PropsType, ref) => {
options
?
options
.
map
(
item
=>
(
<
FlowChartItem
key=
{
item
.
value
}
active=
{
item
.
value
===
activeValue
}
onClick=
{
()
=>
{
onItemChange
(
item
.
value
)
}
}
key=
{
item
[
fieldNames
.
value
]
}
active=
{
item
[
fieldNames
.
value
]
===
activeValue
}
onClick=
{
()
=>
{
onItemChange
?.(
item
[
fieldNames
.
value
],
item
)
}
}
>
{
item
.
label
}
{
item
[
fieldNames
.
label
]
}
</
FlowChartItem
>
))
:
children
&&
React
.
Children
.
map
(
children
,
(
child
:
any
)
=>
{
return
React
.
cloneElement
(
child
,
{
active
:
child
.
props
.
value
===
activeValue
,
onClick
:
(
value
)
=>
{
onItemChange
(
value
)
}
onClick
:
(
value
)
=>
{
onItemChange
?.
(
value
)
}
});
})
}
...
...
@@ -72,7 +74,7 @@ const FlowChartItem = ({ children, type = 'step', active, onClick, value }: Item
<
div
className=
{
styles
[
'item-box'
]
}
>
<
div
className=
{
cs
(
styles
[
type
],
active
&&
styles
[
'active'
])
}
onClick=
{
()
=>
onClick
(
value
)
}
onClick=
{
()
=>
onClick
?.
(
value
)
}
>
{
children
}
</
div
>
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/MaterialDrawer/index.tsx
View file @
b6e61238
import
React
,
{
useRef
,
useState
,
useCallback
,
forwardRef
,
memo
,
useImperativeHandle
}
from
'react'
import
{
Form
}
from
'antd'
import
{
Cascader
,
Form
,
Tabs
,
Table
,
Checkbox
}
from
'antd'
import
StandardTable
from
'@/components/StandardTable'
import
{
ColumnType
}
from
'antd/lib/table'
import
NiceForm
from
'@/components/NiceForm'
...
...
@@ -8,37 +8,44 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
{
schema
}
from
'./schema'
import
CommonDrawer
,
{
HandleType
}
from
'../CommonDrawer'
import
{
getOrderDeliveryNoticeOrderVendorPage
}
from
'@/services/OrderNewV2Api'
import
{
getProductGoodsGetDoesNotFreezeGoodsList
}
from
'@/services/ProductV2Api'
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
import
{
fetchBrand
,
fetchCategoryData
,
fetchTreeData
,
useAsyncCascader
}
from
'../../effects'
export
type
RefHandleType
=
{
show
:
(
flag
?:
boolean
,
params
?:
Object
)
=>
void
show
:
(
flag
?:
boolean
,
params
?:
any
,
data
?:
any
)
=>
void
setRows
:
(
rows
:
any
[])
=>
void
;
}
interface
PropsType
{
onOk
?:
(
rows
:
any
[],
rowKeys
:
any
[])
=>
void
onQueryAll
?:
(
value
?:
any
)
=>
void
fieldCode
?:
string
selectCache
?:
any
[]
}
const
MaterialDrawer
=
(
props
:
PropsType
,
ref
)
=>
{
const
formActions
=
createFormActions
()
const
{
onOk
}
=
props
const
{
onOk
,
onQueryAll
,
fieldCode
=
'code'
,
selectCache
}
=
props
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
any
>
([])
const
[
selectedRows
,
setSelectedRows
]
=
useState
<
any
>
([])
const
[
isQueryAll
,
setIsQueryAll
]
=
useState
<
boolean
>
(
false
)
const
tableRef
=
useRef
<
any
>
({})
const
drawRef
=
useRef
<
HandleType
>
()
const
handleOk
=
useCallback
(()
=>
{
onOk
?.(
selectedRows
,
selectedRowKeys
)
},
[
selectedRows
,
selectedRowKeys
])
onQueryAll
?.(
isQueryAll
)
onOk
?.(
selectedRows
.
map
(
item
=>
({
id
:
item
.
id
,
value
:
item
[
fieldCode
]
}))
,
selectedRowKeys
)
},
[
selectedRows
,
selectedRowKeys
,
isQueryAll
])
const
handleShow
=
useCallback
((
params
:
Object
)
=>
{
},
[])
const
fetchData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
)
=>
{
get
OrderDeliveryNoticeOrderVendorPage
(
params
).
then
(({
code
,
data
})
=>
{
get
ProductGoodsGetDoesNotFreezeGoodsList
(
params
).
then
(({
code
,
data
})
=>
{
if
(
code
===
1000
)
{
resolve
(
data
)
}
...
...
@@ -47,20 +54,14 @@ const MaterialDrawer = (props: PropsType, ref) => {
}
const
handleSelectChange
=
(
record
,
selected
,
selectedRow
,
nativeEvent
)
=>
{
let
childArr
=
[...
selectedRowKeys
]
;
let
childArr
=
[...
selectedRowKeys
]
let
childRowArr
=
[...
selectedRows
]
if
(
selected
)
{
childArr
.
push
(
record
.
id
)
;
childRowArr
.
push
(
record
)
;
childArr
.
push
(
record
.
id
)
childRowArr
.
push
(
record
)
}
else
{
childArr
.
splice
(
childArr
.
findIndex
((
item
)
=>
item
===
record
.
id
),
1
);
childRowArr
.
splice
(
childRowArr
.
findIndex
((
item
)
=>
item
.
id
===
record
.
id
),
1
);
childArr
.
splice
(
childArr
.
findIndex
((
item
)
=>
item
===
record
.
id
),
1
)
childRowArr
.
splice
(
childRowArr
.
findIndex
((
item
)
=>
item
.
id
===
record
.
id
),
1
)
}
setSelectedRowKeys
(
childArr
)
setSelectedRows
(
childRowArr
)
...
...
@@ -88,9 +89,21 @@ const MaterialDrawer = (props: PropsType, ref) => {
setSelectedRows
(
childRowArr
);
}
const
onSelectAllMaterial
=
(
checked
:
boolean
)
=>
{
setIsQueryAll
(
checked
)
setSelectedRows
([])
setSelectedRowKeys
([])
}
useImperativeHandle
(
ref
,
()
=>
({
show
(
flag
=
true
,
params
=
{}
)
{
show
(
flag
:
boolean
,
params
=
{},
data
:
any
)
{
drawRef
?.
current
?.
show
(
flag
,
params
)
if
(
data
)
{
setSelectedRows
(
data
?.
selectData
||
[])
const
selectKeys
=
data
?.
selectData
?.
map
(
item
=>
item
.
id
)
||
[]
setSelectedRowKeys
(
selectKeys
)
setIsQueryAll
(
data
?.
isQueryAll
||
false
)
}
},
setRows
(
rows
:
any
[])
{
const
rowKeys
=
rows
.
map
(
item
=>
item
.
id
)
...
...
@@ -100,16 +113,18 @@ const MaterialDrawer = (props: PropsType, ref) => {
}))
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'通知单号'
,
dataIndex
:
'noticeNo'
,
key
:
'noticeNo'
,
width
:
160
,
},
{
title
:
'通知单摘要'
,
dataIndex
:
'digest'
,
key
:
'digest'
},
{
title
:
'送货日期'
,
dataIndex
:
'deliveryTime'
,
key
:
'deliveryTime'
},
{
title
:
'采购会员'
,
dataIndex
:
'memberName'
,
key
:
'memberName'
},
{
title
:
'单据时间'
,
dataIndex
:
'createTime'
,
key
:
'createTime'
},
{
title
:
'ID'
,
dataIndex
:
'id'
,
key
:
'id'
,
},
{
title
:
'物料编号'
,
dataIndex
:
fieldCode
,
key
:
fieldCode
}
]
const
columns2
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
key
:
'id'
},
{
title
:
'物料编号'
,
dataIndex
:
'code'
,
key
:
'code'
,
width
:
120
},
{
title
:
'物料名称'
,
dataIndex
:
'name'
,
key
:
'name'
},
{
title
:
'物料组'
,
dataIndex
:
[
'materialGroup'
,
'name'
],
key
:
'materialGroup'
},
{
title
:
'规格型号'
,
dataIndex
:
'type'
,
key
:
'type'
},
{
title
:
'品类'
,
dataIndex
:
[
'customerCategory'
,
'name'
],
key
:
'customerCategory'
},
{
title
:
'品牌'
,
dataIndex
:
[
'brand'
,
'name'
],
key
:
'brand'
},
]
return
(
...
...
@@ -119,34 +134,61 @@ const MaterialDrawer = (props: PropsType, ref) => {
width=
{
1000
}
onOk=
{
handleOk
}
onShow=
{
handleShow
}
onCancel=
{
()
=>
{
}
}
onCancel=
{
()
=>
{}
}
destroyOnClose
>
<
StandardTable
currentRef=
{
tableRef
}
columns=
{
columns
}
tableProps=
{
{
rowKey
:
'id'
,
}
}
fetchTableData=
{
(
params
:
unknown
)
=>
fetchData
(
params
)
}
rowSelection=
{
{
selectedRowKeys
:
selectedRowKeys
,
onSelect
:
handleSelectChange
,
onSelectAll
:
handleSelectAll
,
}
}
controlRender=
{
<
NiceForm
actions=
{
formActions
}
onSubmit=
{
values
=>
tableRef
.
current
.
reload
(
values
)
}
effects=
{
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'noticeNo'
,
FORM_FILTER_PATH
,
)
}
}
schema=
{
schema
}
<
div
style=
{
{
position
:
'relative'
,
top
:
90
}
}
>
<
Checkbox
checked=
{
isQueryAll
}
onChange=
{
(
e
)
=>
onSelectAllMaterial
(
e
.
target
.
checked
)
}
>
所有物料
</
Checkbox
>
</
div
>
<
Tabs
defaultActiveKey=
'1'
onChange=
{
()
=>
{}
}
>
<
Tabs
.
TabPane
tab=
'可选择'
key=
'1'
>
{
!
isQueryAll
&&
(
<
StandardTable
currentRef=
{
tableRef
}
columns=
{
columns2
}
tableProps=
{
{
rowKey
:
'id'
}
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
rowSelection=
{
{
selectedRowKeys
:
selectedRowKeys
,
onSelect
:
handleSelectChange
,
onSelectAll
:
handleSelectAll
,
getCheckboxProps
:
(
record
:
any
)
=>
({
disabled
:
selectCache
.
includes
(
record
.
id
)
})
}
}
controlRender=
{
<
NiceForm
actions=
{
formActions
}
onSubmit=
{
values
=>
tableRef
.
current
.
reload
(
values
)
}
components=
{
{
Cascader
}
}
effects=
{
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'code'
,
FORM_FILTER_PATH
);
useAsyncCascader
(
'materialGroupId'
,
fetchTreeData
)
useAsyncCascader
(
'categoryId'
,
fetchCategoryData
)
useAsyncSelect
(
'brandId'
,
fetchBrand
,
[
"name"
,
"id"
])
}
}
schema=
{
schema
}
/>
}
/>
)
}
</
Tabs
.
TabPane
>
<
Tabs
.
TabPane
tab=
{
`已选择(${selectedRows.length})`
}
key=
'2'
>
<
Table
rowKey=
'id'
dataSource=
{
selectedRows
}
columns=
{
columns
}
pagination=
{
null
}
/>
}
/
>
</
Tabs
.
TabPane
>
</
Tabs
>
</
CommonDrawer
>
)
}
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/MaterialDrawer/schema/index.tsx
View file @
b6e61238
import
{
ISchema
}
from
'@formily/antd'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
{
getIntl
}
from
'umi'
const
intl
=
getIntl
()
export
const
schema
:
ISchema
=
{
type
:
'object'
,
...
...
@@ -11,16 +14,16 @@ export const schema: ISchema = {
topLayout
:
{
type
:
'object'
,
'x-component'
:
'mega-layout'
,
'x-component-props'
:
{
className
:
'useMegaStart'
},
//
'x-component-props': {
//
className: 'useMegaStart'
//
},
properties
:
{
noticeNo
:
{
code
:
{
type
:
'string'
,
'x-component'
:
'Search'
,
'x-component-props'
:
{
allowClear
:
true
,
placeholder
:
'
请输入通知单号查询
'
placeholder
:
'
物料编号
'
},
},
},
...
...
@@ -38,25 +41,49 @@ export const schema: ISchema = {
},
},
properties
:
{
digest
:
{
name
:
{
type
:
'string'
,
'x-component-props'
:
{
allowClear
:
true
,
placeholder
:
'
通知单摘要
'
placeholder
:
'
物料名称
'
}
},
'[startDate, endDate]'
:
{
type
:
'daterange'
,
'x-component-props'
:
{
type
:
{
type
:
'string'
,
"x-component-props"
:
{
placeholder
:
'规格型号'
}
},
materialGroupId
:
{
type
:
'string'
,
enum
:
[],
'x-component'
:
'Cascader'
,
"x-component-props"
:
{
placeholder
:
intl
.
formatMessage
({
id
:
'material.group.title'
,
defaultMessage
:
'物料组'
}),
allowClear
:
true
,
placeholder
:
[
'送货开始日期'
,
'送货结束日期'
],
},
style
:
{
width
:
150
},
showSearch
:
true
,
fieldNames
:
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
},
}
},
memberName
:
{
categoryId
:
{
type
:
'string'
,
'x-component'
:
'Cascader'
,
'x-component-props'
:
{
placeholder
:
intl
.
formatMessage
({
id
:
'material.category'
,
defaultMessage
:
'品类'
}),
allowClear
:
true
,
placeholder
:
'采购会员'
style
:
{
width
:
150
},
showSearch
:
true
,
fieldNames
:
{
label
:
'title'
,
value
:
'id'
,
children
:
'children'
},
}
},
brandId
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
intl
.
formatMessage
({
id
:
'material.brand'
,
defaultMessage
:
'品牌'
}),
style
:
{
width
:
150
},
}
},
submit
:
{
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/ProcessRules/index.less
View file @
b6e61238
...
...
@@ -11,20 +11,37 @@
}
.rule-wrap {
position: relative;
display: flex;
align-items: center;
width: 368px;
height: 32px;
margin-bottom: 16px;
padding: 0 4px;
border: 1px solid #F5F6F7;
border-radius: 4px;
color: #252D37;
font-size: 14px;
background-color: #F5F6F7;
cursor: pointer;
.rule-delete {
display: none;
align-items: center;
justify-content: center;
position: absolute;
right: 8px;
top: 8px;
width: 16px;
height: 16px;
cursor: pointer;
}
&:hover {
border: 1px solid #00A98F;
.rule-delete {
display: flex;
}
}
:global {
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/ProcessRules/index.tsx
View file @
b6e61238
This diff is collapsed.
Click to expand it.
src/pages/systemSetting/ruleEng/ruleEngConfig/components/SeeUserDrawer/index.tsx
View file @
b6e61238
import
React
,
{
useRef
,
useState
,
useCallback
,
forwardRef
,
memo
,
useImperativeHandle
}
from
'react'
import
React
,
{
useRef
,
forwardRef
,
memo
}
from
'react'
import
StandardTable
from
'@/components/StandardTable'
import
{
ColumnType
}
from
'antd/lib/table'
import
CommonDrawer
,
{
HandleType
}
from
'../CommonDrawer'
import
{
get
OrderDeliveryNoticeOrderVendorPage
}
from
'@/services/OrderNew
V2Api'
import
CommonDrawer
from
'../CommonDrawer'
import
{
get
MemberUserPageByRoleId
}
from
'@/services/Member
V2Api'
interface
PropsType
{
onOk
?:
(
rows
:
any
[],
rowKeys
:
any
[])
=>
void
}
const
SeeUserDrawer
=
(
props
:
PropsType
,
ref
)
=>
{
const
tableRef
=
useRef
<
any
>
({})
const
roleIdRef
=
useRef
<
any
>
()
const
fetchData
=
(
params
:
any
)
=>
{
console
.
log
(
'roleIdRef.current'
,
roleIdRef
.
current
)
return
new
Promise
((
resolve
)
=>
{
getOrderDeliveryNoticeOrderVendorPage
(
params
).
then
(({
code
,
data
})
=>
{
if
(
code
===
1000
)
{
resolve
(
data
)
}
})
if
(
roleIdRef
.
current
)
{
getMemberUserPageByRoleId
({
...
params
,
roleId
:
roleIdRef
.
current
}).
then
(({
code
,
data
})
=>
{
if
(
code
===
1000
)
{
resolve
(
data
)
}
})
}
else
{
resolve
({
total
:
0
,
data
:
[]
})
}
})
}
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'通知单号'
,
dataIndex
:
'noticeNo'
,
key
:
'noticeNo'
,
width
:
160
,
},
{
title
:
'通知单摘要'
,
dataIndex
:
'digest'
,
key
:
'digest'
},
{
title
:
'送货日期'
,
dataIndex
:
'deliveryTime'
,
key
:
'deliveryTime'
},
{
title
:
'采购会员'
,
dataIndex
:
'memberName'
,
key
:
'memberName'
},
{
title
:
'单据时间'
,
dataIndex
:
'createTime'
,
key
:
'createTime'
},
{
title
:
'序号'
,
dataIndex
:
'number'
,
key
:
'number'
,
render
:
(
text
,
record
,
index
)
=>
index
},
{
title
:
'姓名'
,
dataIndex
:
'name'
,
key
:
'name'
},
{
title
:
'手机号码'
,
dataIndex
:
'phone'
,
key
:
'phone'
},
{
title
:
'所属机构'
,
dataIndex
:
'orgName'
,
key
:
'orgName'
},
{
title
:
'职位'
,
dataIndex
:
'jobTitle'
,
key
:
'jobTitle'
},
]
return
(
<
CommonDrawer
ref=
{
ref
}
title=
'用户列表'
width=
{
10
00
}
width=
{
8
00
}
footer=
{
null
}
onShow=
{
(
params
:
any
)
=>
{
roleIdRef
.
current
=
params
?.
roleId
}
}
destroyOnClose=
{
true
}
>
<
StandardTable
ref=
{
tableRef
}
columns=
{
columns
}
tableProps=
{
{
rowKey
:
'
id'
,
}
}
tableProps=
{
{
rowKey
:
'
userId'
}
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
/>
</
CommonDrawer
>
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/SelectCategory/index.tsx
View file @
b6e61238
import
React
,
{
useState
,
memo
,
useCallback
,
useRef
,
useEffect
}
from
'react'
import
{
HandleType
}
from
'../CommonDrawer'
import
MaterialDrawer
,
{
RefHandleType
}
from
'../MaterialDrawer'
import
CategoryDrawer
from
'../CategoryDrawer'
import
WrapSelect
from
'../WrapSelect'
interface
PropsType
{
onChange
?:
(
data
:
any
[])
=>
void
onChange
?:
(
data
:
any
)
=>
void
onValueChange
?:
(
data
:
any
[])
=>
void
value
?:
any
fieldCode
?:
string
selectCache
?:
any
[]
}
const
SelectMaterial
=
(
props
:
PropsType
)
=>
{
const
{
onChange
,
value
}
=
props
const
{
onChange
,
value
,
fieldCode
=
'title'
,
onValueChange
,
...
rest
}
=
props
const
[
selectData
,
setSelectData
]
=
useState
<
any
[]
>
([])
const
ref
=
useRef
<
RefHandleType
>
()
const
ref
=
useRef
<
any
>
()
const
handleOk
=
useCallback
((
rows
:
any
[])
=>
{
onChange
?.(
rows
)
setSelectData
(
rows
)
const
handleOk
=
useCallback
((
keys
:
any
[])
=>
{
// 直接处理为JSON字符串
onChange
?.(
JSON
.
stringify
(
keys
))
onValueChange
?.(
keys
)
setSelectData
(
keys
)
ref
?.
current
?.
show
(
false
)
},
[])
const
onItemDelete
=
(
id
:
string
|
number
)
=>
{
const
newSelectData
=
selectData
.
filter
(
item
=>
item
.
id
!==
id
)
// 直接处理为JSON字符串
onChange
?.(
JSON
.
stringify
(
newSelectData
))
onValueChange
?.(
newSelectData
)
setSelectData
(
newSelectData
)
ref
?.
current
?.
set
Row
s
(
newSelectData
)
ref
?.
current
?.
set
Key
s
(
newSelectData
)
}
useEffect
(()
=>
{
if
(
value
)
{
setSelectData
(
value
)
// JSON字符串转为原数据
const
keys
=
JSON
.
parse
(
value
)
setSelectData
(
keys
)
onValueChange
?.(
keys
)
}
},
[])
},
[
value
])
return
(
<>
<
WrapSelect
onIconClick=
{
()
=>
{
ref
?.
current
?.
show
()
}
}
onIconClick=
{
()
=>
{
ref
?.
current
?.
show
(
true
,
{},
{
selectData
}
)
}
}
onItemDelete=
{
onItemDelete
}
data=
{
selectData
}
labelKey=
'
memberNam
e'
labelKey=
'
valu
e'
/>
<
Material
Drawer
<
Category
Drawer
ref=
{
ref
}
onOk=
{
handleOk
}
fieldCode=
{
fieldCode
}
{
...
rest
}
/>
</>
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/SelectMaterial/index.tsx
View file @
b6e61238
...
...
@@ -3,45 +3,72 @@ import MaterialDrawer, { RefHandleType } from '../MaterialDrawer'
import
WrapSelect
from
'../WrapSelect'
interface
PropsType
{
onChange
?:
(
data
:
any
[])
=>
void
onChange
?:
(
data
:
any
)
=>
void
onValueChange
?:
(
data
:
any
[])
=>
void
value
?:
any
fieldCode
?:
string
onQueryAll
?:
(
value
?:
any
)
=>
void
selectCache
?:
any
[]
isAll
?:
boolean
}
const
SelectMaterial
=
(
props
:
PropsType
)
=>
{
const
{
onChange
,
value
}
=
props
const
{
onChange
,
value
,
fieldCode
=
'code'
,
onQueryAll
,
onValueChange
,
isAll
,
...
rest
}
=
props
const
[
selectData
,
setSelectData
]
=
useState
<
any
[]
>
([])
const
[
isQueryAll
,
setIsQueryAll
]
=
useState
<
boolean
>
(
false
)
const
ref
=
useRef
<
RefHandleType
>
()
const
handleOk
=
useCallback
((
rows
:
any
[])
=>
{
onChange
?.(
rows
)
// 直接处理为JSON字符串
onChange
?.(
JSON
.
stringify
(
rows
))
onValueChange
?.(
rows
)
setSelectData
(
rows
)
ref
?.
current
?.
show
(
false
)
},
[])
const
onItemDelete
=
(
id
:
string
|
number
)
=>
{
const
newSelectData
=
selectData
.
filter
(
item
=>
item
.
id
!==
id
)
// 直接处理为JSON字符串
onChange
?.(
JSON
.
stringify
(
newSelectData
))
onValueChange
?.(
newSelectData
)
setSelectData
(
newSelectData
)
ref
?.
current
?.
setRows
(
newSelectData
)
}
const
_onQueryAll
=
(
val
:
boolean
)
=>
{
setIsQueryAll
(
val
)
onQueryAll
?.(
val
)
}
useEffect
(()
=>
{
if
(
value
)
{
setSelectData
(
value
)
// JSON字符串转为原数据
const
rows
=
JSON
.
parse
(
value
)
setSelectData
(
rows
)
onValueChange
?.(
rows
)
}
},
[])
},
[
value
])
useEffect
(()
=>
{
setIsQueryAll
(
isAll
)
},
[
isAll
])
return
(
<>
<
WrapSelect
onIconClick=
{
()
=>
{
ref
?.
current
?.
show
()
}
}
onIconClick=
{
()
=>
{
ref
?.
current
?.
show
(
true
,
{},
{
selectData
,
isQueryAll
}
)
}
}
onItemDelete=
{
onItemDelete
}
data=
{
selectData
}
labelKey=
'memberName'
labelKey=
'value'
placeholder=
{
isQueryAll
?
'所有物料'
:
'请选择'
}
/>
<
MaterialDrawer
ref=
{
ref
}
onOk=
{
handleOk
}
fieldCode=
{
fieldCode
}
onQueryAll=
{
_onQueryAll
}
{
...
rest
}
/>
</>
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/SelectRoles/index.tsx
View file @
b6e61238
...
...
@@ -6,14 +6,15 @@ import { HandleType } from '../CommonDrawer'
import
SeeUserDrawer
from
'../SeeUserDrawer'
const
SelectRoles
=
(
props
:
any
)
=>
{
const
{
onChange
,
...
rest
}
=
props
const
{
onChange
,
onValueChange
,
...
rest
}
=
props
const
valueRef
=
useRef
<
any
>
(
)
const
roleIdRef
=
useRef
<
any
>
(
rest
?.
value
)
const
drawRef
=
useRef
<
HandleType
>
()
const
_onChange
=
(
value
)
=>
{
valueRef
.
current
.
ref
=
value
onChange
?.(
value
)
const
_onChange
=
(
id
)
=>
{
roleIdRef
.
current
=
id
onChange
?.(
id
)
onValueChange
?.(
id
)
}
return
(
...
...
@@ -22,9 +23,6 @@ const SelectRoles = (props: any) => {
<
Col
style=
{
{
flex
:
1
}
}
>
<
FetchSelect
style=
{
{
width
:
'100%'
}
}
labelKey=
'memberName'
valueKey=
'id'
requestApi=
{
getOrderDeliveryNoticeOrderVendorPage
}
onChange=
{
_onChange
}
{
...
rest
}
/>
...
...
@@ -32,13 +30,15 @@ const SelectRoles = (props: any) => {
<
Col
>
<
Button
style=
{
{
marginRight
:
0
}
}
onClick=
{
()
=>
{
drawRef
?.
current
?.
show
()
}
}
onClick=
{
()
=>
{
drawRef
?.
current
?.
show
(
true
,
{
roleId
:
roleIdRef
.
current
}
)
}
}
>
查看用户
</
Button
>
</
Col
>
</
Row
>
<
SeeUserDrawer
ref=
{
drawRef
}
/>
<
SeeUserDrawer
ref=
{
drawRef
}
/>
</>
)
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/components/StringDatePicker/index.tsx
0 → 100644
View file @
b6e61238
import
React
from
'react'
import
{
DatePicker
}
from
'antd'
import
moment
from
'moment'
const
StringDatePicker
=
(
props
:
any
)
=>
{
const
{
onChange
,
value
,
...
rest
}
=
props
const
_onChange
=
(
date
:
any
,
dateString
:
string
)
=>
{
onChange
?.(
dateString
)
}
return
(
<
DatePicker
style=
{
{
width
:
'100%'
}
}
placeholder=
"请选择"
{
...
rest
}
value=
{
moment
(
value
)
}
onChange=
{
_onChange
}
/>
)
}
export
default
StringDatePicker
src/pages/systemSetting/ruleEng/ruleEngConfig/components/WrapSelect/index.tsx
View file @
b6e61238
...
...
@@ -10,10 +10,11 @@ interface PropsType {
data
?:
any
[]
labelKey
?:
string
valueKey
?:
string
placeholder
?:
string
}
const
WrapSelect
=
(
props
:
PropsType
)
=>
{
const
{
onIconClick
,
onItemClick
,
onItemDelete
,
data
=
[],
labelKey
=
'name'
,
valueKey
=
'id'
}
=
props
const
{
onIconClick
,
onItemClick
,
onItemDelete
,
data
=
[],
labelKey
=
'name'
,
valueKey
=
'id'
,
placeholder
=
'请选择'
}
=
props
return
(
<
div
className=
{
styles
[
'wrap-select'
]
}
>
...
...
@@ -46,7 +47,7 @@ const WrapSelect = (props: PropsType) => {
}
</>
:
<
div
className=
{
styles
[
'content-placeholder'
]
}
>
请选择
</
div
>
<
div
className=
{
styles
[
'content-placeholder'
]
}
>
{
placeholder
}
</
div
>
}
<
div
className=
{
styles
[
'icon-box'
]
}
onClick=
{
()
=>
onIconClick
?.()
}
>
<
LinkOutlined
style=
{
{
fontSize
:
16
,
color
:
'#FFF'
}
}
/>
...
...
src/pages/systemSetting/ruleEng/ruleEngConfig/constant/index.ts
0 → 100644
View file @
b6e61238
/** 字段类型 */
export
enum
Filed_Type
{
STRING
=
1
,
// 字符
NUMBER
=
2
,
// 数字
DATE
=
3
,
// 日期
}
/** 选择弹窗类型 */
export
enum
Select_Content_Type
{
SelectMaterial
=
1
,
// 选择物料
SelectCategory
=
2
,
// 选择品类
}
/**
* EQUAL 1 等于
*
* UNEQUAL 2 不等于
*
* GREATER_THAN 3 大于
*
* GREATER_THAN_EQUAL 4 大于等于
*
* LESS_THAN 5 小于
*
* LESS_THAN_EQUAL 6 小于等于
*
* INCLUDED 7 包含
*
* NOT_INCLUDED 8 不包含
*
* ALL 9 所有
*/
export
enum
CONDITION_VALUE
{
EQUAL
=
1
,
// 等于
UNEQUAL
=
2
,
// 不等于
GREATER_THAN
=
3
,
// 大于
GREATER_THAN_EQUAL
=
4
,
// 大于等于
LESS_THAN
=
5
,
// 小于
LESS_THAN_EQUAL
=
6
,
// 小于等于
INCLUDED
=
7
,
// 包含
NOT_INCLUDED
=
8
,
// 不包含
// ALL = 9, // 所有
}
export
const
conditionOptions
=
{
[
Filed_Type
.
STRING
]:
[
{
label
:
'是'
,
value
:
CONDITION_VALUE
.
EQUAL
},
{
label
:
'不是'
,
value
:
CONDITION_VALUE
.
UNEQUAL
},
{
label
:
'包含'
,
value
:
CONDITION_VALUE
.
INCLUDED
},
{
label
:
'不包含'
,
value
:
CONDITION_VALUE
.
NOT_INCLUDED
},
// { label: '所有', value: CONDITION_VALUE.ALL },
],
[
Filed_Type
.
NUMBER
]:
[
{
label
:
'>'
,
value
:
CONDITION_VALUE
.
GREATER_THAN
},
{
label
:
'<'
,
value
:
CONDITION_VALUE
.
LESS_THAN
},
{
label
:
'='
,
value
:
CONDITION_VALUE
.
EQUAL
},
{
label
:
'>='
,
value
:
CONDITION_VALUE
.
GREATER_THAN_EQUAL
},
{
label
:
'<='
,
value
:
CONDITION_VALUE
.
LESS_THAN_EQUAL
},
{
label
:
'!='
,
value
:
CONDITION_VALUE
.
UNEQUAL
},
],
[
Filed_Type
.
DATE
]:
[
{
label
:
'是'
,
value
:
CONDITION_VALUE
.
EQUAL
},
{
label
:
'不是'
,
value
:
CONDITION_VALUE
.
UNEQUAL
},
{
label
:
'在之前'
,
value
:
CONDITION_VALUE
.
LESS_THAN
},
{
label
:
'在之后'
,
value
:
CONDITION_VALUE
.
GREATER_THAN
},
]
}
export
const
interrelationOptions
=
[
{
label
:
'并且'
,
value
:
1
},
{
label
:
'或者'
,
value
:
2
},
]
export
enum
RULE_TYPE
{
MATERIAL_MANAGE
=
'MATERIAL_MANAGE'
,
// 物料管理
BUYING_REQUISITION
=
'BUYING_REQUISITION'
,
// 请购单
PURCHASE_PROCESS
=
'PURCHASE_PROCESS'
,
// 采购流程
CONTRACT_MANAGE
=
'CONTRACT_MANAGE'
,
// 合同管理
CONTRACT_COORDINATION
=
'CONTRACT_COORDINATION'
,
// 合同协同
REQUEST_FUNDS_MANAGE
=
'REQUEST_FUNDS_MANAGE'
// 请款单管理
}
/**
* 物料管理 1 等于
*
* 采购单流程 2 不等于
*
* 合同管理 3 大于
*
* 合同协同 4 大于等于
*
* 请购单流程 5 小于
*
* 请款单管理 6 小于等于
*/
export
enum
RULE_ENR_TYPE
{
MATERIAL_MANAGE
=
1
,
// 物料管理
PURCHASE_PROCESS
=
2
,
// 采购单流程
CONTRACT_MANAGE
=
3
,
// 合同管理
CONTRACT_COORDINATION
=
4
,
// 合同协同
BUYING_REQUISITION
=
5
,
// 请购单流程
REQUEST_FUNDS_MANAGE
=
6
,
// 请款单管理
}
src/pages/systemSetting/ruleEng/ruleEngConfig/effects/index.ts
0 → 100644
View file @
b6e61238
import
{
getProductCustomerGetCustomerCategoryTree
,
getProductMaterialGroupTree
,
getProductSelectGetSelectBrand
}
from
"@/services/ProductV2Api"
import
{
createFormActions
,
FormEffectHooks
,
FormPath
}
from
"@formily/antd"
const
{
onFormMount$
}
=
FormEffectHooks
const
EMPTY_ARRAY
=
[]
export
const
EMPTY
=
{
totalCount
:
0
,
data
:
[],
}
export
const
useAsyncCascader
=
async
(
name
,
service
:
()
=>
Promise
<
any
[]
>
)
=>
{
const
{
setFieldState
}
=
createFormActions
()
onFormMount$
().
subscribe
(()
=>
{
service
().
then
(
res
=>
{
setFieldState
(
name
,
state
=>
{
FormPath
.
setIn
(
state
,
'props.x-component-props.options'
,
res
)
})
}).
catch
(
err
=>
{
setFieldState
(
name
,
state
=>
{
FormPath
.
setIn
(
state
,
'props.x-component-props.options'
,
[])
})
})
})
}
export
const
fetchTreeData
=
async
()
=>
{
try
{
const
{
data
,
code
}
=
await
getProductMaterialGroupTree
({
rootNodeId
:
'0'
});
if
(
code
===
1000
)
{
return
data
;
}
return
EMPTY_ARRAY
}
catch
{
return
EMPTY_ARRAY
}
}
export
const
fetchCategoryData
=
async
()
=>
{
try
{
const
{
data
,
code
}
=
await
getProductCustomerGetCustomerCategoryTree
();
if
(
code
===
1000
)
{
return
data
;
}
return
EMPTY_ARRAY
}
catch
{
return
EMPTY_ARRAY
}
}
export
const
fetchBrand
=
async
()
=>
{
try
{
const
{
data
,
code
}
=
await
getProductSelectGetSelectBrand
();
if
(
code
===
1000
)
{
return
data
;
}
return
EMPTY_ARRAY
}
catch
{
return
EMPTY_ARRAY
}
}
src/pages/systemSetting/ruleEng/ruleEngConfig/index.tsx
View file @
b6e61238
...
...
@@ -2,34 +2,87 @@
* 系统能力 - 规则引擎 - 规则引擎配置
* @author: Crayon
*/
import
React
,
{
useEffect
,
useRef
,
useCallback
}
from
'react'
import
React
,
{
useEffect
,
useRef
,
useCallback
,
useState
}
from
'react'
import
AnchorPage
from
'@/components/AnchorPage'
import
{
history
}
from
'umi'
import
usePrompt
from
'@/hooks/usePrompt'
import
FlowChart
,
{
FlowChartOptionsType
,
RefHandleType
}
from
'./components/FlowChart'
import
{
history
,
useLocation
}
from
'umi'
import
FlowChart
,
{
RefHandleType
}
from
'./components/FlowChart'
import
ConfigDrawer
from
'./components/ConfigDrawer'
import
{
HandleType
}
from
'./components/CommonDrawer'
import
{
Spin
}
from
'antd'
import
{
getProductMaterialProcessEngineGet
}
from
'@/services/ProductV2Api'
import
{
getOrderPurchaseProcessEngineGet
}
from
'@/services/OrderNewV2Api'
import
{
getPurchaseRequisitionProcessEngineGet
}
from
'@/services/PurchaseV2Api'
import
{
getContractRuleEngineCoordinationProcess
,
getContractRuleEngineProcess
}
from
'@/services/ContractV2Api'
import
{
getSettleAccountsApplyAmountProcessGet
}
from
'@/services/SettleV2Api'
import
{
getRuleEngineConfigGetRuleEngineInfo
}
from
'@/services/RuleEngineV2Api'
import
{
RULE_ENR_TYPE
,
RULE_TYPE
}
from
'./constant'
type
RuleType
=
'MATERIAL_MANAGE'
|
'BUYING_REQUISITION'
|
'PURCHASE_PROCESS'
|
'CONTRACT_MANAGE'
|
'CONTRACT_COORDINATION'
|
'REQUEST_FUNDS_MANAGE'
const
getFetchDetailApi
=
async
(
type
:
RuleType
,
params
:
any
)
=>
{
switch
(
type
)
{
case
RULE_TYPE
.
MATERIAL_MANAGE
:
return
await
getProductMaterialProcessEngineGet
(
params
)
// 查询物料流程规则引擎详情
case
RULE_TYPE
.
BUYING_REQUISITION
:
return
await
getPurchaseRequisitionProcessEngineGet
(
params
)
// 查询请购单管理规则引擎详情
case
RULE_TYPE
.
PURCHASE_PROCESS
:
return
await
getOrderPurchaseProcessEngineGet
(
params
)
// 查询采购流程规则引擎详情
case
RULE_TYPE
.
CONTRACT_MANAGE
:
return
await
getContractRuleEngineProcess
(
params
)
// 查询合同管理规则引擎详情
case
RULE_TYPE
.
CONTRACT_COORDINATION
:
return
await
getContractRuleEngineCoordinationProcess
(
params
)
// 查询合同协同规则引擎详情
case
RULE_TYPE
.
REQUEST_FUNDS_MANAGE
:
return
await
getSettleAccountsApplyAmountProcessGet
(
params
)
// 查询请款单管理规则引擎详情
default
:
return
{
code
:
1102
,
data
:
null
}
}
}
const
RuleEngConfig
:
React
.
FC
=
()
=>
{
const
location
:
any
=
useLocation
();
const
{
type
,
processId
}
=
location
?.
query
const
[
flowOptions
,
setFlowOptions
]
=
useState
<
any
[]
>
()
const
[
spinning
,
setSpinning
]
=
useState
<
boolean
>
(
false
)
const
flowRef
=
useRef
<
RefHandleType
>
()
const
drawRef
=
useRef
<
HandleType
>
()
const
options
:
FlowChartOptionsType
[]
=
[
{
label
:
'提交审核'
,
value
:
1
},
{
label
:
'审核 (一级)'
,
value
:
2
},
{
label
:
'审核 (二级)'
,
value
:
3
},
]
const
getProcessEngineDetail
=
async
()
=>
{
if
(
type
&&
processId
)
{
setSpinning
(
true
)
const
{
code
,
data
}
=
await
getFetchDetailApi
(
type
,
{
processId
})
if
(
code
===
1000
)
{
const
newOptions
=
data
.
responses
.
map
(
item
=>
({
processStepName
:
item
.
taskName
,
processStep
:
item
.
taskStep
,
processId
:
data
.
processKey
,
processName
:
data
.
processName
}))
setFlowOptions
(
newOptions
)
setSpinning
(
false
)
}
}
}
const
handleDrawer
=
useCallback
(()
=>
{
flowRef
?.
current
?.
setActive
(
''
)
drawRef
?.
current
?.
show
(
false
)
},
[])
const
onFlowChartChange
=
useCallback
((
value
:
string
|
number
)
=>
{
drawRef
?.
current
?.
show
(
true
,
{
id
:
value
})
const
onFlowChartChange
=
useCallback
(
async
(
processStep
:
string
,
optionItem
:
any
)
=>
{
setSpinning
(
true
)
const
{
code
,
data
}
=
await
getRuleEngineConfigGetRuleEngineInfo
({
processId
:
optionItem
.
processId
,
processStep
})
setSpinning
(
false
)
if
(
code
===
1000
)
{
const
params
=
{
process
:
{
...
optionItem
,
type
:
RULE_ENR_TYPE
[
type
]
},
formData
:
data
}
drawRef
?.
current
?.
show
(
true
,
params
)
}
},
[])
useEffect
(()
=>
{
getProcessEngineDetail
()
},
[])
return
(
...
...
@@ -38,15 +91,18 @@ const RuleEngConfig: React.FC = () => {
onBack=
{
()
=>
history
.
goBack
()
}
anchors=
{
[]
}
>
<
FlowChart
ref=
{
flowRef
}
options=
{
options
}
onChange=
{
onFlowChartChange
}
/>
<
ConfigDrawer
ref=
{
drawRef
}
onChange=
{
handleDrawer
}
/>
<
Spin
spinning=
{
spinning
}
>
<
FlowChart
ref=
{
flowRef
}
options=
{
flowOptions
}
onChange=
{
onFlowChartChange
}
fieldNames=
{
{
label
:
'processStepName'
,
value
:
'processStep'
}
}
/>
<
ConfigDrawer
ref=
{
drawRef
}
onChange=
{
handleDrawer
}
/>
</
Spin
>
</
AnchorPage
>
)
}
...
...
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