feat(sj_1.0.0): 添加导出 导入 复制按钮

This commit is contained in:
opensnail 2024-05-26 23:26:32 +08:00
parent f843eacb70
commit aae0793af8
4 changed files with 42 additions and 1 deletions

View File

@ -24,6 +24,9 @@ const local: App.I18n.Schema = {
rollbackSuccess: 'Rollback Success',
deleteSuccess: 'Delete Success',
confirmDelete: 'Are you sure you want to delete?',
import: 'import',
export: 'export',
batchCopy: 'BatchCopy',
edit: 'Edit',
detail: 'Detail',
index: 'Index',

View File

@ -24,6 +24,9 @@ const local: App.I18n.Schema = {
rollbackSuccess: '回滚成功',
deleteSuccess: '删除成功',
confirmDelete: '确认删除吗?',
import: '导入',
export: '导出',
batchCopy: '批量复制',
edit: '编辑',
detail: '详情',
index: '序号',

View File

@ -274,6 +274,9 @@ declare namespace App {
rollbackSuccess: string;
deleteSuccess: string;
confirmDelete: string;
import: string;
export: string;
batchCopy: string;
edit: string;
detail: string;
index: string;

View File

@ -2,6 +2,7 @@
import { NButton, NTag } from 'naive-ui';
import { ref } from 'vue';
import { useBoolean } from '@sa/hooks';
import type { UploadFileInfo } from 'naive-ui';
import { fetchGetRetryScenePageList, fetchUpdateSceneStatus } from '@/service/api';
import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app';
@ -179,6 +180,14 @@ function triggerInterval(backOff: number, maxRetryCount: number) {
}
return desc.substring(1, desc.length);
}
async function beforeUpload(fileData: { file: UploadFileInfo; fileList: UploadFileInfo[] }) {
if (fileData.file.file?.type !== 'application/json') {
window.$message?.error('只能上传json格式的文件请重新上传');
return false;
}
return true;
}
</script>
<template>
@ -199,7 +208,30 @@ function triggerInterval(backOff: number, maxRetryCount: number) {
:show-delete="false"
@add="handleAdd"
@refresh="getData"
/>
>
<template #addAfter>
<NUpload action="https://www.mocky.io/v2/5e4bafc63100007100d8b70f" @before-upload="beforeUpload">
<NButton size="small" ghost type="primary">
<template #icon>
<IconPajamasImport class="text-icon" />
</template>
{{ $t('common.import') }}
</NButton>
</NUpload>
<NButton size="small" ghost type="primary">
<template #icon>
<IconPajamasExport class="text-icon" />
</template>
{{ $t('common.export') }}
</NButton>
<NButton size="small" ghost type="primary">
<template #icon>
<IconIcRoundContentCopy class="text-icon" />
</template>
{{ $t('common.batchCopy') }}
</NButton>
</template>
</TableHeaderOperation>
</template>
<NDataTable
v-model:checked-row-keys="checkedRowKeys"