Your Name 2 gadus atpakaļ
vecāks
revīzija
364a7563d7

+ 4
- 2
src/app.config.js Parādīt failu

@@ -4,11 +4,13 @@ export default defineAppConfig({
4 4
     'pages/home/index',
5 5
     'pages/login/index',
6 6
     'pages/issue/list/index',
7
-    'pages/issue/detail/index',
7
+    'pages/issue/list2/index',
8
+    'pages/issue/edit/index',
9
+    'pages/org/issue/list/index',
10
+    'pages/org/issue/detail/index',
8 11
     'pages/index3/index',
9 12
     'pages/index4/index',
10 13
     'pages/index5/index',
11
-    'pages/issue/add/index',
12 14
     'pages/reporting/index',
13 15
     'pages/reporting/detail/index',
14 16
     'pages/reset-password/index',

+ 19
- 0
src/components/DatePicker/index.jsx Parādīt failu

@@ -0,0 +1,19 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { Popup, DatetimePicker } from '@antmjs/vantui';
5
+
6
+export default (props) => {
7
+  const { show, onCancel, onChange, ...leftProps } = props;
8
+
9
+  const onConfirm = (e) => {
10
+    const dt = new Date(e.detail.value);
11
+    onChange(dt);
12
+  }
13
+  
14
+  return (
15
+    <Popup show={show} position="bottom" onClose={onCancel}>
16
+      <DatetimePicker {...leftProps} onConfirm={onConfirm} />
17
+    </Popup>
18
+  )
19
+}

src/pages/issue/components/Card/index.jsx → src/components/IssueCard/index.jsx Parādīt failu


src/pages/issue/components/Card/style.module.less → src/components/IssueCard/style.module.less Parādīt failu


+ 9
- 0
src/components/OrgPicker/index.jsx Parādīt failu

@@ -0,0 +1,9 @@
1
+import React from 'react';
2
+import Pickerful from '@/components/Pickerful';
3
+import { getSysOrg } from '@/services/sysorg';
4
+
5
+export default (props) => {
6
+  return (
7
+    <Pickerful {...props} keyValue="orgId" dictAPI={getSysOrg} />
8
+  )
9
+}

+ 87
- 105
src/layouts/TabBar.jsx Parādīt failu

@@ -2,6 +2,14 @@ import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import { Image } from '@tarojs/components';
4 4
 import { Tabbar, TabbarItem } from '@antmjs/vantui';
5
+import {
6
+  ROLE_INSPECTOR,
7
+  ROLE_MANAGER,
8
+  ROLE_ORG_USER,
9
+  ROLE_ORG_MANAGER,
10
+  ROLE_QUERY_PERSON,
11
+  ROLE_CITIZEN
12
+} from '@/utils/user';
5 13
 import homeIcon from '@/assets/tabbar/page.png';
6 14
 import homeActiveIcon from '@/assets/tabbar/page click.png';
7 15
 import noticeIcon from '@/assets/tabbar/notice.png';
@@ -13,21 +21,66 @@ import checkActiveIcon from '@/assets/tabbar/evaluation click.png';
13 21
 import mineIcon from '@/assets/tabbar/my.png';
14 22
 import mineActiveIcon from '@/assets/tabbar/my click.png';
15 23
 
16
-const tabPages = {
17
-  home: '/pages/home/index',
18
-  notice: '/pages/index3/index',
19
-  issue: '/pages/issue/add/index',
20
-  check: '/pages/index4/index',
21
-  mine: '/pages/index5/index',
24
+const home = {
25
+  name: 'home',
26
+  label: '首页',
27
+  icon: homeIcon,
28
+  activeIcon: homeActiveIcon,
29
+  page: '/pages/home/index'
30
+}
31
+const notice = {
32
+  name: 'notice',
33
+  label: '公告',
34
+  icon: noticeIcon,
35
+  activeIcon: noticeActiveIcon,
36
+  page: '/pages/index3/index'
37
+}
38
+const issue = {
39
+  name: 'issue',
40
+  label: '发布',
41
+  icon: issueIcon,
42
+  activeIcon: issueActiveIcon,
43
+  page: '/pages/issue/edit/index'
44
+}
45
+const check = {
46
+  name: 'check',
47
+  label: '测评标准',
48
+  icon: checkIcon,
49
+  activeIcon: checkActiveIcon,
50
+  page: '/pages/index4/index'
51
+}
52
+const mine = {
53
+  name: 'mine',
54
+  label: '我的',
55
+  icon: mineIcon,
56
+  activeIcon: mineActiveIcon,
57
+  page: '/pages/index5/index'
22 58
 }
23 59
 
24 60
 export default (props) => {
25
-  const { active = -1, className } = props;
61
+  const { active = -1, className, user } = props;
62
+
63
+  const tabItems = React.useMemo(() => {
64
+    if (!user) return [];
65
+    
66
+    if (user.dutyList.indexOf(ROLE_INSPECTOR) > -1 // 督察员
67
+      || user.dutyList.indexOf(ROLE_MANAGER) > -1 // 管理员
68
+    ) {
69
+      return [
70
+        home,
71
+        notice,
72
+        issue,
73
+        check,
74
+        mine
75
+      ]
76
+    }
77
+
78
+    return [];
79
+  }, [user]);
26 80
 
27 81
   const onChange = (e) => {
28
-    Taro.reLaunch({
29
-      url: tabPages[e.detail]
30
-    })
82
+    const url = tabItems.filter(x => x.name === e.detail)[0].page;
83
+    Taro.reLaunch({ url })
31 84
   }
32 85
 
33 86
   return (
@@ -37,101 +90,30 @@ export default (props) => {
37 90
       active={active}
38 91
       onChange={onChange}
39 92
     >
40
-      <TabbarItem
41
-        name="home"
42
-        renderIcon={
43
-          <Image
44
-            src={homeIcon}
45
-            mode="aspectFit"
46
-            style="width: 30px; height: 18px;"
47
-          ></Image>
48
-        }
49
-        renderIconActive={
50
-          <Image
51
-            src={homeActiveIcon}
52
-            mode="aspectFit"
53
-            style="width: 30px; height: 18px;"
54
-          ></Image>
55
-        }
56
-      >
57
-        首页
58
-      </TabbarItem>
59
-      <TabbarItem
60
-        name="notice"
61
-        renderIcon={
62
-          <Image
63
-            src={noticeIcon}
64
-            mode="aspectFit"
65
-            style="width: 30px; height: 18px;"
66
-          ></Image>
67
-        }
68
-        renderIconActive={
69
-          <Image
70
-            src={noticeActiveIcon}
71
-            mode="aspectFit"
72
-            style="width: 30px; height: 18px;"
73
-          ></Image>
74
-        }
75
-      >
76
-        公告
77
-      </TabbarItem>
78
-      <TabbarItem
79
-        name="issue"
80
-        renderIcon={
81
-          <Image
82
-            src={issueIcon}
83
-            mode="aspectFit"
84
-            style="width: 30px; height: 18px;"
85
-          ></Image>
86
-        }
87
-        renderIconActive={
88
-          <Image
89
-            src={issueActiveIcon}
90
-            mode="aspectFit"
91
-            style="width: 30px; height: 18px;"
92
-          ></Image>
93
-        }
94
-      >
95
-        发布
96
-      </TabbarItem>
97
-      <TabbarItem
98
-        name="check"
99
-        renderIcon={
100
-          <Image
101
-            src={checkIcon}
102
-            mode="aspectFit"
103
-            style="width: 30px; height: 18px;"
104
-          ></Image>
105
-        }
106
-        renderIconActive={
107
-          <Image
108
-            src={checkActiveIcon}
109
-            mode="aspectFit"
110
-            style="width: 30px; height: 18px;"
111
-          ></Image>
112
-        }
113
-      >
114
-        测评标准
115
-      </TabbarItem>
116
-      <TabbarItem
117
-        name="mine"
118
-        renderIcon={
119
-          <Image
120
-            src={mineIcon}
121
-            mode="aspectFit"
122
-            style="width: 30px; height: 18px;"
123
-          ></Image>
124
-        }
125
-        renderIconActive={
126
-          <Image
127
-            src={mineActiveIcon}
128
-            mode="aspectFit"
129
-            style="width: 30px; height: 18px;"
130
-          ></Image>
131
-        }
132
-      >
133
-        我的
134
-      </TabbarItem>
93
+      {
94
+        tabItems.map(item => (
95
+          <TabbarItem
96
+            key={item.name}
97
+            name={item.name}
98
+            renderIcon={
99
+              <Image
100
+                src={item.icon}
101
+                mode="aspectFit"
102
+                style="width: 30px; height: 18px;"
103
+              ></Image>
104
+            }
105
+            renderIconActive={
106
+              <Image
107
+                src={item.activeIcon}
108
+                mode="aspectFit"
109
+                style="width: 30px; height: 18px;"
110
+              ></Image>
111
+            }
112
+          >
113
+            {item.label}
114
+          </TabbarItem>
115
+        ))
116
+      }
135 117
     </Tabbar>
136 118
   )
137 119
 }

+ 1
- 1
src/layouts/index.jsx Parādīt failu

@@ -50,7 +50,7 @@ export default (props) => {
50 50
         }
51 51
       </View>
52 52
       {
53
-        tabBar && <TabBar className={laySty['page-tabbar']} active={tabBar} />
53
+        tabBar && <TabBar className={laySty['page-tabbar']} active={tabBar} user={user} />
54 54
       }
55 55
     </View>
56 56
   )

+ 0
- 49
src/pages/issue/add/components/Assigned.jsx Parādīt failu

@@ -1,49 +0,0 @@
1
-import React from 'react';
2
-import Taro from '@tarojs/taro';
3
-import { View } from '@tarojs/components';
4
-import { Button } from '@antmjs/vantui';
5
-import { putTaIssue } from '@/services/taissue';
6
-import { warn } from '@/utils/message';
7
-import style from './style.module.less';
8
-
9
-export default (props) => {
10
-
11
-  const { issue, formData } = props;
12
-
13
-  const [loading, setLoading] = React.useState(false);
14
-  
15
-  // 新增问题单
16
-  const onSubmit = () => {
17
-    try {
18
-      warn(!formData.addr, '请填写地址')
19
-      warn(!formData.locId, '请选择点位')
20
-      warn(!formData.content, '请填写问题描述')
21
-      warn(!formData.typeId, '请选择问题分类')
22
-      warn(!formData.attachList || formData.attachList.length < 1, '请上传照片')
23
-    } catch (e) {
24
-      return;
25
-    }
26
-
27
-    setLoading(true)
28
-    putTaIssue(issue.issueId, { ...issue, formData }).then(() => {
29
-      setLoading(false);
30
-      Taro.navigateBack({delta: 1});
31
-    }).catch(() => {
32
-      setLoading(false);
33
-    })
34
-  }
35
-  
36
-  return (
37
-    <View class={style['assigned-btn-wrapper']}>
38
-      <View>
39
-        <Button square plain type="danger" loading={loading} onClick={onSubmit}>删除</Button>
40
-      </View>
41
-      <View>
42
-        <Button block square plain hairline type="info" loading={loading} onClick={onSubmit}>打回</Button>
43
-      </View>
44
-      <View>          
45
-        <Button block square type="primary" loading={loading} onClick={onSubmit}>交办</Button>
46
-      </View>
47
-    </View>
48
-  )
49
-}

+ 0
- 19
src/pages/issue/add/components/style.module.less Parādīt failu

@@ -1,19 +0,0 @@
1
-
2
-
3
-.assigned-btn-wrapper {
4
-  display: flex;
5
-  background: #fff;
6
-  padding: 10px;
7
-  
8
-  & > view {
9
-    flex: 1;
10
-
11
-    &:first-child {
12
-      flex: 2;
13
-    }
14
-  
15
-    & + view {
16
-      margin-left: 10px;
17
-    }
18
-  }
19
-}

+ 92
- 8
src/pages/issue/components/Issue/index.jsx Parādīt failu

@@ -2,15 +2,27 @@ import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import { View } from '@tarojs/components';
4 4
 import { Button, Notify, Field, Cell, CellGroup } from '@antmjs/vantui';
5
-import LocType from '@/components/locType';
6
-import IssueType from '@/components/issueType';
5
+import LocType from '@/components/LocType';
6
+import IssueType from '@/components/IssueType';
7
+import OrgPicker from '@/components/OrgPicker';
8
+import DatePicker from '@/components/DatePicker';
7 9
 import Map from '@/components/map';
8 10
 import Uploader from '@/components/Uploader/index';
9 11
 import { getIssueStatus } from '@/utils/biz';
12
+import { getDateStr } from '@/utils/date';
10 13
 import mapIcon from '@/assets/icons/marker.png';
11 14
 
15
+const today = new Date();
16
+
12 17
 export default (props) => {
13
-  const { issue, readOnly, renderFields, renderAction } = props;
18
+  const {
19
+    issue,
20
+    readOnly,
21
+    showOrg,
22
+    showExpireDate,
23
+    renderFields,
24
+    renderAction
25
+  } = props;
14 26
 
15 27
   const [formData, setFormData] = React.useState({
16 28
     typeId: undefined,
@@ -24,6 +36,8 @@ export default (props) => {
24 36
   });
25 37
   const [showLocType, setShowLocType] = React.useState(false);
26 38
   const [showIssueType, setShowIssueType] = React.useState(false);
39
+  const [showOrgPicker, setShowOrgPicker] = React.useState(false);
40
+  const [showDatePicker, setShowDatePicker] = React.useState(false);
27 41
   const [bizStatus, setBizStatus] = React.useState();
28 42
   
29 43
   const onLocTypeChange = (_, it) => {
@@ -44,7 +58,25 @@ export default (props) => {
44 58
     setShowIssueType(false);
45 59
   }
46 60
 
47
-  const onFieldChange = (field, value) => {
61
+  const onOrgChange = (_, it) => {
62
+    setFormData({
63
+      ...formData,
64
+      orgId: it.orgId,
65
+      orgName: it.name,
66
+    });
67
+    setShowOrgPicker(false);
68
+  }
69
+
70
+  const onDateChange = (dt) => {
71
+    const date = getDateStr(dt);
72
+    setFormData({
73
+      ...formData,
74
+      expireDate: date,
75
+    });
76
+    setShowDatePicker(false);
77
+  }
78
+
79
+  const setFieldChange = (field, value) => {
48 80
     setFormData({
49 81
       ...formData,
50 82
       [field]: value,
@@ -74,6 +106,22 @@ export default (props) => {
74 106
         onChange={onIssueTypeChange}
75 107
       />
76 108
 
109
+      <OrgPicker
110
+        show={showOrgPicker}
111
+        value={formData.orgName}
112
+        onCancel={() => setShowOrgPicker(false)}
113
+        onChange={onOrgChange}
114
+      />
115
+
116
+      <DatePicker
117
+        type="date"
118
+        minDate={today}
119
+        show={showDatePicker}
120
+        value={formData.expireDate}
121
+        onCancel={() => setShowDatePicker(false)}
122
+        onChange={onDateChange}
123
+      />
124
+
77 125
       <Map location={formData.location} />
78 126
 
79 127
       <CellGroup>
@@ -88,7 +136,7 @@ export default (props) => {
88 136
           value={formData.addr}
89 137
           leftIcon={mapIcon}
90 138
           readonly={readOnly}
91
-          onChange={e => onFieldChange('addr', e.detail)}
139
+          onChange={e => setFieldChange('addr', e.detail)}
92 140
         />
93 141
       </CellGroup>
94 142
 
@@ -119,7 +167,7 @@ export default (props) => {
119 167
           readonly={readOnly}
120 168
           autosize={{ minHeight: '120px' }}
121 169
           value={formData.content}
122
-          onChange={e => onFieldChange('content', e.detail)}
170
+          onChange={e => setFieldChange('content', e.detail)}
123 171
         />
124 172
       </CellGroup>
125 173
             
@@ -131,14 +179,50 @@ export default (props) => {
131 179
             <Uploader
132 180
               value={formData.attachList}
133 181
               disabled={readOnly}
134
-              onChange={e => onFieldChange('attachList',e)}
182
+              onChange={e => setFieldChange('attachList',e)}
135 183
             />
136 184
           }
137 185
         />
138 186
       </CellGroup>
139 187
 
140 188
       {
141
-        renderFields ? renderFields(formData, setFormData) : null
189
+        (showOrg || showExpireDate) && (
190
+          <CellGroup style={{marginTop: '20px'}}>
191
+            {
192
+              showOrg && (
193
+                <Cell
194
+                  title="交办单位"
195
+                  isLink={!readOnly}
196
+                  value={formData.orgName}
197
+                  onClick={() => !readOnly && setShowOrgPicker(true)}
198
+                />
199
+              )
200
+            }
201
+            {
202
+              showExpireDate && (
203
+                <Cell
204
+                  title="办结时间"
205
+                  isLink={!readOnly}
206
+                  value={formData.expireDate}
207
+                  onClick={() => !readOnly && setShowDatePicker(true)}
208
+                />
209
+              )
210
+            }
211
+          </CellGroup>
212
+        )
213
+      }
214
+
215
+      {
216
+        renderFields ?
217
+          renderFields(
218
+            formData,
219
+            {
220
+              setFieldChange,
221
+              setFormData,
222
+              showOrgPicker,
223
+              setShowOrgPicker,
224
+            }
225
+          ) : null
142 226
       }
143 227
 
144 228
       {

+ 0
- 51
src/pages/issue/detail/index.jsx Parādīt failu

@@ -1,51 +0,0 @@
1
-import React from 'react';
2
-import Taro from '@tarojs/taro';
3
-import { View, RichText } from '@tarojs/components';
4
-import { Button, Notify, Field, Cell, CellGroup } from '@antmjs/vantui';
5
-import Page from '@/layouts/index';
6
-import Map from '@/components/map';
7
-import Uploader from '@/components/Uploader/index';
8
-import { ROLE_INSPECTOR } from '@/utils/user';
9
-import mapIcon from '@/assets/icons/marker.png';
10
-import { getTaIssueById } from '@/services/taissue';
11
-import IssueDetail from '../components/Issue';
12
-import style from './style.module.less';
13
-
14
-export default (props) => {
15
-
16
-  const router = Taro.useRouter();
17
-  const { id } = router.params;
18
-  
19
-  const [issue, setIssue] = React.useState(false);
20
-  const [loading, setLoading] = React.useState(false);
21
-
22
-  // const [
23
-  //   content,
24
-  //   bizStatus
25
-  // ] = React.useMemo(() => {
26
-  //   if (!formData || !formData.issueId) return [];
27
-
28
-  //   return [
29
-  //     (formData.content || '').replace('\r\n', '<br>').replace('\n', '<br>'),
30
-  //     getIssueStatus(formData).label,
31
-  //   ]
32
-  // }, [formData])
33
-
34
-  React.useEffect(() => {
35
-    if (id) {
36
-      setLoading(true)
37
-      getTaIssueById(id).then(res => {
38
-        setLoading(false);
39
-        setIssue(res);
40
-      }).catch(() => {
41
-        setLoading(false);
42
-      });
43
-    }
44
-  }, [id]);
45
-
46
-  return (
47
-    <Page roles={[ROLE_INSPECTOR]} loading={loading}>
48
-      <IssueDetail readOnly issue={issue} />
49
-    </Page>
50
-  )
51
-}

+ 0
- 10
src/pages/issue/detail/style.module.less Parādīt failu

@@ -1,10 +0,0 @@
1
-
2
-.issue-content {
3
-  padding: 0 24px;
4
-  padding-left: 60px;
5
-  rich-text {
6
-    line-height: 70px;
7
-    font-size: 24px;
8
-    color: #202020;
9
-  }
10
-}

+ 132
- 0
src/pages/issue/edit/components/Assigned.jsx Parādīt failu

@@ -0,0 +1,132 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { Button, Popup, CellGroup, Cell, Field } from '@antmjs/vantui';
5
+import { postIssueAssigned, deleteTaIssue, postIssueRejct } from '@/services/taissue';
6
+import { warn } from '@/utils/message';
7
+import style from './style.module.less';
8
+
9
+export default (props) => {
10
+
11
+  const { issue, formData } = props;
12
+
13
+  const [loading1, setLoading1] = React.useState(false);
14
+  const [loading2, setLoading2] = React.useState(false);
15
+  const [loading3, setLoading3] = React.useState(false);
16
+  const [show, setShow] = React.useState(false);
17
+  const [processResult, setProcessResult] = React.useState();
18
+  
19
+  // 交办
20
+  const onAssigned = () => {
21
+    try {
22
+      warn(!formData.addr, '请填写地址')
23
+      warn(!formData.locId, '请选择点位')
24
+      warn(!formData.content, '请填写问题描述')
25
+      warn(!formData.typeId, '请选择问题分类')
26
+      warn(!formData.attachList || formData.attachList.length < 1, '请上传照片')
27
+      warn(!formData.orgId, '请选择交办单位')
28
+      warn(!formData.expireDate, '请选择办结时间')
29
+    } catch (e) {
30
+      return;
31
+    }
32
+
33
+    setLoading1(true)
34
+    postIssueAssigned({ ...issue, formData }).then(() => {
35
+      setLoading1(false);
36
+      Taro.navigateBack({delta: 1});
37
+    }).catch(() => {
38
+      setLoading1(false);
39
+    })
40
+  }
41
+
42
+  const onDelete = () => {
43
+    Taro.showModal({
44
+      title: '删除',
45
+      content: '确定进行删除操作?',
46
+      success (res) {
47
+        if (res.confirm) {
48
+          setLoading2(true)
49
+          deleteTaIssue(issue.issueId).then(() => {
50
+            setLoading2(false);
51
+            Taro.navigateBack({delta: 1});
52
+          }).catch(() => {
53
+            setLoading2(false);
54
+          })
55
+        }
56
+      }
57
+    })
58
+  }
59
+
60
+  const onReject = () => {
61
+    try {
62
+      warn(!processResult, '请填写退单理由')
63
+    } catch (e) {
64
+      return;
65
+    }
66
+
67
+    setShow(false);
68
+
69
+    const data = {
70
+      processResult,
71
+      issueId: issue.issueId,
72
+    }
73
+
74
+    setLoading3(true)
75
+    postIssueRejct(data).then(() => {
76
+      setLoading3(false);
77
+      Taro.navigateBack({delta: 1});
78
+    }).catch(() => {
79
+      setLoading3(false);
80
+    })
81
+  }
82
+  
83
+  return (
84
+    <View class={style['assigned-btn-wrapper']}>
85
+      <Popup position="bottom" show={show} onClose={() => setShow(false)}>
86
+        <CellGroup>
87
+          <Cell title="退单理由" />
88
+          <Field
89
+            type="textarea"
90
+            placeholder="请输入退单理由"
91
+            value={processResult}
92
+            autosize={{ minHeight: '240px' }}
93
+            onChange={e => setProcessResult(e.detail)}
94
+          />
95
+          <View style={{display: 'flex', justifyContent: 'space-around'}}>
96
+            <Button plain type="default" onClick={() => setShow(false)}>取消</Button>
97
+            <Button plain type="primary" onClick={onReject}>确定</Button>
98
+          </View>
99
+        </CellGroup>
100
+      </Popup>
101
+      <View>          
102
+        <Button
103
+          block
104
+          type="primary"
105
+          loading={loading1}
106
+          disabled={loading2 && loading3}
107
+          onClick={onAssigned}
108
+        >交办</Button>
109
+      </View>
110
+      <View style={{marginTop: '20px', display: 'flex'}}>
111
+        <Button
112
+          plain
113
+          hairline
114
+          type="danger"
115
+          loading={loading2}
116
+          disabled={loading1 && loading3}
117
+          style={{ flex: 1 }}
118
+          onClick={onDelete}
119
+        >删除</Button>
120
+        <Button
121
+          plain
122
+          hairline
123
+          type="info"
124
+          loading={loading3}
125
+          disabled={loading1 && loading2}
126
+          style={{ flex: 1, marginLeft: 'var(--main-space)' }}
127
+          onClick={() => setShow(true)}
128
+        >退单</Button>
129
+      </View>
130
+    </View>
131
+  )
132
+}

src/pages/issue/add/components/Edit.jsx → src/pages/issue/edit/components/Edit.jsx Parādīt failu


src/pages/issue/add/components/Form.jsx → src/pages/issue/edit/components/Form.jsx Parādīt failu

@@ -2,8 +2,8 @@ import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import { View } from '@tarojs/components';
4 4
 import { Button, Notify, Field, Cell, CellGroup } from '@antmjs/vantui';
5
-import LocType from '@/components/locType';
6
-import IssueType from '@/components/issueType';
5
+import LocType from '@/components/LocType';
6
+import IssueType from '@/components/IssueType';
7 7
 import Map from '@/components/map';
8 8
 import Uploader from '@/components/Uploader/index';
9 9
 import mapIcon from '@/assets/icons/marker.png';

src/pages/issue/add/components/Save.jsx → src/pages/issue/edit/components/Save.jsx Parādīt failu


+ 6
- 0
src/pages/issue/edit/components/style.module.less Parādīt failu

@@ -0,0 +1,6 @@
1
+
2
+
3
+.assigned-btn-wrapper {
4
+  background: #fff;
5
+  padding: var(--main-space);  
6
+}

src/pages/issue/add/index.config.js → src/pages/issue/edit/index.config.js Parādīt failu


src/pages/issue/add/index.jsx → src/pages/issue/edit/index.jsx Parādīt failu

@@ -1,12 +1,14 @@
1 1
 import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import { Block } from '@tarojs/components';
4
+import { CellGroup, Cell } from '@antmjs/vantui';
4 5
 import Page from '@/layouts/index';
5 6
 import { ROLE_INSPECTOR, ROLE_MANAGER } from '@/utils/user';
6 7
 import { getTaIssueById } from '@/services/taissue';
7 8
 import IssueForm from '../components/Issue';
8 9
 import Save from './components/Save';
9 10
 import Edit from './components/Edit';
11
+import Assigned from './components/Assigned';
10 12
 
11 13
 export default (props) => {
12 14
 
@@ -29,13 +31,17 @@ export default (props) => {
29 31
   }, [id]);
30 32
 
31 33
   return (
32
-    <Page roles={[ROLE_INSPECTOR, ROLE_MANAGER]}>
34
+    <Page roles={[ROLE_INSPECTOR, ROLE_MANAGER]} loading={loading}>
33 35
       <IssueForm
34 36
         issue={issue}
37
+        readOnly={id&&!act}
38
+        showOrg={act === 'assigned'}
39
+        showExpireDate={act === 'assigned'}
35 40
         renderAction={(formData) => (
36 41
           <Block>
37 42
             {!id && <Save formData={formData} />}
38
-            {id && !act && <Edit issue={issue} formData={formData} />}
43
+            {act === 'edit' && <Edit issue={issue} formData={formData} />}
44
+            {act === 'assigned' && <Assigned issue={issue} formData={formData} />}
39 45
           </Block>
40 46
         )}
41 47
       />

+ 28
- 13
src/pages/issue/list/index.jsx Parādīt failu

@@ -4,33 +4,48 @@ import { View } from '@tarojs/components';
4 4
 import { Tab, Tabs } from '@antmjs/vantui';
5 5
 import Page from '@/layouts/index';
6 6
 import PowerList from '@/components/PowerList';
7
+import Card from '@/components/IssueCard';
7 8
 import { getTaIssue } from '@/services/taissue';
8
-import { ROLE_INSPECTOR } from '@/utils/user';
9
-import Card from '../components/Card';
9
+import { ROLE_INSPECTOR, ROLE_MANAGER } from '@/utils/user';
10
+import { useModel } from '@/store';
11
+import { getIssueStatus } from '@/utils/biz';
10 12
 
13
+// 只有督察员能看到当前页面
11 14
 export default (props) => {
15
+  const { user } = useModel('user');
12 16
 
13
-  const onClick = (item, act) => {
14
-    if (act) {
15
-      Taro.navigateTo({
16
-        url: `/pages/issue/detail/index?id=${item.issueId}&act=${act}`
17
-      })
18
-    } else {
19
-      Taro.navigateTo({
20
-        url: `/pages/issue/detail/index?id=${item.issueId}`
21
-      })
17
+  const onClick = (item) => {
18
+
19
+    let act = '';
20
+    const status = getIssueStatus(item);
21
+    
22
+    // 如果是管理员
23
+    if (user.dutyList.indexOf(ROLE_MANAGER) > -1) {
24
+      // 如果是待交办
25
+      if (status.value === 0) {
26
+        act = 'assigned';
27
+      }
28
+    } else if (user.dutyList.indexOf(ROLE_INSPECTOR) > -1) {
29
+      // 如果是待交办
30
+      if (status.value === 0) {
31
+        act = 'edit';
32
+      }
22 33
     }
34
+
35
+    Taro.navigateTo({
36
+      url: `/pages/issue/edit/index?id=${item.issueId}&act=${act}`
37
+    })
23 38
   }
24 39
   
25 40
   return (
26
-    <Page roles={[ROLE_INSPECTOR]}>
41
+    <Page>
27 42
       <Tabs sticky>
28 43
         <Tab title="全部">
29 44
           <PowerList
30 45
             request={getTaIssue}
31 46
             params={{mine: true}}
32 47
             renderItem={(item) => (
33
-              <Card key={item.issueId} detail={item} onClick={() => onClick(item, 'assigned')} />
48
+              <Card key={item.issueId} detail={item} onClick={() => onClick(item)} />
34 49
             )}
35 50
           />
36 51
         </Tab>

src/pages/issue/detail/index.config.js → src/pages/issue/list2/index.config.js Parādīt failu

@@ -1,4 +1,4 @@
1 1
 // eslint-disable-next-line no-undef
2 2
 export default definePageConfig({
3
-  navigationBarTitleText: '问题单详情'
3
+  navigationBarTitleText: '问题列表'
4 4
 })

+ 72
- 0
src/pages/issue/list2/index.jsx Parādīt failu

@@ -0,0 +1,72 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { Tab, Tabs } from '@antmjs/vantui';
5
+import Page from '@/layouts/index';
6
+import PowerList from '@/components/PowerList';
7
+import Card from '@/components/IssueCard';
8
+import { getTaIssue } from '@/services/taissue';
9
+import { ROLE_MANAGER } from '@/utils/user';
10
+import { useModel } from '@/store';
11
+import { getIssueStatus } from '@/utils/biz';
12
+
13
+export default (props) => {
14
+
15
+  const router = Taro.useRouter();
16
+  const { title } = router.params;
17
+
18
+  React.useMemo(() => {
19
+    if (title) {
20
+      Taro.setNavigationBarTitle({ title });
21
+    } else {
22
+      Taro.setNavigationBarTitle({ title: '问题列表' });
23
+    }
24
+  }, [title]);
25
+
26
+  const { user } = useModel('user');
27
+
28
+  const onClick = (item) => {
29
+
30
+    let act = '';
31
+    const status = getIssueStatus(item);
32
+
33
+    // 如果是管理员
34
+    if (user.dutyList.indexOf(ROLE_MANAGER) > -1) {
35
+      // 如果是待交办
36
+      if (status.value === 0) {
37
+        act = 'assigned';
38
+      }
39
+    } else {
40
+      
41
+    }
42
+
43
+    Taro.navigateTo({
44
+      url: `/pages/issue/edit/index?id=${item.issueId}&act=${act}`
45
+    })
46
+  }
47
+  
48
+  return (
49
+    <Page>
50
+      <Tabs sticky>
51
+        <Tab title="监督员">
52
+          <PowerList
53
+            request={getTaIssue}
54
+            params={{mine: true}}
55
+            renderItem={(item) => (
56
+              <Card key={item.issueId} detail={item} onClick={() => onClick(item)} />
57
+            )}
58
+          />
59
+        </Tab>
60
+        <Tab title="市民">
61
+          <PowerList
62
+            request={getTaIssue}
63
+            params={{bizStatus: 'start', mine: true}}
64
+            renderItem={(item) => (
65
+              <Card key={item.issueId} detail={item} onClick={() => onClick(item)} />
66
+            )}
67
+          />
68
+        </Tab>
69
+      </Tabs>
70
+    </Page>
71
+  )
72
+}

+ 0
- 4
src/pages/login/index.jsx Parādīt failu

@@ -9,10 +9,6 @@ import './index.less'
9 9
 
10 10
 export default (props) => {
11 11
 
12
-  React.useMemo(() => {  
13
-    Taro.hideTabBar();
14
-  }, []);
15
-
16 12
   const onSuccess = () => {
17 13
     Taro.navigateBack({
18 14
       delta: 1,

+ 4
- 0
src/pages/org/issue/detail/index.config.js Parādīt failu

@@ -0,0 +1,4 @@
1
+// eslint-disable-next-line no-undef
2
+export default definePageConfig({
3
+  navigationBarTitleText: '问题详情'
4
+})

+ 96
- 0
src/pages/org/issue/detail/index.jsx Parādīt failu

@@ -0,0 +1,96 @@
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 Page from '@/layouts/index';
6
+import Uploader from '@/components/Uploader/index';
7
+import { getTaIssueById } from '@/services/taissue';
8
+import { getTaOrgIssueByIssueId } from '@/services/taorgissue';
9
+
10
+const getDtStr = dt => !dt ? '' : dt.replace('T', ' ').substring(0, 16)
11
+
12
+export default (props) => {
13
+
14
+  const router = Taro.useRouter();
15
+  const { id } = router.params;
16
+
17
+  const [loading, setLoading] = React.useState(false);
18
+  const [issue, setIssue] = React.useState();
19
+  const [orgIssue, setOrgIssue] = React.useState();
20
+
21
+  const setFormData = (key, value) => {
22
+    setOrgIssue({
23
+      ...(orgIssue || {}),
24
+      [key]: value,
25
+    })
26
+  }
27
+
28
+  React.useEffect(() => {
29
+    if (id) {
30
+      setLoading(true)
31
+      getTaIssueById(id).then(res => {
32
+        setLoading(false);
33
+        setIssue(res);
34
+      }).catch(() => {
35
+        setLoading(false);
36
+      });
37
+
38
+      getTaOrgIssueByIssueId(id).then(res => setOrgIssue(res));
39
+    }
40
+  }, [id]);
41
+  
42
+  return (
43
+    <Page loading={loading}>
44
+      <CellGroup>
45
+        <Cell title="上报时间" value={getDtStr(issue?.createDate)} />
46
+        <Cell title="办结时间" value={issue?.expireDate} /> 
47
+      </CellGroup>
48
+      <CellGroup style={{marginTop: '20px'}}>
49
+        <Cell title="抽检位置" value={issue?.locName} />
50
+        <Cell title="定 位 点" value={issue?.addr} />
51
+        <Cell title="问题详情" />        
52
+        <Field
53
+          readonly
54
+          type="textarea"
55
+          autosize={{ minHeight: '120px' }}
56
+          value={issue?.content}
57
+        /> 
58
+        <Cell
59
+          renderTitle={
60
+            <Uploader
61
+              disabled
62
+              value={issue?.attachList}
63
+            />
64
+          }
65
+        />
66
+      </CellGroup>
67
+      <CellGroup style={{marginTop: '20px'}}>
68
+        <Cell title="整改结果" />        
69
+        <Field
70
+          readonly
71
+          type="textarea"
72
+          autosize={{ minHeight: '120px' }}
73
+          value={orgIssue?.result}
74
+          onChange={e => setFormData('result', e.detail)}
75
+        />
76
+        <Cell
77
+          renderTitle={
78
+            <Uploader
79
+              disabled
80
+              value={orgIssue?.attachList}
81
+              onChange={e => setFormData('attachList', e)}
82
+            />
83
+          }
84
+        />
85
+      </CellGroup>
86
+      <View style={{marginTop: '20px', padding: 'var(--main-space)'}}>
87
+        <View>
88
+          <Button block type="primary">通过审核</Button>
89
+        </View>
90
+        <View style={{marginTop: '20px'}}>
91
+          <Button block type="default">重新整改</Button>
92
+        </View>
93
+      </View>
94
+    </Page>
95
+  )
96
+}

+ 4
- 0
src/pages/org/issue/list/index.config.js Parādīt failu

@@ -0,0 +1,4 @@
1
+// eslint-disable-next-line no-undef
2
+export default definePageConfig({
3
+  navigationBarTitleText: '问题列表'
4
+})

+ 67
- 0
src/pages/org/issue/list/index.jsx Parādīt failu

@@ -0,0 +1,67 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { Tab, Tabs } from '@antmjs/vantui';
5
+import Page from '@/layouts/index';
6
+import PowerList from '@/components/PowerList';
7
+import Card from '@/components/IssueCard';
8
+import { getTaOrgIssue } from '@/services/taorgissue';
9
+import { ROLE_MANAGER } from '@/utils/user';
10
+import { useModel } from '@/store';
11
+import { getIssueStatus } from '@/utils/biz';
12
+
13
+export default (props) => {
14
+
15
+  const router = Taro.useRouter();
16
+  const { title, bizStatus } = router.params;
17
+
18
+  React.useMemo(() => {
19
+    if (title) {
20
+      Taro.setNavigationBarTitle({ title });
21
+    } else {
22
+      Taro.setNavigationBarTitle({ title: '问题列表' });
23
+    }
24
+  }, [title]);
25
+
26
+  // const { user } = useModel('user');
27
+
28
+  const onClick = (item) => {
29
+
30
+    let act = '';
31
+    const status = getIssueStatus(item);
32
+
33
+    // 如果是待交办
34
+    if (status.value === 0) {
35
+      act = 'assigned';
36
+    }
37
+
38
+    Taro.navigateTo({
39
+      url: `/pages/issue/edit/index?id=${item.issueId}&act=${act}`
40
+    })
41
+  }
42
+  
43
+  return (
44
+    <Page>
45
+      <Tabs sticky>
46
+        <Tab title="监督员">
47
+          <PowerList
48
+            request={getTaOrgIssue}
49
+            params={{bizStatus, sourceType: 'inspector'}}
50
+            renderItem={(item) => (
51
+              <Card key={item.issueId} detail={item} onClick={() => onClick(item)} />
52
+            )}
53
+          />
54
+        </Tab>
55
+        <Tab title="市民">
56
+          <PowerList
57
+            request={getTaOrgIssue}
58
+            params={{bizStatus, sourceType: 'feedback'}}
59
+            renderItem={(item) => (
60
+              <Card key={item.issueId} detail={item} onClick={() => onClick(item)} />
61
+            )}
62
+          />
63
+        </Tab>
64
+      </Tabs>
65
+    </Page>
66
+  )
67
+}

+ 30
- 0
src/services/sysorg.js Parādīt failu

@@ -0,0 +1,30 @@
1
+import request from '@/utils/request';
2
+
3
+/*
4
+ * 分页查询
5
+ */
6
+export const getSysOrg = (params) => request('/api/sysOrg', { params });
7
+
8
+/*
9
+ * 新增数据
10
+ */
11
+export const postSysOrg = (data) => request('/api/sysOrg', { data, method: 'post' });
12
+
13
+/*
14
+ * 通过ID查询单条数据
15
+ */
16
+export const getSysOrgById = (id) => request(`/api/sysOrg/${id}`);
17
+
18
+/** 
19
+ * 更新数据
20
+ * 
21
+ * @param {*} id
22
+ * @param {*} data
23
+ * @returns
24
+ */
25
+export const putSysOrg = (id, data) => request(`/api/sysOrg/${id}`, { data, method: 'put' });
26
+
27
+/*
28
+ * 通过主键删除数据
29
+ */
30
+export const deleteSysOrg = (id) => request(`/api/sysOrg/${id}`, { method: 'delete' });

+ 10
- 0
src/services/taissue.js Parādīt failu

@@ -24,3 +24,13 @@ export const putTaIssue = (id, data) => request(`/api/taIssue/${id}`, { data, me
24 24
  * 通过主键删除数据
25 25
  */
26 26
 export const deleteTaIssue = (id) => request(`/api/taIssue/${id}`, { method: 'delete' });
27
+
28
+/*
29
+ * 交办
30
+ */
31
+export const postIssueAssigned = (data) => request('/api/taIssueProcess/assigned', { data, method: 'post' });
32
+
33
+/*
34
+ * 驳回
35
+ */
36
+export const postIssueRejct = (data) => request('/api/taIssueProcess/reject', { data, method: 'post' });

+ 30
- 0
src/services/taorgissue.js Parādīt failu

@@ -0,0 +1,30 @@
1
+import request from '@/utils/request';
2
+
3
+/*
4
+ * 分页查询
5
+ */
6
+export const getTaOrgIssue = (params) => request('/api/taOrgIssue', { params });
7
+
8
+/*
9
+ * 新增数据
10
+ */
11
+export const postTaOrgIssue = (data) => request('/api/taOrgIssue', { data, method: 'post' });
12
+
13
+/*
14
+ * 通过ID查询单条数据
15
+ */
16
+export const getTaOrgIssueById = (id) => request(`/api/taOrgIssue/${id}`);
17
+/*
18
+ * 通过ISSUE_ID查询单条数据
19
+ */
20
+export const getTaOrgIssueByIssueId = (issueId) => request(`/api/taIssue/${issueId}/orgIssue`);
21
+
22
+/*
23
+ * 更新数据
24
+ */
25
+export const putTaOrgIssue = (id, data) => request(`/api/taOrgIssue/${id}`, { data, method: 'put' });
26
+
27
+/*
28
+ * 通过主键删除数据
29
+ */
30
+export const deleteTaOrgIssue = (id) => request(`/api/taOrgIssue/${id}`, { method: 'delete' });

+ 5
- 5
src/utils/biz.js Parādīt failu

@@ -6,11 +6,6 @@ export function getIssueStatus(taIssue) {
6 6
       value: 0,
7 7
       label: '未交办',
8 8
     }
9
-  } else if (taIssue.processNode === 'assigned') {
10
-    return {
11
-      value: 1,
12
-      label: '已交办',
13
-    };
14 9
   } else if (taIssue.processNode === 'end') {
15 10
     return {
16 11
       value: 2,
@@ -26,6 +21,11 @@ export function getIssueStatus(taIssue) {
26 21
       value: 4,
27 22
       label: '已打回',
28 23
     };
24
+  } else if (taIssue.processNode === 'assigned') {
25
+    return {
26
+      value: 1,
27
+      label: '已交办',
28
+    };
29 29
   }
30 30
 
31 31
   return {};

+ 12
- 0
src/utils/date.js Parādīt failu

@@ -0,0 +1,12 @@
1
+
2
+function fill0(n) {
3
+  return n > 9 ? `${n}` : `0${n}`
4
+}
5
+
6
+export function getDateStr(dt) {
7
+  const y = dt.getFullYear();
8
+  const m = dt.getMonth() + 1;
9
+  const d = dt.getDate();
10
+
11
+  return `${y}-${fill0(m)}-${fill0(d)}`
12
+}