常用变量的类封装和常用刷新任务封装

156 阅读5分钟
class BaseConstant {
    static getInstance = () => baseConstant;
    G_OPERATE = {//常用的页面操作,如添加、删除、浏览之类
        ADD: "add",
        EDIT: "edit",
        SHOW: "show",
        TXT_TO_AUDIO: "txt-to-audio",
        PREVIEW: "preview",
        UPLOAD: "upload",
        OK: "ok",
        CANCEL: "cancel",
    };
    
    G_TIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
    G_PAGE_SIZE = 10;
    G_DEFAULT_PASSWORD = "123456";

    G_DEVICE_TYPE = {//
        TERMINAL: 2,
        ADAPTER: 1,
        ALL: 0,
    };

    G_REGION_DEVICE = {//
        DEVICE: 2,//只设置区域
        REGION: 1,//只设置区域
        ALL: 3,//设置区域和设备
    };

    G_REFRESH_URL = {//用于定时刷新
        ASSIST_DATA: "assisstlist",
        LOG: "loglist",
        MONITOR: "monitor",
        REALTIME_EB_PLAY_STATUS: "realtimestatus",
        FLOW_MONITOR:"flow_monitor"
    };

    G_DEVICE_STATE_COLOR = { // 设备状态颜色
        FREE: '#2db7f5',     // 未注册 未播放 空闲 待机 正常 =>蓝色 #2db7f5
        UNNORMAL: '#f50',    // 异常 故障  => 红色 #f50
        PLAYING: '#87d068',  // 正在播放 占用 正在运行 已连接 在线=> 绿色 #87d068
        OFFLINE: '#969696'   // 关机 离线=> 灰色 #969696
    };
}

const baseConstant = new BaseConstant();

export default BaseConstant;
import React from "react";
import Icon from "antd/es/icon";
let subMenuIndex = 0;
class BaseData {

    static getInstance = () => baseData;    

    //刷新任务是否启用
    isContinueTask = true;
    
    updateTimes = null;

    //需要刷新的任务列表
    updateTimeTask = {
        sysTime: null,
    };

    updateLogTask = {
        refresh: null,
    };

    updateEvaluationList = {
        refresh: null,
    };

    updateAdapterStatusList = {
        refresh: null,
    };

    updateTerminalStatusList ={
        refresh: null,
    };

    updateBroadcastIsPlaying = {
        refresh: null,
    };

    updateTopoStatus = {
        refresh: null,
    };

    updateEventLevelStatus = {
        refresh: null,
    };

    updateTimeEB = {//定时广播定时刷新
        refresh: null,
    };

    //用来存储一些初始值,用来比较页面参数有没有修改
    originalData = {};

    //用于定时刷新
    requestParam = [];
    callBackList = {};
    errorCallBackList = {};
    refreshInterval = 3;

    //大屏全屏全屏
    toggleFullscreen = null ;
    //是否超级用户
    isSuper = 0;
    //用户操作权限
    userOperation = 1;
    userHasOperation = {
        view: true,
        add: false,
        delete: false,
        edit: false
    };
    regionList = [];
    regionTree = [];

    // 导航type为1表示是父组件,本身不可以点击跳转;type为0表示是子组件,本身可以点击跳转
    navList = [{        icon: <Icon type="control" />,        title: "市平台",        key: "sub" + subMenuIndex++,        type: 1,        children: [{            title: "播发查询",            key: "11",            linkProps: {                to: "/ebd"            }        }, {            title: "运维管理查询",            key: "12",            linkProps: {                to: "/ebr"            }        }, {            title: "效果评估",            key: "13",            linkProps: {                to: "/ebm"            }        }]
    }, {
        icon: <Icon type="global" />,
        title: "地图模式",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "大屏展示",
            key: "1073741824",
            linkProps: {
                to: "/big-screen"
            }
        }, {
            title: "地图",
            key: "1",
            linkProps: {
                to: "/map"
            }
        }
        ]
    }, {
        icon: <Icon type="solution" />,
        title: "内容与策略",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "制作播发",
            key: "16",
            linkProps: {
                to: "/production-play"
            }
        }, {
            title: "内容审核",
            key: "32",
            linkProps: {
                to: "/review"
            }
        }, {
            title: "资源预案",
            key: "64",
            linkProps: {
                to: "/resource"
            }
        }, {
            title: "调度预案",
            key: "281474976710656",
            linkProps: {
                to: "/dispatch"
            }
        }]
    }, {
        icon: <Icon type="notification" />,
        title: "广播播发",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "上级播发",
            key: "2",
            linkProps: {
                to: "/superior-broadcast"
            }
        }, {
            title: "本地播发",
            key: "4",
            linkProps: {
                to: "/local-broadcast"
            }
        }, {
            title: "效果评估",
            key: "8",
            linkProps: {
                to: "/evaluation-list"
            }
        }, {
            title: "上级消息",
            key: "33554432",
            linkProps: {
                to: "/eb-record"
            }
        }]
    }, {
        icon: <Icon type="control" />,
        title: "节目配置",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "通道管理",
            key: "17592186044416",
            linkProps: {
                to: "/program-channel"
            }
        }]
    }, {
        icon: <Icon type="api" />,
        title: "适配器",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "适配器列表",
            key: "128",
            linkProps: {
                to: "/adapter-list"
            }
        }, {
            title: "适配器管理",
            key: "256",
            linkProps: {
                to: "/adapter-manage"
            }
        }, {
            title: "适配器状态",
            key: "512",
            linkProps: {
                to: "/adapter-status"
            }
        }]
    }, {
        icon: <Icon type="database" />,
        title: "台站",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "台站适配器",
            key: "4294967296",
            linkProps: {
                to: "/station-list"
            }
        }, {
            title: "台站适配器管理",
            key: "8589934592",
            linkProps: {
                to: "/station-tab"
            }
        }, {
            title: "台站",
            key: "17179869184",
            linkProps: {
                to: "/real-station-list"
            }
        }]
    }, {
        icon: <Icon type="video-camera" />,
        title: "终端",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "终端列表",
            key: "1024",
            linkProps: {
                to: "/terminal-list"
            }
        }, {
            title: "终端管理",
            key: "2048",
            linkProps: {
                to: "/terminal-tab"
            }
        }, {
            title: "终端状态",
            key: "4096",
            linkProps: {
                to: "/terminal-status"
            }
        }]
    }, {
        icon: <Icon type="control" />,
        title: "传输覆盖设备",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "传输覆盖设备",
            key: "34359738368",
            linkProps: {
                to: "/transport-equipment"
            }
        }]
    }, {
        icon: <Icon type="up-circle" />,
        title: "平台管理",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "上级平台",
            key: "8192",
            linkProps: {
                to: "/platform-setting"
            }
        }, {
            title: "酉阳平台接入",
            key: "562949953421312",
            linkProps: {
                to: "/platform-outer"
            }
        }, {
            title: "本地平台",
            key: "16777216",
            linkProps: {
                to: "/local-platform-setting"
            }
        }, {
            title: "节点管控",
            key: "68719476736",
            linkProps: {
                to: "/access-point"
            }
        }]
    }, {
        icon: <Icon type="message" />,
        title: "短信猫",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "通讯录",
            key: "67108864",
            linkProps: {
                to: "/phoneuser"
            }
        }, {
            title: "短信播发",
            key: "134217728",
            linkProps: {
                to: "/message-play-list"
            }
        }, {
            title: "短信记录",
            key: "268435456",
            linkProps: {
                to: "/message-record"
            }
        }]
    }, {
        icon: <Icon type="monitor" />,
        title: "系统监控",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "视频监控",
            key: "137438953472",
            linkProps: {
                to: "/camera"
            }
        }, {
            title: "视频回看",
            key: "274877906944",
            linkProps: {
                to: "http://192.168.254.134/index.htm?username=admin&password=wellav&logintype=wan"
            }
        }, {
            title: "拓扑监控",
            key: "549755813888",
            linkProps: {
                to: "/topology"
            }
        }]
    }, {
        icon: <Icon type="alert" />,
        title: "显示屏管理",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "LED屏",
            key: "1099511627776",
            linkProps: {
                to: "/led-screen-list"
            }
        }, {
            title: "节目配置",
            key: "2199023255552",
            linkProps: {
                to: "/led-program-config"
            }
        }, {
            title: "节目播放",
            key: "4398046511104",
            linkProps: {
                to: "/led-program-play"
            }

        }]
    }, {
        icon: <Icon type="audio" />,
        title: "播控器",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "IP话筒",
            key: "8796093022208",
            linkProps: {
                to: "/ip-microphone"
            }
        }]
    }, {
        icon: <Icon type="solution" />,
        title: "融媒体",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "平台设置",
            key: "70368744177664",
            linkProps: {
                to: "/media-convergence-setting"
            }
        }, {
            title: "广播播发",
            key: "140737488355328",
            linkProps: {
                to: "/media-convergence-broadcast"
            }
        }]
    }, {
        icon: <Icon type="setting" />,
        title: "运维管理",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "用户管理",
            key: "32768",
            linkProps: {
                to: "/user"
            }
        }, {
            title: "角色管理",
            key: "65536",
            linkProps: {
                to: "/role"
            }
        }, {
            title: "部门管理",
            key: "2147483648",
            linkProps: {
                to: "/unit-info"
            }
        }, {
            title: "区域管理",
            key: "262144",
            linkProps: {
                to: "/region"
            }
        }, {
            title: "证书管理",
            key: "524288",
            linkProps: {
                to: "/certificate-manage"
            }
        }, {
            title: "日志管理",
            key: "1048576",
            linkProps: {
                to: "/log"
            }
        }, {
            title: "系统设置",
            key: "2097152",
            linkProps: {
                to: "/system-set"
            }
        }, {
            title: "授时同步",
            key: "536870912",
            linkProps: {
                to: "/time_info"
            }
        }, {
            title: "系统监控",
            key: "4194304",
            linkProps: {
                to: "/system-monitor"
            }
        }, {
            title: "数据备份",
            key: "8388608",
            linkProps: {
                to: "/data-backup"
            }
        }]
    }, {
        icon: <Icon type="gateway" />,
        title: "电信网关",
        key: "sub" + subMenuIndex++,
        type: 1,
        children: [{
            title: "白名单",
            key: "18014398509481984",
            linkProps: {
                to: "/white-list"
            }
        }, {
            title: "短信记录",
            key: "36028797018963968",
            linkProps: {
                to: "/message-record-tab"
            }
        }, {
            title: "电话记录",
            key: "72057594037927936",
            linkProps: {
                to: "/telephone-record"
            }
        }]
    }
    ];
}

const baseData = new BaseData();
export default BaseData;