fangmingyue 2 年前
父节点
当前提交
1243ea9484
共有 1 个文件被更改,包括 16 次插入6 次删除
  1. 16
    6
      src/pages/home/components/EscalationCharts.jsx

+ 16
- 6
src/pages/home/components/EscalationCharts.jsx 查看文件

11
   const [orgId, setOrgId] = useState();
11
   const [orgId, setOrgId] = useState();
12
   const [condition, setCondition] = useState();
12
   const [condition, setCondition] = useState();
13
 
13
 
14
-  const onChange = e => {
15
-    setCondition({ orgId: e })
16
-    setOrgId(e)
17
-  }
18
-  console.log('orgId', orgId);
14
+  React.useEffect(() => {
15
+    if (orgList.length > 0) {
16
+      const e = orgList[0]?.orgId
17
+      setCondition({ orgId: e })
18
+      setOrgId(e)
19
+    }
20
+  }, [orgList])
19
 
21
 
20
   React.useEffect(() => {
22
   React.useEffect(() => {
21
     getSysOrg({ pageSize: 500 }).then((res) => {
23
     getSysOrg({ pageSize: 500 }).then((res) => {
23
     })
25
     })
24
   }, []);
26
   }, []);
25
 
27
 
28
+
29
+
30
+  //选择下拉框将条件参数set给condition
31
+  const onChange = e => {
32
+    setCondition({ orgId: e })
33
+    setOrgId(e)
34
+  }
35
+
26
   React.useEffect(() => {
36
   React.useEffect(() => {
27
     getStatEscalation(condition).then((res) => {
37
     getStatEscalation(condition).then((res) => {
28
       setOption({
38
       setOption({
76
         ]
86
         ]
77
       })
87
       })
78
     })
88
     })
79
-  }, []);
89
+  }, [condition]);
80
 
90
 
81
   return (
91
   return (
82
     <Card
92
     <Card