| | |
| | | import React, { useRef } from 'react' |
| | | import React, { useEffect, useRef, useState } from 'react' |
| | | import { Row, Col } from 'antd'; |
| | | import { Form, Input, Button, Radio, Select, Modal, Cascader, Upload, Message } from '@arco-design/web-react'; |
| | | 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'; |
| | | |
| | | const RadioGroup = Radio.Group; |
| | | const FormItem = Form.Item; |
| | | const TextArea = Input.TextArea; |
| | | const appUrl = $$.appUrl; |
| | | |
| | | function getId() { |
| | | return $$.ax.request({ url: `caseUtils/getNewTimeId`, type: 'get', service: 'utils' }); |
| | | } |
| | | |
| | | function delFile(id) { |
| | | return $$.ax.request({ url: `fileInfo/deleteFileById`, type: 'delete', service: 'sys', data: { id } }); |
| | | } |
| | | |
| | | function returnApply(data) { |
| | | return $$.ax.request({ url: `caseTask/returnApply`, type: 'post', service: 'mediate', data }); |
| | | } |
| | | |
| | | export default function BackModel(props) { |
| | | const formRef = useRef(); |
| | | const [id, setId] = useState(); |
| | | const options = [ |
| | | { |
| | | label: '不属于本部门的职能范围', |
| | |
| | | value: 5 |
| | | }, |
| | | ] |
| | | const handleSubmit = () => { |
| | | |
| | | useEffect(() => { |
| | | getAppId() |
| | | }, []) |
| | | |
| | | //获取id |
| | | const getAppId = async () => { |
| | | const res = await getId() |
| | | if (res.type) { |
| | | setId(res.data) |
| | | } |
| | | } |
| | | |
| | | const handleSubmit = () => { |
| | | if (formRef.current) { |
| | | formRef.current.validate(undefined, (errors, values) => { |
| | | if (!errors) { |
| | | handleReturn({ |
| | | id, |
| | | caseId: props.caseId, |
| | | returnContent: values.returnContent |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | //删除文件 |
| | | const handleDelFile = async (id) => { |
| | | const res = await delFile(id) |
| | | if (res.type) { |
| | | $$.infoSuccess({ content: '删除成功!' }); |
| | | } |
| | | } |
| | | |
| | | //回退请求 |
| | | const handleReturn = async (data) => { |
| | | const res = await returnApply(data) |
| | | if (res.type) { |
| | | $$.infoSuccess({ content: '提交申请成功!' }); |
| | | props.onCancel() |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div> |
| | | <Scrollbars style={{ height: '550px' }} autoHide> |
| | |
| | | <Col span={24}> |
| | | <FormItem |
| | | label={(<div style={{ display: 'flex' }}>回退理由<div className="must">必填</div></div>)} |
| | | field='trueName' |
| | | field='backType' |
| | | rules={[{ required: true, message: '请选择回退理由' }]} |
| | | > |
| | | <RadioGroup direction='vertical' options={options}> |
| | | </RadioGroup> |
| | | <RadioGroup |
| | | direction='vertical' |
| | | options={options} |
| | | onChange={(value) => { |
| | | const obj = options.find(item => item.value === value) |
| | | formRef.current.setFieldValue('returnContent', obj.label) |
| | | }} |
| | | /> |
| | | </FormItem> |
| | | </Col> |
| | | <Col span={24}> |
| | | <FormItem |
| | | label=' ' |
| | | field='luyou' |
| | | field='returnContent' |
| | | rules={[{ required: true, message: '回退理由不能为空' }]} |
| | | > |
| | | <TextArea |
| | |
| | | <Col span={24} className="doubleFile"> |
| | | <ArcoUpload |
| | | params={{ |
| | | action: ``, |
| | | action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.caseId}&ownerId=${id}&ownerType=22_00018-510`, |
| | | }} |
| | | field='file' |
| | | label='附件材料' |
| | | handleDelFile={handleDelFile} |
| | | /> |
| | | </Col> |
| | | </Row> |