feat(sj_1.0.0): 导出、导入添加确认导出提示

1、 涉及定时任务、重试场景、组配置
2、组配置导入只限管理员导入
3、普通用户只能选择导出,管理员可以全部导出
This commit is contained in:
opensnail 2024-05-29 09:54:39 +08:00
parent 61e24330b6
commit bea1d3f85c
6 changed files with 67 additions and 24 deletions

View File

@ -27,9 +27,10 @@ const local: App.I18n.Schema = {
checkUploadType: 'Only JSON format files can be uploaded, please re-upload',
second: 's',
millisecond: 'ms',
import: 'import',
export: 'export',
batchCopy: 'BatchCopy',
import: 'Import',
export: 'Export',
exportAll: 'Are you sure to export all?',
exportPar: 'Are you sure to export {num} pieces of data?',
edit: 'Edit',
detail: 'Detail',
index: 'Index',

View File

@ -29,7 +29,8 @@ const local: App.I18n.Schema = {
millisecond: '毫秒',
import: '导入',
export: '导出',
batchCopy: '批量复制',
exportAll: '确认全部导出吗?',
exportPar: '确认导出{num}条数据吗?',
edit: '编辑',
detail: '详情',
index: '序号',

View File

@ -279,7 +279,8 @@ declare namespace App {
millisecond: string;
import: string;
export: string;
batchCopy: string;
exportAll: string;
exportPar: string;
edit: string;
detail: string;
index: string;

View File

@ -1,5 +1,5 @@
<script setup lang="tsx">
import { NButton, NTag } from 'naive-ui';
import { NButton, NPopconfirm, NTag } from 'naive-ui';
import { ref } from 'vue';
import { useBoolean } from '@sa/hooks';
import { fetchGetGroupConfigList, fetchUpdateGroupStatus } from '@/service/api';
@ -30,6 +30,11 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
groupName: null
},
columns: () => [
{
type: 'selection',
align: 'center',
width: 48
},
{
key: 'index',
title: $t('common.index'),
@ -182,13 +187,24 @@ function handleExport() {
@refresh="getData"
>
<template #addAfter>
<FileUpload action="/group/import" accept="application/json" />
<NButton size="small" ghost type="primary" @click="handleExport">
<template #icon>
<IconPajamasExport class="text-icon" />
<FileUpload v-if="hasAuth('R_ADMIN')" action="/group/import" accept="application/json" />
<NPopconfirm @positive-click="handleExport">
<template #trigger>
<NButton size="small" ghost type="primary" :disabled="checkedRowKeys.length === 0 && hasAuth('R_USER')">
<template #icon>
<IconPajamasExport class="text-icon" />
</template>
{{ $t('common.export') }}
</NButton>
</template>
{{ $t('common.export') }}
</NButton>
<template #default>
{{
checkedRowKeys.length === 0
? $t('common.exportAll')
: $t('common.exportPar', { num: checkedRowKeys.length })
}}
</template>
</NPopconfirm>
</template>
</TableHeaderOperation>
</template>

View File

@ -44,7 +44,7 @@ const { columnChecks, columns, data, getData, loading, mobilePagination, searchP
key: 'index',
title: $t('common.index'),
align: 'center',
width: 120
width: 48
},
{
key: 'jobName',
@ -278,12 +278,23 @@ function handleExport() {
>
<template #addAfter>
<FileUpload action="/job/import" accept="application/json" />
<NButton size="small" ghost type="primary" :disabled="checkedRowKeys.length === 0" @click="handleExport">
<template #icon>
<IconPajamasExport class="text-icon" />
<NPopconfirm @positive-click="handleExport">
<template #trigger>
<NButton size="small" ghost type="primary" :disabled="checkedRowKeys.length === 0 && hasAuth('R_USER')">
<template #icon>
<IconPajamasExport class="text-icon" />
</template>
{{ $t('common.export') }}
</NButton>
</template>
{{ $t('common.export') }}
</NButton>
<template #default>
{{
checkedRowKeys.length === 0
? $t('common.exportAll')
: $t('common.exportPar', { num: checkedRowKeys.length })
}}
</template>
</NPopconfirm>
</template>
</TableHeaderOperation>
</template>

View File

@ -1,5 +1,5 @@
<script setup lang="tsx">
import { NButton, NTag } from 'naive-ui';
import { NButton, NPopconfirm, NTag } from 'naive-ui';
import { ref } from 'vue';
import { useBoolean } from '@sa/hooks';
import { fetchGetRetryScenePageList, fetchUpdateSceneStatus } from '@/service/api';
@ -9,9 +9,11 @@ import { useTable, useTableOperate } from '@/hooks/common/table';
import { DelayLevel, backOffRecord, routeKeyRecord } from '@/constants/business';
import StatusSwitch from '@/components/common/status-switch.vue';
import { downloadFetch } from '@/utils/download';
import { useAuth } from '@/hooks/business/auth';
import SceneOperateDrawer from './modules/scene-operate-drawer.vue';
import SceneSearch from './modules/scene-search.vue';
import SceneDetailDrawer from './modules/scene-detail-drawer.vue';
const { hasAuth } = useAuth();
const appStore = useAppStore();
@ -212,12 +214,23 @@ function handleExport() {
>
<template #addAfter>
<FileUpload action="/scene-config/import" accept="application/json" />
<NButton size="small" ghost type="primary" :disabled="checkedRowKeys.length === 0" @click="handleExport">
<template #icon>
<IconPajamasExport class="text-icon" />
<NPopconfirm @positive-click="handleExport">
<template #trigger>
<NButton size="small" ghost type="primary" :disabled="checkedRowKeys.length === 0 && hasAuth('R_USER')">
<template #icon>
<IconPajamasExport class="text-icon" />
</template>
{{ $t('common.export') }}
</NButton>
</template>
{{ $t('common.export') }}
</NButton>
<template #default>
{{
checkedRowKeys.length === 0
? $t('common.exportAll')
: $t('common.exportPar', { num: checkedRowKeys.length })
}}
</template>
</NPopconfirm>
</template>
</TableHeaderOperation>
</template>