import { store } from "@/store";
import { defineStore } from "pinia";

interface CommonState {
  [key: string]: any;
}

export const useCommonStore = defineStore("commonStore", {
  state: (): CommonState => ({
    // 弹出公共Table的弹窗
    isShowTable: false,
    tableType: 1,
    tableTitle: "",
    //   大屏显示的组件key值，包含默认值
    mainSL001: "OrderInformation",
    mainSL002: "MaterialsCondition",
    mainSL003: "ProductionScheduleOfHeavyParts",
    mainSRT12: "ProductionTaskStatistics",
    mainSRT13: "ProductionCapacitySituation",
    mainS076: "DailyProductionS",
    mainS077: "ProductionSituation",
    mainS078: "EquipmentMonitoring",
    mainLeftTop: "XiaFaGongDanJinDu",
    BanZucqtj: "BanZuChuQinTongJi",
    ShengChanJHQK: "ShengChanJiHuaQingKuang",
    ChengPinRKQKJ: "ChengPinRuKuQingKuang",
    WeiDianZCJGG: "WeiDianZiCheJianGongGao",
    // ====
    qualityTOP01: "DistributionOfUnqualifiedProducts",
    qualityTOP02: "ProductionPassThroughRate",
    qualityTOP03: "QualityAnomaly",
    qualityBottom01: "InspectionTaskOfToday",
    qualityBottom02: "DefectDistributionDiagram",
    // ====
    workTOP01: "ManagementPersons",
    workTOP02: "ChanLiangTongJi",
    workTOP03: "WeeklyFulfillmentOfProductionOrders",
    workBottom01: "CurrentProductionOrderProgress",
    workBottom02: "BadTop10",

    moduleKey: "", // 用于判断修改了哪个模块
    isShowSelectModule: false, // 是否显示选择模块中的组件弹窗
  }),
  persist: true,
});

export function useCommonStoreHook() {
  return useCommonStore(store);
}
