😎调整动态插件页面
This commit is contained in:
parent
2ce10418e1
commit
24a2d584a1
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sys-plugin-container">
|
<div class="sys-plugin-container">
|
||||||
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="900px">
|
<el-dialog v-model="state.isShowDialog" draggable overflow destroy-on-close width="900px">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div style="color: #fff">
|
<div style="color: #fff">
|
||||||
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
|
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>
|
||||||
@ -10,7 +10,7 @@
|
|||||||
<el-tabs v-model="state.selectedTabName">
|
<el-tabs v-model="state.selectedTabName">
|
||||||
<el-tab-pane label="插件信息">
|
<el-tab-pane label="插件信息">
|
||||||
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto" style="height: 500px">
|
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto" style="height: 500px">
|
||||||
<el-row :gutter="35">
|
<el-row :gutter="10">
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
<el-form-item label="功能名称" prop="name" :rules="[{ required: true, message: '功能名称不能为空', trigger: 'blur' }]">
|
<el-form-item label="功能名称" prop="name" :rules="[{ required: true, message: '功能名称不能为空', trigger: 'blur' }]">
|
||||||
<el-input v-model="state.ruleForm.name" placeholder="功能名称" clearable />
|
<el-input v-model="state.ruleForm.name" placeholder="功能名称" clearable />
|
||||||
@ -112,7 +112,7 @@ const openDialog = (row: any) => {
|
|||||||
state.isShowDialog = true;
|
state.isShowDialog = true;
|
||||||
ruleFormRef.value?.resetFields();
|
ruleFormRef.value?.resetFields();
|
||||||
|
|
||||||
// 延迟拿值防止取不到
|
// 延迟取值防止取不到
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (monacoEditor == null) initMonacoEditor();
|
if (monacoEditor == null) initMonacoEditor();
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|||||||
@ -1,66 +1,75 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sys-plugin-container">
|
<div class="sys-plugin-container" v-loading="options.loading">
|
||||||
<el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
|
<el-card shadow="hover" :body-style="{ padding: '5px 5px 0 5px', display: 'flex', width: '100%', height: '100%', alignItems: 'start' }">
|
||||||
<el-form :model="state.queryParams" ref="queryForm" :inline="true">
|
<el-form :model="state.queryParams" ref="queryForm" :show-message="false" :inlineMessage="true" :label-width="'60px'" style="flex: 1 1 0%">
|
||||||
<el-form-item label="功能名称">
|
<el-row :gutter="10">
|
||||||
<el-input v-model="state.queryParams.name" placeholder="功能名称" clearable />
|
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
|
||||||
</el-form-item>
|
<el-form-item label="功能名称" pro="name">
|
||||||
<el-form-item>
|
<el-input v-model="state.queryParams.name" placeholder="功能名称" clearable @keyup.enter.native="handleQuery(true)" />
|
||||||
<el-button-group>
|
</el-form-item>
|
||||||
<el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'sysPlugin:page'"> 查询 </el-button>
|
</el-col>
|
||||||
<el-button icon="ele-Refresh" @click="resetQuery"> 重置 </el-button>
|
</el-row>
|
||||||
</el-button-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="ele-Plus" @click="openAddPlugin" v-auth="'sysPlugin:add'"> 新增 </el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
<el-divider style="height: calc(100% - 5px); margin: 0 10px" direction="vertical" />
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col>
|
||||||
|
<el-button-group>
|
||||||
|
<el-button type="primary" icon="ele-Search" @click="handleQuery(true)" v-auth="'sysPlugin:page'" :loading="options.loading"> 查询 </el-button>
|
||||||
|
<el-button icon="ele-Refresh" @click="resetQuery" :loading="options.loading"> 重置 </el-button>
|
||||||
|
</el-button-group>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
|
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
|
||||||
<el-table :data="state.pluginData" style="width: 100%" v-loading="state.loading" border>
|
<vxe-grid ref="xGrid" class="xGrid-style" v-bind="options" @sort-change="sortChange">
|
||||||
<el-table-column type="index" label="序号" width="55" align="center" fixed />
|
<template #toolbar_buttons>
|
||||||
<el-table-column prop="name" label="功能名称" header-align="center" show-overflow-tooltip />
|
<el-button type="primary" icon="ele-Plus" @click="handleAdd" v-auth="'sysPlugin:add'"> 新增 </el-button>
|
||||||
<el-table-column prop="assemblyName" label="程序集名称" header-align="center" show-overflow-tooltip />
|
</template>
|
||||||
<el-table-column prop="orderNo" label="排序" width="70" align="center" show-overflow-tooltip />
|
<template #toolbar_tools> </template>
|
||||||
<el-table-column label="状态" width="70" align="center" show-overflow-tooltip>
|
<template #empty>
|
||||||
<template #default="scope">
|
<el-empty :image-size="200" />
|
||||||
<el-tag type="success" v-if="scope.row.status === 1">启用</el-tag>
|
</template>
|
||||||
<el-tag type="danger" v-else>禁用</el-tag>
|
<template #row_status="{ row }">
|
||||||
</template>
|
<el-tag v-if="row.status === 1" type="success">启用</el-tag>
|
||||||
</el-table-column>
|
<el-tag v-else type="danger">禁用</el-tag>
|
||||||
<el-table-column label="修改记录" width="100" align="center" show-overflow-tooltip>
|
</template>
|
||||||
<template #default="scope">
|
<template #row_record="{ row }">
|
||||||
<ModifyRecord :data="scope.row" />
|
<ModifyRecord :data="row" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
<template #row_buttons="{ row }">
|
||||||
<el-table-column label="操作" width="140" fixed="right" align="center" show-overflow-tooltip>
|
<el-tooltip content="编辑" placement="top">
|
||||||
<template #default="scope">
|
<el-button icon="ele-Edit" text type="primary" v-auth="'sysPlugin:update'" @click="handleEdit(row)"> </el-button>
|
||||||
<el-button icon="ele-Edit" size="small" text type="primary" @click="openEditPlugin(scope.row)" v-auth="'sysPlugin:update'"> 编辑 </el-button>
|
</el-tooltip>
|
||||||
<el-button icon="ele-Delete" size="small" text type="danger" @click="delPlugin(scope.row)" v-auth="'sysPlugin:delete'"> 删除 </el-button>
|
<el-tooltip content="删除" placement="top">
|
||||||
</template>
|
<el-button icon="ele-Delete" text type="danger" v-auth="'sysPlugin:delete'" @click="handleDelete(row)"> </el-button>
|
||||||
</el-table-column>
|
</el-tooltip>
|
||||||
</el-table>
|
</template>
|
||||||
<el-pagination
|
<template #pager>
|
||||||
v-model:currentPage="state.tableParams.page"
|
<vxe-pager
|
||||||
v-model:page-size="state.tableParams.pageSize"
|
:loading="options.loading"
|
||||||
:total="state.tableParams.total"
|
v-model:current-page="state.tableParams.page"
|
||||||
:page-sizes="[10, 20, 50, 100]"
|
v-model:page-size="state.tableParams.pageSize"
|
||||||
small
|
:total="state.tableParams.total"
|
||||||
background
|
@page-change="pageChange"
|
||||||
@size-change="handleSizeChange"
|
/>
|
||||||
@current-change="handleCurrentChange"
|
</template>
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
</vxe-grid>
|
||||||
/>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<EditPlugin ref="editPluginRef" :title="state.editPluginTitle" @handleQuery="handleQuery" />
|
<EditPlugin ref="editPluginRef" :title="state.title" @handleQuery="handleQuery" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="sysPlugin">
|
<script lang="ts" setup name="sysPlugin">
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||||
|
import { auth } from '/@/utils/authFunction';
|
||||||
|
import { VxeGridInstance, VxePagerEvents, VxePagerDefines } from 'vxe-table';
|
||||||
|
import { useVxeTable } from '/@/hooks/vxeTableOptionsHook';
|
||||||
|
|
||||||
import EditPlugin from '/@/views/system/plugin/component/editPlugin.vue';
|
import EditPlugin from '/@/views/system/plugin/component/editPlugin.vue';
|
||||||
import ModifyRecord from '/@/components/table/modifyRecord.vue';
|
import ModifyRecord from '/@/components/table/modifyRecord.vue';
|
||||||
|
|
||||||
@ -68,55 +77,97 @@ import { getAPI } from '/@/utils/axios-utils';
|
|||||||
import { SysPluginApi } from '/@/api-services/api';
|
import { SysPluginApi } from '/@/api-services/api';
|
||||||
import { SysPlugin } from '/@/api-services/models';
|
import { SysPlugin } from '/@/api-services/models';
|
||||||
|
|
||||||
|
const xGrid = ref<VxeGridInstance>();
|
||||||
const editPluginRef = ref<InstanceType<typeof EditPlugin>>();
|
const editPluginRef = ref<InstanceType<typeof EditPlugin>>();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: false,
|
|
||||||
pluginData: [] as Array<SysPlugin>,
|
|
||||||
queryParams: {
|
queryParams: {
|
||||||
name: undefined,
|
name: undefined,
|
||||||
},
|
},
|
||||||
tableParams: {
|
tableParams: {
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 20,
|
pageSize: 50,
|
||||||
|
field: 'id', // 默认的排序字段
|
||||||
|
order: 'aes', // 排序方向
|
||||||
|
descStr: 'desc', // 降序排序的关键字符
|
||||||
total: 0 as any,
|
total: 0 as any,
|
||||||
},
|
},
|
||||||
editPluginTitle: '',
|
visible: false,
|
||||||
|
title: '',
|
||||||
|
});
|
||||||
|
//表格参数配置
|
||||||
|
const options = useVxeTable<SysPlugin>({
|
||||||
|
id: 'sysPlugin',
|
||||||
|
name: '插件信息',
|
||||||
|
columns: [
|
||||||
|
// { type: 'checkbox', width: 40, fixed: 'left' },
|
||||||
|
{ type: 'seq', title: '序号', width: 60, fixed: 'left' },
|
||||||
|
{ field: 'name', title: '功能名称', minWidth: 200, showOverflow: 'tooltip' },
|
||||||
|
{ field: 'assemblyName', title: '程序集名称', minWidth: 200, showOverflow: 'tooltip' },
|
||||||
|
{ field: 'orderNo', title: '排序', width: 80, showOverflow: 'tooltip' },
|
||||||
|
{ field: 'status', title: '状态', width: 80, showOverflow: 'tooltip', slots: { default: 'row_status' } },
|
||||||
|
{ field: '', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
||||||
|
{ title: '操作', fixed: 'right', width: 100, showOverflow: true, slots: { default: 'row_buttons' } },
|
||||||
|
],
|
||||||
|
enableExport: auth('sysPlugin:export'),
|
||||||
|
searchCallback: () => handleQuery(),
|
||||||
|
queryAllCallback: () => fetchData({ pageSize: 99999 }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 页面初始化
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
handleQuery();
|
await handleQuery();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 查询操作
|
// 查询操作
|
||||||
const handleQuery = async () => {
|
const handleQuery = async (reset = false) => {
|
||||||
state.loading = true;
|
options.loading = true;
|
||||||
let params = Object.assign(state.queryParams, state.tableParams);
|
if (reset) state.tableParams.page = 1;
|
||||||
var res = await getAPI(SysPluginApi).apiSysPluginPagePost(params);
|
var res = await fetchData(null);
|
||||||
state.pluginData = res.data.result?.items ?? [];
|
xGrid.value?.loadData(res.data.result?.items ?? []);
|
||||||
state.tableParams.total = res.data.result?.total;
|
state.tableParams.total = res.data.result?.total;
|
||||||
state.loading = false;
|
options.loading = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取数据
|
||||||
|
const fetchData = async (tableParams: any) => {
|
||||||
|
let params = Object.assign(state.queryParams, state.tableParams, tableParams);
|
||||||
|
return getAPI(SysPluginApi).apiSysPluginPagePost(params);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 重置操作
|
// 重置操作
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
state.queryParams.name = undefined;
|
state.queryParams.name = undefined;
|
||||||
|
handleQuery(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 改变页码序号或页面容量
|
||||||
|
const pageChange: VxePagerEvents.PageChange = ({ currentPage, pageSize }: VxePagerDefines.PageChangeEventParams) => {
|
||||||
|
state.tableParams.page = currentPage;
|
||||||
|
state.tableParams.pageSize = pageSize;
|
||||||
|
handleQuery();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 列排序
|
||||||
|
const sortChange = (options: any) => {
|
||||||
|
state.tableParams.field = options.field;
|
||||||
|
state.tableParams.order = options.order;
|
||||||
handleQuery();
|
handleQuery();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开新增页面
|
// 打开新增页面
|
||||||
const openAddPlugin = () => {
|
const handleAdd = () => {
|
||||||
state.editPluginTitle = '添加动态插件';
|
state.title = '添加动态插件';
|
||||||
editPluginRef.value?.openDialog({ orderNo: 100, status: 1 });
|
editPluginRef.value?.openDialog({ status: 1, orderNo: 100 });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开编辑页面
|
// 打开编辑页面
|
||||||
const openEditPlugin = (row: any) => {
|
const handleEdit = (row: any) => {
|
||||||
state.editPluginTitle = '编辑动态插件';
|
state.title = '编辑动态插件';
|
||||||
editPluginRef.value?.openDialog(row);
|
editPluginRef.value?.openDialog(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除当前行
|
// 删除
|
||||||
const delPlugin = (row: any) => {
|
const handleDelete = (row: any) => {
|
||||||
ElMessageBox.confirm(`确定删除动态插件:【${row.name}】?`, '提示', {
|
ElMessageBox.confirm(`确定删除动态插件:【${row.name}】?`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
@ -129,16 +180,4 @@ const delPlugin = (row: any) => {
|
|||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 改变页面容量
|
|
||||||
const handleSizeChange = (val: number) => {
|
|
||||||
state.tableParams.pageSize = val;
|
|
||||||
handleQuery();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 改变页码序号
|
|
||||||
const handleCurrentChange = (val: number) => {
|
|
||||||
state.tableParams.page = val;
|
|
||||||
handleQuery();
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user