fangmingyue před 2 roky
rodič
revize
8d5f29f449

+ 6
- 1
src/layouts/index.jsx Zobrazit soubor

8
 import TabBar from './TabBar';
8
 import TabBar from './TabBar';
9
 import laySty from './layout.module.less';
9
 import laySty from './layout.module.less';
10
 
10
 
11
+const f = x => x;
12
+
11
 export default (props) => {
13
 export default (props) => {
12
-  const { className, style, roles, tabBar = false, loading } = props;
14
+  const { className, style, roles, tabBar = false, loading, onShow = f, onHide = f } = props;
13
 
15
 
14
   const { person, user, duty } = useModel('user');
16
   const { person, user, duty } = useModel('user');
15
 
17
 
32
     };
34
     };
33
   });
35
   });
34
 
36
 
37
+  Taro.useDidShow(onShow);
38
+  Taro.useDidHide(onHide);
39
+
35
   return (
40
   return (
36
     <View className={laySty['page-wrapper']}>
41
     <View className={laySty['page-wrapper']}>
37
       <Notify id="vanNotify" />
42
       <Notify id="vanNotify" />

+ 13
- 2
src/pages/check/edit/components/LocForm.jsx Zobrazit soubor

116
           </CellGroup>
116
           </CellGroup>
117
         )
117
         )
118
       }
118
       }
119
-      <CellGroup style={{ marginTop: '20px' }}>
119
+      {/* <CellGroup style={{ marginTop: '20px' }}>
120
         <Cell>
120
         <Cell>
121
           <View style={{ textAlign: 'center', color: '#000' }}>
121
           <View style={{ textAlign: 'center', color: '#000' }}>
122
             您已完成{count}份
122
             您已完成{count}份
123
           </View>
123
           </View>
124
         </Cell>
124
         </Cell>
125
-      </CellGroup>
125
+      </CellGroup> */}
126
+
127
+      {
128
+        checkType == 'survey' && (
129
+          <CellGroup style={{ marginTop: '20px' }}>
130
+            <Cell
131
+              title="已完成"
132
+              value={`${checkItemInfo?.answerNum || 0} 份`}
133
+            />
134
+          </CellGroup>
135
+        )
136
+      }
126
     </View >
137
     </View >
127
   )
138
   )
128
 }
139
 }

+ 10
- 2
src/pages/home/components/StatCard.jsx Zobrazit soubor

4
 import { getIndexData } from '@/services/stat';
4
 import { getIndexData } from '@/services/stat';
5
 import style from './stat-card.module.less';
5
 import style from './stat-card.module.less';
6
 
6
 
7
-export default (props) => {
7
+export default React.forwardRef((props, ref) => {
8
   const { duty } = props;
8
   const { duty } = props;
9
 
9
 
10
   const [list, setList] = React.useState([]);
10
   const [list, setList] = React.useState([]);
22
     }
22
     }
23
   }, [duty]);
23
   }, [duty]);
24
 
24
 
25
+  React.useImperativeHandle(ref, () => ({
26
+    refresh: () => {
27
+      if (duty) {
28
+        getIndexData(duty).then(setList);
29
+      }
30
+    }
31
+  }), [duty]);
32
+
25
   return (
33
   return (
26
     <View className={classNames}>
34
     <View className={classNames}>
27
       <View className={style['stat-card']}>
35
       <View className={style['stat-card']}>
36
       </View>
44
       </View>
37
     </View>
45
     </View>
38
   )
46
   )
39
-}
47
+})

+ 7
- 2
src/pages/home/index.jsx Zobrazit soubor

74
 
74
 
75
 export default (props) => {
75
 export default (props) => {
76
 
76
 
77
+  const statRef = React.useRef();
77
   const userModel = useModel('user');
78
   const userModel = useModel('user');
78
   const { user, duty, signOut, changePwd } = userModel || {};
79
   const { user, duty, signOut, changePwd } = userModel || {};
79
 
80
 
83
     return menus[duty];
84
     return menus[duty];
84
   }, [duty])
85
   }, [duty])
85
 
86
 
87
+  const onShow = () => {
88
+    statRef.current?.refresh();
89
+  }
90
+
86
   return (
91
   return (
87
-    <Page tabBar="home" className="home-page">
92
+    <Page tabBar="home" className="home-page" onShow={onShow}>
88
       <Head
93
       <Head
89
         userModel={userModel}
94
         userModel={userModel}
90
         onChangePwd={changePwd}
95
         onChangePwd={changePwd}
91
         onExit={signOut}
96
         onExit={signOut}
92
       />
97
       />
93
       <Banner duty={duty} />
98
       <Banner duty={duty} />
94
-      <StatCard duty={duty} />
99
+      <StatCard duty={duty} ref={statRef} />
95
 
100
 
96
       <View className="menu-icons">
101
       <View className="menu-icons">
97
         {
102
         {

+ 27
- 13
src/pages/user/list/index.jsx Zobrazit soubor

2
 import Taro from "@tarojs/taro";
2
 import Taro from "@tarojs/taro";
3
 import { View } from "@tarojs/components";
3
 import { View } from "@tarojs/components";
4
 import { Cell, Button, Dialog } from "@antmjs/vantui";
4
 import { Cell, Button, Dialog } from "@antmjs/vantui";
5
+import { ROLES } from "@/utils/user";
5
 import Page from "@/layouts/index";
6
 import Page from "@/layouts/index";
6
 import PowerList from "@/components/PowerList";
7
 import PowerList from "@/components/PowerList";
7
 import { getSysUser, deleteSysUser } from "@/services/sysuser";
8
 import { getSysUser, deleteSysUser } from "@/services/sysuser";
19
 
20
 
20
   const onDelete = (user) => {
21
   const onDelete = (user) => {
21
     Dialog.confirm({
22
     Dialog.confirm({
23
+      width: '70vw',
22
       title: "确认删除用户?",
24
       title: "确认删除用户?",
23
-    }).then((e) => {
24
-      const { action } = e.detail;
25
+    }).then((action) => {
25
       if (action === "confirm") {
26
       if (action === "confirm") {
26
         setLoading(true);
27
         setLoading(true);
27
-        deleteSysUser(user.id)
28
+        deleteSysUser(user.userId)
28
           .then(() => {
29
           .then(() => {
29
             setLoading(false);
30
             setLoading(false);
30
 
31
 
38
     });
39
     });
39
   };
40
   };
40
 
41
 
42
+  const onShow = () => {
43
+    listRef.current.refresh();
44
+  }
45
+
41
   return (
46
   return (
42
-    <Page loading={loading}>
47
+    <Page loading={loading} onShow={onShow}>
43
       <view className={styles["user-warpper"]}>
48
       <view className={styles["user-warpper"]}>
44
         <view className={styles["user-warpper-list"]}>
49
         <view className={styles["user-warpper-list"]}>
45
           <PowerList
50
           <PowerList
49
             renderItem={(item) => (
54
             renderItem={(item) => (
50
               <Cell
55
               <Cell
51
                 key={item.userId}
56
                 key={item.userId}
52
-                title={item.name}
57
+                title={`${item.name} ${item.phone}`}
53
                 label={item.createDate.substring(0, 10)}
58
                 label={item.createDate.substring(0, 10)}
54
               >
59
               >
55
-                <Button
56
-                  plain
57
-                  type="danger"
58
-                  size="small"
59
-                  onClick={() => onDelete(item)}
60
-                >
61
-                  删除
62
-                </Button>
60
+                <View>
61
+                  <View>
62
+                    {
63
+                      item.dutyList?.map(x => ROLES[x]).join(' ')
64
+                    }
65
+                  </View>
66
+                  <View>
67
+                    <Button
68
+                      plain
69
+                      type="danger"
70
+                      size="small"
71
+                      onClick={() => onDelete(item)}
72
+                    >
73
+                      删除
74
+                    </Button>
75
+                  </View>
76
+                </View>
63
               </Cell>
77
               </Cell>
64
             )}
78
             )}
65
           />
79
           />