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

+ 58 - 18
src/pages/B2Scene/EditNum.tsx

@@ -1,11 +1,12 @@
-import React, { useCallback, useState } from "react";
+import React, { useCallback, useEffect, useState } from "react";
 import styles from "./index.module.scss";
 import { Button, Input, Modal, Popconfirm } from "antd";
-import { B2_APIcheckNum, B2_APIeditNum } from "@/store/action/B2Scene";
+import { B2_APIeditNum, B2_APInumIsOk } from "@/store/action/B2Scene";
 import { MessageFu } from "@/utils/message";
+import classNames from "classnames";
 
 type Props = {
-  info: { id: number; num: string; name: string };
+  info: { id: number; num: string; name: string; roomName: string };
   closeFu: () => void;
   upTableFu: () => void;
 };
@@ -13,20 +14,36 @@ type Props = {
 function EditNum({ info, closeFu, upTableFu }: Props) {
   const [value, setValue] = useState("");
 
+  // 通过 新机房编码 检查 新站址名称
+  const [newRoomName, setNewRoomName] = useState({ code: 0, name: "" });
+
+  const numIsOkFu = useCallback(async (val: string) => {
+    const res = await B2_APInumIsOk(val);
+    if (res.code === 0) {
+      if (res.data && res.data.name)
+        setNewRoomName({ code: 1, name: res.data.name });
+      else setNewRoomName({ code: 0, name: "机房编码不存在!" });
+    }
+  }, []);
+
+  useEffect(() => {
+    if (value && value.length >= 24) numIsOkFu(value);
+  }, [numIsOkFu, value]);
+
   const btnOkFu = useCallback(async () => {
     if (value === info.num) return MessageFu.warning("新旧编码不能相同!");
 
-    const res1 = await B2_APIcheckNum(value);
-    if (res1.code === 0) {
-      if (res1.data) {
-        // 编码存在
-        const res2 = await B2_APIeditNum(info.id, value);
-        if (res2.code === 0) {
-          MessageFu.success("更新成功!");
-          upTableFu();
-          closeFu();
-        }
-      } else MessageFu.warning("该机房编码不存在,请先在机房管理中创建!");
+    // const res1 = await B2_APIcheckNum(value);
+    // if (res1.code === 0) {
+    //   if (res1.data) {
+    // 编码存在
+    const res2 = await B2_APIeditNum(info.id, value);
+    if (res2.code === 0) {
+      MessageFu.success("更新成功!");
+      upTableFu();
+      closeFu();
+      // }
+      // } else MessageFu.warning("该机房编码不存在,请先在机房管理中创建!");
     }
   }, [closeFu, info.id, info.num, upTableFu, value]);
 
@@ -41,14 +58,22 @@ function EditNum({ info, closeFu, upTableFu }: Props) {
     >
       <div className="B2Emain">
         <div className="B2Ebox1">
-          <div>机房编码:</div>
+          <div>场景名称:</div>
+          <div>{info.name}</div>
+        </div>
+
+        <div className="B2Ebox1">
+          <div>原机房编码:</div>
           <div>{info.num}</div>
         </div>
         <div className="B2Ebox1">
-          <div>场景名称:</div>
-          <div>{info.name}</div>
+          <div>原站址名称:</div>
+          <div>{info.roomName}</div>
         </div>
 
+        <hr />
+        <br />
+
         <div className="B2Ebox1">
           <div>新机房编码:</div>
           <div>
@@ -62,8 +87,23 @@ function EditNum({ info, closeFu, upTableFu }: Props) {
           </div>
         </div>
 
+        <div
+          className={classNames(
+            "B2Ebox1",
+            newRoomName.code === 0 ? "B2Ebox1Err" : ""
+          )}
+          hidden={value.length < 24 || !newRoomName.name}
+        >
+          <div>新站址名称:</div>
+          <div>{newRoomName.name}</div>
+        </div>
+
         <div className="B2Ebtn">
-          <Button type="primary" onClick={btnOkFu} disabled={value.length < 24}>
+          <Button
+            type="primary"
+            onClick={btnOkFu}
+            disabled={value.length < 24 || newRoomName.code !== 1}
+          >
             提交
           </Button>
           &emsp;

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

@@ -4,10 +4,11 @@ export type B2FromDataType = {
   city:string
   region:string
   auditStatus: string;
-  pmUser: string;
+  roomName: string;
   searchKey: string;
   pageSize: number;
   pageNum: number;
+  isSiteEmpty:1|0
 };
 
 // 计算状态

+ 12 - 0
src/pages/B2Scene/index.module.scss

@@ -209,6 +209,18 @@
           }
         }
 
+        .B2Ebox1Err {
+          &>div {
+            &:nth-of-type(1) {
+              opacity: 0;
+            }
+
+            &:nth-of-type(2) {
+              color: #ff4d4f;
+            }
+          }
+        }
+
 
         .B2Ebtn {
           margin-top: 20px;

+ 34 - 30
src/pages/B2Scene/index.tsx

@@ -9,6 +9,7 @@ import styles from "./index.module.scss";
 import {
   Button,
   Cascader,
+  Checkbox,
   Input,
   Popconfirm,
   Select,
@@ -46,10 +47,11 @@ function B2Scene() {
     city: "",
     region: "",
     auditStatus: "",
-    pmUser: "",
+    roomName: "",
     searchKey: "",
     pageSize: 10,
     pageNum: 1,
+    isSiteEmpty: 0,
   });
 
   const tableSelectRef = useRef({} as B2FromDataType);
@@ -85,7 +87,7 @@ function B2Scene() {
 
   // 输入框的改变
   const txtChangeFu = useCallback(
-    (txt: string, key: "pmUser" | "searchKey") => {
+    (txt: string, key: "roomName" | "searchKey") => {
       setTableSelect({ ...tableSelect, [key]: txt });
     },
     [tableSelect]
@@ -110,10 +112,11 @@ function B2Scene() {
       city: "",
       region: "",
       auditStatus: "",
-      pmUser: "",
+      roomName: "",
       searchKey: "",
       pageSize: 10,
       pageNum: 1,
+      isSiteEmpty: 0,
     });
     setTimeout(() => {
       setTimeKey(Date.now());
@@ -160,7 +163,12 @@ function B2Scene() {
   );
 
   // 修改机房编码
-  const [editNum, setEditNum] = useState({ id: 0, num: "", name: "" });
+  const [editNum, setEditNum] = useState({
+    id: 0,
+    num: "",
+    name: "",
+    roomName: "",
+  });
 
   const columns = useMemo(() => {
     return [
@@ -174,6 +182,7 @@ function B2Scene() {
                   id: item.id,
                   num: item.roomNum,
                   name: item.sceneName,
+                  roomName: item.roomName,
                 })
               }
               className="B2audit"
@@ -191,15 +200,9 @@ function B2Scene() {
             ? "(空)"
             : `${item.province}-${item.city}-${item.region}`,
       },
-      // 待完善
       {
-        title: "项目经理",
-        render: (item: B2tableType) => {
-          if (item.creatorId === 1) return "管理员";
-          else {
-            return item.pmName || "(空)";
-          }
-        },
+        title: "站址名称",
+        render: (item: B2tableType) => item.roomName || "(空)",
       },
       {
         title: "场景名称",
@@ -254,14 +257,6 @@ function B2Scene() {
         render: (item: B2tableType) => item.shootTime || "(空)",
       },
       {
-        title: "领用单位",
-        render: (item: B2tableType) => item.snapUseDept || "(空)",
-      },
-      {
-        title: "领用人员",
-        render: (item: B2tableType) => item.snapUseName || "(空)",
-      },
-      {
         title: "审核状态",
         render: (item: B2tableType) => (
           <>
@@ -397,28 +392,24 @@ function B2Scene() {
             sheetFilter: [
               "roomNum",
               "myCity",
-              "pmName",
+              "roomName",
               "sceneName",
               "link",
               "sceneCode",
               "cameraSn",
               "shootTime",
-              "snapUseDept",
-              "snapUseName",
               "auditStatus",
               "auditTime",
             ],
             sheetHeader: [
               "机房编码",
               "站址地区",
-              "项目经理",
+              "站址名称",
               "场景名称",
               "场景链接",
               "场景码",
               "相机SN码",
               "拍摄时间",
-              "领用单位",
-              "领用人员",
               "审核状态",
               "审核时间",
             ],
@@ -475,19 +466,32 @@ function B2Scene() {
               }
             />
           </div>
+          <div className="B2topRow">
+            <Checkbox
+              checked={!!tableSelect.isSiteEmpty}
+              onChange={(e) =>
+                setTableSelect({
+                  ...tableSelect,
+                  isSiteEmpty: e.target.checked ? 1 : 0,
+                })
+              }
+            >
+              仅查看站址地区为空的场景
+            </Checkbox>
+          </div>
         </div>
         {/* 右侧按钮 */}
         <div className="B2top2">
           <div>
             <div className="B2topRow">
-              <span>项目经理:</span>
+              <span>站址名称:</span>
               <Input
                 key={inputKey}
                 maxLength={10}
                 style={{ width: 235 }}
-                placeholder="请输入姓名,最多10字"
+                placeholder="请输入站址名称,最多10字"
                 allowClear
-                onChange={(e) => txtChangeFu(e.target.value, "pmUser")}
+                onChange={(e) => txtChangeFu(e.target.value, "roomName")}
               />
             </div>
 
@@ -568,7 +572,7 @@ function B2Scene() {
       {editNum.num ? (
         <EditNum
           info={editNum}
-          closeFu={() => setEditNum({ id: 0, num: "", name: "" })}
+          closeFu={() => setEditNum({ id: 0, num: "", name: "", roomName: "" })}
           upTableFu={getListFu}
         />
       ) : null}

+ 104 - 2
src/pages/B3Push/index.tsx

@@ -19,11 +19,17 @@ import { useDispatch, useSelector } from "react-redux";
 import { B3FromDataType } from "./data";
 import { B1options2, B1options2Obj } from "../B1Plan/data";
 import { QuestionCircleOutlined } from "@ant-design/icons";
-import { B3_APIgetlist, B3_APIpush } from "@/store/action/B3Push";
+import {
+  B3_APIgetlist,
+  B3_APIgetlistAll,
+  B3_APIpush,
+} from "@/store/action/B3Push";
 import { RootState } from "@/store";
 import { B3tableType } from "@/types";
 import { MessageFu } from "@/utils/message";
 import { mapDataAll1 } from "../C1User/AddUser/city";
+import ExportJsonExcel from "js-export-excel";
+import dayjs from "dayjs";
 
 function B3Push() {
   const dispatch = useDispatch();
@@ -164,7 +170,6 @@ function B3Push() {
             ? "(空)"
             : `${item.province}-${item.city}-${item.region}`,
       },
-      // 待完善
       {
         title: "项目经理",
         render: (item: B3tableType) => {
@@ -261,6 +266,99 @@ function B3Push() {
     ];
   }, [pushFu]);
 
+  // 点击导出
+  const deriveFu = useCallback(async () => {
+    if (B3TableList.total > 30000)
+      return MessageFu.warning(
+        "只支持导出最多30000条数据。请增加筛选条件,并重新尝试"
+      );
+
+    if (B3TableList.list.length === 0)
+      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 B3_APIgetlistAll({
+      ...tableSelect,
+      ...objTemp,
+      pageNum: 1,
+      pageSize: 99999,
+    });
+    if (res.code === 0) {
+      if (res.data.records.length <= 0)
+        return MessageFu.warning("当前搜索条件没有数据!");
+      const option = {
+        fileName: name,
+        datas: [
+          {
+            sheetData: res.data.records.map((v: B3tableType) => ({
+              roomNum: v.roomNum || "(空)",
+              myCity:
+                !v.province && !v.city && !v.region
+                  ? "(空)"
+                  : `${v.province}-${v.city}-${v.region}`,
+              pmName: v.creatorId === 1 ? "管理员" : v.pmName || "(空)",
+              sceneCode: v.sceneCode || "(空)",
+              pushStatus: Reflect.get(B1options2Obj, v.pushStatus) || "(空)",
+              pushStatusTxt: v.pushDesc || "(空)",
+              pushTime: v.pushTime || "(空)",
+              pushLinkStatus:
+                Reflect.get(B1options2Obj, v.pushLinkStatus) || "(空)",
+              pushLinkTime: v.pushLinkTime || "(空)",
+              jsonUpdateTime: v.jsonUpdateTime || "(空)",
+              jsonStatus: Reflect.get(B1options2Obj, v.jsonStatus) || "(空)",
+              jsonStatusTxt: v.jsonDesc || "(空)",
+              jsonPushTime: v.jsonPushTime || "(空)",
+            })),
+            sheetName: name,
+            sheetFilter: [
+              "roomNum",
+              "myCity",
+              "pmName",
+              "sceneCode",
+              "pushStatus",
+              "pushStatusTxt",
+              "pushTime",
+              "pushLinkStatus",
+              "pushLinkTime",
+              "jsonUpdateTime",
+              "jsonStatus",
+              "jsonStatusTxt",
+              "jsonPushTime",
+            ],
+            sheetHeader: [
+              "机房编码",
+              "站址地区",
+              "项目经理",
+              "场景码",
+              "场景推送状态",
+              "场景推送状态描述",
+              "场景推送时间",
+              "链接推送状态",
+              "链接推送时间",
+              "Json更新时间",
+              "Json推送状态",
+              "Json推送状态描述",
+              "Json推送时间",
+            ],
+            columnWidths: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],
+          },
+        ],
+      };
+
+      const toExcel = new ExportJsonExcel(option); //new
+      toExcel.saveExcel(); //保存
+    }
+  }, [B3TableList.list.length, B3TableList.total, tableSelect]);
+
   return (
     <div className={styles.B3Push}>
       <div className="pageTitle">
@@ -365,6 +463,10 @@ function B3Push() {
                 style={{ cursor: "pointer" }}
               />
             </Tooltip>
+            &emsp;
+            <Button type="primary" onClick={deriveFu}>
+              导出表格
+            </Button>
           </div>
         </div>
       </div>

+ 13 - 6
src/store/action/B2Scene.ts

@@ -51,12 +51,12 @@ export const B2_APIlookReDo = () => {
   return http.get("cms/scene/duplicateRoom");
 };
 
-/**
- * 查询机房编码是否存在
- */
-export const B2_APIcheckNum = (num: string) => {
-  return http.get(`cms/room/exist/${num}`);
-};
+// /**
+//  * 查询机房编码是否存在
+//  */
+// export const B2_APIcheckNum = (num: string) => {
+//   return http.get(`cms/room/exist/${num}`);
+// };
 
 /**
  * 更新机房编码
@@ -64,3 +64,10 @@ export const B2_APIcheckNum = (num: string) => {
 export const B2_APIeditNum = (id: number, num: string) => {
   return http.get(`cms/scene/update/${id}/${num}`);
 };
+
+/**
+ * 查询机房编码是否存在
+ */
+export const B2_APInumIsOk = (num: string) => {
+  return http.get(`cms/scene/room/exist/${num}`);
+};

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

@@ -17,6 +17,13 @@ export const B3_APIgetlist = (data: any) => {
 };
 
 /**
+ * 获取 进度统计 表格列表(导出表格)
+ */
+export const B3_APIgetlistAll = (data: any) => {
+  return http.post("cms/push/pageList", data);
+};
+
+/**
  * 点击推送
  */
 export const B3_APIpush = (arr: string[]) => {

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

@@ -21,4 +21,5 @@ export type B2tableType = {
   snapUseDept: string;
   snapUseName: string;
   updateTime: string;
+  roomName:string
 };

+ 2 - 2
src/utils/http.ts

@@ -7,8 +7,8 @@ import { domShowFu } from "./domShow";
 
 const envFlag = process.env.NODE_ENV === "development";
 
-// const baseUrlTemp = "https://sit-tieta3d.4dage.com"; // 测试环境
-const baseUrlTemp = "https://tower3d.4dkankan.com"; // 正式环境
+const baseUrlTemp = "https://sit-tieta3d.4dage.com"; // 测试环境
+// const baseUrlTemp = "https://tower3d.4dkankan.com"; // 正式环境
 // const baseUrlTemp = "http://192.168.20.61:8057"; // 线下环境
 
 const baseFlag = baseUrlTemp.includes("https://");