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