|
@@ -2,15 +2,21 @@ import AnimateContent from '@/components/AnimateContent'
|
|
|
import consts from '@/utils/consts'
|
|
|
import { PageContainer } from '@ant-design/pro-layout'
|
|
|
import ProTable from '@ant-design/pro-table'
|
|
|
-import { Button, message } from 'antd'
|
|
|
+import { message } from 'antd'
|
|
|
import { useRef, useState } from 'react'
|
|
|
import { useRequest } from 'umi'
|
|
|
-import { getApprovalList, saveApproval } from '@/services/api/project'
|
|
|
+import { getApprovalList, publishApproval, saveApproval } from '@/services/api/project'
|
|
|
import type { ActionType } from '@ant-design/pro-table'
|
|
|
|
|
|
import ApprovalDetail from './Detail'
|
|
|
import { ModalForm, ProFormText } from '@ant-design/pro-form'
|
|
|
import type { ProFormInstance } from '@ant-design/pro-form'
|
|
|
+
|
|
|
+export enum PublishType {
|
|
|
+ FAIL = '0',
|
|
|
+ SUCCESS = '1'
|
|
|
+}
|
|
|
+
|
|
|
const FlowList = () => {
|
|
|
const tRef = useRef<ActionType>(null)
|
|
|
const formRef = useRef<ProFormInstance>(null)
|
|
@@ -38,6 +44,14 @@ const FlowList = () => {
|
|
|
// tRef.current?.reload()
|
|
|
// }
|
|
|
// })
|
|
|
+
|
|
|
+ const { run: tryPublish } = useRequest(publishApproval, {
|
|
|
+ manual: true,
|
|
|
+ onSuccess() {
|
|
|
+ message.success('')
|
|
|
+ tRef.current?.reload()
|
|
|
+ }
|
|
|
+ })
|
|
|
const { run: tryUpdate } = useRequest(saveApproval, {
|
|
|
manual: true,
|
|
|
onSuccess: () => {
|
|
@@ -69,6 +83,20 @@ const FlowList = () => {
|
|
|
)
|
|
|
},
|
|
|
{
|
|
|
+ dataIndex: 'publish',
|
|
|
+ title: '流程状态',
|
|
|
+ valueEnum: {
|
|
|
+ [PublishType.SUCCESS]: {
|
|
|
+ text: '已发布',
|
|
|
+ status: 'Success'
|
|
|
+ },
|
|
|
+ [PublishType.FAIL]: {
|
|
|
+ text: '未发布',
|
|
|
+ statis: 'Default'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
dataIndex: 'opreate',
|
|
|
title: '操作',
|
|
|
onHeaderCell: () => ({ style: { textAlign: 'center' } }),
|
|
@@ -87,7 +115,7 @@ const FlowList = () => {
|
|
|
编辑流程名称
|
|
|
</span>
|
|
|
<span
|
|
|
- className="pl-2 text-primary hover:cursor-pointer hover:text-blue-600"
|
|
|
+ className="px-2 text-primary hover:cursor-pointer hover:text-blue-600"
|
|
|
onClick={() =>
|
|
|
setState({
|
|
|
...state,
|
|
@@ -97,6 +125,14 @@ const FlowList = () => {
|
|
|
}>
|
|
|
查看流程图
|
|
|
</span>
|
|
|
+ <span
|
|
|
+ className={[
|
|
|
+ 'pl-2',
|
|
|
+ record.publish ? 'text-gray-500' : 'text-primary cursor-pointer'
|
|
|
+ ].join(' ')}
|
|
|
+ onClick={() => !record.publish && tryPublish({ ID: record.approval.ID })}>
|
|
|
+ 发布
|
|
|
+ </span>
|
|
|
{/* <Popconfirm
|
|
|
title={`确认删除${record.name}吗?`}
|
|
|
okText="确认"
|