import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) let status_time = 24 * 60 * 60 * 1000 export default new Vuex.Store({ state: { token: "", userState: false, userInfo: null, menuListDeafaultTotal: [ { label: "综合展示", name: "ComprehensiveDisplay", index: "1", permission: 10, }, { label: "数据图层", name: "DataLayer", index: "2", permission: 20, children: [ { label: "图标库管理", name: "IconLibraryManagement", index: "1", permission: 21, }, { label: "图层管理", name: "LayerManagement", index: "2", permission: 22, }, ], }, { label: "数据质检", name: "DataQualityInspection", index: "3", permission: 30, children: [ { label: "质检规则", name: "QualityInspectionRules", index: "1", permission: 31, children: [ { label: "图层质检规则", index: "1", }, { label: "单条数据规则", index: "2", }, { label: "数据导入规则", index: "3", children: [ { label: "Excel导入规则", index: "1", }, { label: "Shapefile导入规则", index: "2", }, { label: "Geojson导入规则", index: "3", }, { label: "数据库导入规则", index: "4", }, ] }, { label: "数据完整性检查", index: "4", }, ] }, { label: "质检流程管理", name: "QualityInspectionProcessManagement", index: "2", permission: 32, children: [ { label: "质检流程图", index: "1", children: [ { label: "接口接入质检流程图", index: "1", }, { label: "附件流程图", index: "2", }, ], }, { label: "附件质检", index: "2", children: [ { label: "Excel质检", index: "1", }, { label: "Shapefile质检", index: "2", }, { label: "Geojson质检", index: "3", }, { label: "数据库质检", index: "4", }, ], }, ] }, ], }, { label: "数据接入", name: "DataAccess", index: "4", permission: 40, children: [ { label: "数据录入", name: "DataTable", index: "1", permission: 41, }, { label: "数据导入", name: "DataTable", index: "2", permission: 42, }, { label: "数据日志", name: "DataLog", index: "3", permission: 43, }, { label: "结果反馈", name: "ResultFeedback", index: "4", permission: 44, }, ], }, { label: "数据展示", name: "DataDisplay", index: "5", permission: 50, children: [ { label: "入库数据展示", name: "DataTable", index: "1", permission: 51, }, { label: "GIS图层展示", name: "LayerDisplay", index: "2", permission: 52, }, ], }, { label: "数据服务", name: "DataServices", index: "6", permission: 60, children: [ { label: "数据发布", name: "DataTable", index: "1", permission: 61, }, { label: "数据服务接口", name: "DataService", index: "2", permission: 62, }, { label: "瓦片服务接口", name: "TileSerivce", index: "3", permission: 63, }, { label: "服务监控", name: "ServiceMonitoring", index: "4", permission: 64, }, ], }, { label: "实用工具", name: "Utilities", index: "7", permission: 70, children: [ { label: "地址转换工具", name: "AddressTranslationTool", index: "1", permission: 71, }, { label: "坐标转换工具", name: "CoordinateConversionTool", index: "2", permission: 72, }, { label: "手动落图工具", name: "ManualDrawingTool", index: "3", permission: 73, }, { label: "图形绘制工具", name: "GraphicsDrawingTool", index: "4", permission: 74, }, { label: "测量工具", name: "MeasureTool", index: "5", permission: 75, }, ], }, { label: "二次开发", name: "SecondaryDevelopment", index: "8", permission: 80, children: [ { label: "手动落图工具", name: "ManualDrawingTool", index: "1", permission: 81, }, { label: "图形绘制工具", name: "GraphicsDrawingTool", index: "2", permission: 82, }, { label: "测量工具", name: "MeasureTool", index: "3", permission: 83, }, { label: "加载瓦片服务", name: "AddTileService", index: "4", permission: 84, }, ], }, { label: "系统管理", name: "SystemManagement", index: "9", permission: 90, children: [ { label: "用户管理", name: "UserManagement", index: "1", permission: 91, }, { label: "角色管理", name: "RoleManagement", index: "2", permission: 92, }, ], }, ], menuListTotal: [], isShowChart: false, layers: [], layerList: [], iconList: [], mouseLocation: [0, 0], nowZoom: 6 }, getters: { getToken: function (state) { return Vue.ls.get("token") }, getUserState: function (state) { return Vue.ls.get("userState") }, getUserInfo: function (state) { return JSON.parse(Vue.ls.get("userInfo")) }, getMenuListTotal: function (state) { return state.menuListTotal }, getMenuListDeafaultTotal: function (state) { return state.menuListDeafaultTotal }, }, mutations: { setToken(state, str) { state.token = str; Vue.ls.set("token", str, status_time); }, setUserState(state, bool) { state.userState = bool; Vue.ls.set("userState", bool, status_time); }, setUserInfo(state, obj) { state.userInfo = obj; Vue.ls.set("userInfo", JSON.stringify(obj), status_time); }, setLayerList(state, arr) { state.layerList = arr.concat([]); }, setIconList(state, arr) { state.iconList = arr.concat([]); }, setMouseLocation(state, arr) { state.mouseLocation = arr; }, setZoom(state, zoom) { state.nowZoom = zoom; }, addLayer(state, obj) { state.layers.unshift(obj); }, removeLayer(state, obj) { state.layers = state.layers.filter(function (item) { return item.layerId != obj.layerId; }) }, resetLayer(state, arr) { state.layers = arr.concat([]) }, setChartIsShow(state, bool) { state.isShowChart = bool }, setMenuListTotal(state, obj) { state.menuListTotal = JSON.parse(JSON.stringify(obj)) } }, actions: { addLayerControl(context, obj) { context.commit('addLayer', obj) }, removeLayerControl(context, obj) { context.commit('removeLayer', obj) }, resetLayerControl(context, arr) { context.commit('resetLayer', arr) }, }, modules: {}, })