😎调整代码生成管理页面
This commit is contained in:
parent
5e773c8830
commit
a55937bde9
@ -54,6 +54,14 @@
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="生成表" prop="tableName" :rules="[{ required: true, message: '生成表不能为空', trigger: 'blur' }]">
|
||||
<template v-slot:label>
|
||||
<div>
|
||||
生成表
|
||||
<el-tooltip raw-content content="如果是刚刚在前端生成的实体,请重启后台服务后再进行代码生成。" placement="top">
|
||||
<SvgIcon name="fa fa-question-circle-o" :size="16" style="vertical-align: middle" />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
<el-select v-model="state.ruleForm.tableName" @change="tableChanged" value-key="value" filterable clearable class="w100">
|
||||
<el-option v-for="item in state.tableData" :key="item.entityName" :label="item.entityName + ' ( ' + item.tableName + ' ) [' + item.tableComment + ']'" :value="item" />
|
||||
</el-select>
|
||||
|
||||
@ -173,7 +173,7 @@ const resetQuery = async () => {
|
||||
|
||||
// 打开新增页面
|
||||
const handleAdd = () => {
|
||||
state.title = '增加';
|
||||
state.title = '增加代码生成';
|
||||
EditCodeGenRef.value?.openDialog({
|
||||
authorName: 'Admin.NET',
|
||||
generateType: '200',
|
||||
@ -187,7 +187,7 @@ const handleAdd = () => {
|
||||
|
||||
// 打开编辑页面
|
||||
const handleEdit = (row: any) => {
|
||||
state.title = '编辑';
|
||||
state.title = '编辑代码生成';
|
||||
EditCodeGenRef.value?.openDialog(row);
|
||||
};
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
<el-button-group style="padding-left: 12px; padding-right: 12px">
|
||||
<el-button icon="ele-Plus" @click="showAddColumn"> 增加列 </el-button>
|
||||
<el-button icon="ele-Plus" @click="showGenDialog"> 生成实体 </el-button>
|
||||
<el-popover placement="bottom" title="温馨提示" :width="200" trigger="hover" content="如果是刚刚生成的实体,请重启服务后再生成种子">
|
||||
<el-popover placement="bottom" title="🔔提示" :width="220" trigger="hover" content="如果是刚刚生成的实体,请重启后台服务后再生成种子。">
|
||||
<template #reference>
|
||||
<el-button icon="ele-Plus" @click="showGenSeedDataDialog"> 生成种子 </el-button>
|
||||
</template>
|
||||
@ -81,7 +81,7 @@ import { onMounted, reactive, ref } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { VxeGridInstance } from 'vxe-table';
|
||||
import { useVxeTable } from '/@/hooks/vxeTableOptionsHook';
|
||||
import { useVxeTable } from '/@/hooks/useVxeTableOptionsHook';
|
||||
|
||||
import EditTable from '/@/views/system/database/component/editTable.vue';
|
||||
import EditColumn from '/@/views/system/database/component/editColumn.vue';
|
||||
@ -118,54 +118,58 @@ const state = reactive({
|
||||
});
|
||||
|
||||
// 表格参数配置
|
||||
const options = useVxeTable<DbColumnOutput>({
|
||||
id: 'sysDatabase',
|
||||
name: '库表信息',
|
||||
columns: [
|
||||
// { type: 'checkbox', width: 40, fixed: 'left' },
|
||||
{ type: 'seq', title: '序号', width: 50, fixed: 'left' },
|
||||
{ field: 'dbColumnName', title: '字段名', minWidth: 200, showOverflow: 'tooltip' },
|
||||
{ field: 'dataType', title: '数据类型', minWidth: 120, showOverflow: 'tooltip' },
|
||||
{ field: 'isPrimarykey', title: '主键', minWidth: 70, slots: { default: 'row_isPrimarykey' } },
|
||||
{ field: 'isIdentity', title: '自增', minWidth: 70, slots: { default: 'row_isIdentity' } },
|
||||
{ field: 'isNullable', title: '可空', minWidth: 70, slots: { default: 'row_isNullable' } },
|
||||
{ field: 'length', title: '长度', minWidth: 80, showOverflow: 'tooltip' },
|
||||
{ field: 'decimalDigits', title: '精度', minWidth: 80, showOverflow: 'tooltip' },
|
||||
{ field: 'defaultValue', title: '默认值', minWidth: 80, showOverflow: 'tooltip' },
|
||||
{ field: 'columnDescription', title: '描述', minWidth: 200, showOverflow: 'tooltip' },
|
||||
{ title: '操作', fixed: 'right', width: 100, showOverflow: true, slots: { default: 'row_buttons' } },
|
||||
],
|
||||
enableExport: true,
|
||||
searchCallback: () => handleQueryColumn(),
|
||||
queryAllCallback: () => fetchData({ pageSize: 99999 }),
|
||||
});
|
||||
const options = useVxeTable<DbColumnOutput>(
|
||||
{
|
||||
id: 'sysDatabase',
|
||||
name: '库表信息',
|
||||
columns: [
|
||||
// { type: 'checkbox', width: 40, fixed: 'left' },
|
||||
{ type: 'seq', title: '序号', width: 50, fixed: 'left' },
|
||||
{ field: 'dbColumnName', title: '字段名', minWidth: 200, showOverflow: 'tooltip' },
|
||||
{ field: 'dataType', title: '数据类型', minWidth: 120, showOverflow: 'tooltip' },
|
||||
{ field: 'isPrimarykey', title: '主键', minWidth: 70, slots: { default: 'row_isPrimarykey' } },
|
||||
{ field: 'isIdentity', title: '自增', minWidth: 70, slots: { default: 'row_isIdentity' } },
|
||||
{ field: 'isNullable', title: '可空', minWidth: 70, slots: { default: 'row_isNullable' } },
|
||||
{ field: 'length', title: '长度', minWidth: 80, showOverflow: 'tooltip' },
|
||||
{ field: 'decimalDigits', title: '精度', minWidth: 80, showOverflow: 'tooltip' },
|
||||
{ field: 'defaultValue', title: '默认值', minWidth: 80, showOverflow: 'tooltip' },
|
||||
{ field: 'columnDescription', title: '描述', minWidth: 200, showOverflow: 'tooltip' },
|
||||
{ title: '操作', fixed: 'right', width: 100, showOverflow: true, slots: { default: 'row_buttons' } },
|
||||
],
|
||||
},
|
||||
// vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档
|
||||
{
|
||||
// 代理配置
|
||||
proxyConfig: { autoLoad: true, ajax: { query: () => handleQueryColumnApi() } },
|
||||
// 分页配置
|
||||
pagerConfig: { enabled: false },
|
||||
// 工具栏配置
|
||||
toolbarConfig: { export: true },
|
||||
}
|
||||
);
|
||||
|
||||
// 页面初始化
|
||||
onMounted(async () => {
|
||||
options.loading = true;
|
||||
var res = await getAPI(SysDatabaseApi).apiSysDatabaseListGet();
|
||||
let res = await getAPI(SysDatabaseApi).apiSysDatabaseListGet();
|
||||
state.dbData = res.data.result;
|
||||
options.loading = false;
|
||||
|
||||
let appNamesRes = await getAPI(SysCodeGenApi).apiSysCodeGenApplicationNamespacesGet();
|
||||
state.appNamespaces = appNamesRes.data.result as Array<string>;
|
||||
options.loading = false;
|
||||
});
|
||||
|
||||
// 查询操作
|
||||
const handleQueryColumn = async () => {
|
||||
// 查询列api
|
||||
const handleQueryColumnApi = async () => {
|
||||
if (state.tableName == '' || typeof state.tableName == 'undefined') {
|
||||
await xGrid.value?.loadData([]);
|
||||
options.loading = false;
|
||||
return;
|
||||
}
|
||||
options.loading = true;
|
||||
var res = await fetchData();
|
||||
await xGrid.value?.loadData(res.data.result ?? []);
|
||||
options.loading = false;
|
||||
return getAPI(SysDatabaseApi).apiSysDatabaseColumnListTableNameConfigIdGet(state.tableName, state.configId);
|
||||
};
|
||||
|
||||
// 获取数据
|
||||
const fetchData = async (tableParams?: any) => {
|
||||
return getAPI(SysDatabaseApi).apiSysDatabaseColumnListTableNameConfigIdGet(state.tableName, state.configId);
|
||||
// 查询列操作
|
||||
const handleQueryColumn = async () => {
|
||||
await xGrid.value?.commitProxy('query');
|
||||
};
|
||||
|
||||
// 增加表
|
||||
|
||||
@ -130,6 +130,7 @@ const options = useVxeTable<SysMenu>(
|
||||
pagerConfig: { enabled: false },
|
||||
// 工具栏配置
|
||||
toolbarConfig: { export: false },
|
||||
// 树形配置
|
||||
treeConfig: { expandAll: false },
|
||||
}
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user