shaogen1995 před 1 rokem
rodič
revize
e24b263b16

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

@@ -16,6 +16,7 @@ import dayjs from "dayjs";
 import ExportJsonExcel from "js-export-excel";
 import { ExclamationCircleOutlined } from "@ant-design/icons";
 import { mapDataAll2 } from "../C1User/AddUser/city";
+import PlanModal from "./PlanModal";
 
 const tableSelectTemp: B2FromDataArer = {
   // 按机房统计
@@ -148,7 +149,12 @@ function B1tab1({ topType, setTopType }: Props) {
         render: (item: B1tableAreaType) => (
           <>
             {/* 带完善 */}
-            <Button size="small" type="text">
+            <Button
+              size="small"
+              type="text"
+              disabled={!item.id}
+              onClick={() => setModalTitle(item.id)}
+            >
               按日期查看
             </Button>
             <Button
@@ -164,6 +170,7 @@ function B1tab1({ topType, setTopType }: Props) {
       },
     ];
   }, [setTopTypeFu]);
+
   // 点击导出
   const deriveFu = useCallback(async () => {
     if (B1TableList.list.length === 0)
@@ -212,6 +219,9 @@ function B1tab1({ topType, setTopType }: Props) {
     toExcel.saveExcel(); //保存
   }, [B1TableList.list]);
 
+  // 点击 按日期查看
+  const [modalTitle, setModalTitle] = useState("");
+
   return (
     <>
       <div className="pageTitle">
@@ -281,6 +291,11 @@ function B1tab1({ topType, setTopType }: Props) {
       <div className="tableNumBox">
         共 <span>{B1TableList.total}</span> 条数据
       </div>
+
+      {/* 点击 按日期查看 出来的页面 */}
+      {modalTitle ? (
+        <PlanModal title={modalTitle} closePageFu={() => setModalTitle("")} />
+      ) : null}
     </>
   );
 }

+ 290 - 6
src/pages/B1Plan/PlanModal.tsx

@@ -1,18 +1,302 @@
-import React from "react";
+import React, {
+  useCallback,
+  useEffect,
+  useMemo,
+  useRef,
+  useState,
+} from "react";
 import styles from "./index.module.scss";
-import { Button, Modal } from "antd";
-function PlanModal() {
+import { Button, Modal, DatePicker, Table } from "antd";
+import dayjs from "dayjs";
+import { B1_APIgetTimeList } from "@/store/action/B1Plan";
+import ExportJsonExcel from "js-export-excel";
+import { MessageFu } from "@/utils/message";
+
+const { RangePicker } = DatePicker;
+
+type ListType = {
+  id: string;
+  pcsCalculate: number;
+  pcsFirst: number;
+  pcsPass: number;
+  pcsReject: number;
+  pcsScene: number;
+  today: string;
+};
+
+type DateType = {
+  timeAll: null | string[];
+  startTime: string;
+  endTime: string;
+  province: string;
+  city: string;
+  region: string;
+};
+
+type Props = {
+  title: string;
+  closePageFu: () => void;
+};
+
+const nowTime = Date.now();
+const timeArrTemp = [
+  dayjs(nowTime - 86400000 * 30).format("YYYY-MM-DD"),
+  dayjs(nowTime).format("YYYY-MM-DD"),
+];
+
+const tempObj: DateType = {
+  timeAll: timeArrTemp,
+  startTime: timeArrTemp[0] + " 00:00:00",
+  endTime: timeArrTemp[1] + " 23:59:59",
+  province: "",
+  city: "",
+  region: "",
+};
+
+function PlanModal({ title, closePageFu }: Props) {
+  // 筛选
+  const [tableSelect, setTableSelect] = useState({ ...tempObj });
+  const tableSelectRef = useRef({ ...tempObj });
+
+  useEffect(() => {
+    tableSelectRef.current = { ...tableSelect };
+  }, [tableSelect]);
+
+  // 初始化 表单数据,带入 城市信息
+  const baseFromDataFu = useCallback(() => {
+    const obj = { ...tempObj };
+    const arr = title.split("/");
+    obj.province = arr[0] || "";
+    obj.city = arr[1] || "";
+    obj.region = arr[2] || "";
+    setTableSelect(obj);
+  }, [title]);
+
+  useEffect(() => {
+    baseFromDataFu();
+  }, [baseFromDataFu]);
+
+  // 点击搜索的 时间戳
+  const [timeKey, setTimeKey] = useState(-1);
+
+  const timeRef = useRef(-1);
+
+  // 表格数据
+  const [list, setList] = useState<ListType[]>([]);
+
+  const getListFu = useCallback(() => {
+    clearTimeout(timeRef.current);
+    timeRef.current = window.setTimeout(async () => {
+      const res = await B1_APIgetTimeList(tableSelectRef.current);
+      if (res.code === 0) {
+        setList(
+          res.data.map((v: any) => ({
+            ...v,
+            id:
+              v.pcsCalculate +
+              "" +
+              v.pcsFirst +
+              v.pcsPass +
+              v.pcsReject +
+              v.pcsScene +
+              v.today,
+          }))
+        );
+      }
+    }, 50);
+  }, []);
+
+  useEffect(() => {
+    getListFu();
+  }, [getListFu, timeKey]);
+
+  // 时间选择器改变
+  const timeChange = useCallback(
+    (e: any) => {
+      let temp: any = null;
+
+      const obj = {
+        ...tableSelect,
+        timeAll: null,
+        startTime: "",
+        endTime: "",
+      };
+
+      if (e) {
+        temp = [
+          dayjs(e[0]).format("YYYY-MM-DD"),
+          dayjs(e[1]).format("YYYY-MM-DD"),
+        ];
+
+        obj.timeAll = temp;
+        obj.startTime = temp[0] + " 00:00:00";
+        obj.endTime = temp[1] + " 23:59:59";
+      }
+
+      setTableSelect(obj);
+    },
+    [tableSelect]
+  );
+
+  // 设置选择日期的范围为90天
+  const disabledDate = useCallback((e: any) => {
+    const time = nowTime - 86400000 * 90;
+
+    const flag = e.valueOf() < time || e.valueOf() > nowTime + 86400000;
+
+    return flag;
+  }, []);
+
+  // 点击重置
+  const resListFu = useCallback(() => {
+    baseFromDataFu();
+    setTimeKey(Date.now());
+  }, [baseFromDataFu]);
+
+  // 点击昨日 或者 近7天
+  const numChangeTimeFu = useCallback((num: 1 | 7) => {
+    const numRes = nowTime - 86400000 * num;
+    const arr = [
+      dayjs(numRes).format("YYYY-MM-DD"),
+      dayjs(nowTime).format("YYYY-MM-DD"),
+    ];
+    const obj = {
+      ...tableSelectRef.current,
+      timeAll: arr,
+      startTime: arr[0] + " 00:00:00",
+      endTime: arr[1] + " 23:59:59",
+    };
+    setTableSelect(obj);
+  }, []);
+
+  const columns = useMemo(() => {
+    return [
+      {
+        title: "日期",
+        render: (item: ListType) => item.today || "空",
+      },
+      {
+        title: "上传场景",
+        render: (item: ListType) => item.pcsScene || 0,
+      },
+      {
+        title: "完成场景计算",
+        render: (item: ListType) => item.pcsCalculate || 0,
+      },
+      {
+        title: "初审通过",
+        render: (item: ListType) => item.pcsFirst || 0,
+      },
+      {
+        title: "审核通过",
+        render: (item: ListType) => item.pcsPass || 0,
+      },
+      {
+        title: "审核驳回",
+        render: (item: ListType) => item.pcsReject || 0,
+      },
+    ];
+  }, []);
+
+  // 点击导出
+  const deriveFu = useCallback(async () => {
+    if (list.length === 0) return MessageFu.warning("当前搜索条件没有数据!");
+    const name = title + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
+
+    const option = {
+      fileName: name,
+      datas: [
+        {
+          sheetData: list,
+          sheetName: name,
+          sheetFilter: [
+            "today",
+            "pcsScene",
+            "pcsCalculate",
+            "pcsFirst",
+            "pcsPass",
+            "pcsReject",
+          ],
+          sheetHeader: [
+            "日期",
+            "上传场景",
+            "完成场景计算",
+            "初审通过",
+            "审核通过",
+            "审核驳回",
+          ],
+          columnWidths: [10, 5, 5, 5, 5, 5],
+        },
+      ],
+    };
+
+    const toExcel = new ExportJsonExcel(option); //new
+    toExcel.saveExcel(); //保存
+  }, [list, title]);
+
   return (
     <Modal
       wrapClassName={styles.PlanModal}
       open={true}
-      title={``}
+      title={title}
       footer={
         [] // 设置footer为空,去掉 取消 确定默认按钮
       }
     >
-      <div className="B1Mbtn">
-        <Button type="primary">关闭</Button>
+      <div className="B1Mmain">
+        {/* 顶部筛选 */}
+        <div className="B1MmainTop">
+          <div>
+            <span>日期:</span>
+            <RangePicker
+              disabledDate={disabledDate}
+              value={
+                tableSelect.timeAll
+                  ? [
+                      dayjs(tableSelect.timeAll[0]),
+                      dayjs(tableSelect.timeAll[1]),
+                    ]
+                  : null
+              }
+              onChange={(e) => timeChange(e)}
+            />
+            &emsp;<Button onClick={() => numChangeTimeFu(1)}>昨日</Button>
+            &emsp;<Button onClick={() => numChangeTimeFu(7)}>近七天</Button>
+          </div>
+          <div>
+            <Button onClick={resListFu}>重置</Button>&emsp;
+            <Button type="primary" onClick={() => setTimeKey(Date.now())}>
+              查询
+            </Button>
+            &emsp;
+            <Button
+              disabled={list.length === 0}
+              type="primary"
+              onClick={deriveFu}
+            >
+              导出表格
+            </Button>
+          </div>
+        </div>
+        {/* 表格 */}
+        <div className="B1MmainTable">
+          <Table
+            size="small"
+            scroll={{ y: 578 }}
+            dataSource={list}
+            columns={columns}
+            rowKey="id"
+            pagination={false}
+          />
+        </div>
+
+        <div className="B1Mbtn">
+          <Button onClick={closePageFu}>关闭</Button>
+          {/*  右下角的列表数量 */}
+          <div className="tableNumBox">
+            共 <span>{list.length}</span> 条数据
+          </div>
+        </div>
       </div>
     </Modal>
   );

+ 41 - 7
src/pages/B1Plan/index.module.scss

@@ -1,9 +1,10 @@
 .B1Plan {
   :global {
-    .B1box{
+    .B1box {
       width: 100%;
       height: 100%;
     }
+
     .pageTitle {
       display: flex;
       align-items: center;
@@ -69,17 +70,50 @@
   }
 }
 
-.PlanModal{
-  :global{
+.PlanModal {
+  :global {
     .ant-modal-close {
       display: none;
     }
+
     .ant-modal {
-      width: 800px !important;
-      .B1Mbtn{
-        margin-top: 20px;
-        text-align: center;
+      width: 1000px !important;
+
+      .B1Mmain {
+        border-top: 1px solid #ccc;
+        padding-top: 15px;
+
+        .B1MmainTop {
+          display: flex;
+          justify-content: space-between;
+        }
+
+        .B1MmainTable {
+          margin-top: 15px;
+
+          .ant-table-cell {
+            text-align: center !important;
+          }
+        }
+
+        .B1Mbtn {
+          margin-top: 20px;
+          text-align: center;
+          position: relative;
+
+          .tableNumBox {
+            position: absolute;
+            right: 0px;
+            bottom: 5px;
+
+            &>span {
+              color: var(--themeColor);
+            }
+          }
+        }
       }
+
+
     }
   }
 }

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

@@ -0,0 +1,137 @@
+import React, { useCallback, useEffect, useMemo, useState } from "react";
+import styles from "./index.module.scss";
+import { Button, Modal, Table } from "antd";
+import { B2_APIlookReDo } from "@/store/action/B2Scene";
+import { MessageFu } from "@/utils/message";
+import dayjs from "dayjs";
+import ExportJsonExcel from "js-export-excel";
+
+type ListType = {
+  id: string;
+  city: string;
+  province: string;
+  region: string;
+  roomNum: string;
+  sceneCode: string;
+};
+
+type Props = {
+  closePageFu: () => void;
+};
+
+function LookReDo({ closePageFu }: Props) {
+  const [list, setList] = useState<ListType[]>([]);
+
+  const geiListFu = useCallback(async () => {
+    const res = await B2_APIlookReDo();
+    if (res.code === 0) {
+      setList(
+        res.data.map((v: ListType) => ({
+          ...v,
+          id: v.city + "" + v.province + v.region + v.roomNum + v.sceneCode,
+        }))
+      );
+    }
+  }, []);
+
+  useEffect(() => {
+    geiListFu();
+  }, [geiListFu]);
+
+  const column = useMemo(() => {
+    return [
+      {
+        title: "机房编码",
+        render: (item: ListType) => item.roomNum || "空",
+      },
+      {
+        title: "站址地区",
+        render: (item: ListType) =>
+          !item.province && !item.city && !item.region
+            ? "(空)"
+            : `${item.province}-${item.city}-${item.region}`,
+      },
+      {
+        title: "场景码",
+        render: (item: ListType) => item.sceneCode || "空",
+      },
+    ];
+  }, []);
+
+  // 点击导出
+  const deriveFu = useCallback(async () => {
+    if (list.length === 0) return MessageFu.warning("当前搜索条件没有数据!");
+    const name = "重复场景" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
+
+    const option = {
+      fileName: name,
+      datas: [
+        {
+          sheetData: list.map((v) => ({
+            ...v,
+            myCity:
+              !v.province && !v.city && !v.region
+                ? "(空)"
+                : `${v.province}-${v.city}-${v.region}`,
+          })),
+          sheetName: name,
+          sheetFilter: ["roomNum", "myCity", "sceneCode"],
+          sheetHeader: ["机房编码", "站址地区", "场景码"],
+          columnWidths: [10, 10, 10],
+        },
+      ],
+    };
+
+    const toExcel = new ExportJsonExcel(option); //new
+    toExcel.saveExcel(); //保存
+  }, [list]);
+
+  return (
+    <Modal
+      wrapClassName={styles.LookReDo}
+      open={true}
+      title={
+        <div className="B2Mtitle">
+          <div>重复场景</div>
+          <div>
+            <Button
+              type="primary"
+              disabled={list.length === 0}
+              onClick={deriveFu}
+            >
+              导出表格
+            </Button>
+          </div>
+        </div>
+      }
+      footer={
+        [] // 设置footer为空,去掉 取消 确定默认按钮
+      }
+    >
+      <div className="B2Mmain">
+        <div className="B1MTable">
+          <Table
+            size="small"
+            scroll={{ y: 578 }}
+            dataSource={list}
+            columns={column}
+            rowKey="id"
+            pagination={false}
+          />
+        </div>
+
+        <div className="B2Mbtn">
+          <Button onClick={closePageFu}>关闭</Button>
+          {/*  右下角的列表数量 */}
+          <div className="tableNumBox">
+            共 <span>{list.length}</span> 条数据
+          </div>
+        </div>
+      </div>
+    </Modal>
+  );
+}
+
+const MemoLookReDo = React.memo(LookReDo);
+
+export default MemoLookReDo;

+ 4 - 2
src/pages/B2Scene/data.ts

@@ -1,9 +1,11 @@
 export type B2FromDataType = {
+  siteArr: undefined | string[];
+  province:string
+  city:string
+  region:string
   auditStatus: string;
   pmUser: string;
   searchKey: string;
-  siteLevel: 2;
-  site: undefined | string[];
   pageSize: number;
   pageNum: number;
 };

+ 64 - 7
src/pages/B2Scene/index.module.scss

@@ -1,8 +1,6 @@
 .B2Scene {
   :global {
     .B2top {
-      display: flex;
-      justify-content: space-between;
       border-radius: 10px;
       background-color: #fff;
       padding: 15px 24px;
@@ -23,16 +21,25 @@
           }
         }
       }
+
+      .B2top2 {
+        margin-top: 15px;
+        justify-content: space-between;
+
+        &>div {
+          display: flex;
+        }
+      }
     }
 
     .tableMain {
       border-radius: 10px;
       margin-top: 15px;
-      height: calc(100% - 80px);
+      height: calc(100% - 127px);
       background-color: #fff;
 
       .ant-table-body {
-        height: 625px;
+        height: 578px;
         overflow-y: auto !important;
         overflow-y: overlay !important;
 
@@ -56,11 +63,12 @@
       }
 
       // 下载json
-      .B2TabA{
+      .B2TabA {
         color: var(--themeColor);
-   
+
       }
-      .B2TabANo{
+
+      .B2TabANo {
         color: #ccc;
         cursor: not-allowed;
       }
@@ -69,6 +77,7 @@
   }
 }
 
+// -----------审核
 .AuditMo {
   :global {
 
@@ -119,4 +128,52 @@
 
 
   }
+}
+
+// ----------查看重复场景
+.LookReDo {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+
+    .ant-modal {
+      width: 800px !important;
+
+      .B2Mtitle {
+        display: flex;
+        justify-content: space-between;
+      }
+
+      .B2Mmain {
+        border-top: 1px solid #ccc;
+        padding-top: 15px;
+
+        .B1MTable {
+          margin-top: 10px;
+
+          .ant-table-cell {
+            text-align: center !important;
+          }
+        }
+
+        .B2Mbtn {
+          margin-top: 20px;
+          text-align: center;
+          position: relative;
+
+          .tableNumBox {
+            position: absolute;
+            right: 0px;
+            bottom: 5px;
+
+            &>span {
+              color: var(--themeColor);
+            }
+          }
+        }
+
+      }
+    }
+  }
 }

+ 117 - 50
src/pages/B2Scene/index.tsx

@@ -33,60 +33,90 @@ import dayjs from "dayjs";
 import AuditMo from "./AuditMo";
 import clasNames from "classnames";
 import { mapDataAll1 } from "../C1User/AddUser/city";
+import LookReDo from "./LookReDo";
 
 function B2Scene() {
   const dispatch = useDispatch();
 
   // 筛选和分页
   const [tableSelect, setTableSelect] = useState<B2FromDataType>({
+    siteArr: undefined,
+    province: "",
+    city: "",
+    region: "",
     auditStatus: "",
     pmUser: "",
     searchKey: "",
-    siteLevel: 2,
-    site: undefined,
     pageSize: 10,
     pageNum: 1,
   });
 
+  const tableSelectRef = useRef({} as B2FromDataType);
+
+  useEffect(() => {
+    tableSelectRef.current = { ...tableSelect };
+  }, [tableSelect]);
+
+  // 点击搜索的 时间戳
+  const [timeKey, setTimeKey] = useState(-1);
+
   // 发送接口的函数
   const getListFu = useCallback(() => {
+    const objTemp: any = {};
+
+    if (tableSelectRef.current.siteArr) {
+      const temp = tableSelectRef.current.siteArr;
+      objTemp.province = temp[0] || "";
+      objTemp.city = temp[1] || "";
+      objTemp.region = temp[2] || "";
+    }
+
     const obj = {
-      ...tableSelect,
-      site: tableSelect.site ? tableSelect.site[1] : null,
+      ...tableSelectRef.current,
+      ...objTemp,
     };
     dispatch(B2_APIgetlist(obj));
-  }, [dispatch, tableSelect]);
+  }, [dispatch]);
 
   useEffect(() => {
     getListFu();
-  }, [getListFu]);
+  }, [getListFu, timeKey]);
 
   // 输入框的改变
-  const txtTimeRef = useRef(-1);
   const txtChangeFu = useCallback(
     (txt: string, key: "pmUser" | "searchKey") => {
-      clearTimeout(txtTimeRef.current);
-      txtTimeRef.current = window.setTimeout(() => {
-        setTableSelect({ ...tableSelect, [key]: txt, pageNum: 1 });
-      }, 500);
+      setTableSelect({ ...tableSelect, [key]: txt });
     },
     [tableSelect]
   );
 
+  // 点击搜索
+  const clickSearch = useCallback(() => {
+    setTableSelect({ ...tableSelect, pageNum: 1 });
+    setTimeout(() => {
+      setTimeKey(Date.now());
+    }, 50);
+  }, [tableSelect]);
+
   // 点击重置
   const [inputKey, setInputKey] = useState(1);
   const resetSelectFu = useCallback(() => {
     // 把2个输入框和时间选择器清空
     setInputKey(Date.now());
     setTableSelect({
+      siteArr: undefined,
+      province: "",
+      city: "",
+      region: "",
       auditStatus: "",
       pmUser: "",
       searchKey: "",
-      siteLevel: 2,
-      site: undefined,
       pageSize: 10,
       pageNum: 1,
     });
+    setTimeout(() => {
+      setTimeKey(Date.now());
+    }, 50);
   }, []);
 
   // 从仓库获取列表
@@ -97,6 +127,9 @@ function B2Scene() {
   const paginationChange = useCallback(
     () => (pageNum: number, pageSize: number) => {
       setTableSelect({ ...tableSelect, pageNum, pageSize });
+      setTimeout(() => {
+        setTimeKey(Date.now());
+      }, 50);
     },
     [tableSelect]
   );
@@ -134,9 +167,9 @@ function B2Scene() {
       {
         title: "站址地区",
         render: (item: B2tableType) =>
-          !item.province && !item.city
+          !item.province && !item.city && !item.region
             ? "(空)"
-            : `${item.province} - ${item.city}`,
+            : `${item.province}-${item.city}-${item.region}`,
       },
       // 待完善
       {
@@ -297,13 +330,24 @@ function B2Scene() {
       return MessageFu.warning("当前搜索条件没有数据!");
     const name = "场景审核" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
 
+    const objTemp: any = {};
+
+    if (tableSelectRef.current.siteArr) {
+      const temp = tableSelectRef.current.siteArr;
+      objTemp.province = temp[0] || "";
+      objTemp.city = temp[1] || "";
+      objTemp.region = temp[2] || "";
+    }
+
     const res = await B2_APIgetlistAll({
       ...tableSelect,
-      site: tableSelect.site ? tableSelect.site[1] : null,
+      ...objTemp,
       pageNum: 1,
       pageSize: 99999,
     });
     if (res.code === 0) {
+      if (res.data.records.length <= 0)
+        return MessageFu.warning("当前搜索条件没有数据!");
       const option = {
         fileName: name,
         datas: [
@@ -311,7 +355,9 @@ function B2Scene() {
             sheetData: res.data.records.map((v: B2tableType) => ({
               roomNum: v.roomNum || "(空)",
               myCity:
-                !v.province && !v.city ? "(空)" : `${v.province} - ${v.city}`,
+                !v.province && !v.city && !v.region
+                  ? "(空)"
+                  : `${v.province}-${v.city}-${v.region}`,
               pmName: v.creatorId === 1 ? "管理员" : v.pmName || "(空)",
               sceneName: v.sceneName || "(空)",
               link: v.link || "(空)",
@@ -371,6 +417,9 @@ function B2Scene() {
     auditDesc: "",
   });
 
+  // 查看重复的场景
+  const [lookReDo, setLookReDo] = useState(false);
+
   return (
     <div className={styles.B2Scene}>
       <div className="pageTitle">场景审核</div>
@@ -383,7 +432,7 @@ function B2Scene() {
             <Input
               key={inputKey}
               maxLength={24}
-              style={{ width: 246 }}
+              style={{ width: 250 }}
               placeholder="请输入机房编码/场景码,最多24字"
               allowClear
               onChange={(e) => txtChangeFu(e.target.value, "searchKey")}
@@ -393,53 +442,63 @@ function B2Scene() {
           <div className="B2topRow">
             <span>站址地区:</span>
             <Cascader
-              value={tableSelect.site}
-              style={{ width: 180 }}
+              changeOnSelect
+              value={tableSelect.siteArr}
+              style={{ width: 250 }}
               options={mapDataAll1}
               placeholder="全部"
               onChange={(e) =>
-                setTableSelect({ ...tableSelect, site: e as string[] })
-              }
-            />
-          </div>
-
-          <div className="B2topRow">
-            <span>项目经理:</span>
-            <Input
-              key={inputKey}
-              maxLength={10}
-              style={{ width: 180 }}
-              placeholder="请输入姓名,最多10字"
-              allowClear
-              onChange={(e) => txtChangeFu(e.target.value, "pmUser")}
-            />
-          </div>
-
-          <div className="B2topRow">
-            <span>审核状态:</span>
-            <Select
-              style={{ width: 140 }}
-              value={tableSelect.auditStatus}
-              onChange={(e) =>
-                setTableSelect({ ...tableSelect, auditStatus: e, pageNum: 1 })
+                setTableSelect({ ...tableSelect, siteArr: e as string[] })
               }
-              options={B1options1}
             />
           </div>
         </div>
         {/* 右侧按钮 */}
         <div className="B2top2">
-          <Button onClick={resetSelectFu}>重置</Button>&emsp;
-          <Button type="primary" onClick={deriveFu}>
-            导出表格
-          </Button>
+          <div>
+            <div className="B2topRow">
+              <span>项目经理:</span>
+              <Input
+                key={inputKey}
+                maxLength={10}
+                style={{ width: 235 }}
+                placeholder="请输入姓名,最多10字"
+                allowClear
+                onChange={(e) => txtChangeFu(e.target.value, "pmUser")}
+              />
+            </div>
+
+            <div className="B2topRow">
+              <span>审核状态:</span>
+              <Select
+                style={{ width: 250 }}
+                value={tableSelect.auditStatus}
+                onChange={(e) =>
+                  setTableSelect({ ...tableSelect, auditStatus: e })
+                }
+                options={B1options1}
+              />
+            </div>
+          </div>
+          <div>
+            <Button onClick={() => setLookReDo(true)}>查看重复的场景</Button>
+            &emsp;
+            <Button onClick={resetSelectFu}>重置</Button>&emsp;
+            <Button type="primary" onClick={clickSearch}>
+              查询
+            </Button>
+            &emsp;
+            <Button type="primary" onClick={deriveFu}>
+              导出表格
+            </Button>
+          </div>
         </div>
       </div>
 
       {/* 表格主体 */}
       <div className="tableMain">
         <Table
-          scroll={{ y: 625 }}
+          scroll={{ y: 578 }}
           dataSource={B2TableList.list}
           columns={columns}
           rowKey="id"
@@ -478,6 +537,14 @@ function B2Scene() {
           }}
         />
       ) : null}
+
+      {/* 查看重复的场景 */}
+      {lookReDo ? <LookReDo closePageFu={() => setLookReDo(false)} /> : null}
+
+      {/*  右下角的列表数量 */}
+      <div className="tableNumBox">
+        共 <span>{B2TableList.total}</span> 条数据
+      </div>
     </div>
   );
 }

+ 4 - 2
src/pages/B3Push/data.ts

@@ -1,10 +1,12 @@
 export type B3FromDataType= {
+  siteArr: undefined | string[];
+  province:string
+  city:string
+  region:string
   jsonStatus: "" | 0 | 2 | 3;
   pmUser: string;
   pushStatus: "" | 0 | 2 | 3;
   searchKey: string;
-  site: undefined|string[];
-  siteLevel: 2;
   pageSize: number;
   pageNum: number;
 }

+ 56 - 20
src/pages/B3Push/index.tsx

@@ -30,56 +30,85 @@ function B3Push() {
 
   // 筛选和分页
   const [tableSelect, setTableSelect] = useState<B3FromDataType>({
+    siteArr: undefined,
+    province: "",
+    city: "",
+    region: "",
     jsonStatus: "",
     pmUser: "",
     pushStatus: "",
     searchKey: "",
-    site: undefined,
-    siteLevel: 2,
     pageSize: 10,
     pageNum: 1,
   });
 
+  const tableSelectRef = useRef({} as B3FromDataType);
+
+  useEffect(() => {
+    tableSelectRef.current = { ...tableSelect };
+  }, [tableSelect]);
+
+  // 点击搜索的 时间戳
+  const [timeKey, setTimeKey] = useState(-1);
+
   // 发送接口的函数
   const getListFu = useCallback(() => {
+    const objTemp: any = {};
+
+    if (tableSelectRef.current.siteArr) {
+      const temp = tableSelectRef.current.siteArr;
+      objTemp.province = temp[0] || "";
+      objTemp.city = temp[1] || "";
+      objTemp.region = temp[2] || "";
+    }
+
     const obj = {
-      ...tableSelect,
-      site: tableSelect.site ? tableSelect.site[1] : null,
+      ...tableSelectRef.current,
+      ...objTemp,
     };
     dispatch(B3_APIgetlist(obj));
-  }, [dispatch, tableSelect]);
+  }, [dispatch]);
 
   useEffect(() => {
     getListFu();
-  }, [getListFu]);
+  }, [getListFu, timeKey]);
 
   // 输入框的改变
-  const txtTimeRef = useRef(-1);
   const txtChangeFu = useCallback(
     (txt: string, key: "pmUser" | "searchKey") => {
-      clearTimeout(txtTimeRef.current);
-      txtTimeRef.current = window.setTimeout(() => {
-        setTableSelect({ ...tableSelect, [key]: txt, pageNum: 1 });
-      }, 500);
+      setTableSelect({ ...tableSelect, [key]: txt });
     },
     [tableSelect]
   );
 
+  // 点击搜索
+  const clickSearch = useCallback(() => {
+    setTableSelect({ ...tableSelect, pageNum: 1 });
+    setTimeout(() => {
+      setTimeKey(Date.now());
+    }, 50);
+  }, [tableSelect]);
+
   // 点击重置
   const [inputKey, setInputKey] = useState(1);
   const resetSelectFu = useCallback(() => {
     // 把2个输入框和时间选择器清空
     setInputKey(Date.now());
     setTableSelect({
+      siteArr: undefined,
+      province: "",
+      city: "",
+      region: "",
       jsonStatus: "",
       pmUser: "",
       pushStatus: "",
       searchKey: "",
-      site: undefined,
-      siteLevel: 2,
       pageSize: 10,
       pageNum: 1,
     });
+    setTimeout(() => {
+      setTimeKey(Date.now());
+    }, 50);
   }, []);
 
   // 从仓库获取列表
@@ -91,6 +120,9 @@ function B3Push() {
   const paginationChange = useCallback(
     () => (pageNum: number, pageSize: number) => {
       setTableSelect({ ...tableSelect, pageNum, pageSize });
+      setTimeout(() => {
+        setTimeKey(Date.now());
+      }, 50);
     },
     [tableSelect]
   );
@@ -128,9 +160,9 @@ function B3Push() {
       {
         title: "站址地区",
         render: (item: B3tableType) =>
-          !item.province && !item.city
+          !item.province && !item.city && !item.region
             ? "(空)"
-            : `${item.province} - ${item.city}`,
+            : `${item.province}-${item.city}-${item.region}`,
       },
       // 待完善
       {
@@ -232,7 +264,7 @@ function B3Push() {
   return (
     <div className={styles.B3Push}>
       <div className="pageTitle">
-        进度统计&emsp;<span>仅显示审核通过的场景</span>
+        推送管理&emsp;<span>仅显示审核通过的场景</span>
       </div>
       {/*顶部筛选 */}
       <div className="B3top">
@@ -252,12 +284,12 @@ function B3Push() {
           <div className="B3topRow">
             <span>站址地区:</span>
             <Cascader
-              value={tableSelect.site}
+              value={tableSelect.siteArr}
               style={{ width: 200 }}
               options={mapDataAll1}
               placeholder="全部"
               onChange={(e) =>
-                setTableSelect({ ...tableSelect, site: e as string[] })
+                setTableSelect({ ...tableSelect, siteArr: e as string[] })
               }
             />
           </div>
@@ -282,7 +314,7 @@ function B3Push() {
                 style={{ width: 194 }}
                 value={tableSelect.pushStatus}
                 onChange={(e) =>
-                  setTableSelect({ ...tableSelect, pushStatus: e, pageNum: 1 })
+                  setTableSelect({ ...tableSelect, pushStatus: e })
                 }
                 options={B1options2}
               />
@@ -293,7 +325,7 @@ function B3Push() {
                 style={{ width: 194 }}
                 value={tableSelect.jsonStatus}
                 onChange={(e) =>
-                  setTableSelect({ ...tableSelect, jsonStatus: e, pageNum: 1 })
+                  setTableSelect({ ...tableSelect, jsonStatus: e })
                 }
                 options={B1options2}
               />
@@ -301,6 +333,10 @@ function B3Push() {
           </div>
           <div>
             <Button onClick={resetSelectFu}>重置</Button>&emsp;
+            <Button type="primary" onClick={clickSearch}>
+              查询
+            </Button>
+            &emsp;
             <Popconfirm
               placement="bottomRight"
               title={

+ 7 - 0
src/store/action/B1Plan.ts

@@ -46,3 +46,10 @@ export const B1_APIgetlistArea = (data: any) => {
     }
   };
 };
+
+/**
+ * 获取 区域 里面的 按日期查看 列表
+ */
+export const B1_APIgetTimeList = (data: any) => {
+  return http.post("cms/schedule/report/trend", data);
+};

+ 8 - 2
src/store/action/B2Scene.ts

@@ -19,11 +19,10 @@ export const B2_APIgetlist = (data: any) => {
 /**
  * 获取 进度统计 表格列表(导出表格)
  */
-export const B2_APIgetlistAll = (data:any) => {
+export const B2_APIgetlistAll = (data: any) => {
   return http.post("cms/scene/pageList", data);
 };
 
-
 /**
  * 删除 单个表格数据
  */
@@ -44,3 +43,10 @@ export const B2_APIreset = (id: number) => {
 export const B2_APIAudit = (data: any) => {
   return http.post("cms/scene/audit", data);
 };
+
+/**
+ * 重复的场景
+ */
+export const B2_APIlookReDo = () => {
+  return http.get("cms/scene/duplicateRoom");
+};

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

@@ -4,6 +4,7 @@ export type B2tableType = {
   auditTime: string;
   cameraSn: string;
   city: string;
+  region:string
   createTime: string;
   creatorId: number;
   creatorName: string;

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

@@ -1,5 +1,6 @@
 export type B3tableType = {
   city: string;
+  region:string
   createTime: string;
   creatorId: number;
   creatorName: string;

+ 15 - 13
src/utils/http.ts

@@ -4,31 +4,33 @@ import { getTokenInfo, removeTokenInfo } from "./storage";
 import store from "@/store";
 import { MessageFu } from "./message";
 import { domShowFu } from "./domShow";
+
+const envFlag = process.env.NODE_ENV === "development";
+
+// 线下环境:http://192.168.20.61:8057
+// 正式环境:https://tower3d.4dkankan.com
+// 测试环境:https://sit-tieta3d.4dage.com
+const baseUrlTemp = "https://sit-tieta3d.4dage.com";
+
+const baseFlag = baseUrlTemp.includes("https://");
+
 // 请求基地址
-export const baseURL =
-  // 线下的图片地址需要加上/api/
-  process.env.NODE_ENV === "development"
-    ? "http://192.168.20.61:8057/api/"
-    : "";
-  // process.env.NODE_ENV === "development" ? "https://tower3d.4dkankan.com" : ""; //正式环境
-  // process.env.NODE_ENV === "development" ? "https://sit-tieta3d.4dage.com" : ""; //测试环境
+export const baseURL = envFlag
+  ? `${baseUrlTemp}${baseFlag ? "" : "/api/"}`
+  : "";
 
 // 处理  类型“AxiosResponse<any, any>”上不存在属性“code”
 declare module "axios" {
   interface AxiosResponse {
     code: number;
-    timestamp:string
+    timestamp: string;
     // 这里追加你的参数
   }
 }
 
 // 创建 axios 实例
 const http = axios.create({
-  // --------线下的地址不用加/api/
-  baseURL: baseURL,
-
-  // --------打包或线上环境接口需要加上api/
-  // baseURL: baseURL + "/api/",
+  baseURL: `${baseUrlTemp}${baseFlag ? "/api/" : ""}`,
   timeout: 20000,
 });