mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-04-24 23:47:17 +08:00
perf: 通用CRUD
This commit is contained in:
parent
90d1cb8c98
commit
08ed64d7ef
@ -4,13 +4,11 @@ import { useRole } from "./utils/hook";
|
|||||||
import { PureTableBar } from "@/components/RePureTableBar";
|
import { PureTableBar } from "@/components/RePureTableBar";
|
||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||||
|
|
||||||
// import Database from "@iconify-icons/ri/database-2-line";
|
|
||||||
// import More from "@iconify-icons/ep/more-filled";
|
|
||||||
import Delete from "@iconify-icons/ep/delete";
|
import Delete from "@iconify-icons/ep/delete";
|
||||||
import EditPen from "@iconify-icons/ep/edit-pen";
|
import Edit from "@iconify-icons/ep/edit";
|
||||||
import Refresh from "@iconify-icons/ep/refresh";
|
import Refresh from "@iconify-icons/ep/refresh";
|
||||||
import Menu from "@iconify-icons/ep/menu";
|
|
||||||
import AddFill from "@iconify-icons/ri/add-circle-line";
|
import AddFill from "@iconify-icons/ri/add-circle-line";
|
||||||
|
import Download from "@iconify-icons/ep/download";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "SystemRole"
|
name: "SystemRole"
|
||||||
@ -23,13 +21,13 @@ const {
|
|||||||
columns,
|
columns,
|
||||||
dataList,
|
dataList,
|
||||||
pagination,
|
pagination,
|
||||||
// buttonClass,
|
disabledDelete,
|
||||||
|
disabledEdit,
|
||||||
|
disabledEditFrom,
|
||||||
onSearch,
|
onSearch,
|
||||||
resetForm,
|
resetForm,
|
||||||
openDialog,
|
openDialog,
|
||||||
handleMenu,
|
|
||||||
handleDelete,
|
handleDelete,
|
||||||
// handleDatabase,
|
|
||||||
handleSizeChange,
|
handleSizeChange,
|
||||||
handleCurrentChange,
|
handleCurrentChange,
|
||||||
handleSelectionChange
|
handleSelectionChange
|
||||||
@ -38,6 +36,7 @@ const {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
|
<!-- 搜索状态栏 -->
|
||||||
<el-form
|
<el-form
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
@ -52,14 +51,6 @@ const {
|
|||||||
class="!w-[180px]"
|
class="!w-[180px]"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="角色标识:" prop="code">
|
|
||||||
<el-input
|
|
||||||
v-model="form.code"
|
|
||||||
placeholder="请输入角色标识"
|
|
||||||
clearable
|
|
||||||
class="!w-[180px]"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="状态:" prop="status">
|
<el-form-item label="状态:" prop="status">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.status"
|
v-model="form.status"
|
||||||
@ -80,26 +71,55 @@ const {
|
|||||||
>
|
>
|
||||||
搜索
|
搜索
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)">
|
<el-button
|
||||||
|
type="info"
|
||||||
|
:icon="useRenderIcon(Refresh)"
|
||||||
|
@click="resetForm(formRef)"
|
||||||
|
>
|
||||||
重置
|
重置
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
<!-- 表格 -->
|
||||||
<PureTableBar
|
<PureTableBar
|
||||||
title="角色管理(仅演示,操作后不生效)"
|
title="角色管理(仅演示,操作后不生效)"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
@refresh="onSearch"
|
@refresh="onSearch"
|
||||||
>
|
>
|
||||||
|
<!-- 表头按钮 -->
|
||||||
<template #buttons>
|
<template #buttons>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="success"
|
||||||
:icon="useRenderIcon(AddFill)"
|
:icon="useRenderIcon(AddFill)"
|
||||||
@click="openDialog()"
|
@click="openDialog()"
|
||||||
>
|
>
|
||||||
新增角色
|
新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
:icon="useRenderIcon(Edit)"
|
||||||
|
:disabled="disabledEdit"
|
||||||
|
@click="openDialog('修改', disabledEditFrom)"
|
||||||
|
>
|
||||||
|
修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
:icon="useRenderIcon(Delete)"
|
||||||
|
:disabled="disabledDelete"
|
||||||
|
@click="openDialog()"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
:icon="useRenderIcon(Download)"
|
||||||
|
@click="openDialog()"
|
||||||
|
>
|
||||||
|
导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- 表格内容 -->
|
||||||
<template v-slot="{ size, dynamicColumns }">
|
<template v-slot="{ size, dynamicColumns }">
|
||||||
<pure-table
|
<pure-table
|
||||||
align-whole="center"
|
align-whole="center"
|
||||||
@ -108,8 +128,10 @@ const {
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:size="size"
|
:size="size"
|
||||||
adaptive
|
adaptive
|
||||||
|
stripe
|
||||||
:adaptiveConfig="{ offsetBottom: 108 }"
|
:adaptiveConfig="{ offsetBottom: 108 }"
|
||||||
:data="dataList"
|
:data="dataList"
|
||||||
|
row-key="id"
|
||||||
:columns="dynamicColumns"
|
:columns="dynamicColumns"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:paginationSmall="size === 'small' ? true : false"
|
:paginationSmall="size === 'small' ? true : false"
|
||||||
@ -121,27 +143,18 @@ const {
|
|||||||
@page-size-change="handleSizeChange"
|
@page-size-change="handleSizeChange"
|
||||||
@page-current-change="handleCurrentChange"
|
@page-current-change="handleCurrentChange"
|
||||||
>
|
>
|
||||||
|
<!-- 表格数据操作按钮 -->
|
||||||
<template #operation="{ row }">
|
<template #operation="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
class="reset-margin"
|
class="reset-margin"
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
:size="size"
|
:size="size"
|
||||||
:icon="useRenderIcon(EditPen)"
|
:icon="useRenderIcon(Edit)"
|
||||||
@click="openDialog('修改', row)"
|
@click="openDialog('修改', row)"
|
||||||
>
|
>
|
||||||
修改
|
修改
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
|
||||||
class="reset-margin"
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
:size="size"
|
|
||||||
:icon="useRenderIcon(Menu)"
|
|
||||||
@click="handleMenu"
|
|
||||||
>
|
|
||||||
菜单权限
|
|
||||||
</el-button>
|
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
:title="`是否确认删除角色名称为${row.name}的这条数据`"
|
:title="`是否确认删除角色名称为${row.name}的这条数据`"
|
||||||
@confirm="handleDelete(row)"
|
@confirm="handleDelete(row)"
|
||||||
@ -150,7 +163,7 @@ const {
|
|||||||
<el-button
|
<el-button
|
||||||
class="reset-margin"
|
class="reset-margin"
|
||||||
link
|
link
|
||||||
type="primary"
|
type="danger"
|
||||||
:size="size"
|
:size="size"
|
||||||
:icon="useRenderIcon(Delete)"
|
:icon="useRenderIcon(Delete)"
|
||||||
>
|
>
|
||||||
@ -158,43 +171,6 @@ const {
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
<!-- <el-dropdown>
|
|
||||||
<el-button
|
|
||||||
class="ml-3 mt-[2px]"
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
:size="size"
|
|
||||||
:icon="useRenderIcon(More)"
|
|
||||||
/>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu>
|
|
||||||
<el-dropdown-item>
|
|
||||||
<el-button
|
|
||||||
:class="buttonClass"
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
:size="size"
|
|
||||||
:icon="useRenderIcon(Menu)"
|
|
||||||
@click="handleMenu"
|
|
||||||
>
|
|
||||||
菜单权限
|
|
||||||
</el-button>
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item>
|
|
||||||
<el-button
|
|
||||||
:class="buttonClass"
|
|
||||||
link
|
|
||||||
type="primary"
|
|
||||||
:size="size"
|
|
||||||
:icon="useRenderIcon(Database)"
|
|
||||||
@click="handleDatabase"
|
|
||||||
>
|
|
||||||
数据权限
|
|
||||||
</el-button>
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown> -->
|
|
||||||
</template>
|
</template>
|
||||||
</pure-table>
|
</pure-table>
|
||||||
</template>
|
</template>
|
||||||
|
@ -228,6 +228,8 @@ export function useRole() {
|
|||||||
dataList,
|
dataList,
|
||||||
pagination,
|
pagination,
|
||||||
// buttonClass,
|
// buttonClass,
|
||||||
|
switchStyle,
|
||||||
|
onChange,
|
||||||
onSearch,
|
onSearch,
|
||||||
resetForm,
|
resetForm,
|
||||||
openDialog,
|
openDialog,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user