|
@@ -8,139 +8,106 @@ const KEY_PAGE_BRANDCRUMB = 'page_brandcrumb'
|
|
|
|
|
|
export default {
|
|
|
namespaced: true,
|
|
|
- state: {
|
|
|
- sidebarClosed: false,
|
|
|
- sidebarSelected: '', // sidebar选中的选项
|
|
|
- // userInfo: null, //{ username: 'admin' },
|
|
|
- userInfo: {
|
|
|
- username: 'yanruolan',
|
|
|
- userId: '06328a53c69a41bb8f5bb1a552c6e8d6'
|
|
|
+ state: {
|
|
|
+ sidebarClosed: false,
|
|
|
+ sidebarSelected: '', // sidebar选中的选项
|
|
|
+ userInfo: null, //{ username: 'admin' },
|
|
|
+ permissions: {
|
|
|
+ "system:role:delete": true,
|
|
|
+ "system:role:create": true,
|
|
|
+ "system:role:query": true,
|
|
|
+ "system:role:setOpts": true
|
|
|
+ },
|
|
|
+ projectId: '',
|
|
|
+ projects: [],
|
|
|
+ breadcrumb: [],
|
|
|
+ uploaderList: [], //当前上传文件列表
|
|
|
+ secret: "", //项目密码
|
|
|
+ userId: "", //用户id
|
|
|
+ rowEdit: false,//表格数据变化
|
|
|
+ errorReport:[],//扫楼错误报告
|
|
|
},
|
|
|
- permissions: {
|
|
|
- "system:role:delete": true,
|
|
|
- "system:role:create": true,
|
|
|
- "system:role:query": true,
|
|
|
- "system:role:setOpts": true
|
|
|
- },
|
|
|
- projectId: 'Pj5101050001',
|
|
|
- projects: [{
|
|
|
- id: "Pj5101050001",
|
|
|
- name: "成都青羊万达广场",
|
|
|
- pwd: "saga123456"
|
|
|
- },{
|
|
|
- id: "Pj1101080260",
|
|
|
- name: "万达测试",
|
|
|
- pwd: "saga123456"
|
|
|
- },{
|
|
|
- id: "Pj5107030002",
|
|
|
- name: "绵阳CBD万达广场",
|
|
|
- pwd: "saga123456"
|
|
|
- },{
|
|
|
- id: "Pj1101050029",
|
|
|
- name: "北京东坝万达广场",
|
|
|
- pwd: "saga123456"
|
|
|
- },{
|
|
|
- id: "Pj4419000005",
|
|
|
- name: "莞城万科城市广场",
|
|
|
- pwd: "saga123456"
|
|
|
- },{
|
|
|
- id: "Pj1101080259",
|
|
|
- name: "博锐尚格北京总部办公楼",
|
|
|
- pwd: "saga123456"
|
|
|
- },{
|
|
|
- id: "Pj4101020002",
|
|
|
- name: "郑州亿达科技新城展厅",
|
|
|
- pwd: "saga123456"
|
|
|
- }],
|
|
|
- breadcrumb: [],
|
|
|
- uploaderList: [], //当前上传文件列表
|
|
|
- secret: "saga123456", //项目密码
|
|
|
- userId: "06328a53c69a41bb8f5bb1a552c6e8d6", //用户id
|
|
|
- rowEdit: false,//表格数据变化
|
|
|
- errorReport: [],//扫楼错误报告
|
|
|
- },
|
|
|
- getters: {
|
|
|
- sidebarClosed: state => state.sidebarClosed,
|
|
|
- secret: state => state.secret,
|
|
|
- userId: state => state.userId,
|
|
|
- sidebarSelected: state => {
|
|
|
- // if (!state.pageSidebarSelected) {
|
|
|
- // let menu = storage.get(KEY_MENU_SELECTED)
|
|
|
- // if (menu) {
|
|
|
- // state.pageSidebarSelected = menu
|
|
|
- // }
|
|
|
- // }
|
|
|
- // return state.pageSidebarSelected
|
|
|
- return state.sidebarSelected
|
|
|
- },
|
|
|
- userInfo: state => state.userInfo,
|
|
|
- permissions: state => state.permissions,
|
|
|
- projects: state => state.projects,
|
|
|
- uploaderList: state => state.uploaderList,
|
|
|
- projectId: state => {
|
|
|
- if (!state.projectId) {
|
|
|
- let pid = storage.get(KEY_PROJECT_SELECTED)
|
|
|
- if (pid) {
|
|
|
- state.projectId = pid
|
|
|
+ getters: {
|
|
|
+ sidebarClosed: state => state.sidebarClosed,
|
|
|
+ secret: state => state.secret,
|
|
|
+ userId: state => state.userId,
|
|
|
+ sidebarSelected: state => {
|
|
|
+ // if (!state.pageSidebarSelected) {
|
|
|
+ // let menu = storage.get(KEY_MENU_SELECTED)
|
|
|
+ // if (menu) {
|
|
|
+ // state.pageSidebarSelected = menu
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // return state.pageSidebarSelected
|
|
|
+ return state.sidebarSelected
|
|
|
+ },
|
|
|
+ userInfo: state => state.userInfo,
|
|
|
+ permissions: state => state.permissions,
|
|
|
+ projects: state => state.projects,
|
|
|
+ uploaderList: state => state.uploaderList,
|
|
|
+ projectId: state => {
|
|
|
+ if (!state.projectId) {
|
|
|
+ let pid = storage.get(KEY_PROJECT_SELECTED)
|
|
|
+ if (pid) {
|
|
|
+ state.projectId = pid
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- return state.projectId
|
|
|
- },
|
|
|
- breadcrumb: state => {
|
|
|
- if (!state.breadcrumb) {
|
|
|
- let arr = storage.get(KEY_PAGE_BRANDCRUMB)
|
|
|
- if (arr) {
|
|
|
- state.breadcrumb = arr
|
|
|
+ return state.projectId
|
|
|
+ },
|
|
|
+ breadcrumb: state => {
|
|
|
+ if (!state.breadcrumb) {
|
|
|
+ let arr = storage.get(KEY_PAGE_BRANDCRUMB)
|
|
|
+ if (arr) {
|
|
|
+ state.breadcrumb = arr
|
|
|
+ }
|
|
|
}
|
|
|
+ return state.breadcrumb
|
|
|
}
|
|
|
- return state.breadcrumb
|
|
|
- }
|
|
|
- },
|
|
|
- mutations: {
|
|
|
- setRowEdit: (state, val) => (state.rowEdit = val),
|
|
|
- setErrorReport: (state, val) => (state.errorReport = val),
|
|
|
- setSidebarClosed: (state, val) => (state.sidebarClosed = val),
|
|
|
- setSidebarSelected: (state, val) => {
|
|
|
- state.sidebarSelected = val
|
|
|
- storage.set(KEY_MENU_SELECTED, val)
|
|
|
- lStorage.set('screen_data', {path: val, data: {}})
|
|
|
},
|
|
|
- setprojectId: (state, val) => {
|
|
|
- lStorage.remove('cacheInfo') //待删除(删除用户浏览器无用缓存)
|
|
|
- let cacheInfo = lStorage.get('historyInfo') ? lStorage.get('historyInfo') : {}
|
|
|
- state.projectId = val
|
|
|
- localStorage.setItem('projectId', val)
|
|
|
- if (cacheInfo[state.userInfo.userName]) {
|
|
|
- // cacheInfo[state.userInfo.userName].projectId = val
|
|
|
- cacheInfo[state.userInfo.userName] = [...new Set([val, ...cacheInfo[state.userInfo.userName]])].slice(0, 3)
|
|
|
- lStorage.set('historyInfo', cacheInfo)
|
|
|
- } else {
|
|
|
- cacheInfo[state.userInfo.userName] = [val]
|
|
|
- lStorage.set('historyInfo', cacheInfo)
|
|
|
- }
|
|
|
- storage.set(KEY_PROJECT_SELECTED, val)
|
|
|
- state.projects.map((item) => {
|
|
|
- if (item.id == val) {
|
|
|
- state.secret = item.pwd
|
|
|
- localStorage.setItem('secret', item.pwd)
|
|
|
+ mutations: {
|
|
|
+ setRowEdit: (state, val) => (state.rowEdit = val),
|
|
|
+ setErrorReport:(state,val) => (state.errorReport = val),
|
|
|
+ setSidebarClosed: (state, val) => (state.sidebarClosed = val),
|
|
|
+ setSidebarSelected: (state, val) => {
|
|
|
+ state.sidebarSelected = val
|
|
|
+ storage.set(KEY_MENU_SELECTED, val)
|
|
|
+ lStorage.set('screen_data', {path: val, data: {}})
|
|
|
+ },
|
|
|
+ setprojectId: (state, val) => {
|
|
|
+ lStorage.remove('cacheInfo') //待删除(删除用户浏览器无用缓存)
|
|
|
+ let cacheInfo = lStorage.get('historyInfo') ? lStorage.get('historyInfo') : {}
|
|
|
+ state.projectId = val
|
|
|
+ localStorage.setItem('projectId', val)
|
|
|
+ if (cacheInfo[state.userInfo.userName]) {
|
|
|
+ // cacheInfo[state.userInfo.userName].projectId = val
|
|
|
+ cacheInfo[state.userInfo.userName] = [...new Set([val, ...cacheInfo[state.userInfo.userName]])].slice(0,3)
|
|
|
+ lStorage.set('historyInfo', cacheInfo)
|
|
|
+ } else {
|
|
|
+ cacheInfo[state.userInfo.userName] = [val]
|
|
|
+ lStorage.set('historyInfo', cacheInfo)
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
- setUploaderList: (state, val) => {
|
|
|
- state.uploaderList = val ? val : []
|
|
|
- },
|
|
|
+ storage.set(KEY_PROJECT_SELECTED, val)
|
|
|
+ state.projects.map((item) => {
|
|
|
+ if (item.id == val) {
|
|
|
+ state.secret = item.pwd
|
|
|
+ localStorage.setItem('secret', item.pwd)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setUploaderList: (state, val) => {
|
|
|
+ state.uploaderList = val ? val : []
|
|
|
+ },
|
|
|
|
|
|
- },
|
|
|
+ },
|
|
|
actions: {
|
|
|
setRowEdit(contentx, value) {
|
|
|
contentx.commit('setRowEdit', value)
|
|
|
},
|
|
|
- setErrorReport(contentx, value) {
|
|
|
- contentx.commit('setErrorReport', value)
|
|
|
+ setErrorReport(contentx,value) {
|
|
|
+ contentx.commit('setErrorReport',value)
|
|
|
},
|
|
|
loadUserInfo({state}) {
|
|
|
console.log(state)
|
|
|
- // 获取 userInfo 信息
|
|
|
return new Promise((resolve, reject) => {
|
|
|
frameworkApi.loadUserInfo().then(resp => {
|
|
|
console.log(resp)
|