6/22完善引入,
This commit is contained in:
@@ -5,17 +5,7 @@
|
||||
<svg-icon :icon-class="item.menuIcon" />
|
||||
</div>
|
||||
<div class="quickly_item_content">{{ item.menuName }}</div>
|
||||
<!-- <div class="actionsbox">
|
||||
<div class="routeactions">
|
||||
<el-icon><Position /></el-icon>
|
||||
<span style="padding-left: 0.1rem">跳转</span>
|
||||
</div>
|
||||
<div class="deleteaction">
|
||||
<el-icon><Delete /></el-icon>
|
||||
<span style="padding-left: 0.1rem">删除</span>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="deleteaction" @click="delteRoute(item.id)">
|
||||
<div class="deleteaction" @click="delteRoute($event, item.id)">
|
||||
<el-icon class="icons"><Remove /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
@@ -27,14 +17,7 @@
|
||||
<!-- 添加快捷入口 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="repairProjectFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<!-- <el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入" />
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="图标" prop="icon">
|
||||
<el-input v-model="form.icon" placeholder="请输入" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="展示页面" prop="path">
|
||||
<!-- <el-input v-model="form.path" placeholder="请输入" /> -->
|
||||
<el-cascader
|
||||
@change="handleCascader"
|
||||
clearable
|
||||
@@ -59,6 +42,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { addQuicklyshortcut, delQuicklyshortcut, getQuicklyshortcut } from '@/api/workflow';
|
||||
import { usePermissionStore } from '@/store/modules/permission';
|
||||
import { Plus, Remove } from '@element-plus/icons-vue';
|
||||
|
||||
// ! 快捷入口
|
||||
const quickBox = ref<
|
||||
@@ -106,7 +90,7 @@ function addQuieckDialog() {
|
||||
dialog.visible = true;
|
||||
}
|
||||
function getquicklist() {
|
||||
getQuicklyshortcut().then((res) => {
|
||||
getQuicklyshortcut({}).then((res) => {
|
||||
quickBox.value = res.data;
|
||||
});
|
||||
}
|
||||
@@ -116,10 +100,13 @@ function handleroutestoshowlist(rotues) {
|
||||
if (!Array.isArray(rotues)) {
|
||||
return [];
|
||||
}
|
||||
const arr = rotues.map((ele) => _hanle(null, ele, 1)).filter((item) => item);
|
||||
quicklylist.value = arr;
|
||||
quicklylist.value = rotues.map((ele) => _handle(null, ele, 1)).filter((item) => item);
|
||||
}
|
||||
function _hanle(parentRoute, currentRoute, level) {
|
||||
function _handle(
|
||||
parentRoute: { name?: any; icon?: any; path: any; level?: any; children?: any[] },
|
||||
currentRoute: { hidden: any; path: string; meta: { title: any; icon: any }; children: any[] },
|
||||
level: number
|
||||
) {
|
||||
// 非页面路由
|
||||
if (currentRoute.hidden && level === 1) {
|
||||
return null;
|
||||
@@ -156,7 +143,7 @@ function _hanle(parentRoute, currentRoute, level) {
|
||||
}
|
||||
// 4. 递归处理子节点
|
||||
if (level < 2 && currentRoute.children && Array.isArray(currentRoute.children)) {
|
||||
obj.children = currentRoute.children.map((item) => _hanle(obj, item, level + 1)).filter((item) => item !== null); // 过滤掉 null 值
|
||||
obj.children = currentRoute.children.map((item) => _handle(obj, item, level + 1)).filter((item) => item !== null); // 过滤掉 null 值
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
@@ -184,7 +171,8 @@ function submitQuick() {
|
||||
getquicklist();
|
||||
});
|
||||
}
|
||||
function delteRoute(id: string) {
|
||||
function delteRoute(e: MouseEvent, id: string) {
|
||||
e.stopPropagation();
|
||||
delQuicklyshortcut(id).then(() => {
|
||||
getquicklist();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user