Browse Source

进度-区域 站址地区多条数据为空 表格idKey错乱问题

shaogen1995 1 năm trước cách đây
mục cha
commit
701be3e71e

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

@@ -106,7 +106,7 @@ function B1tab1({ topType, setTopType }: Props) {
     return [
       {
         title: "站址地区",
-        render: (item: B1tableAreaType) => item.id || "空",
+        render: (item: B1tableAreaType) => item.cityAll || "空",
       },
       {
         title: "机房总数",
@@ -152,16 +152,16 @@ function B1tab1({ topType, setTopType }: Props) {
             <Button
               size="small"
               type="text"
-              disabled={!item.id}
-              onClick={() => setModalTitle(item.id)}
+              disabled={!item.cityAll}
+              onClick={() => setModalTitle(item.cityAll)}
             >
               按日期查看
             </Button>
             <Button
               size="small"
               type="text"
-              disabled={!item.id}
-              onClick={() => setTopTypeFu("机房", item.id)}
+              disabled={!item.cityAll}
+              onClick={() => setTopTypeFu("机房", item.cityAll)}
             >
               按机房查看
             </Button>
@@ -183,7 +183,7 @@ function B1tab1({ topType, setTopType }: Props) {
         {
           sheetData: B1TableList.list.map((v: B1tableAreaType) => ({
             ...v,
-            id: v.id || "(空)",
+            id: v.cityAll || "(空)",
           })),
           sheetName: name,
           sheetFilter: [

+ 4 - 4
src/pages/B1Plan/data.ts

@@ -69,10 +69,10 @@ export const B1options2 = [
     value: 0,
     label: "待推送",
   },
-  {
-    value: 1,
-    label: "推送中",
-  },
+  // {
+  //   value: 1,
+  //   label: "推送中",
+  // },
   {
     value: 2,
     label: "推送成功",

+ 17 - 6
src/store/action/B1Plan.ts

@@ -1,5 +1,6 @@
 import http from "@/utils/http";
 import { AppDispatch } from "..";
+import { B1tableAreaType } from "@/types";
 /**
  * 获取 进度统计 表格列表(存到仓库)-按机房
  */
@@ -33,13 +34,23 @@ export const B1_APIgetlistArea = (data: any) => {
   return async (dispatch: AppDispatch) => {
     const res = await http.post("cms/schedule/report/region", data);
     if (res.code === 0) {
-      const obj = {
-        list: res.data.map((v: any) => ({
+      const arr: any = res.data;
+
+      const arr2: any = [];
+
+      arr.forEach((v: any, i: number) => {
+        const cityTxt = `${v.province}${v.city ? "/" + v.city : ""}${
+          v.region ? "/" + v.region : ""
+        }`;
+        arr2.push({
           ...v,
-          id: `${v.province}${v.city ? "/" + v.city : ""}${
-            v.region ? "/" + v.region : ""
-          }`,
-        })),
+          cityAll: cityTxt,
+          id: cityTxt ? cityTxt : i,
+        });
+      });
+
+      const obj = {
+        list: arr2,
         total: res.data.length,
       };
       dispatch({ type: "B1/getListArea", payload: obj });

+ 1 - 0
src/types/api/B1Plan.d.ts

@@ -20,6 +20,7 @@ export type B1tableType = {
   updateTime: string;
 };
 export type B1tableAreaType = {
+  cityAll:string
   id:string
   pcsCalculate: number;
   pcsFirst: number;