diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index 0094da3..be8a665 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -61,7 +61,7 @@ // "--clickHouseIot iot", // 测试 "--clickHouseAnxincloud Anxinyun101", - "--clickHousePepEmis pepca9", + "--clickHousePepEmis pepca10", "--clickHouseProjectManage peppm8", "--clickHouseVcmp video_access_dev", "--clickHouseDataAlarm default", diff --git a/web/client/src/components/workflow/approval.jsx b/web/client/src/components/workflow/approval.jsx index 2cbd56c..191ce1d 100644 --- a/web/client/src/components/workflow/approval.jsx +++ b/web/client/src/components/workflow/approval.jsx @@ -10,11 +10,46 @@ import { IconClose } from '@douyinfe/semi-icons'; import './index.less' const WorkFlowApprovalModal = (props) => { - const { visible, onCancel, webEmis, user, postData } = props; + const { visible, onCancel, webEmis, user, processAuditList, checkProcessInstanceId, successCallBack } = props; const [loading, setLoading] = useState(true); - + const [processData, setProcessData] = useState({}); const iframeRef = React.createRef(); + useEffect(() => { + window.receiveMessageFromIndex = function (event) { + if (event && event.data && typeof (event.data) == 'string') { + let data = JSON.parse(event.data); + const { type, msg } = data; + if (msg) { + console.log(msg); + Notification.success({ title: msg }) + } + if (type == 'submitSuccess' && successCallBack) { + successCallBack(); + setLoading(false); + } + } + } + //监听message事件 + window.addEventListener('message', receiveMessageFromIndex, false); + return () => { + window.removeEventListener('message', receiveMessageFromIndex, false); + } + }, []) + + useEffect(() => { + console.log('iframeRef.current', iframeRef.current); + if (checkProcessInstanceId && processAuditList.length && iframeRef.current) { + const corProcessData = processAuditList.find(p => p.processInstanceId == checkProcessInstanceId) + if (corProcessData) { + iframeRef.current.contentWindow.postMessage(JSON.stringify({ + ...corProcessData + }), '*'); + } + } + }, [checkProcessInstanceId, iframeRef]) + + console.log(iframeRef); return (
{ id='workflowFrame' onLoad={() => { let frameWin = document.getElementById('workflowFrame'); - frameWin.contentWindow.postMessage(JSON.stringify({ - - }), '*'); + // frameWin.contentWindow.postMessage(JSON.stringify({ + + // }), '*'); setLoading(false); }} allowTransparency="true" diff --git a/web/client/src/components/workflow/index.jsx b/web/client/src/components/workflow/index.jsx index e23849f..3809e4f 100644 --- a/web/client/src/components/workflow/index.jsx +++ b/web/client/src/components/workflow/index.jsx @@ -105,6 +105,9 @@ const WorkFlowModal = (props) => { } //监听message事件 window.addEventListener('message', receiveMessageFromIndex, false); + return () => { + window.removeEventListener('message', receiveMessageFromIndex, false); + } }, []) console.log(webEmis, processId); diff --git a/web/client/src/sections/workOrder/containers/jobOrder.jsx b/web/client/src/sections/workOrder/containers/jobOrder.jsx index 6fea47d..32fd548 100644 --- a/web/client/src/sections/workOrder/containers/jobOrder.jsx +++ b/web/client/src/sections/workOrder/containers/jobOrder.jsx @@ -78,21 +78,21 @@ const JobOrder = (props) => { }) }
- {/* { setWorkflowModalVisible(false) }} successCallBack={() => { setWorkflowModalVisible(false) }} - /> */} + /> {/* */} - { { setWorkflowModalVisible(false) }} - />} + />} */} ) } diff --git a/web/client/src/sections/workOrder/containers/stayDoWorkOrder.jsx b/web/client/src/sections/workOrder/containers/stayDoWorkOrder.jsx index ea72334..f0955c6 100644 --- a/web/client/src/sections/workOrder/containers/stayDoWorkOrder.jsx +++ b/web/client/src/sections/workOrder/containers/stayDoWorkOrder.jsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import { ApiTable, EmisApiTable, EmisRequest } from '$utils' import { Skeleton, Button, Pagination, Form, Popconfirm, Table, Toast } from '@douyinfe/semi-ui'; import { IconSearch } from '@douyinfe/semi-icons'; -import { SkeletonScreen, WorkflowModal } from "$components"; +import { SkeletonScreen, WorkflowModal, WorkflowApprovalModal } from "$components"; import moment from "moment"; @@ -28,8 +28,8 @@ const Rest = (props) => { const [tableData, setTableData] = useState([]); //获取项目状态列表 const [loading, setLoading] = useState(true); //获取项目状态列表 const [workflowModalVisible, setWorkflowModalVisible] = useState(false) - const [processInstanceId, setProcessInstanceId] = useState(null) - + const [checkProcessInstanceId, setCheckProcessInstanceId] = useState(null) + const [processData, setProcessData] = useState([]) useEffect(() => { @@ -80,9 +80,8 @@ const Rest = (props) => { title: '操作', dataIndex: 'hadle', render: (text, record, index) =>
{ - setProcessInstanceId(record.processInstanceId) + setCheckProcessInstanceId(record.processInstanceId) setWorkflowModalVisible(true) - }}>查看详情
}] @@ -134,8 +133,6 @@ const Rest = (props) => { 查询 - - @@ -184,10 +181,10 @@ const Rest = (props) => { - { setWorkflowModalVisible(false) }} successCallBack={() => { setWorkflowModalVisible(false) }} />