|
@ -3,96 +3,104 @@ import { connect } from 'react-redux'; |
|
|
import moment from 'moment'; |
|
|
import moment from 'moment'; |
|
|
import { WorkflowModal, WorkFlowViewModal } from "$components" |
|
|
import { WorkflowModal, WorkFlowViewModal } from "$components" |
|
|
import { EmisRequest, EmisApiTable } from "$utils" |
|
|
import { EmisRequest, EmisApiTable } from "$utils" |
|
|
import { Card, Notification, Space, Button } from '@douyinfe/semi-ui'; |
|
|
import { Card, Notification, Space, Button, Spin } from '@douyinfe/semi-ui'; |
|
|
import { IconArticle } from '@douyinfe/semi-icons'; |
|
|
import { IconArticle } from '@douyinfe/semi-icons'; |
|
|
import '../style.less' |
|
|
import '../style.less' |
|
|
|
|
|
|
|
|
const { Meta } = Card; |
|
|
const { Meta } = Card; |
|
|
|
|
|
|
|
|
const JobOrder = (props) => { |
|
|
const JobOrder = (props) => { |
|
|
const { dispatch, actions, user, workflowProcess } = props |
|
|
const { dispatch, actions, user, workflowProcess, clientHeight } = props |
|
|
const { workOrder } = actions |
|
|
const { workOrder } = actions |
|
|
const [workflowModalVisible, setWorkflowModalVisible] = useState(false) |
|
|
const [workflowModalVisible, setWorkflowModalVisible] = useState(false) |
|
|
const [launchProcessId, setLaunchProcessId] = useState(null) |
|
|
const [launchProcessId, setLaunchProcessId] = useState(null) |
|
|
|
|
|
const [formStateRequestingIndex, setFormStateRequestingIndex] = useState(false) |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
dispatch(workOrder.getEnabledWorkflowProcess()) |
|
|
dispatch(workOrder.getEnabledWorkflowProcess()) |
|
|
}, []) |
|
|
}, []) |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div className='work-order-container' style={{ |
|
|
<div> |
|
|
display: 'grid', gridTemplateColumns: `repeat(auto-fit, minmax(340px, 1fr))`, gridAutoRows: `minmax(0, auto)`, gridGap: 12, |
|
|
<div className='work-order-container' style={{ |
|
|
}}> |
|
|
display: 'grid', gridTemplateColumns: `repeat(auto-fit, minmax(340px, 1fr))`, gridAutoRows: `minmax(0, auto)`, gridGap: 12, |
|
|
{ |
|
|
}}> |
|
|
workflowProcess.map(p => { |
|
|
{ |
|
|
return ( |
|
|
workflowProcess.map((p, index) => { |
|
|
<Card |
|
|
return ( |
|
|
key={p.id} |
|
|
<Card |
|
|
className='work-order-card' |
|
|
key={p.id} |
|
|
style={{ gridColumn: `span 1`, cursor: 'pointer' }} |
|
|
className='work-order-card' |
|
|
footerLine={true} |
|
|
style={{ gridColumn: `span 1`, cursor: 'pointer' }} |
|
|
footerStyle={{ display: 'flex', justifyContent: 'flex-end' }} |
|
|
footerLine={true} |
|
|
footer={ |
|
|
footerStyle={{ display: 'flex', justifyContent: 'flex-end' }} |
|
|
`创建时间:${moment(p.createTime || p.updateTime).format('YYYY-MM-DD HH:mm:ss')}` |
|
|
footer={ |
|
|
} |
|
|
`创建时间:${moment(p.createTime || p.updateTime).format('YYYY-MM-DD HH:mm:ss')}` |
|
|
onClick={() => { |
|
|
} |
|
|
EmisRequest.get(EmisApiTable.getProcessByName, { |
|
|
onClick={() => { |
|
|
name: decodeURIComponent(p.name), |
|
|
if (formStateRequestingIndex) return; |
|
|
resource: p.id |
|
|
setFormStateRequestingIndex(index + 1) |
|
|
}).then(res => { |
|
|
EmisRequest.get(EmisApiTable.getProcessByName, { |
|
|
console.log(res); |
|
|
name: decodeURIComponent(p.name), |
|
|
if (res) { |
|
|
resource: p.id |
|
|
// if (res.deleted) { |
|
|
}).then(res => { |
|
|
// Notification.error({ title: '该表单流程已删除,请尝试退出账号重新登录或联系项企管理员' }) |
|
|
setFormStateRequestingIndex(false) |
|
|
// } else if (res.isEdited) { |
|
|
if (res) { |
|
|
// Notification.error({ title: '该表单流程已修改,请尝试退出账号重新登录或联系项企管理员' }) |
|
|
// if (res.deleted) { |
|
|
// } else if (!res.isEnable) { |
|
|
// Notification.error({ title: '该表单流程已删除,请尝试退出账号重新登录或联系项企管理员' }) |
|
|
// Notification.error({ title: '该表单流程已停用,请尝试退出账号重新登录或联系项企管理员' }) |
|
|
// } else if (res.isEdited) { |
|
|
// } else |
|
|
// Notification.error({ title: '该表单流程已修改,请尝试退出账号重新登录或联系项企管理员' }) |
|
|
if (res.id) { |
|
|
// } else if (!res.isEnable) { |
|
|
setLaunchProcessId(res.id) |
|
|
// Notification.error({ title: '该表单流程已停用,请尝试退出账号重新登录或联系项企管理员' }) |
|
|
setWorkflowModalVisible(true) |
|
|
// } else |
|
|
|
|
|
if (res.id) { |
|
|
|
|
|
setLaunchProcessId(res.id) |
|
|
|
|
|
setWorkflowModalVisible(true) |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
Notification.error({ title: `获取指定流程失败` }); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
}) |
|
|
Notification.error({ title: `获取指定流程失败` }); |
|
|
}} |
|
|
} |
|
|
> |
|
|
}) |
|
|
<div> |
|
|
}} |
|
|
<Meta |
|
|
> |
|
|
title={ |
|
|
<div> |
|
|
<span>{p.name}<Spin style={{ position: 'relative', top: 6, left: 6 }} spinning={formStateRequestingIndex == index + 1} /></span> |
|
|
<Meta |
|
|
} |
|
|
title={p.name} |
|
|
avatar={ |
|
|
// description="全面、易用、优质" |
|
|
<IconArticle style={{ fontSize: 42 }} /> |
|
|
avatar={ |
|
|
} |
|
|
<IconArticle style={{ fontSize: 42 }} /> |
|
|
/> |
|
|
} |
|
|
</div> |
|
|
/> |
|
|
</Card> |
|
|
</div> |
|
|
) |
|
|
</Card> |
|
|
}) |
|
|
) |
|
|
} |
|
|
}) |
|
|
</div> |
|
|
} |
|
|
<WorkflowModal |
|
|
{/* <WorkflowModal |
|
|
|
|
|
visible={workflowModalVisible} |
|
|
visible={workflowModalVisible} |
|
|
title={''} |
|
|
title={''} |
|
|
processId={launchProcessId} |
|
|
processId={launchProcessId} |
|
|
onCancel={() => { setWorkflowModalVisible(false) }} |
|
|
onCancel={() => { setWorkflowModalVisible(false) }} |
|
|
successCallBack={() => { setWorkflowModalVisible(false) }} |
|
|
successCallBack={() => { setWorkflowModalVisible(false) }} |
|
|
/> */} |
|
|
/> |
|
|
<WorkFlowViewModal |
|
|
{/* <WorkFlowViewModal |
|
|
visible={workflowModalVisible} |
|
|
visible={workflowModalVisible} |
|
|
processId={launchProcessId} |
|
|
processId={launchProcessId} |
|
|
/> |
|
|
/> */} |
|
|
</div> |
|
|
</div> |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
function mapStateToProps (state) { |
|
|
const { auth, global, workflowProcess } = state; |
|
|
const { auth, global, workflowProcess } = state; |
|
|
|
|
|
console.log(global); |
|
|
return { |
|
|
return { |
|
|
user: auth.user, |
|
|
user: auth.user, |
|
|
actions: global.actions, |
|
|
actions: global.actions, |
|
|
workflowProcess: workflowProcess.data || [] |
|
|
workflowProcess: workflowProcess.data || [], |
|
|
|
|
|
clientHeight: global.clientHeight |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|