import React, { useState, useEffect, useRef } from "react"; import { connect } from "react-redux"; import moment from "moment"; import { Button, Form, Table, Pagination, Skeleton, Popconfirm, SideSheet, Tag, } from "@douyinfe/semi-ui"; import "../style.less"; import { ApiTable } from "$utils"; import { Setup } from "$components"; import PushModal from "../components/pushModal"; import PushSideSheet from "../components/pushSideSheet"; // import SideSheets from "../components/sideSheet"; export const accessType = [ { name: "萤石云", key: "yingshi" }, { name: "NVR", key: "nvr" }, { name: "IPC", key: "ipc" }, { name: "级联", key: "cascade" }, ]; const Carrierpigeon = (props) => { const { history, dispatch, actions, user, loading, StatusPushList } = props; const { offline } = actions; const [setup, setSetup] = useState(false); const [setupp, setSetupp] = useState([]); const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 const [search, setearch] = useState({}); //搜索条件 const [rowId, setRowId] = useState(); //表格数据id const [pigeonPush, setPigeonPush] = useState(false); //推送弹框 const [pushTitle, setPushTitle] = useState(''); //提醒弹框 const api = useRef(); const searchData = useRef(search) const limits = useRef(); //每页实际条数 const page = useRef(query.page); const PIGEON = "pigeon"; const cameraList = useRef([]);//第三阶段监听范围摄像头列表 const [sideSheetVisible, setSideSheetVisible] = useState(false); const [pushData, setPushData] = useState({}); const [journal, setJournal] = useState([]); const tableList = [//表格属性 { title: '推送信息', list: [ { name: "策略类型", value: "pushWay" }, { name: "推送机制", value: "noticeWay" }, { name: "监听设备数量", value: "monitorCount" }, { name: "累计推送次数", value: "logCount" }, ] }, ]; const noticeWayObj = { 'offline':'离线及时通知', 'online':'上线及时通知', 'timing':'定时统计', } useEffect(() => { attribute(); dispatch(offline.getCameraListAll()).then((res) => {//第三步 let mycameraList = res.payload.data for (let index = 0; index < mycameraList.length; index++) { mycameraList[index].label=mycameraList[index].name mycameraList[index].key=index+1 mycameraList[index].value=String(mycameraList[index].id) if(mycameraList[index].type=='cascade'){ mycameraList[index].color='#808FD3' mycameraList[index].abbr='级联' } else if(mycameraList[index].type=='nvr'){ mycameraList[index].color='#F6D86F' mycameraList[index].abbr='NVR' } else if(mycameraList[index].type=='ipc'){ mycameraList[index].color='#1859C1' mycameraList[index].abbr='IPC' } else{ mycameraList[index].color='#57CBD3' mycameraList[index].abbr='莹石' } } cameraList.current=mycameraList }); //初始化表格显示设置 localStorage.getItem(PIGEON) == null ? localStorage.setItem( PIGEON, JSON.stringify(['pushWay','noticeWay','logCount','monitorCount']) ) : ""; }, []); useEffect(() => { equipmentGetStatusPush(); }, [query, search]); const equipmentGetStatusPush = () => { searchData.current = { ...query, ...search } dispatch(offline.getStatusPush(searchData.current)).then((res) => { limits.current = res.payload.data.length }); } const columns = [ { title: "序号", render: (_, record, index) => { return index + 1; }, }, { title: "策略名称", dataIndex: "name", render: (_, r, index) => { return r.name }, }, { title: "操作", width: "20%", dataIndex: "", render: (_, row) => { return (