From de2659b89012c81eec2c2c99c2a4a9e417c60d11 Mon Sep 17 00:00:00 2001
From: zhangyongtian <1181606322@qq.com>
Date: Mon, 02 Sep 2024 18:16:10 +0800
Subject: [PATCH] feat: 纠纷登记编辑回显

---
 gz-customerSystem/src/views/register/visit/index.jsx |   32 +++++++++++++++++++++++++++++---
 gz-customerSystem/src/router/router.js               |    2 +-
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/gz-customerSystem/src/router/router.js b/gz-customerSystem/src/router/router.js
index 5dd82ce..288ae76 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/views/register/visit/index.jsx b/gz-customerSystem/src/views/register/visit/index.jsx
index e56cdc3..6321466 100644
--- a/gz-customerSystem/src/views/register/visit/index.jsx
+++ b/gz-customerSystem/src/views/register/visit/index.jsx
@@ -13,9 +13,10 @@
 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,18 +32,43 @@
 	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(1);
 	const [id, setId] = useState();
 
 	useEffect(() => {
-		getAppId()
+		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()

--
Gitblit v1.8.0