Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
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-admin
Commits
a838cbd1
Commit
a838cbd1
authored
May 06, 2022
by
许佳敏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '220518-feat' into 'v2-220518'
feat: 完善请购单流程规则 See merge request linkseeks-design/pro-admin!53
parents
bf85dc0e
2716b393
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
171 additions
and
67 deletions
+171
-67
index.ts
...es/systemManage/buyingRequisitionProcess/columns/index.ts
+2
-2
index.tsx
...ingRequisitionProcess/components/AddEditContent/index.tsx
+58
-5
index.tsx
...buyingRequisitionProcess/components/ApplyMember/index.tsx
+61
-25
index.tsx
...yingRequisitionProcess/components/ProcessSelect/index.tsx
+8
-14
index.tsx
src/pages/systemManage/buyingRequisitionProcess/index.tsx
+42
-21
No files found.
src/pages/systemManage/buyingRequisitionProcess/columns/index.ts
View file @
a838cbd1
...
...
@@ -3,8 +3,8 @@ import { ColumnType } from 'antd/lib/table/interface';
/** 流程规则ID */
export
const
id
:
ColumnType
<
any
>
=
{
title
:
'ID'
,
key
:
'
i
d'
,
dataIndex
:
'
i
d'
,
key
:
'
processI
d'
,
dataIndex
:
'
processI
d'
,
}
/** 流程规则名称 */
...
...
src/pages/systemManage/buyingRequisitionProcess/components/AddEditContent/index.tsx
View file @
a838cbd1
import
React
,
{
useState
,
useRef
}
from
'react'
;
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
;
import
PeripheralLayout
from
'@/components/DetailLayout'
;
import
FormProgress
,
{
HandleType
}
from
'@/components/FormProgress'
import
{
Button
,
Form
}
from
'antd'
;
...
...
@@ -8,6 +8,8 @@ import ProcessSelectLayout from '../ProcessSelect';
import
ApplyMemberLayout
from
'../ApplyMember'
;
import
usePrompt
from
'@/hooks/usePrompt'
;
import
{
VISIT_TYPE
}
from
'@/constants'
;
import
{
history
}
from
'umi'
;
import
{
getPurchaseRequisitionWebProcessBaseList
,
getPurchaseRequisitionWebProcessGet
,
postPurchaseRequisitionWebProcessSave
,
postPurchaseRequisitionWebProcessUpdate
}
from
'@/services/PurchaseV2Api'
type
PropsType
=
{
type
:
'add'
|
'edit'
|
'view'
...
...
@@ -22,18 +24,69 @@ export const layout: any = {
labelAlign
:
"left"
};
const
AddInvoiceProcessEng
:
React
.
FC
<
PropsType
>
=
({
id
,
title
,
type
})
=>
{
const
AddInvoiceProcessEng
:
React
.
FC
<
PropsType
>
=
({
id
:
processId
,
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
)
=>
{
form
.
validateFields
().
then
(
values
=>
{
setLoading
(
true
)
const
params
=
{
processId
,
...
values
,
allMembers
:
values
.
allMembers
===
1
?
true
:
false
,
members
:
values
.
allMembers
===
2
?
values
.
members
?.
map
(
_item
=>
{
return
{
memberId
:
_item
.
memberId
,
roleId
:
_item
.
roleId
,
}
})
:
undefined
}
const
fetchApi
=
processId
?
postPurchaseRequisitionWebProcessUpdate
:
postPurchaseRequisitionWebProcessSave
fetchApi
({
...
params
}).
then
(
res
=>
{
if
(
res
.
code
!==
1000
)
{
setLoading
(
false
)
return
}
handleLeave
(
false
)
history
.
goBack
()
})
})
}
const
getProcessBaseList
=
async
()
=>
{
const
{
code
,
data
}
=
await
getPurchaseRequisitionWebProcessBaseList
();
if
(
code
===
1000
)
{
setProcessBaseList
(
data
)
}
}
const
getDetail
=
async
()
=>
{
if
(
processId
)
{
const
{
code
,
data
}
=
await
getPurchaseRequisitionWebProcessGet
({
processId
});
if
(
code
===
1000
)
{
form
.
setFieldsValue
({
name
:
data
.
name
,
baseProcessId
:
data
.
baseProcessId
,
allMembers
:
data
.
allMembers
?
1
:
2
,
})
}
}
}
useEffect
(()
=>
{
const
getData
=
async
()
=>
{
await
getProcessBaseList
()
getDetail
()
}
getData
()
},
[])
return
(
<>
<
PeripheralLayout
...
...
@@ -64,8 +117,8 @@ const AddInvoiceProcessEng: React.FC<PropsType> = ({ id, title, type }) => {
onFieldsChange=
{
()
=>
{
progressRef
?.
current
?.
render
(
form
)
}
}
>
<
ProcessEngLayout
type=
{
type
}
/>
<
ProcessSelectLayout
type=
{
type
}
/>
<
ApplyMemberLayout
type=
{
type
}
/>
<
ProcessSelectLayout
type=
{
type
}
optionsData=
{
processBaseList
}
/>
<
ApplyMemberLayout
form=
{
form
}
type=
{
type
}
processId=
{
processId
}
/>
</
Form
>
}
/>
...
...
src/pages/systemManage/buyingRequisitionProcess/components/ApplyMember/index.tsx
View file @
a838cbd1
import
React
,
{
useCallback
,
useState
}
from
'react'
;
import
{
Button
,
Form
,
Radio
,
Space
,
Table
}
from
'antd'
;
import
React
,
{
useCallback
,
use
Effect
,
use
State
}
from
'react'
;
import
{
Button
,
Form
,
Popconfirm
,
Radio
,
Space
,
Table
}
from
'antd'
;
import
{
FormInstance
}
from
'antd/es/form/Form'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
...
...
@@ -9,18 +9,20 @@ import { operation } from '../../columns';
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
;
import
TableModal
from
'@/components/TableModal'
;
import
{
getMemberManageAllProviderPage
}
from
'@/services/MemberV2Api'
;
import
{
getPurchaseRequisitionWebProcessMemberPage
}
from
'@/services/PurchaseV2Api'
;
import
{
getMemberManageAllConsumerPage
}
from
'@/services/MemberV2Api'
;
import
{
VISIT_TYPE
}
from
'@/constants'
;
interface
InvoiceTypeProps
{
form
?:
FormInstance
type
:
'add'
|
'edit'
|
'view'
processId
?:
string
}
const
InvoiceTypeLayout
:
React
.
FC
<
InvoiceTypeProps
>
=
(
props
:
any
)
=>
{
const
{
form
,
type
}
=
props
;
const
{
form
,
type
,
processId
}
=
props
;
const
[
visible
,
setVisible
]
=
useState
<
boolean
>
(
false
);
const
[
member
,
setMember
]
=
useState
<
any
>
(
{}
)
const
[
member
,
setMember
]
=
useState
<
any
>
(
[]
)
const
mock
=
[
{
value
:
1
,
label
:
'所有会员(默认)'
},
{
value
:
2
,
label
:
'指定会员'
},
...
...
@@ -29,8 +31,8 @@ const InvoiceTypeLayout: React.FC<InvoiceTypeProps> = (props: any) => {
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'
i
d'
,
key
:
'
i
d'
,
dataIndex
:
'
memberI
d'
,
key
:
'
memberI
d'
,
},
{
title
:
'会员名称'
,
...
...
@@ -56,7 +58,7 @@ const InvoiceTypeLayout: React.FC<InvoiceTypeProps> = (props: any) => {
const
handleFetchData
=
useCallback
((
params
:
any
)
=>
{
return
new
Promise
(
resolve
=>
{
getMemberManageAll
Provid
erPage
({
...
params
}).
then
(
res
=>
{
getMemberManageAll
Consum
erPage
({
...
params
}).
then
(
res
=>
{
if
(
res
.
code
!==
1000
)
{
return
}
...
...
@@ -67,15 +69,52 @@ const InvoiceTypeLayout: React.FC<InvoiceTypeProps> = (props: any) => {
})
},
[])
const
toggle
=
(
flag
:
boolean
)
=>
{
setVisible
(
flag
)
const
confirm
=
(
records
)
=>
{
const
newMember
=
member
.
filter
(
_item
=>
_item
.
id
!==
records
.
id
);
console
.
log
(
newMember
)
setMember
(
newMember
)
form
.
setFieldsValue
({
'members'
:
newMember
})
}
const
handleConfirm
=
(
selectRow
:
number
[]
|
string
[],
selectedRows
:
{
[
key
:
string
]:
any
}[])
=>
{
console
.
log
(
selectRow
,
'selectRow'
);
console
.
log
(
selectedRows
,
'selectedRows'
);
console
.
log
(
'selectedRows'
,
selectedRows
)
setMember
(
selectedRows
)
form
.
setFieldsValue
({
'members'
:
selectedRows
})
setVisible
(
false
)
}
const
columnFunc
=
useCallback
(()
=>
{
const
params
=
[...
columns
];
!
(
type
===
VISIT_TYPE
.
VIEW
)
&&
params
.
push
({
...
operation
,
render
:
(
_text
,
record
)
=>
<>
{
(
<
Popconfirm
title=
"确认要删除吗?"
onConfirm=
{
()
=>
confirm
(
record
)
}
okText=
"是"
cancelText=
"否"
>
<
Button
type=
"link"
>
删除
</
Button
>
</
Popconfirm
>
)
}
</>
})
return
params
},
[
member
])
useEffect
(()
=>
{
if
(
processId
)
{
getPurchaseRequisitionWebProcessMemberPage
({
processId
}
as
any
).
then
(({
code
,
data
})
=>
{
if
(
code
===
1000
)
{
setMember
(
data
);
form
.
setFieldsValue
({
'members'
:
data
})
}
})
}
},
[
processId
])
return
(
<
CardLayout
id=
"applyMember"
...
...
@@ -85,7 +124,7 @@ const InvoiceTypeLayout: React.FC<InvoiceTypeProps> = (props: any) => {
classNames=
{
styles
[
'invoice-type'
]
}
>
<
Form
.
Item
name=
'
invoiceType
'
name=
'
allMembers
'
initialValue=
{
1
}
rules=
{
[
{
required
:
true
,
message
:
'请选择适用会员'
},
...
...
@@ -99,20 +138,17 @@ const InvoiceTypeLayout: React.FC<InvoiceTypeProps> = (props: any) => {
</
Form
.
Item
>
<
Form
.
Item
noStyle
shouldUpdate=
{
(
prevValues
,
currentValues
)
=>
(
prevValues
.
invoiceType
!==
currentValues
.
invoiceType
)
}
shouldUpdate=
{
(
prevValues
,
currentValues
)
=>
(
prevValues
.
allMembers
!==
currentValues
.
allMembers
)
}
>
{
({
getFieldValue
})
=>
getFieldValue
(
'
invoiceType
'
)
===
2
?
(
getFieldValue
(
'
allMembers
'
)
===
2
?
(
<
Space
direction=
'vertical'
>
<
Button
block
type=
'dashed'
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
togg
le
(
true
)
}
>
选择
</
Button
>
<
Form
.
Item
name=
"member
Id
"
rules=
{
[{
required
:
true
,
message
:
'请选择适用会员'
}]
}
>
<
Button
block
type=
'dashed'
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
setVisib
le
(
true
)
}
>
选择
</
Button
>
<
Form
.
Item
name=
"member
s
"
rules=
{
[{
required
:
true
,
message
:
'请选择适用会员'
}]
}
>
<
Table
columns=
{
[
...
columns
,
{
...
operation
}
]
}
rowKey=
'id'
columns=
{
columnFunc
()
}
dataSource=
{
member
}
/>
</
Form
.
Item
>
</
Space
>
...
...
@@ -129,7 +165,7 @@ const InvoiceTypeLayout: React.FC<InvoiceTypeProps> = (props: any) => {
}
}
customKey=
'id'
fetchData=
{
handleFetchData
}
onClose=
{
()
=>
togg
le
(
false
)
}
onClose=
{
()
=>
setVisib
le
(
false
)
}
onOk=
{
handleConfirm
}
columns=
{
columns
}
effects=
{
(
$
,
actions
)
=>
{
...
...
@@ -170,7 +206,7 @@ const InvoiceTypeLayout: React.FC<InvoiceTypeProps> = (props: any) => {
}
}
}
}
value=
{
[
member
]
}
value=
{
member
}
/>
</
CardLayout
>
)
...
...
src/pages/systemManage/buyingRequisitionProcess/components/ProcessSelect/index.tsx
View file @
a838cbd1
...
...
@@ -9,18 +9,12 @@ interface ProcessSelectProps {
/** FormInstance */
form
?:
FormInstance
type
:
'add'
|
'edit'
|
'view'
optionsData
:
any
[]
}
const
ProcessSelectLayout
:
React
.
FC
<
ProcessSelectProps
>
=
(
props
:
any
)
=>
{
const
{
form
,
type
}
=
props
;
const
mock
=
[
{
id
:
1
,
name
:
'请购单流程--0级'
,
value
:
'-'
,
tag
:
'请购单流程'
},
{
id
:
2
,
name
:
'请购单流程--1级'
,
value
:
'1-待提交请购单'
,
tag
:
'请购单流程'
},
{
id
:
3
,
name
:
'请购单流程--2级'
,
value
:
'1-待审核请购单(一级) —>2-待提交请购单'
,
tag
:
'请购单流程'
},
{
id
:
4
,
name
:
'请购单流程--3级'
,
value
:
'1-待审核请购单(一级) —>2-审核请购单(二级)—>3-待提交请购单'
,
tag
:
'请购单流程'
},
]
const
{
form
,
type
,
optionsData
}
=
props
;
return
(
<
CardLayout
...
...
@@ -31,20 +25,20 @@ const ProcessSelectLayout: React.FC<ProcessSelectProps> = (props: any) => {
classNames=
{
styles
[
'select-box'
]
}
>
<
Form
.
Item
name=
'
processSelect
'
name=
'
baseProcessId
'
rules=
{
[
{
required
:
true
,
message
:
'请选择流程'
},
]
}
>
<
Radio
.
Group
disabled=
{
type
===
VISIT_TYPE
.
VIEW
}
>
{
mock
.
map
(
_item
=>
(
<
Radio
key=
{
_item
.
id
}
value=
{
_item
.
i
d
}
>
{
optionsData
.
map
(
_item
=>
(
<
Radio
key=
{
_item
.
baseProcessId
}
value=
{
_item
.
baseProcessI
d
}
>
<
div
className=
{
styles
[
'box'
]
}
>
<
div
className=
{
styles
[
'box-clerk'
]
}
>
<
div
className=
{
styles
[
'box-clerk-name'
]
}
>
{
_item
.
n
ame
}
</
div
>
<
div
className=
{
styles
[
'box-clerk-value'
]
}
>
{
_item
.
value
}
</
div
>
<
div
className=
{
styles
[
'box-clerk-name'
]
}
>
{
_item
.
processN
ame
}
</
div
>
<
div
className=
{
styles
[
'box-clerk-value'
]
}
>
{
_item
.
description
}
</
div
>
</
div
>
<
div
className=
{
styles
[
'box-tag'
]
}
>
{
_item
.
tag
}
</
div
>
<
div
className=
{
styles
[
'box-tag'
]
}
>
{
_item
.
processTypeName
}
</
div
>
</
div
>
</
Radio
>
))
}
...
...
src/pages/systemManage/buyingRequisitionProcess/index.tsx
View file @
a838cbd1
import
React
from
'react'
;
import
React
,
{
useRef
}
from
'react'
;
import
{
history
,
Link
}
from
'umi'
;
import
{
Button
,
Space
,
Switch
}
from
'antd'
;
import
{
Button
,
Popconfirm
,
Space
,
Switch
}
from
'antd'
;
import
moment
from
'moment'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
TableLayout
from
'@/components/TableLayout'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
createTime
,
id
,
name
,
operation
,
processName
,
status
}
from
'./columns'
;
import
{
getPurchaseRequisitionWebProcessPage
,
postPurchaseRequisitionWebProcessStatusUpdate
,
getPurchaseRequisitionWebProcessDelete
}
from
'@/services/PurchaseV2Api'
const
InvoiceProcessEng
:
React
.
FC
<
{}
>
=
()
=>
{
const
ref
=
useRef
<
any
>
()
const
format
=
(
text
,
fmt
?:
string
)
=>
{
return
<>
{
moment
(
text
).
format
(
fmt
||
"YYYY-MM-DD HH:mm:ss"
)
}
</>
}
const
mock
=
[
{
id
:
1
,
name
:
'物料对账单请购流程'
,
processName
:
'请购单流程-2级'
,
createTime
:
1650614111890
,
status
:
1
,
const
handleStatus
=
async
({
processId
},
status
:
number
)
=>
{
const
res
=
await
postPurchaseRequisitionWebProcessStatusUpdate
(
{
processId
,
status
})
if
(
res
.
code
===
1000
)
{
ref
.
current
.
reload
()
}
]
}
const
fetchDeleteBatch
=
(
processId
)
=>
{
getPurchaseRequisitionWebProcessDelete
({
processId
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
ref
.
current
.
reload
()
}
})
}
const
columns
:
ColumnType
<
any
>
[]
=
[
{
...
...
@@ -29,10 +39,7 @@ const InvoiceProcessEng: React.FC<{}> = () => {
},
{
...
name
,
render
:
(
_text
)
=>
<
Link
to=
'#'
>
{
_text
}
</
Link
>
},
{
...
processName
,
render
:
(
_text
,
record
)
=>
<
Link
to=
{
`/system/ruleSettingManager/buyingRequisitionProcess/view?id=${record.processId}`
}
>
{
_text
}
</
Link
>
},
{
...
createTime
,
...
...
@@ -40,22 +47,36 @@ const InvoiceProcessEng: React.FC<{}> = () => {
},
{
...
status
,
render
:
(
_text
)
=>
<
Switch
checked=
{
!!
_text
}
/>
render
:
(
_text
,
record
)
=>
<
Switch
checked=
{
!!
_text
}
onChange=
{
()
=>
handleStatus
(
record
,
!!
_text
?
0
:
1
)
}
/>
},
{
...
operation
,
render
:
(
_text
)
=>
<
Space
size=
{
16
}
>
<
a
>
查看
</
a
>
<
a
>
编辑
</
a
>
<
a
>
删除
</
a
>
</
Space
>
render
:
(
_text
,
record
)
=>
(
<
Space
size=
{
16
}
>
<
a
onClick=
{
()
=>
{
history
.
push
(
`/system/ruleSettingManager/buyingRequisitionProcess/view?id=${record.processId}`
)
}
}
>
查看
</
a
>
{
!
record
.
status
&&
(
<>
<
a
onClick=
{
()
=>
{
history
.
push
(
`/system/ruleSettingManager/buyingRequisitionProcess/edit?id=${record.processId}`
)
}
}
>
编辑
</
a
>
<
Popconfirm
title=
'确定删除么?'
okText=
'是'
cancelText=
'否'
onConfirm=
{
()
=>
fetchDeleteBatch
(
record
.
processId
)
}
>
<
a
>
删除
</
a
>
</
Popconfirm
>
</>
)
}
</
Space
>
)
},
]
return
(
<
TableLayout
reload=
{
ref
}
columns=
{
columns
}
fetch=
{
mock
}
fetch=
{
getPurchaseRequisitionWebProcessPage
}
schema=
{
{
type
:
"object"
,
properties
:
{
...
...
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