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, updateTime: 18975439859,
createTime: 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>> { export function getFileList(data: TableQueryParams): Promise<CommonList<any>> {

View File

@ -219,7 +219,7 @@
@apply overflow-hidden; @apply overflow-hidden;
.ms-container--shadow(); .ms-container--shadow();
.ms-card-list { .ms-card-list {
@apply grid h-full overflow-auto; @apply grid overflow-auto;
.ms-scroll-bar(); .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)`, 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> <slot></slot>
</div> </div>
</a-scrollbar> </a-scrollbar>

View File

@ -5,7 +5,7 @@
</slot> </slot>
<template #content> <template #content>
<template v-for="item of props.list"> <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> <a-doption v-else :key="item.label" :class="item.danger ? 'error-6' : ''">{{ t(item.label || '') }}</a-doption>
</template> </template>
</template> </template>

View File

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

View File

@ -1,209 +1,181 @@
<template> <template>
<MsDrawer <MsDetailDrawer
v-model:visible="innerVisible" v-model:visible="innerVisible"
:width="960" :width="960"
:footer="false" :footer="false"
class="ms-drawer" :title="t('project.fileManagement.detail')"
no-content-padding :detail-id="props.fileId"
unmount-on-close :detail-index="props.activeFileIndex"
:get-detail-func="getFileDetail"
:pagination="props.pagination"
:table-data="props.tableData"
:page-change="props.pageChange"
@loaded="loadedFile"
> >
<template #title> <template #titleRight="{ loading, detail }">
<div class="flex w-full items-center"> <a-switch
{{ t('project.fileManagement.detail') }} v-if="fileType === 'jar'"
<a-tooltip :default-checked="detail?.enable"
:content="isFirst ? t('project.fileManagement.noPrev') : t('project.fileManagement.prev')" :before-change="handleEnableIntercept"
:mouse-enter-delay="300" :disabled="loading"
mini size="small"
> class="mr-[8px]"
<a-button />
type="outline" <MsButton
size="mini" type="icon"
class="arco-btn-outline--secondary ml-[16px] mr-[4px]" status="secondary"
:disabled="isFirst || fileLoading" class="!rounded-[var(--border-radius-small)] !text-[var(--color-text-1)]"
@click="emit('prevFile')" :disabled="loading"
> @click="handleDownload"
<template #icon> >
<icon-left /> <MsIcon type="icon-icon_bottom-align_outlined" class="mr-[4px]" />
</template> {{ t('project.fileManagement.download') }}
</a-button> </MsButton>
</a-tooltip> <MsButton
<a-tooltip v-if="detail?.storage !== 'minio'"
:content="isLast ? t('project.fileManagement.noNext') : t('project.fileManagement.next')" type="icon"
:mouse-enter-delay="300" status="secondary"
mini class="!rounded-[var(--border-radius-small)] !text-[var(--color-text-1)]"
> :disabled="loading"
<a-button >
type="outline" <MsIcon type="icon-icon_reset_outlined" class="mr-[4px]" />
size="mini" {{ t('project.fileManagement.updateFile') }}
class="arco-btn-outline--secondary" </MsButton>
:disabled="isLast || fileLoading"
@click="emit('nextFile')"
>
<template #icon>
<icon-right />
</template>
</a-button>
</a-tooltip>
<div class="ml-auto flex items-center">
<a-switch
v-if="fileType === 'jar'"
:default-checked="fileDetail?.enable"
:before-change="handleEnableIntercept"
:disabled="fileLoading"
size="small"
class="mr-[8px]"
/>
<MsButton
type="icon"
status="secondary"
class="!rounded-[var(--border-radius-small)] !text-[var(--color-text-1)]"
:disabled="fileLoading"
@click="handleDownload"
>
<MsIcon type="icon-icon_bottom-align_outlined" class="mr-[4px]" />
{{ t('project.fileManagement.download') }}
</MsButton>
<MsButton
v-if="fileDetail?.storage !== 'minio'"
type="icon"
status="secondary"
class="!rounded-[var(--border-radius-small)] !text-[var(--color-text-1)]"
:disabled="fileLoading"
>
<MsIcon type="icon-icon_reset_outlined" class="mr-[4px]" />
{{ t('project.fileManagement.updateFile') }}
</MsButton>
</div>
</div>
</template> </template>
<div class="flex h-full"> <template #default="{ loading, detail }">
<div class="file-detail"> <div class="flex h-full">
<a-skeleton v-if="fileLoading" :loading="fileLoading" :animation="true"> <div class="file-detail">
<a-skeleton-shape size="large" class="mb-[16px] h-[102px] w-[102px]" /> <a-skeleton v-if="loading" :loading="loading" :animation="true">
<a-space direction="vertical" class="w-[28%]" size="large"> <a-skeleton-shape size="large" class="mb-[16px] h-[102px] w-[102px]" />
<a-skeleton-line :rows="11" :line-height="24" /> <a-space direction="vertical" class="w-[28%]" size="large">
</a-space> <a-skeleton-line :rows="11" :line-height="24" />
<a-space direction="vertical" class="ml-[4%] w-[68%]" size="large"> </a-space>
<a-skeleton-line :rows="11" :line-height="24" /> <a-space direction="vertical" class="ml-[4%] w-[68%]" size="large">
</a-space> <a-skeleton-line :rows="11" :line-height="24" />
</a-skeleton> </a-space>
<template v-else> </a-skeleton>
<div class="mb-[16px] w-[102px]"> <template v-else>
<MsPreviewCard <div class="mb-[16px] w-[102px]">
mode="hover" <MsPreviewCard
:type="fileDetail?.type" mode="hover"
:url="fileDetail?.url" :type="detail?.type"
:footer-text="t('project.fileManagement.replaceFile')" :url="detail?.url"
@click="handleFileIconClick" :footer-text="t('project.fileManagement.replaceFile')"
/> @click="handleFileIconClick"
</div> />
<MsDescription </div>
:descriptions="fileDescriptions" <MsDescription
:label-width="currentLocale === 'zh-CN' ? '80px' : '100px'" :descriptions="fileDescriptions"
:add-tag-func="addFileTag" :label-width="currentLocale === 'zh-CN' ? '80px' : '100px'"
> :add-tag-func="addFileTag"
<template #value="{ item }"> >
<div class="flex flex-wrap items-center"> <template #value="{ item }">
<a-tooltip <div class="flex flex-wrap items-center">
:content="(item.value as string)" <a-tooltip
:mouse-enter-delay="300" :content="(item.value as string)"
:disabled="item.value === undefined || item.value === null || item.value?.toString() === ''" :mouse-enter-delay="300"
mini :disabled="item.value === undefined || item.value === null || item.value?.toString() === ''"
> mini
<div :class="['one-line-text', 'flex-1']">
{{
item.value === undefined || item.value === null || item.value?.toString() === ''
? '-'
: item.value
}}
</div>
</a-tooltip>
<template v-if="item.key === 'name'">
<popConfirm
mode="rename"
:field-config="{ placeholder: t('project.fileManagement.fileNamePlaceholder') }"
:all-names="[]"
> >
<MsButton class="!mr-0 ml-[8px]">{{ t('common.rename') }}</MsButton> <div :class="['one-line-text', 'flex-1']">
</popConfirm> {{
<template v-if="fileType === 'image'"> item.value === undefined || item.value === null || item.value?.toString() === ''
<a-divider ? '-'
direction="vertical" : item.value
class="mx-[8px] min-h-[12px] rounded-[var(--border-radius-small)]" }}
/> </div>
<MsButton class="ml-0" @click="previewVisible = true"> </a-tooltip>
{{ t('common.preview') }} <template v-if="item.key === 'name'">
</MsButton> <popConfirm
mode="rename"
:field-config="{ placeholder: t('project.fileManagement.fileNamePlaceholder') }"
:all-names="[]"
>
<MsButton class="!mr-0 ml-[8px]">{{ t('common.rename') }}</MsButton>
</popConfirm>
<template v-if="fileType === 'image'">
<a-divider
direction="vertical"
class="mx-[8px] min-h-[12px] rounded-[var(--border-radius-small)]"
/>
<MsButton class="ml-0" @click="previewVisible = true">
{{ t('common.preview') }}
</MsButton>
</template>
</template> </template>
</template> <template v-if="item.key === 'desc'">
<template v-if="item.key === 'desc'"> <popConfirm
<popConfirm mode="rename"
mode="rename" :title="t('project.fileManagement.desc')"
:title="t('project.fileManagement.desc')" :field-config="{
:field-config="{ field: detail.desc,
field: item.value as string, placeholder: t('project.fileManagement.descPlaceholder'),
placeholder: t('project.fileManagement.descPlaceholder'), maxLength: 250,
maxLength: 250, isTextArea: true,
isTextArea: true, }"
}" :all-names="[]"
:all-names="[]" >
> <MsButton class="ml-[8px]"><MsIcon type="icon-icon_edit_outlined"></MsIcon></MsButton>
<MsButton class="ml-[8px]"><MsIcon type="icon-icon_edit_outlined"></MsIcon></MsButton> </popConfirm>
</popConfirm> </template>
</template> </div>
</div> </template>
</template> </MsDescription>
</MsDescription> </template>
</template>
</div>
<div class="file-relation">
<a-tabs v-model:active-key="activeTab" :disabled="fileLoading" 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>
<div class="h-[16px] bg-[var(--color-text-n9)]"></div>
<div v-if="activeTab === 'case'" class="flex items-center justify-between p-[16px]">
<div class="text-[var(--color-text-1)]">{{ t('project.fileManagement.caseList') }}</div>
<a-input-search
v-model:model-value="keyword"
:placeholder="t('project.fileManagement.search')"
allow-clear
class="w-[240px]"
@press-enter="searchCase"
@search="searchCase"
>
</a-input-search>
</div> </div>
<div class="p-[16px]"> <div class="file-relation">
<ms-base-table <a-tabs v-model:active-key="activeTab" :disabled="loading" class="no-content">
v-if="activeTab === 'case'" <a-tab-pane key="case" :title="t('project.fileManagement.cases')" />
v-bind="caseTableProps" <a-tab-pane key="version" :title="t('project.fileManagement.versionHistory')" />
no-disable </a-tabs>
:action-config="caseBatchActions" <div class="h-[16px] bg-[var(--color-text-n9)]"></div>
v-on="caseTableEvent" <div v-if="activeTab === 'case'" class="flex items-center justify-between p-[16px]">
> <div class="text-[var(--color-text-1)]">{{ t('project.fileManagement.caseList') }}</div>
<template #action="{ record }"> <a-input-search
<MsButton type="text" class="mr-[8px]" @click="updateCase(record)"> v-model:model-value="keyword"
{{ t('project.fileManagement.updateCaseFile') }} :placeholder="t('project.fileManagement.search')"
</MsButton> allow-clear
</template> class="w-[240px]"
</ms-base-table> @press-enter="searchCase"
<ms-base-table v-if="activeTab === 'version'" v-bind="versionTableProps" no-disable v-on="versionTableEvent"> @search="searchCase"
</ms-base-table> >
</a-input-search>
</div>
<div class="p-[16px]">
<ms-base-table
v-if="activeTab === 'case'"
v-bind="caseTableProps"
no-disable
:action-config="caseBatchActions"
v-on="caseTableEvent"
>
<template #action="{ record }">
<MsButton type="text" class="mr-[8px]" @click="updateCase(record)">
{{ t('project.fileManagement.updateCaseFile') }}
</MsButton>
</template>
</ms-base-table>
<ms-base-table
v-if="activeTab === 'version'"
v-bind="versionTableProps"
no-disable
v-on="versionTableEvent"
>
</ms-base-table>
</div>
</div> </div>
</div> </div>
</div> <a-image-preview v-model:visible="previewVisible" :src="detail?.url" />
<a-image-preview v-model:visible="previewVisible" :src="fileDetail?.url" /> </template>
</MsDrawer> </MsDetailDrawer>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch, computed, watchEffect } from 'vue'; import { ref, watch, watchEffect } from 'vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { useFileSystemAccess } from '@vueuse/core'; import { useFileSystemAccess } from '@vueuse/core';
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import MsIcon from '@/components/pure/ms-icon-font/index.vue'; import MsIcon from '@/components/pure/ms-icon-font/index.vue';
import { getFileEnum } from '@/components/pure/ms-upload/iconMap'; import { getFileEnum } from '@/components/pure/ms-upload/iconMap';
@ -213,29 +185,30 @@
import { getFileDetail, getFileCases, getFileVersions } from '@/api/modules/project-management/fileManagement'; import { getFileDetail, getFileCases, getFileVersions } from '@/api/modules/project-management/fileManagement';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import MsPreviewCard from '@/components/business/ms-thumbnail-card/index.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 { TableKeyEnum } from '@/enums/tableEnum';
import { downloadUrlFile } from '@/utils'; import { downloadUrlFile } from '@/utils';
import useLocale from '@/locale/useLocale'; 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<{ const props = defineProps<{
visible: boolean; visible: boolean;
fileId: string | number; fileId: string | number;
isFirst?: boolean; activeFileIndex: number;
isLast?: boolean; 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 { file: newFile, open } = useFileSystemAccess();
const { t } = useI18n(); const { t } = useI18n();
const { currentLocale } = useLocale(); const { currentLocale } = useLocale();
const innerVisible = ref(false); const innerVisible = ref(false);
const fileDetail = ref();
const fileDescriptions = ref<Description[]>([]); const fileDescriptions = ref<Description[]>([]);
const fileLoading = ref(false);
watch( watch(
() => props.visible, () => 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) { async function handleEnableIntercept(newValue: string | number | boolean) {
await new Promise((resolve) => { await new Promise((resolve) => {
setTimeout(() => { setTimeout(() => {
@ -344,16 +233,77 @@
return true; return true;
} }
function handleDownload() { function handleDownload(detail: any) {
downloadUrlFile(fileDetail.value.url, fileDetail.value.name); downloadUrlFile(detail.url, detail.name);
} }
const fileType = computed(() => { const fileType = ref('unknown');
if (fileDetail.value?.type) {
return getFileEnum(`/${fileDetail.value.type.toLowerCase()}`); function loadedFile(detail: any) {
if (detail.type) {
fileType.value = getFileEnum(`/${detail.type.toLowerCase()}`);
} }
return 'unknown'; 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,
},
]
);
}
}
watch( watch(
() => newFile.value, () => newFile.value,

View File

@ -239,10 +239,10 @@
<fileDetailDrawerVue <fileDetailDrawerVue
v-model:visible="showDetailDrawer" v-model:visible="showDetailDrawer"
:file-id="activeFileId" :file-id="activeFileId"
:is-first="activeFileIsFirst" :active-file-index="activeFileIndex"
:is-last="activeFileIsLast" :table-data="propsRes.data"
@prev-file="openPrevFile" :page-change="propsEvent.pageChange"
@next-file="openNextFile" :pagination="propsRes.msPagination"
/> />
</template> </template>
@ -629,17 +629,6 @@
const showDetailDrawer = ref(false); const showDetailDrawer = ref(false);
const activeFileId = ref<string | number>(''); const activeFileId = ref<string | number>('');
const activeFileIndex = ref(0); 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) { async function openFileDetail(id: string | number, index: number) {
showDetailDrawer.value = true; showDetailDrawer.value = true;
@ -647,38 +636,6 @@
activeFileIndex.value = index; 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 uploadDrawerVisible = ref(false); // -
const fileList = ref<MsFileItem[]>(asyncTaskStore.uploadFileTask.fileList); const fileList = ref<MsFileItem[]>(asyncTaskStore.uploadFileTask.fileList);
// //

View File

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

View File

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