|
@@ -3,10 +3,11 @@ import { EmitterType } from '@/enums/emit'
|
|
|
import { queryApprovalDetail } from '@/services/api/project'
|
|
|
import consts from '@/utils/consts'
|
|
|
import useEventEmitter from '@/utils/emit'
|
|
|
+import { ArrowLeftOutlined } from '@ant-design/icons'
|
|
|
import { PageContainer } from '@ant-design/pro-layout'
|
|
|
import ProTable, { ProColumns } from '@ant-design/pro-table'
|
|
|
import { connect } from '@umijs/max'
|
|
|
-import { Button } from 'antd'
|
|
|
+import { Button, Modal } from 'antd'
|
|
|
import { Dispatch, useEffect, useState } from 'react'
|
|
|
import { BusinessModelState } from '../model'
|
|
|
import LeftMenu from '../RuleCode/components/LeftMenu'
|
|
@@ -39,6 +40,8 @@ type iState = {
|
|
|
}
|
|
|
subjectName?: string
|
|
|
}
|
|
|
+let stepChanged = false
|
|
|
+
|
|
|
const Step: React.FC<StepProps> = ({ executorMap, matterMap, conditionSchema, dispatch }) => {
|
|
|
const [drawer, DrawerDOM] = useDrawer()
|
|
|
const [state, setState] = useState<iState>({
|
|
@@ -52,7 +55,8 @@ const Step: React.FC<StepProps> = ({ executorMap, matterMap, conditionSchema, di
|
|
|
data: { process = [], processList = [] }
|
|
|
} = await queryApprovalDetail(params)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
- setState({ ...state, process: { detail: process, list: processList, changed: false } })
|
|
|
+ setState({ ...state, process: { detail: process, list: processList } })
|
|
|
+ stepChanged = false
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -62,6 +66,10 @@ const Step: React.FC<StepProps> = ({ executorMap, matterMap, conditionSchema, di
|
|
|
|
|
|
initData({ gatherID, businessType })
|
|
|
})
|
|
|
+ event$.useSubscription(EmitterType.STEP_DETAIL_CHANGE, () => {
|
|
|
+ stepChanged = true
|
|
|
+ })
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
if (state.activeKey) {
|
|
|
const [gatherID, businessType] = state.activeKey.split('_')
|
|
@@ -110,10 +118,38 @@ const Step: React.FC<StepProps> = ({ executorMap, matterMap, conditionSchema, di
|
|
|
}
|
|
|
]
|
|
|
|
|
|
+ const customBackHandler = () => {
|
|
|
+ console.log(stepChanged)
|
|
|
+
|
|
|
+ if (stepChanged) {
|
|
|
+ return Modal.confirm({
|
|
|
+ okText: '确定',
|
|
|
+ title: '温馨提示',
|
|
|
+ cancelText: '取消',
|
|
|
+ content: '当前数据未保存,是否跳转?',
|
|
|
+ onOk() {
|
|
|
+ stepChanged = false
|
|
|
+ drawer.close()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ drawer.close()
|
|
|
+ }
|
|
|
const handleBtnClick = () => {
|
|
|
+ const title = (
|
|
|
+ <div className="ant-page-header-heading-left">
|
|
|
+ <div className="ant-page-header-back" onClick={customBackHandler}>
|
|
|
+ <div className="ant-page-header-back-button">
|
|
|
+ <ArrowLeftOutlined />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <span>{state.subjectName}</span>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
drawer.open({
|
|
|
- title: state.subjectName,
|
|
|
+ title,
|
|
|
destroyOnClose: true,
|
|
|
+ closeIcon: null,
|
|
|
children: (
|
|
|
<ApprovalFlow
|
|
|
executorList={executorMap[state.activeKey]}
|