Browse Source

增加loading

xujunjie 2 years ago
parent
commit
01e68af988

+ 2 - 0
src/components/Flow/node/circle/index.tsx

@@ -33,6 +33,8 @@ export default function CustomRect(props) {
           display: 'flex',
           justifyContent: 'center',
           alignItems: 'center',
+          padding: "0px 8px",
+          lineHeight: 1.2
         }}
       >
         <span>{label}</span>

+ 6 - 3
src/pages/PurchaseAdmin/PurchaseList/Detail/AuditFlow.js

@@ -1,5 +1,5 @@
 import React, { useMemo, useEffect, useState, useRef } from 'react';
-import { Steps, Popover, Alert } from 'antd';
+import { Steps, Popover, Alert, Spin } from 'antd';
 import styles from './Index.less';
 import { queryDDProcessesForecast } from '@/services/boom';
 import { connect } from 'dva';
@@ -20,6 +20,7 @@ function AuditFlow(props) {
     cc_userids = [],
   } = props;
   const [flow, setFlow] = useState({ workflowActivityRules: [] });
+  const [loading, setLoading] = useState(false);
   const timerRef = useRef({
     id: '',
     status: false,
@@ -130,6 +131,7 @@ function AuditFlow(props) {
     if (!timerRef.current.status) {
       // 上锁
       timerRef.current.status = true;
+      setLoading(true);
       try {
         let flow = await queryDDProcessesForecast({
           processCode,
@@ -139,6 +141,7 @@ function AuditFlow(props) {
         });
         setFlow(flow);
       } catch (error) {}
+      setLoading(false);
       setTimeout(() => {
         // 延时解锁
         timerRef.current.status = false;
@@ -158,7 +161,7 @@ function AuditFlow(props) {
   }, [processCode, formComponentValues]);
 
   return (
-    <>
+    <Spin spinning={loading}>
       <div className={styles.top}>
         <Steps current={current} progressDot={customDot} direction={direction}>
           {flow.workflowActivityRules.map(item => (
@@ -168,7 +171,7 @@ function AuditFlow(props) {
         </Steps>
       </div>
       {status !== undefined && renderAlert()}
-    </>
+    </Spin>
   );
 }