⚡代码生成导入表优化
This commit is contained in:
parent
09b6a8fb81
commit
589c707647
@ -159,7 +159,8 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
UserName = HttpContext.GetName(),
|
UserName = HttpContext.GetName(),
|
||||||
TableName = table.Name,
|
TableName = table.Name,
|
||||||
Desc = table.Description,
|
Desc = table.Description,
|
||||||
CodeGen = OptionsSetting.CodeGen
|
CodeGen = OptionsSetting.CodeGen,
|
||||||
|
FrontTpl = dto.FrontTpl,
|
||||||
};
|
};
|
||||||
|
|
||||||
GenTable genTable = CodeGeneratorTool.InitTable(initTableDto);
|
GenTable genTable = CodeGeneratorTool.InitTable(initTableDto);
|
||||||
|
|||||||
@ -101,7 +101,6 @@
|
|||||||
"moduleName": "business",
|
"moduleName": "business",
|
||||||
"author": "admin",
|
"author": "admin",
|
||||||
"tablePrefix": "sys_", //"表前缀(生成类名不会包含表前缀,多个用逗号分隔)",
|
"tablePrefix": "sys_", //"表前缀(生成类名不会包含表前缀,多个用逗号分隔)",
|
||||||
"vuePath": "", //前端代码存储路径eg:D:\Work\ZRAdmin-Vue3
|
"vuePath": "" //前端代码存储路径eg:D:\Work\ZRAdmin-Vue3
|
||||||
"frontTpl": 2//默认前端模板 1、element ui 2、element plus
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -452,7 +452,7 @@ namespace ZR.CodeGenerator
|
|||||||
SortType = "asc",
|
SortType = "asc",
|
||||||
CheckedBtn = new int[] { 1, 2, 3 },
|
CheckedBtn = new int[] { 1, 2, 3 },
|
||||||
PermissionPrefix = className.ToLower(),
|
PermissionPrefix = className.ToLower(),
|
||||||
FrontTpl = dto.CodeGen.FrontTpl,
|
FrontTpl = dto.FrontTpl
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ namespace ZR.CodeGenerator.Model
|
|||||||
{
|
{
|
||||||
public class ImportCodeGenTableDto
|
public class ImportCodeGenTableDto
|
||||||
{
|
{
|
||||||
|
public int FrontTpl { get; set; }
|
||||||
public string DbName { get; set; }
|
public string DbName { get; set; }
|
||||||
public List<CodeGenTables> Tables { get; set; }
|
public List<CodeGenTables> Tables { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ namespace ZR.CodeGenerator.Model
|
|||||||
{
|
{
|
||||||
public class InitTableDto
|
public class InitTableDto
|
||||||
{
|
{
|
||||||
|
public int FrontTpl { get; set; }
|
||||||
public string DbName { get; set; }
|
public string DbName { get; set; }
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
public string TableName { get; set; }
|
public string TableName { get; set; }
|
||||||
|
|||||||
@ -16,13 +16,26 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-table ref="table" @row-click="clickRow" :data="dbTableList" highlight-current-row height="300px" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
@row-click="clickRow"
|
||||||
|
:data="dbTableList"
|
||||||
|
highlight-current-row
|
||||||
|
height="300px"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
<el-table-column type="selection" width="55"></el-table-column>
|
<el-table-column type="selection" width="55"></el-table-column>
|
||||||
<el-table-column prop="name" label="表名" sortable="custom" width="380" />
|
<el-table-column prop="name" label="表名" sortable="custom" width="380" />
|
||||||
<el-table-column prop="description" label="表描述" />
|
<el-table-column prop="description" label="表描述" />
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination background :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total" @pagination="getList" />
|
<pagination
|
||||||
|
background
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="total"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
</el-row>
|
</el-row>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="handleImportTable">确 定</el-button>
|
<el-button type="primary" @click="handleImportTable">确 定</el-button>
|
||||||
@ -32,7 +45,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listDbTable, importTable, codeGetDBList } from "@/api/tool/gen";
|
import { listDbTable, importTable, codeGetDBList } from '@/api/tool/gen'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -49,72 +62,71 @@ export default {
|
|||||||
dbList: [],
|
dbList: [],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
dbName: "",
|
dbName: '',
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
tableName: undefined,
|
tableName: undefined,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
dbName: [
|
dbName: [{ required: true, message: '请选择数据库名称', trigger: 'blur' }],
|
||||||
{ required: true, message: "请选择数据库名称", trigger: "blur" },
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 显示弹框
|
// 显示弹框
|
||||||
show() {
|
show() {
|
||||||
this.getList();
|
this.getList()
|
||||||
this.visible = true;
|
this.visible = true
|
||||||
},
|
},
|
||||||
clickRow(row) {
|
clickRow(row) {
|
||||||
this.$refs.table.toggleRowSelection(row);
|
this.$refs.table.toggleRowSelection(row)
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.tables = selection//.map((item) => item.name);
|
this.tables = selection //.map((item) => item.name);
|
||||||
},
|
},
|
||||||
// 查询表数据
|
// 查询表数据
|
||||||
getList() {
|
getList() {
|
||||||
codeGetDBList().then((res) => {
|
codeGetDBList().then((res) => {
|
||||||
const { dbList } = res.data;
|
const { dbList } = res.data
|
||||||
this.dbList = dbList;
|
this.dbList = dbList
|
||||||
});
|
})
|
||||||
if (this.queryParams.dbName !== "") {
|
if (this.queryParams.dbName !== '') {
|
||||||
listDbTable(this.queryParams).then((res) => {
|
listDbTable(this.queryParams).then((res) => {
|
||||||
this.dbTableList = res.data.result;
|
this.dbTableList = res.data.result
|
||||||
this.total = res.data.totalNum;
|
this.total = res.data.totalNum
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm("queryForm");
|
this.resetForm('queryForm')
|
||||||
this.handleQuery();
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
handleShowTable() {
|
handleShowTable() {
|
||||||
this.handleQuery();
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
/** 导入按钮操作 */
|
/** 导入按钮操作 */
|
||||||
handleImportTable() {
|
handleImportTable() {
|
||||||
console.log(JSON.stringify(this.tables));
|
console.log(JSON.stringify(this.tables))
|
||||||
|
|
||||||
importTable({
|
importTable({
|
||||||
tables: this.tables,
|
tables: this.tables,
|
||||||
dbName: this.queryParams.dbName,
|
dbName: this.queryParams.dbName,
|
||||||
|
frontTpl: 1,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.msgSuccess(res.msg);
|
this.msgSuccess(res.msg)
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.visible = false;
|
this.visible = false
|
||||||
this.$emit("ok");
|
this.$emit('ok')
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user