优化代码

This commit is contained in:
RuoYi 2023-11-30 09:37:36 +08:00
parent 42bb8f6445
commit 966a17123f
10 changed files with 76 additions and 84 deletions

View File

@ -1 +0,0 @@
如果使用的是RuoYi-Vue3前端那么需要覆盖一下此目录的模板index.vue.vm、index-tree.vue.vm文件到上级vue目录。

View File

@ -168,7 +168,7 @@ export default {
// //
handleDelete(file) { handleDelete(file) {
const findex = this.fileList.map(f => f.name).indexOf(file.name); const findex = this.fileList.map(f => f.name).indexOf(file.name);
if(findex > -1) { if (findex > -1) {
this.fileList.splice(findex, 1); this.fileList.splice(findex, 1);
this.$emit("input", this.listToString(this.fileList)); this.$emit("input", this.listToString(this.fileList));
} }

View File

@ -1,7 +1,7 @@
/** /**
* v-dialogDragWidth 可拖动弹窗高度右下角 * v-dialogDragWidth 可拖动弹窗高度右下角
* Copyright (c) 2019 ruoyi * Copyright (c) 2019 ruoyi
*/ */
export default { export default {
bind(el) { bind(el) {

View File

@ -1,7 +1,7 @@
/** /**
* v-dialogDragWidth 可拖动弹窗宽度右侧边 * v-dialogDragWidth 可拖动弹窗宽度右侧边
* Copyright (c) 2019 ruoyi * Copyright (c) 2019 ruoyi
*/ */
export default { export default {
bind(el) { bind(el) {

View File

@ -13,8 +13,8 @@
<item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" /> <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
</template> </template>
<sidebar-item <sidebar-item
v-for="child in item.children" v-for="(child, index) in item.children"
:key="child.path" :key="child.path + index"
:is-nest="true" :is-nest="true"
:item="child" :item="child"
:base-path="resolvePath(child.path)" :base-path="resolvePath(child.path)"

View File

@ -60,7 +60,7 @@ export default {
}, },
// 添加tab页签 // 添加tab页签
openPage(title, url, params) { openPage(title, url, params) {
var obj = { path: url, meta: { title: title } } const obj = { path: url, meta: { title: title } }
store.dispatch('tagsView/addView', obj); store.dispatch('tagsView/addView', obj);
return router.push({ path: url, query: params }); return router.push({ path: url, query: params });
}, },

View File

@ -15,10 +15,8 @@ export function checkPermi(value) {
return all_permission === permission || permissionDatas.includes(permission) return all_permission === permission || permissionDatas.includes(permission)
}) })
if (!hasPermission) { return hasPermission;
return false
}
return true
} else { } else {
console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`) console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`)
return false return false
@ -40,10 +38,8 @@ export function checkRole(value) {
return super_admin === role || permissionRoles.includes(role) return super_admin === role || permissionRoles.includes(role)
}) })
if (!hasRole) { return hasRole;
return false
}
return true
} else { } else {
console.error(`need roles! Like checkRole="['admin','editor']"`) console.error(`need roles! Like checkRole="['admin','editor']"`)
return false return false

View File

@ -65,10 +65,7 @@ export function validEmail(email) {
* @returns {Boolean} * @returns {Boolean}
*/ */
export function isString(str) { export function isString(str) {
if (typeof str === 'string' || str instanceof String) { return typeof str === 'string' || str instanceof String;
return true
}
return false
} }
/** /**