import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import moment from 'moment';
import { WorkflowModal, WorkFlowViewModal, WorkflowApprovalModal } from "$components"
import { EmisRequest, EmisApiTable } from "$utils"
import { Card, Notification, Space, Button, Spin } from '@douyinfe/semi-ui';
import { IconArticle } from '@douyinfe/semi-icons';
import '../style.less'
const { Meta } = Card;
const JobOrder = (props) => {
const { dispatch, actions, user, workflowProcess, clientHeight } = props
const { workOrder } = actions
const [workflowModalVisible, setWorkflowModalVisible] = useState(false)
const [launchProcessId, setLaunchProcessId] = useState(null)
const [formStateRequestingIndex, setFormStateRequestingIndex] = useState(false)
useEffect(() => {
dispatch(workOrder.getEnabledWorkflowProcess())
}, [])
return (
{
workflowProcess.map((p, index) => {
return (
{
if (formStateRequestingIndex) return;
setFormStateRequestingIndex(index + 1)
EmisRequest.get(EmisApiTable.getProcessByName, {
name: decodeURIComponent(p.name),
resource: p.id
}).then(res => {
setFormStateRequestingIndex(false)
if (res) {
// if (res.deleted) {
// Notification.error({ title: '该表单流程已删除,请尝试退出账号重新登录或联系项企管理员' })
// } else if (res.isEdited) {
// Notification.error({ title: '该表单流程已修改,请尝试退出账号重新登录或联系项企管理员' })
// } else if (!res.isEnable) {
// Notification.error({ title: '该表单流程已停用,请尝试退出账号重新登录或联系项企管理员' })
// } else
if (res.id) {
setLaunchProcessId(res.id)
setWorkflowModalVisible(true)
}
} else {
Notification.error({ title: `获取指定流程失败` });
}
})
}}
>
{p.name}
}
avatar={
}
/>
)
})
}
{/*
{ setWorkflowModalVisible(false) }}
successCallBack={() => { setWorkflowModalVisible(false) }}
/> */}
{/* */}
{ { setWorkflowModalVisible(false) }}
/>}
)
}
function mapStateToProps (state) {
const { auth, global, workflowProcess } = state;
console.log(global);
return {
user: auth.user,
actions: global.actions,
workflowProcess: workflowProcess.data || [],
clientHeight: global.clientHeight
};
}
export default connect(mapStateToProps)(JobOrder);