广州市综治平台前端
xusd
3 days ago b4725b231cfe2a710288e8bd0b1b9d990989f90c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
/*
 * @Company: hugeInfo
 * @Author: ldh
 * @Date: 2022-03-23 11:16:55
 * @LastEditTime: 2023-12-11 10:10:02
 * @LastEditors: dminyi 1301963064@qq.com
 * @Version: 1.0.0
 * @Description: 调解结束-反馈调解结果
 */
import React, { useState, useEffect, useRef } from 'react';
import { useSearchParams, useNavigate } from 'react-router-dom';
import { Row, Col, Space, Select, Input, Button, Typography, Radio, Checkbox, Tooltip } from 'antd';
import { PlusOutlined, CloseCircleFilled } from '@ant-design/icons';
import * as $$ from '../../../utils/utility';
import MyUpload from '../../../components/MyUpload';
 
const { Option } = Select;
 
const { TextArea } = Input;
 
const { Link } = Typography;
 
// 获取调解结果数据
function getDataApi(submitData) {
  return $$.ax.request({ url: `caseInfo/pcWindowMeetUsers?caseId=${submitData}`, type: 'get', service: 'mediate' });
}
 
 
// 调解结果反馈
function resultFeedbackApi(submitData) {
  return $$.ax.request({ url: 'caseInfo/pcWindowInMediResult', type: 'post', data: submitData, service: 'mediate' });
}
 
//全局修改
function globalUpdateApi(submitData) {
  return $$.ax.request({ url: 'caseInfo/globalUpdate', type: 'post', data: submitData, service: 'mediate' });
}
 
 
 
 
 
const ResultFeedback = ({ caseId, taskId, disputeData, showResultButton }) => {
  const myUploadRef = useRef();
 
  const [searchParams] = useSearchParams();
 
  let navigate = useNavigate();
 
  const back = searchParams.get('back');
 
  // form数据
  const [formData, setFormData] = useState({});
 
  // 申请人,被申请人,其他人数据
  const [data, setData] = useState({});
 
  function handleChangeInput(key, value) {
    if (key === 'mediResult') {
      formData.mediResult = value[0];
      formData.mediResultName = value[1];
      if (value[0] === '22_00025-2') {
        formData.mediFalse = $$.options.mediFalseCause[0].value;
        formData.mediFalseName = $$.options.mediFalseCause[0].label;
      }
    } else if (key === 'mediFalse') {
      formData.mediFalse = value[0];
      formData.mediFalseName = value[1];
    } else if (key === 'fulfilSitu') {
      formData.fulfilSitu = value[0];
      formData.fulfilSituName = value[1];
    } else {
      formData[key] = value;
    }
    setFormData({ ...formData });
  }
 
  // 文件展示
  function handleChangeFile(file) {
    $$.modalInfo({
      content: '确定删除该文书吗?',
      onOk: () => {
        myUploadRef.current.handleDeleteFiles(file.id).then((res) => {
          if (res) getData();
        });
      },
    });
  }
 
  // 获取参与人数据
  async function getData() {
    global.setSpinning(true);
    const res = await getDataApi(caseId);
    global.setSpinning(false);
    if (res.type) {
      let resData = res.data || {};
      setData(resData);
    }
  }
 
  // 调解结果反馈
  async function resultFeedback() {
    let submitData = { ...formData, caseId, taskId };
    console.log('submitData', submitData);
    console.log('data', data);
    if (submitData.mediResult === '22_00025-2') {
      delete submitData.fulfilSitu;
      delete submitData.fulfilSituName;
      delete submitData.agreeContent;
      if (submitData.civilStatus === '1') {
        delete submitData.civilNo;
      }
      delete submitData.mediateBookNo;
      delete submitData.mediateNo;
    } else {
      delete submitData.mediFalse;
      delete submitData.mediFalseName;
      delete submitData.civilStatus;
      delete submitData.civilNo;
    }
    if (data.meetUserList?.length == 0 || !data.meetUserList) {
      return $$.info({ type: 'warning', content: '您没有预约记录,暂时无法提交' })
    }
    submitData.meetUserList = data.meetUserList?.map((x) => {
      return { id: x.id, signStatus: x.signStatus };
    });
    global.setSpinning(true);
    const res = await resultFeedbackApi(submitData);
    global.setSpinning(false);
    if (res.type) {
      navigate(`/mediate/myAdjust/mediationWindowSuccess?caseId=${caseId}`)
    }
  }
 
  useEffect(() => {
    setFormData({
      mediResult: $$.options.mediResult[0].value,
      mediResultName: $$.options.mediResult[0].label,
      fulfilSitu: disputeData?.fulfilSitu || $$.options.fulfilSitu[1].value,
      fulfilSituName: disputeData?.fulfilSituName || $$.options.fulfilSitu[1].label,
      civilStatus: '1',
      agreeContent: disputeData?.agreeContent,
      mediateBookNo: disputeData?.mediateBookNo,
      mediateNo: disputeData?.mediateNo,
      handleContent: disputeData?.handleContent,
    });
    //xxx-==='已归档'&& getData();
    getData();
    // globalUpdateApi(formData);
  }, []);
 
 
  console.log ("formData",formData)
  return (
    <>
      <div className="mediationWindow-modal-main">
        <Row gutter={[16, 16]}>
          <Col span={24}>
            <h5>调解结果</h5>
            <Radio.Group value={formData.mediResult} onChange={(e) => handleChangeInput('mediResult', [e.target.value, e.target.label])}>
              <Space direction="vertical">
                {$$.options.mediResult.map((x) => (
                  <Radio value={x.value} key={x.value} label={x.label}>
                    {x.label}
                  </Radio>
                ))}
              </Space>
            </Radio.Group>
          </Col>
          {formData.mediResult === '22_00025-2' ? (
            <>
              <Col span={24}>
                <h5>调解不成功原因</h5>
                <Radio.Group value={formData.mediFalse} onChange={(e) => handleChangeInput('mediFalse', [e.target.value, e.target.label])}>
                  <Space direction="vertical">
                    {$$.options.mediFalseCause.map((x) => (
                      <Radio value={x.value} key={x.value} label={x.label}>
                        {x.label}
                      </Radio>
                    ))}
                  </Space>
                </Radio.Group>
              </Col>
              {
                formData.mediFalse === '22_00019-9' &&
                <Col span={24}>
                  <TextArea
                    value={formData.mediFalseContent}
                    placeholder="输入调解不成功的具体原因"
                    allowClear
                    rows={2}
                    onChange={(e) => handleChangeInput('mediFalseContent', e.target.value)}
                  />
                </Col>
              }
              <Col span={24}>
                <h5>是否转诉讼案件</h5>
                <Radio.Group value={formData.civilStatus} onChange={(e) => handleChangeInput('civilStatus', e.target.value)}>
                  <Space direction="vertical">
                    <Radio value={'1'}>否,未转诉讼</Radio>
                    <Radio value={'2'}>是,转诉讼</Radio>
                  </Space>
                </Radio.Group>
              </Col>
              {formData.civilStatus === '2' && (
                <Col span={24}>
                  <h5>诉讼案号</h5>
                  <Input
                    value={formData.civilNo}
                    onChange={(e) => handleChangeInput('civilNo', e.target.value)}
                    placeholder="输入审判业务系统的立案号(如有)"
                    allowClear
                    style={{ width: '354px' }}
                  />
                </Col>
              )}
            </>
          ) : (
            <>
              <Col span={24}>
                <h5>履行情况</h5>
                <Select
                  value={formData.fulfilSitu}
                  onChange={(value, options) => handleChangeInput('fulfilSitu', [value, options.label])}
                  style={{ width: '354px' }}
                >
                  {$$.options.fulfilSitu.map((x) => (
                    <Option value={x.value} key={x.value} label={x.label}>
                      {x.label}
                    </Option>
                  ))}
                </Select>
              </Col>
              <Col span={24}>
                <h5>达成的调解协议</h5>
                <TextArea
                  value={formData.agreeContent}
                  onChange={(e) => handleChangeInput('agreeContent', e.target.value)}
                  placeholder="输入双方申请人达成的调解协议内容"
                  allowClear
                  rows={4}
                />
              </Col>
              <Col span={24}>
                <h5>协议文书</h5>
                <Row gutter={[24, 16]}>
                  {data.resultFileList
                    ?.filter((item) => item.ownerType === '22_00018-302')[0]
                    ?.fileList.map((x, t) => (
                      <Col span={12} key={t}>
                        <div className="public-fileCard">
                          <img src={$$.fileType(x.cat)} alt="" />
                          <div className="public-fileCard-main">
                            <Typography.Text ellipsis={{ tooltip: x.name }}>{x.name}</Typography.Text>
                            <Space size="middle" className="public-fileCard-action">
                              <Link onClick={() => myUploadRef.current.handleOpenFiles(x)}>预览</Link>
                              <Link onClick={() => myUploadRef.current.handleDownloadFiles(x)}>下载</Link>
                            </Space>
                          </div>
                          <div className="public-fileCard-del" onClick={() => handleChangeFile(x)}>
                            <CloseCircleFilled />
                          </div>
                        </div>
                        <div className="public-fileCard-text">
                          <div>制作人:{x.uploaderName || '-'}</div>
                          <div>制作时间:{$$.timeFormat(x.createTime)}</div>
                        </div>
                      </Col>
                    ))}
                  <Col span={12}>
                    <MyUpload
                      type="diy"
                      fileId={caseId}
                      fileType="22_00018-302"
                      fileList={data.resultFileList?.filter((item) => item.ownerType === '22_00018-302')[0]?.fileList || []}
                      showFileList={false}
                      myUploadRef={myUploadRef}
                      handleChangeFile={(type) => {
                        if (type === 'success') getData();
                      }}
                    >
                      <Tooltip title="点击上传">
                        <div className="mediationWindow-document-plus">
                          <PlusOutlined style={{ fontSize: '24px', color: 'rgba(0,0,0,0.5)' }} />
                        </div>
                      </Tooltip>
                    </MyUpload>
                  </Col>
                </Row>
              </Col>
              <Col span={24}>
                <h5>诉前调书号</h5>
                <Input
                  value={formData.mediateBookNo}
                  onChange={(e) => handleChangeInput('mediateBookNo', e.target.value)}
                  placeholder="输入审判业务系统的诉前调书号(如有)"
                  allowClear
                  style={{ width: '354px' }}
                />
              </Col>
              <Col span={24}>
                <h5>诉前调解案号</h5>
                <Input
                  value={formData.mediateNo}
                  onChange={(e) => handleChangeInput('mediateNo', e.target.value)}
                  placeholder="输入审判业务系统的诉前调解案号(如有)"
                  allowClear
                  style={{ width: '354px' }}
                />
              </Col>
            </>
          )}
          <Col span={24}>
            <h5>人员参与情况(打勾代表参与调解)</h5>
            <Space direction="vertical">
              {!data.meetUserList?.length && $$.MyEmpty()}
              {data.meetUserList?.map((x, t) => (
                <Checkbox
                  key={t}
                  checked={x.signStatus === '2' ? true : false}
                  onChange={(e) => {
                    data.meetUserList[t].signStatus = e.target.checked ? '2' : '1';
                    setData({ ...data });
                  }}
                >
                  {x.userName}
                </Checkbox>
              ))}
            </Space>
          </Col>
          <Col span={24}>
            <h5>调解备注</h5>
            <TextArea
              value={formData.handleContent}
              placeholder="简要对调解过程进行总结"
              allowClear
              rows={2}
              onChange={(e) => handleChangeInput('handleContent', e.target.value)}
            />
          </Col>
          {/* TODO:暂无  */}
          <Col span={24}>
            <h5>上传附件</h5>
            <MyUpload fileId={caseId} fileType="22_00018-305" fileList={data.sceneFileList || []} />
          </Col>
        </Row>
      </div>
      <div className="mediationWindow-modal-footer">
        {!showResultButton &&
          <Space size="large">
            <Button
              type="primary"
              onClick={() => {
                $$.modalInfo({
                  title: '调解结果提交确认',
                  content: <span>确定提交本案的调解结果为<span className="public-color">{formData.mediResultName}</span>吗?</span>,
                  okText: '确定提交',
                  cancelText: '我再想想',
                  onOk: () => resultFeedback(),
                });
              }}
            >
              提交结果
            </Button>
          </Space>
 
        }
      </div>
    </>
  );
};
 
export default ResultFeedback;