附件上传调整
This commit is contained in:
parent
e9c7b39f1b
commit
2a933ea8cb
44
src/api/attachment/attachment.js
Normal file
44
src/api/attachment/attachment.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询附件列表
|
||||||
|
export function listAttachment(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attachment/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询附件详细
|
||||||
|
export function getAttachment(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attachment/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增附件
|
||||||
|
export function addAttachment(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attachment',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改附件
|
||||||
|
export function updateAttachment(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attachment',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除附件
|
||||||
|
export function delAttachment(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/attachment/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
396
src/components/FileUpload/optimizeToolUpload.vue
Normal file
396
src/components/FileUpload/optimizeToolUpload.vue
Normal file
@ -0,0 +1,396 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-upload class="upload-demo" ref="upload" action="#"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
:on-change="onChange"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
:multiple="isMultiple"
|
||||||
|
:on-exceed="handleExceed"
|
||||||
|
:accept="acceptType"
|
||||||
|
:file-list="fileList"
|
||||||
|
:auto-upload="true"
|
||||||
|
:http-request="uploadFile"
|
||||||
|
show-file-list>
|
||||||
|
<el-button slot="trigger" size="small" type="primary" @click="isFolder = false">选取文件</el-button>
|
||||||
|
<el-button size="small" type="primary" @click="handleUploadFile" >
|
||||||
|
上传文件夹
|
||||||
|
</el-button>
|
||||||
|
<!-- 上传-->
|
||||||
|
<input v-show="false" ref="fileRef" id="fileFolder" type="file" @change="handleFolderUpload" webkitdirectory
|
||||||
|
multiple="multiple" />
|
||||||
|
|
||||||
|
<!-- <input v-show="false" type="file" ref="fileRef" webkitdirectory @change="handleFolderUpload">
|
||||||
|
<el-button slot="trigger" size="small" type="primary">选取文件夹</el-button>-->
|
||||||
|
</el-upload>
|
||||||
|
<!-- <div slot="tip" class="el-upload__tip" >只能上传{{acceptType}}文件</div>-->
|
||||||
|
<div v-show="progressFlag" class="head-img">
|
||||||
|
<el-progress :text-inside="true" :stroke-width="14" :percentage="progressPercent" status="success"></el-progress>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
|
import {
|
||||||
|
getToken
|
||||||
|
} from "@/utils/auth";
|
||||||
|
import JSZip from 'jszip'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
uploadUrl: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
// 是否多选
|
||||||
|
isMultiple: {
|
||||||
|
type: Boolean,
|
||||||
|
default() {
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
// 文件类型
|
||||||
|
type: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return []
|
||||||
|
},
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
//上传类型
|
||||||
|
acceptType: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
// 上传数量
|
||||||
|
limit: {
|
||||||
|
type: Number,
|
||||||
|
default() {
|
||||||
|
return 1
|
||||||
|
},
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
// 文件
|
||||||
|
dataFile: {
|
||||||
|
type: [Object, Array, String],
|
||||||
|
default() {
|
||||||
|
return ''
|
||||||
|
},
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
isDetail: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
fileList: [],
|
||||||
|
progress: 0,
|
||||||
|
isUploading: false,
|
||||||
|
progressFlag: false, //进度条初始值隐藏
|
||||||
|
progressPercent: 0, //进度条初始值
|
||||||
|
partSize: 5 * 1024 * 1024,
|
||||||
|
fileDetailName: null,
|
||||||
|
uploadedNum: 0,
|
||||||
|
_shardCount: null, //是否最后一片
|
||||||
|
isFolder: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
dataFile: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
if (newValue && newValue.length > 0) {
|
||||||
|
this.fileList = Array.isArray(newValue) ? newValue : [newValue]
|
||||||
|
this.fileDetailName = this.fileList[0].name
|
||||||
|
} else {
|
||||||
|
this.fileList = []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 上传前
|
||||||
|
beforeUpload(file) {
|
||||||
|
/* const fileType = file.type.toLowerCase()
|
||||||
|
console.info("fileType=======", fileType)
|
||||||
|
const typeFlag = this.type.some(item => {
|
||||||
|
return fileType.indexOf(item) != -1
|
||||||
|
})
|
||||||
|
if (!typeFlag) {
|
||||||
|
this.$message.error('上传类型有误,请重新上传')
|
||||||
|
return false
|
||||||
|
}*/
|
||||||
|
},
|
||||||
|
//文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
|
||||||
|
onChange(file, fileList) {
|
||||||
|
this.fileList = fileList;
|
||||||
|
},
|
||||||
|
handleRemove(file, fileList) {
|
||||||
|
this.fileList = fileList;
|
||||||
|
},
|
||||||
|
handleExceed(files, fileList) {
|
||||||
|
/* this.$message.warning(
|
||||||
|
"最多之能上传"+ this.limit +"个附件"
|
||||||
|
); */
|
||||||
|
},
|
||||||
|
async uploadFile({ data, file }) {
|
||||||
|
let self = this
|
||||||
|
//初始化参数
|
||||||
|
if (file.size < this.partSize) {
|
||||||
|
let formData = new FormData()
|
||||||
|
formData.append("file", file)
|
||||||
|
self.progressFlag = true;
|
||||||
|
axios({
|
||||||
|
url: self.uploadUrl,
|
||||||
|
method: 'post',
|
||||||
|
data: formData,
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer ' + getToken(),
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
},
|
||||||
|
onUploadProgress: progressEvent => {
|
||||||
|
// progressEvent.loaded:已上传文件大小
|
||||||
|
// progressEvent.total:被上传文件的总大小
|
||||||
|
//进度条
|
||||||
|
self.progressPercent = ((progressEvent.loaded / progressEvent.total) * 100) | 0;
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
console.info("11111111uploadFile1111111")
|
||||||
|
setTimeout(() => {
|
||||||
|
if (res.data.code == 200) {
|
||||||
|
setTimeout(function () {
|
||||||
|
//文件夹上传
|
||||||
|
if(self.isFolder){
|
||||||
|
self.fileList.push(file)
|
||||||
|
}
|
||||||
|
self.$message({
|
||||||
|
message: '上传成功!',
|
||||||
|
type: 'success',
|
||||||
|
duration: '2000'
|
||||||
|
});
|
||||||
|
self.progressFlag = false;
|
||||||
|
self.progressPercent = 0
|
||||||
|
self.handleResult(res,file);
|
||||||
|
}, 500);
|
||||||
|
} else {
|
||||||
|
console.info("11111上传失败11111", error)
|
||||||
|
self.progressFlag = false;
|
||||||
|
self.$message({
|
||||||
|
message: '上传失败!',
|
||||||
|
type: 'error',
|
||||||
|
duration: '2000'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
}).catch(error => {
|
||||||
|
console.info("1111111uploadFile1uploadFile1111111", error)
|
||||||
|
console.error(error)
|
||||||
|
self.progressFlag = false;
|
||||||
|
self.progressPercent = 0
|
||||||
|
self.$refs.upload.clearFiles();
|
||||||
|
self.$message({
|
||||||
|
message: '上传失败!',
|
||||||
|
type: 'error',
|
||||||
|
duration: '2000'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
self.uploadedNum = 0
|
||||||
|
file._shardCount = Math.ceil(file.size / this.partSize) //总片数
|
||||||
|
file.uploaded = 0
|
||||||
|
let formData = new FormData()
|
||||||
|
formData.append('fileName', file.name)
|
||||||
|
//大文件上传初始化,返回uploadId initUpload(formData)
|
||||||
|
axios({
|
||||||
|
url: process.env.VUE_APP_BASE_API + "/common/initUpload",
|
||||||
|
method: 'post',
|
||||||
|
data: formData,
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer ' + getToken(),
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
},
|
||||||
|
}).then(function (res) {
|
||||||
|
console.info("222222222upload222")
|
||||||
|
if (res.status == 200) {
|
||||||
|
//从第0块开始上传
|
||||||
|
file.uploadId = res.data.uploadId
|
||||||
|
file.objectKey = res.data
|
||||||
|
file.chunkId = 0
|
||||||
|
self.uploadByChunk(file)
|
||||||
|
} else {
|
||||||
|
this.progress--
|
||||||
|
self.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
self.progressPercent = 0
|
||||||
|
self.progressFlag = false;
|
||||||
|
console.error(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
//分片上传大文件
|
||||||
|
uploadByChunk(file) {
|
||||||
|
this._start = file.chunkId * this.partSize
|
||||||
|
this._end = Math.min(file.size, this._start + this.partSize)//结束时总大小,和 开始的大小+之前的大小比较
|
||||||
|
|
||||||
|
let self = this
|
||||||
|
let fileData = file.slice(this._start, this._end)
|
||||||
|
//获取文件块MD5
|
||||||
|
let reader = new FileReader()
|
||||||
|
reader.readAsBinaryString(fileData)
|
||||||
|
let form1 = new FormData()//new一个form的实例,可以进行键值对的添加,
|
||||||
|
form1.append('chunkFile', fileData) //slice方法用于切出文件的一部分
|
||||||
|
form1.append('uploadId', file.uploadId)
|
||||||
|
form1.append('chunkId', (file.chunkId + 1).toString())
|
||||||
|
form1.append('shardCount', file._shardCount.toString()) //是否最后一片
|
||||||
|
self.progressFlag = true;
|
||||||
|
//上传大文件的Chunk 返回chunk的MD5 uploadChunk(form1)
|
||||||
|
axios({
|
||||||
|
url: process.env.VUE_APP_BASE_API + "/common/uploadChunk",
|
||||||
|
method: 'post',
|
||||||
|
data: form1,
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer ' + getToken(),
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
},
|
||||||
|
|
||||||
|
}).then(response => {
|
||||||
|
if (response.status == 200) {
|
||||||
|
//判断返回的MD5值是否一致,一致继续传下一块,否则重传本块(这里目前前后端MD5一直不一致,暂时先注释掉,有时间了我再研究一下)
|
||||||
|
// self.md5Str[index] === response.msg ||
|
||||||
|
if (true) {
|
||||||
|
// this.$message.success('第' + (index + 1).toString() + '块文件上传成功')
|
||||||
|
self.uploadedNum++
|
||||||
|
let percent = Math.floor((self.uploadedNum / file._shardCount) * 100)
|
||||||
|
self.percentageSend(file, percent)
|
||||||
|
//如果没上传完成,继续上传一下块
|
||||||
|
file.chunkId++
|
||||||
|
if (file.chunkId < file._shardCount) {
|
||||||
|
this.uploadByChunk(file)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//不一致,重新传本块
|
||||||
|
this.$message.success('第' + (file.chunkId + 1).toString() + '块文件上传不成功,重新上传')
|
||||||
|
this.uploadByChunk(file.chunkId)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//出错,跳出循环显示错误
|
||||||
|
this.progress--
|
||||||
|
this.$message.error(response.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//接收上传的百分值回调
|
||||||
|
percentageSend(file, perNum) {
|
||||||
|
let self = this
|
||||||
|
self.progressPercent = perNum
|
||||||
|
//如果上传完成,合并文件
|
||||||
|
if (perNum === 100) {
|
||||||
|
let form2 = new FormData()//new一个form的实例,可以进行键值对的添加,
|
||||||
|
form2.append('uploadId', file.uploadId)
|
||||||
|
form2.append('fileName', file.name)
|
||||||
|
// 大文件上传完成后合并
|
||||||
|
// 返回文件访问的URL
|
||||||
|
axios({
|
||||||
|
url: process.env.VUE_APP_BASE_API + "/common/mergeFile",
|
||||||
|
method: 'post',
|
||||||
|
data: form2,
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer ' + getToken(),
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
},
|
||||||
|
}).then(res => {
|
||||||
|
if (res.status == 200) {
|
||||||
|
setTimeout(function () {
|
||||||
|
self.$message({
|
||||||
|
message: '上传成功!',
|
||||||
|
type: 'success',
|
||||||
|
duration: '2000'
|
||||||
|
});
|
||||||
|
self.progressFlag = false;
|
||||||
|
self.progressPercent = 0
|
||||||
|
self.handleResult(res,file);
|
||||||
|
}, 500);
|
||||||
|
//文件夹上传
|
||||||
|
if(self.isFolder){
|
||||||
|
self.fileList.push(file)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.progressFlag = false;
|
||||||
|
self.$message({
|
||||||
|
message: '上传失败!',
|
||||||
|
type: 'error',
|
||||||
|
duration: '2000'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
resetData() {
|
||||||
|
this.progress = 0;
|
||||||
|
},
|
||||||
|
handleResult(res, file) {
|
||||||
|
let self = this
|
||||||
|
const data = {
|
||||||
|
fileName: file.name,
|
||||||
|
fileSize: file.size,
|
||||||
|
fileUrl: res.data.filePath,
|
||||||
|
filePath: res.data.filePath,
|
||||||
|
fileOldName: res.data.originalFilename,
|
||||||
|
fileNewName: res.data.newFileName,
|
||||||
|
suffixType: res.data.suffixType
|
||||||
|
}
|
||||||
|
self.$emit("handleSuccess", data)
|
||||||
|
self.clearFile()
|
||||||
|
},
|
||||||
|
/** 清空文件 **/
|
||||||
|
clearFile(){
|
||||||
|
this.progressFlag = false;
|
||||||
|
if(this.$refs.upload){
|
||||||
|
this.$refs.upload.clearFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fileList = []
|
||||||
|
},
|
||||||
|
handleUploadFile() {
|
||||||
|
document.getElementById("fileFolder").value = null;
|
||||||
|
this.$refs.fileRef.dispatchEvent(new MouseEvent("click"));
|
||||||
|
},
|
||||||
|
async handleFolderUpload(event) {
|
||||||
|
let self = this;
|
||||||
|
self.isFolder = true
|
||||||
|
const files = event.target.files;
|
||||||
|
self.fileslength = files.length;
|
||||||
|
let filesper = Math.floor( 100 / files.length * 100)/100;
|
||||||
|
self.progressShow = true;
|
||||||
|
if (self.fileslength == 0) {
|
||||||
|
self.progressShow = false;
|
||||||
|
self.$modal.msg("上传完成0个,未完成0个");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
let temp = {
|
||||||
|
"data": null,
|
||||||
|
"file": file
|
||||||
|
}
|
||||||
|
await self.uploadFile(temp);
|
||||||
|
}
|
||||||
|
/* console.info("files=========", files)
|
||||||
|
let fileListTemp = []
|
||||||
|
for(let item of files){
|
||||||
|
fileListTemp.push(item);
|
||||||
|
}
|
||||||
|
self.fileList = fileListTemp; */
|
||||||
|
/* files.for()
|
||||||
|
self.onChange(null, files); */
|
||||||
|
// self.fileList = files;
|
||||||
|
// this.$refs.fileRef.value = null;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -4,7 +4,9 @@
|
|||||||
:visible.sync="visible"
|
:visible.sync="visible"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
width="80%"
|
width="80%"
|
||||||
append-to-body>
|
append-to-body
|
||||||
|
:show-close="false"
|
||||||
|
>
|
||||||
<div class="el-card__body">
|
<div class="el-card__body">
|
||||||
<el-form :model="queryParams" ref="queryForm" v-show="showSearch" label-width="68px" :inline="true">
|
<el-form :model="queryParams" ref="queryForm" v-show="showSearch" label-width="68px" :inline="true">
|
||||||
<el-form-item label="工具编号" prop="toolCode">
|
<el-form-item label="工具编号" prop="toolCode">
|
||||||
|
@ -230,7 +230,7 @@
|
|||||||
<i-frame :src="previewUrl" v-if="viewDialogOpen"/>
|
<i-frame :src="previewUrl" v-if="viewDialogOpen"/>
|
||||||
</el-dialog>
|
</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>
|
<template #title>
|
||||||
<span class="title">{{docTitle}}</span>
|
<span class="title">{{docTitle}}</span>
|
||||||
<div class="drawer-head-btn" v-if="docDetailDisable">
|
<div class="drawer-head-btn" v-if="docDetailDisable">
|
||||||
@ -524,6 +524,10 @@ export default {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const docIds = row.docId || this.ids;
|
const docIds = row.docId || this.ids;
|
||||||
|
if(docIds == null || docIds == undefined || docIds =='' || docIds.length < 0){
|
||||||
|
this.$modal.msgError(`最少选择一条数据`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.$modal.confirm('是否确认删除?').then(function() {
|
this.$modal.confirm('是否确认删除?').then(function() {
|
||||||
return delDocument(docIds);
|
return delDocument(docIds);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
@ -611,9 +615,13 @@ export default {
|
|||||||
self.loadingDownload = false
|
self.loadingDownload = false
|
||||||
},1000)
|
},1000)
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 发布操作 */
|
||||||
handlePush(row) {
|
handlePush(row) {
|
||||||
const docIds = row.docId || this.ids;
|
const docIds = row.docId || this.ids;
|
||||||
|
if(docIds == null || docIds == undefined || docIds =='' || docIds.length < 0){
|
||||||
|
this.$modal.msgError(`最少选择一条数据`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.$modal.confirm('是否确认发布?').then(function() {
|
this.$modal.confirm('是否确认发布?').then(function() {
|
||||||
return pushDoc(docIds);
|
return pushDoc(docIds);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
@ -3,23 +3,11 @@
|
|||||||
<div class="fl">
|
<div class="fl">
|
||||||
<el-tabs v-model="detailActiveName">
|
<el-tabs v-model="detailActiveName">
|
||||||
<el-tab-pane label="文件信息" name="first">
|
<el-tab-pane label="文件信息" name="first">
|
||||||
<el-table :data="docList" style="width: 100%">
|
<el-table :data="attachmentList" style="width: 100%">
|
||||||
<el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" />
|
<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>
|
|
||||||
</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-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createDate) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="180" v-if="toolDetail.downloadStatus">
|
<el-table-column label="操作" align="center" width="180" v-if="toolDetail.downloadStatus">
|
||||||
@ -54,6 +42,7 @@
|
|||||||
import editDocument from "../document/editDocument";
|
import editDocument from "../document/editDocument";
|
||||||
import { Base64 } from 'js-base64';
|
import { Base64 } from 'js-base64';
|
||||||
import iFrame from "@/components/iFrame/index"
|
import iFrame from "@/components/iFrame/index"
|
||||||
|
import { listAttachment } from "@/api/attachment/attachment";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'toolDetail',
|
name: 'toolDetail',
|
||||||
@ -68,7 +57,7 @@
|
|||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
detailActiveName: 'first',
|
detailActiveName: 'first',
|
||||||
docList: [],
|
attachmentList: [],
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@ -91,7 +80,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
this.getDocList()
|
this.getAttachmentList()
|
||||||
this.getDiscussionsList()
|
this.getDiscussionsList()
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -101,11 +90,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
getDocList() {
|
getAttachmentList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.queryParams.toolId = this.toolDetail.toolId
|
this.$set(this.queryParams,'del',"0")
|
||||||
listDocument(this.queryParams).then(response => {
|
this.$set(this.queryParams,'businessId',this.toolDetail.toolId)
|
||||||
this.docList = response.rows;
|
listAttachment(this.queryParams).then(response => {
|
||||||
|
this.attachmentList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
@ -116,7 +106,7 @@
|
|||||||
},
|
},
|
||||||
editDocumentSubmit(){
|
editDocumentSubmit(){
|
||||||
this.open = false
|
this.open = false
|
||||||
this.getDocList()
|
this.getAttachmentList()
|
||||||
},
|
},
|
||||||
handlePriew(row){
|
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.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){
|
handleDownload(row){
|
||||||
let self = this
|
let self = this
|
||||||
self.loadingDownload = true
|
self.loadingDownload = true
|
||||||
this.$download.resource(row.docUrl);
|
this.$download.resource(row.fileUrl);
|
||||||
|
|
||||||
//保存下载记录
|
//保存下载记录
|
||||||
if(this.toolDetail.toolId){
|
if(row.businessId){
|
||||||
let formData = {
|
let formData = {
|
||||||
toolId: this.toolDetail.toolId
|
'businessId': row.businessId,
|
||||||
|
'businessType': 'tool',
|
||||||
|
'attId': row.id,
|
||||||
|
'attName': row.fileOldName
|
||||||
}
|
}
|
||||||
addCount(formData).then(res => {
|
addCount(formData).then(res => {
|
||||||
});
|
});
|
||||||
|
@ -614,6 +614,7 @@ export default {
|
|||||||
handleDelete(list){
|
handleDelete(list){
|
||||||
let _this = this
|
let _this = this
|
||||||
if (!list||list.length<1) {
|
if (!list||list.length<1) {
|
||||||
|
this.$modal.msgError(`最少选择一条数据`);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_this.$modal.confirm('删除后,该流程待办任务将会被删除,请谨慎操作。是否确认执行?')
|
_this.$modal.confirm('删除后,该流程待办任务将会被删除,请谨慎操作。是否确认执行?')
|
||||||
|
@ -30,9 +30,9 @@
|
|||||||
</div><!--el-form-border 表单-->
|
</div><!--el-form-border 表单-->
|
||||||
</el-tab-pane><!--el-tab-pane-->
|
</el-tab-pane><!--el-tab-pane-->
|
||||||
<el-tab-pane label="关联文件" name="second">
|
<el-tab-pane label="关联文件" name="second">
|
||||||
<el-table :data="docList" style="width: 100%">
|
<el-table :data="attachmentList" style="width: 100%">
|
||||||
<el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" />
|
<el-table-column label="附件名称" prop="fileName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" >
|
<!-- <el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.doc_class" :value="scope.row.docType"/>
|
<dict-tag :options="dict.type.doc_class" :value="scope.row.docType"/>
|
||||||
</template>
|
</template>
|
||||||
@ -43,10 +43,10 @@
|
|||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.doc_source" :value="scope.row.docSource"/>
|
<dict-tag :options="dict.type.doc_source" :value="scope.row.docSource"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>-->
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createDate) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="180" v-if="detailData.downloadStatus">
|
<el-table-column label="操作" align="center" width="180" v-if="detailData.downloadStatus">
|
||||||
@ -55,7 +55,8 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-view"
|
icon="el-icon-view"
|
||||||
@click="handlePriew(scope.row)"
|
v-if="previewAuth(scope.row)"
|
||||||
|
@click="handlePreview(scope.row)"
|
||||||
>预览</el-button>
|
>预览</el-button>
|
||||||
<el-button type="text" icon="el-icon-download" @click="handleDownload(scope.row)" v-loading="loadingDownload">下载</el-button>
|
<el-button type="text" icon="el-icon-download" @click="handleDownload(scope.row)" v-loading="loadingDownload">下载</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -121,7 +122,7 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 上传 -->
|
<!-- 上传 -->
|
||||||
<AddDoc :show.sync="open" :toolId="detailData.toolId" @callback="getDocList"/>
|
<AddDoc :show.sync="open" :toolId="detailData.toolId" @callback="getAttachmentList"/>
|
||||||
</div><!--fbox1 左右分栏-->
|
</div><!--fbox1 左右分栏-->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -135,6 +136,8 @@
|
|||||||
import editDocument from "../document/editDocument";
|
import editDocument from "../document/editDocument";
|
||||||
import { Base64 } from 'js-base64';
|
import { Base64 } from 'js-base64';
|
||||||
import iFrame from "@/components/iFrame/index"
|
import iFrame from "@/components/iFrame/index"
|
||||||
|
import { addCount } from "@/api/tool/downloadCount";
|
||||||
|
import { listAttachment } from "@/api/attachment/attachment";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'toolDetail',
|
name: 'toolDetail',
|
||||||
@ -150,7 +153,7 @@
|
|||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
detailActiveName: 'first',
|
detailActiveName: 'first',
|
||||||
docList: [],
|
attachmentList: [],
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@ -172,12 +175,13 @@
|
|||||||
replyContent: [],
|
replyContent: [],
|
||||||
detailLoading: false,
|
detailLoading: false,
|
||||||
//详细数据
|
//详细数据
|
||||||
detailData:{}
|
detailData:{},
|
||||||
|
attFileType: "zip,rar,7z",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
this.getDetail()
|
this.getDetail()
|
||||||
this.getDocList()
|
this.getAttachmentList()
|
||||||
this.getDiscussionsList()
|
this.getDiscussionsList()
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -187,11 +191,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
getDocList() {
|
getAttachmentList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.queryParams.toolId = this.toolDetail.toolId
|
this.$set(this.queryParams,'del',"0")
|
||||||
listDocument(this.queryParams).then(response => {
|
this.$set(this.queryParams,'businessId',this.toolDetail.toolId)
|
||||||
this.docList = response.rows;
|
listAttachment(this.queryParams).then(response => {
|
||||||
|
this.attachmentList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
@ -202,9 +207,9 @@
|
|||||||
},
|
},
|
||||||
editDocumentSubmit(){
|
editDocumentSubmit(){
|
||||||
this.open = false
|
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.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.viewDialogTitle = '文档在线预览'
|
||||||
this.viewDialogOpen = true;
|
this.viewDialogOpen = true;
|
||||||
@ -225,7 +230,20 @@
|
|||||||
handleDownload(row){
|
handleDownload(row){
|
||||||
let self = this
|
let self = this
|
||||||
self.loadingDownload = true
|
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(()=>{
|
setTimeout(()=>{
|
||||||
self.loadingDownload = false
|
self.loadingDownload = false
|
||||||
},1000)
|
},1000)
|
||||||
@ -391,7 +409,25 @@
|
|||||||
}).finally(()=>{
|
}).finally(()=>{
|
||||||
self.detailLoading = false
|
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>
|
</script>
|
||||||
|
@ -72,6 +72,25 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</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-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="工具来源" prop="toolSource">
|
<el-form-item label="工具来源" prop="toolSource">
|
||||||
@ -205,40 +224,37 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="el-form-border">
|
<div class="el-form-border">
|
||||||
<div class="operate">
|
<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>-->
|
<!-- <el-button icon="el-icon-delete">删除</el-button>-->
|
||||||
</div><!--operate 操作按钮-->
|
</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 type="selection" width="50" align="center"> </el-table-column>-->
|
||||||
<el-table-column label="文档名称" prop="docName" :show-overflow-tooltip="true" />
|
<el-table-column label="序号" width="60" type="index"></el-table-column>
|
||||||
<el-table-column label="类别" prop="docType" :show-overflow-tooltip="true" width="80" >
|
<el-table-column label="附件名称" prop="fileName" :show-overflow-tooltip="true" />
|
||||||
<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="操作" align="center" width="180">
|
<el-table-column label="操作" align="center" width="180">
|
||||||
<template slot-scope="scope" v-if="scope.row.roleId !== 1">
|
<template slot-scope="scope" v-if="scope.row.roleId !== 1">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-view"
|
icon="el-icon-view"
|
||||||
v-if="isShowOperation(scope.row)"
|
v-if="previewAuth(scope.row)"
|
||||||
@click="handlePreview(scope.row)"
|
@click="handlePreview(scope.row)"
|
||||||
>预览</el-button>
|
>预览</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
@ -294,6 +310,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import iFrame from "@/components/iFrame/index"
|
import iFrame from "@/components/iFrame/index"
|
||||||
import { listDocument,delDocument } from "@/api/document/document";
|
import { listDocument,delDocument } from "@/api/document/document";
|
||||||
|
import { listAttachment } from "@/api/attachment/attachment";
|
||||||
import processcode from "@/views/workflowList/processcode/index.vue";
|
import processcode from "@/views/workflowList/processcode/index.vue";
|
||||||
import {
|
import {
|
||||||
workflowprocesskey,
|
workflowprocesskey,
|
||||||
@ -309,6 +326,9 @@ import { addTool, checkToolExist, getInfoByBpmcId, updateTool } from '@/api/tool
|
|||||||
import blUserSelector from '@/components/user-selector/src/user-selector.vue'
|
import blUserSelector from '@/components/user-selector/src/user-selector.vue'
|
||||||
import ToolSelector from '@/components/tool-selector/index.vue'
|
import ToolSelector from '@/components/tool-selector/index.vue'
|
||||||
import { Base64 } from 'js-base64'
|
import { Base64 } from 'js-base64'
|
||||||
|
import uploadVue from '@/components/FileUpload/optimizeToolUpload.vue'
|
||||||
|
import { addCount } from "@/api/tool/downloadCount";
|
||||||
|
|
||||||
// PDF本地文件预览
|
// PDF本地文件预览
|
||||||
export default {
|
export default {
|
||||||
dicts: ['sys_normal_disable','tool_type', 'tool_source', 'tool_status', 'doc_source','doc_class'],
|
dicts: ['sys_normal_disable','tool_type', 'tool_source', 'tool_status', 'doc_source','doc_class'],
|
||||||
@ -318,7 +338,8 @@ export default {
|
|||||||
Treeselect, AddDoc,
|
Treeselect, AddDoc,
|
||||||
WorkflowLogs,
|
WorkflowLogs,
|
||||||
processcode,
|
processcode,
|
||||||
iFrame
|
iFrame,
|
||||||
|
uploadVue
|
||||||
},
|
},
|
||||||
name: "Borrow_doc",
|
name: "Borrow_doc",
|
||||||
props: ['data'],
|
props: ['data'],
|
||||||
@ -339,8 +360,6 @@ export default {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
toolPrincipalsChoose: false,
|
toolPrincipalsChoose: false,
|
||||||
// 新增时的关联附件
|
|
||||||
docList: [],
|
|
||||||
addDocShow: false,
|
addDocShow: false,
|
||||||
docQueryParams: {
|
docQueryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@ -368,7 +387,9 @@ export default {
|
|||||||
userInfo: this.$store.getters.userInfo,
|
userInfo: this.$store.getters.userInfo,
|
||||||
viewShow: false,
|
viewShow: false,
|
||||||
monitorDrawerVisible:false,
|
monitorDrawerVisible:false,
|
||||||
form: {},
|
form: {
|
||||||
|
toolRespDept: this.$store.getters.userInfo.deptId
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
toolCode: [
|
toolCode: [
|
||||||
{ required: true, message: "工具编号不能为空", trigger: "blur" },
|
{ required: true, message: "工具编号不能为空", trigger: "blur" },
|
||||||
@ -383,7 +404,7 @@ export default {
|
|||||||
{ required: true, message: "负责人不能为空", trigger: "blur" }
|
{ required: true, message: "负责人不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
toolRespDept: [
|
toolRespDept: [
|
||||||
{ required: true, message: "请选择归属部门", trigger: "change" }
|
{ required: true, message: "请选择归属部门", trigger: ['blur','change'] }
|
||||||
],
|
],
|
||||||
toolSource: [
|
toolSource: [
|
||||||
{ required: true, message: "请选择工具来源", trigger: "change" }
|
{ required: true, message: "请选择工具来源", trigger: "change" }
|
||||||
@ -427,6 +448,16 @@ export default {
|
|||||||
viewDialogOpen: false,
|
viewDialogOpen: false,
|
||||||
previewUrl: '',
|
previewUrl: '',
|
||||||
loadingDownload: false,
|
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: {},
|
computed: {},
|
||||||
@ -438,6 +469,8 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.curDeptId = this.$store.getters.userInfo.deptId
|
||||||
|
this.curDeptName = this.$store.getters.userInfo.dept.deptName
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
this.init(this.data)
|
this.init(this.data)
|
||||||
}
|
}
|
||||||
@ -480,7 +513,7 @@ export default {
|
|||||||
getInfoByBpmcId(procInstId).then(async (res) => {
|
getInfoByBpmcId(procInstId).then(async (res) => {
|
||||||
let formData = res.data;
|
let formData = res.data;
|
||||||
formData.type = _this.form.type
|
formData.type = _this.form.type
|
||||||
// _this.docList = formData.documentList
|
// _this.attachmentList = formData.attachmentList
|
||||||
formData.association = JSON.parse(res.data.association)
|
formData.association = JSON.parse(res.data.association)
|
||||||
_this.form = formData
|
_this.form = formData
|
||||||
_this.getDocumentList(res.data.toolId)
|
_this.getDocumentList(res.data.toolId)
|
||||||
@ -586,7 +619,7 @@ export default {
|
|||||||
formData.association = JSON.stringify(_this.form.association)
|
formData.association = JSON.stringify(_this.form.association)
|
||||||
formData.toolRespDept = _this.userInfo.dept.deptId
|
formData.toolRespDept = _this.userInfo.dept.deptId
|
||||||
if (formData.toolId) {
|
if (formData.toolId) {
|
||||||
this.$set(formData,'documentList',_this.docList)
|
this.$set(formData,'attachmentList',_this.attachmentList)
|
||||||
updateTool(formData).then((res) => {
|
updateTool(formData).then((res) => {
|
||||||
if (res.code===200) {
|
if (res.code===200) {
|
||||||
_this.$message({
|
_this.$message({
|
||||||
@ -622,7 +655,7 @@ export default {
|
|||||||
review: _this.attributeModelBool('approve'),
|
review: _this.attributeModelBool('approve'),
|
||||||
};
|
};
|
||||||
formData.editStatus = _this.editStatus
|
formData.editStatus = _this.editStatus
|
||||||
this.$set(formData,'documentList',_this.docList)
|
this.$set(formData,'attachmentList',_this.attachmentList)
|
||||||
addTool(formData).then((res) => {
|
addTool(formData).then((res) => {
|
||||||
if (res.code===200) {
|
if (res.code===200) {
|
||||||
_this.form.toolId = res.data.businessKey;
|
_this.form.toolId = res.data.businessKey;
|
||||||
@ -768,7 +801,7 @@ export default {
|
|||||||
formData.recordStatus = 'doing'
|
formData.recordStatus = 'doing'
|
||||||
}
|
}
|
||||||
formData.editStatus = _this.editStatus
|
formData.editStatus = _this.editStatus
|
||||||
this.$set(formData,'documentList',_this.docList)
|
this.$set(formData,'attachmentList',_this.attachmentList)
|
||||||
addTool(formData).then((res) => {
|
addTool(formData).then((res) => {
|
||||||
if (res.code===200) {
|
if (res.code===200) {
|
||||||
_this.$message({
|
_this.$message({
|
||||||
@ -792,7 +825,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleDelete(row){
|
handleDelete(row){
|
||||||
this.docList.splice(row,1)
|
this.attachmentList.splice(row,1)
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 新增上传附件
|
* 新增上传附件
|
||||||
@ -805,10 +838,10 @@ export default {
|
|||||||
},
|
},
|
||||||
getDocumentList(toolId) {
|
getDocumentList(toolId) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.docQueryParams.toolId = toolId
|
this.$set(this.docQueryParams,'del',"0")
|
||||||
this.$set(this.docQueryParams,'isDeleted',"0")
|
this.$set(this.docQueryParams,'businessId',toolId)
|
||||||
listDocument(this.docQueryParams).then(res => {
|
listAttachment(this.docQueryParams).then(res => {
|
||||||
this.docList = res.rows;
|
this.attachmentList = res.rows;
|
||||||
this.total = res.total;
|
this.total = res.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
@ -822,6 +855,8 @@ export default {
|
|||||||
},
|
},
|
||||||
handleSelectNode(node){
|
handleSelectNode(node){
|
||||||
this.$set(this.form,'toolRespDeptName',node.label)
|
this.$set(this.form,'toolRespDeptName',node.label)
|
||||||
|
this.$set(this.form,'toolRespDept',node.id)
|
||||||
|
this.$refs.eForm.validateField('toolRespDept');
|
||||||
},
|
},
|
||||||
toolSelect(){
|
toolSelect(){
|
||||||
this.$refs.selectHeadTool.blur();
|
this.$refs.selectHeadTool.blur();
|
||||||
@ -842,7 +877,7 @@ export default {
|
|||||||
/** 添加关联附件数据**/
|
/** 添加关联附件数据**/
|
||||||
addFileData(dataInfo){
|
addFileData(dataInfo){
|
||||||
let document = JSON.parse(JSON.stringify(dataInfo))
|
let document = JSON.parse(JSON.stringify(dataInfo))
|
||||||
this.docList.push(document)
|
this.attachmentList.push(document)
|
||||||
},
|
},
|
||||||
findDeptInTree(tree, id) {
|
findDeptInTree(tree, id) {
|
||||||
for (const node of tree) {
|
for (const node of tree) {
|
||||||
@ -868,11 +903,29 @@ export default {
|
|||||||
},
|
},
|
||||||
isShowOperation(row){
|
isShowOperation(row){
|
||||||
let self = this
|
let self = this
|
||||||
if(row.docId == null || row.docId == undefined || row.docId == ''){
|
if(row.businessId == null || row.businessId == undefined || row.businessId == ''){
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
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){
|
handlePreview(row){
|
||||||
this.viewDialogOpen = true;
|
this.viewDialogOpen = true;
|
||||||
this.viewDialogTitle = '文档在线预览'
|
this.viewDialogTitle = '文档在线预览'
|
||||||
@ -887,15 +940,36 @@ export default {
|
|||||||
handleDownload(row){
|
handleDownload(row){
|
||||||
let self = this
|
let self = this
|
||||||
self.loadingDownload = true
|
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(()=>{
|
setTimeout(()=>{
|
||||||
self.loadingDownload = false
|
self.loadingDownload = false
|
||||||
},1000)
|
},1000)
|
||||||
},
|
},
|
||||||
handleBeforeClose() {
|
handleBeforeClose() {
|
||||||
this.viewDialogOpen = false
|
this.viewDialogOpen = false
|
||||||
}
|
},
|
||||||
},
|
handleUploadSuccess(res) {
|
||||||
|
this.attachmentList.push(res)
|
||||||
|
// 处理上传成功后的逻辑
|
||||||
|
},
|
||||||
|
handleUploadError(error) {
|
||||||
|
// 处理上传失败后的逻辑
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -403,8 +403,26 @@ export default {
|
|||||||
this.viewShow = false;
|
this.viewShow = false;
|
||||||
this.$emit("close")
|
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
|
let _this = this
|
||||||
if (!_this.procDefKey) {
|
if (!_this.procDefKey) {
|
||||||
_this.$message.warning("尚未进行流程设置,将无法发起流程!");
|
_this.$message.warning("尚未进行流程设置,将无法发起流程!");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user