From be89af3bf4d7e591ef085f55f1de7c28fcf5f6a8 Mon Sep 17 00:00:00 2001
From: liuwh <964324856@qq.com>
Date: Sat, 21 Jun 2025 19:50:18 +0800
Subject: [PATCH] fix:修改解纷态势问题

---
 src/views/disputeLedger/index.jsx |  104 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 69 insertions(+), 35 deletions(-)

diff --git a/src/views/disputeLedger/index.jsx b/src/views/disputeLedger/index.jsx
index 88bd32e..50e2e93 100644
--- a/src/views/disputeLedger/index.jsx
+++ b/src/views/disputeLedger/index.jsx
@@ -2,7 +2,7 @@
  * @Company: hugeInfo
  * @Author: lwh
  * @Date: 2024-09-14 15:59:17
- * @LastEditTime: 2025-06-14 11:35:43
+ * @LastEditTime: 2025-06-20 18:48:05
  * @LastEditors: lwh
  * @Version: 1.0.0
  * @Description:
@@ -43,6 +43,11 @@
 // 调度中心列表
 function getListDataApi(submitData) {
 	return $$.ax.request({ url: 'caseInfo/ledger', type: 'get', data: submitData, service: 'mediate' });
+}
+
+//
+function ledgerCountApi(submitData) {
+	return $$.ax.request({ url: 'caseInfo/ledgerCount', type: 'get', data: submitData, service: 'mediate' });
 }
 
 // 区域字典值
@@ -86,7 +91,7 @@
 		data4: { value1: 24, value2: 30, value3: 46 },
 	});
 
-	const [allNum, setAllNum] = useState(0);
+	const [allData, setAllData] = useState({});
 
 	// 搜索 or 重置
 	function handleSearch(type, session) {
@@ -100,8 +105,24 @@
 					},
 					activeKey
 				);
+				ledgerCount(
+					{
+						[session.key]: session.value[0],
+						createStart: $$.dateFormat(session.createStart),
+						createEnd: $$.dateFormat(session.createEnd),
+					},
+					activeKey
+				);
 			} else {
 				getListData(
+					{
+						[normalSearch.key]: normalSearch.value[0],
+						createStart: $$.dateFormat(normalSearch.createStart),
+						createEnd: $$.dateFormat(normalSearch.createEnd),
+					},
+					activeKey
+				);
+				ledgerCount(
 					{
 						[normalSearch.key]: normalSearch.value[0],
 						createStart: $$.dateFormat(normalSearch.createStart),
@@ -119,6 +140,7 @@
 			$$.searchCascader(values, 'queCode', normalSearch.level, ['queCity', 'queArea', 'queRoad', 'queVillage']);
 			$$.searchCascader(values, 'caseType', 1, ['caseType', 'caseType']);
 			getListData({ ...values }, session);
+			ledgerCount({ ...values }, session);
 			return;
 		}
 	}
@@ -131,6 +153,7 @@
 		if (res.type) {
 			let nowData = res.data || {};
 			setData({ ...data, ...nowData });
+			// !allData.hasOwnProperty('sysNum') && ledgerCount(submitData, ledgerType);
 			// setSearch(submitData);
 		}
 	}
@@ -186,6 +209,15 @@
 			3: 'queRoad',
 			4: 'queVillage',
 		}[KeyIndex];
+	}
+
+	async function ledgerCount(submitData, ledgerType) {
+		global.setSpinning(true);
+		const res = await ledgerCountApi({ ...submitData, ledgerType });
+		global.setSpinning(false);
+		if (res.type) {
+			setAllData({ ...res.data });
+		}
 	}
 
 	useEffect(() => {
@@ -281,7 +313,7 @@
 							{
 								icon: disputeLedger_8,
 								title: '全部',
-								value: data?.totalNum || 0,
+								value: allData?.allNum || 0,
 								backgroundColor: '#e8f7ff',
 								borderColor: '#3491fa',
 								color: '#3491FA',
@@ -290,56 +322,56 @@
 							{
 								icon: disputeLedger_9,
 								title: '本系统',
-								value: data?.sysNum || 0,
+								value: allData?.sysNum || 0,
 								backgroundColor: '#fff7e6',
 								borderColor: '#FA8C16',
 								color: '#FA8C16',
-								per: `${data?.sysRate || 0}%`,
+								per: `${allData?.sysRate || 0}%`,
 							},
 							{
 								icon: disputeLedger_10,
 								title: '12345',
-								value: data?.ottffNum || 0,
+								value: allData?.ottffNum || 0,
 								backgroundColor: '#F9F0FF',
 								borderColor: '#722ED1',
 								color: '#722ED1',
-								per: `${data?.ottffRate || 0}%`,
+								per: `${allData?.ottffRate || 0}%`,
 							},
 							{
 								icon: disputeLedger_11,
 								title: '非警务纠纷',
-								value: data?.fjwjfNum || 0,
+								value: allData?.tzfjwjfNum || 0,
 								backgroundColor: 'rgba(182,221,241,0.24)',
 								borderColor: '#1A6FB8',
 								color: '#1A6FB8',
-								per: `${data?.fjwjfRate || 0}%`,
+								per: `${allData?.tzfjwjfRate || 0}%`,
 							},
 							{
 								icon: disputeLedger_12,
 								title: '人民调解',
-								value: data?.rmtjNum || 0,
+								value: allData?.rmtjNum || 0,
 								backgroundColor: 'rgba(253,205,197,0.24)',
 								borderColor: '#F53F3F',
 								color: '#F53F3F',
-								per: `${data?.rmtjRate || 0}%`,
+								per: `${allData?.rmtjRate || 0}%`,
 							},
 							{
 								icon: disputeLedger_13,
 								title: '信访',
-								value: data?.xfNum || 0,
+								value: allData?.xfNum || 0,
 								backgroundColor: 'rgba(175,240,181,0.24)',
 								borderColor: '#00B42A',
 								color: '#00B42A',
-								per: `${data?.xfRate || 0}%`,
+								per: `${allData?.xfRate || 0}%`,
 							},
 							{
 								icon: disputeLedger_14,
 								title: '劳动争议',
-								value: data?.ldzcNum || 0,
+								value: allData?.ldzcNum || 0,
 								backgroundColor: 'rgba(181,245,236,0.24)',
 								borderColor: '#08979c',
 								color: '#08979c',
-								per: `${data?.ldzcRate || 0}%`,
+								per: `${allData?.ldzcRate || 0}%`,
 							},
 						].map((item, index) => (
 							<div
@@ -347,26 +379,9 @@
 									setActiveKey(index);
 									setActiveName(item.title);
 									if (index === 0) {
-										setAllNum(data?.allNum || 0);
 										handleSearch('search', '');
-									} else if (index === 1) {
-										setAllNum(data?.sysNum || 0);
-										handleSearch('search', 1);
-									} else if (index === 2) {
-										setAllNum(data?.ottffNum || 0);
-										handleSearch('search', 2);
-									} else if (index === 3) {
-										setAllNum(data?.rmtjNum || 0);
-										handleSearch('search', 3);
-									} else if (index === 4) {
-										setAllNum(data?.xfNum || 0);
-										handleSearch('search', 4);
-									} else if (index === 5) {
-										setAllNum(data?.ldzcNum || 0);
-										handleSearch('search', 5);
-									} else if (index === 6) {
-										setAllNum(data?.fjwjfNum || 0);
-										handleSearch('search', 6);
+									} else {
+										handleSearch('search', index);
 									}
 								}}
 								className={`disputeLedger-card ${activeKey === index ? 'disputeLedger-card-active' : ''}`}
@@ -441,7 +456,26 @@
 											{ value: data.finishNum, name: '化解成功' },
 											{ value: data.failNum, name: '化解不成功' },
 										]}
-										allNum={allNum}
+										allNum={(() => {
+											switch (activeKey) {
+												case 0:
+													return allData?.allNum || 0;
+												case 1:
+													return allData?.sysNum || 0;
+												case 2:
+													return allData?.ottffNum || 0;
+												case 3:
+													return allData?.tzfjwjfNum || 0;
+												case 4:
+													return allData?.rmtjNum || 0;
+												case 5:
+													return allData?.xfNum || 0;
+												case 6:
+													return allData?.ldzcNum || 0;
+												default:
+													return allData?.sysNum || 0;
+											}
+										})()}
 									/>
 								</div>
 							</div>

--
Gitblit v1.8.0