1、工具管理独立处理

2、文档资源管理调整:批量导出、文档资源管理关联附件独立处理
This commit is contained in:
pan
2024-09-05 21:23:42 +08:00
parent 2a933ea8cb
commit f7f98ee723
15 changed files with 1014 additions and 361 deletions

View File

@@ -2,7 +2,7 @@
<div class="fbox1">
<div class="fl">
<el-tabs v-model="detailActiveName">
<el-tab-pane label="件信息" name="first">
<el-tab-pane label="件信息" name="first">
<el-table :data="attachmentList" style="width: 100%">
<el-table-column label="附件名称" prop="fileName" :show-overflow-tooltip="true" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
@@ -16,7 +16,8 @@
size="mini"
type="text"
icon="el-icon-view"
@click="handlePriew(scope.row)"
v-if="previewAuth(scope.row)"
@click="handlePreview(scope.row)"
>预览</el-button>
<el-button type="text" icon="el-icon-download" @click="handleDownload(scope.row)" v-loading="loadingDownload">下载</el-button>
</template>
@@ -26,28 +27,20 @@
</el-tabs><!--el-tabs-->
</div><!--fl 左侧页签-->
<el-dialog :title="viewDialogTitle" :visible.sync="viewDialogOpen" fullscreen width="500px" append-to-body :before-close="handleBeforeClose">
<i-frame :src="previewUrl" v-if="viewDialogOpen"/>
</el-dialog>
<preview-util v-if="isPreviewDisable" ref="previewForm" @previewClose="previewClose"></preview-util>
</div><!--fbox1 左右分栏-->
</template>
<script>
import { listDocument, getDocument, delDocument, addDocument, updateDocument } from "@/api/document/document";
import { listDiscussions, addDiscussions } from "@/api/tool/discussions.js";
import { listReplies, addReplies} from "@/api/tool/replies.js";
import { addCount } from "@/api/tool/downloadCount";
import AddDoc from './AddDoc'
import editDocument from "../document/editDocument";
import { Base64 } from 'js-base64';
import iFrame from "@/components/iFrame/index"
import { listAttachment } from "@/api/attachment/attachment";
import previewUtil from '@/components/PreviewUtil/previewUtil.vue'
export default {
name: 'toolDetail',
components: { editDocument, AddDoc, iFrame },
dicts:['sys_normal_disable','tool_type','tool_source','tool_status','doc_class','doc_source'],
components: { previewUtil},
dicts:[],
props: {
toolDetail: {
type: Object,
@@ -77,17 +70,13 @@
repliesList: [],
showReplyForm: [],
replyContent: [],
isPreviewDisable: false,
attFileType: "zip,rar,7z",
}
},
created(){
this.getAttachmentList()
this.getDiscussionsList()
},
watch: {
discussionsList(newList) {
this.showReplyForm = new Array(newList.length).fill(false);
this.replyContent = new Array(newList.length).fill('');
}
},
methods:{
getAttachmentList() {
@@ -101,27 +90,33 @@
}
);
},
handleAdd(){
this.open = true
handlePreview(row){
this.isPreviewDisable = true
this.$nextTick(() => {
this.$refs.previewForm.frontModulePreview(row)
})
},
editDocumentSubmit(){
this.open = false
this.getAttachmentList()
/** 关闭预览 **/
previewClose(){
this.isPreviewDisable = false
},
handlePriew(row){
this.previewUrl = process.env.VUE_APP_TOOL_TECH_FILE_VIEW_API + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(process.env.VUE_APP_BASE_API + row.docUrl));
this.viewDialogTitle = '文档在线预览'
this.viewDialogOpen = true;
previewAuth(row){
if(row.fileUrl == null || row.fileUrl == '' || row.fileUrl == undefined){
return false
}
let extension = this.getExtension(row.fileUrl);
const acceptedExtensions = this.attFileType.toLowerCase().split(',');
if(acceptedExtensions.includes(extension)){
return false
}
return true
},
/** 删除按钮操作 */
handleDelete(row) {
const docIds = row.docId || this.ids;
this.$modal.confirm('是否确认删除?').then(function() {
return delDocument(docIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
getExtension(filePath) {
// 分割字符串,以 '.' 为分隔符
const parts = filePath.split('.');
// 取最后一个部分作为后缀名
const extension = parts.pop();
return extension;
},
/**
* 处理下载
@@ -147,155 +142,6 @@
self.loadingDownload = false
},1000)
},
getDiscussionsList() {
let self = this
listDiscussions({businessId:this.toolDetail.toolId}).then(res => {
self.discussionsList = res.rows
self.discussionsList.forEach(item => {
if(item.repliesList && item.repliesList.length > 0){
self.$set(item, 'showReplyFormSon', new Array(item.repliesList.length).fill(false))
self.$set(item, 'replyContentSon', new Array(item.repliesList.length).fill(''))
}else{
self.$set(item, 'showReplyFormSon', false)
self.$set(item, 'replyContentSon', '')
}
});
});
},
/** 评论 **/
handleDiscussions(){
let self = this
if (this.discussionContent == '' || this.discussionContent == null || this.discussionContent == undefined) {
self.$message({
message: '内容不能为空',//提示的信息
type:'warning',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
return;
}
let data = {
businessId: this.toolDetail.toolId,
content: this.discussionContent,
type: "tool",
}
self.$modal.confirm('是否确认发布?').then(()=> {
addDiscussions(data).then(res => {
this.discussionContent = null
self.$message({
message: '发布成功',//提示的信息
type:'success',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
self.getDiscussionsList()
}).catch(err =>{
this.discussionContent = null
console.error("handleDiscussions==err==", err)
self.$modal.msgError("发布失败");
});
})
},
getFirstChar(value) {
if(!value){return ''}
return value.charAt(0);
},
toggleReplyForm(index) {
this.$set(this.showReplyForm, index, !this.showReplyForm[index]);
},
cancelReply(index) {
this.$set(this.showReplyForm, index, false);
this.$set(this.replyContent, index, '');
},
/** 回复 **/
submitReply(index, item) {
let self = this
const content = this.replyContent[index];
if (content == '' || content == null || content == undefined) {
self.$message({
message: '回复内容不能为空',//提示的信息
type:'warning',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
return;
}
let data = {
"discussionId": item.id,
"content": content,
}
self.$modal.confirm('是否确认发布?').then(()=> {
addReplies(data).then(res => {
self.$message({
message: '发布成功',//提示的信息
type:'success',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
self.cancelReply(index)
self.getDiscussionsList()
}).catch(err =>{
console.error("handleDiscussions==err==", err)
self.$modal.msgError("发布失败");
});
})
// 清空回复内容并隐藏表单
this.replyContent[index] = '';
this.showReplyForm[index] = false;
},
/** 第二级 **/
toggleReplyFormSon(parentIndex, repIndex) {
const parentItem = this.discussionsList[parentIndex];
this.$set(parentItem.showReplyFormSon, repIndex, !parentItem.showReplyFormSon[repIndex]);
// this.$set(this.showReplyFormSon, index, !this.showReplyFormSon[index]);
},
/** 第二级,取消回复 **/
cancelReplySon(parentIndex, repIndex) {
const parentItem = this.discussionsList[parentIndex];
this.$set(parentItem.showReplyFormSon, repIndex, false);
this.$set(parentItem.replyContentSon, repIndex, '');
},
/** 第二级回复 **/
submitReplySon(parentIndex, repIndex, repItem) {
let self = this
const parentItem = this.discussionsList[parentIndex];
const content = parentItem.replyContentSon[repIndex];
if (content.trim() == '' || content == null || content == undefined) {
self.$message({
message: '回复内容不能为空',//提示的信息
type:'warning',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
return;
}
let data = {
"discussionId": repItem.id,
"content": content,
}
self.$modal.confirm('是否确认发布?').then(()=> {
addReplies(data).then(res => {
self.$message({
message: '发布成功',//提示的信息
type:'success',  //类型是成功
duration:1200,  //显示时间, 毫秒。设为 0 则不会自动关闭建议1200
});
self.cancelReplySon(parentIndex, repIndex)
self.getDiscussionsList()
}).catch(err =>{
console.error("submitReplySon==err==", err)
self.$modal.msgError("发布失败");
});
})
// 清空回复内容并隐藏表单
this.$set(parentItem.replyContentSon, repIndex, '');
this.$set(parentItem.showReplyFormSon, repIndex, false);
},
handleBeforeClose() {
this.viewDialogOpen = false
}
}
}
</script>