|
@@ -0,0 +1,184 @@
|
|
1
|
+import React from 'react';
|
|
2
|
+import Taro from '@tarojs/taro';
|
|
3
|
+import { View } from '@tarojs/components';
|
|
4
|
+import { Button, Notify, Field, Cell, CellGroup } from '@antmjs/vantui';
|
|
5
|
+import LocType from '@/components/LocType';
|
|
6
|
+import IssueType from '@/components/IssueType';
|
|
7
|
+import OrgPicker from '@/components/OrgPicker';
|
|
8
|
+import DatePicker from '@/components/DatePicker';
|
|
9
|
+import Map from '@/components/map';
|
|
10
|
+import Uploader from '@/components/Uploader/index';
|
|
11
|
+import { getIssueStatus } from '@/utils/biz';
|
|
12
|
+import { getDateStr } from '@/utils/date';
|
|
13
|
+import mapIcon from '@/assets/icons/marker.png';
|
|
14
|
+
|
|
15
|
+export default (props) => {
|
|
16
|
+ const today = new Date();
|
|
17
|
+
|
|
18
|
+ const {
|
|
19
|
+ issue,
|
|
20
|
+ readOnly,
|
|
21
|
+ showOrg,
|
|
22
|
+ showExpireDate,
|
|
23
|
+ renderFields,
|
|
24
|
+ renderAction
|
|
25
|
+ } = props;
|
|
26
|
+
|
|
27
|
+ const [formData, setFormData] = React.useState({
|
|
28
|
+ typeId: undefined,
|
|
29
|
+ typeName: undefined,
|
|
30
|
+ locId: undefined,
|
|
31
|
+ locName: undefined,
|
|
32
|
+ location: undefined,
|
|
33
|
+ addr: undefined,
|
|
34
|
+ content: undefined,
|
|
35
|
+ attachList: [],
|
|
36
|
+ });
|
|
37
|
+ const [showLocType, setShowLocType] = React.useState(false);
|
|
38
|
+ const [showIssueType, setShowIssueType] = React.useState(false);
|
|
39
|
+ const [showOrgPicker, setShowOrgPicker] = React.useState(false);
|
|
40
|
+ const [showDatePicker, setShowDatePicker] = React.useState(false);
|
|
41
|
+ const [bizStatus, setBizStatus] = React.useState();
|
|
42
|
+ const [issueProcess, setIssueProcess] = React.useState([]);
|
|
43
|
+
|
|
44
|
+ const issueReject = React.useMemo(() => {
|
|
45
|
+ if (!issueProcess || !issueProcess.length) return {};
|
|
46
|
+
|
|
47
|
+ return issueProcess.filter(x => x.processStatus === 'reject')[0] || {};
|
|
48
|
+ }, [issueProcess]);
|
|
49
|
+
|
|
50
|
+ const onLocTypeChange = (_, it) => {
|
|
51
|
+ setFormData({
|
|
52
|
+ ...formData,
|
|
53
|
+ locId: it.typeId,
|
|
54
|
+ locName: it.name,
|
|
55
|
+ });
|
|
56
|
+ setShowLocType(false);
|
|
57
|
+ }
|
|
58
|
+
|
|
59
|
+ const onIssueTypeChange = (_, it) => {
|
|
60
|
+ setFormData({
|
|
61
|
+ ...formData,
|
|
62
|
+ typeId: it.typeId,
|
|
63
|
+ typeName: it.name,
|
|
64
|
+ });
|
|
65
|
+ setShowIssueType(false);
|
|
66
|
+ }
|
|
67
|
+
|
|
68
|
+ const onOrgChange = (_, it) => {
|
|
69
|
+ setFormData({
|
|
70
|
+ ...formData,
|
|
71
|
+ orgId: it.orgId,
|
|
72
|
+ orgName: it.name,
|
|
73
|
+ });
|
|
74
|
+ setShowOrgPicker(false);
|
|
75
|
+ }
|
|
76
|
+
|
|
77
|
+ const onDateChange = (dt) => {
|
|
78
|
+ const date = getDateStr(dt);
|
|
79
|
+ setFormData({
|
|
80
|
+ ...formData,
|
|
81
|
+ expireDate: date,
|
|
82
|
+ });
|
|
83
|
+ setShowDatePicker(false);
|
|
84
|
+ }
|
|
85
|
+
|
|
86
|
+ const setFieldChange = (field, value) => {
|
|
87
|
+ setFormData({
|
|
88
|
+ ...formData,
|
|
89
|
+ [field]: value,
|
|
90
|
+ })
|
|
91
|
+ }
|
|
92
|
+
|
|
93
|
+ React.useEffect(() => {
|
|
94
|
+ if (issue) {
|
|
95
|
+ setFormData(issue);
|
|
96
|
+ setBizStatus(getIssueStatus(issue));
|
|
97
|
+
|
|
98
|
+ // if (issue.processStatus == 'reject') {
|
|
99
|
+ // getIssueProcess({ pageSize: 100, issueId: issue.issueId }).then(res => {
|
|
100
|
+ // setIssueProcess(res.records || []);
|
|
101
|
+ // })
|
|
102
|
+ // }
|
|
103
|
+ }
|
|
104
|
+ }, [issue]);
|
|
105
|
+
|
|
106
|
+ return (
|
|
107
|
+ <View>
|
|
108
|
+ {/* <LocType
|
|
109
|
+ show={showLocType}
|
|
110
|
+ value={formData.locId}
|
|
111
|
+ onCancel={() => setShowLocType(false)}
|
|
112
|
+ onChange={onLocTypeChange}
|
|
113
|
+ />
|
|
114
|
+
|
|
115
|
+ <IssueType
|
|
116
|
+ show={showIssueType}
|
|
117
|
+ value={formData.typeName}
|
|
118
|
+ onCancel={() => setShowIssueType(false)}
|
|
119
|
+ onChange={onIssueTypeChange}
|
|
120
|
+ />
|
|
121
|
+
|
|
122
|
+ <OrgPicker
|
|
123
|
+ show={showOrgPicker}
|
|
124
|
+ value={formData.orgName}
|
|
125
|
+ onCancel={() => setShowOrgPicker(false)}
|
|
126
|
+ onChange={onOrgChange}
|
|
127
|
+ />
|
|
128
|
+
|
|
129
|
+ <DatePicker
|
|
130
|
+ type="date"
|
|
131
|
+ minDate={today}
|
|
132
|
+ show={showDatePicker}
|
|
133
|
+ value={formData.expireDate}
|
|
134
|
+ onCancel={() => setShowDatePicker(false)}
|
|
135
|
+ onChange={onDateChange}
|
|
136
|
+ /> */}
|
|
137
|
+
|
|
138
|
+ <Map location={formData.location} />
|
|
139
|
+
|
|
140
|
+ <CellGroup>
|
|
141
|
+ <Field
|
|
142
|
+ placeholder="阳光丽景小区"
|
|
143
|
+ value={formData.addr}
|
|
144
|
+ leftIcon={mapIcon}
|
|
145
|
+ readonly={readOnly}
|
|
146
|
+ onChange={e => setFieldChange('addr', e.detail)}
|
|
147
|
+ />
|
|
148
|
+ </CellGroup>
|
|
149
|
+
|
|
150
|
+ <CellGroup style={{ marginTop: '20px' }}>
|
|
151
|
+
|
|
152
|
+ <Cell title="问题描述" size="large" border={false} />
|
|
153
|
+
|
|
154
|
+ <Field
|
|
155
|
+ type="textarea"
|
|
156
|
+ placeholder="请输入问题描述"
|
|
157
|
+ readonly={readOnly}
|
|
158
|
+ autosize={{ minHeight: '120px' }}
|
|
159
|
+ value={formData.content}
|
|
160
|
+ onChange={e => setFieldChange('content', e.detail)}
|
|
161
|
+ />
|
|
162
|
+ </CellGroup>
|
|
163
|
+
|
|
164
|
+ <CellGroup style={{ marginTop: '20px' }}>
|
|
165
|
+ <Cell title="拍照" size="large" border={false} />
|
|
166
|
+
|
|
167
|
+ <Cell
|
|
168
|
+ renderTitle={
|
|
169
|
+ <Uploader
|
|
170
|
+ value={formData.attachList}
|
|
171
|
+ disabled={readOnly}
|
|
172
|
+ onChange={e => setFieldChange('attachList', e)}
|
|
173
|
+ />
|
|
174
|
+ }
|
|
175
|
+ />
|
|
176
|
+ </CellGroup>
|
|
177
|
+
|
|
178
|
+ <View style={{ padding: 'var(--main-space)', background: '#fff' }}>
|
|
179
|
+ <Button block type="primary">提交</Button>
|
|
180
|
+ </View>
|
|
181
|
+
|
|
182
|
+ </View>
|
|
183
|
+ )
|
|
184
|
+}
|