diff --git a/apps/web-antd/src/api/license/license/index.ts b/apps/web-antd/src/api/license/license/index.ts
index d15bd45..9b5c974 100644
--- a/apps/web-antd/src/api/license/license/index.ts
+++ b/apps/web-antd/src/api/license/license/index.ts
@@ -65,6 +65,19 @@ export function updateLicense(data: LicenseApi.License) {
return requestClient.put('/license/license/update', data);
}
+/** 下载导入模板 */
+export function importTemplate() {
+ return requestClient.download('/license/license/get-import-template');
+}
+
+/** 导入License */
+export function importLicense(file: File, updateSupport: boolean) {
+ return requestClient.upload('/license/license/import', {
+ file,
+ updateSupport,
+ });
+}
+
/** 重新License */
export function reapplyLicense(data: LicenseApi.License) {
return requestClient.put('/license/license/reapply', data);
diff --git a/apps/web-antd/src/views/license/customer/index.vue b/apps/web-antd/src/views/license/customer/index.vue
index b141d09..e65dc61 100644
--- a/apps/web-antd/src/views/license/customer/index.vue
+++ b/apps/web-antd/src/views/license/customer/index.vue
@@ -62,7 +62,7 @@ async function onDelete(row: CustomerApi.Customer) {
async function onExport() {
const data = await exportCustomer(await gridApi.formApi.getValues());
downloadFileFromBlobPart({
- fileName: `${$t('customer.customer')}.xls`,
+ fileName: `${$t('customer.customer')}.xlsx`,
source: data,
});
}
diff --git a/apps/web-antd/src/views/license/license/data.ts b/apps/web-antd/src/views/license/license/data.ts
index 8b92651..5062c58 100644
--- a/apps/web-antd/src/views/license/license/data.ts
+++ b/apps/web-antd/src/views/license/license/data.ts
@@ -478,3 +478,27 @@ export function useDetailSchema(): DescriptionItemSchema[] {
},
];
}
+
+/** 用户导入的表单 */
+export function useImportFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'file',
+ label: 'License数据',
+ component: 'Upload',
+ rules: 'required',
+ help: '仅允许导入 xls、xlsx 格式文件',
+ },
+ {
+ fieldName: 'updateSupport',
+ label: '是否覆盖',
+ component: 'Switch',
+ componentProps: {
+ checkedChildren: '是',
+ unCheckedChildren: '否',
+ },
+ rules: z.boolean().default(false),
+ help: '是否更新已经存在的License数据',
+ },
+ ];
+}
diff --git a/apps/web-antd/src/views/license/license/index.vue b/apps/web-antd/src/views/license/license/index.vue
index 8d2ba63..b768d81 100644
--- a/apps/web-antd/src/views/license/license/index.vue
+++ b/apps/web-antd/src/views/license/license/index.vue
@@ -21,6 +21,7 @@ import { useGridColumns, useGridFormSchema } from './data';
import Detail from './modules/detail.vue';
import Form from './modules/form.vue';
import History from './modules/history.vue';
+import ImportForm from './modules/import-form.vue';
const router = useRouter();
@@ -39,6 +40,11 @@ const [DetailModal, detailModalApi] = useVbenModal({
destroyOnClose: true,
});
+const [ImportModal, importModalApi] = useVbenModal({
+ connectedComponent: ImportForm,
+ destroyOnClose: true,
+});
+
/** 刷新表格 */
function onRefresh() {
gridApi.query();
@@ -105,7 +111,12 @@ async function onDelete(row: LicenseApi.License) {
/** 导出表格 */
async function onExport() {
const data = await exportLicense(await gridApi.formApi.getValues());
- downloadFileFromBlobPart({ fileName: 'License.xls', source: data });
+ downloadFileFromBlobPart({ fileName: 'License.xlsx', source: data });
+}
+
+/** 导入用户 */
+function handleImport() {
+ importModalApi.open();
}
const [Grid, gridApi] = useVbenVxeGrid({
@@ -152,6 +163,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
+
diff --git a/apps/web-antd/src/views/license/license/modules/import-form.vue b/apps/web-antd/src/views/license/license/modules/import-form.vue
new file mode 100644
index 0000000..0ef2b2d
--- /dev/null
+++ b/apps/web-antd/src/views/license/license/modules/import-form.vue
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/web-antd/src/views/license/project/index.vue b/apps/web-antd/src/views/license/project/index.vue
index 8d891e9..c179b14 100644
--- a/apps/web-antd/src/views/license/project/index.vue
+++ b/apps/web-antd/src/views/license/project/index.vue
@@ -73,7 +73,7 @@ async function onDelete(row: ProjectApi.Project) {
async function onExport() {
const data = await exportProject(await gridApi.formApi.getValues());
downloadFileFromBlobPart({
- fileName: `${$t('project.project')}.xls`,
+ fileName: `${$t('project.project')}.xlsx`,
source: data,
});
}