feat();代码生成器更改
parent
6910315d47
commit
22e534b67d
|
@ -1,7 +1,7 @@
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 查询菜单列表
|
// 查询菜单列表
|
||||||
export function listMenu(query) {
|
export function listMenu(query={}) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/menu/list',
|
url: '/system/menu/list',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
@ -3,15 +3,15 @@ import request from '@/utils/request'
|
||||||
// 查询生成表数据
|
// 查询生成表数据
|
||||||
export function listTable(query) {
|
export function listTable(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/tool/gen/list',
|
url: '/code/gen/list',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: query
|
data: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 查询db数据库列表
|
// 查询db数据库列表
|
||||||
export function listDbTable(query) {
|
export function listDbTable(query={}) {
|
||||||
return request({
|
return request({
|
||||||
url: '/tool/gen/db/list',
|
url: '/code/gen/db/list',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: query
|
data: query
|
||||||
})
|
})
|
||||||
|
@ -20,7 +20,7 @@ export function listDbTable(query) {
|
||||||
// 查询表详细信息
|
// 查询表详细信息
|
||||||
export function getGenTable(tableId) {
|
export function getGenTable(tableId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/tool/gen/' + tableId,
|
url: '/code/gen/' + tableId,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ export function getGenTable(tableId) {
|
||||||
// 修改代码生成信息
|
// 修改代码生成信息
|
||||||
export function updateGenTable(data) {
|
export function updateGenTable(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/tool/gen',
|
url: '/code/gen',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
@ -37,7 +37,7 @@ export function updateGenTable(data) {
|
||||||
// 导入表
|
// 导入表
|
||||||
export function importTable(data) {
|
export function importTable(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/tool/gen/importTable',
|
url: '/code/gen/importTable',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
params: data
|
params: data
|
||||||
})
|
})
|
||||||
|
@ -46,7 +46,7 @@ export function importTable(data) {
|
||||||
// 创建表
|
// 创建表
|
||||||
export function createTable(data) {
|
export function createTable(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/tool/gen/createTable',
|
url: '/code/gen/createTable',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
params: data
|
params: data
|
||||||
})
|
})
|
||||||
|
@ -55,7 +55,7 @@ export function createTable(data) {
|
||||||
// 预览生成代码
|
// 预览生成代码
|
||||||
export function previewTable(tableId) {
|
export function previewTable(tableId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/tool/gen/preview/' + tableId,
|
url: '/code/gen/preview/' + tableId,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ export function previewTable(tableId) {
|
||||||
// 删除表数据
|
// 删除表数据
|
||||||
export function delTable(tableId) {
|
export function delTable(tableId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/tool/gen/' + tableId,
|
url: '/code/gen/' + tableId,
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ export function delTable(tableId) {
|
||||||
// 生成代码(自定义路径)
|
// 生成代码(自定义路径)
|
||||||
export function genCode(tableName) {
|
export function genCode(tableName) {
|
||||||
return request({
|
return request({
|
||||||
url: '/tool/gen/genCode/' + tableName,
|
url: '/code/gen/genCode/' + tableName,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ export function genCode(tableName) {
|
||||||
// 同步数据库
|
// 同步数据库
|
||||||
export function synchDb(tableName) {
|
export function synchDb(tableName) {
|
||||||
return request({
|
return request({
|
||||||
url: '/tool/gen/synchDb/' + tableName,
|
url: '/code/gen/synchDb/' + tableName,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ function handleBeforeUpload(file) {
|
||||||
// 上传成功处理
|
// 上传成功处理
|
||||||
function handleUploadSuccess(res, file) {
|
function handleUploadSuccess(res, file) {
|
||||||
// 如果上传成功
|
// 如果上传成功
|
||||||
if (res.data.code == 200) {
|
if (res.code == 200) {
|
||||||
// 获取富文本实例
|
// 获取富文本实例
|
||||||
let quill = toRaw(quillEditorRef.value).getQuill();
|
let quill = toRaw(quillEditorRef.value).getQuill();
|
||||||
// 获取光标位置
|
// 获取光标位置
|
||||||
|
|
|
@ -138,13 +138,13 @@ function handleUploadError(err) {
|
||||||
|
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
function handleUploadSuccess(res, file) {
|
function handleUploadSuccess(res, file) {
|
||||||
if (res.data.code === 200) {
|
if (res.code === 200) {
|
||||||
uploadList.value.push({ name: res.data.fileName, url: res.data.fileName });
|
uploadList.value.push({ name: res.data.fileName, url: res.data.fileName });
|
||||||
uploadedSuccessfully();
|
uploadedSuccessfully();
|
||||||
} else {
|
} else {
|
||||||
number.value--;
|
number.value--;
|
||||||
proxy.$modal.closeLoading();
|
proxy.$modal.closeLoading();
|
||||||
proxy.$modal.msgError(res.data.msg);
|
proxy.$modal.msgError(res.msg);
|
||||||
proxy.$refs.fileUpload.handleRemove(file);
|
proxy.$refs.fileUpload.handleRemove(file);
|
||||||
uploadedSuccessfully();
|
uploadedSuccessfully();
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,13 +150,13 @@ function handleExceed() {
|
||||||
|
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
function handleUploadSuccess(res, file) {
|
function handleUploadSuccess(res, file) {
|
||||||
if (res.data.code === 200) {
|
if (res.code === 200) {
|
||||||
uploadList.value.push({ name: res.data.fileName, url: res.data.fileName });
|
uploadList.value.push({ name: res.data.fileName, url: res.data.fileName });
|
||||||
uploadedSuccessfully();
|
uploadedSuccessfully();
|
||||||
} else {
|
} else {
|
||||||
number.value--;
|
number.value--;
|
||||||
proxy.$modal.closeLoading();
|
proxy.$modal.closeLoading();
|
||||||
proxy.$modal.msgError(res.data.msg);
|
proxy.$modal.msgError(res.msg);
|
||||||
proxy.$refs.imageUpload.handleRemove(file);
|
proxy.$refs.imageUpload.handleRemove(file);
|
||||||
uploadedSuccessfully();
|
uploadedSuccessfully();
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ function handleSelectUser() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
authUserSelectAll({ roleId: roleId, userIds: uIds }).then(res => {
|
authUserSelectAll({ roleId: roleId, userIds: uIds }).then(res => {
|
||||||
proxy.$modal.msgSuccess(res.data.msg);
|
proxy.$modal.msgSuccess(res.msg);
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
emit("ok");
|
emit("ok");
|
||||||
});
|
});
|
||||||
|
|
|
@ -77,7 +77,7 @@ const state = reactive({
|
||||||
|
|
||||||
function getUser() {
|
function getUser() {
|
||||||
getUserProfile().then(response => {
|
getUserProfile().then(response => {
|
||||||
state.user = response.data;
|
state.user = response.data.sysUser;
|
||||||
state.roleGroup = response.data.roleGroup;
|
state.roleGroup = response.data.roleGroup;
|
||||||
state.postGroup = response.data.postGroup;
|
state.postGroup = response.data.postGroup;
|
||||||
});
|
});
|
||||||
|
|
|
@ -133,7 +133,7 @@ function uploadImg() {
|
||||||
formData.append("avatarfile", data, options.filename);
|
formData.append("avatarfile", data, options.filename);
|
||||||
uploadAvatar(formData).then(response => {
|
uploadAvatar(formData).then(response => {
|
||||||
open.value = false;
|
open.value = false;
|
||||||
options.img = import.meta.env.VITE_APP_BASE_API + response.data.imgUrl;
|
options.img = response.data;
|
||||||
userStore.avatar = options.img;
|
userStore.avatar = options.img;
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
|
|
|
@ -32,8 +32,8 @@ function handleImportTable() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
createTable({ sql: content.value }).then(res => {
|
createTable({ sql: content.value }).then(res => {
|
||||||
proxy.$modal.msgSuccess(res.data.msg);
|
proxy.$modal.msgSuccess(res.msg);
|
||||||
if (res.data.code === 200) {
|
if (res.code === 200) {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
emit("ok");
|
emit("ok");
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ function submitForm() {
|
||||||
const basicForm = proxy.$refs.basicInfo.$refs.basicInfoForm;
|
const basicForm = proxy.$refs.basicInfo.$refs.basicInfoForm;
|
||||||
const genForm = proxy.$refs.genInfo.$refs.genInfoForm;
|
const genForm = proxy.$refs.genInfo.$refs.genInfoForm;
|
||||||
Promise.all([basicForm, genForm].map(getFormPromise)).then(res => {
|
Promise.all([basicForm, genForm].map(getFormPromise)).then(res => {
|
||||||
const validateResult = res.data.every(item => !!item);
|
const validateResult = res.every(item => !!item);
|
||||||
if (validateResult) {
|
if (validateResult) {
|
||||||
const genTable = Object.assign({}, info.value);
|
const genTable = Object.assign({}, info.value);
|
||||||
genTable.columns = columns.value;
|
genTable.columns = columns.value;
|
||||||
|
@ -158,8 +158,8 @@ function submitForm() {
|
||||||
parentMenuId: info.value.parentMenuId
|
parentMenuId: info.value.parentMenuId
|
||||||
};
|
};
|
||||||
updateGenTable(genTable).then(res => {
|
updateGenTable(genTable).then(res => {
|
||||||
proxy.$modal.msgSuccess(res.data.msg);
|
proxy.$modal.msgSuccess(res.msg);
|
||||||
if (res.data.code === 200) {
|
if (res.code === 200) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -112,8 +112,8 @@ function handleImportTable() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
importTable({ tables: tableNames }).then(res => {
|
importTable({ tables: tableNames }).then(res => {
|
||||||
proxy.$modal.msgSuccess(res.data.msg);
|
proxy.$modal.msgSuccess(res.msg);
|
||||||
if (res.data.code === 200) {
|
if (res.code === 200) {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
emit("ok");
|
emit("ok");
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
v-hasPermi="['tool:gen:code']"
|
v-hasPermi="['tool:gen:code']"
|
||||||
>生成</el-button>
|
>生成</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5" v-if="false">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
plain
|
plain
|
||||||
|
@ -236,7 +236,7 @@ function handleGenTable(row) {
|
||||||
proxy.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath);
|
proxy.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
proxy.$download.zip("/tool/gen/batchGenCode?tables=" + tbNames, "cloud.zip");
|
proxy.$download.zip("/code/gen/batchGenCode?tables=" + tbNames, "cloud.zip");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue