mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-23 21:18:09 +00:00
refactor(gencode): 统一属性命名规范并优化代码结构
将表字段属性从驼峰式改为下划线式命名 调整组件属性顺序以保持一致性 优化API调用和数据响应处理
This commit is contained in:
@@ -3,27 +3,27 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="表名称" prop="tableName">
|
||||
<el-input placeholder="请输入仓库名称" v-model="info.tableName" />
|
||||
<el-input v-model="info.table_name" placeholder="请输入仓库名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="表描述" prop="tableComment">
|
||||
<el-input placeholder="请输入" v-model="info.tableComment" />
|
||||
<el-input v-model="info.table_comment" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="实体类名称" prop="className">
|
||||
<el-input placeholder="请输入" v-model="info.className" />
|
||||
<el-input v-model="info.class_name" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="作者" prop="functionAuthor">
|
||||
<el-input placeholder="请输入" v-model="info.functionAuthor" />
|
||||
<el-input v-model="info.function_author" placeholder="请输入"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" :rows="3" v-model="info.remark"></el-input>
|
||||
<el-input v-model="info.remark" type="textarea" :rows="3"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -40,9 +40,9 @@ defineProps({
|
||||
|
||||
// 表单校验
|
||||
const rules = ref({
|
||||
tableName: [{ required: true, message: "请输入表名称", trigger: "blur" }],
|
||||
tableComment: [{ required: true, message: "请输入表描述", trigger: "blur" }],
|
||||
className: [{ required: true, message: "请输入实体类名称", trigger: "blur" }],
|
||||
functionAuthor: [{ required: true, message: "请输入作者", trigger: "blur" }]
|
||||
table_name: [{ required: true, message: "请输入表名称", trigger: "blur" }],
|
||||
table_comment: [{ required: true, message: "请输入表描述", trigger: "blur" }],
|
||||
class_name: [{ required: true, message: "请输入实体类名称", trigger: "blur" }],
|
||||
function_author: [{ required: true, message: "请输入作者", trigger: "blur" }]
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<!-- 创建表 -->
|
||||
<el-dialog title="创建表" v-model="visible" width="800px" top="5vh" append-to-body>
|
||||
<el-dialog v-model="visible" title="创建表" width="800px" top="5vh" append-to-body>
|
||||
<span>创建表语句(支持多个建表语句):</span>
|
||||
<el-input type="textarea" :rows="10" placeholder="请输入文本" v-model="content"></el-input>
|
||||
<el-input v-model="content" type="textarea" :rows="10" placeholder="请输入文本"></el-input>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="handleImportTable">确 定</el-button>
|
||||
|
||||
@@ -48,22 +48,22 @@
|
||||
|
||||
<el-table-column label="插入" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isInsert"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isInsert" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="编辑" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isEdit"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isEdit" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="列表" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isList"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isList" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="查询" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isQuery"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isQuery" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="查询方式" min-width="10%">
|
||||
@@ -82,12 +82,12 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="必填" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isRequired"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isRequired" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="唯一" min-width="5%">
|
||||
<template #default="scope">
|
||||
<el-checkbox true-label="1" false-label="0" v-model="scope.row.isUnique"></el-checkbox>
|
||||
<el-checkbox v-model="scope.row.isUnique" true-label="1" false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="显示类型" min-width="12%">
|
||||
@@ -136,7 +136,7 @@
|
||||
|
||||
<script setup name="GenEdit">
|
||||
import GencodeAPI from "@/api/generator/gencode";
|
||||
import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
|
||||
import DictAPI from "@/api/system/dict";
|
||||
import basicInfoForm from "./components/basicInfoForm";
|
||||
import genInfoForm from "./components/genInfoForm";
|
||||
|
||||
@@ -200,7 +200,7 @@ function close() {
|
||||
tables.value = res.data.tables;
|
||||
});
|
||||
/** 查询字典下拉列表 */
|
||||
GencodeAPI.getDictOptionselect().then(response => {
|
||||
DictAPI.getDictTypeOptionselect.then(response => {
|
||||
dictOptions.value = response.data;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" v-if="info.genType == '1'">
|
||||
<el-col v-if="info.genType == '1'" :span="24">
|
||||
<el-form-item prop="genPath">
|
||||
<template #label>
|
||||
自定义路径
|
||||
@@ -261,7 +261,7 @@ const rules = ref({
|
||||
functionName: [{ required: true, message: "请输入生成功能名", trigger: "blur" }]
|
||||
});
|
||||
|
||||
function subSelectChange(value) {
|
||||
function subSelectChange() {
|
||||
props.info.subTableFkName = "";
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ function tplSelectChange(value) {
|
||||
}
|
||||
|
||||
function setSubTableColumns(value) {
|
||||
for (var item in props.tables) {
|
||||
for (const item in props.tables) {
|
||||
const name = props.tables[item].tableName;
|
||||
if (value === name) {
|
||||
subColumns.value = props.tables[item].columns;
|
||||
|
||||
@@ -115,11 +115,10 @@
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="列表筛选">
|
||||
<el-dropdown trigger="click">
|
||||
<el-button type="default" icon="operation" circle v-hasPerm="['demo:example:filter']" />
|
||||
<el-button v-hasPerm="['demo:example:filter']" type="default" icon="operation" circle/>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-for="column in tableColumns" :key="column.prop"
|
||||
:command="column">
|
||||
<el-dropdown-item v-for="column in tableColumns" :key="column.prop" :command="column">
|
||||
<el-checkbox v-model="column.show">
|
||||
{{ column.label }}
|
||||
</el-checkbox>
|
||||
@@ -257,7 +256,9 @@ const data = reactive({
|
||||
page_no: 1,
|
||||
page_size: 10,
|
||||
table_name: undefined,
|
||||
table_comment: undefined
|
||||
table_comment: undefined,
|
||||
start_time: undefined,
|
||||
end_time: undefined
|
||||
},
|
||||
preview: {
|
||||
open: false,
|
||||
@@ -308,8 +309,8 @@ function loadingData() {
|
||||
}
|
||||
|
||||
GencodeAPI.listTable(queryParams).then(response => {
|
||||
tableList.value = response.rows;
|
||||
total.value = response.total;
|
||||
tableList.value = response.data.data.items;
|
||||
total.value = response.data.data.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
@@ -385,7 +386,9 @@ function handleRefresh() {
|
||||
page_no: 1,
|
||||
page_size: 10,
|
||||
table_name: undefined,
|
||||
table_comment: undefined
|
||||
table_comment: undefined,
|
||||
start_time: undefined,
|
||||
end_time: undefined
|
||||
};
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user