|
|
|
@ -1,13 +1,14 @@ |
|
|
|
import { createStore as create } from 'vuex'; |
|
|
|
import { createStore as create } from "vuex"; |
|
|
|
import { Styles, Size } from '../config'; |
|
|
|
import { Styles, Size } from "../config"; |
|
|
|
import { getByCodes, getMenus, logout, getActions } from '../api/public'; |
|
|
|
import { getByCodes, getMenus, logout, getActions } from "../api/public"; |
|
|
|
import { mapping } from '../api/role'; |
|
|
|
import { mapping } from "../api/role"; |
|
|
|
|
|
|
|
import { clearAndAssign } from "noob-mengyxu/utils"; |
|
|
|
|
|
|
|
|
|
|
|
export class State { |
|
|
|
export class State { |
|
|
|
dict = { |
|
|
|
dict = { |
|
|
|
active_status: { |
|
|
|
active_status: { |
|
|
|
A: '启用', |
|
|
|
A: "启用", |
|
|
|
B: '禁用', |
|
|
|
B: "禁用", |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
roles = {}; |
|
|
|
roles = {}; |
|
|
|
@ -43,7 +44,7 @@ export class Actions { |
|
|
|
dict[item.code] = item.name; |
|
|
|
dict[item.code] = item.name; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
commit('updateDict', [key, dict]); |
|
|
|
commit("updateDict", [key, dict]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -51,29 +52,30 @@ export class Actions { |
|
|
|
getRoleMap = ({ state, commit }) => { |
|
|
|
getRoleMap = ({ state, commit }) => { |
|
|
|
state.roleRefresh && |
|
|
|
state.roleRefresh && |
|
|
|
mapping().then((rsp) => { |
|
|
|
mapping().then((rsp) => { |
|
|
|
commit('updateState', ['roles', rsp]); |
|
|
|
commit("updateState", ["roles", rsp]); |
|
|
|
commit('updateState', ['roleRefresh', false]); |
|
|
|
commit("updateState", ["roleRefresh", false]); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
getMenus = ({ state, commit }) => { |
|
|
|
getMenus = ({ state, commit }) => { |
|
|
|
getMenus().then((rsp) => commit('updateState', ['menus', rsp])); |
|
|
|
getMenus().then((rsp) => commit("updateState", ["menus", rsp])); |
|
|
|
}; |
|
|
|
}; |
|
|
|
getMyActions = ({ state, commit }, content) => { |
|
|
|
getMyActions = ({ state, commit }, content) => { |
|
|
|
getActions(content).then((rsp) => commit('updateState', ['actions', rsp])); |
|
|
|
getActions(content).then((rsp) => commit("updateState", ["actions", rsp])); |
|
|
|
}; |
|
|
|
}; |
|
|
|
login = (store) => { |
|
|
|
login = (store) => { |
|
|
|
const { state, commit } = store; |
|
|
|
const { state, commit } = store; |
|
|
|
state.size.headHeight = state.size.head + 'px'; |
|
|
|
state.size.headHeight = state.size.head + "px"; |
|
|
|
state.size.asideWidth = state.size.aside + 'px'; |
|
|
|
state.size.asideWidth = state.size.aside + "px"; |
|
|
|
commit('initSize'); |
|
|
|
commit("initSize"); |
|
|
|
this.getMenus(store); |
|
|
|
this.getMenus(store); |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export class Mutations { |
|
|
|
export class Mutations { |
|
|
|
updateState = (state, param) => { |
|
|
|
updateState = (state, [k, v]) => { |
|
|
|
state[param[0]] = param[1]; |
|
|
|
state[k] = v; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
initSize = (state, param) => { |
|
|
|
initSize = (state, param) => { |
|
|
|
const size = state.size; |
|
|
|
const size = state.size; |
|
|
|
const aside = parseInt(size.asideWidth); |
|
|
|
const aside = parseInt(size.asideWidth); |
|
|
|
@ -86,11 +88,11 @@ export class Mutations { |
|
|
|
size.height = param[0]; |
|
|
|
size.height = param[0]; |
|
|
|
size.width = param[1]; |
|
|
|
size.width = param[1]; |
|
|
|
} |
|
|
|
} |
|
|
|
size.mainHeight = Math.floor(size.height - head) + 'px'; |
|
|
|
size.mainHeight = Math.floor(size.height - head) + "px"; |
|
|
|
size.tableHeight = size.height - 2 * (mainPad + searchRowPad) - 3 - searchRow - head; |
|
|
|
size.tableHeight = size.height - 2 * (mainPad + searchRowPad) - 3 - searchRow - head; |
|
|
|
size.pTableHeight = size.tableHeight - size.pageHeight; |
|
|
|
size.pTableHeight = size.tableHeight - size.pageHeight; |
|
|
|
|
|
|
|
|
|
|
|
size.headLeftWidth = size.width - aside - headRightWidth - 20 + 'px'; |
|
|
|
size.headLeftWidth = size.width - aside - headRightWidth - 20 + "px"; |
|
|
|
}; |
|
|
|
}; |
|
|
|
updateDict = (state, param) => { |
|
|
|
updateDict = (state, param) => { |
|
|
|
state.dict[param[0]] = param[1]; |
|
|
|
state.dict[param[0]] = param[1]; |
|
|
|
|