fix: 修复代码生成问题
This commit is contained in:
parent
d6514c8e44
commit
ca69940dae
@ -15,6 +15,7 @@ export function fetchGetDictTypeOption() {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取字典类型列表 */
|
/** 获取字典类型列表 */
|
||||||
export function fetchGetDictTypeList(params?: Api.System.DictTypeSearchParams) {
|
export function fetchGetDictTypeList(params?: Api.System.DictTypeSearchParams) {
|
||||||
return request<Api.System.DictTypeList>({
|
return request<Api.System.DictTypeList>({
|
||||||
|
@ -15,9 +15,6 @@ const gap = computed(() => (appStore.isMobile ? 0 : 16));
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NSpace vertical :size="16">
|
<NSpace vertical :size="16">
|
||||||
<NAlert :title="$t('common.warning')" type="warning">
|
|
||||||
{{ $t('page.home.branchDesc') }}
|
|
||||||
</NAlert>
|
|
||||||
<HeaderBanner />
|
<HeaderBanner />
|
||||||
<CardData />
|
<CardData />
|
||||||
<NGrid :x-gap="gap" :y-gap="16" responsive="screen" item-responsive>
|
<NGrid :x-gap="gap" :y-gap="16" responsive="screen" item-responsive>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useAuthStore } from '@/store/modules/auth';
|
import { useAuthStore } from '@/store/modules/auth';
|
||||||
|
import defaultAvatar from '@/assets/imgs/soybean.jpg';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@ -44,11 +45,15 @@ const statisticData = computed<StatisticData[]>(() => [
|
|||||||
<NGi span="24 s:24 m:18">
|
<NGi span="24 s:24 m:18">
|
||||||
<div class="flex-y-center">
|
<div class="flex-y-center">
|
||||||
<div class="size-72px shrink-0 overflow-hidden rd-1/2">
|
<div class="size-72px shrink-0 overflow-hidden rd-1/2">
|
||||||
<img src="@/assets/imgs/soybean.jpg" class="size-full" />
|
<img :src="authStore.userInfo.user?.avatar || defaultAvatar" class="size-full" />
|
||||||
</div>
|
</div>
|
||||||
<div class="pl-12px">
|
<div class="pl-12px">
|
||||||
<h3 class="text-18px font-semibold">
|
<h3 class="text-18px font-semibold">
|
||||||
{{ $t('page.home.greeting', { userName: authStore.userInfo.user?.userName }) }}
|
{{
|
||||||
|
$t('page.home.greeting', {
|
||||||
|
userName: authStore.userInfo.user?.nickName || authStore.userInfo.user?.userName
|
||||||
|
})
|
||||||
|
}}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-#999 leading-30px">{{ $t('page.home.weatherDesc') }}</p>
|
<p class="text-#999 leading-30px">{{ $t('page.home.weatherDesc') }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { fetchGetGenDbList, fetchImportGenTable } from '@/service/api/tool';
|
import { fetchGetGenDataNames, fetchGetGenDbList, fetchImportGenTable } from '@/service/api/tool';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
@ -10,12 +10,6 @@ defineOptions({
|
|||||||
name: 'GenTableImportDrawer'
|
name: 'GenTableImportDrawer'
|
||||||
});
|
});
|
||||||
|
|
||||||
interface Props {
|
|
||||||
options: CommonType.Option[];
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = defineProps<Props>();
|
|
||||||
|
|
||||||
const visible = defineModel<boolean>('visible', {
|
const visible = defineModel<boolean>('visible', {
|
||||||
default: false
|
default: false
|
||||||
});
|
});
|
||||||
@ -34,7 +28,7 @@ const { columns, data, getData, getDataByPage, loading, mobilePagination, search
|
|||||||
showTotal: true,
|
showTotal: true,
|
||||||
apiParams: {
|
apiParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 30,
|
pageSize: 15,
|
||||||
// if you want to use the searchParams in Form, you need to define the following properties, and the value is null
|
// if you want to use the searchParams in Form, you need to define the following properties, and the value is null
|
||||||
// the value can not be undefined, otherwise the property in Form will not be reactive
|
// the value can not be undefined, otherwise the property in Form will not be reactive
|
||||||
dataName: null,
|
dataName: null,
|
||||||
@ -84,10 +78,21 @@ async function handleSubmit() {
|
|||||||
emit('submitted');
|
emit('submitted');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dataNameOptions = ref<CommonType.Option[]>([]);
|
||||||
|
|
||||||
|
async function getDataNames() {
|
||||||
|
const { error, data: dataNames } = await fetchGetGenDataNames();
|
||||||
|
if (error) return;
|
||||||
|
dataNameOptions.value = dataNames.map(item => ({ label: item, value: item }));
|
||||||
|
}
|
||||||
|
|
||||||
watch(visible, () => {
|
watch(visible, () => {
|
||||||
if (visible.value) {
|
if (visible.value) {
|
||||||
searchParams.dataName = props.options.length ? props.options[0].value : null;
|
getDataNames();
|
||||||
getData();
|
resetSearchParams();
|
||||||
|
searchParams.dataName = dataNameOptions.value.length ? dataNameOptions.value[0].value : null;
|
||||||
|
data.value = [];
|
||||||
|
checkedRowKeys.value = [];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -98,7 +103,7 @@ watch(visible, () => {
|
|||||||
<div class="h-full flex-col">
|
<div class="h-full flex-col">
|
||||||
<GenTableDbSearch
|
<GenTableDbSearch
|
||||||
v-model:model="searchParams"
|
v-model:model="searchParams"
|
||||||
:options="options"
|
:options="dataNameOptions"
|
||||||
@reset="resetSearchParams"
|
@reset="resetSearchParams"
|
||||||
@search="getDataByPage"
|
@search="getDataByPage"
|
||||||
/>
|
/>
|
||||||
|
@ -132,7 +132,7 @@ watch(visible, () => {
|
|||||||
if (visible.value) {
|
if (visible.value) {
|
||||||
genTableInfo.value = undefined;
|
genTableInfo.value = undefined;
|
||||||
tab.value = 'dragTable';
|
tab.value = 'dragTable';
|
||||||
getDeptOptions();
|
getDictOptions();
|
||||||
getGenTableInfo();
|
getGenTableInfo();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -140,7 +140,7 @@ watch(visible, () => {
|
|||||||
const dictOptions = ref<SelectOption[]>([]);
|
const dictOptions = ref<SelectOption[]>([]);
|
||||||
const { loading: dictLoading, startLoading: startDictLoading, endLoading: endDictLoading } = useLoading();
|
const { loading: dictLoading, startLoading: startDictLoading, endLoading: endDictLoading } = useLoading();
|
||||||
|
|
||||||
async function getDeptOptions() {
|
async function getDictOptions() {
|
||||||
startDictLoading();
|
startDictLoading();
|
||||||
const { error, data } = await fetchGetDictTypeOption();
|
const { error, data } = await fetchGetDictTypeOption();
|
||||||
if (error) return;
|
if (error) return;
|
||||||
@ -351,7 +351,7 @@ const columns: NaiveUI.TableColumn<Api.Tool.GenTableColumn>[] = [
|
|||||||
<NInput v-model:value="genTableInfo.info.functionName" />
|
<NInput v-model:value="genTableInfo.info.functionName" />
|
||||||
</NFormItemGi>
|
</NFormItemGi>
|
||||||
<NFormItemGi span="24 s:12" label="上级菜单" path="parentMenuId">
|
<NFormItemGi span="24 s:12" label="上级菜单" path="parentMenuId">
|
||||||
<MenuTreeSelect v-model:value="genTableInfo.info.parentMenuId" />
|
<MenuTreeSelect v-model:value="genTableInfo.info.parentMenuId" :data-name="rowData?.dataName" />
|
||||||
</NFormItemGi>
|
</NFormItemGi>
|
||||||
<NFormItemGi span="24 s:12" label="生成代码方式" path="genType">
|
<NFormItemGi span="24 s:12" label="生成代码方式" path="genType">
|
||||||
<NRadioGroup v-model:value="genTableInfo.info.genType">
|
<NRadioGroup v-model:value="genTableInfo.info.genType">
|
||||||
|
@ -73,6 +73,7 @@ async function handleCopyCode() {
|
|||||||
watch(visible, () => {
|
watch(visible, () => {
|
||||||
if (visible.value) {
|
if (visible.value) {
|
||||||
previewData.value = {};
|
previewData.value = {};
|
||||||
|
tab.value = 'vm/java/domain.java.vm';
|
||||||
getGenPreview();
|
getGenPreview();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -90,6 +91,7 @@ const genMap: Api.Tool.GenTablePreview = {
|
|||||||
'vm/soybean/api/soy.api.ts.vm': 'api.ts',
|
'vm/soybean/api/soy.api.ts.vm': 'api.ts',
|
||||||
'vm/soybean/typings/soy.api.d.ts.vm': 'type.d.ts',
|
'vm/soybean/typings/soy.api.d.ts.vm': 'type.d.ts',
|
||||||
'vm/soybean/soy.index.vue.vm': 'index.vue',
|
'vm/soybean/soy.index.vue.vm': 'index.vue',
|
||||||
|
'vm/soybean/soy.index-tree.vue.vm': 'index-tree.vue',
|
||||||
'vm/soybean/modules/soy.search.vue.vm': 'search.vue',
|
'vm/soybean/modules/soy.search.vue.vm': 'search.vue',
|
||||||
'vm/soybean/modules/soy.operate-drawer.vue.vm': 'operate-drawer.vue'
|
'vm/soybean/modules/soy.operate-drawer.vue.vm': 'operate-drawer.vue'
|
||||||
};
|
};
|
||||||
@ -125,7 +127,7 @@ function getGenLanguage(name: string) {
|
|||||||
<NSpin :show="loading" class="h-full" content-class="h-full">
|
<NSpin :show="loading" class="h-full" content-class="h-full">
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
<NTabs v-model:value="tab" type="line" placement="left" class="h-full" pane-class="h-full">
|
<NTabs v-model:value="tab" type="line" placement="left" class="h-full" pane-class="h-full">
|
||||||
<NTab v-for="(gen, index) in Object.keys(genMap)" :key="index" :name="gen" display-directive="show">
|
<NTab v-for="(gen, index) in Object.keys(previewData)" :key="index" :name="gen" display-directive="show">
|
||||||
{{ genMap[gen] }}
|
{{ genMap[gen] }}
|
||||||
</NTab>
|
</NTab>
|
||||||
</NTabs>
|
</NTabs>
|
||||||
|
Loading…
Reference in New Issue
Block a user