From 552853dc3cd7864d70783153a8bcf2cc8909edd2 Mon Sep 17 00:00:00 2001
From: dminyi <1301963064@qq.com>
Date: Mon, 02 Sep 2024 20:01:27 +0800
Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/gzzfw/frontEnd/gzDyh into master
---
gz-customerSystem/src/views/register/visit/component/applyDialog.jsx | 122 ++++++++-----
gz-customerSystem/src/components/personCard/DetailDialog.jsx | 16 +
gz-customerSystem/src/views/register/visit/component/agentDialog.jsx | 97 ++++++----
gz-customerSystem/src/api/appUrl.js | 2
gz-customerSystem/src/components/ArcoUpload/index.less | 16 +
gz-customerSystem/src/router/router.js | 2
gz-customerSystem/src/utils/caseTypeSelect.js | 6
gz-customerSystem/src/components/ArcoUpload/index.jsx | 74 ++++++++
gz-customerSystem/src/views/register/index.less | 8
gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx | 76 +++-----
gz-customerSystem/src/components/personCard/index.jsx | 2
gz-customerSystem/src/views/register/visit/index.jsx | 104 +++++++----
gz-customerSystem/src/utils/utility.js | 2
13 files changed, 344 insertions(+), 183 deletions(-)
diff --git a/gz-customerSystem/src/api/appUrl.js b/gz-customerSystem/src/api/appUrl.js
index d4e5a71..06e403f 100644
--- a/gz-customerSystem/src/api/appUrl.js
+++ b/gz-customerSystem/src/api/appUrl.js
@@ -2,7 +2,7 @@
* @Company: hugeInfo
* @Author: ldh
* @Date: 2022-02-16 11:25:57
- * @LastEditTime: 2024-09-02 10:43:43
+ * @LastEditTime: 2024-09-02 19:58:19
* @LastEditors: dminyi 1301963064@qq.com
* @Version: 1.0.0
* @Description: api地址
diff --git a/gz-customerSystem/src/components/ArcoUpload/index.jsx b/gz-customerSystem/src/components/ArcoUpload/index.jsx
new file mode 100644
index 0000000..592096c
--- /dev/null
+++ b/gz-customerSystem/src/components/ArcoUpload/index.jsx
@@ -0,0 +1,74 @@
+import React, { useEffect, useState } from 'react'
+import { Upload, Form } from '@arco-design/web-react';
+import {
+ IconAttachment,
+} from '@arco-design/web-react/icon';
+import * as $$ from '../../utils/utility';
+import './index.less';
+
+const FormItem = Form.Item;
+
+/**
+ * params *, //upload组件参数
+ * field *, // form的标识
+ * handleChangeFile, // 文件上传成功之后的回调
+ * label *, // form的label名
+ * editData *, // 编辑回显数据
+ */
+
+export default function ArcoUpload(props) {
+ const [myFileList, setMyFileList] = useState([])
+ useEffect(() => {
+ if(props.editData) {
+ console.log(props.editData[props.field]);
+ setMyFileList(props.editData[props.field])
+ }
+ }, [props.editData])
+
+ return (
+ <FormItem
+ label={props.label}
+ field={props.field}
+ triggerPropName='fileList'
+ >
+ <Upload
+ drag
+ multiple
+ accept='.png,.jpg,.pdf'
+ onDrop={(e) => {
+ }}
+ tip='支持png、jpg、pdf格式的图片上传,每次上传大小不超过10M'
+ showUploadList={{
+ fileIcon: <IconAttachment style={{ color: '#1D2129' }} />,
+ }}
+ headers={{ Authorization: $$.getSessionStorage('customerSystemToken') }}
+ onChange={(fileList, file) => {
+ console.log(fileList, myFileList, file);
+ const { status, response } = file
+ //因为字节upLoad组件有bug,不能区分添加文件还是删除文件,所以用这种办法来判断是不是删除
+ const isDel = myFileList && myFileList.length > fileList.length
+ //上传失败
+ if (status === 'error' && !isDel) {
+ $$.info({ type: 'error', content: '抱歉,网络错误附件上传失败,请稍后重试' });
+ }
+ //上传成功
+ if (status === 'done' && !isDel) {
+ if (response.code === 0 || response.code === '0') {
+ // 返回附件成功上传的回调
+ $$.infoSuccess({ content: response.msg });
+ if (props.handleChangeFile) {
+ props.handleChangeFile(response);
+ }
+ }
+ }
+ //删除文件
+ if (isDel) {
+
+ }
+ setMyFileList(fileList)
+ }}
+ {...props.params}//自定义
+ />
+ </FormItem>
+ )
+}
diff --git a/gz-customerSystem/src/components/ArcoUpload/index.less b/gz-customerSystem/src/components/ArcoUpload/index.less
new file mode 100644
index 0000000..f7cf232
--- /dev/null
+++ b/gz-customerSystem/src/components/ArcoUpload/index.less
@@ -0,0 +1,16 @@
+.arco-upload-list {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+}
+.arco-upload-list-item {
+ width: calc(50% - 17px);
+ margin-top: 24px;
+ margin-left: 17px;
+
+ &:nth-child(2n+1) {
+ width: calc(50% - 17px);
+ margin-right: 17px;
+ margin-left: 0px;
+ }
+}
\ No newline at end of file
diff --git a/gz-customerSystem/src/components/personCard/DetailDialog.jsx b/gz-customerSystem/src/components/personCard/DetailDialog.jsx
index a62c172..2e177df 100644
--- a/gz-customerSystem/src/components/personCard/DetailDialog.jsx
+++ b/gz-customerSystem/src/components/personCard/DetailDialog.jsx
@@ -281,7 +281,7 @@
{
label: '代理对象',
value: '',
- field: 'personList',
+ field: 'personId',
},
],
[
@@ -337,9 +337,17 @@
perClass: data.perClassName || data.perTypeName
}
} else {
- return {
- ...res,
- value: res.field === 'personList' ? data[res.field].join(',') : data[res.field]
+ if (res.field === 'personId') {
+ const filterValue = props.personData.filter(result => data[res.field].indexOf(result.id) != -1).map(result => result.trueName).join(',')
+ return {
+ ...res,
+ value: filterValue
+ }
+ } else {
+ return {
+ ...res,
+ value: data[res.field]
+ }
}
}
})
diff --git a/gz-customerSystem/src/components/personCard/index.jsx b/gz-customerSystem/src/components/personCard/index.jsx
index df5109e..90394f2 100644
--- a/gz-customerSystem/src/components/personCard/index.jsx
+++ b/gz-customerSystem/src/components/personCard/index.jsx
@@ -142,7 +142,7 @@
unmountOnExit={true}
maskClosable={false}
>
- <DetailDialog editData={editData} />
+ <DetailDialog editData={editData} personData={data} />
</Modal>
</Fragment>
);
diff --git a/gz-customerSystem/src/router/router.js b/gz-customerSystem/src/router/router.js
index 5436453..61f7003 100644
--- a/gz-customerSystem/src/router/router.js
+++ b/gz-customerSystem/src/router/router.js
@@ -212,7 +212,7 @@
<Route path="myConfirmation" element={<MyConfirmation />} />
<Route path="judicialOverview" element={<JudicialOverview />} />
{/* 来访登记*/}
- <Route path="visit" element={<Visit />} />
+ <Route path="visit/:id?" element={<Visit />} />
<Route path="visit/eventFlow" element={<EventFlow />} />
<Route path="visit/handleFeedback" element={<HandleFeedback />} />
diff --git a/gz-customerSystem/src/utils/caseTypeSelect.js b/gz-customerSystem/src/utils/caseTypeSelect.js
index 7858103..bf234b7 100644
--- a/gz-customerSystem/src/utils/caseTypeSelect.js
+++ b/gz-customerSystem/src/utils/caseTypeSelect.js
@@ -45,3 +45,9 @@
},
]
+
+const obj = {
+ caseTypeSelect
+};
+
+export default obj;
diff --git a/gz-customerSystem/src/utils/utility.js b/gz-customerSystem/src/utils/utility.js
index 43c3421..b7f9a0a 100644
--- a/gz-customerSystem/src/utils/utility.js
+++ b/gz-customerSystem/src/utils/utility.js
@@ -36,7 +36,7 @@
// 下拉框
export { default as options } from './selectOption';
-
+export { default as caseTypeSelect } from './caseTypeSelect';
export { default as caseOptions } from './caseCauseSelect';
// icon 对照表
diff --git a/gz-customerSystem/src/views/register/index.less b/gz-customerSystem/src/views/register/index.less
index 0bdef29..0672fc1 100644
--- a/gz-customerSystem/src/views/register/index.less
+++ b/gz-customerSystem/src/views/register/index.less
@@ -178,11 +178,11 @@
}
}
-.arco-upload-list-type-text .arco-upload-list-item:first-of-type,
-.arco-upload-list-type-picture-list .arco-upload-list-item:first-of-type {
- margin-top: 34px;
+// .arco-upload-list-type-text .arco-upload-list-item:first-of-type,
+// .arco-upload-list-type-picture-list .arco-upload-list-item:first-of-type {
+// margin-top: 34px;
-}
+// }
.unitDialogResult {
font-size: 16px;
diff --git a/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx b/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx
index b63946c..ddc860f 100644
--- a/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx
@@ -2,20 +2,24 @@
import { Row, Col, Space } from 'antd';
import { Form, Input, Button, Radio, Select, Checkbox, Upload } from '@arco-design/web-react';
import KeyVisits from "@/components/personCard/KeyVisits";
-import {
- IconLink,
-} from '@arco-design/web-react/icon';
import * as $$ from '@/utils/utility';
+import ArcoUpload from '@/components/ArcoUpload';
const FormItem = Form.Item;
const Option = Select.Option;
const InputSearch = Input.Search;
const RadioGroup = Radio.Group;
const CheckboxGroup = Checkbox.Group;
+const appUrl = $$.appUrl;
+
+function getId() {
+ return $$.ax.request({ url: `caseUtils/getNewTimeId`, type: 'get', service: 'utils' });
+}
export default function AgentDialog(props) {
const formRef = useRef();
const [visitList, setVisitList] = useState([])
+ const [id, setId] = useState()
useEffect(() => {
if (props.editData) {
@@ -23,7 +27,6 @@
formRef.current.setFieldsValue({
...props.editData
})
- console.log(props);
//过滤代理人
setVisitList(props.fakeData.filter(item => {
if (props.editData.perType === '24_00006-1') {
@@ -41,8 +44,18 @@
return item.perType === '15_020008-2'
}
}))
+ //获取id
+ getAppId()
}
}, [])
+
+ //获取id
+ const getAppId = async () => {
+ const res = await getId()
+ if (res.type) {
+ setId(res.data)
+ }
+ }
//保存信息
const handleSave = () => {
@@ -53,17 +66,31 @@
if (props.editData) {
props.handleAddParty({
...fieldValue
- })
+ }, true)
} else {
props.handleAddParty({
...fieldValue,
perType: props.dialogType,
perTypeName: $$.options.personType.find(item => item.value === props.dialogType).label,
- })
+ id: id
+ }, false)
}
props.onClose()
}
});
+ }
+ }
+
+ //上传身份证识别
+ const handleChangeFile = (data) => {
+ if (data.data && data.data.length != 0) {
+ if (data.data[0].idcardOcrResult) {
+ const { birthday, ...rest } = data.data[0].idcardOcrResult
+ //回填信息
+ formRef.current.setFieldsValue({
+ ...rest
+ })
+ }
}
}
@@ -82,39 +109,25 @@
>
<Row gutter={[32, 0]} style={{ margin: '0 -10px' }}>
<Col span={24}>
- <FormItem
- label='身份证明材料'
+ <ArcoUpload
+ params={{
+ action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
+ }}
field='file'
- >
- <Upload
- drag
- multiple
- accept='image/*'
- action='/'
- onDrop={(e) => {
- }}
- tip='支持png、jpg、pdf格式的图片上传,每次上传大小不超过10M'
- showUploadList={{
- fileIcon: <IconLink style={{ color: '#1D2129' }} />,
- }}
- />
- </FormItem>
+ handleChangeFile={handleChangeFile}
+ label='身份证明材料'
+ editData={props.editData}
+ />
</Col>
<Col span={24}>
- <FormItem
- label='代理人委托书'
+ <ArcoUpload
+ params={{
+ action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
+ }}
field='file1'
- >
- <Upload
- drag
- multiple
- accept='image/*'
- action='/'
- onDrop={(e) => {
- }}
- tip='支持png、jpg、pdf格式的图片上传,每次上传大小不超过10M'
- />
- </FormItem>
+ label='代理人委托书'
+ editData={props.editData}
+ />
</Col>
<Col span={12}>
<FormItem
@@ -303,7 +316,19 @@
>
保存
</Button>
- <Button className="dialogBack">
+ <Button
+ className="dialogBack"
+ onClick={() => {
+ if (props.editData) {
+ formRef.current.resetFields();
+ formRef.current.setFieldsValue({
+ ...props.editData
+ })
+ } else {
+ formRef.current.resetFields();
+ }
+ }}
+ >
重置
</Button>
</div>
diff --git a/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx b/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx
index 757f2ef..4e4be9f 100644
--- a/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx
@@ -15,19 +15,24 @@
import { Form, Input, Button, Radio, Select, Modal, Cascader, Upload, Message } from '@arco-design/web-react';
import KeyVisits from "@/components/personCard/KeyVisits";
import SelectUnitDialog from "./selectUnitDialog";
-import {
- IconLink,
-} from '@arco-design/web-react/icon';
+import ArcoUpload from '@/components/ArcoUpload';
const FormItem = Form.Item;
const Option = Select.Option;
const InputSearch = Input.Search;
const RadioGroup = Radio.Group;
+const appUrl = $$.appUrl;
+
+
+function getId() {
+ return $$.ax.request({ url: `caseUtils/getNewTimeId`, type: 'get', service: 'utils' });
+}
export default function ApplyDialog(props) {
const formRef = useRef();
const [perClass, setPerClass] = useState('09_01001-1');
const [visible, setVisible] = useState(false);
+ const [id, setId] = useState()
useEffect(() => {
if (props.editData) {
@@ -36,9 +41,19 @@
...props.editData
})
setPerClass(props.editData.perClass)
+ setId(props.editData.id)
+ } else {
+ getAppId()
}
}, [])
+ //获取id
+ const getAppId = async () => {
+ const res = await getId()
+ if (res.type) {
+ setId(res.data)
+ }
+ }
const personIconType = (v) => {
switch (v) {
@@ -51,6 +66,19 @@
}
}
+ //上传身份证识别
+ const handleChangeFile = (data) => {
+ if (data.data && data.data.length != 0) {
+ if (data.data[0].idcardOcrResult) {
+ const { birthday, ...rest } = data.data[0].idcardOcrResult
+ //回填信息
+ formRef.current.setFieldsValue({
+ ...rest
+ })
+ }
+ }
+ }
+
//页面返回
const formType = (type) => {
if (type === '09_01001-1') {
@@ -58,23 +86,15 @@
return (
<>
<Col span={24}>
- <FormItem
- label='身份证明材料'
+ <ArcoUpload
+ params={{
+ action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
+ }}
field='file'
- >
- <Upload
- drag
- multiple
- accept='image/*'
- action='/'
- onDrop={(e) => {
- }}
- tip='支持png、jpg、pdf格式的图片上传,每次上传大小不超过10M'
- showUploadList={{
- fileIcon: <IconLink style={{ color: '#1D2129' }} />,
- }}
- />
- </FormItem>
+ handleChangeFile={handleChangeFile}
+ label='身份证明材料'
+ editData={props.editData}
+ />
</Col>
<Col span={12}>
<FormItem
@@ -202,36 +222,24 @@
return (
<>
<Col span={24}>
- <FormItem
- label={isLegal ? '企业登记材料' : '机构登记材料'}
+ <ArcoUpload
+ params={{
+ action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
+ }}
field='file'
- >
- <Upload
- drag
- multiple
- accept='image/*'
- action='/'
- onDrop={(e) => {
- }}
- tip='支持png、jpg、pdf格式的图片上传,每次上传大小不超过10M'
- />
- </FormItem>
+ label={isLegal ? '企业登记材料' : '机构登记材料'}
+ editData={props.editData}
+ />
</Col>
<Col span={24}>
- <FormItem
- label={isLegal ? '法定代表人身份证明材料' : '机构代表人身份证明材料'}
+ <ArcoUpload
+ params={{
+ action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
+ }}
field='file1'
- >
- <Upload
- drag
- multiple
- accept='image/*'
- action='/'
- onDrop={(e) => {
- }}
- tip='支持png、jpg、pdf格式的图片上传,每次上传大小不超过10M'
- />
- </FormItem>
+ label={isLegal ? '法定代表人身份证明材料' : '机构代表人身份证明材料'}
+ editData={props.editData}
+ />
</Col>
<Col span={12}>
<FormItem
@@ -304,18 +312,20 @@
formRef.current.validate(undefined, (errors, values) => {
if (!errors) {
const fieldValue = formRef.current.getFields()
+ console.log(fieldValue);
if (props.editData) {
props.handleAddParty({
...fieldValue
- })
+ }, true)
} else {
props.handleAddParty({
...fieldValue,
perType: props.dialogType,
perClass: perClass,
perTypeName: $$.options.personType.find(item => item.value === props.dialogType).label,
- perClassName: $$.options.personClass.find(item => item.value === perClass).label
- })
+ perClassName: $$.options.personClass.find(item => item.value === perClass).label,
+ id: id
+ }, false)
}
props.onClose()
}
@@ -379,7 +389,21 @@
>
保存
</Button>
- <Button className="dialogBack">
+ <Button
+ className="dialogBack"
+ onClick={() => {
+ if (props.editData) {
+ formRef.current.resetFields();
+ formRef.current.setFieldsValue({
+ ...props.editData
+ })
+ setPerClass(props.editData.perClass)
+ } else {
+ formRef.current.resetFields();
+ setPerClass('09_01001-1')
+ }
+ }}
+ >
重置
</Button>
</div>
diff --git a/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx b/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
index 630a3b2..89134f4 100644
--- a/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
@@ -26,10 +26,6 @@
const FormItem = Form.Item;
const InputSearch = Input.Search;
-function getId() {
- return $$.ax.request({ url: `caseUtils/getNewTimeId`, type: 'get', service: 'utils' });
-}
-
const VisitorRegister = (props) => {
const [dialogType, setDialogType] = useState();//添加当事人的类型
@@ -260,44 +256,6 @@
// 更多列配置...
];
- const options1 = [
- {
- value: 'jingjijiufen',
- label: '经济纠纷',
- children: [
- {
- value: 'laodongjiufen',
- label: '劳动纠纷',
- },
- {
- value: 'laodongzhengyijiufen',
- label: '劳动争议纠纷',
- },
- ],
- },
- {
- value: 'linlijiufen',
- label: '邻里纠纷',
- children: [
- {
- value: 'linlijiufen',
- label: '邻里纠纷',
- },
- ],
- },
- ];
-
- //获取id
- const getAppId = async (value) => {
- const res = await getId()
- if (res.type) {
- setFakeData([...fakeData, {
- ...value,
- id: res.data
- }])
- }
- }
-
//获取当前时间
const getFormattedDateTime = () => {
let now = new Date();
@@ -331,8 +289,9 @@
};
//添加当事人
- const handleAddParty = (value) => {
- if (value.id) {
+ const handleAddParty = (value, isEdit) => {
+ console.log(value, isEdit);
+ if (isEdit) {
//编辑
const newList = fakeData.map(item => {
if (item.id === value.id) {
@@ -344,7 +303,9 @@
setFakeData(newList)
setEditData(null)
} else {
- getAppId(value)
+ setFakeData([...fakeData, {
+ ...value
+ }])
}
}
@@ -435,13 +396,28 @@
<FormItem
label={(<div style={{ display: 'flex' }}>纠纷类型<div className="must">必填</div></div>)}
rules={[{ message: '请选择纠纷类型', required: true }]}
- field='caseType'
+ field='myCaseType'
>
<Cascader
placeholder='请选择'
- options={options1}
+ options={$$.caseTypeSelect.caseTypeSelect}
onChange={(value, option) => {
- console.log(value, option);
+ if (option) {
+ props.formRef.current.setFieldsValue({
+ caseTypeFirst: option[0].value,
+ caseTypeFirstName: option[0].label,
+ caseType: option[1].value,
+ caseTypeName: option[1].label,
+ })
+ } else {
+ //清除数据
+ props.formRef.current.setFieldsValue({
+ caseTypeFirst: undefined,
+ caseTypeFirstName: undefined,
+ caseType: undefined,
+ caseTypeName: undefined,
+ })
+ }
}}
allowClear
/>
@@ -476,7 +452,7 @@
</FormItem>
</Col>
<Col span={8}>
- <FormItem label='问题属地' field='quesAddress'>
+ <FormItem label='问题属地' field='myQuesAddress'>
<Cascader
placeholder='请选择'
options={$$.locationOption()}
@@ -671,6 +647,7 @@
onClose={() => setAddVisabled(false)}
handleAddParty={handleAddParty}
editData={editData}
+ mainId={props.mainId}
/>
</Modal>
<Modal
@@ -693,6 +670,7 @@
fakeData={fakeData}
dialogType={dialogType}
editData={editData}
+ mainId={props.mainId}
/>
</Modal>
<Modal
diff --git a/gz-customerSystem/src/views/register/visit/index.jsx b/gz-customerSystem/src/views/register/visit/index.jsx
index bf03f00..60a8177 100644
--- a/gz-customerSystem/src/views/register/visit/index.jsx
+++ b/gz-customerSystem/src/views/register/visit/index.jsx
@@ -2,20 +2,21 @@
* @Author: dminyi 1301963064@qq.com
* @Date: 2024-08-09 09:59:43
* @LastEditors: dminyi 1301963064@qq.com
- * @LastEditTime: 2024-09-02 11:40:22
+ * @LastEditTime: 2024-09-02 19:59:41
* @FilePath: \gzDyh\gz-customerSystem\src\views\basicInformation\organization\index.jsx
* @Description: 来访登记
*/
-import React, { useState, useRef, Fragment } from "react";
+import React, { useState, useRef, Fragment, useEffect } from "react";
import NewPage from '@/components/NewPage';
import * as $$ from '@/utils/utility';
import "@arco-themes/react-gzzz/css/arco.css";
import '../index.less';
import { Space } from 'antd';
-import { Button, Steps, Tabs, Message } from '@arco-design/web-react';
+import { Button, Steps, Message } from '@arco-design/web-react';
import VisitorRegister from './component/visitorRegister';
import Preview from './preview';
+import { useParams } from 'react-router-dom';
const Step = Steps.Step;
@@ -31,26 +32,63 @@
return $$.ax.request({ url: `caseInfo/caseRegister`, type: 'post', service: 'mediate', data });
}
+function getDetailData(id) {
+ return $$.ax.request({ url: `/casedraftInfo/getCasedraftInfo?id=${id}`, type: 'get', service: 'mediate' });
+}
-const Organization = () => {
+
+const Organization = (props) => {
const formRef = useRef();
+ const routeData = useParams();
const [isReview, setIsReview] = useState(false);//预览页面控制
- const [current, setCurrent] = useState(3);
+ const [current, setCurrent] = useState(1);
+ const [id, setId] = useState();
+
+ useEffect(() => {
+ if (routeData.id) {
+ getDeatil(routeData.id)
+ } else {
+ getAppId()
+ }
+
+ }, [])
+
+ //编辑
+ const getDeatil = async (id) => {
+ const res = await getDetailData(id)
+ if (res.type) {
+ console.log(res);
+ const { agentList, personList, ...rest } = res.data
+ formRef.current.setFieldsValue({
+ ...rest,
+ fakeData: agentList.concat(personList),
+ myCaseType: [rest.caseTypeFirst, rest.caseType],
+ myQuesAddress: rest.queRoad ? [rest.queProv, rest.queCity, rest.queArea, rest.queRoad] : undefined
+ })
+ }
+ }
+
+ //获取id
+ const getAppId = async () => {
+ const res = await getId()
+ if (res.type) {
+ setId(res.data)
+ }
+ }
//提交信息,需要校验规则
const handleSubmit = async () => {
if (formRef.current) {
formRef.current.validate(undefined, (errors, values) => {
if (!errors) {
- const data = formRef.current.getFields()
- handleData(data).then(res => {
- reauestSubmit({
- ...res,
- isSelfAccept: 0,
- isDraft: 0,
- operateType: 0,
- })
+ const { myCaseType, myQuesAddress, ...rest } = formRef.current.getFields()
+ const params = handleData(rest)
+ reauestSubmit({
+ ...params,
+ isSelfAccept: 0,
+ isDraft: 0,
+ operateType: 0,
})
}
});
@@ -60,45 +98,37 @@
//保存草稿信息,不需要校验规则
const handleSave = () => {
if (formRef.current) {
- const data = formRef.current.getFields()
- handleData(data).then(res => {
- requestSave(res)
- })
+ const { myCaseType, myQuesAddress, ...rest } = formRef.current.getFields()
+ const params = handleData(rest)
+ requestSave(params)
}
}
//数据处理
- const handleData = async (data) => {
+ const handleData = (data) => {
const { fakeData, ...newObj } = data
if (data.id) {
return {
...newObj,
personList: fakeData?.filter(item => item.perType === "15_020008-1" || item.perType === "15_020008-2"),
agentList: fakeData?.filter(item => item.perType === "24_00006-1" || item.perType === "24_00006-2").map(item => {
- //personNameList用于查看详情显示代理人名字,不需要上传,去除
- const { personNameList, ...rest } = item
return {
- ...rest,
+ ...item,
personId: item.personId.join(',')
}
}),
}
} else {
- const res = await getId()
- if (res.type) {
- return {
- ...newObj,
- personList: fakeData?.filter(item => item.perType === "15_020008-1" || item.perType === "15_020008-2"),
- agentList: fakeData?.filter(item => item.perType === "24_00006-1" || item.perType === "24_00006-2").map(item => {
- //personNameList用于查看详情显示代理人名字,不需要上传,去除
- const { personNameList, ...rest } = item
- return {
- ...rest,
- personId: item.personId.join(',')
- }
- }),
- id: res.data
- }
+ return {
+ ...newObj,
+ personList: fakeData?.filter(item => item.perType === "15_020008-1" || item.perType === "15_020008-2"),
+ agentList: fakeData?.filter(item => item.perType === "24_00006-1" || item.perType === "24_00006-2").map(item => {
+ return {
+ ...item,
+ personId: item.personId.join(',')
+ }
+ }),
+ id: id
}
}
}
@@ -156,7 +186,7 @@
</Steps>
</div>
<Preview style={{ display: isReview ? '' : 'none' }} />
- <VisitorRegister formRef={formRef} style={{ display: isReview ? 'none' : '' }} />
+ <VisitorRegister formRef={formRef} style={{ display: isReview ? 'none' : '' }} mainId={id} />
<div className="dataSync-excel">
<Space size="large" style={{ margin: '4px 14px' }}>
<Button type="primary" style={{ backgroundColor: '#1A6FB8' }} onClick={handleSave} >保存</Button>
--
Gitblit v1.8.0