This commit is contained in:
2025-07-02 10:58:46 +08:00
12 changed files with 121 additions and 196 deletions

View File

@ -93,13 +93,14 @@
<el-table v-loading="state.loading" :data="state.infoList" height="67vh" border>
<el-table-column label="序号" align="center" type="index" min-width="50px" />
<el-table-column label="文件名称" align="center" prop="fileName"></el-table-column>
<el-table-column label="上传时间" align="center" prop="createdAt"> </el-table-column>
<el-table-column label="操作" align="center">
<el-table-column label="文件类型" align="center" prop="fileSuffix" width="100px" />
<el-table-column label="上传时间" align="center" prop="createTime"> </el-table-column>
<el-table-column label="操作" align="center" width="300">
<template #default="scope">
<el-button
type="primary"
v-auth="'/zm/api/v1/system/documentData/get'"
v-if="state.acceptType.includes(scope.row.suffix)"
v-if="acceptType.includes(scope.row.fileSuffix)"
link
@click="handleView(scope.row)"
><el-icon><View /></el-icon>查看</el-button
@ -107,7 +108,7 @@
<el-button
type="primary"
v-auth="'/zm/api/v1/system/documentData/complaintBoxAdd'"
v-if="state.acceptType.includes(scope.row.suffix)"
v-if="state.wordType.includes(scope.row.fileSuffix)"
link
@click="updataView(scope.row)"
><el-icon><EditPen /></el-icon>修改文件</el-button
@ -132,9 +133,9 @@
/>
</div>
</div>
<!-- <documentDetail ref="documentDetailRef" v-if="state.showDocumentDetail" @onClose="onClose"></documentDetail>
<documentsEdit ref="documentDataEditRef" v-if="state.showdocumentDataEdit" @onClose="onCloseEdit"></documentsEdit>
<uploadFileder
<documentsDeailsVue ref="documentDetailRef" v-if="state.showDocumentDetail" @onClose="onClose"></documentsDeailsVue>
<documentsEdit ref="documentDataEditRef" v-if="state.showdocumentDataEdit" @onClose="onCloseEdit"></documentsEdit>
<!-- <uploadFileder
ref="uploadFilederRef"
v-if="state.showUploadFileder"
@onCloseFile="state.showUploadFileder = false"
@ -142,7 +143,7 @@
></uploadFileder>
<fileOnline ref="fileOnlineRef" @getfileOnlineType="getfileOnlineType"></fileOnline>
<moveFile ref="moveFileRef"></moveFile> -->
<bookFile ref="bookFileRef" @onExportView="onExportView" @onExport="onExport"></bookFile>
<bookFile ref="bookFileRef" @onExportView="onExportView" @onExport="onExport" @onBook="handleView"></bookFile>
<el-dialog title="上传文件" v-model="uploadFileder" width="30%">
<file-upload v-model="state.paramsQuery.file"></file-upload>
<template #footer>
@ -158,6 +159,15 @@
<RecyclingStation ref="recylingRef"></RecyclingStation>
</el-tab-pane>
</el-tabs>
<el-image-viewer
ref="imageRef"
style="width: 100%; height: 100%"
:url-list="[imgUrl]"
v-if="imgUrl"
show-progress
fit="cover"
@close="imgUrl = ''"
/>
</template>
<script setup name="KnowledgeDocument" lang="ts">
@ -179,12 +189,8 @@ type KnowledgeDocumentOption = {
fileName: string;
children?: KnowledgeDocumentOption[];
};
// import documentDetail from '/@/views/OnlineEngineering/comm/documentsDetail/index.vue';
// import documentsEdit from '/@/views/OnlineEngineering/comm/documentsEdit/index.vue';
// import profileData from '/@/views/OnlineEngineering/profileData/index.vue';
// import uploadFileder from '/@/views/OnlineEngineering/comm/uploadFileder/index.vue';
// import fileOnline from '/@/views/OnlineEngineering/profileEngineering/fileOnline/index.vue';
// import moveFile from '/@/views/OnlineEngineering/profileEngineering/moveFile/index.vue';
import DocumentsEdit from '@/views/safety/knowledgeDocument/component/documentsEdit.vue';
import documentsDeailsVue from '@/views/safety/knowledgeDocument/component/documentsDeails.vue';
import RecyclingStation from './component/recyclingStation.vue';
import { useUserStoreHook } from '@/store/modules/user';
@ -205,6 +211,8 @@ const uploadParams = computed(() => {
};
});
const imgUrl = ref<string>('');
const filterText = ref('');
const treeRef = ref();
const documentDetailRef = ref();
@ -245,11 +253,15 @@ const state = reactive({
parentName: '',
selectedNodeId: null,
projectId: currentProject.value?.id || '',
acceptType: ['.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx'],
imgType: ['jpg', 'png', 'jpeg', 'gif', 'svg'],
wordType: ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'],
browserViewableType: ['html', 'htm', 'txt', 'log', 'md', 'json', 'xml', 'css', 'js'],
draggableCheck: true,
activeName: ''
});
const acceptType = computed(() => [...state.imgType, ...state.wordType, ...state.browserViewableType]);
watch(filterText, (val: any) => {
treeRef.value!.filter(val);
});
@ -418,15 +430,17 @@ const updateName = (row) => {
editName(row, '请输入文件名称', 1);
};
const handleView = (row) => {
// getProfileDetail(row.id).then((res: any) => {
// if (res.code == 200) {
// // 查看文档
// state.showDocumentDetail = true;
// nextTick(() => {
// documentDetailRef.value.openDialog(res.data);
// });
// }
// });
if (state.imgType.includes(row.fileSuffix)) {
imgUrl.value = row.fileUrl;
return;
} else if (state.wordType.includes(row.fileSuffix)) {
state.showDocumentDetail = true;
nextTick(() => {
documentDetailRef.value.openDialog(row);
});
} else {
window.open(row.fileUrl);
}
};
// 关闭在线编辑弹框
const onClose = () => {
@ -440,7 +454,7 @@ const updataView = (row) => {
// 修改文档
state.showdocumentDataEdit = true;
nextTick(() => {
documentDataEditRef.value.openDialog(row, '/zm/api/v1/system/busConstructionUser/complaintBoxAddTwo');
documentDataEditRef.value.openDialog(row, '/quality/knowledgeDocument/changxie/callback/');
});
};
// 删除文件及文件夹