张涛 11 months ago
parent
commit
02e8969f56

+ 2
- 1
src/layouts/TabBar.jsx View File

83
 
83
 
84
     // 责任单位用户
84
     // 责任单位用户
85
     if (duty == ROLE_ORG_USER || duty == ROLE_ORG_MANAGER) {
85
     if (duty == ROLE_ORG_USER || duty == ROLE_ORG_MANAGER) {
86
-      return [home, notice,feedback, mine];
86
+      return [home, notice, mine];
87
+      // return [home, notice,feedback, mine];
87
     }
88
     }
88
 
89
 
89
     if (duty == ROLE_CITIZEN) {
90
     if (duty == ROLE_CITIZEN) {

+ 32
- 23
src/layouts/index.jsx View File

12
 export default (props) => {
12
 export default (props) => {
13
   const { className, style, roles, tabBar = false, loading } = props;
13
   const { className, style, roles, tabBar = false, loading } = props;
14
 
14
 
15
-  const { person, user, duty, current } = useModel('user');
15
+  const { person, user, duty, current } = useModel("user");
16
 
16
 
17
   const containerClass = `${laySty["page-conatiner"]} ${
17
   const containerClass = `${laySty["page-conatiner"]} ${
18
     tabBar ? laySty["with-tabbar"] : ""
18
     tabBar ? laySty["with-tabbar"] : ""
19
   } ${className}`;
19
   } ${className}`;
20
+
21
+  const currentPage = Taro.getCurrentPages().slice().pop();
22
+  const isLoginPage = currentPage.route.includes("pages/login/index");
23
+
20
   React.useEffect(() => {
24
   React.useEffect(() => {
21
-    const currentPage = Taro.getCurrentPages().slice().pop();
25
+    //  currentPage = Taro.getCurrentPages().slice().pop();
22
 
26
 
23
     if (!user) {
27
     if (!user) {
24
       try {
28
       try {
25
-        current().then((res) => {
26
-          console.log('---当前人员----', res);
27
-        }).catch((err) => {
28
-          console.log('---当前人员--报错了--');
29
-          console.error(err);
30
-  
31
-          if (!currentPage.route.includes("pages/login/index")) {
32
-            Taro.navigateTo({
33
-              url: "/pages/login/index",
34
-            });
35
-          }
36
-        });
29
+        current()
30
+          .then((res) => {
31
+            console.log("---当前人员----", res);
32
+          })
33
+          .catch((err) => {
34
+            console.log("---当前人员--报错了--");
35
+            console.error(err);
36
+
37
+            if (!isLoginPage) {
38
+              Taro.navigateTo({
39
+                url: "/pages/login/index",
40
+              });
41
+            }
42
+          });
37
       } catch (error) {
43
       } catch (error) {
38
         console.error(error);
44
         console.error(error);
39
       }
45
       }
48
     //     return;
54
     //     return;
49
     //   }
55
     //   }
50
     // }
56
     // }
51
-  }, [current, user]);
52
-
57
+  }, [current, user, isLoginPage]);
53
 
58
 
54
   // React.useEffect(() => {
59
   // React.useEffect(() => {
55
   //   console.log("personRef******************");
60
   //   console.log("personRef******************");
80
   });
85
   });
81
 
86
 
82
   useEffect(() => {
87
   useEffect(() => {
83
-      // 获取当前编码后的标题
84
-      var encodedTitle = document.title;
85
-      // 解码标题
86
-      var decodedTitle = decodeURIComponent(encodedTitle);
87
-      // 设置解码后的标题
88
-      document.title = decodedTitle;
88
+    // 获取当前编码后的标题
89
+    var encodedTitle = document.title;
90
+    // 解码标题
91
+    var decodedTitle = decodeURIComponent(encodedTitle);
92
+    // 设置解码后的标题
93
+    document.title = decodedTitle;
89
   }, []);
94
   }, []);
90
 
95
 
91
   return (
96
   return (
101
             </Loading>
106
             </Loading>
102
           </View>
107
           </View>
103
         )} */}
108
         )} */}
109
+        {/* {!isLoginPage ? (
110
+          <Auth roles={roles}>{props.children}</Auth>
111
+        ) : (
112
+          props.children
113
+        )} */}
104
         <Auth roles={roles}>{props.children}</Auth>
114
         <Auth roles={roles}>{props.children}</Auth>
105
-
106
         {!tabBar && <View className={laySty["pdm-space"]}></View>}
115
         {!tabBar && <View className={laySty["pdm-space"]}></View>}
107
       </View>
116
       </View>
108
       {tabBar && (
117
       {tabBar && (

+ 5
- 5
src/pages/home/index.jsx View File

127
           link: "/pages/org/issue/list/index?title=已逾期&bizStatus=expired",
127
           link: "/pages/org/issue/list/index?title=已逾期&bizStatus=expired",
128
         },
128
         },
129
         { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
129
         { icon: "icon11", text: "消息通知", link: "/pages/message/list/index" },
130
-        {
131
-          icon: "icon10",
132
-          text: "我的上报",
133
-          link: `/pages/feedback/issuelist/index?title=我的上报&bizStatus=`,
134
-        },
130
+        // {
131
+        //   icon: "icon10",
132
+        //   text: "我的上报",
133
+        //   link: `/pages/feedback/issuelist/index?title=我的上报&bizStatus=`,
134
+        // },
135
         {
135
         {
136
           icon: "icon12",
136
           icon: "icon12",
137
           text: "交办历史",
137
           text: "交办历史",

+ 21
- 20
src/pages/org/components/issue-info/index.jsx View File

1
-import React from 'react';
2
-import Taro from '@tarojs/taro';
3
-import { View } from '@tarojs/components';
4
-import { Cell, CellGroup, Field, Button } from '@antmjs/vantui';
5
-import Uploader from '@/components/Uploader/index';
6
-import Map from '@/components/map';
7
-import { getDtStr } from '@/utils/date';
1
+import React, { useEffect } from "react";
2
+import Taro from "@tarojs/taro";
3
+import { View } from "@tarojs/components";
4
+import { Cell, CellGroup, Field, Button } from "@antmjs/vantui";
5
+import Uploader from "@/components/Uploader/index";
6
+import Map from "@/components/map";
7
+import { getDtStr } from "@/utils/date";
8
+import { APPLY_READY, getIssueStatus } from "@/utils/biz";
8
 
9
 
9
 export default (props) => {
10
 export default (props) => {
10
   const { issue } = props;
11
   const { issue } = props;
12
+  const [bizStatus, setBizStatus] = React.useState({});
13
+  useEffect(()=>{
14
+    const data=getIssueStatus(issue)
15
+    setBizStatus(data);
16
+
17
+  },[issue])
11
   return (
18
   return (
12
     <>
19
     <>
13
       <Map location={issue?.location} readOnly />
20
       <Map location={issue?.location} readOnly />
17
         <Cell title="办结时间" value={issue?.expireDate} />
24
         <Cell title="办结时间" value={issue?.expireDate} />
18
         <Cell title="交办次数" value={issue?.processNum || 1} />
25
         <Cell title="交办次数" value={issue?.processNum || 1} />
19
       </CellGroup>
26
       </CellGroup>
20
-      <CellGroup style={{marginTop: '20px'}}>
27
+      <CellGroup style={{ marginTop: "20px" }}>
21
         <Cell title="抽检位置" value={issue?.locName} />
28
         <Cell title="抽检位置" value={issue?.locName} />
22
         <Cell title="定 位 点" value={issue?.addr} />
29
         <Cell title="定 位 点" value={issue?.addr} />
23
-        <Cell title="问题详情" />        
30
+        <Cell title="问题详情" />
24
         <Field
31
         <Field
25
           readonly
32
           readonly
26
           type="textarea"
33
           type="textarea"
27
-          autosize={{ minHeight: '120px' }}
34
+          autosize={{ minHeight: "120px" }}
28
           value={issue?.content}
35
           value={issue?.content}
29
-        /> 
30
-        <Cell
31
-          renderTitle={
32
-            <Uploader
33
-              disabled
34
-              value={issue?.attachList}
35
-            />
36
-          }
37
         />
36
         />
37
+        <Cell renderTitle={<Uploader disabled value={issue?.attachList} />} />
38
+        <Cell title="状态" value={bizStatus?.label}></Cell>
38
       </CellGroup>
39
       </CellGroup>
39
     </>
40
     </>
40
-  )
41
-}
41
+  );
42
+};

+ 2
- 2
src/pages/org/issue/detail/index.jsx View File

111
                   <Apply block type="primary" applyType={PROCESS_APPLY_END} orgIssue={orgIssue}>申请办结</Apply>
111
                   <Apply block type="primary" applyType={PROCESS_APPLY_END} orgIssue={orgIssue}>申请办结</Apply>
112
               }
112
               }
113
             </View>
113
             </View>
114
-            {
114
+            {/* {
115
               showApplyVerify && (
115
               showApplyVerify && (
116
                 <View style={{marginTop: '20px'}}>
116
                 <View style={{marginTop: '20px'}}>
117
                   <Apply block type="primary" applyType={PROCESS_APPLY_VERIFY} orgIssue={orgIssue}>申请审核</Apply>
117
                   <Apply block type="primary" applyType={PROCESS_APPLY_VERIFY} orgIssue={orgIssue}>申请审核</Apply>
118
                 </View>
118
                 </View>
119
               )
119
               )
120
-            }
120
+            } */}
121
             <View style={{marginTop: '20px', display: 'flex' }}>
121
             <View style={{marginTop: '20px', display: 'flex' }}>
122
               <Apply
122
               <Apply
123
                 block
123
                 block

+ 20
- 17
src/pages/org/issue/detail2/components/Order.jsx View File

34
       return 0;
34
       return 0;
35
     });
35
     });
36
     return sortedSteps.map((it, index, array) => {
36
     return sortedSteps.map((it, index, array) => {
37
-      const { value: bizStatus = 0, label: statusText } = getIssueStatus({
38
-        ...(it || {}),
39
-        expireDate: it?.createDate,
40
-        processNode: it?.processNode || it?.applyType,
41
-        processStatus: it?.processStatus || it?.verifyStatus || APPLY_READY,
42
-      });
43
-      const [bg1, bg2] = colors[bizStatus];
37
+      // const { value: bizStatus = 0, label: statusText } = getIssueStatus({
38
+      //   ...(it || {}),
39
+      //   expireDate: it?.createDate,
40
+      //   processNode: it?.processNode || it?.applyType,
41
+      //   processStatus: it?.processStatus || it?.verifyStatus || APPLY_READY,
42
+      // });
43
+      // const [bg1, bg2] = colors[bizStatus];
44
 
44
 
45
       let nextOrgName = null;
45
       let nextOrgName = null;
46
       if (index == 0) {
46
       if (index == 0) {
47
-        nextOrgName = "平台管理员";
47
+        nextOrgName = "平台";
48
       } else if (index <= array.length - 1) {
48
       } else if (index <= array.length - 1) {
49
         nextOrgName = array[index - 1].orgName;
49
         nextOrgName = array[index - 1].orgName;
50
       }
50
       }
51
       return (
51
       return (
52
         <View key={it.orgIssueId} className={styles["page_order"]}>
52
         <View key={it.orgIssueId} className={styles["page_order"]}>
53
           <Cell
53
           <Cell
54
-            value={dayjs(it.createDate).format("YYYY-MM-DD HH:mm:ss")}
55
-            renderTitle={
56
-              <View>
57
-                
58
-
59
-                <View className="title">
60
-                  {nextOrgName} {"---->"} {it.orgName}
61
-                  <Tag plain={true} style={{ color: bg2 }}>{statusText}</Tag>
54
+            title={
55
+              <>
56
+                <View>{nextOrgName}</View>
57
+                <View>
58
+                  {dayjs(it.createDate).format("YYYY-MM-DD HH:mm:ss")}
62
                 </View>
59
                 </View>
63
-              </View>
60
+              </>
61
+            }
62
+            renderRightIcon={
63
+              <>
64
+                <View>{it.orgName}</View>
65
+                <View>&ensp;&ensp;</View>
66
+              </>
64
             }
67
             }
65
           />
68
           />
66
           {/* <View className={styles["org_order"]}>
69
           {/* <View className={styles["org_order"]}>

+ 0
- 1
src/pages/org/issue/detail2/index.jsx View File

76
   return (
76
   return (
77
     <Page loading={loading}>
77
     <Page loading={loading}>
78
       <IssueInfo issue={issue} />
78
       <IssueInfo issue={issue} />
79
-
80
     <Order id={id}/>
79
     <Order id={id}/>
81
 
80
 
82
       {/* <CellGroup style={{marginTop: '20px'}}>
81
       {/* <CellGroup style={{marginTop: '20px'}}>

+ 16
- 29
src/store/user.js View File

31
   };
31
   };
32
 
32
 
33
   const updateDuty = (d = ROLE_CITIZEN) => {
33
   const updateDuty = (d = ROLE_CITIZEN) => {
34
-    try {
35
-      setDuty(d);
36
-      Taro.setStorageSync("duty", d);
37
-    } catch (e) {
38
-      console.log(e);
39
-    }
34
+    setDuty(d);
35
+    Taro.setStorageSync("duty", d);
40
   };
36
   };
41
 
37
 
42
   const initDuty = (u) => {
38
   const initDuty = (u) => {
43
     console.log(u);
39
     console.log(u);
44
-    let d;
45
-    try {
46
-      d = Taro.getStorageSync("duty");
47
-    } catch (error) {
48
-      console.error("读取存储中'duty'失败:", error);
49
-      // 根据业务需求考虑是否需要进行错误处理或通知用户
50
-    }
40
+    const d = Taro.getStorageSync("duty");
41
+    console.log(d);
51
     const dutyList = u?.dutyList || [];
42
     const dutyList = u?.dutyList || [];
52
-    const firstDuty = dutyList[0];
53
-
54
     if (d) {
43
     if (d) {
55
       if (dutyList.indexOf(d) < 0) {
44
       if (dutyList.indexOf(d) < 0) {
56
-        console.log(firstDuty);
57
-        updateDuty(firstDuty);
45
+        updateDuty(dutyList[0]);
58
       } else {
46
       } else {
59
         updateDuty(d);
47
         updateDuty(d);
60
       }
48
       }
61
     } else {
49
     } else {
62
-      updateDuty(firstDuty);
50
+      updateDuty(dutyList[0]);
63
     }
51
     }
64
   };
52
   };
65
 
53
 
77
 
65
 
78
   const maSignup = (data) => {
66
   const maSignup = (data) => {
79
     return new Promise((resolve, reject) => {
67
     return new Promise((resolve, reject) => {
80
-      signup(data)
81
-        .then((res) => {
82
-          setPerson(res.person);
83
-          setUser(res.user);
84
-          initDuty(res.user);
85
-          resolve(res);
86
-        })
87
-        .catch(reject);
68
+      signup(data).then(res => {
69
+        setPerson(res.person);
70
+        setUser(res.user);
71
+        initDuty(res.user);
72
+        resolve(res);
73
+      }).catch(reject);
88
     });
74
     });
89
-  };
75
+  }
90
 
76
 
91
   const current = () => {
77
   const current = () => {
92
     return new Promise((resolve, reject) => {
78
     return new Promise((resolve, reject) => {
123
   };
109
   };
124
 
110
 
125
   const signOut = () => {
111
   const signOut = () => {
126
-    console.log(111111);
112
+    console.log(111111)
127
     setPerson(null);
113
     setPerson(null);
128
     setUser(null);
114
     setUser(null);
129
     initDuty(null);
115
     initDuty(null);
141
 
127
 
142
     changePassword(data)
128
     changePassword(data)
143
       .then((res) => {
129
       .then((res) => {
144
-        signOut();
130
+        signOut()
131
+
145
       })
132
       })
146
       .catch((e) => {
133
       .catch((e) => {
147
         console.error(e);
134
         console.error(e);

+ 21
- 21
src/utils/biz.js View File

34
 
34
 
35
 
35
 
36
 export function getIssueStatus (taIssue) {
36
 export function getIssueStatus (taIssue) {
37
+console.log(taIssue)
38
+  const isExpired = dayjs(taIssue?.expireDate).format('YYYY-MM-DD') < dayjs().format('YYYY-MM-DD');
37
 
39
 
38
-  const isExpired = dayjs(taIssue.expireDate).format('YYYY-MM-DD') < dayjs().format('YYYY-MM-DD');
39
-
40
-  if (taIssue.processStatus === APPLY_REJECT) {
40
+  if (taIssue?.processStatus === APPLY_REJECT) {
41
     return {
41
     return {
42
       value: 4,
42
       value: 4,
43
       label: '已打回',
43
       label: '已打回',
44
     };
44
     };
45
-  } else if (taIssue.processNode === PROCESS_START) {
45
+  } else if (taIssue?.processNode === PROCESS_START) {
46
 
46
 
47
     if (isExpired) {
47
     if (isExpired) {
48
       return {
48
       return {
55
       value: 0,
55
       value: 0,
56
       label: '待交办',
56
       label: '待交办',
57
     }
57
     }
58
-  } else if (taIssue.processNode === PROCESS_END) {
59
-    if (dayjs(taIssue.expireDate).format('YYYY-MM-DD') < dayjs(taIssue.endDate).format('YYYY-MM-DD')) {
58
+  } else if (taIssue?.processNode === PROCESS_END) {
59
+    if (dayjs(taIssue?.expireDate).format('YYYY-MM-DD') < dayjs(taIssue?.endDate).format('YYYY-MM-DD')) {
60
       return {
60
       return {
61
         value: 5,
61
         value: 5,
62
         label: '逾期办结',
62
         label: '逾期办结',
67
       value: 2,
67
       value: 2,
68
       label: '已办结',
68
       label: '已办结',
69
     };
69
     };
70
-  } else if (taIssue.processNode.indexOf(PROCESS_ASSIGNED) === 0) {
71
-    if (taIssue.processStatus === APPLY_READY) {
72
-      if (taIssue.processNode === PROCESS_APPLY_REJECT) {
70
+  } else if (taIssue?.processNode.indexOf(PROCESS_ASSIGNED) === 0) {
71
+    if (taIssue?.processStatus === APPLY_READY) {
72
+      if (taIssue?.processNode === PROCESS_APPLY_REJECT) {
73
         return {
73
         return {
74
           value: 1,
74
           value: 1,
75
           label: '驳回申请',
75
           label: '驳回申请',
76
         };
76
         };
77
-      } else if (taIssue.processNode === PROCESS_APPLY_DELAY) {
77
+      } else if (taIssue?.processNode === PROCESS_APPLY_DELAY) {
78
         return {
78
         return {
79
           value: 1,
79
           value: 1,
80
           label: '延期申请',
80
           label: '延期申请',
81
         };
81
         };
82
-      } else if (taIssue.processNode === PROCESS_APPLY_VERIFY) {
82
+      } else if (taIssue?.processNode === PROCESS_APPLY_VERIFY) {
83
         return {
83
         return {
84
           value: 1,
84
           value: 1,
85
           label: '审核申请',
85
           label: '审核申请',
86
         };
86
         };
87
-      } else if (taIssue.processNode === PROCESS_APPLY_END) {
87
+      } else if (taIssue?.processNode === PROCESS_APPLY_END) {
88
         return {
88
         return {
89
           value: 1,
89
           value: 1,
90
           label: '消单申请',
90
           label: '消单申请',
95
         //   label: '待处理',
95
         //   label: '待处理',
96
         // };
96
         // };
97
       }
97
       }
98
-    } else if (taIssue.processStatus === APPLY_PASS) {
99
-      if (taIssue.processNode === PROCESS_APPLY_REJECT) {
98
+    } else if (taIssue?.processStatus === APPLY_PASS) {
99
+      if (taIssue?.processNode === PROCESS_APPLY_REJECT) {
100
         return {
100
         return {
101
           value: 1,
101
           value: 1,
102
           label: '驳回申请通过',
102
           label: '驳回申请通过',
103
         };
103
         };
104
-      } else if (taIssue.processNode === PROCESS_APPLY_DELAY) {
104
+      } else if (taIssue?.processNode === PROCESS_APPLY_DELAY) {
105
         return {
105
         return {
106
           value: 1,
106
           value: 1,
107
           label: '延期申请通过',
107
           label: '延期申请通过',
108
         };
108
         };
109
-      } else if (taIssue.processNode === PROCESS_APPLY_VERIFY) {
109
+      } else if (taIssue?.processNode === PROCESS_APPLY_VERIFY) {
110
         return {
110
         return {
111
           value: 1,
111
           value: 1,
112
           label: '审核申请通过',
112
           label: '审核申请通过',
113
         };
113
         };
114
-      } else if (taIssue.processNode === PROCESS_APPLY_END) {
114
+      } else if (taIssue?.processNode === PROCESS_APPLY_END) {
115
         return {
115
         return {
116
           value: 1,
116
           value: 1,
117
           label: '消单申请通过',
117
           label: '消单申请通过',
118
         };
118
         };
119
       }
119
       }
120
     } else {
120
     } else {
121
-      if (taIssue.processNode === PROCESS_APPLY_REJECT) {
121
+      if (taIssue?.processNode === PROCESS_APPLY_REJECT) {
122
         return {
122
         return {
123
           value: 1,
123
           value: 1,
124
           label: '驳回申请驳回',
124
           label: '驳回申请驳回',
125
         };
125
         };
126
-      } else if (taIssue.processNode === PROCESS_APPLY_DELAY) {
126
+      } else if (taIssue?.processNode === PROCESS_APPLY_DELAY) {
127
         return {
127
         return {
128
           value: 1,
128
           value: 1,
129
           label: '延期申请驳回',
129
           label: '延期申请驳回',
130
         };
130
         };
131
-      } else if (taIssue.processNode === PROCESS_APPLY_VERIFY) {
131
+      } else if (taIssue?.processNode === PROCESS_APPLY_VERIFY) {
132
         return {
132
         return {
133
           value: 1,
133
           value: 1,
134
           label: '审核申请驳回',
134
           label: '审核申请驳回',
135
         };
135
         };
136
-      } else if (taIssue.processNode === PROCESS_APPLY_END) {
136
+      } else if (taIssue?.processNode === PROCESS_APPLY_END) {
137
         return {
137
         return {
138
           value: 1,
138
           value: 1,
139
           label: '消单申请驳回',
139
           label: '消单申请驳回',