附件上传调整

This commit is contained in:
pan
2024-09-05 08:57:44 +08:00
parent e9c7b39f1b
commit 2a933ea8cb
9 changed files with 663 additions and 91 deletions

View File

@@ -230,7 +230,7 @@
<i-frame :src="previewUrl" v-if="viewDialogOpen"/>
</el-dialog>
<el-drawer :visible.sync="open" :modal-append-to-body="false" size="75%">
<el-drawer :visible.sync="open" :modal-append-to-body="false" size="75%" :show-close="false">
<template #title>
<span class="title">{{docTitle}}</span>
<div class="drawer-head-btn" v-if="docDetailDisable">
@@ -524,6 +524,10 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const docIds = row.docId || this.ids;
if(docIds == null || docIds == undefined || docIds =='' || docIds.length < 0){
this.$modal.msgError(`最少选择一条数据`);
return;
}
this.$modal.confirm('是否确认删除?').then(function() {
return delDocument(docIds);
}).then(() => {
@@ -611,9 +615,13 @@ export default {
self.loadingDownload = false
},1000)
},
/** 删除按钮操作 */
/** 发布操作 */
handlePush(row) {
const docIds = row.docId || this.ids;
if(docIds == null || docIds == undefined || docIds =='' || docIds.length < 0){
this.$modal.msgError(`最少选择一条数据`);
return;
}
this.$modal.confirm('是否确认发布?').then(function() {
return pushDoc(docIds);
}).then(() => {

View File

@@ -3,23 +3,11 @@
<div class="fl">
<el-tabs v-model="detailActiveName">
<el-tab-pane label="文件信息" name="first">
<el-table :data="docList" style="width: 100%">
<el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" />
<el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" >
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_class" :value="scope.row.docType"/>
</template>
</el-table-column>
<el-table-column label="负责人" prop="docPrincipals" :show-overflow-tooltip="true" width="80" />
<el-table-column label="归属单位" align="center" prop="docRespDeptName" :show-overflow-tooltip="true" width="80" />
<el-table-column label="来源" prop="docSource" width="100" >
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_source" :value="scope.row.docSource"/>
</template>
</el-table-column>
<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">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createDate) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180" v-if="toolDetail.downloadStatus">
@@ -54,6 +42,7 @@
import editDocument from "../document/editDocument";
import { Base64 } from 'js-base64';
import iFrame from "@/components/iFrame/index"
import { listAttachment } from "@/api/attachment/attachment";
export default {
name: 'toolDetail',
@@ -68,7 +57,7 @@
data(){
return{
detailActiveName: 'first',
docList: [],
attachmentList: [],
queryParams: {
pageNum: 1,
pageSize: 10,
@@ -91,7 +80,7 @@
}
},
created(){
this.getDocList()
this.getAttachmentList()
this.getDiscussionsList()
},
watch: {
@@ -101,11 +90,12 @@
}
},
methods:{
getDocList() {
getAttachmentList() {
this.loading = true;
this.queryParams.toolId = this.toolDetail.toolId
listDocument(this.queryParams).then(response => {
this.docList = response.rows;
this.$set(this.queryParams,'del',"0")
this.$set(this.queryParams,'businessId',this.toolDetail.toolId)
listAttachment(this.queryParams).then(response => {
this.attachmentList = response.rows;
this.total = response.total;
this.loading = false;
}
@@ -116,7 +106,7 @@
},
editDocumentSubmit(){
this.open = false
this.getDocList()
this.getAttachmentList()
},
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));
@@ -139,12 +129,15 @@
handleDownload(row){
let self = this
self.loadingDownload = true
this.$download.resource(row.docUrl);
this.$download.resource(row.fileUrl);
//保存下载记录
if(this.toolDetail.toolId){
if(row.businessId){
let formData = {
toolId: this.toolDetail.toolId
'businessId': row.businessId,
'businessType': 'tool',
'attId': row.id,
'attName': row.fileOldName
}
addCount(formData).then(res => {
});

View File

@@ -614,6 +614,7 @@ export default {
handleDelete(list){
let _this = this
if (!list||list.length<1) {
this.$modal.msgError(`最少选择一条数据`);
return
}
_this.$modal.confirm('删除后该流程待办任务将会被删除请谨慎操作是否确认执行')

View File

@@ -30,9 +30,9 @@
</div><!--el-form-border 表单-->
</el-tab-pane><!--el-tab-pane-->
<el-tab-pane label="关联文件" name="second">
<el-table :data="docList" style="width: 100%">
<el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" />
<el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" >
<el-table :data="attachmentList" style="width: 100%">
<el-table-column label="附件名称" prop="fileName" :show-overflow-tooltip="true" />
<!-- <el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" >
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_class" :value="scope.row.docType"/>
</template>
@@ -43,10 +43,10 @@
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_source" :value="scope.row.docSource"/>
</template>
</el-table-column>
</el-table-column>-->
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createDate) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180" v-if="detailData.downloadStatus">
@@ -55,7 +55,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>
@@ -121,7 +122,7 @@
</el-dialog>
<!-- 上传 -->
<AddDoc :show.sync="open" :toolId="detailData.toolId" @callback="getDocList"/>
<AddDoc :show.sync="open" :toolId="detailData.toolId" @callback="getAttachmentList"/>
</div><!--fbox1 左右分栏-->
</template>
@@ -135,6 +136,8 @@
import editDocument from "../document/editDocument";
import { Base64 } from 'js-base64';
import iFrame from "@/components/iFrame/index"
import { addCount } from "@/api/tool/downloadCount";
import { listAttachment } from "@/api/attachment/attachment";
export default {
name: 'toolDetail',
@@ -150,7 +153,7 @@
data(){
return{
detailActiveName: 'first',
docList: [],
attachmentList: [],
queryParams: {
pageNum: 1,
pageSize: 10,
@@ -172,12 +175,13 @@
replyContent: [],
detailLoading: false,
//详细数据
detailData:{}
detailData:{},
attFileType: "zip,rar,7z",
}
},
created(){
this.getDetail()
this.getDocList()
this.getAttachmentList()
this.getDiscussionsList()
},
watch: {
@@ -187,11 +191,12 @@
}
},
methods:{
getDocList() {
getAttachmentList() {
this.loading = true;
this.queryParams.toolId = this.toolDetail.toolId
listDocument(this.queryParams).then(response => {
this.docList = response.rows;
this.$set(this.queryParams,'del',"0")
this.$set(this.queryParams,'businessId',this.toolDetail.toolId)
listAttachment(this.queryParams).then(response => {
this.attachmentList = response.rows;
this.total = response.total;
this.loading = false;
}
@@ -202,9 +207,9 @@
},
editDocumentSubmit(){
this.open = false
this.getDocList()
this.getAttachmentList()
},
handlePriew(row){
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;
@@ -225,7 +230,20 @@
handleDownload(row){
let self = this
self.loadingDownload = true
this.$download.resource(row.docUrl);
this.$download.resource(row.fileUrl);
//保存下载记录
if(row.businessId){
let formData = {
'businessId': row.businessId,
'businessType': 'tool',
'attId': row.id,
'attName': row.fileOldName
}
addCount(formData).then(res => {
});
}
setTimeout(()=>{
self.loadingDownload = false
},1000)
@@ -391,7 +409,25 @@
}).finally(()=>{
self.detailLoading = false
});
}
},
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
},
getExtension(filePath) {
// 分割字符串,以 '.' 为分隔符
const parts = filePath.split('.');
// 取最后一个部分作为后缀名
const extension = parts.pop();
return extension;
},
}
}
</script>

View File

@@ -72,6 +72,25 @@
</el-form-item>
</el-col>
</el-row>
<!-- <el-row>
<el-col :span="12">
<el-form-item label="负责人" prop="toolPrincipals">
<el-input v-if="editStatus" v-model="form.toolPrincipalsName" placeholder="请选择负责人"
maxlength="11" @focus="toolPrincipalsChoose = true"/>
<span v-else>{{form.toolPrincipalsName}}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属部门" prop="toolRespDept">
<treeselect :disabled="!editStatus" v-model="form.toolRespDept" :options="deptOptions"
:multiple="false"
:disable-branch-nodes="true" noOptionsText="暂无数据"
noChildrenText="没有子选项" noResultsText="没有匹配的结果"
@select="handleSelectNode" placeholder="请选择归属部门" />
</el-form-item>
</el-col>
</el-row>-->
<el-row>
<el-col :span="12">
<el-form-item label="工具来源" prop="toolSource">
@@ -205,40 +224,37 @@
</div>
<div class="el-form-border">
<div class="operate">
<el-button type="primary" icon="el-icon-upload2" v-if="editStatus" @click="handleDocAdd">上传</el-button>
<!-- <el-form-item label="文件" required>
</el-form-item>
<el-button type="primary" icon="el-icon-upload2" v-if="editStatus" @click="handleDocAdd">上传</el-button>-->
<template v-if="editStatus">
<uploadVue
:display="editStatus"
:uploadUrl="uploadFileUrl"
:type="['.txt','.doc','.docx','.pdf','.mp4','.zip','.rar','.7z','.png','.jpg','.jpeg']"
:acceptType="acceptType"
:isMultiple="true"
:dataFile="dataFile"
:isDetail="detailBoolean"
ref="uploadFile"
@handleSuccess="handleUploadSuccess"
@handleError="handleUploadError"
/>
</template>
<!-- <el-button icon="el-icon-delete">删除</el-button>-->
</div><!--operate 操作按钮-->
<el-table :data="docList" style="width: 100%">
<el-table :data="attachmentList" style="width: 100%">
<!-- <el-table-column type="selection" width="50" align="center"> </el-table-column>-->
<el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" />
<el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" >
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_class" :value="scope.row.docType"/>
</template>
</el-table-column>
<el-table-column label="负责人" prop="docPrincipals" :show-overflow-tooltip="true" width="80" />
<el-table-column label="归属部门" prop="docRespDept" :show-overflow-tooltip="true" width="150" >
<template slot-scope="scope">
{{convertDeptName(scope.row)}}
</template>
</el-table-column>
<el-table-column label="来源" prop="docSource" width="100" >
<template slot-scope="scope">
<dict-tag :options="dict.type.doc_source" :value="scope.row.docSource"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="序号" width="60" type="index"></el-table-column>
<el-table-column label="附件名称" prop="fileName" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="180">
<template slot-scope="scope" v-if="scope.row.roleId !== 1">
<el-button
size="mini"
type="text"
icon="el-icon-view"
v-if="isShowOperation(scope.row)"
v-if="previewAuth(scope.row)"
@click="handlePreview(scope.row)"
>预览</el-button>
<el-button
@@ -294,6 +310,7 @@
<script>
import iFrame from "@/components/iFrame/index"
import { listDocument,delDocument } from "@/api/document/document";
import { listAttachment } from "@/api/attachment/attachment";
import processcode from "@/views/workflowList/processcode/index.vue";
import {
workflowprocesskey,
@@ -309,6 +326,9 @@ import { addTool, checkToolExist, getInfoByBpmcId, updateTool } from '@/api/tool
import blUserSelector from '@/components/user-selector/src/user-selector.vue'
import ToolSelector from '@/components/tool-selector/index.vue'
import { Base64 } from 'js-base64'
import uploadVue from '@/components/FileUpload/optimizeToolUpload.vue'
import { addCount } from "@/api/tool/downloadCount";
// PDF本地文件预览
export default {
dicts: ['sys_normal_disable','tool_type', 'tool_source', 'tool_status', 'doc_source','doc_class'],
@@ -318,7 +338,8 @@ export default {
Treeselect, AddDoc,
WorkflowLogs,
processcode,
iFrame
iFrame,
uploadVue
},
name: "Borrow_doc",
props: ['data'],
@@ -339,8 +360,6 @@ export default {
}
return {
toolPrincipalsChoose: false,
// 新增时的关联附件
docList: [],
addDocShow: false,
docQueryParams: {
pageNum: 1,
@@ -368,7 +387,9 @@ export default {
userInfo: this.$store.getters.userInfo,
viewShow: false,
monitorDrawerVisible:false,
form: {},
form: {
toolRespDept: this.$store.getters.userInfo.deptId
},
rules: {
toolCode: [
{ required: true, message: "工具编号不能为空", trigger: "blur" },
@@ -383,7 +404,7 @@ export default {
{ required: true, message: "负责人不能为空", trigger: "blur" }
],
toolRespDept: [
{ required: true, message: "请选择归属部门", trigger: "change" }
{ required: true, message: "请选择归属部门", trigger: ['blur','change'] }
],
toolSource: [
{ required: true, message: "请选择工具来源", trigger: "change" }
@@ -427,6 +448,16 @@ export default {
viewDialogOpen: false,
previewUrl: '',
loadingDownload: false,
//当前部门
curDeptId: null,
curDeptName: null,
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传文件服务器地址
acceptType: ".txt,.doc,.docx,.pdf,.mp4,.zip,.rar,.7z,.png,.jpg,.jpeg",
dataFile: [],
detailBoolean: false,
attachmentList: [],
attFileType: "zip,rar,7z",
};
},
computed: {},
@@ -438,6 +469,8 @@ export default {
},
},
mounted() {
this.curDeptId = this.$store.getters.userInfo.deptId
this.curDeptName = this.$store.getters.userInfo.dept.deptName
if (this.data) {
this.init(this.data)
}
@@ -480,7 +513,7 @@ export default {
getInfoByBpmcId(procInstId).then(async (res) => {
let formData = res.data;
formData.type = _this.form.type
// _this.docList = formData.documentList
// _this.attachmentList = formData.attachmentList
formData.association = JSON.parse(res.data.association)
_this.form = formData
_this.getDocumentList(res.data.toolId)
@@ -586,7 +619,7 @@ export default {
formData.association = JSON.stringify(_this.form.association)
formData.toolRespDept = _this.userInfo.dept.deptId
if (formData.toolId) {
this.$set(formData,'documentList',_this.docList)
this.$set(formData,'attachmentList',_this.attachmentList)
updateTool(formData).then((res) => {
if (res.code===200) {
_this.$message({
@@ -622,7 +655,7 @@ export default {
review: _this.attributeModelBool('approve'),
};
formData.editStatus = _this.editStatus
this.$set(formData,'documentList',_this.docList)
this.$set(formData,'attachmentList',_this.attachmentList)
addTool(formData).then((res) => {
if (res.code===200) {
_this.form.toolId = res.data.businessKey;
@@ -768,7 +801,7 @@ export default {
formData.recordStatus = 'doing'
}
formData.editStatus = _this.editStatus
this.$set(formData,'documentList',_this.docList)
this.$set(formData,'attachmentList',_this.attachmentList)
addTool(formData).then((res) => {
if (res.code===200) {
_this.$message({
@@ -792,7 +825,7 @@ export default {
});
},
handleDelete(row){
this.docList.splice(row,1)
this.attachmentList.splice(row,1)
},
/**
* 新增上传附件
@@ -805,10 +838,10 @@ export default {
},
getDocumentList(toolId) {
this.loading = true
this.docQueryParams.toolId = toolId
this.$set(this.docQueryParams,'isDeleted',"0")
listDocument(this.docQueryParams).then(res => {
this.docList = res.rows;
this.$set(this.docQueryParams,'del',"0")
this.$set(this.docQueryParams,'businessId',toolId)
listAttachment(this.docQueryParams).then(res => {
this.attachmentList = res.rows;
this.total = res.total;
this.loading = false;
}
@@ -822,6 +855,8 @@ export default {
},
handleSelectNode(node){
this.$set(this.form,'toolRespDeptName',node.label)
this.$set(this.form,'toolRespDept',node.id)
this.$refs.eForm.validateField('toolRespDept');
},
toolSelect(){
this.$refs.selectHeadTool.blur();
@@ -842,7 +877,7 @@ export default {
/** 添加关联附件数据**/
addFileData(dataInfo){
let document = JSON.parse(JSON.stringify(dataInfo))
this.docList.push(document)
this.attachmentList.push(document)
},
findDeptInTree(tree, id) {
for (const node of tree) {
@@ -868,11 +903,29 @@ export default {
},
isShowOperation(row){
let self = this
if(row.docId == null || row.docId == undefined || row.docId == ''){
if(row.businessId == null || row.businessId == undefined || row.businessId == ''){
return false
}
return 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
},
getExtension(filePath) {
// 分割字符串,以 '.' 为分隔符
const parts = filePath.split('.');
// 取最后一个部分作为后缀名
const extension = parts.pop();
return extension;
},
handlePreview(row){
this.viewDialogOpen = true;
this.viewDialogTitle = '文档在线预览'
@@ -887,15 +940,36 @@ export default {
handleDownload(row){
let self = this
self.loadingDownload = true
this.$download.resource(row.docUrl);
this.$download.resource(row.fileUrl);
//保存下载记录
if(row.businessId){
let formData = {
'businessId': row.businessId,
'businessType': 'tool',
'attId': row.id,
'attName': row.fileOldName
}
addCount(formData).then(res => {
});
}
setTimeout(()=>{
self.loadingDownload = false
},1000)
},
handleBeforeClose() {
this.viewDialogOpen = false
}
},
},
handleUploadSuccess(res) {
this.attachmentList.push(res)
// 处理上传成功后的逻辑
},
handleUploadError(error) {
// 处理上传失败后的逻辑
},
},
};
</script>

View File

@@ -403,8 +403,26 @@ export default {
this.viewShow = false;
this.$emit("close")
},
// 提交
async saveForm() {
let _this = this
// 首先页签调整为 信息内容
_this.activeName = 'info'
if (!_this.procDefKey) {
_this.$message.warning("尚未进行流程设置,将无法发起流程!");
return;
}
let dialogVisible = true
if (!!_this.$refs["eForm"]) {
let valid = await _this.$refs["eForm"].validate()
if (!valid) {
dialogVisible = false
}
}
_this.tempForm()
},
//不需要验证必填的保存
saveForm() {
tempForm() {
let _this = this
if (!_this.procDefKey) {
_this.$message.warning("尚未进行流程设置,将无法发起流程!");