refactor: ♻️ 优化button图标使用方式

This commit is contained in:
ray
2024-11-12 22:32:46 +08:00
parent 78cafd9653
commit a5a6e21ae9
9 changed files with 204 additions and 631 deletions

View File

@@ -12,30 +12,16 @@
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">
<template #icon><Search /></template>
搜索
</el-button>
<el-button @click="handleResetQuery">
<template #icon><Refresh /></template>
重置
</el-button>
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
<el-button icon="refresh" @click="handleResetQuery">重置</el-button>
</el-form-item>
</el-form>
</div>
<el-card shadow="never">
<div class="mb-10px">
<el-button type="success" @click="handleOpenDialog()">
<template #icon><Plus /></template>
新增
</el-button>
<el-button
type="danger"
:disabled="ids.length === 0"
@click="handleDelete()"
>
<template #icon><Delete /></template>
<el-button type="success" icon="plus" @click="handleOpenDialog()">新增</el-button>
<el-button type="danger" :disabled="ids.length === 0" icon="delete" @click="handleDelete()">
删除
</el-button>
</div>
@@ -110,12 +96,7 @@
width="500px"
@close="handleCloseDialog"
>
<el-form
ref="roleFormRef"
:model="formData"
:rules="rules"
label-width="100px"
>
<el-form ref="roleFormRef" :model="formData" :rules="rules" label-width="100px">
<el-form-item label="角色名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入角色名称" />
</el-form-item>
@@ -165,12 +146,7 @@
size="500"
>
<div class="flex-x-between">
<el-input
v-model="permKeywords"
clearable
class="w-[150px]"
placeholder="菜单权限名称"
>
<el-input v-model="permKeywords" clearable class="w-[150px]" placeholder="菜单权限名称">
<template #prefix>
<Search />
</template>
@@ -195,9 +171,7 @@
<template #content>
如果只需勾选菜单权限不需要勾选子菜单或者按钮权限请关闭父子联动
</template>
<el-icon
class="ml-1 color-[--el-color-primary] inline-block cursor-pointer"
>
<el-icon class="ml-1 color-[--el-color-primary] inline-block cursor-pointer">
<QuestionFilled />
</el-icon>
</el-tooltip>
@@ -220,9 +194,7 @@
</el-tree>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="handleAssignPermSubmit">
</el-button>
<el-button type="primary" @click="handleAssignPermSubmit"> </el-button>
<el-button @click="assignPermDialogVisible = false"> </el-button>
</div>
</template>
@@ -236,11 +208,7 @@ defineOptions({
inheritAttrs: false,
});
import RoleAPI, {
RolePageVO,
RoleForm,
RolePageQuery,
} from "@/api/system/role";
import RoleAPI, { RolePageVO, RoleForm, RolePageQuery } from "@/api/system/role";
import MenuAPI from "@/api/system/menu";
const queryFormRef = ref(ElForm);
@@ -414,9 +382,7 @@ async function handleOpenAssignPermDialog(row: RolePageVO) {
RoleAPI.getRoleMenuIds(roleId)
.then((data) => {
const checkedMenuIds = data;
checkedMenuIds.forEach((menuId) =>
permTreeRef.value!.setChecked(menuId, true, false)
);
checkedMenuIds.forEach((menuId) => permTreeRef.value!.setChecked(menuId, true, false));
})
.finally(() => {
loading.value = false;