广州市综治平台前端
xusd
2025-06-07 ee685c9f350ec9241107d4e8a05799768a0bce9a
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
import React, { useRef, useEffect, useState } from 'react'
import { Row, Col, Space } from 'antd';
import { link } from '@/assets/images';
import { Form, Input, Button, Radio } from '@arco-design/web-react';
import ArcoUpload from '@/components/ArcoUpload';
import { Scrollbars } from "react-custom-scrollbars";
import * as $$ from '@/utils/utility';
import { getOffset, getSize } from '@/utils/utility';
import { useNavigate } from 'react-router-dom';
import PreviewImage from '@/components/PreviewImage';
import NameCard2 from '@/components/NameCard2';
 
const RadioGroup = Radio.Group;
const FormItem = Form.Item;
const TextArea = Input.TextArea;
const appUrl = $$.appUrl;
 
function getData(type, data) {
  let url = type === 'htsh' ? `caseTask/getReturnApplyInfo` : `caseTask/getAppearApplyInfo`
  return $$.ax.request({ url: url, type: 'get', service: 'mediate', data });
}
 
function submit(type, data) {
  let url = type === 'htsh' ? `caseTask/returnAudit` : `caseTask/appearAudit`
  return $$.ax.request({ url: url, type: 'post', service: 'mediate', data });
}
 
function delFile(id) {
  return $$.ax.request({ url: `fileInfo/deleteFileById`, type: 'get', service: 'sys', data: { id } });
}
 
export default function Examine(props) {
  const navigate = useNavigate();
  const formRef = useRef();
  const scrollRef = useRef(null);
  const [infoData, setInfoData] = useState({});
  const [id, setId] = useState();
  const [height, setHeight] = useState(500);
  const [agreeRadio, setAgreeRadio] = useState();
  const [reasonRadio, setReasonRadio] = useState();
  const mainFlag = props.type == 'htsh' ? 'return' : 'appear'
  const options = props.type == 'htsh' ? [
    {
      label: '回退理由不充分',
      value: '0'
    },
    {
      label: '回退延迟',
      value: '1'
    },
    {
      label: '其他',
      value: '2'
    },
  ] : [
    {
      label: '上报理由不充分',
      value: '0'
    },
    {
      label: '上报延迟',
      value: '1'
    },
    {
      label: '其他',
      value: '2'
    },
  ]
 
  useEffect(() => {
    getInfoData()
  }, [props.type])
 
  useEffect(() => {
    onWindowResize()
    window.addEventListener("resize", onWindowResize);
    // 返回一个函数,该函数会在组件卸载前执行  
    return () => {
      // 组件销毁时执行  
      window.removeEventListener("resize", onWindowResize);
    };
  }, [])
 
  const onWindowResize = () => {
    let offsetTop = 0;
    if (scrollRef.current.container) {
      offsetTop = getOffset(scrollRef.current.container).top;
    }
    setHeight(getSize().windowH - offsetTop - 80)
  };
 
  //回显数据
  const getInfoData = async () => {
    const res = await getData(props.type, {
      caseTaskId: props.caseTaskId
    })
    if (res.type) {
      setInfoData(res.data || {})
      setId(res.data.id)
    }
  }
 
  const handleSubmit = () => {
    if (formRef.current) {
      formRef.current.validate(undefined, (errors, values) => {
        if (!errors) {
          const { file, myNoUp, ...rest } = formRef.current.getFields()
          requestSubmit({
            id,
            caseId: props.caseId,
            caseTaskId: props.caseTaskId,
            ...rest
          })
        }
      })
    }
  }
 
  const requestSubmit = async (data) => {
    const res = await submit(props.type, data)
    if (res.type) {
      $$.infoSuccess({ content: '提交成功!' });
      navigate('/mediate/visit/visitWorkBench')
    }
  }
 
  //删除文件
  const handleDelFile = async (id) => {
    const res = await delFile(id)
    if (res.type) {
      $$.infoSuccess({ content: '删除成功!' });
    }
  }
 
  return (
    <div className='dataSync'>
      <div className='dataSync-noBackTabPage' style={{ background: '#fff' }}>
        <Scrollbars style={{ height: height + 'px' }} autoHide ref={scrollRef}>
          <div className='whiteBox'>
            <Space size='small'>
              <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>{props.type === 'htsh' ? '回退申请' : '上报申请'}</h5>
            </Space>
            <Row gutter={[16, 16]}>
              <Col span={24}>
                <div><div className="title-text">{props.type === 'htsh' ? '回退理由' : '上报理由'}</div></div>
                <div>{infoData[mainFlag + 'Content'] || '-'}</div>
              </Col>
              <Col span={24}>
                <div><div className="title-text">附件材料</div></div>
                <div style={{ color: '#1A6FB8' }}>
                  {infoData?.fileInfoList?.map((result, resIndex) => {
                    return <div style={{ display: 'inline-block' }}>
                      <PreviewImage name={result.name} src={result.showUrl} />
                      {resIndex !== infoData?.fileInfoList?.length - 1 && <>,</>}
                    </div>
                  }) || '-'}
                </div>
              </Col>
              <Col span={24}>
                <div><div className="title-text">申请时间</div></div>
                <div>{$$.myTimeFormat(infoData[mainFlag + 'Time'], 'YYYY-MM-DD HH:mm') || '-'}</div>
              </Col>
              <Col span={24}>
                <div><div className="title-text">申请人</div></div>
                <div style={{ display: 'flex' }}>
                  {infoData[mainFlag + 'UnitName']}&nbsp;&nbsp;
                  <NameCard2 name={infoData[mainFlag + 'UserName']} userId={infoData[mainFlag + 'UserId']} />
                </div>
              </Col>
            </Row>
          </div>
          <div className='whiteBox' style={{ borderTop: '8px solid #f0f2f5' }}>
            <Space size='small'>
              <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>审核</h5>
            </Space>
            <Form
              ref={formRef}
              layout='vertical'
              requiredSymbol={false}
              initialValues={{
                auditResult: '24_00004-1',
                auditResultName: "同意"
              }}//默认值
              scrollToFirstError
            >
              <Row>
                <Col span={24}>
                  <FormItem
                    label={(<div style={{ display: 'flex' }}>审核结果</div>)}
                    field='auditResult'
                  >
                    <RadioGroup
                      direction='vertical'
                      options={$$.options.auditResult}
                      onChange={(value) => {
                        setAgreeRadio(value)
                        if (value) {
                          const data = $$.options.auditResult.find(item => item.value === value)
                          formRef.current.setFieldValue('auditResultName', data.label)
                        } else {
                          formRef.current.setFieldValue('auditResultName', '')
                        }
                      }}
                    />
                  </FormItem>
                </Col>
                {agreeRadio == '24_00004-2' &&
                  <>
                    <Col span={24}>
                      <FormItem
                        label={(<div style={{ display: 'flex' }}>理由说明<div className="must">必填</div></div>)}
                        field='myNoUp'
                        rules={[{ required: true, message: '请选择理由说明' }]}
                      >
                        <RadioGroup
                          direction='vertical'
                          options={options}
                          onChange={(value) => {
                            setReasonRadio(value)
                            if (value !== '2') {
                              const obj = options.find(item => item.value === value)
                              formRef.current.setFieldValue('auditContent', obj.label)
                            } else {
                              formRef.current.setFieldValue('auditContent', '')
                            }
                          }}
                        >
                        </RadioGroup>
                      </FormItem>
                    </Col>
                    {
                      reasonRadio === '2' && <Col span={24}>
                        <FormItem
                          label=' '
                          field='auditContent'
                          rules={[{ required: true, message: '理由不能为空' }]}
                        >
                          <TextArea
                            autoSize={{ minRows: 4, maxRows: 8 }}
                            placeholder={`请填写不同意${props.type === 'htsh' ? '回退' : '上报'}的具体理由`}
                          />
                        </FormItem>
                      </Col>
                    }
                    <Col span={24} className="doubleFile">
                      <ArcoUpload
                        params={{
                          action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.caseId}&ownerId=${id}&ownerType=${props.type == 'htsh' ? '22_00018-511' : '22_00018-513'}`,
                        }}
                        field='file'
                        label='附件材料'
                        handleDelFile={handleDelFile}
                      />
                    </Col>
                  </>
                }
              </Row>
            </Form>
          </div>
        </Scrollbars>
        <div className='dialogFooter' style={{ margin: 0, padding: '16px 12px' }}>
          <Button
            type="primary"
            className="dialogPrimary"
            onClick={handleSubmit}
          >
            提交
          </Button>
          <Button type='secondary' onClick={() => navigate(-1)}>返回上级页面</Button>
        </div>
      </div>
    </div >
  )
}