| | |
| | | items.forEach(item => { |
| | | item.pathValue = item.path; |
| | | item.path = '/' + item.code; |
| | | item.query = {}; // 初始化 item.query |
| | | item.query = queryStringToObject(item.pathValue) |
| | | console.log('item', item); |
| | | if (item.children && item.children.length > 0) { |
| | | updateCode(item.children); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function queryStringToObject(queryString) { |
| | | const index = queryString.indexOf('?'); |
| | | if (index !== -1) { |
| | | queryString = queryString.substring(index + 1); |
| | | } |
| | | const params = new URLSearchParams(queryString); |
| | | const obj = {}; |
| | | for (const [key, value] of params.entries()) { |
| | | obj[key] = value; |
| | | } |
| | | return obj; |
| | | } |
| | | |
| | | |
| | | const user = { |
| | |
| | | //根据用户名登录 |
| | | LoginByUsername({commit}, userInfo) { |
| | | return new Promise((resolve, reject) => { |
| | | loginByUsername(userInfo.tenantId, userInfo.deptId, userInfo.roleId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key, ).then(res => { |
| | | loginByUsername(userInfo.tenantId, userInfo.deptId, userInfo.roleId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key,).then(res => { |
| | | const data = res.data; |
| | | if(data.success){ |
| | | if (data.success) { |
| | | debugger; |
| | | commit('SET_TOKEN', data.obj.sessionInfo.token); |
| | | commit('SET_REFRESH_TOKEN', data.obj.sessionInfo.token); |
| | |
| | | commit('SET_USER_INFO', data.obj.sessionInfo); |
| | | commit('DEL_ALL_TAG'); |
| | | commit('CLEAR_LOCK'); |
| | | }else { |
| | | } else { |
| | | Message({ |
| | | message: data.msg, |
| | | type: 'error' |
| | |
| | | //根据第三方信息登录 |
| | | LoginBySocial({commit}, userInfo) { |
| | | return new Promise((resolve) => { |
| | | loginBySocial(userInfo.tenantId, userInfo.source, userInfo.state).then(res => { |
| | | loginBySocial(userInfo.tenantId, userInfo.source, userInfo.state).then(res => { |
| | | const data = res.data; |
| | | if (data.error_description) { |
| | | Message({ |
| | |
| | | GetMenu({commit, dispatch}, topMenuId) { |
| | | return new Promise(resolve => { |
| | | getRoutes('modelManagmentNode').then((res) => { |
| | | const list =[ |
| | | { |
| | | "action": null, |
| | | "actionName": null, |
| | | "alias": "资源库", |
| | | "category": null, |
| | | "categoryName": null, |
| | | "children": [ |
| | | { |
| | | "action": null, |
| | | "actionName": null, |
| | | "alias": "知识库", |
| | | "category": null, |
| | | "categoryName": null, |
| | | "children": [ |
| | | { |
| | | "action": null, |
| | | "actionName": null, |
| | | "alias": "resourcelib", |
| | | "category": null, |
| | | "categoryName": null, |
| | | "children": [], |
| | | "code": "resourcelib", |
| | | "hasChildren": false, |
| | | "id": "2C5FABD2-535F-8568-8E61-C643BA7D77A1", |
| | | "isOpen": null, |
| | | "isOpenName": null, |
| | | "meta": { |
| | | "keepAlive": false |
| | | }, |
| | | "name": "设备资源库", |
| | | "parentId": "9B00AD2C-A407-7F71-B35C-58E466E53A33", |
| | | "parentName": null, |
| | | "path": "bs=test?image=resource&type=folder&context=resourcemanager&querytype=0&querytemplate=resourcelibroot", |
| | | "remark": null, |
| | | "sort": 1, |
| | | "source": "" |
| | | }, |
| | | { |
| | | "action": null, |
| | | "actionName": null, |
| | | "alias": "工艺知识库", |
| | | "category": null, |
| | | "categoryName": null, |
| | | "children": [], |
| | | "code": "gongyi", |
| | | "hasChildren": false, |
| | | "id": "AC04E222-F14B-F4FF-11BB-DFE8917A2756", |
| | | "isOpen": null, |
| | | "isOpenName": null, |
| | | "meta": { |
| | | "keepAlive": false |
| | | }, |
| | | "name": "工艺知识库", |
| | | "parentId": "9B00AD2C-A407-7F71-B35C-58E466E53A33", |
| | | "parentName": null, |
| | | "path": "bs=UI?image=report&type=folder&context=knowledgemanager&querytype=0&querytemplate=knowledgelibroot", |
| | | "remark": null, |
| | | "sort": 2, |
| | | "source": "" |
| | | } |
| | | ], |
| | | "code": "zhishiku", |
| | | "hasChildren": true, |
| | | "id": "9B00AD2C-A407-7F71-B35C-58E466E53A33", |
| | | "isOpen": null, |
| | | "isOpenName": null, |
| | | "meta": { |
| | | "keepAlive": false |
| | | }, |
| | | "name": "知识库", |
| | | "parentId": "4EDC91B8-E3B2-D126-E75C-D2CEC59F53CE", |
| | | "parentName": null, |
| | | "path": "bs=/base", |
| | | "remark": null, |
| | | "sort": 1, |
| | | "source": "" |
| | | }, |
| | | { |
| | | "action": null, |
| | | "actionName": null, |
| | | "alias": "TemplateLib", |
| | | "category": null, |
| | | "categoryName": null, |
| | | "children": [ |
| | | { |
| | | "action": null, |
| | | "actionName": null, |
| | | "alias": "CardTemplateLib", |
| | | "category": null, |
| | | "categoryName": null, |
| | | "children": [], |
| | | "code": "CardTemplateLib", |
| | | "hasChildren": false, |
| | | "id": "E6E963E7-2DF6-80EE-2A61-FA86E0F3D5F2", |
| | | "isOpen": null, |
| | | "isOpenName": null, |
| | | "meta": { |
| | | "keepAlive": false |
| | | }, |
| | | "name": "卡片模板", |
| | | "parentId": "8493A92A-13DA-8800-140D-9C0C4A722665", |
| | | "parentName": null, |
| | | "path": "bs=?image=card&type=folder&context=cardtemplatemanager&querytype=0&querytemplate=cardtemplateroot", |
| | | "remark": null, |
| | | "sort": 1, |
| | | "source": "" |
| | | } |
| | | ], |
| | | "code": "TemplateLib", |
| | | "hasChildren": true, |
| | | "id": "8493A92A-13DA-8800-140D-9C0C4A722665", |
| | | "isOpen": null, |
| | | "isOpenName": null, |
| | | "meta": { |
| | | "keepAlive": false |
| | | }, |
| | | "name": "模板库", |
| | | "parentId": "4EDC91B8-E3B2-D126-E75C-D2CEC59F53CE", |
| | | "parentName": null, |
| | | "path": "bs=mb", |
| | | "remark": null, |
| | | "sort": 2, |
| | | "source": "" |
| | | }, |
| | | { |
| | | "action": null, |
| | | "actionName": null, |
| | | "alias": "典型数据库", |
| | | "category": null, |
| | | "categoryName": null, |
| | | "children": [ |
| | | { |
| | | "action": null, |
| | | "actionName": null, |
| | | "alias": "典型规程", |
| | | "category": null, |
| | | "categoryName": null, |
| | | "children": [], |
| | | "code": "guicheng", |
| | | "hasChildren": false, |
| | | "id": "B3EC1413-1A33-61E3-DDD1-CB4D0CFD0C6E", |
| | | "isOpen": null, |
| | | "isOpenName": null, |
| | | "meta": { |
| | | "keepAlive": false |
| | | }, |
| | | "name": "典型规程", |
| | | "parentId": "BDBD6CFA-2F4C-EEF7-C380-5E9BBF6A37B3", |
| | | "parentName": null, |
| | | "path": "bs=test?image=typical&type=workorder&context=TypicalProcessLib", |
| | | "remark": null, |
| | | "sort": 1, |
| | | "source": "" |
| | | } |
| | | ], |
| | | "code": "dianxing", |
| | | "hasChildren": true, |
| | | "id": "BDBD6CFA-2F4C-EEF7-C380-5E9BBF6A37B3", |
| | | "isOpen": null, |
| | | "isOpenName": null, |
| | | "meta": { |
| | | "keepAlive": false |
| | | }, |
| | | "name": "典型数据库", |
| | | "parentId": "4EDC91B8-E3B2-D126-E75C-D2CEC59F53CE", |
| | | "parentName": null, |
| | | "path": "bs=dx", |
| | | "remark": null, |
| | | "sort": 3, |
| | | "source": "" |
| | | } |
| | | ], |
| | | "code": "ziyuanku", |
| | | "hasChildren": true, |
| | | "id": "4EDC91B8-E3B2-D126-E75C-D2CEC59F53CE", |
| | | "isOpen": null, |
| | | "isOpenName": null, |
| | | "meta": { |
| | | "keepAlive": false |
| | | }, |
| | | "name": "资源库", |
| | | "parentId": "modelManagmentNode", |
| | | "parentName": null, |
| | | "path": "bs=zy", |
| | | "remark": null, |
| | | "sort": 913, |
| | | "source": "" |
| | | } |
| | | ]; |
| | | const data = res.data.obj; |
| | | let menu = deepClone(list); |
| | | let menu = deepClone(data); |
| | | menu.forEach(ele => { |
| | | addPath(ele, true); |
| | | updateCode([ele]); |
| | |
| | | } |
| | | }) |
| | | state.menuAll = menu |
| | | setStore({ name: 'menuAll', content: state.menuAll }) |
| | | setStore({name: 'menuAll', content: state.menuAll}) |
| | | }, |
| | | SET_MENU_ALL_NULL: (state) => { |
| | | state.menuAll = [] |
| | | setStore({ name: 'menuAll', content: state.menuAll }) |
| | | setStore({name: 'menuAll', content: state.menuAll}) |
| | | }, |
| | | SET_MENU: (state, menu) => { |
| | | state.menu = menu |
| | | setStore({ name: 'menu', content: state.menu }) |
| | | setStore({name: 'menu', content: state.menu}) |
| | | }, |
| | | SET_REFRESH_TOKEN: (state, refreshToken) => { |
| | | setRefreshToken(refreshToken) |