附件上传调整
This commit is contained in:
@@ -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 => {
|
||||
});
|
||||
|
||||
@@ -614,6 +614,7 @@ export default {
|
||||
handleDelete(list){
|
||||
let _this = this
|
||||
if (!list||list.length<1) {
|
||||
this.$modal.msgError(`最少选择一条数据`);
|
||||
return
|
||||
}
|
||||
_this.$modal.confirm('删除后,该流程待办任务将会被删除,请谨慎操作。是否确认执行?')
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user