|
|
@@ -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>
|
|
|
+  
|
|
|
+ <Button type="primary" onClick={deriveFu}>
|
|
|
+ 导出表格
|
|
|
+ </Button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|