diff --git a/apps/web-antd/src/api/license/license/index.ts b/apps/web-antd/src/api/license/license/index.ts index 9b5c974..88c1627 100644 --- a/apps/web-antd/src/api/license/license/index.ts +++ b/apps/web-antd/src/api/license/license/index.ts @@ -27,11 +27,13 @@ export namespace LicenseApi { neCodeList: NeCode[]; // 操作 oldLicense: License; hasHistory: boolean; + showUpload?: boolean; // 是否显示上传按钮 } export interface NeCode { id: number; // 主键 neList: number[]; // 网元开关 activationCode: string; // 激活码 + fileUrl: string; // 文件地址 } } @@ -60,6 +62,11 @@ export function createLicense(data: LicenseApi.License) { return requestClient.post('/license/license/create', data); } +/** 修改License */ +export function updateLicenseDetail(data: LicenseApi.NeCode) { + return requestClient.put('/license/license/update-detail', data); +} + /** 修改License */ export function updateLicense(data: LicenseApi.License) { return requestClient.put('/license/license/update', data); diff --git a/apps/web-antd/src/views/license/license/components/detail.vue b/apps/web-antd/src/views/license/license/components/detail.vue index 35ac83f..6083b59 100644 --- a/apps/web-antd/src/views/license/license/components/detail.vue +++ b/apps/web-antd/src/views/license/license/components/detail.vue @@ -1,14 +1,18 @@ diff --git a/apps/web-antd/src/views/license/license/data.ts b/apps/web-antd/src/views/license/license/data.ts index 5062c58..5d80ff7 100644 --- a/apps/web-antd/src/views/license/license/data.ts +++ b/apps/web-antd/src/views/license/license/data.ts @@ -1,5 +1,5 @@ import type { VbenFormSchema } from '#/adapter/form'; -import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { CustomerApi } from '#/api/license/customer'; import type { LicenseApi } from '#/api/license/license'; import type { ProjectApi } from '#/api/license/project'; @@ -7,7 +7,6 @@ import type { DescriptionItemSchema } from '#/components/description'; import { h, ref } from 'vue'; -import { useAccess } from '@vben/access'; import { formatDate, formatDateTime } from '@vben/utils'; import dayjs, { Dayjs } from 'dayjs'; @@ -21,7 +20,6 @@ import { DictTag } from '#/components/dict-tag'; import { $t } from '#/locales'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils'; -const { hasAccessByCodes } = useAccess(); const customerList = ref([]); const projectList = ref([]); export const formData = ref(); @@ -146,6 +144,26 @@ export function useFormSchema(): VbenFormSchema[] { ], }, }, + { + fieldName: 'approver', + label: $t('license.approver'), + component: 'ApiSelect', + rules: 'required', + help: $t('license.licenseAdminHelp'), + componentProps: { + allowClear: true, + api: async () => { + const data = await getLicenseAdminList(); + return data.map((item) => ({ + label: item.nickname, + value: item.id, + })); + }, + showSearch: true, + filterOption: (input: string, option: any) => + option.label.toLowerCase().includes(input.toLowerCase()), + }, + }, { fieldName: 'neCodeList', label: $t('license.neList'), @@ -181,26 +199,6 @@ export function useFormSchema(): VbenFormSchema[] { component: 'Textarea', formItemClass: 'col-span-2', }, - { - fieldName: 'approver', - label: $t('license.approver'), - component: 'ApiSelect', - rules: 'required', - help: $t('license.licenseAdminHelp'), - componentProps: { - allowClear: true, - api: async () => { - const data = await getLicenseAdminList(); - return data.map((item) => ({ - label: item.nickname, - value: item.id, - })); - }, - showSearch: true, - filterOption: (input: string, option: any) => - option.label.toLowerCase().includes(input.toLowerCase()), - }, - }, ]; } @@ -299,9 +297,7 @@ export function useGridFormSchema(): VbenFormSchema[] { } /** 列表的字段 */ -export function useGridColumns( - onActionClick?: OnActionClickFn, -): VxeTableGridOptions['columns'] { +export function useGridColumns(): VxeTableGridOptions['columns'] { return [ { field: 'customerName', diff --git a/apps/web-antd/src/views/license/license/modules/detail.vue b/apps/web-antd/src/views/license/license/modules/detail.vue index f4f9640..b47a41d 100644 --- a/apps/web-antd/src/views/license/license/modules/detail.vue +++ b/apps/web-antd/src/views/license/license/modules/detail.vue @@ -5,6 +5,8 @@ import { ref } from 'vue'; import { useVbenModal } from '@vben/common-ui'; +import { getLicense } from '#/api/license/license'; + import Detail from '../components/detail.vue'; const formData = ref(); @@ -29,9 +31,17 @@ const [Modal, modalApi] = useVbenModal({ if (!data || !data.id) { return; } - formData.value = data; + // formData.value = data; + await getDetailById(data.id); }, }); + +const getDetailById = async (id: number) => { + // 获取详情 + const data = await getLicense(id); + formData.value = data; + formData.value.showUpload = true; // 显示上传按钮 +};