bugfix
This commit is contained in:
@ -26,8 +26,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
>搜索
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -40,8 +40,8 @@
|
||||
icon="Download"
|
||||
@click="handleGenTable"
|
||||
v-hasPermi="['tool:gen:code']"
|
||||
>生成</el-button
|
||||
>
|
||||
>生成
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -50,8 +50,8 @@
|
||||
icon="Upload"
|
||||
@click="openImportTable"
|
||||
v-hasPermi="['tool:gen:import']"
|
||||
>导入</el-button
|
||||
>
|
||||
>导入
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -61,8 +61,8 @@
|
||||
:disabled="single"
|
||||
@click="handleEditTable"
|
||||
v-hasPermi="['tool:gen:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -72,8 +72,8 @@
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['tool:gen:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@ -212,8 +212,8 @@
|
||||
v-copyText="value"
|
||||
v-copyText:callback="copyTextSuccess"
|
||||
style="float: right"
|
||||
> 复制</el-link
|
||||
>
|
||||
> 复制
|
||||
</el-link>
|
||||
<pre>{{ value }}</pre>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@ -222,16 +222,13 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Gen">
|
||||
import {
|
||||
listTable,
|
||||
previewTable,
|
||||
delTable,
|
||||
genCode,
|
||||
synchDb,
|
||||
} from "@/api/tool/gen";
|
||||
<script setup name="Gen" lang="jsx">
|
||||
import { delTable, listTable, previewTable, synchDb } from "@/api/tool/gen";
|
||||
import router from "@/router";
|
||||
import importTable from "./importTable";
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import { ref } from "vue";
|
||||
import useSettingsStore from "@/store/modules/settings";
|
||||
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance();
|
||||
@ -282,18 +279,44 @@ function getList() {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
// 下载生成代码选项
|
||||
const downloadArg = ref(null);
|
||||
|
||||
/** 生成代码操作 */
|
||||
function handleGenTable(row) {
|
||||
proxy.$download.zip(
|
||||
"/tool/gen/download/" + row.tableId,
|
||||
row.tableName + ".zip"
|
||||
downloadArg.value = useSettingsStore().downloadGenCodeType;
|
||||
// jsx vnode 单选:全部, Java, SQL
|
||||
const h = () => (
|
||||
<el-form>
|
||||
<el-form-item prop="downloadArg">
|
||||
<el-radio-group v-model={downloadArg.value}>
|
||||
<el-radio label="all">全部</el-radio>
|
||||
<el-radio label="vue">vue</el-radio>
|
||||
<el-radio label="java">Java</el-radio>
|
||||
<el-radio label="sql">SQL</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
);
|
||||
ElMessageBox.confirm(h, "下载类型", {
|
||||
"custom-class": "gen-download-type",
|
||||
center: true,
|
||||
}).then(() => {
|
||||
useSettingsStore().setDownloadGenCodeType(downloadArg.value);
|
||||
proxy.$download.zip(
|
||||
`/tool/gen/download/${row.tableId}/${downloadArg.value}`,
|
||||
`${row.tableName}_${downloadArg.value}.zip`
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/** 同步数据库操作 */
|
||||
function handleSynchDb(row) {
|
||||
const tableName = row.tableName;
|
||||
@ -307,27 +330,36 @@ function handleSynchDb(row) {
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
/** 打开导入表弹窗 */
|
||||
function openImportTable() {
|
||||
proxy.$refs["importRef"].show();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 预览按钮 */
|
||||
function handlePreview(row) {
|
||||
previewTable(row.tableId).then((response) => {
|
||||
preview.value.data = response.data;
|
||||
preview.value.open = true;
|
||||
preview.value.activeName = "domain.java";
|
||||
const firstTab = Object.keys(response.data)[0];
|
||||
preview.value.activeName = firstTab.substring(
|
||||
firstTab.lastIndexOf("/") + 1,
|
||||
firstTab.indexOf(".vm")
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/** 复制代码成功 */
|
||||
function copyTextSuccess() {
|
||||
proxy.$modal.msgSuccess("复制成功");
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.tableId);
|
||||
@ -335,6 +367,7 @@ function handleSelectionChange(selection) {
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleEditTable(row) {
|
||||
const tableId = row.tableId || ids.value[0];
|
||||
@ -343,6 +376,7 @@ function handleEditTable(row) {
|
||||
query: { pageNum: queryParams.value.pageNum },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const tableIds = row.tableId || ids.value;
|
||||
|
Reference in New Issue
Block a user