fix: 修复代码生成问题,修改状态切换组件

This commit is contained in:
AN 2025-04-27 14:52:19 +08:00
parent 28c88c485f
commit 74fcdc4e2c
6 changed files with 32 additions and 20 deletions

View File

@ -176,11 +176,11 @@ public class VelocityUtils {
fileName = StringUtils.format("{}/domain/bo/{}Bo.java", javaPath, className);
}
if (template.contains("soy.index.vue.vm")) {
fileName = StringUtils.format("soybean/views/{}/{}/index.vue", moduleName, businessName);
fileName = StringUtils.format("soybean/views/{}/{}/index.vue", moduleName, StrUtil.toSymbolCase(businessName, '-'));
} else if (template.contains("soy.api.d.ts.vm")) {
fileName = StringUtils.format("soybean/typings/api/{}.api.d.ts", moduleName);
} else if (template.contains("soy.api.ts.vm")) {
fileName = StringUtils.format("soybean/api/{}/{}.ts", moduleName, businessName);
fileName = StringUtils.format("soybean/api/{}/{}.ts", moduleName, StrUtil.toSymbolCase(businessName, '-'));
} else if (template.contains("soy.search.vue.vm")) {
fileName = StringUtils.format("soybean/views/{}/{}/modules/{}-search.vue", moduleName, businessName, StrUtil.toSymbolCase(businessName, '-'));
} else if (template.contains("soy.operate-drawer.vue.vm")) {

View File

@ -2,7 +2,7 @@
import { computed, reactive, watch } from 'vue';
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
import { $t } from '@/locales';
import { fetchCreate${BusinessName}, fetchUpdate${BusinessName} } from '@/service/api/${moduleName}/${businessName}';
import { fetchCreate${BusinessName}, fetchUpdate${BusinessName} } from '@/service/api/${moduleName}/${business-name}';
#if($dictList && $dictList.size() > 0)import { useDict } from '@/hooks/business/dict';#end
defineOptions({

View File

@ -6,8 +6,8 @@ import { useAuth } from '@/hooks/business/auth';
import { useAppStore } from '@/store/modules/app';
import { useDownload } from '@/hooks/business/download';
import { useTable, useTableOperate } from '@/hooks/common/table';
import ${BusinessName}OperateDrawer from './modules/${business_name}-operate-drawer.vue';
import ${BusinessName}Search from './modules/${business_name}-search.vue';
import ${BusinessName}OperateDrawer from './modules/${business-name}-operate-drawer.vue';
import ${BusinessName}Search from './modules/${business-name}-search.vue';
defineOptions({
name: '${BusinessName}List'

View File

@ -51,8 +51,8 @@ const handleUpdateValue = (val: Api.Common.EnableStatus) => {
v-model:value="value"
:loading="loading"
:rubber-band="false"
checked-value="1"
unchecked-value="0"
checked-value="0"
unchecked-value="1"
:disabled="props.disabled"
@update:value="handleUpdateValue"
/>

View File

@ -1,16 +1,14 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import type { SelectOption } from 'naive-ui';
import { useLoading } from '@sa/hooks';
import { fetchTenantList } from '@/service/api';
import { fetchChangeTenant, fetchClearTenant } from '@/service/api/system/tenant';
import { useAppStore } from '@/store/modules/app';
import { useTabStore } from '@/store/modules/tab';
import { useAuth } from '@/hooks/business/auth';
import { useRouterPush } from '@/hooks/common/router';
const { hasRole } = useAuth();
const { clearTabs } = useTabStore();
const router = useRouter();
defineOptions({ name: 'TenantSelect' });
interface Props {
@ -21,6 +19,11 @@ withDefaults(defineProps<Props>(), {
clearable: false
});
const appStore = useAppStore();
const { hasRole } = useAuth();
const { clearTabs } = useTabStore();
const { toHome } = useRouterPush();
const tenantId = defineModel<CommonType.IdType>('tenantId', { required: false, default: undefined });
const enabled = defineModel<boolean>('enabled', { required: false, default: true });
@ -33,6 +36,20 @@ const showTenantSelect = computed<boolean>(() => {
return hasRole('superadmin') && enabled.value;
});
/**
* 关闭当前页面并刷新
*
* @param msg 提示信息
* @param val 租户ID
*/
async function closeAndRefresh(msg: string, val: CommonType.IdType = '') {
lastSelected.value = val;
window.$message?.success(msg);
clearTabs();
toHome();
appStore.reloadPage(500);
}
async function handleChangeTenant(_tenantId: CommonType.IdType) {
if (!_tenantId) {
return;
@ -41,18 +58,12 @@ async function handleChangeTenant(_tenantId: CommonType.IdType) {
return;
}
await fetchChangeTenant(_tenantId);
lastSelected.value = _tenantId;
window.$message?.success('切换租户成功');
clearTabs();
router.push('/');
closeAndRefresh('切换租户成功', _tenantId);
}
async function handleClearTenant() {
await fetchClearTenant();
lastSelected.value = '';
window.$message?.success('切换为默认租户');
clearTabs();
router.push('/');
closeAndRefresh('切换为默认租户');
}
async function handleFetchTenantList() {

View File

@ -110,6 +110,7 @@ export function useRouterPush(inSetup = true) {
routerPushByKeyWithMetaQuery,
toLogin,
toggleLoginModule,
redirectFromLogin
redirectFromLogin,
toHome
};
}