Просмотр исходного кода

所有导出增加前置条件

shaogen1995 1 год назад
Родитель
Сommit
f9c1742666

+ 6 - 1
src/pages/A1Camera/index.tsx

@@ -109,6 +109,11 @@ function A1Camera() {
 
   // 点击导出
   const deriveFu = useCallback(async () => {
+    if (A1TableList.total > 30000)
+      return MessageFu.warning(
+        "只支持导出最多30000条数据。请增加筛选条件,并重新尝试"
+      );
+
     if (A1TableList.list.length === 0)
       return MessageFu.warning("当前搜索条件没有数据!");
     const name = "相机管理" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
@@ -160,7 +165,7 @@ function A1Camera() {
       const toExcel = new ExportJsonExcel(option); //new
       toExcel.saveExcel(); //保存
     }
-  }, [A1TableList.list.length, tableSelect]);
+  }, [A1TableList.list.length, A1TableList.total, tableSelect]);
 
   const columns = useMemo(() => {
     return [

+ 6 - 1
src/pages/A2Psychz/index.tsx

@@ -273,6 +273,11 @@ function A2Psychz() {
 
   // 点击导出
   const deriveFu = useCallback(async () => {
+    if (A2TableList.total > 30000)
+      return MessageFu.warning(
+        "只支持导出最多30000条数据。请增加筛选条件,并重新尝试"
+      );
+
     if (A2TableList.list.length === 0)
       return MessageFu.warning("当前搜索条件没有数据!");
     const name = "机房管理" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
@@ -347,7 +352,7 @@ function A2Psychz() {
       const toExcel = new ExportJsonExcel(option); //new
       toExcel.saveExcel(); //保存
     }
-  }, [A2TableList.list.length]);
+  }, [A2TableList.list.length, A2TableList.total]);
 
   return (
     <div className={styles.A2Psychz}>

+ 6 - 1
src/pages/B1Plan/B1tab1.tsx

@@ -173,6 +173,11 @@ function B1tab1({ topType, setTopType }: Props) {
 
   // 点击导出
   const deriveFu = useCallback(async () => {
+    if (B1TableList.total > 30000)
+      return MessageFu.warning(
+        "只支持导出最多30000条数据。请增加筛选条件,并重新尝试"
+      );
+
     if (B1TableList.list.length === 0)
       return MessageFu.warning("当前搜索条件没有数据!");
     const name = "进度统计" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
@@ -217,7 +222,7 @@ function B1tab1({ topType, setTopType }: Props) {
 
     const toExcel = new ExportJsonExcel(option); //new
     toExcel.saveExcel(); //保存
-  }, [B1TableList.list]);
+  }, [B1TableList.list, B1TableList.total]);
 
   // 点击 按日期查看
   const [modalTitle, setModalTitle] = useState("");

+ 6 - 1
src/pages/B1Plan/B1tab2.tsx

@@ -226,6 +226,11 @@ function B1tab1({ topType, setTopType }: Props, ref: any) {
   }, []);
   // 点击导出
   const deriveFu = useCallback(async () => {
+    if (B1TableList.total > 30000)
+      return MessageFu.warning(
+        "只支持导出最多30000条数据。请增加筛选条件,并重新尝试"
+      );
+
     if (B1TableList.list.length === 0)
       return MessageFu.warning("当前搜索条件没有数据!");
     const name = "进度统计" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
@@ -299,7 +304,7 @@ function B1tab1({ topType, setTopType }: Props, ref: any) {
       const toExcel = new ExportJsonExcel(option); //new
       toExcel.saveExcel(); //保存
     }
-  }, [B1TableList.list.length]);
+  }, [B1TableList.list.length, B1TableList.total]);
 
   return (
     <>

+ 5 - 0
src/pages/B1Plan/PlanModal.tsx

@@ -201,6 +201,11 @@ function PlanModal({ title, closePageFu }: Props) {
 
   // 点击导出
   const deriveFu = useCallback(async () => {
+    if (list.length > 30000)
+      return MessageFu.warning(
+        "只支持导出最多30000条数据。请增加筛选条件,并重新尝试"
+      );
+
     if (list.length === 0) return MessageFu.warning("当前搜索条件没有数据!");
     let name = title + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
     name = name.replaceAll("/", "_");

+ 5 - 0
src/pages/B2Scene/LookReDo.tsx

@@ -60,6 +60,11 @@ function LookReDo({ closePageFu }: Props) {
 
   // 点击导出
   const deriveFu = useCallback(async () => {
+    if (list.length > 30000)
+      return MessageFu.warning(
+        "只支持导出最多30000条数据。请增加筛选条件,并重新尝试"
+      );
+
     if (list.length === 0) return MessageFu.warning("当前搜索条件没有数据!");
     const name = "重复场景" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
 

+ 6 - 1
src/pages/B2Scene/index.tsx

@@ -326,6 +326,11 @@ function B2Scene() {
 
   // 点击导出
   const deriveFu = useCallback(async () => {
+    if (B2TableList.total > 30000)
+      return MessageFu.warning(
+        "只支持导出最多30000条数据。请增加筛选条件,并重新尝试"
+      );
+
     if (B2TableList.list.length === 0)
       return MessageFu.warning("当前搜索条件没有数据!");
     const name = "场景审核" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
@@ -407,7 +412,7 @@ function B2Scene() {
       const toExcel = new ExportJsonExcel(option); //new
       toExcel.saveExcel(); //保存
     }
-  }, [B2TableList.list, tableSelect]);
+  }, [B2TableList.list.length, B2TableList.total, tableSelect]);
 
   // 审核弹窗的信息
   const [auditInfo, setAuditInfo] = useState({

+ 1 - 1
src/utils/http.ts

@@ -30,7 +30,7 @@ declare module "axios" {
 // 创建 axios 实例
 const http = axios.create({
   baseURL: `${baseURL}${baseFlag ? "/api/" : ""}`,
-  timeout: 20000,
+  timeout: 50000,
 });
 
 let axajInd = 0;