Browse Source

基础信息删除修改

莫凡 3 years atrás
parent
commit
da9099b55a

+ 8 - 0
src/components/DiagManager/index.js

@@ -74,6 +74,14 @@ function DiagManager() {
     post(api.deleteRecord, { id: Diagid }).then((res) => {
 	  setDelvisible(false);
       if (res.data.code === 200) {
+		//刷新列表
+		const totalPage = Math.ceil((total-1) / size);
+		//将当前页码与删除数据之后的总页数进行比较,避免当前页码不存在
+		const pagenum =
+		    params.current > totalPage ? totalPage : params.current;
+		//避免pagenum变为0
+		params.current = pagenum < 1 ? 1 : pagenum;
+		setParams(params)
         getDiseasePage();
         setDiagid("");
         message.success("删除成功");

+ 8 - 0
src/components/DrugManager/index.js

@@ -75,6 +75,14 @@ function DrugManager() {
 	post(api.deleteRecord, { id: Drugid }).then((res) => {
 	  setDelvisible(false);
 	  if (res.data.code === 200) {
+		//刷新列表
+		const totalPage = Math.ceil((total-1) / size);
+		//将当前页码与删除数据之后的总页数进行比较,避免当前页码不存在
+		const pagenum =
+		     params.current > totalPage ? totalPage : params.current;
+		//避免pagenum变为0
+		params.current = pagenum < 1 ? 1 : pagenum;
+		setParams(params)
 		getDrugeryPage();
 		setDrugid("");
 		message.success("删除成功");

+ 8 - 0
src/components/DutyRecord/index.js

@@ -96,6 +96,14 @@ function DutyRecord() {
 	function delRecord() {
 		post(api.delOfficialCapacityPage, { id: selectedRowKeys }).then((res) => {
 			if (res.data.code === 200) {
+				//刷新列表
+				const totalPage = Math.ceil((total - selectedRowKeys.length) / size);
+				//将当前页码与删除数据之后的总页数进行比较,避免当前页码不存在
+				const pagenum =
+				    params.current > totalPage ? totalPage : params.current;
+				//避免pagenum变为0
+				params.current = pagenum < 1 ? 1 : pagenum;
+				setParams(params)
 				//刷新列表
 				getDutyRecord()
 			} else {

+ 8 - 0
src/components/SurgeryManager/index.js

@@ -74,6 +74,14 @@ function SurgManager() {
 	post(api.deleteRecord, { id: Surgid }).then((res) => {
 	  setDelvisible(false);
 	  if (res.data.code === 200) {
+		//刷新列表
+		const totalPage = Math.ceil((total-1) / size);
+		//将当前页码与删除数据之后的总页数进行比较,避免当前页码不存在
+		const pagenum =
+		    params.current > totalPage ? totalPage : params.current;
+		//避免pagenum变为0
+		params.current = pagenum < 1 ? 1 : pagenum;
+		setParams(params)
 		getSurgeryPage();
 		setSurgid("");
 		message.success("删除成功");