mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-28 04:23:24 +08:00
fix: 添加租户套餐为空时的错误提示
检测租户套餐列表是否为空,为空时显示错误提示并抛出异常,避免用户填写表单后无法选择套餐
This commit is contained in:
@@ -5,6 +5,8 @@ import { useVbenDrawer } from '@vben/common-ui';
|
|||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
import { cloneDeep } from '@vben/utils';
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import { tenantAdd, tenantInfo, tenantUpdate } from '#/api/system/tenant';
|
import { tenantAdd, tenantInfo, tenantUpdate } from '#/api/system/tenant';
|
||||||
import { packageSelectList } from '#/api/system/tenant-package';
|
import { packageSelectList } from '#/api/system/tenant-package';
|
||||||
@@ -35,6 +37,14 @@ const [BasicForm, formApi] = useVbenForm({
|
|||||||
|
|
||||||
async function setupPackageSelect() {
|
async function setupPackageSelect() {
|
||||||
const tenantPackageList = await packageSelectList();
|
const tenantPackageList = await packageSelectList();
|
||||||
|
/**
|
||||||
|
* 检测是否存在租户套餐 你也不想表单填完了发现套餐为0无法选中吧
|
||||||
|
*/
|
||||||
|
if (tenantPackageList.length === 0) {
|
||||||
|
message.error('请先配置租户套餐');
|
||||||
|
throw new Error('请先配置租户套餐');
|
||||||
|
}
|
||||||
|
|
||||||
const options = tenantPackageList.map((item) => ({
|
const options = tenantPackageList.map((item) => ({
|
||||||
label: item.packageName,
|
label: item.packageName,
|
||||||
value: item.packageId,
|
value: item.packageId,
|
||||||
|
|||||||
Reference in New Issue
Block a user