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