remove all semicolons
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import store from '@/store'
|
||||
|
||||
function authPermission(permission) {
|
||||
const all_permission = "*:*:*";
|
||||
const all_permission = "*:*:*"
|
||||
const permissions = store.getters && store.getters.permissions
|
||||
if (permission && permission.length > 0) {
|
||||
return permissions.some(v => {
|
||||
@ -13,7 +13,7 @@ function authPermission(permission) {
|
||||
}
|
||||
|
||||
function authRole(role) {
|
||||
const super_admin = "admin";
|
||||
const super_admin = "admin"
|
||||
const roles = store.getters && store.getters.roles
|
||||
if (role && role.length > 0) {
|
||||
return roles.some(v => {
|
||||
@ -27,7 +27,7 @@ function authRole(role) {
|
||||
export default {
|
||||
// 验证用户是否具备某权限
|
||||
hasPermi(permission) {
|
||||
return authPermission(permission);
|
||||
return authPermission(permission)
|
||||
},
|
||||
// 验证用户是否含有指定权限,只需包含其中一个
|
||||
hasPermiOr(permissions) {
|
||||
@ -43,7 +43,7 @@ export default {
|
||||
},
|
||||
// 验证用户是否具备某角色
|
||||
hasRole(role) {
|
||||
return authRole(role);
|
||||
return authRole(role)
|
||||
},
|
||||
// 验证用户是否含有指定角色,只需包含其中一个
|
||||
hasRoleOr(roles) {
|
||||
|
@ -29,7 +29,7 @@ const sessionCache = {
|
||||
return null
|
||||
},
|
||||
remove (key) {
|
||||
sessionStorage.removeItem(key);
|
||||
sessionStorage.removeItem(key)
|
||||
}
|
||||
}
|
||||
const localCache = {
|
||||
@ -63,7 +63,7 @@ const localCache = {
|
||||
return null
|
||||
},
|
||||
remove (key) {
|
||||
localStorage.removeItem(key);
|
||||
localStorage.removeItem(key)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,10 @@ import {Loading, Message} from 'element-ui'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import errorCode from '@/utils/errorCode'
|
||||
import { blobValidate } from "@/utils/ruoyi";
|
||||
import { blobValidate } from "@/utils/ruoyi"
|
||||
|
||||
const baseURL = process.env.VUE_APP_BASE_API
|
||||
let downloadLoadingInstance;
|
||||
let downloadLoadingInstance
|
||||
|
||||
export default {
|
||||
name(name, isDelete = true) {
|
||||
@ -17,29 +17,29 @@ export default {
|
||||
responseType: 'blob',
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||
}).then((res) => {
|
||||
const isBlob = blobValidate(res.data);
|
||||
const isBlob = blobValidate(res.data)
|
||||
if (isBlob) {
|
||||
const blob = new Blob([res.data])
|
||||
this.saveAs(blob, decodeURIComponent(res.headers['download-filename']))
|
||||
} else {
|
||||
this.printErrMsg(res.data);
|
||||
this.printErrMsg(res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
resource(resource) {
|
||||
var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource);
|
||||
var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource)
|
||||
axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||
}).then((res) => {
|
||||
const isBlob = blobValidate(res.data);
|
||||
const isBlob = blobValidate(res.data)
|
||||
if (isBlob) {
|
||||
const blob = new Blob([res.data])
|
||||
this.saveAs(blob, decodeURIComponent(res.headers['download-filename']))
|
||||
} else {
|
||||
this.printErrMsg(res.data);
|
||||
this.printErrMsg(res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -52,28 +52,28 @@ export default {
|
||||
responseType: 'blob',
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||
}).then((res) => {
|
||||
const isBlob = blobValidate(res.data);
|
||||
const isBlob = blobValidate(res.data)
|
||||
if (isBlob) {
|
||||
const blob = new Blob([res.data], { type: 'application/zip' })
|
||||
this.saveAs(blob, name)
|
||||
} else {
|
||||
this.printErrMsg(res.data);
|
||||
this.printErrMsg(res.data)
|
||||
}
|
||||
downloadLoadingInstance.close();
|
||||
downloadLoadingInstance.close()
|
||||
}).catch((r) => {
|
||||
console.error(r)
|
||||
Message.error('下载文件出现错误,请联系管理员!')
|
||||
downloadLoadingInstance.close();
|
||||
downloadLoadingInstance.close()
|
||||
})
|
||||
},
|
||||
saveAs(text, name, opts) {
|
||||
saveAs(text, name, opts);
|
||||
saveAs(text, name, opts)
|
||||
},
|
||||
async printErrMsg(data) {
|
||||
const resText = await data.text();
|
||||
const rspObj = JSON.parse(resText);
|
||||
const resText = await data.text()
|
||||
const rspObj = JSON.parse(resText)
|
||||
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||
Message.error(errMsg);
|
||||
Message.error(errMsg)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Message, MessageBox, Notification, Loading } from 'element-ui'
|
||||
|
||||
let loadingInstance;
|
||||
let loadingInstance
|
||||
|
||||
export default {
|
||||
// 消息提示
|
||||
@ -41,7 +41,7 @@ export default {
|
||||
},
|
||||
// 错误通知
|
||||
notifyError(content) {
|
||||
Notification.error(content);
|
||||
Notification.error(content)
|
||||
},
|
||||
// 成功通知
|
||||
notifySuccess(content) {
|
||||
@ -78,6 +78,6 @@ export default {
|
||||
},
|
||||
// 关闭遮罩层
|
||||
closeLoading() {
|
||||
loadingInstance.close();
|
||||
loadingInstance.close()
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
import store from '@/store'
|
||||
import router from '@/router';
|
||||
import router from '@/router'
|
||||
|
||||
export default {
|
||||
// 刷新当前tab页签
|
||||
refreshPage(obj) {
|
||||
const { path, query, matched } = router.currentRoute;
|
||||
const { path, query, matched } = router.currentRoute
|
||||
if (obj === undefined) {
|
||||
matched.forEach((m) => {
|
||||
if (m.components && m.components.default && m.components.default.name) {
|
||||
if (!['Layout', 'ParentView'].includes(m.components.default.name)) {
|
||||
obj = { name: m.components.default.name, path: path, query: query };
|
||||
obj = { name: m.components.default.name, path: path, query: query }
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
return store.dispatch('tagsView/delCachedView', obj).then(() => {
|
||||
const { path, query } = obj
|
||||
@ -24,9 +24,9 @@ export default {
|
||||
},
|
||||
// 关闭当前tab页签,打开新页签
|
||||
closeOpenPage(obj) {
|
||||
store.dispatch("tagsView/delView", router.currentRoute);
|
||||
store.dispatch("tagsView/delView", router.currentRoute)
|
||||
if (obj !== undefined) {
|
||||
return router.push(obj);
|
||||
return router.push(obj)
|
||||
}
|
||||
},
|
||||
// 关闭指定tab页签
|
||||
@ -37,35 +37,35 @@ export default {
|
||||
if (latestView) {
|
||||
return router.push(latestView.fullPath)
|
||||
}
|
||||
return router.push('/');
|
||||
});
|
||||
return router.push('/')
|
||||
})
|
||||
}
|
||||
return store.dispatch('tagsView/delView', obj);
|
||||
return store.dispatch('tagsView/delView', obj)
|
||||
},
|
||||
// 关闭所有tab页签
|
||||
closeAllPage() {
|
||||
return store.dispatch('tagsView/delAllViews');
|
||||
return store.dispatch('tagsView/delAllViews')
|
||||
},
|
||||
// 关闭左侧tab页签
|
||||
closeLeftPage(obj) {
|
||||
return store.dispatch('tagsView/delLeftTags', obj || router.currentRoute);
|
||||
return store.dispatch('tagsView/delLeftTags', obj || router.currentRoute)
|
||||
},
|
||||
// 关闭右侧tab页签
|
||||
closeRightPage(obj) {
|
||||
return store.dispatch('tagsView/delRightTags', obj || router.currentRoute);
|
||||
return store.dispatch('tagsView/delRightTags', obj || router.currentRoute)
|
||||
},
|
||||
// 关闭其他tab页签
|
||||
closeOtherPage(obj) {
|
||||
return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute);
|
||||
return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute)
|
||||
},
|
||||
// 添加tab页签
|
||||
openPage(title, url, params) {
|
||||
const obj = { path: url, meta: { title: title } }
|
||||
store.dispatch('tagsView/addView', obj);
|
||||
return router.push({ path: url, query: params });
|
||||
store.dispatch('tagsView/addView', obj)
|
||||
return router.push({ path: url, query: params })
|
||||
},
|
||||
// 修改tab页签
|
||||
updatePage(obj) {
|
||||
return store.dispatch('tagsView/updateVisitedView', obj);
|
||||
return store.dispatch('tagsView/updateVisitedView', obj)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user