Yansen преди 2 години
родител
ревизия
1e9d994490

+ 1
- 1
src/components/OrgPicker/index.jsx Целия файл

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

+ 2
- 2
src/components/Pickerful/index.jsx Целия файл

@@ -10,7 +10,7 @@ const wrapperStyle = {
10 10
 }
11 11
 
12 12
 export default (props) => {
13
-  const { show, value, keyValue, labelValue = 'name', dictAPI, onChange, onCancel } = props;
13
+  const { show, value, params = {}, keyValue, labelValue = 'name', dictAPI, onChange, onCancel } = props;
14 14
 
15 15
   const [dict, setDict] = React.useState([]);
16 16
   const [checked, setChecked] = React.useState();
@@ -30,7 +30,7 @@ export default (props) => {
30 30
   }
31 31
 
32 32
   React.useEffect(() => {
33
-    dictAPI({pageSize: 500}).then(res => {
33
+    dictAPI({pageSize: 500, ...params }).then(res => {
34 34
       setDict(res.records || []);
35 35
     })
36 36
   }, []);

+ 11
- 30
src/pages/check/edit/components/LocForm.jsx Целия файл

@@ -5,6 +5,7 @@ import { CellGroup, Cell, Field, RadioGroup, Radio, Icon, Loading } from '@antmj
5 5
 import Map from '@/components/map';
6 6
 import { getTaCheckItemAnswer } from '@/services/tacheckitem';
7 7
 import { getTaCheckAnswer } from '@/services/tacheckanswer';
8
+import { geocoder } from '@/utils/map';
8 9
 import mapIcon from '@/assets/icons/marker.png';
9 10
 import AgePicker from './AgePicker';
10 11
 
@@ -12,7 +13,6 @@ export default (props) => {
12 13
   const { checkItemInfo, checkType, answer, readonly, onChange, onLoadingChange } = props;
13 14
 
14 15
   const [showAgePicker, setShowAgePicker] = React.useState(false);
15
-  const [count, setCount] = React.useState();
16 16
 
17 17
   const setLoading = (v) => {
18 18
     if (onLoadingChange) {
@@ -27,35 +27,23 @@ export default (props) => {
27 27
     })
28 28
   }
29 29
 
30
-  React.useEffect(() => {
31
-    getTaCheckAnswer().then((res) => {
32
-      setCount(res.total);
33
-    })
34
-  })
35
-
36
-  // // 获取答题主记录信息
37
-  // React.useEffect(() => {
38
-  //   if (checkItemInfo?.itemId) {
39
-  //     setLoading(true);
40
-  //     getTaCheckItemAnswer(checkItemInfo?.itemId).then((res) => {
41
-  //       if (res) {
42
-  //         onChange(res);
43
-  //       }
44
-  //       setLoading(false);
45
-  //     }).catch(() => {
46
-  //       setLoading(false);
47
-  //     });
48
-  //   }
49
-  // }, [checkItemInfo?.itemId])
30
+  const onLocationChange = (loc) => {
31
+    setFieldChange('location', loc);
50 32
 
51
-  // console.log('answer', answer);
33
+    if (checkType == 'loc' && loc) {
34
+      // 交换经纬度位置
35
+      const [x, y] = loc.split(',');
36
+      const location = [y, x].join(',');
37
+      geocoder(location).then(e => setFieldChange('addr', e?.address_component?.street_number || e?.address)).catch(console.error)
38
+    }
39
+  }
52 40
 
53 41
   return (
54 42
     <View>
55 43
       <Map
56 44
         readOnly={readonly}
57 45
         location={answer?.location}
58
-        onChange={e => setFieldChange('location', e)}
46
+        onChange={onLocationChange}
59 47
       />
60 48
       {/* <View style={{ position: 'fixed', zIndex: '3000', top: '50%', color: 'red', display: 'grid', width: '50px', height: '50px' }}>
61 49
         <Loading type="spinner" vertical />
@@ -119,13 +107,6 @@ export default (props) => {
119 107
           </CellGroup>
120 108
         )
121 109
       }
122
-      {/* <CellGroup style={{ marginTop: '20px' }}>
123
-        <Cell>
124
-          <View style={{ textAlign: 'center', color: '#000' }}>
125
-            您已完成{count}份
126
-          </View>
127
-        </Cell>
128
-      </CellGroup> */}
129 110
 
130 111
       {
131 112
         checkType == 'survey' && (

+ 13
- 1
src/pages/check/loc/edit/components/LocForm.jsx Целия файл

@@ -5,6 +5,7 @@ import { CellGroup, Cell, Field } from '@antmjs/vantui';
5 5
 import Map from '@/components/map';
6 6
 import { getTaCheckItemAnswer } from '@/services/tacheckitem';
7 7
 import mapIcon from '@/assets/icons/marker.png';
8
+import { geocoder } from '@/utils/map';
8 9
 
9 10
 export default (props) => {
10 11
   const { checkItemInfo, answer, readonly, onChange, onLoadingChange } = props;
@@ -21,6 +22,17 @@ export default (props) => {
21 22
       [key]: val,
22 23
     })
23 24
   }
25
+  
26
+  const onLocationChange = (loc) => {
27
+    setFieldChange('location', loc);
28
+
29
+    if (loc) {
30
+      // 交换经纬度位置
31
+      const [x, y] = loc.split(',');
32
+      const location = [y, x].join(',');
33
+      geocoder(location).then(e => setFieldChange('addr', e?.address_component?.street_number || e?.address)).catch(console.error)
34
+    }
35
+  }
24 36
 
25 37
   // 获取答题主记录信息
26 38
   React.useEffect(() => {
@@ -42,7 +54,7 @@ export default (props) => {
42 54
       <Map
43 55
         readOnly={readonly}
44 56
         location={answer?.location}
45
-        onChange={(e) => setFieldChange('location', e)}
57
+        onChange={onLocationChange}
46 58
       />
47 59
       <CellGroup>
48 60
         <Cell

+ 14
- 1
src/pages/feedback/issue/index.jsx Целия файл

@@ -8,6 +8,7 @@ import Uploader from '@/components/Uploader/index';
8 8
 import mapIcon from '@/assets/icons/marker.png';
9 9
 import { warn } from '@/utils/message';
10 10
 import { postTaFeedback } from '@/services/tafeedback';
11
+import { geocoder } from '@/utils/map';
11 12
 
12 13
 export default (props) => {
13 14
   const readOnly = false;
@@ -60,13 +61,25 @@ export default (props) => {
60 61
     })
61 62
 
62 63
   }
64
+    
65
+  const onLocationChange = (loc) => {
66
+    setFieldChange('location', loc);
67
+
68
+    if (loc) {
69
+      // 交换经纬度位置
70
+      const [x, y] = loc.split(',');
71
+      const location = [y, x].join(',');
72
+      geocoder(location).then(e => setFieldChange('addr', e?.address_component?.street_number || e?.address)).catch(console.error)
73
+    }
74
+  }
75
+
63 76
 
64 77
   return (
65 78
     <Page tabBar="feedback">
66 79
       <Map
67 80
         readOnly={readOnly}
68 81
         location={formData.location}
69
-        onChange={e => !formData.location && setFieldChange('location', e)}
82
+        onChange={onLocationChange}
70 83
       />
71 84
 
72 85
       <CellGroup>

+ 2
- 2
src/pages/home/index.jsx Целия файл

@@ -42,7 +42,7 @@ const menus = {
42 42
   [ROLE_ORG_USER]: [
43 43
     { icon: 'icon2', text: '处 理 中', link: `/pages/org/issue/list/index?title=处理中&bizStatus=${PROCESS_ASSIGNED}` },
44 44
     { icon: 'icon3', text: '已 办 结', link: `/pages/org/issue/list/index?title=已办结&bizStatus=${PROCESS_END}` },
45
-    { icon: 'icon5', text: '已 逾 期', link: '/pages/org/issue/list/index?title=已办结&bizStatus=expired' },
45
+    { icon: 'icon5', text: '已 逾 期', link: '/pages/org/issue/list/index?title=已逾期&bizStatus=expired' },
46 46
     { icon: 'icon11', text: '消息通知', link: '/pages/message/list/index' },
47 47
   ],
48 48
 
@@ -50,7 +50,7 @@ const menus = {
50 50
   [ROLE_ORG_MANAGER]: [
51 51
     { icon: 'icon2', text: '处 理 中', link: `/pages/org/issue/list/index?title=处理中&bizStatus=${PROCESS_ASSIGNED}` },
52 52
     { icon: 'icon3', text: '已 办 结', link: `/pages/org/issue/list/index?title=已办结&bizStatus=${PROCESS_END}` },
53
-    { icon: 'icon5', text: '已 逾 期', link: '/pages/org/issue/list/index?title=已办结&bizStatus=expired' },
53
+    { icon: 'icon5', text: '已 逾 期', link: '/pages/org/issue/list/index?title=已逾期&bizStatus=expired' },
54 54
     { icon: 'icon9', text: '审核申请', request: getVerifyApply, link: `/pages/apply/list/index?title=审核申请&applyType=${PROCESS_APPLY_VERIFY}` },
55 55
     { icon: 'icon11', text: '消息通知', link: '/pages/message/list/index' },
56 56
     { icon: 'person', text: '人员管理', link: '/pages/user/list/index' },

+ 14
- 1
src/pages/issue/components/Issue/index.jsx Целия файл

@@ -12,6 +12,7 @@ import { getDateStr } from '@/utils/date';
12 12
 import mapIcon from '@/assets/icons/marker.png';
13 13
 import { getTaOrgIssueByIssueId } from '@/services/taorgissue';
14 14
 import { PROCESS_END } from '@/utils/biz';
15
+import { geocoder } from '@/utils/map';
15 16
 
16 17
 import IssueStatus from './IssueStatus';
17 18
 
@@ -107,6 +108,18 @@ export default (props) => {
107 108
     setFormData(data);
108 109
   }
109 110
 
111
+  
112
+  const onLocationChange = (loc) => {
113
+    setFieldChange('location', loc);
114
+
115
+    if (loc) {
116
+      // 交换经纬度位置
117
+      const [x, y] = loc.split(',');
118
+      const location = [y, x].join(',');
119
+      geocoder(location).then(e => setFieldChange('addr', e?.address_component?.street_number || e?.address)).catch(console.error)
120
+    }
121
+  }
122
+
110 123
   React.useEffect(() => {
111 124
     if (issue) {
112 125
       fmRef.current = issue;
@@ -157,7 +170,7 @@ export default (props) => {
157 170
       <Map
158 171
         readOnly={!!issueId}
159 172
         location={formData.location}
160
-        onChange={e => !formData.location && setFieldChange('location', e)}
173
+        onChange={onLocationChange}
161 174
       />
162 175
 
163 176
       <CellGroup>

+ 56
- 9
src/pages/issue/edit/components/Assigned.jsx Целия файл

@@ -1,15 +1,17 @@
1 1
 import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import { View } from '@tarojs/components';
4
-import { Button } from '@antmjs/vantui';
5
-import { postIssueAssigned, putTaIssue } from '@/services/taissue';
4
+import { Button, Dialog } from '@antmjs/vantui';
5
+import { postIssueAssigned, putTaIssue, copyTaIssue } from '@/services/taissue';
6 6
 import { warn } from '@/utils/message';
7 7
 
8 8
 export default (props) => {
9 9
 
10 10
   const { issue, formData } = props;
11 11
 
12
+  const dialogId = React.useMemo(() => `dialog-${Math.random().toString(36).substring(2, 7)}`, []);
12 13
   const [loading1, setLoading1] = React.useState(false);
14
+  const [loading2, setLoading2] = React.useState(false);
13 15
   
14 16
   // 交办
15 17
   const onAssigned = () => {
@@ -42,14 +44,59 @@ export default (props) => {
42 44
       setLoading1(false);
43 45
     })
44 46
   }
47
+
48
+  // 复制
49
+  const onCopy = () => {
50
+    Dialog.confirm({
51
+      title: '复制问题单',
52
+      message: '确认复制当前问题单?',
53
+      selector: dialogId,
54
+    }).then((value) => {
55
+      if ('confirm' === value) {
56
+        setLoading2(true)
57
+        copyTaIssue(issue.issueId).then(res => {
58
+          setLoading2(false)
59
+
60
+          // Dialog 有 bug,
61
+          // 使用 setTimeout 延迟一会规避一下
62
+          const t = setTimeout(() => {
63
+            clearTimeout(t);
64
+            Dialog.confirm({
65
+              title: '复制成功',
66
+              message: `新问题单号: ${res.issueId}, 是否跳转`,
67
+              selector: dialogId,
68
+            }).then((value2) => {
69
+              if ('confirm' === value2) {
70
+                Taro.navigateTo({
71
+                  url: `/pages/issue/edit/index?id=${res.issueId}`
72
+                })
73
+              }
74
+            });
75
+          }, 200);
76
+        }).catch(() => {
77
+          setLoading2(false)
78
+        })
79
+      }
80
+    })
81
+  }
45 82
  
46 83
   return (
47
-    <Button
48
-      block
49
-      type="primary"
50
-      loading={loading1}
51
-      onClick={onAssigned}
52
-      style={{marginTop: '20px'}}
53
-    >交办</Button>
84
+    <View style={{marginTop: '20px', display: 'flex'}}>
85
+      <Dialog id={dialogId} />
86
+      <Button
87
+        block
88
+        type="primary"
89
+        loading={loading1}
90
+        onClick={onAssigned}
91
+        style={{ flex: 5 }}
92
+      >交办</Button>
93
+      <Button
94
+        block
95
+        type="info"
96
+        loading={loading2}
97
+        onClick={onCopy}
98
+        style={{ flex: 1, marginLeft: 'var(--main-space)' }}
99
+      >复制</Button>
100
+    </View>
54 101
   )
55 102
 }

+ 1
- 1
src/pages/issue/edit/index.jsx Целия файл

@@ -49,7 +49,7 @@ export default (props) => {
49 49
     if (duty == ROLE_INSPECTOR) {
50 50
       return [
51 51
         issue && issue.processNode != PROCESS_START,
52
-        issue?.processNode && issue?.processNode != PROCESS_START,
52
+        true,
53 53
         issue && issue.processNode == PROCESS_START,
54 54
         false,
55 55
         false,

+ 3
- 3
src/pages/org/issue/detail/index.jsx Целия файл

@@ -26,7 +26,7 @@ export default (props) => {
26 26
 
27 27
   const router = Taro.useRouter();
28 28
   const { id, act } = router.params;
29
-  const { duty } = useModel('user');
29
+  const { duty, user } = useModel('user');
30 30
 
31 31
   const [loading, setLoading] = React.useState(false);
32 32
   const [issue, setIssue] = React.useState();
@@ -64,9 +64,9 @@ export default (props) => {
64 64
         setLoading(false);
65 65
       });
66 66
 
67
-      getTaOrgIssueByIssueId(id).then(res => setOrgIssue(res));
67
+      getTaOrgIssueByIssueId(id, user?.orgId ).then(res => setOrgIssue(res));
68 68
     }
69
-  }, [id]);
69
+  }, [id, user]);
70 70
   
71 71
   return (
72 72
     <Page loading={loading}>

+ 5
- 0
src/services/taissue.js Целия файл

@@ -20,6 +20,11 @@ export const getTaIssueById = (id) => request(`/api/taIssue/${id}`);
20 20
  */
21 21
 export const putTaIssue = (id, data) => request(`/api/taIssue/${id}`, { data, method: 'put' });
22 22
 
23
+/*
24
+ * 复制数据
25
+ */
26
+export const copyTaIssue = (id) => request(`/api/taIssue/${id}/copy`, { method: 'post' });
27
+
23 28
 /*
24 29
  * 通过主键删除数据
25 30
  */

+ 29
- 0
src/utils/map.js Целия файл

@@ -0,0 +1,29 @@
1
+import Taro from "@tarojs/taro";
2
+
3
+// 腾讯地图接口 - 个人开发者
4
+const QMAP_WEBSERVICE_KEY = 'HTPBZ-HHJA7-XD2XD-PRS37-H3HVJ-U5BAA';
5
+
6
+// https://lbs.qq.com/service/webService/webServiceGuide/webServiceGcoder
7
+// location 为 gcj02 编码
8
+export function geocoder(location, getPoi = 0) {
9
+  if (!location || location.length < 3) {
10
+    return Promise.reject(new Error('待解析地址为空'));
11
+  }
12
+
13
+  return new Promise((resolve, reject) => {
14
+    const url = `https://apis.map.qq.com/ws/geocoder/v1/?location=${location}&key=${QMAP_WEBSERVICE_KEY}&get_poi=${getPoi}`
15
+
16
+    Taro.request({ url }).then(({ data }) => {
17
+      const { status, message, result } = data || {};
18
+      if (status != 0) {
19
+        console.error(data);
20
+        reject(new Error(message));
21
+      } else {
22
+        resolve(result);
23
+      }
24
+    }).catch((err) => {
25
+      console.error(err);
26
+      reject(new Error(err.errMsg));
27
+    });
28
+  })
29
+}