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 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2020-09-15 17:48:36 * @Date: 2020-09-15 17:48:36
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-15 17:49:54 * @LastEditTime: 2020-11-06 18:47:46
* @Description: 内外部流转记录组件 * @Description: 内外部流转记录组件
*/ */
import React from 'react'; import React from 'react';
...@@ -16,8 +16,18 @@ import styles from './index.less'; ...@@ -16,8 +16,18 @@ import styles from './index.less';
interface AuditProcessProp { interface AuditProcessProp {
outerVerifyCurrent?: number; outerVerifyCurrent?: number;
innerVerifyCurrent?: number; innerVerifyCurrent?: number;
outerVerifySteps?: { step: number, stepName: string, roleName: string }[]; outerVerifySteps?: {
innerVerifySteps?: { step: number, stepName: string, roleName: string }[]; 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 customTitleKey?: string
customKey?: string customKey?: string
}; };
...@@ -39,6 +49,7 @@ const AuditProcess: React.FC<AuditProcessProp> = ({ ...@@ -39,6 +49,7 @@ const AuditProcess: React.FC<AuditProcessProp> = ({
key={customKey ? item[customKey] : item.step} key={customKey ? item[customKey] : item.step}
title={customTitleKey ? item[customTitleKey] : item.stepName} title={customTitleKey ? item[customTitleKey] : item.stepName}
description={item.roleName} description={item.roleName}
status={item.status}
/> />
))} ))}
</Steps> </Steps>
...@@ -50,6 +61,7 @@ const AuditProcess: React.FC<AuditProcessProp> = ({ ...@@ -50,6 +61,7 @@ const AuditProcess: React.FC<AuditProcessProp> = ({
key={customKey ? item[customKey] : item.step} key={customKey ? item[customKey] : item.step}
title={customTitleKey ? item[customTitleKey] : item.stepName} title={customTitleKey ? item[customTitleKey] : item.stepName}
description={item.roleName} description={item.roleName}
status={item.status}
/> />
))} ))}
</Steps> </Steps>
......
...@@ -14,7 +14,7 @@ import { ...@@ -14,7 +14,7 @@ import {
CREDIT_OUTER_STATUS, CREDIT_STATUS, CREDIT_OUTER_STATUS, CREDIT_STATUS,
CREDIT_INNER_STATUS_UNCOMMITTED, CREDIT_INNER_STATUS_UNCOMMITTED,
} from '@/constants'; } from '@/constants';
import { normalizeFiledata, FileData } from '@/utils'; import { normalizeFiledata, FileData, findLastIndexFlowState, normalizeFlowData } from '@/utils';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import AvatarWrap from '@/components/AvatarWrap'; import AvatarWrap from '@/components/AvatarWrap';
import StatusTag from '@/components/StatusTag'; import StatusTag from '@/components/StatusTag';
...@@ -192,20 +192,22 @@ const DetailInfo: React.FC<DetailInfoProps> = ({ ...@@ -192,20 +192,22 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
step: item.step, step: item.step,
stepName: item.taskName, stepName: item.taskName,
roleName: item.roleName, 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={ innerVerifySteps={
quotaInfo && quotaInfo.innerTaskList ? quotaInfo && quotaInfo.innerTaskList ?
quotaInfo.innerTaskList.map(item => ({ quotaInfo.innerTaskList.map(item => ({
step: item.step, step: item.step,
stepName: item.taskName, stepName: item.taskName,
roleName: item.roleName, 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> </div>
......
import React from 'react' import React from 'react'
import AuditProcess from '@/components/AuditProcess' import AuditProcess from '@/components/AuditProcess'
import { findLastIndexFlowState } from '../../_public/order/utils' import { findLastIndexFlowState } from '@/utils'
import OrderProductTable from '../../components/orderProductTable' import OrderProductTable from '../../components/orderProductTable'
import SaleOrderProductTable from '../../components/saleOrderProductTable' import SaleOrderProductTable from '../../components/saleOrderProductTable'
import OrderPayTabs from '../../components/orderPayTabs' import OrderPayTabs from '../../components/orderPayTabs'
...@@ -22,8 +22,22 @@ const OrderDetailSection:React.FC<OrderDetailSectionProps> = ({formContext, type ...@@ -22,8 +22,22 @@ const OrderDetailSection:React.FC<OrderDetailSectionProps> = ({formContext, type
customKey='state' customKey='state'
outerVerifyCurrent={findLastIndexFlowState(formContext.data.externalWorkflowFlowRecordLogResponses)} outerVerifyCurrent={findLastIndexFlowState(formContext.data.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formContext.data.interiorWorkflowFlowRecordLogResponses)} innerVerifyCurrent={findLastIndexFlowState(formContext.data.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={formContext.data.externalWorkflowFlowRecordLogResponses || []} outerVerifySteps={
innerVerifySteps={formContext.data.interiorWorkflowFlowRecordLogResponses || []} 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> ></AuditProcess>
{ type === 'saleOrder' ? <SaleOrderProductTable/> : <OrderProductTable editable /> } { type === 'saleOrder' ? <SaleOrderProductTable/> : <OrderProductTable editable /> }
......
...@@ -24,8 +24,8 @@ import { useProductTable } from './model/useProductTable' ...@@ -24,8 +24,8 @@ import { useProductTable } from './model/useProductTable'
import styled from 'styled-components' import styled from 'styled-components'
import { useUpdate } from '@umijs/hooks' import { useUpdate } from '@umijs/hooks'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { formatTimeString, omit } from '@/utils' import { formatTimeString, omit, findLastIndexFlowState } from '@/utils'
import { changeRouterTitleByStatus, findLastIndexFlowState } from '../../_public/order/utils' import { changeRouterTitleByStatus } from '../../_public/order/utils'
import { ReadyAddOrderDetailContext } from '../context' import { ReadyAddOrderDetailContext } from '../context'
import AuditProcess from '@/components/AuditProcess' import AuditProcess from '@/components/AuditProcess'
...@@ -293,8 +293,22 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -293,8 +293,22 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
customKey='state' customKey='state'
outerVerifyCurrent={findLastIndexFlowState(initFormValue.externalWorkflowFlowRecordLogResponses)} outerVerifyCurrent={findLastIndexFlowState(initFormValue.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(initFormValue.interiorWorkflowFlowRecordLogResponses)} innerVerifyCurrent={findLastIndexFlowState(initFormValue.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={initFormValue.externalWorkflowFlowRecordLogResponses} outerVerifySteps={
innerVerifySteps={initFormValue.interiorWorkflowFlowRecordLogResponses} 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> } ></AuditProcess> }
<Card className='' style={{marginTop: 24}}> <Card className='' style={{marginTop: 24}}>
<NiceForm <NiceForm
......
...@@ -513,6 +513,29 @@ export const coverColFiltersItem = ( ...@@ -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 { export default {
isArray, isArray,
isObject, 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