diff --git a/client/package.json b/client/package.json index c26bf00..f48ca35 100644 --- a/client/package.json +++ b/client/package.json @@ -15,6 +15,7 @@ "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" }, "dependencies": { + "@riophae/vue-treeselect": "^0.4.0", "axios": "0.18.1", "element-ui": "2.13.0", "file-saver": "^2.0.2", diff --git a/client/src/api/dict.js b/client/src/api/dict.js index df66187..d46429f 100644 --- a/client/src/api/dict.js +++ b/client/src/api/dict.js @@ -4,7 +4,7 @@ export function getDictTypeList(query) { return request({ url: '/system/dicttype/', method: 'get', - params:query + params: query }) } export function createDictType(data) { @@ -32,7 +32,7 @@ export function getDictList(query) { return request({ url: '/system/dict/', method: 'get', - params:query + params: query }) } export function createDict(data) { @@ -54,4 +54,4 @@ export function deleteDict(id) { url: `/system/dict/${id}/`, method: 'delete' }) -} \ No newline at end of file +} diff --git a/client/src/api/file.js b/client/src/api/file.js index e380b10..dd9e644 100644 --- a/client/src/api/file.js +++ b/client/src/api/file.js @@ -1,3 +1,3 @@ -export function uploadUrl(){ - return process.env.VUE_APP_BASE_API + '/upload/' -} \ No newline at end of file +export function uploadUrl() { + return process.env.VUE_APP_BASE_API + '/upload/' +} diff --git a/client/src/api/org.js b/client/src/api/org.js index a931a3f..2880ec4 100644 --- a/client/src/api/org.js +++ b/client/src/api/org.js @@ -10,7 +10,7 @@ export function getOrgList(query) { return request({ url: '/system/organization/', method: 'get', - params:query + params: query }) } export function createOrg(data) { @@ -32,4 +32,4 @@ export function deleteOrg(id) { url: `/system/organization/${id}/`, method: 'delete' }) -} \ No newline at end of file +} diff --git a/client/src/api/position.js b/client/src/api/position.js index 92b5548..2ea116f 100644 --- a/client/src/api/position.js +++ b/client/src/api/position.js @@ -1,6 +1,5 @@ import request from '@/utils/request' - export function getPositionAll() { return request({ url: '/system/position/', diff --git a/client/src/api/user.js b/client/src/api/user.js index 2352e0d..2712ba4 100644 --- a/client/src/api/user.js +++ b/client/src/api/user.js @@ -15,7 +15,6 @@ export function logout() { }) } - export function getInfo() { return request({ url: '/system/user/info/', @@ -23,8 +22,6 @@ export function getInfo() { }) } - - export function getUserList(query) { return request({ url: '/system/user/', diff --git a/client/src/main.js b/client/src/main.js index 1f6594b..c404257 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -14,7 +14,6 @@ import router from './router' import '@/icons' // icon import '@/permission' // permission control - /** * If you don't want to use mock-server * you want to use MockJs for mock api @@ -31,7 +30,7 @@ if (process.env.NODE_ENV === 'production') { // set ElementUI lang to EN // Vue.use(ElementUI, { locale }) // 如果想要中文版 element-ui,按如下方式声明 -Vue.use(ElementUI, { size: 'medium' }); +Vue.use(ElementUI, { size: 'medium' }) Vue.config.productionTip = false diff --git a/client/src/store/modules/user.js b/client/src/store/modules/user.js index 3dba2c2..d75d478 100644 --- a/client/src/store/modules/user.js +++ b/client/src/store/modules/user.js @@ -41,7 +41,6 @@ const actions = { commit('SET_TOKEN', data.access) setToken(data.access) resolve() - }).catch(error => { reject(error) }) @@ -64,7 +63,7 @@ const actions = { if (!perms || perms.length <= 0) { reject('没有任何权限!') } - + commit('SET_PERMS', perms) commit('SET_NAME', name) commit('SET_AVATAR', avatar) diff --git a/client/src/utils/auth.js b/client/src/utils/auth.js index 4a1c963..392db62 100644 --- a/client/src/utils/auth.js +++ b/client/src/utils/auth.js @@ -22,4 +22,4 @@ export function removeToken() { // method: 'post', // data // }) -// } \ No newline at end of file +// } diff --git a/client/src/utils/index.js b/client/src/utils/index.js index 5b55a3e..cfdf23c 100644 --- a/client/src/utils/index.js +++ b/client/src/utils/index.js @@ -244,7 +244,7 @@ export function getTime(type) { export function debounce(func, wait, immediate) { let timeout, args, context, timestamp, result - const later = function () { + const later = function() { // 据上一次触发时间间隔 const last = +new Date() - timestamp @@ -261,7 +261,7 @@ export function debounce(func, wait, immediate) { } } - return function (...args) { + return function(...args) { context = this timestamp = +new Date() const callNow = immediate && !timeout @@ -346,37 +346,36 @@ export function removeClass(ele, cls) { } } - export function genTree(data) { - let result = [] + const result = [] if (!Array.isArray(data)) { return result } data.forEach(item => { - delete item.children; - }); - let map = {}; + delete item.children + }) + const map = {} data.forEach(item => { item.label = item.name item.value = item.id - map[item.id] = item; - }); + map[item.id] = item + }) data.forEach(item => { - let parent = map[item.pid]; + const parent = map[item.pid] if (parent) { - (parent.children || (parent.children = [])).push(item); + (parent.children || (parent.children = [])).push(item) } else { - result.push(item); + result.push(item) } - }); - return result; + }) + return result } const arrChange = arr => arr.map(item => { - const res = {}; - for (let key in item) { - let _key = key === 'name' ? 'label' : key; - res[_key] = Array.isArray(item[key]) ? arrChange(item[key]) : item[key]; + const res = {} + for (const key in item) { + const _key = key === 'name' ? 'label' : key + res[_key] = Array.isArray(item[key]) ? arrChange(item[key]) : item[key] } return res -}); \ No newline at end of file +}) diff --git a/client/src/utils/permission.js b/client/src/utils/permission.js index 20b6aea..217bdeb 100644 --- a/client/src/utils/permission.js +++ b/client/src/utils/permission.js @@ -9,7 +9,7 @@ export default function checkPermission(value) { if (value && value instanceof Array && value.length > 0) { const perms = store.getters && store.getters.perms const permissionperms = value - if(perms.includes('admin')){ + if (perms.includes('admin')) { return true } // 如果是超管,都可以操作 const hasPermission = perms.some(perm => { diff --git a/client/src/views/login/index.vue b/client/src/views/login/index.vue index 5be3575..2568652 100644 --- a/client/src/views/login/index.vue +++ b/client/src/views/login/index.vue @@ -78,8 +78,8 @@ export default { password: '' }, loginRules: { - username: [{ required: true, trigger: 'blur', message: "请输入账户" }], - password: [{ required: true, trigger: 'blur', validator: validatePassword, message: "请输入密码" }] + username: [{ required: true, trigger: 'blur', message: '请输入账户' }], + password: [{ required: true, trigger: 'blur', validator: validatePassword, message: '请输入密码' }] }, loading: false, passwordType: 'password', diff --git a/client/src/views/system/dict.vue b/client/src/views/system/dict.vue index 895934c..50d41e9 100644 --- a/client/src/views/system/dict.vue +++ b/client/src/views/system/dict.vue @@ -2,9 +2,12 @@
点击左侧类型查看字典