|
@@ -1,60 +1,84 @@
|
|
|
-import ApprovalFlow from '@/components/Flow'
|
|
|
-import React, { useState } from 'react'
|
|
|
-
|
|
|
-import ReactFlow, {
|
|
|
- removeElements,
|
|
|
- addEdge,
|
|
|
- MiniMap,
|
|
|
- Controls,
|
|
|
- Background
|
|
|
-} from 'react-flow-renderer'
|
|
|
-
|
|
|
-// import ButtonEdge from './components/Flow/components/Edge'
|
|
|
-
|
|
|
-const onLoad = reactFlowInstance => reactFlowInstance.fitView()
|
|
|
-
|
|
|
-const initialElements = [
|
|
|
- {
|
|
|
- id: 'ewb-1',
|
|
|
- type: 'input',
|
|
|
- data: { label: 'Input 1' },
|
|
|
- position: { x: 250, y: 0 }
|
|
|
- },
|
|
|
- { id: 'ewb-2', data: { label: 'Node 2' }, position: { x: 250, y: 300 } },
|
|
|
-
|
|
|
- {
|
|
|
- id: 'edge-1-2',
|
|
|
- source: 'ewb-1',
|
|
|
- target: 'ewb-2',
|
|
|
- type: 'buttonedge'
|
|
|
- }
|
|
|
-]
|
|
|
-
|
|
|
-// const edgeTypes = {
|
|
|
-// buttonedge: ButtonEdge
|
|
|
-// }
|
|
|
-
|
|
|
-const EdgeWithButtonFlow = () => {
|
|
|
- const [elements, setElements] = useState(initialElements)
|
|
|
- const onElementsRemove = elementsToRemove =>
|
|
|
- setElements(els => removeElements(elementsToRemove, els))
|
|
|
- const onConnect = params => setElements(els => addEdge({ ...params, type: 'buttonedge' }, els))
|
|
|
-
|
|
|
+import AnimateContent from '@/components/AnimateContent'
|
|
|
+import { getApprovalList } from '@/services/api/project'
|
|
|
+import consts from '@/utils/consts'
|
|
|
+import { PageContainer } from '@ant-design/pro-layout'
|
|
|
+import ProTable from '@ant-design/pro-table'
|
|
|
+import { Button } from 'antd'
|
|
|
+import { useState } from 'react'
|
|
|
+import ApprovalDetail from './Detail'
|
|
|
+const FlowList = () => {
|
|
|
+ const [state, setState] = useState({
|
|
|
+ params: {},
|
|
|
+ visible: false,
|
|
|
+ current: {
|
|
|
+ id: null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const columns = [
|
|
|
+ {
|
|
|
+ dataIndex: 'name',
|
|
|
+ title: '名称'
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // dataIndex: ''
|
|
|
+ // }
|
|
|
+ {
|
|
|
+ dataIndex: 'opreate',
|
|
|
+ title: '操作',
|
|
|
+ render: (_, record) => (
|
|
|
+ <div className="divide-x divide-bg-gray-400 ">
|
|
|
+ <span
|
|
|
+ className="pr-2 text-primary cursor-pointer hover:text-hex-967bbd"
|
|
|
+ onClick={() => {
|
|
|
+ setState({ ...state, visible: true, current: { ...state.current, id: record.ID } })
|
|
|
+ }}>
|
|
|
+ 编辑
|
|
|
+ </span>
|
|
|
+ <span className="px-2 text-primary cursor-pointer hover:text-hex-967bbd">设置审批人</span>
|
|
|
+ <span className="text-hex-F5222D pl-2 cursor-pointer hover:text-hex-967bbd">删除</span>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ ]
|
|
|
return (
|
|
|
- // <ReactFlow
|
|
|
- // elements={elements}
|
|
|
- // onElementsRemove={onElementsRemove}
|
|
|
- // onConnect={onConnect}
|
|
|
- // snapToGrid={true}
|
|
|
- // edgeTypes={edgeTypes}
|
|
|
- // onLoad={onLoad}
|
|
|
- // key="edge-with-button">
|
|
|
- // <MiniMap />
|
|
|
- // <Controls />
|
|
|
- // <Background />
|
|
|
- // </ReactFlow>
|
|
|
- <ApprovalFlow />
|
|
|
+ <PageContainer title={false}>
|
|
|
+ <ProTable
|
|
|
+ columns={columns}
|
|
|
+ rowKey="ID"
|
|
|
+ params={state.params}
|
|
|
+ request={async (params, filters, sorter) => {
|
|
|
+ const {
|
|
|
+ code = -1,
|
|
|
+ data: { items, total }
|
|
|
+ } = await getApprovalList({ ...params, ...filters, ...sorter })
|
|
|
+ return {
|
|
|
+ success: code === consts.RET_CODE.SUCCESS,
|
|
|
+ data: items,
|
|
|
+ total
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ search={false}
|
|
|
+ toolbar={{
|
|
|
+ search: {
|
|
|
+ onSearch: value => setState({ ...state, params: { ...state.params, search: value } })
|
|
|
+ },
|
|
|
+ actions: [
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ onClick={() => setState({ ...state, visible: true })}
|
|
|
+ key="add_flow_btn">
|
|
|
+ 新建流程
|
|
|
+ </Button>
|
|
|
+ ]
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ <AnimateContent
|
|
|
+ visible={state.visible}
|
|
|
+ onVisibleChange={visible => setState({ ...state, visible })}>
|
|
|
+ <ApprovalDetail {...state.current}></ApprovalDetail>
|
|
|
+ </AnimateContent>
|
|
|
+ </PageContainer>
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-export default EdgeWithButtonFlow
|
|
|
+export default FlowList
|