feat: 删除文件夹审批预览
This commit is contained in:
@@ -9,47 +9,52 @@
|
||||
@updateNav="updateNavFun"
|
||||
>
|
||||
<template #options>
|
||||
<el-button :icon="Plus" class="options" type="primary" @click="appendFun({})">
|
||||
<el-button
|
||||
v-if="!readonly"
|
||||
:icon="Plus"
|
||||
class="options"
|
||||
type="primary"
|
||||
@click="appendFun({})"
|
||||
>
|
||||
{{ $t('知识库.新增') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template #treeAction="{ data }">
|
||||
<!-- 新增子目录 -->
|
||||
<el-tooltip
|
||||
v-if="parsePermission(data.permissionValue).write"
|
||||
:content="$t('知识库.新增子目录')"
|
||||
placement="top"
|
||||
>
|
||||
<el-button type="primary" link @click.stop="appendFun(data)">
|
||||
<el-icon><FolderAdd /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<!-- 编辑目录 -->
|
||||
<el-tooltip
|
||||
v-if="parsePermission(data.permissionValue).write"
|
||||
:content="$t('通用.编辑')"
|
||||
placement="top"
|
||||
>
|
||||
<el-button type="primary" link @click.stop="updateFun(data)">
|
||||
<el-icon><EditPen /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<!-- 删除目录 -->
|
||||
<el-tooltip
|
||||
v-if="parsePermission(data.permissionValue).delete"
|
||||
:content="$t('通用.删除')"
|
||||
placement="top"
|
||||
>
|
||||
<el-button type="danger" link @click.stop="confirmRemoveFun(data)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<template v-if="!readonly">
|
||||
<el-tooltip
|
||||
v-if="parsePermission(data.permissionValue).write"
|
||||
:content="$t('知识库.新增子目录')"
|
||||
placement="top"
|
||||
>
|
||||
<el-button type="primary" link @click.stop="appendFun(data)">
|
||||
<el-icon><FolderAdd /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
v-if="parsePermission(data.permissionValue).write"
|
||||
:content="$t('通用.编辑')"
|
||||
placement="top"
|
||||
>
|
||||
<el-button type="primary" link @click.stop="updateFun(data)">
|
||||
<el-icon><EditPen /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
v-if="parsePermission(data.permissionValue).delete"
|
||||
:content="$t('通用.删除')"
|
||||
placement="top"
|
||||
>
|
||||
<el-button type="danger" link @click.stop="confirmRemoveFun(data)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</template>
|
||||
<template #table>
|
||||
<div class="right-table">
|
||||
<div class="search">
|
||||
<TableSearch
|
||||
v-if="searchItems.length > 0"
|
||||
v-if="searchItems.length > 0 && !readonly"
|
||||
ref="tableSearchRef"
|
||||
:searchItems="searchItems"
|
||||
@search="searchFun"
|
||||
@@ -59,7 +64,7 @@
|
||||
<div class="table">
|
||||
<BaseTable
|
||||
ref="baseTableRef"
|
||||
:tableName="tableName"
|
||||
:tableName="dynamicTableName"
|
||||
:api="apiName"
|
||||
:params="searchParams"
|
||||
showIndex
|
||||
@@ -74,7 +79,7 @@
|
||||
@cell-dblclick="onCellDblclickFun"
|
||||
>
|
||||
<template #leftOptions>
|
||||
<div>
|
||||
<div v-if="!readonly">
|
||||
<el-button
|
||||
:icon="DArrowLeft"
|
||||
:disabled="navList.length <= 1"
|
||||
@@ -143,7 +148,7 @@
|
||||
v-model="visible"
|
||||
:detail="currentRow"
|
||||
:folder="currentFolder"
|
||||
:tableName="tableName"
|
||||
:tableName="dynamicTableName"
|
||||
:moduleCode="moduleCode"
|
||||
:itemNum="needApproval ? 6 : 5"
|
||||
:confirmLoading="confirmLoading"
|
||||
@@ -231,24 +236,52 @@ import PoolTaskSelect from '@/components/pool/poolTaskSelect.vue';
|
||||
import { parsePermission } from '@/utils/permission';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { TABLE_NAME } from '@/utils/enum/tableName';
|
||||
import { DIR_TYPE } from '@/utils/enum/data';
|
||||
|
||||
interface Props {
|
||||
tableName?: string;
|
||||
dirType: number;
|
||||
needApproval?: boolean;
|
||||
moduleCode?: string;
|
||||
readonly?: boolean;
|
||||
targetFolder?: any;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
tableName: TABLE_NAME.ANIMATION_LIBRARY,
|
||||
needApproval: false,
|
||||
moduleCode: '',
|
||||
readonly: false,
|
||||
targetFolder: null,
|
||||
});
|
||||
|
||||
const dynamicTableName = computed(() => {
|
||||
if (props.dirType === DIR_TYPE.TOLERANCE_ANALYSIS) {
|
||||
return TABLE_NAME.TOLERANCE_ANALYSIS;
|
||||
}
|
||||
if (props.dirType === DIR_TYPE.KNOWLEDGE) {
|
||||
return TABLE_NAME.SIMULATION_KNOWLEDGE;
|
||||
}
|
||||
return props.tableName || TABLE_NAME.SIMULATION_KNOWLEDGE;
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const CALLBACK_FLAG = computed(() => route.path);
|
||||
|
||||
const listDirApi = (params: any) => {
|
||||
const listDirApi = async (params: any) => {
|
||||
if (props.readonly && props.targetFolder?.id) {
|
||||
if (!params.parentDirId) {
|
||||
return {
|
||||
code: 200,
|
||||
success: true,
|
||||
data: [props.targetFolder],
|
||||
};
|
||||
}
|
||||
return dataListDirApi({
|
||||
...params,
|
||||
dirType: props.dirType,
|
||||
});
|
||||
}
|
||||
return dataListDirApi({ ...params, dirType: props.dirType });
|
||||
};
|
||||
|
||||
@@ -419,6 +452,7 @@ const actionList = computed(() => {
|
||||
type: 'primary',
|
||||
click: (row: any) => editFileFun(row),
|
||||
hide: (row: any) =>
|
||||
props.readonly ||
|
||||
row.dataType !== 2 ||
|
||||
row.approvalStatus === 'pending' ||
|
||||
!parsePermission(row.permissionValue).write,
|
||||
@@ -432,6 +466,7 @@ const actionList = computed(() => {
|
||||
type: 'danger',
|
||||
click: (row: any) => delFileWithApprovalFun(row),
|
||||
hide: (row: any) =>
|
||||
props.readonly ||
|
||||
row.dataType !== 2 ||
|
||||
row.approvalStatus === 'pending' ||
|
||||
!parsePermission(row.permissionValue).delete,
|
||||
@@ -444,6 +479,7 @@ const actionList = computed(() => {
|
||||
confirmTip: t('通用.确认删除吗'),
|
||||
click: (row: any) => delFileFun(row),
|
||||
hide: (row: any) =>
|
||||
props.readonly ||
|
||||
row.dataType !== 2 ||
|
||||
row.approvalStatus === 'pending' ||
|
||||
!parsePermission(row.permissionValue).delete,
|
||||
@@ -664,6 +700,10 @@ const uploadFinishedFun = (data: any) => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (props.readonly && props.targetFolder?.id) {
|
||||
currentFolder.value = props.targetFolder;
|
||||
memoryFolder.value = currentFolder.value;
|
||||
}
|
||||
emitter.on('UPLOAD_FINISHED', uploadFinishedFun);
|
||||
});
|
||||
|
||||
|
||||
@@ -6,30 +6,34 @@
|
||||
<el-tag type="primary">{{ knowledgeBaseName }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<BaseTable
|
||||
ref="baseTableRef"
|
||||
:tableName="TABLE_NAME.SIMULATION_KNOWLEDGE_APPROVE_PREVIEW"
|
||||
showIndex
|
||||
:actionList="actionList"
|
||||
:data="knowledgeList"
|
||||
hidePagination
|
||||
>
|
||||
<template #originalName="{ row }">
|
||||
<el-icon v-if="row.dataType === 1">
|
||||
<Folder />
|
||||
</el-icon>
|
||||
<el-icon v-else>
|
||||
<Document />
|
||||
</el-icon>
|
||||
{{ row.originalName }}
|
||||
</template>
|
||||
<template #fileSize="{ row }">
|
||||
{{ formatFileSize(row.fileSize) }}
|
||||
</template>
|
||||
<template #poolInfos="{ row }">
|
||||
<PoolTaskSelect :modelValue="row.poolInfos" :editable="false" />
|
||||
</template>
|
||||
</BaseTable>
|
||||
<div v-if="!showTree">
|
||||
<BaseTable
|
||||
ref="baseTableRef"
|
||||
:tableName="TABLE_NAME.SIMULATION_KNOWLEDGE_APPROVE_PREVIEW"
|
||||
showIndex
|
||||
:actionList="actionList"
|
||||
:data="knowledgeList"
|
||||
hidePagination
|
||||
>
|
||||
<template #fileSize="{ row }">
|
||||
{{ formatFileSize(row.fileSize) }}
|
||||
</template>
|
||||
<template #poolInfos="{ row }">
|
||||
<PoolTaskSelect :modelValue="row.poolInfos" :editable="false" />
|
||||
</template>
|
||||
</BaseTable>
|
||||
</div>
|
||||
|
||||
<div class="library-page" v-else>
|
||||
<ResourceLibraryPage
|
||||
v-if="folder.id"
|
||||
:dirType="folder.dirType"
|
||||
needApproval
|
||||
readonly
|
||||
:targetFolder="folder"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<FilePreview v-model="previewVisible" :fileId="currentRow?.id" />
|
||||
</template>
|
||||
|
||||
@@ -37,6 +41,7 @@
|
||||
import { computed, ref, watchEffect } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import BaseTable from '@/components/common/table/baseTable.vue';
|
||||
import ResourceLibraryPage from '@/components/common/resourceLibrary/resourceLibraryPage.vue';
|
||||
import approvalTypeHeader from './approvalTypeHeader.vue';
|
||||
import { formatFileSize } from '@/utils/file';
|
||||
import FilePreview from '@/components/common/filePreview/index.vue';
|
||||
@@ -52,19 +57,34 @@ const { t } = useI18n();
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
data: {},
|
||||
});
|
||||
|
||||
const knowledgeBaseName = ref<string>('');
|
||||
const knowledgeList = ref<any[]>([]);
|
||||
// const baseTableRef = ref<any>(null);
|
||||
const folder = ref<any>({});
|
||||
const showTree = ref<boolean>(false);
|
||||
|
||||
watchEffect(() => {
|
||||
if (props.data) {
|
||||
const approveContents = JSON.parse(props.data?.approveContents || '{}');
|
||||
knowledgeBaseName.value = approveContents.knowledgeBaseName || '';
|
||||
knowledgeList.value = approveContents.afterData || approveContents.beforeData || null;
|
||||
// if (baseTableRef.value && knowledgeList.value) {
|
||||
// baseTableRef.value?.setDataFun(knowledgeList.value);
|
||||
// }
|
||||
|
||||
const isDeleteAction = approveContents.approveAction === 3;
|
||||
const beforeData = approveContents.beforeData || approveContents.afterData || [];
|
||||
const isFolder = beforeData.length > 0 && beforeData[0].dataType === 1;
|
||||
|
||||
if (isDeleteAction && isFolder) {
|
||||
showTree.value = true;
|
||||
const folderData = beforeData[0];
|
||||
folder.value = {
|
||||
...folderData,
|
||||
};
|
||||
} else {
|
||||
showTree.value = false;
|
||||
knowledgeList.value = beforeData;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const currentRow = ref<any>(null);
|
||||
const previewVisible = ref<boolean>(false);
|
||||
const previewFileFun = (row: any) => {
|
||||
@@ -110,4 +130,7 @@ const actionList = computed(() => {
|
||||
.content {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.library-page {
|
||||
height: calc(100% - 40px);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user