This commit is contained in:
2025-11-21 17:23:27 +08:00
3 changed files with 104 additions and 39 deletions

View File

@@ -10,6 +10,10 @@ const lang = {
'是': 'Yes',
'否': 'No',
'返回上一级': 'Back',
'预览': 'Preview',
'下载': 'Download',
'审核模版': 'Approval Template',
'请选择审核模版': 'Please select an approval template',
},
'菜单': {
'首页': 'Home',

View File

@@ -10,6 +10,10 @@ const lang = {
'是': '是',
'否': '否',
'返回上一级': '返回上一级',
'预览': '预览',
'下载': '下载',
'审核模版': '审核模板',
'请选择审核模版': '请选择审核模版',
},
'菜单': {
'首页': '首页',

View File

@@ -1,14 +1,20 @@
<template>
<div class="gl-page-content-grey">
<div class="content">
<FileTree ref="fileTreeRef" :api="dataListDirApi" :params="{dirType:DIR_TYPE.KNOWLEDGE}" @choseNode="choseNodeFun" @updateNav="updateNavFun">
<FileTree
ref="fileTreeRef"
:api="dataListDirApi"
:params="{ dirType: DIR_TYPE.KNOWLEDGE }"
@choseNode="choseNodeFun"
@updateNav="updateNavFun"
>
<template #options>
<el-button :icon="Plus" class="options" type="primary" @click="appendFun({})">
{{ $t('知识库.新增') }}
</el-button>
</template>
<template #treeAction="{ data, }">
<div >
<div>
<el-button type="primary" link @click.stop="appendFun(data)">
<el-icon>
<FolderAdd />
@@ -50,27 +56,33 @@
:params="searchParams"
showIndex
:actionsWidth="200"
:actionList="actionList"
@cell-dblclick="onCellDblclickFun"
>
<template #leftOptions>
<div>
<el-button :icon="DArrowLeft" @click="backFun" :disabled="navList.length <= 1">{{ $t('通用.返回上一级') }}</el-button>
<el-button :icon="DArrowLeft" @click="backFun" :disabled="navList.length <= 1">{{ $t('通用.返回上一级')
}}</el-button>
<el-button type="primary" :icon="Plus" @click="openModalFun" :disabled="!currentFolder">
{{ $t('知识库.上传') }}
</el-button>
</div>
</template>
<template #originalName="{ row }">
<el-icon v-if="row.dataType === 1"><Folder /></el-icon>
<el-icon v-else><Document /></el-icon>
<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 #approvalStatus="{ row,column }">
<template v-if="row.dataType===2">
<el-button type="primary" link @click="openProcessFun(row)" v-if='row[column.field]==="pending"'>
<template #approvalStatus="{ row, column }">
<template v-if="row.dataType === 2">
<el-button type="primary" link @click="openProcessFun(row)" v-if='row[column.field] === "pending"'>
{{ KNOWLEDGE_APPROVE_STATUS.O[row[column.field]] }}
</el-button>
<el-button type="primary" link @click="openProcessFun(row)" v-else>
@@ -78,34 +90,31 @@
</el-button>
</template>
</template>
<template #approveType="{ row,column }">
<el-button
v-if="row.dataType===2"
type="primary"
link
@click="openProcessFun(row)"
> {{ KNOWLEDGE_APPROVE_TYPE.O[row[column.field]] }}</el-button>
<template #approveType="{ row, column }">
<el-button v-if="row.dataType === 2" type="primary" link @click="openProcessFun(row)"> {{
KNOWLEDGE_APPROVE_TYPE.O[row[column.field]] }}</el-button>
</template>
<template #tableActions="{ row }">
<!-- <template #tableActions="{ row }">
<div class="gl-table-actions" v-if="row.dataType ===2" >
<el-link type="primary" @click="previewFileFun(row)">{{ $t('知识库.预览') }}</el-link>
<UploadFile v-model="row.id" :name="$t('知识库.下载')" />
<el-link type="primary" @click="editFileFun(row)">{{ $t('知识库.编辑') }}</el-link>
<el-link type="danger" @click="delFileFun(row)">{{ $t('工况库.删除') }}</el-link>
</div>
</template>
</template> -->
</BaseTable>
</template>
</FileTree>
</div>
<ApprovalProcess v-model="processVisible" :flowId="currentRow?.cidFlowId"/>
<knowledgeDetailModal v-model="visible" :detail="currentRow" :folder="currentFolder" tableName="SIMULATION_KNOWLEDGE" @ok="onOkFun" />
<folderModal
v-model="folderModalVisible"
:detail="currentFolder"
:mode="currentFolderMode"
@ok="onFolderOkFun"
<ApprovalProcess v-model="processVisible" :flowId="currentRow?.cidFlowId" />
<knowledgeDetailModal
v-model="visible"
:detail="currentRow"
:folder="currentFolder"
tableName="SIMULATION_KNOWLEDGE"
@ok="onOkFun"
/>
<folderModal v-model="folderModalVisible" :detail="currentFolder" :mode="currentFolderMode" @ok="onFolderOkFun" />
</div>
</template>
@@ -127,8 +136,9 @@ import { DIR_TYPE } from '@/utils/enum/data.ts';
import ApproveList from '@/components/common/approveList/index.vue';
import { useDict } from '@/utils/useDict';
import ApprovalProcess from '@/components/common/approvalProcess/index.vue';
import i18n from '@/utils/i18n';
const { KNOWLEDGE_APPROVE_STATUS, KNOWLEDGE_APPROVE_TYPE } = useDict('KNOWLEDGE_APPROVE_STATUS', 'KNOWLEDGE_APPROVE_TYPE' );
const { KNOWLEDGE_APPROVE_STATUS, KNOWLEDGE_APPROVE_TYPE } = useDict('KNOWLEDGE_APPROVE_STATUS', 'KNOWLEDGE_APPROVE_TYPE');
type Data = RenderContentContext['data']
const fileTreeRef = ref<any>();
@@ -175,7 +185,7 @@ const removeFun = async (data: Data) => {
const req = {
delDirId: data.id,
};
const res:any = await dataDelDirApi(req);
const res: any = await dataDelDirApi(req);
if (res.code === 200) {
refreshTreeFun(data.parentId);
ElMessage.success(res.message);
@@ -196,6 +206,49 @@ const searchParams = ref<any>({
fileId: currentFolder.value?.id || '',
});
const actionList = ref<any>([
{
title: i18n?.global?.t('通用.预览'),
type: 'primary',
click: (row: any) => {
previewFileFun(row);
},
hide: (row: any) => {
return row.dataType !== 2;
},
},
{
title: i18n?.global?.t('通用.下载'),
type: 'primary',
click: (row: any) => {
downloadFileFun(row);
},
hide: (row: any) => {
return row.dataType !== 2;
},
},
{
title: i18n?.global?.t('通用.编辑'),
type: 'primary',
click: (row: any) => {
editFileFun(row);
},
hide: (row: any) => {
return row.dataType !== 2 || row.approvalStatus === 'pending';
},
},
{
title: i18n?.global?.t('通用.删除'),
type: 'danger',
click: (row: any) => {
delFileFun(row);
},
hide: (row: any) => {
return row.dataType !== 2 || row.approvalStatus === 'pending';
},
},
]);
const searchFun = (data: object) => {
isSearching.value = true;
if (!memoryFolder.value && currentFolder.value) {
@@ -215,7 +268,7 @@ const resetFun = (data: object) => {
const refreshTableFun = async () => {
baseTableRef.value?.resetFun();
};
const onFolderOkFun = async (formData:any) => {
const onFolderOkFun = async (formData: any) => {
if (currentFolderMode.value === 'add') {
const req = {
dirType: DIR_TYPE.KNOWLEDGE,
@@ -223,7 +276,7 @@ const onFolderOkFun = async (formData:any) => {
dirName: formData.name,
type: 0,
};
const res:any = await dataCreateDirApi(req);
const res: any = await dataCreateDirApi(req);
if (res.code === 200) {
refreshTreeFun(currentFolder.value.id);
folderModalVisible.value = false;
@@ -239,7 +292,7 @@ const onFolderOkFun = async (formData:any) => {
newName: formData.name,
type: 0,
};
const res:any = await dataRenameDirApi(req);
const res: any = await dataRenameDirApi(req);
if (res.code === 200) {
refreshTreeFun(currentFolder.value.parentId);
folderModalVisible.value = false;
@@ -256,7 +309,7 @@ const openModalFun = () => {
visible.value = true;
currentRow.value = null;
};
const onOkFun = async (formData:any) => {
const onOkFun = async (formData: any) => {
const req = {
...currentRow.value,
templateId: formData.templateId,
@@ -288,11 +341,15 @@ const onOkFun = async (formData:any) => {
}
};
const previewFileFun = (row:any ) => {
const previewFileFun = (row: any) => {
// TODO
console.log(row);
};
const editFileFun = (row:any ) => {
const downloadFileFun = (row: any) => {
// TODO
console.log(row);
};
const editFileFun = (row: any) => {
currentRow.value = row;
visible.value = true;
};
@@ -300,11 +357,11 @@ const delFileFun = async (row: any) => {
const templateId = ref('');
const templateName = ref('');
ElMessageBox({
title: '审核模版',
title: i18n?.global?.t('通用.审核模版'),
showCancelButton: true,
showConfirmButton: true,
confirmButtonText: '确认',
cancelButtonText: '取消',
confirmButtonText: i18n?.global?.t('通用.确定'),
cancelButtonText: i18n?.global?.t('通用.取消'),
message: () =>
h(ApproveList, {
modelValue: templateId.value,
@@ -315,7 +372,7 @@ const delFileFun = async (row: any) => {
}),
}).then(async () => {
if (!templateId.value) {
ElMessage.error('请选择审核模版');
ElMessage.error(i18n?.global?.t('通用.请选择审核模版'));
return;
}
const req = {
@@ -323,7 +380,7 @@ const delFileFun = async (row: any) => {
templateName: templateName.value,
delFileId: row.id,
};
const res:any = await dataDelFileApi(req);
const res: any = await dataDelFileApi(req);
if (res.code === 200) {
refreshTableFun();
ElMessage.success(res.message);
@@ -333,12 +390,12 @@ const delFileFun = async (row: any) => {
});
};
const onCellDblclickFun = (e:any) => {
const onCellDblclickFun = (e: any) => {
if (e.row.dataType === 1) {
fileTreeRef.value?.openDirFun(e.row.id);
}
};
const apiName:any = ref(null);
const apiName: any = ref(null);
watchEffect(() => {
if (currentFolder.value && currentFolder.value.id && !isSearching.value) {
searchParams.value.fileId = currentFolder.value?.id || '';