Browse Source

小屏报告列更新问题处理

shizi 8 months ago
parent
commit
713541a6ea
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/pages/doctorScreen/Index.jsx

+ 8 - 1
src/pages/doctorScreen/Index.jsx

@@ -17,6 +17,7 @@ class DoctorScreen extends React.Component {
       waitPat: [],
       callPat: [],
       reWaitPat: [],
+      copyReWaitPat: [],
     };
   }
   static getDerivedStateFromProps(nextProps, prevState) {
@@ -25,7 +26,13 @@ class DoctorScreen extends React.Component {
         patList: JSON.parse(JSON.stringify(nextProps?.patList || [])), // 防止重复渲染
         callPat: nextProps?.callPat || [],
         waitPat: initArray(nextProps?.waitPat || [], 7),
-        reWaitPat: initArray(nextProps?.reWaitPat || [], 8),
+      };
+    }
+    if (nextProps && 'reWaitPat' in nextProps && JSON.stringify(nextProps.reWaitPat) !== JSON.stringify(prevState.copyReWaitPat)) {
+      let nReWaitPat = nextProps?.reWaitPat || [];
+      return {
+        copyReWaitPat: JSON.parse(JSON.stringify(nReWaitPat)), // 防止重复渲染
+        reWaitPat: initArray(nReWaitPat, 8),
       };
     }
     return null;