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>

View File

@@ -91,9 +91,10 @@
>工具发布</el-button>
<el-button icon="el-icon-delete" @click="handleDelete(selection)" v-hasPermi="['tool:batch:remove']">批量删除</el-button>
<el-button icon="el-icon-download" @click="handleOpenExport()" v-hasPermi="['tool:export']">导出</el-button>
<el-button icon="el-icon-download" @click="handleOpenBatchExport()" v-hasPermi="['tool:batch:export']">批量导出</el-button>
</div><!--operate 操作按钮-->
<el-table v-loading="loading" :data="toolList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" :selectable="selectable"/>
<el-table v-loading="loading" :data="toolList" ref="tableRef" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center"/>
<el-table-column label="工具编号" align="center" key="toolCode" prop="toolCode" v-if="columns[0].visible" />
<el-table-column label="工具名称" align="center" key="toolName" prop="toolName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="工具类别" align="center" key="toolType" prop="toolType" v-if="columns[2].visible" :show-overflow-tooltip="true" >
@@ -113,14 +114,38 @@
<dict-tag :options="dict.type.flow_status" :value="scope.row.recordStatus"/>
</template>
</el-table-column>
<el-table-column label="关联工具" align="center" :show-overflow-tooltip="true">
<!-- <el-table-column label="引用工具" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="handleRelationTool(scope.row.relationToolList)">
<el-link target="_blank" v-for="assItem in scope.row.relationToolList" :key="assItem.id" @click="handleToolDetail(assItem)">{{assItem.toolName}}</el-link>
</span>
</template>
</el-table-column>-->
<el-table-column label="引用工具" align="center" :show-overflow-tooltip="true" width="100">
<template slot-scope="scope">
<el-popover
trigger="click"
placement="top-start"
v-if="Array.isArray(scope.row.relationToolList) && scope.row.relationToolList.length > 0"
>
<!-- 这里展示引用工具的详细信息 -->
<ul>
<li v-for="assItem in scope.row.relationToolList" :key="assItem.id">
<el-link target="_blank" @click="handleToolDetail(assItem)">
{{ assItem.toolName }}
</el-link>
</li>
</ul>
<!-- 弹出框触发器 -->
<el-link slot="reference">
引用工具 ({{ scope.row.relationToolList.length }})
</el-link>
</el-popover>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@@ -130,7 +155,7 @@
label="操作"
align="center"
fixed="right"
width="250"
width="270px"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
@@ -159,7 +184,7 @@
</el-card><!--el-card-->
<!-- 工具导出对话框 -->
<el-dialog title="导出" :visible.sync="exoportDrawerOpen" width="980px" append-to-body>
<el-dialog :title="exportTitle" :visible.sync="exoportDrawerOpen" width="980px" append-to-body :close-on-press-escape="false" :close-on-click-modal="false" :show-close="false">
<div class="el-form-border">
<el-form ref="exportFrom" label-width="180px">
<el-row>
@@ -203,9 +228,6 @@
</span>
</el-dialog>
<el-drawer
:visible.sync="drawerShow"
direction="rtl"
@@ -215,14 +237,19 @@
:show-close="false"
modal-append-to-body
:destroy-on-close="true"
:close-on-press-escape="false"
>
<main-component ref="mainComponent" :code="path + code" :data="data" @close="handleClose"></main-component>
</el-drawer>
<!-- 工具详情对话框 -->
<el-drawer :visible.sync="detailDrawerOpen" :modal-append-to-body="false" size="80%" class="no-padding" @close="handleCloseDetail()">
<el-drawer :visible.sync="detailDrawerOpen" :modal-append-to-body="false" :show-close="false"
size="80%" class="no-padding" :close-on-press-escape="false" @close="handleCloseDetail()">
<template #title>
<span>工具名称</span>
<span>{{toolTitle}}</span>
<div class="drawer-head-btn">
<el-button @click="detailDrawerOpen = false"> </el-button>
</div><!--drawer-head-btn 抽屉顶部按钮区域-->
</template>
<template v-if="detailOpen">
<tool-detail ref="toolDetailRef" :toolDetail="toolDetail"/>
@@ -232,15 +259,20 @@
<!-- 工具详情对话框 -->
<el-drawer :visible.sync="fileDetailDrawerOpen" :modal-append-to-body="false" size="80%" class="no-padding" @close="handleFileCloseDetail()">
<el-drawer :visible.sync="fileDetailDrawerOpen" :modal-append-to-body="false" :show-close="false"
size="80%" class="no-padding" :close-on-press-escape="false" @close="handleFileCloseDetail()">
<template #title>
<span>工具下载</span>
<span>工具附件下载</span>
<div class="drawer-head-btn">
<el-button @click="fileDetailDrawerOpen = false"> </el-button>
</div><!--drawer-head-btn 抽屉顶部按钮区域-->
</template>
<template v-if="fileDetailOpen">
<download-file-detail ref="downloadFileDetailRef" :toolDetail="toolDetail"/>
</template>
</el-drawer><!--el-drawer 详情-抽屉-->
</div><!--app-container-->
</template>
@@ -255,6 +287,7 @@ import downloadFileDetail from "./downloadFileDetail.vue";
import AddDoc from './AddDoc'
import mainComponent from "@/components/mainComponent/index.vue";
import { exportDocx } from '@/utils/docUtil/docutil.js';
import { addCount } from "@/api/tool/downloadCount";
export default {
name: "User",
@@ -369,6 +402,12 @@ export default {
label: 'word'
}
],
//详情名称
toolTitle:'',
exportTitle:'',
batchExportFlag: false,
selectedRows: [], // 保存所有选中的数据
};
},
watch: {
@@ -512,9 +551,10 @@ export default {
this.detailDrawerOpen = true
this.detailOpen = true
this.toolDetail = row
this.toolTitle = '工具详情'
} else {
let status = row.recordStatus === 'draft' ? '1' : '0'
this.handleOpen({type:'tool_release', procInstId:row.procInstId, status:status})
this.handleOpen({type:'tool_release', procInstId:row.procInstId, status:status, title: '工具发布'})
}
},
handleFileDownload(row){
@@ -551,11 +591,27 @@ export default {
let _this = this
_this.handleOpen({type:'tool_release',procInstId:row.procInstId,status:'1'})
},
/** 发布按钮操作 */
/** 导出 */
handleOpenExport() {
if (this.checkList.length<1) {
this.checkList = JSON.parse(JSON.stringify(this.columnList))
}
this.exportTitle = '导出'
this.batchExportFlag = false
this.exoportDrawerOpen = true
},
/** 批量导出 */
handleOpenBatchExport() {
let self = this
if(self.selection == null || self.selection == '' || self.selection == undefined || self.selection.length <= 0){
this.$modal.msgError(`最少选择一条数据`);
return;
}
if (this.checkList.length<1) {
this.checkList = JSON.parse(JSON.stringify(this.columnList))
}
this.exportTitle = '批量导出'
this.batchExportFlag = true
this.exoportDrawerOpen = true
},
/** 导出按钮操作 */
@@ -563,17 +619,36 @@ export default {
let self = this
if (this.statevalue == 1) {
let excludeFields = this.columnList.filter(item=>!this.checkList.includes(item))
this.download('/tool/export', {
let params = {
...this.queryParams,
downloadCheck:false,
excludeFields:excludeFields,
}, `工具信息数据_${new Date().getTime()}.xlsx`)
}
if(this.batchExportFlag){
params = {
downloadCheck:false,
toolIdList: self.selection.map(item=>item.toolId),
excludeFields:excludeFields,
}
}
this.download('/tool/export',params, `工具信息数据_${new Date().getTime()}.xlsx`)
setTimeout(() => {
if(self.batchExportFlag){
self.clearSelected()
}
self.exoportDrawerOpen = false;
}, 1000);
}
if (this.statevalue == 2) {
exportWordList(this.queryParams).then(r => {
let params = {
...this.queryParams
}
if(this.batchExportFlag){
params = {
toolIdList: self.selection.map(item=>item.toolId)
}
}
exportWordList(params).then(r => {
if (r.data.length != 0) {
const data = {
form: null,
@@ -582,6 +657,9 @@ export default {
//模板文件位置在public文件夹里N
exportDocx('tool.docx', data, `tool.docx`)
setTimeout(() => {
if(self.batchExportFlag){
self.clearSelected()
}
self.exoportDrawerOpen = false;
}, 1000);
} else {
@@ -590,6 +668,7 @@ export default {
})
}
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
@@ -617,6 +696,18 @@ export default {
this.$modal.msgError(`最少选择一条数据`);
return
}
//只能删除草稿数据
let delFlag = false;
for(let item of list){
if(!(item.recordStatus == 'draft')){
delFlag = true;
}
}
if(delFlag){
this.$modal.msgError(`只能删除流程状态为[拟稿]数据,请重新选择`);
return
}
_this.$modal.confirm('删除后该流程待办任务将会被删除请谨慎操作是否确认执行')
.then(async() => {
_this.loading = true
@@ -680,9 +771,27 @@ export default {
return true
}
},
clearSelected() {
// 清空选中的tab
this.$refs.tableRef.clearSelection();
},
onPopoverShow(list) {
this.relationToolList = list; // 更新要显示的工具列表
},
/* handlePageChange(page) {
this.$nextTick(() => {
this.restoreSelection();
});
},
// 根据保存的选中数据,恢复选中状态
restoreSelection() {
this.$refs.tableRef.clearSelection();
this.toolList.forEach(row => {
if (this.selectedRows.some(selected => selected.toolId == row.toolId)) {
this.$refs.tableRef.toggleRowSelection(row, true);
}
});
}, */
}
};

View File

@@ -19,7 +19,7 @@
<el-col :span="12"> <el-form-item label="操作说明">{{detailData.operateExplain}}</el-form-item> </el-col>
<el-col :span="12"> <el-form-item label="备注">{{detailData.remark}}</el-form-item> </el-col>
<el-col :span="24">
<el-form-item label="关联工具">
<el-form-item label="引用工具">
<span v-if="detailData.association != null && detailData.association != '' && detailData.association != undefined">
<el-tag :key="tag.toolId" v-for="tag in JSON.parse(detailData.association)" type="info" style="margin-right: 5px">{{tag.toolName}}</el-tag>
</span>
@@ -121,6 +121,8 @@
<i-frame :src="previewUrl" v-if="viewDialogOpen"/>
</el-dialog>
<preview-util v-if="isPreviewDisable" ref="previewForm" @previewClose="previewClose"></preview-util>
<!-- 上传 -->
<AddDoc :show.sync="open" :toolId="detailData.toolId" @callback="getAttachmentList"/>
</div><!--fbox1 左右分栏-->
@@ -138,10 +140,15 @@
import iFrame from "@/components/iFrame/index"
import { addCount } from "@/api/tool/downloadCount";
import { listAttachment } from "@/api/attachment/attachment";
import axios from 'axios'
import {
getToken
} from "@/utils/auth";
import previewUtil from '@/components/PreviewUtil/previewUtil.vue'
export default {
name: 'toolDetail',
components: { editDocument, AddDoc, iFrame },
components: { editDocument, AddDoc, iFrame, previewUtil },
dicts:['sys_normal_disable','tool_type','tool_source','tool_status','doc_class','doc_source'],
props: {
toolDetail: {
@@ -177,6 +184,20 @@
//详细数据
detailData:{},
attFileType: "zip,rar,7z",
// json
dialogVisible:false,
isJson:false,
resultContentObj:[],
// docx
isDocx:false,
docxData: null,
//pdf文件
isPdf:false,
pdfFileData: null, // 默认文档类型
previewLoading:false,
previewUseFront: "txt,doc,docx,pdf",
isPreviewDisable: false
}
},
created(){
@@ -210,9 +231,14 @@
this.getAttachmentList()
},
handlePreview(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;
this.isPreviewDisable = true
this.$nextTick(() => {
this.$refs.previewForm.frontModulePreview(row)
})
},
/** 关闭预览 **/
previewClose(){
this.isPreviewDisable = false
},
/** 删除按钮操作 */
handleDelete(row) {