|
@@ -0,0 +1,80 @@
|
|
1
|
+import React from 'react';
|
|
2
|
+import Taro from '@tarojs/taro';
|
|
3
|
+import { View } from '@tarojs/components';
|
|
4
|
+import { Button, Dialog } from '@antmjs/vantui';
|
|
5
|
+import OrgPicker from "@/components/OrgPicker";
|
|
6
|
+import { postIssueAssignedAgain, putTaIssue, copyTaIssue } from '@/services/taissue';
|
|
7
|
+import { warn } from '@/utils/message';
|
|
8
|
+
|
|
9
|
+export default (props) => {
|
|
10
|
+
|
|
11
|
+ const { issue } = props;
|
|
12
|
+ const formDataRef = React.useRef();
|
|
13
|
+
|
|
14
|
+ const dialogId = React.useMemo(() => `dialog-${Math.random().toString(36).substring(2, 7)}`, []);
|
|
15
|
+ const [loading1, setLoading1] = React.useState(false);
|
|
16
|
+ const [loading2, setLoading2] = React.useState(false);
|
|
17
|
+ const [showOrgPicker, setShowOrgPicker] = React.useState(false);
|
|
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(!formDataRef.current?.orgId, '请选择交办单位')
|
|
28
|
+ // warn(!formData.expireDate, '请选择办结时间')
|
|
29
|
+ } catch (e) {
|
|
30
|
+ return;
|
|
31
|
+ }
|
|
32
|
+
|
|
33
|
+ setLoading1(true)
|
|
34
|
+
|
|
35
|
+ const data = { ...issue, ...(formDataRef.current || {}) };
|
|
36
|
+ // 先提交修改
|
|
37
|
+ putTaIssue(issue.issueId, data).then(() => {
|
|
38
|
+ // 再提交交办
|
|
39
|
+ postIssueAssignedAgain({ ...data, nextOrg: data.orgId }).then(() => {
|
|
40
|
+ setLoading1(false);
|
|
41
|
+ Taro.navigateBack({ delta: 1 });
|
|
42
|
+ }).catch(() => {
|
|
43
|
+ setLoading1(false);
|
|
44
|
+ })
|
|
45
|
+ }).catch(() => {
|
|
46
|
+ setLoading1(false);
|
|
47
|
+ })
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+ const onOrgChange = (_, it) => {
|
|
52
|
+ const data = {
|
|
53
|
+ ...(formDataRef.current || {}),
|
|
54
|
+ orgId: it.orgId,
|
|
55
|
+ orgName: it.name,
|
|
56
|
+ };
|
|
57
|
+ formDataRef.current = data;
|
|
58
|
+ setShowOrgPicker(false);
|
|
59
|
+ onAssigned();
|
|
60
|
+ };
|
|
61
|
+
|
|
62
|
+ return (
|
|
63
|
+ <View style={{ marginTop: '20px', display: 'flex' }}>
|
|
64
|
+ <Dialog id={dialogId} />
|
|
65
|
+ <OrgPicker
|
|
66
|
+ parentId={issue.orgId}
|
|
67
|
+ show={showOrgPicker}
|
|
68
|
+ value={formDataRef.current?.orgName}
|
|
69
|
+ onCancel={() => setShowOrgPicker(false)}
|
|
70
|
+ onChange={onOrgChange}
|
|
71
|
+ />
|
|
72
|
+ <Button
|
|
73
|
+ block
|
|
74
|
+ type="primary"
|
|
75
|
+ loading={loading1}
|
|
76
|
+ onClick={() => setShowOrgPicker(true)}
|
|
77
|
+ >交办</Button>
|
|
78
|
+ </View>
|
|
79
|
+ )
|
|
80
|
+}
|