renmingwang
2026-03-25 6d56bf4daf08c4c7c6d193d98ed0b547dc473451
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * @Author: daidai
 * @Date: 2021-12-06 11:01:16
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-11-15 10:30:00  // 更新了时间
 * @FilePath: \web-pc\src\store\modules\menus.js
 */
import {isObject} from '@/lib/types'
export default {
    state: () => ({
        sbtxSwiper: true,//设备提醒轮播
        ssyjSwiper:true,//实时预警轮播
        isScale:true,//是否进行全局适配
        fullscreen: false, // 添加:全屏状态
        currentTask: 'sc02', // 当前任务:sc01/sc02
        currentLocation: 'sc01', // 当前货位状态:sc01/sc02
        defaultOption: {
            step: 4.4, // 数值越大速度滚动越快
            hoverStop: true, // 是否开启鼠标悬停stop
            openWatch: true, // 开启数据实时监控刷新dom
            direction: 1, // 0向下 1向上 2向左 3向右
            limitMoveNum: 4, // 开始无缝滚动的数据量 this.dataList.length
            singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
            singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
            waitTime: 3000 // 单步运动停止的时间(默认值1000ms)
          },
          echartsAutoTime:3000,//echarts 图自动请求接口时间
    }),
    getters: {
        //根据菜单路径获取 菜单信息
    },
    mutations: {
        initSwipers(state){
            let flags = JSON.parse(localStorage.getItem('settingData'))
            // console.log(flags);
            if(flags && isObject(flags)){
               for (const key in flags) {
                   if (state.hasOwnProperty.call(flags, key) && flags.hasOwnProperty.call(flags, key)) {
                       const element = flags[key];
                       state[key] = element
                   }
               }
            }
        },
        updateSwiper(state, {val,type}) {
            state[type] = val
            
            // 创建完整的设置对象,包含全屏状态和切换状态
            const settingData = {
                sbtxSwiper: state.sbtxSwiper,
                ssyjSwiper: state.ssyjSwiper,
                isScale: state.isScale,
                fullscreen: state.fullscreen || false, // 确保包含全屏状态
                currentTask: state.currentTask,
                currentLocation: state.currentLocation
            }
            
            localStorage.setItem('settingData', JSON.stringify(settingData))
        },
        
        // 更新当前任务
        updateCurrentTask(state, val) {
            state.currentTask = val;
            
            // 创建完整的设置对象,包含全屏状态和切换状态
            const settingData = {
                sbtxSwiper: state.sbtxSwiper,
                ssyjSwiper: state.ssyjSwiper,
                isScale: state.isScale,
                fullscreen: state.fullscreen || false,
                currentTask: state.currentTask,
                currentLocation: state.currentLocation
            }
            
            localStorage.setItem('settingData', JSON.stringify(settingData))
        },
        
        // 更新当前货位状态
        updateCurrentLocation(state, val) {
            state.currentLocation = val;
            
            // 创建完整的设置对象,包含全屏状态和切换状态
            const settingData = {
                sbtxSwiper: state.sbtxSwiper,
                ssyjSwiper: state.ssyjSwiper,
                isScale: state.isScale,
                fullscreen: state.fullscreen || false,
                currentTask: state.currentTask,
                currentLocation: state.currentLocation
            }
            
            localStorage.setItem('settingData', JSON.stringify(settingData))
        },
 
    },
    actions: {
       
    },
}