Sfoglia il codice sorgente

fix: 审批信息展示导致页面崩溃问题修复

ZhaoJun 1 anno fa
parent
commit
c6213ed42c
1 ha cambiato i file con 16 aggiunte e 16 eliminazioni
  1. 16 16
      src/pages/Detail/FlowModal.js

+ 16 - 16
src/pages/Detail/FlowModal.js

@@ -388,15 +388,15 @@ function FlowModal(props) {
     setInputValue(null);
   };
 
-  function calculateHoursDifference(date1, date2) {
-    const timestamp1 = date1.getTime(); // 获取第一个Date对象的时间戳(以毫秒为单位)
-    const timestamp2 = date2.getTime(); // 获取第二个Date对象的时间戳(以毫秒为单位)
-
-    const timeDifferenceInMillis = Math.abs(timestamp2 - timestamp1); // 计算时间戳之间的差值(毫秒数)
-    const hoursDifference = timeDifferenceInMillis / (1000 * 60 * 60); // 将差值转换为小时数
-
-    return hoursDifference.toFixed(2);
-  }
+  // function calculateHoursDifference(date1, date2) {
+  //   const timestamp1 = date1.getTime(); // 获取第一个Date对象的时间戳(以毫秒为单位)
+  //   const timestamp2 = date2.getTime(); // 获取第二个Date对象的时间戳(以毫秒为单位)
+  //
+  //   const timeDifferenceInMillis = Math.abs(timestamp2 - timestamp1); // 计算时间戳之间的差值(毫秒数)
+  //   const hoursDifference = timeDifferenceInMillis / (1000 * 60 * 60); // 将差值转换为小时数
+  //
+  //   return hoursDifference.toFixed(2);
+  // }
 
   const getDescription = (node, prevNode) => {
     let str = `审批人:${node.AuditorUser?.CName || '-'}`;
@@ -407,8 +407,8 @@ function FlowModal(props) {
         : date.toLocaleDateString('zh-CN', {
             format: 'YYYY-MM-DD hh:mm:ss',
           });
-    const residenceTime =
-      auditTime === '-' ? '-' : calculateHoursDifference(date, new Date(prevNode.audit_time));
+    // const residenceTime =
+    //   auditTime === '-' ? '-' : calculateHoursDifference(date, new Date(prevNode.audit_time));
     return (
       <div>
         审批人:{node.AuditorUser?.CName || '-'}
@@ -420,9 +420,9 @@ function FlowModal(props) {
         <div>
           <span>审批时间:{auditTime || '-'}</span>
         </div>
-        <div>
-          <span>滞留时间:{`${residenceTime}小时`}</span>
-        </div>
+        {/* <div> */}
+        {/*   <span>滞留时间:{`${residenceTime}小时`}</span> */}
+        {/* </div> */}
       </div>
     );
   };
@@ -611,11 +611,11 @@ function FlowModal(props) {
                       current={item.current}
                       status={item.status}
                     >
-                      {item.list.reduce((prev, node) => (
+                      {item.list.map(( node) => (
                         <Step
                           key={`${node.id}_${node.node}`}
                           title={node.node}
-                          description={getDescription(node, prev)}
+                          description={getDescription(node)}
                         />
                       ))}
                     </Steps>