feat(文件管理): 文件管理页面&ms-detail-drawer组件&部分组件调整

This commit is contained in:
baiqi 2023-09-25 18:35:14 +08:00 committed by fit2-zhao
parent 2618a89a71
commit d284454127
12 changed files with 521 additions and 936 deletions

View File

@ -570,574 +570,6 @@ const fileList = [
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000011,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000012,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000013,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000014,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000015,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000016,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000017,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000018,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000019,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000020,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 100001,
name: 'JAR',
url: 'https://github.com/metersphere/metersphere/blob/v2.10/.gitignore',
type: 'JAR',
desc: 'fwihflhlofihlasjkhfdlkasjdhgaksuidhoasidoasidasopidapsoidaps',
storage: 'minio',
tag: ['dsadasd'],
size: '12MB',
enable: true,
fileVersion: 'v2.10',
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000002,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000003,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000004,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000005,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000006,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000007,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000008,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000009,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000010,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000011,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000012,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000013,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000014,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000015,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000016,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000017,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000018,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000019,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
{
id: 1000020,
name: 'PNG',
url: 'http://localhost:5173/front/base-display/get/logo-platform',
type: 'PNG',
desc: 'sfakjdghkjrugheoirugkblasjblsdjkhflksdjfsldkjklnjkhkljds',
storage: 'github',
gitBranch: 'master',
gitVersion: 'v2.10',
gitPath: '/asdas/xas/xas/fd/f/',
tag: ['asfasdfas'],
size: '12MB',
enable: false,
fileModule: 'XXX',
creator: '创建人',
updater: '更新人',
updateTime: 18975439859,
createTime: 18975439859,
},
];
// 获取文件列表
export function getFileList(data: TableQueryParams): Promise<CommonList<any>> {

View File

@ -219,7 +219,7 @@
@apply overflow-hidden;
.ms-container--shadow();
.ms-card-list {
@apply grid h-full overflow-auto;
@apply grid overflow-auto;
.ms-scroll-bar();

View File

@ -0,0 +1,199 @@
<template>
<MsDrawer
v-model:visible="innerVisible"
:width="props.width"
:footer="false"
class="ms-drawer"
no-content-padding
unmount-on-close
>
<template #title>
<div class="flex w-full items-center">
{{ props.title }}
<a-tooltip
:content="activeDetailIsFirst ? t('ms.detail.drawer.noPrev') : t('ms.detail.drawer.prev')"
:mouse-enter-delay="300"
mini
>
<a-button
type="outline"
size="mini"
class="arco-btn-outline--secondary ml-[16px] mr-[4px]"
:disabled="activeDetailIsFirst || loading"
@click="openPrevDetail"
>
<template #icon>
<icon-left />
</template>
</a-button>
</a-tooltip>
<a-tooltip
:content="activeDetailIsLast ? t('ms.detail.drawer.noNext') : t('ms.detail.drawer.next')"
:mouse-enter-delay="300"
mini
>
<a-button
type="outline"
size="mini"
class="arco-btn-outline--secondary"
:disabled="activeDetailIsLast || loading"
@click="openNextDetail"
>
<template #icon>
<icon-right />
</template>
</a-button>
</a-tooltip>
<div class="ml-auto flex items-center">
<slot name="titleRight" :loading="loading" :detail="detail"></slot>
</div>
</div>
</template>
<slot :loading="loading" :detail="detail"></slot>
</MsDrawer>
</template>
<script setup lang="ts">
import { computed, ref, watch } from 'vue';
import { useI18n } from '@/hooks/useI18n';
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
import type { MsPaginationI } from '@/components/pure/ms-table/type';
const props = defineProps<{
visible: boolean;
title: string;
width: number;
detailId: string | number; // id
detailIndex: number; //
tableData: any[]; //
pagination?: MsPaginationI; //
pageChange: (page: number) => Promise<void>; //
getDetailFunc: (id: string | number) => Promise<any>; //
}>();
const emit = defineEmits(['update:visible', 'loaded']);
const { t } = useI18n();
const innerVisible = ref(false);
watch(
() => props.visible,
(val) => {
innerVisible.value = val;
}
);
watch(
() => innerVisible.value,
(val) => {
emit('update:visible', val);
}
);
const loading = ref(false);
const detail = ref<any>({});
const activeDetailId = ref<string | number>(props.detailId);
async function initDetail() {
try {
loading.value = true;
await new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, 3000);
});
detail.value = await props.getDetailFunc(activeDetailId.value);
emit('loaded', detail.value);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
loading.value = false;
}
}
watch(
() => props.detailId,
(val) => {
activeDetailId.value = val;
}
);
const activeDetailIndex = ref(props.detailIndex);
watch(
() => props.detailIndex,
(val) => {
activeDetailIndex.value = val;
}
);
// 01
const activeDetailIsFirst = computed(() => activeDetailIndex.value === 0 && props.pagination?.current === 1);
const activeDetailIsLast = computed(
// *+
() =>
activeDetailIndex.value === props.tableData.length - 1 &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
props.pagination!.current * props.pagination!.pageSize + activeDetailIndex.value >=
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
props.pagination!.total
);
async function openPrevDetail() {
if (!activeDetailIsFirst.value) {
//
if (activeDetailIndex.value === 0 && props.pagination) {
try {
//
loading.value = true;
await props.pageChange(props.pagination.current - 1);
activeDetailId.value = props.tableData[props.tableData.length - 1].id;
activeDetailIndex.value = props.tableData.length - 1;
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
loading.value = false;
}
} else {
//
activeDetailId.value = props.tableData[activeDetailIndex.value - 1].id;
activeDetailIndex.value -= 1;
}
}
}
async function openNextDetail() {
if (!activeDetailIsLast.value) {
//
if (activeDetailIndex.value === props.tableData.length - 1 && props.pagination) {
try {
//
loading.value = true;
await props.pageChange(props.pagination.current + 1);
activeDetailId.value = props.tableData[0].id;
activeDetailIndex.value = 0;
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
loading.value = false;
}
} else {
//
activeDetailId.value = props.tableData[activeDetailIndex.value + 1].id;
activeDetailIndex.value += 1;
}
}
}
watch(
() => activeDetailId.value,
() => {
initDetail();
}
);
</script>
<style lang="less" scoped></style>

View File

@ -0,0 +1,6 @@
export default {
'ms.detail.drawer.prev': 'Prev',
'ms.detail.drawer.noPrev': 'Currently the first',
'ms.detail.drawer.next': 'Next',
'ms.detail.drawer.noNext': 'Currently the last one',
};

View File

@ -0,0 +1,6 @@
export default {
'ms.detail.drawer.prev': '上一个',
'ms.detail.drawer.noPrev': '当前已是第一个',
'ms.detail.drawer.next': '下一个',
'ms.detail.drawer.noNext': '当前已是最后一个',
};

View File

@ -25,7 +25,7 @@
height: props.autoHeight ? 'auto' : `calc(100vh - ${cardOverHeight}px)`,
}"
>
<div :class="[`min-w-[${props.minWidth || 1000}px]`]">
<div :style="{ minWidth: `${props.minWidth || 1000}px` }">
<slot></slot>
</div>
</a-scrollbar>

View File

@ -5,7 +5,7 @@
</slot>
<template #content>
<template v-for="item of props.list">
<a-divider v-if="item.isDivider" :key="`${item.label}-divider`" class="ms-dropdown-divider" />
<a-divider v-if="item.isDivider" :key="`${item.label}-divider`" margin="4px" />
<a-doption v-else :key="item.label" :class="item.danger ? 'error-6' : ''">{{ t(item.label || '') }}</a-doption>
</template>
</template>

View File

@ -20,10 +20,10 @@
<a-button type="outline"><MsIcon type="icon-icon_more_outlined" /></a-button>
<template #content>
<template v-for="element in props.actionConfig.moreAction" :key="element.label">
<a-divider v-if="element.isDivider" margin="0" />
<a-doption v-else :value="element" :class="{ delete: element.danger }">{{
t(element.label as string)
}}</a-doption>
<a-divider v-if="element.isDivider" margin="4px" />
<a-doption v-else :value="element" :class="{ delete: element.danger }">
{{ t(element.label as string) }}
</a-doption>
</template>
</template>
</a-dropdown>

View File

@ -1,55 +1,23 @@
<template>
<MsDrawer
<MsDetailDrawer
v-model:visible="innerVisible"
:width="960"
:footer="false"
class="ms-drawer"
no-content-padding
unmount-on-close
:title="t('project.fileManagement.detail')"
:detail-id="props.fileId"
:detail-index="props.activeFileIndex"
:get-detail-func="getFileDetail"
:pagination="props.pagination"
:table-data="props.tableData"
:page-change="props.pageChange"
@loaded="loadedFile"
>
<template #title>
<div class="flex w-full items-center">
{{ t('project.fileManagement.detail') }}
<a-tooltip
:content="isFirst ? t('project.fileManagement.noPrev') : t('project.fileManagement.prev')"
:mouse-enter-delay="300"
mini
>
<a-button
type="outline"
size="mini"
class="arco-btn-outline--secondary ml-[16px] mr-[4px]"
:disabled="isFirst || fileLoading"
@click="emit('prevFile')"
>
<template #icon>
<icon-left />
</template>
</a-button>
</a-tooltip>
<a-tooltip
:content="isLast ? t('project.fileManagement.noNext') : t('project.fileManagement.next')"
:mouse-enter-delay="300"
mini
>
<a-button
type="outline"
size="mini"
class="arco-btn-outline--secondary"
:disabled="isLast || fileLoading"
@click="emit('nextFile')"
>
<template #icon>
<icon-right />
</template>
</a-button>
</a-tooltip>
<div class="ml-auto flex items-center">
<template #titleRight="{ loading, detail }">
<a-switch
v-if="fileType === 'jar'"
:default-checked="fileDetail?.enable"
:default-checked="detail?.enable"
:before-change="handleEnableIntercept"
:disabled="fileLoading"
:disabled="loading"
size="small"
class="mr-[8px]"
/>
@ -57,28 +25,27 @@
type="icon"
status="secondary"
class="!rounded-[var(--border-radius-small)] !text-[var(--color-text-1)]"
:disabled="fileLoading"
:disabled="loading"
@click="handleDownload"
>
<MsIcon type="icon-icon_bottom-align_outlined" class="mr-[4px]" />
{{ t('project.fileManagement.download') }}
</MsButton>
<MsButton
v-if="fileDetail?.storage !== 'minio'"
v-if="detail?.storage !== 'minio'"
type="icon"
status="secondary"
class="!rounded-[var(--border-radius-small)] !text-[var(--color-text-1)]"
:disabled="fileLoading"
:disabled="loading"
>
<MsIcon type="icon-icon_reset_outlined" class="mr-[4px]" />
{{ t('project.fileManagement.updateFile') }}
</MsButton>
</div>
</div>
</template>
<template #default="{ loading, detail }">
<div class="flex h-full">
<div class="file-detail">
<a-skeleton v-if="fileLoading" :loading="fileLoading" :animation="true">
<a-skeleton v-if="loading" :loading="loading" :animation="true">
<a-skeleton-shape size="large" class="mb-[16px] h-[102px] w-[102px]" />
<a-space direction="vertical" class="w-[28%]" size="large">
<a-skeleton-line :rows="11" :line-height="24" />
@ -91,8 +58,8 @@
<div class="mb-[16px] w-[102px]">
<MsPreviewCard
mode="hover"
:type="fileDetail?.type"
:url="fileDetail?.url"
:type="detail?.type"
:url="detail?.url"
:footer-text="t('project.fileManagement.replaceFile')"
@click="handleFileIconClick"
/>
@ -141,7 +108,7 @@
mode="rename"
:title="t('project.fileManagement.desc')"
:field-config="{
field: item.value as string,
field: detail.desc,
placeholder: t('project.fileManagement.descPlaceholder'),
maxLength: 250,
isTextArea: true,
@ -157,7 +124,7 @@
</template>
</div>
<div class="file-relation">
<a-tabs v-model:active-key="activeTab" :disabled="fileLoading" class="no-content">
<a-tabs v-model:active-key="activeTab" :disabled="loading" class="no-content">
<a-tab-pane key="case" :title="t('project.fileManagement.cases')" />
<a-tab-pane key="version" :title="t('project.fileManagement.versionHistory')" />
</a-tabs>
@ -188,22 +155,27 @@
</MsButton>
</template>
</ms-base-table>
<ms-base-table v-if="activeTab === 'version'" v-bind="versionTableProps" no-disable v-on="versionTableEvent">
<ms-base-table
v-if="activeTab === 'version'"
v-bind="versionTableProps"
no-disable
v-on="versionTableEvent"
>
</ms-base-table>
</div>
</div>
</div>
<a-image-preview v-model:visible="previewVisible" :src="fileDetail?.url" />
</MsDrawer>
<a-image-preview v-model:visible="previewVisible" :src="detail?.url" />
</template>
</MsDetailDrawer>
</template>
<script setup lang="ts">
import { ref, watch, computed, watchEffect } from 'vue';
import { ref, watch, watchEffect } from 'vue';
import dayjs from 'dayjs';
import { useFileSystemAccess } from '@vueuse/core';
import { Message } from '@arco-design/web-vue';
import { useI18n } from '@/hooks/useI18n';
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
import MsButton from '@/components/pure/ms-button/index.vue';
import MsIcon from '@/components/pure/ms-icon-font/index.vue';
import { getFileEnum } from '@/components/pure/ms-upload/iconMap';
@ -213,29 +185,30 @@
import { getFileDetail, getFileCases, getFileVersions } from '@/api/modules/project-management/fileManagement';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import MsPreviewCard from '@/components/business/ms-thumbnail-card/index.vue';
import MsDetailDrawer from '@/components/business/ms-detail-drawer/index.vue';
import { TableKeyEnum } from '@/enums/tableEnum';
import { downloadUrlFile } from '@/utils';
import useLocale from '@/locale/useLocale';
import type { MsTableColumn } from '@/components/pure/ms-table/type';
import type { MsPaginationI, MsTableColumn } from '@/components/pure/ms-table/type';
const props = defineProps<{
visible: boolean;
fileId: string | number;
isFirst?: boolean;
isLast?: boolean;
activeFileIndex: number;
tableData: any[];
pagination?: MsPaginationI;
pageChange: (page: number) => Promise<void>;
}>();
const emit = defineEmits(['update:visible', 'prevFile', 'nextFile']);
const emit = defineEmits(['update:visible']);
const { file: newFile, open } = useFileSystemAccess();
const { t } = useI18n();
const { currentLocale } = useLocale();
const innerVisible = ref(false);
const fileDetail = ref();
const fileDescriptions = ref<Description[]>([]);
const fileLoading = ref(false);
watch(
() => props.visible,
@ -251,90 +224,6 @@
}
);
async function initFileDetail() {
try {
fileLoading.value = true;
await new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, 3000);
});
fileDetail.value = await getFileDetail(props.fileId);
fileDescriptions.value = [
{
label: t('project.fileManagement.name'),
value: fileDetail.value.name,
key: 'name',
},
{
label: t('project.fileManagement.desc'),
value: fileDetail.value.desc,
key: 'desc',
},
{
label: t('project.fileManagement.type'),
value: fileDetail.value.type,
},
{
label: t('project.fileManagement.size'),
value: fileDetail.value.size,
},
{
label: t('project.fileManagement.creator'),
value: fileDetail.value.creator,
},
{
label: t('project.fileManagement.fileModule'),
value: fileDetail.value.fileModule,
key: 'fileModule',
},
{
label: t('project.fileManagement.tag'),
value: fileDetail.value.tag,
isTag: true,
showTagAdd: true,
key: 'tag',
},
{
label: t('project.fileManagement.createTime'),
value: dayjs(fileDetail.value.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
if (fileDetail.value?.storage !== 'minio') {
fileDescriptions.value.splice(
3,
0,
...[
{
label: t('project.fileManagement.gitBranch'),
value: fileDetail.value.gitBranch,
},
{
label: t('project.fileManagement.gitPath'),
value: fileDetail.value.gitPath,
},
{
label: t('project.fileManagement.gitVersion'),
value: fileDetail.value.gitVersion,
},
]
);
}
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
fileLoading.value = false;
}
}
watch(
() => props.fileId,
() => {
initFileDetail();
}
);
async function handleEnableIntercept(newValue: string | number | boolean) {
await new Promise((resolve) => {
setTimeout(() => {
@ -344,16 +233,77 @@
return true;
}
function handleDownload() {
downloadUrlFile(fileDetail.value.url, fileDetail.value.name);
function handleDownload(detail: any) {
downloadUrlFile(detail.url, detail.name);
}
const fileType = computed(() => {
if (fileDetail.value?.type) {
return getFileEnum(`/${fileDetail.value.type.toLowerCase()}`);
const fileType = ref('unknown');
function loadedFile(detail: any) {
if (detail.type) {
fileType.value = getFileEnum(`/${detail.type.toLowerCase()}`);
}
fileDescriptions.value = [
{
label: t('project.fileManagement.name'),
value: detail.name,
key: 'name',
},
{
label: t('project.fileManagement.desc'),
value: detail.desc,
key: 'desc',
},
{
label: t('project.fileManagement.type'),
value: detail.type,
},
{
label: t('project.fileManagement.size'),
value: detail.size,
},
{
label: t('project.fileManagement.creator'),
value: detail.creator,
},
{
label: t('project.fileManagement.fileModule'),
value: detail.fileModule,
key: 'fileModule',
},
{
label: t('project.fileManagement.tag'),
value: detail.tag,
isTag: true,
showTagAdd: true,
key: 'tag',
},
{
label: t('project.fileManagement.createTime'),
value: dayjs(detail.createTime).format('YYYY-MM-DD HH:mm:ss'),
},
];
if (detail?.storage !== 'minio') {
fileDescriptions.value.splice(
3,
0,
...[
{
label: t('project.fileManagement.gitBranch'),
value: detail.gitBranch,
},
{
label: t('project.fileManagement.gitPath'),
value: detail.gitPath,
},
{
label: t('project.fileManagement.gitVersion'),
value: detail.gitVersion,
},
]
);
}
}
return 'unknown';
});
watch(
() => newFile.value,

View File

@ -239,10 +239,10 @@
<fileDetailDrawerVue
v-model:visible="showDetailDrawer"
:file-id="activeFileId"
:is-first="activeFileIsFirst"
:is-last="activeFileIsLast"
@prev-file="openPrevFile"
@next-file="openNextFile"
:active-file-index="activeFileIndex"
:table-data="propsRes.data"
:page-change="propsEvent.pageChange"
:pagination="propsRes.msPagination"
/>
</template>
@ -629,17 +629,6 @@
const showDetailDrawer = ref(false);
const activeFileId = ref<string | number>('');
const activeFileIndex = ref(0);
// 01
const activeFileIsFirst = computed(() => activeFileIndex.value === 0 && propsRes.value.msPagination?.current === 1);
const activeFileIsLast = computed(
// *+
() =>
activeFileIndex.value === propsRes.value.data.length - 1 &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
propsRes.value.msPagination!.current * propsRes.value.msPagination!.pageSize + activeFileIndex.value >=
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
propsRes.value.msPagination!.total
);
async function openFileDetail(id: string | number, index: number) {
showDetailDrawer.value = true;
@ -647,38 +636,6 @@
activeFileIndex.value = index;
}
async function openPrevFile() {
if (!activeFileIsFirst.value) {
//
if (activeFileIndex.value === 0 && propsRes.value.msPagination) {
//
await propsEvent.value.pageChange(propsRes.value.msPagination.current - 1);
activeFileId.value = propsRes.value.data[propsRes.value.data.length - 1].id;
activeFileIndex.value = propsRes.value.data.length - 1;
} else {
//
activeFileId.value = propsRes.value.data[activeFileIndex.value - 1].id;
activeFileIndex.value -= 1;
}
}
}
async function openNextFile() {
if (!activeFileIsLast.value) {
//
if (activeFileIndex.value === propsRes.value.data.length - 1 && propsRes.value.msPagination) {
//
await propsEvent.value.pageChange(propsRes.value.msPagination.current + 1);
activeFileId.value = propsRes.value.data[0].id;
activeFileIndex.value = 0;
} else {
//
activeFileId.value = propsRes.value.data[activeFileIndex.value + 1].id;
activeFileIndex.value += 1;
}
}
}
const uploadDrawerVisible = ref(false); // -
const fileList = ref<MsFileItem[]>(asyncTaskStore.uploadFileTask.fileList);
//

View File

@ -3,7 +3,11 @@
<template #title>
{{ batchTitle }}
<div class="text-[var(--color-text-4)]">
{{ t('system.user.batchModalSubTitle', { count: props.tableSelected.length }) }}
{{
t('system.user.batchModalSubTitle', {
count: props.batchParams?.currentSelectCount || props.tableSelected.length,
})
}}
</div>
</template>
<a-spin :loading="loading">
@ -47,6 +51,7 @@
import MsTransfer from '@/components/pure/ms-transfer/index.vue';
import type { OrgsItem } from '@/models/setting/user';
import type { BatchActionQueryParams } from '@/components/pure/ms-table/type';
const { t } = useI18n();
@ -55,13 +60,15 @@
tableSelected: (string | number)[];
visible: boolean;
action: string;
batchParams?: BatchActionQueryParams;
keyword?: string;
}>(),
{
visible: false,
}
);
const emit = defineEmits(['update:visible']);
const emit = defineEmits(['update:visible', 'finished']);
const showBatchModal = ref(false);
const batchTitle = ref('');
@ -136,8 +143,11 @@
try {
const params = {
selectIds: props.tableSelected as string[],
selectAll: false,
condition: {},
selectAll: !!props.batchParams?.selectAll,
excludeIds: props.batchParams?.excludeIds,
condition: {
keyword: props.keyword,
},
roleIds: target.value,
};
switch (batchModalMode.value) {
@ -155,6 +165,7 @@
}
Message.success(t('system.user.batchModalSuccess'));
showBatchModal.value = false;
emit('finished');
} catch (error) {
console.log(error);
} finally {

View File

@ -174,7 +174,14 @@
</template>
</a-modal>
<inviteModal v-model:visible="inviteVisible" :user-group-options="userGroupOptions"></inviteModal>
<batchModal v-model:visible="showBatchModal" :table-selected="tableSelected" :action="batchAction"></batchModal>
<batchModal
v-model:visible="showBatchModal"
:table-selected="tableSelected"
:action="batchAction"
:batch-params="batchModalParams"
:keyword="keyword"
@finished="resetSelector"
></batchModal>
</template>
<script setup lang="ts">
@ -210,7 +217,7 @@
import MsTagGroup from '@/components/pure/ms-tag/ms-tag-group.vue';
import type { FormInstance, ValidatedError, FileItem } from '@arco-design/web-vue';
import type { MsTableColumn, BatchActionParams } from '@/components/pure/ms-table/type';
import type { MsTableColumn, BatchActionParams, BatchActionQueryParams } from '@/components/pure/ms-table/type';
import type { ActionsItem } from '@/components/pure/ms-table-more-action/types';
import type { SimpleUserInfo, SystemRole, UserListItem } from '@/models/setting/user';
import type { FormItemModel, MsBatchFormInstance } from '@/components/business/ms-batch-form/types';
@ -257,12 +264,12 @@
slotName: 'action',
dataIndex: 'operation',
fixed: 'right',
width: 90,
width: 110,
},
];
const tableStore = useTableStore();
tableStore.initColumn(TableKeyEnum.SYSTEM_USER, columns, 'drawer');
const { propsRes, propsEvent, loadList, setKeyword } = useTable(
const { propsRes, propsEvent, loadList, setKeyword, resetSelector } = useTable(
getUserList,
{
tableKey: TableKeyEnum.SYSTEM_USER,
@ -298,11 +305,11 @@
/**
* 重置密码
*/
function resetPassword(record?: UserListItem, isBatch?: boolean) {
function resetPassword(record?: UserListItem, isBatch?: boolean, params?: BatchActionQueryParams) {
let title = t('system.user.resetPswTip', { name: characterLimit(record?.name) });
let selectIds = [record?.id || ''];
if (isBatch) {
title = t('system.user.batchResetPswTip', { count: tableSelected.value.length });
title = t('system.user.batchResetPswTip', { count: params?.currentSelectCount || tableSelected.value.length });
selectIds = tableSelected.value as string[];
}
openModal({
@ -315,11 +322,14 @@
try {
await resetUserPassword({
selectIds,
selectAll: false,
condition: {},
selectAll: !!params?.selectAll,
excludeIds: params?.excludeIds || [],
condition: { keyword: keyword.value },
});
Message.success(t('system.user.resetPswSuccess'));
resetSelector();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
@ -330,11 +340,11 @@
/**
* 禁用用户
*/
function disabledUser(record?: UserListItem, isBatch?: boolean) {
function disabledUser(record?: UserListItem, isBatch?: boolean, params?: BatchActionQueryParams) {
let title = t('system.user.disableUserTip', { name: characterLimit(record?.name) });
let selectIds = [record?.id || ''];
if (isBatch) {
title = t('system.user.batchDisableUserTip', { count: tableSelected.value.length });
title = t('system.user.batchDisableUserTip', { count: params?.currentSelectCount || tableSelected.value.length });
selectIds = tableSelected.value as string[];
}
openModal({
@ -348,13 +358,16 @@
try {
await toggleUserStatus({
selectIds,
selectAll: false,
condition: {},
selectAll: !!params?.selectAll,
excludeIds: params?.excludeIds || [],
condition: { keyword: keyword.value },
enable: false,
});
Message.success(t('system.user.disableUserSuccess'));
resetSelector();
loadList();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
@ -365,11 +378,11 @@
/**
* 启用用户
*/
function enableUser(record?: UserListItem, isBatch?: boolean) {
function enableUser(record?: UserListItem, isBatch?: boolean, params?: BatchActionQueryParams) {
let title = t('system.user.enableUserTip', { name: characterLimit(record?.name) });
let selectIds = [record?.id || ''];
if (isBatch) {
title = t('system.user.batchEnableUserTip', { count: tableSelected.value.length });
title = t('system.user.batchEnableUserTip', { count: params?.currentSelectCount || tableSelected.value.length });
selectIds = tableSelected.value as string[];
}
openModal({
@ -383,13 +396,16 @@
try {
await toggleUserStatus({
selectIds,
selectAll: false,
condition: {},
selectAll: !!params?.selectAll,
excludeIds: params?.excludeIds || [],
condition: { keyword: keyword.value },
enable: true,
});
Message.success(t('system.user.enableUserSuccess'));
resetSelector();
loadList();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
@ -400,11 +416,11 @@
/**
* 删除用户
*/
function deleteUser(record?: UserListItem, isBatch?: boolean) {
function deleteUser(record?: UserListItem, isBatch?: boolean, params?: BatchActionQueryParams) {
let title = t('system.user.deleteUserTip', { name: characterLimit(record?.name) });
let selectIds = [record?.id || ''];
if (isBatch) {
title = t('system.user.batchDeleteUserTip', { count: tableSelected.value.length });
title = t('system.user.batchDeleteUserTip', { count: params?.currentSelectCount || tableSelected.value.length });
selectIds = tableSelected.value as string[];
}
openModal({
@ -421,12 +437,15 @@
try {
await deleteUserInfo({
selectIds,
selectAll: false,
condition: {},
selectAll: !!params?.selectAll,
excludeIds: params?.excludeIds || [],
condition: { keyword: keyword.value },
});
Message.success(t('system.user.deleteUserSuccess'));
resetSelector();
loadList();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
},
@ -494,30 +513,32 @@
const showBatchModal = ref(false);
const batchAction = ref(''); //
const batchModalParams = ref();
/**
* 处理表格选中后批量操作
* @param event 批量操作事件对象
*/
function handleTableBatch(event: BatchActionParams) {
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
switch (event.eventTag) {
case 'batchAddProject':
case 'batchAddUserGroup':
case 'batchAddOrganization':
batchAction.value = event.eventTag;
batchModalParams.value = params;
showBatchModal.value = true;
break;
case 'resetPassword':
resetPassword(undefined, true);
resetPassword(undefined, true, params);
break;
case 'disabled':
disabledUser(undefined, true);
disabledUser(undefined, true, params);
break;
case 'enable':
enableUser(undefined, true);
enableUser(undefined, true, params);
break;
case 'delete':
deleteUser(undefined, true);
deleteUser(undefined, true, params);
break;
default:
break;
@ -577,6 +598,7 @@
.map((e: SystemRole) => e.id);
}
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
@ -740,6 +762,7 @@
userForm.value.list = [...list];
await cb();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
loading.value = false;
@ -852,6 +875,7 @@
importFailCount.value = failCount;
showImportResult();
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
importLoading.value = false;