diff --git a/apps/web-antd/src/views/license/license/data.ts b/apps/web-antd/src/views/license/license/data.ts index dfb213d..2050a34 100644 --- a/apps/web-antd/src/views/license/license/data.ts +++ b/apps/web-antd/src/views/license/license/data.ts @@ -182,10 +182,6 @@ export function useFormSchema(): VbenFormSchema[] { component: 'ApiSelect', rules: 'required', help: $t('license.licenseAdminHelp'), - dependencies: { - triggerFields: [''], - show: () => formData.value?.action === 1, - }, componentProps: { allowClear: true, api: async () => { @@ -388,16 +384,6 @@ export function useGridColumns( // code: 'edit', // show: hasAccessByCodes(['license:license:update']), // }, - { - code: 'apply', - text: $t('license.apply'), - show: (values: LicenseApi.License) => { - return ( - hasAccessByCodes(['license:license:apply']) && - values.status === 0 - ); - }, - }, { code: 'generate', text: $t('license.generate'), diff --git a/apps/web-antd/src/views/license/license/index.vue b/apps/web-antd/src/views/license/license/index.vue index 4ba66df..530ae8d 100644 --- a/apps/web-antd/src/views/license/license/index.vue +++ b/apps/web-antd/src/views/license/license/index.vue @@ -43,12 +43,7 @@ function onRefresh() { /** 创建License */ function onCreate() { - formModalApi.setData({ action: 1 }).open(); -} - -/** 申请License */ -function onApply(row: LicenseApi.License) { - formModalApi.setData({ ...row, action: 1 }).open(); + formModalApi.setData({}).open(); } /** 生成License */ @@ -108,10 +103,6 @@ async function onExport() { /** 表格操作按钮的回调函数 */ function onActionClick({ code, row }: OnActionClickParams) { switch (code) { - case 'apply': { - onApply(row); - break; - } case 'delete': { onDelete(row); break; diff --git a/apps/web-antd/src/views/license/license/modules/form.vue b/apps/web-antd/src/views/license/license/modules/form.vue index 73fe1fa..c719d12 100644 --- a/apps/web-antd/src/views/license/license/modules/form.vue +++ b/apps/web-antd/src/views/license/license/modules/form.vue @@ -11,7 +11,6 @@ import { message } from 'ant-design-vue'; import { useVbenForm } from '#/adapter/form'; import { - applyLicense, createLicense, getLicense, updateLicense, @@ -35,20 +34,13 @@ const state = reactive({ const neCodeRef = ref(); const getTitle = computed(() => { - if (formData.value?.id) { - if (formData.value?.action === 1) { - return $t('license.applyAction', ['License']); - } - return $t('ui.actionTitle.edit', ['License']); - } else { - return $t('license.applyAction', ['License']); - } + return formData.value?.id + ? $t('ui.actionTitle.edit', ['License']) + : $t('license.applyAction', ['License']); }); const getConfirmText = computed(() => { - return formData.value?.action === 1 - ? $t('license.apply') - : $t('page.action.confirm'); + return formData.value?.id ? $t('page.action.confirm') : $t('license.apply'); }); const [Form, formApi] = useVbenForm({ @@ -100,21 +92,12 @@ const [Modal, modalApi] = useVbenModal({ const data = (await formApi.getValues()) as LicenseApi.License; data.neList = state.checkedList; data.neCodeList = state.neCodeList; - const action = formData.value?.action || 0; try { - if (formData.value?.id) { - await (action === 1 ? applyLicense(data) : updateLicense(data)); - } else { - await createLicense(data); - } + await (formData.value?.id ? updateLicense(data) : createLicense(data)); // 关闭并提示 await modalApi.close(); emit('success'); - if (action === 1) { - message.success($t('license.applySuccess'), 3); - } else { - message.success($t('ui.actionMessage.operationSuccess')); - } + message.success($t('license.applySuccess'), 3); } finally { modalApi.unlock(); } @@ -132,8 +115,6 @@ const [Modal, modalApi] = useVbenModal({ if (data.id) { modalApi.lock(); try { - const action = data.action || 0; // 确保 action 字段存在 - formData.value = { ...data, action }; data = await getLicense(data.id); } finally { modalApi.unlock();