mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-14 13:13:51 +08:00
版本预发布
This commit is contained in:
@@ -17,7 +17,23 @@
|
||||
:pagination="false"
|
||||
:scroll-x="1090"
|
||||
:scrollbar-props="{ trigger: 'none' }"
|
||||
/>
|
||||
>
|
||||
<template #tableTitle>
|
||||
<n-tooltip placement="top-start" trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button type="primary" @click="reloadFields(true)" class="min-left-space">
|
||||
<template #icon>
|
||||
<n-icon>
|
||||
<Reload />
|
||||
</n-icon>
|
||||
</template>
|
||||
重置字段
|
||||
</n-button>
|
||||
</template>
|
||||
主要用于重置字段设置或数据库表字段发生变化时重新载入
|
||||
</n-tooltip>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</n-card>
|
||||
</n-spin>
|
||||
</template>
|
||||
@@ -28,7 +44,7 @@
|
||||
import { genInfoObj, selectListObj } from '@/views/develop/code/components/model';
|
||||
import { ColumnList } from '@/api/develop/code';
|
||||
import { NButton, NCheckbox, NInput, NSelect, NTooltip, NTreeSelect } from 'naive-ui';
|
||||
import { HelpCircleOutline } from '@vicons/ionicons5';
|
||||
import { HelpCircleOutline, Reload } from '@vicons/ionicons5';
|
||||
import { renderIcon } from '@/utils';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
|
||||
@@ -64,14 +80,26 @@
|
||||
const columns = ref<any>([]);
|
||||
const show = ref(false);
|
||||
const dataSource = ref(formValue.value.masterColumns);
|
||||
|
||||
async function reloadFields(loading = false) {
|
||||
if (loading) {
|
||||
show.value = true;
|
||||
}
|
||||
|
||||
formValue.value.masterColumns = await ColumnList({
|
||||
name: formValue.value.dbName,
|
||||
table: formValue.value.tableName,
|
||||
});
|
||||
dataSource.value = formValue.value.masterColumns;
|
||||
if (loading) {
|
||||
show.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
show.value = true;
|
||||
if (formValue.value.masterColumns.length === 0) {
|
||||
formValue.value.masterColumns = await ColumnList({
|
||||
name: formValue.value.dbName,
|
||||
table: formValue.value.tableName,
|
||||
});
|
||||
dataSource.value = formValue.value.masterColumns;
|
||||
await reloadFields();
|
||||
}
|
||||
|
||||
columns.value = [
|
||||
|
||||
@@ -20,6 +20,7 @@ export interface joinAttr {
|
||||
export const genInfoObj = {
|
||||
id: 0,
|
||||
genType: 10,
|
||||
genTemplate: null,
|
||||
varName: '',
|
||||
options: {
|
||||
headOps: ['add', 'batchDel', 'export'],
|
||||
|
||||
@@ -44,9 +44,7 @@
|
||||
<n-button type="success" :loading="formBtnLoading" @click="submitBuild"
|
||||
>提交生成</n-button
|
||||
>
|
||||
<n-button type="info" dashed :loading="formBtnLoading" @click="submitSave"
|
||||
>仅保存配置</n-button
|
||||
>
|
||||
<n-button type="info" dashed @click="submitSave">仅保存配置</n-button>
|
||||
</n-space>
|
||||
</template>
|
||||
</n-tabs>
|
||||
@@ -217,12 +215,17 @@
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: () => {
|
||||
Build(genInfo.value).then((_res) => {
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1500);
|
||||
message.success('生成提交成功,即将刷新页面..');
|
||||
});
|
||||
formBtnLoading.value = true;
|
||||
Build(genInfo.value)
|
||||
.then((_res) => {
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1500);
|
||||
message.success('生成提交成功,即将刷新页面..');
|
||||
})
|
||||
.finally(() => {
|
||||
formBtnLoading.value = false;
|
||||
});
|
||||
},
|
||||
onNegativeClick: () => {
|
||||
// message.error('取消');
|
||||
|
||||
@@ -62,6 +62,16 @@
|
||||
placeholder="请选择"
|
||||
:options="selectList.genType"
|
||||
v-model:value="formParams.genType"
|
||||
:on-update:value="onUpdateValueGenType"
|
||||
/>
|
||||
</n-form-item>
|
||||
|
||||
<n-form-item label="生成模板" path="genTemplate">
|
||||
<n-select
|
||||
placeholder="请选择"
|
||||
:options="genTemplateOptions"
|
||||
v-model:value="formParams.genTemplate"
|
||||
:onFocus="onFocusGenTemplate"
|
||||
/>
|
||||
</n-form-item>
|
||||
|
||||
@@ -447,6 +457,21 @@
|
||||
formParams.value.daoName = option?.daoName as string;
|
||||
formParams.value.tableComment = option?.defTableComment as string;
|
||||
}
|
||||
|
||||
const genTemplateOptions = ref([]);
|
||||
function onFocusGenTemplate() {
|
||||
for (let i = 0; i < selectList.value.genType?.length; i++) {
|
||||
if (selectList.value.genType[i].value === formParams.value.genType) {
|
||||
genTemplateOptions.value = selectList.value.genType[i].templates;
|
||||
formParams.value.genTemplate = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onUpdateValueGenType(value) {
|
||||
formParams.value.genType = value;
|
||||
onFocusGenTemplate();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user