feat: ✨ 重置代码配置
This commit is contained in:
@@ -38,6 +38,14 @@ class GeneratorAPI {
|
|||||||
method: "get",
|
method: "get",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 重置代码配置 */
|
||||||
|
static resetGenConfig(tableName: string) {
|
||||||
|
return request({
|
||||||
|
url: `${GENERATOR_BASE_URL}/${tableName}/config`,
|
||||||
|
method: "delete",
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GeneratorAPI;
|
export default GeneratorAPI;
|
||||||
|
|||||||
@@ -54,7 +54,17 @@
|
|||||||
@click="handleOpenDialog(scope.row.tableName)"
|
@click="handleOpenDialog(scope.row.tableName)"
|
||||||
>
|
>
|
||||||
<i-ep-MagicStick />
|
<i-ep-MagicStick />
|
||||||
生成
|
生成代码
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
link
|
||||||
|
@click="handleResetConfig(scope.row.tableName)"
|
||||||
|
>
|
||||||
|
<i-ep-RefreshLeft />
|
||||||
|
重置配置
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -72,7 +82,7 @@
|
|||||||
<el-drawer
|
<el-drawer
|
||||||
v-model="dialog.visible"
|
v-model="dialog.visible"
|
||||||
:title="dialog.title"
|
:title="dialog.title"
|
||||||
@close="handleCloseDialog"
|
@close="dialog.visible = false"
|
||||||
size="80%"
|
size="80%"
|
||||||
>
|
>
|
||||||
<el-steps :active="active" align-center finish-status="success" simple>
|
<el-steps :active="active" align-center finish-status="success" simple>
|
||||||
@@ -452,10 +462,6 @@ function handleResetQuery() {
|
|||||||
handleQuery();
|
handleQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCloseDialog() {
|
|
||||||
dialog.visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
function handleOpenDialog(tableName: string) {
|
function handleOpenDialog(tableName: string) {
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
@@ -463,8 +469,10 @@ function handleOpenDialog(tableName: string) {
|
|||||||
// 获取字典数据
|
// 获取字典数据
|
||||||
DictAPI.getList().then((data) => {
|
DictAPI.getList().then((data) => {
|
||||||
dictOptions.value = data;
|
dictOptions.value = data;
|
||||||
|
loading.value = true;
|
||||||
|
|
||||||
GeneratorAPI.getGenConfig(tableName).then((data) => {
|
GeneratorAPI.getGenConfig(tableName)
|
||||||
|
.then((data) => {
|
||||||
dialog.title = `${tableName} 代码生成`;
|
dialog.title = `${tableName} 代码生成`;
|
||||||
formData.value = data;
|
formData.value = data;
|
||||||
if (formData.value.id) {
|
if (formData.value.id) {
|
||||||
@@ -473,6 +481,20 @@ function handleOpenDialog(tableName: string) {
|
|||||||
} else {
|
} else {
|
||||||
active.value = 0;
|
active.value = 0;
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置配置 */
|
||||||
|
function handleResetConfig(tableName: string) {
|
||||||
|
ElMessageBox.confirm("确定要重置配置吗?", "提示", {
|
||||||
|
type: "warning",
|
||||||
|
}).then(() => {
|
||||||
|
GeneratorAPI.resetGenConfig(tableName).then(() => {
|
||||||
|
handleQuery();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user