/*
 * @Author: Z 1518051043@qq.com
 * @Date: 2025-09-12 13:51:43
 * @LastEditors: zwy 1518051043@qq.com
 * @LastEditTime: 2026-01-28 17:27:20
 * @FilePath: \yuanxinPro\src\store\module\app.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Cookies from "js-cookie";
import { ElMessage } from "element-plus";
import { tr } from "element-plus/es/locales.mjs";

const useAppStore = defineStore("app", {
  state: () => ({
    // 记录时间轴走的时间
    globalTimeLineEndSelectTime: "2025-11-02 00:00:00",
    globalTimeLineStartTime: "2025-11-02 00:00:00",
    globalTimeLineEndTime: "2025-11-02 00:00:00",
    globalisFromTosub: false,
    footerTimeHasedSelectTimeToSub: false,
    globalSubsystemSelectedTimeRange: [
      "Sun Nov 02 2025 00:00:00 GMT+0800 (中国标准时间) ",
      "Tue Nov 04 2025 00:00:00 GMT+0800 (中国标准时间) ",
    ],

    globalLeftWssCONTINE: false,

    // 进入子系统前是否处于实时模式（专门用于返回时恢复，不依赖 globalLeftWssCONTINE）
    globalIsRealtimeBeforeSub: false,

    globalRecordMainSysTaskCode: 0,

    subSystemTimeLineEndSelectTime: "-",
    subsystemSocket: null,
    subsystemSocketContent: "",
    HeartbeatInterval: null,
    isTimeLineShow: true,
    islegendShow: true,//主系统时间下方图例是否隐藏
    isSourceLegendShow: true,
    isdataPanelShow: true,
    issatelliteOrbitShow: false,
    issatelliteBeamShow: true,
    iscontrolPanelShow: true,//控制主系统右上角悬浮框,分系统右上角悬浮框

    globaleAutoPlay: true,
    globalIntervalTime: 3000,
    globalStartWss: false,
    globalSatelliteSearchID: "4097",//卫星id
    globalSubsystemActiveIndex: "0",
    globalSubsystemIsFastForward: false,
    globalSubsystemSpeed: 1,
    globalSubsystemTaskCode: 0,
    globalSubsystemSelectedStartTime: [
      "Sun Nov 02 2025 00:00:00 GMT+0800 (中国标准时间) ",
      "Tue Nov 04 2025 00:00:00 GMT+0800 (中国标准时间) ",
    ],
    globalSubsystemSelectedEndTime: "2025-11-04 00:00:00", //暂未使用
    globalDisableTimeLine: true,

    gridPanelData: [], //格网面板
    regionPanelData: [], //区域面板
    signalSitePanelData: [], //信关站面板

    chartConfig: {}, //图表配置项,

    currentHotMapCountry: null,

    gridInfoList: null, //全部格网信息列表
  }),
  actions: {
    setGlobalRecordMainSysTaskCode(status) {
      this.globalRecordMainSysTaskCode = status;
    },
    setGlobalLeftWssCONTINE(status) {
      this.globalLeftWssCONTINE = status;
    },
    setGlobalIsRealtimeBeforeSub(status) {
      this.globalIsRealtimeBeforeSub = status;
    },
    setSubSystemTimeLineEndSelectTime(status) {
      this.subSystemTimeLineEndSelectTime = status;
    },
    setFooterTimeHasedSelectTimeToSub(status) {
      this.footerTimeHasedSelectTimeToSub = status;
    },
    setGlobalSubsystemSelectedTimeRange(range) {
      this.globalSubsystemSelectedTimeRange = range;
    },
    setGlobalisFromTosub(status) {
      this.globalisFromTosub = status;
    },
    setGlobalTimeLineEndSelectTime(time) {
      this.globalTimeLineEndSelectTime = time;
    },
    setGlobalTimeLineStartTime(time) {
      this.globalTimeLineStartTime = time;
    },
    setGlobalTimeLineEndTime(time) {
      this.globalTimeLineEndTime = time;
    },
    setSubsystemSocket(socket) {
      this.subsystemSocket = socket;
    },
    setSubsystemSocketContent(content) {
      this.subsystemSocketContent = content;
    },
    setHeartbeatInterval(interval) {
      this.HeartbeatInterval = interval;
    },
    setisTimeLineShow(status) {
      this.isTimeLineShow = status;
    },
    setislegendShow(status) {
      this.islegendShow = status;
    },
    setisSourceLegendShow(status) {
      this.isSourceLegendShow = status;
    },
    setisdataPanelShow(status) {
      this.isdataPanelShow = status;
    },
    setissatelliteOrbitShow(status) {
      this.issatelliteOrbitShow = status;
    },

    setissatelliteBeamShow(status) {
      this.issatelliteBeamShow = status;
    },
    setiscontrolPanelShow(status) {
      this.iscontrolPanelShow = status;
    },
    setglobaleAutoPlay(status) {
      this.globaleAutoPlay = status;
    },
    setglobalIntervalTime(status) {
      //   //console.log("开始执行间隔时间");

      this.globalIntervalTime = status;
    },
    setglobalStartWss(status) {
      // //console.log("同步socket数据");

      this.globalStartWss = status;
    },
    setglobalSatelliteSearchID(status) {
      //   //console.log("设置卫星搜索ID");

      this.globalSatelliteSearchID = status;
    },
    setglobalSubsystemActiveIndex(status) {
      this.globalSubsystemActiveIndex = status;
    },
    setglobalSubsystemIsFastForward(status) {
      this.globalSubsystemIsFastForward = status;
    },
    setglobalSubsystemSpeed(status) {
      this.globalSubsystemSpeed = status;
    },
    setglobalSubsystemTaskCode(status) {
      this.globalSubsystemTaskCode = status;
    },

    setglobalSubsystemSelectedStartTime(status) {
      this.globalSubsystemSelectedStartTime = status;
    },
    setglobalSubsystemSelectedEndTime(status) {
      this.globalSubsystemSelectedEndTime = status;
    },
  },
});

export default useAppStore;
