mirror of
https://github.com/yangzongzhuan/RuoYi-Vue3.git
synced 2025-09-28 15:22:42 +00:00
优化代码
This commit is contained in:
@@ -168,6 +168,7 @@ function submitForm() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getFormPromise(form) {
|
||||
return new Promise(resolve => {
|
||||
form.validate(res => {
|
||||
@@ -175,6 +176,7 @@ function getFormPromise(form) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function close() {
|
||||
const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: route.query.pageNum } };
|
||||
proxy.$tab.closeOpenPage(obj);
|
||||
|
@@ -258,15 +258,18 @@ const rules = ref({
|
||||
businessName: [{ required: true, message: "请输入生成业务名", trigger: "blur" }],
|
||||
functionName: [{ required: true, message: "请输入生成功能名", trigger: "blur" }]
|
||||
});
|
||||
|
||||
function subSelectChange(value) {
|
||||
props.info.subTableFkName = "";
|
||||
}
|
||||
|
||||
function tplSelectChange(value) {
|
||||
if (value !== "sub") {
|
||||
props.info.subTableName = "";
|
||||
props.info.subTableFkName = "";
|
||||
}
|
||||
}
|
||||
|
||||
function setSubTableColumns(value) {
|
||||
for (var item in props.tables) {
|
||||
const name = props.tables[item].tableName;
|
||||
@@ -276,6 +279,7 @@ function setSubTableColumns(value) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询菜单下拉树结构 */
|
||||
function getMenuTreeselect() {
|
||||
listMenu().then(response => {
|
||||
|
@@ -7,6 +7,7 @@
|
||||
v-model="queryParams.tableName"
|
||||
placeholder="请输入表名称"
|
||||
clearable
|
||||
style="width: 180px"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -15,6 +16,7 @@
|
||||
v-model="queryParams.tableComment"
|
||||
placeholder="请输入表描述"
|
||||
clearable
|
||||
style="width: 180px"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
@@ -71,14 +73,17 @@ function show() {
|
||||
getList();
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
/** 单击选择行 */
|
||||
function clickRow(row) {
|
||||
proxy.$refs.table.toggleRowSelection(row);
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
tables.value = selection.map(item => item.tableName);
|
||||
}
|
||||
|
||||
/** 查询表数据 */
|
||||
function getList() {
|
||||
listDbTable(queryParams).then(res => {
|
||||
@@ -86,16 +91,19 @@ function getList() {
|
||||
total.value = res.total;
|
||||
});
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 导入按钮操作 */
|
||||
function handleImportTable() {
|
||||
const tableNames = tables.value.join(",");
|
||||
|
@@ -217,11 +217,13 @@ function getList() {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 生成代码操作 */
|
||||
function handleGenTable(row) {
|
||||
const tbNames = row.tableName || tableNames.value;
|
||||
@@ -237,6 +239,7 @@ function handleGenTable(row) {
|
||||
proxy.$download.zip("/tool/gen/batchGenCode?tables=" + tbNames, "ruoyi.zip");
|
||||
}
|
||||
}
|
||||
|
||||
/** 同步数据库操作 */
|
||||
function handleSynchDb(row) {
|
||||
const tableName = row.tableName;
|
||||
@@ -246,20 +249,24 @@ function handleSynchDb(row) {
|
||||
proxy.$modal.msgSuccess("同步成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 打开导入表弹窗 */
|
||||
function openImportTable() {
|
||||
proxy.$refs["importRef"].show();
|
||||
}
|
||||
|
||||
/** 打开创建表弹窗 */
|
||||
function openCreateTable() {
|
||||
proxy.$refs["createRef"].show();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 预览按钮 */
|
||||
function handlePreview(row) {
|
||||
previewTable(row.tableId).then(response => {
|
||||
@@ -268,10 +275,12 @@ function handlePreview(row) {
|
||||
preview.value.activeName = "domain.java";
|
||||
});
|
||||
}
|
||||
|
||||
/** 复制代码成功 */
|
||||
function copyTextSuccess() {
|
||||
proxy.$modal.msgSuccess("复制成功");
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.tableId);
|
||||
@@ -279,11 +288,13 @@ function handleSelectionChange(selection) {
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleEditTable(row) {
|
||||
const tableId = row.tableId || ids.value[0];
|
||||
router.push({ path: "/tool/gen-edit/index/" + tableId, query: { pageNum: queryParams.value.pageNum } });
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const tableIds = row.tableId || ids.value;
|
||||
|
Reference in New Issue
Block a user