Commit 003fdf2a authored by Bill's avatar Bill

Merge branch 'dev' of 10.0.0.22:lingxi/lingxi-business-paltform into dev

parents fa7887ca d6cf1e3d
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-15 17:48:36
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-15 17:49:54
* @LastEditTime: 2020-11-06 18:47:46
* @Description: 内外部流转记录组件
*/
import React from 'react';
......@@ -16,8 +16,18 @@ import styles from './index.less';
interface AuditProcessProp {
outerVerifyCurrent?: number;
innerVerifyCurrent?: number;
outerVerifySteps?: { step: number, stepName: string, roleName: string }[];
innerVerifySteps?: { step: number, stepName: string, roleName: string }[];
outerVerifySteps?: {
step: number,
stepName: string,
roleName: string,
status: 'wait' | 'process' | 'finish' | 'error',
}[];
innerVerifySteps?: {
step: number,
stepName: string,
roleName: string,
status: 'wait' | 'process' | 'finish' | 'error',
}[];
customTitleKey?: string
customKey?: string
};
......@@ -39,6 +49,7 @@ const AuditProcess: React.FC<AuditProcessProp> = ({
key={customKey ? item[customKey] : item.step}
title={customTitleKey ? item[customTitleKey] : item.stepName}
description={item.roleName}
status={item.status}
/>
))}
</Steps>
......@@ -50,6 +61,7 @@ const AuditProcess: React.FC<AuditProcessProp> = ({
key={customKey ? item[customKey] : item.step}
title={customTitleKey ? item[customTitleKey] : item.stepName}
description={item.roleName}
status={item.status}
/>
))}
</Steps>
......
......@@ -14,7 +14,7 @@ import {
CREDIT_OUTER_STATUS, CREDIT_STATUS,
CREDIT_INNER_STATUS_UNCOMMITTED,
} from '@/constants';
import { normalizeFiledata, FileData } from '@/utils';
import { normalizeFiledata, FileData, findLastIndexFlowState, normalizeFlowData } from '@/utils';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import AvatarWrap from '@/components/AvatarWrap';
import StatusTag from '@/components/StatusTag';
......@@ -192,20 +192,22 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
step: item.step,
stepName: item.taskName,
roleName: item.roleName,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
outerVerifyCurrent={quotaInfo && quotaInfo.outerTaskList ? quotaInfo.outerTaskList.findIndex(item => item.isExecute === 0) : 0}
outerVerifyCurrent={findLastIndexFlowState(quotaInfo?.outerTaskList)}
innerVerifySteps={
quotaInfo && quotaInfo.innerTaskList ?
quotaInfo.innerTaskList.map(item => ({
step: item.step,
stepName: item.taskName,
roleName: item.roleName,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
innerVerifyCurrent={quotaInfo && quotaInfo.innerTaskList ? quotaInfo.innerTaskList.findIndex(item => item.isExecute === 0) : 0}
innerVerifyCurrent={findLastIndexFlowState(quotaInfo?.innerTaskList)}
/>
</div>
......
import React from 'react'
import AuditProcess from '@/components/AuditProcess'
import { findLastIndexFlowState } from '../../_public/order/utils'
import { findLastIndexFlowState } from '@/utils'
import OrderProductTable from '../../components/orderProductTable'
import SaleOrderProductTable from '../../components/saleOrderProductTable'
import OrderPayTabs from '../../components/orderPayTabs'
......@@ -22,8 +22,22 @@ const OrderDetailSection:React.FC<OrderDetailSectionProps> = ({formContext, type
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(formContext.data.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formContext.data.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={formContext.data.externalWorkflowFlowRecordLogResponses || []}
innerVerifySteps={formContext.data.interiorWorkflowFlowRecordLogResponses || []}
outerVerifySteps={
formContext.data.externalWorkflowFlowRecordLogResponses ?
formContext.data.externalWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
innerVerifySteps={
formContext.data.interiorWorkflowFlowRecordLogResponses ?
formContext.data.interiorWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
></AuditProcess>
{ type === 'saleOrder' ? <SaleOrderProductTable/> : <OrderProductTable editable /> }
......
......@@ -24,8 +24,8 @@ import { useProductTable } from './model/useProductTable'
import styled from 'styled-components'
import { useUpdate } from '@umijs/hooks'
import { PublicApi } from '@/services/api'
import { formatTimeString, omit } from '@/utils'
import { changeRouterTitleByStatus, findLastIndexFlowState } from '../../_public/order/utils'
import { formatTimeString, omit, findLastIndexFlowState } from '@/utils'
import { changeRouterTitleByStatus } from '../../_public/order/utils'
import { ReadyAddOrderDetailContext } from '../context'
import AuditProcess from '@/components/AuditProcess'
......@@ -293,8 +293,22 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(initFormValue.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(initFormValue.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={initFormValue.externalWorkflowFlowRecordLogResponses}
innerVerifySteps={initFormValue.interiorWorkflowFlowRecordLogResponses}
outerVerifySteps={
initFormValue.externalWorkflowFlowRecordLogResponses ?
initFormValue.externalWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
innerVerifySteps={
initFormValue.interiorWorkflowFlowRecordLogResponses ?
initFormValue.interiorWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
></AuditProcess> }
<Card className='' style={{marginTop: 24}}>
<NiceForm
......
......@@ -513,6 +513,29 @@ export const coverColFiltersItem = (
}
};
/**
* 找到最后一个可用的工作流状态的索引
* @param {array} data 数据
* @param {string} customKey 自定义 key
*/
export const findLastIndexFlowState = (data: any[], customKey = 'isExecute'): number => {
let index = 0;
if (!Array.isArray(data)) {
return index;
}
// 循环数据,找到状态值,一直覆盖
for (let i = 0; i < data.length; i++) {
if (!Boolean(data[i][customKey])) {
index = i - 1;
}
// 循环到最后如果 index 还是为 0 的话,说明工作流全部跑完了,此时 index 为 data.length - 1
if (i === data.length - 1 && index === 0) {
index = data.length - 1;
}
}
return index;
};
export default {
isArray,
isObject,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment