前后台-- -- 上传附件

This commit is contained in:
gaoyuanwei 2022-09-01 13:50:42 +08:00
parent 7ff222761c
commit 2ff89ea6e4
9 changed files with 136 additions and 8 deletions

View File

@ -293,7 +293,7 @@ export default {
}) })
this.allData = JSON.parse(JSON.stringify(this.transferData)) this.allData = JSON.parse(JSON.stringify(this.transferData))
}).catch(err => { }).catch(err => {
this.$message.error(err) this.$message.error('未搜索到相关数据资源')
}) })
} }
}, },
@ -316,6 +316,7 @@ export default {
title: this.type, title: this.type,
list: this.selectedArray list: this.selectedArray
}) })
console.log(this.selectedArray, this.displayList, 'this.displayList')
}, },
getDisplay (displayList) { getDisplay (displayList) {
this.displayList = [] this.displayList = []

View File

@ -36,8 +36,10 @@
tip="支持文件类型大小不超过100M"></upload> tip="支持文件类型大小不超过100M"></upload>
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.mp4' :list="item" v-else-if="item.type == 'video'" type="视频" btnName="上传视频" :maxCount="1" :dataList="item" <upload @changeInfoList='changeInfoList' :title='item.name' accept='.mp4' :list="item" v-else-if="item.type == 'video'" type="视频" btnName="上传视频" :maxCount="1" :dataList="item"
tip="支持视频类型大小不超过100M"></upload> tip="支持视频类型大小不超过100M"></upload>
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.zip' :list="item" v-else-if="item.type == 'package'" type="安装包" btnName="上传安装包" :maxCount="1" :dataList="item" <upload @changeInfoList='changeInfoList' :title='item.name' accept='.zip' :list="item" v-else-if="item.type == 'package' &&item.name != '上传附件'" type="安装包" btnName="上传安装包" :maxCount="1" :dataList="item"
tip="支持.zip类型大小不超过100M"></upload> tip="支持.zip类型大小不超过100M"></upload>
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.pdf,.ppt,.xlsx,.doc,.docx,.zip' :list="item" v-else-if="item.name == '上传附件'" type="附件" btnName="上传附件" :maxCount="1" :dataList="item"
tip="大小不超过100M"></upload>
<input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'AbilityType'" type="disabled" :data="item" :name="item.name" :value="typeInput"></input-select-checkbox> <input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'AbilityType'" type="disabled" :data="item" :name="item.name" :value="typeInput"></input-select-checkbox>
<input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'ComponentType'" type="disabled" :data="item" :name="item.name" :value="type"></input-select-checkbox> <input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'ComponentType'" type="disabled" :data="item" :name="item.name" :value="type"></input-select-checkbox>
<input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'input'" type="input" :data="item" :name="item.name"></input-select-checkbox> <input-select-checkbox :changeField='changeField' :list="[]" v-else-if="item.type == 'input'" type="input" :data="item" :name="item.name"></input-select-checkbox>
@ -267,7 +269,7 @@ export default {
} }
.item { .item {
position: relative; position: relative;
.box{ .box {
display: flex; display: flex;
align-items: center; align-items: center;
margin: 25px 0; margin: 25px 0;
@ -276,17 +278,17 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.required{ .required {
color: #f56c6c; color: #f56c6c;
margin-right: 3px; margin-right: 3px;
} }
} }
.requiredTips{ .requiredTips {
font-size: 14px; font-size: 14px;
color: #f56c6c; color: #f56c6c;
position: absolute; position: absolute;
bottom:-20px; bottom: -20px;
left:110px; left: 110px;
} }
} }
</style> </style>

View File

@ -69,6 +69,7 @@
:dataFrom="dataFrom" :dataFrom="dataFrom"
:fileList="fileList" :fileList="fileList"
:packageList="packageList" :packageList="packageList"
:accessoryList="accessoryList"
:imgList="imgList" :imgList="imgList"
:externalField="['接口服务', '接口请求方式']" :externalField="['接口服务', '接口请求方式']"
:configure="bs" :configure="bs"
@ -370,6 +371,7 @@
const navList2 = ref([]) const navList2 = ref([])
const fileList = ref({}) const fileList = ref({})
const packageList = ref({}) const packageList = ref({})
const accessoryList = ref({})
const imgList = ref({}) const imgList = ref({})
const videoList = ref({}) const videoList = ref({})
const data = ref({}) const data = ref({})
@ -787,6 +789,9 @@
mybus.on('chagePackageList', (obj) => { mybus.on('chagePackageList', (obj) => {
packageList.value = obj packageList.value = obj
}) })
mybus.on('chageAccessory', (obj) => {
accessoryList.value = obj
})
mybus.on('chageImgList', (obj) => { mybus.on('chageImgList', (obj) => {
imgList.value = obj imgList.value = obj
}) })
@ -836,6 +841,7 @@
mybus.off('chageDataFromDwon') mybus.off('chageDataFromDwon')
mybus.off('chageVideoList') mybus.off('chageVideoList')
mybus.off('chagePackageList') mybus.off('chagePackageList')
mybus.off('chageAccessory')
}) })
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -69,6 +69,7 @@
:dataFrom="dataFrom" :dataFrom="dataFrom"
:fileList="fileList" :fileList="fileList"
:fileList2="fileList2" :fileList2="fileList2"
:accessoryList="accessoryList"
:imgList="imgList" :imgList="imgList"
:configure="bs" :configure="bs"
@submit="submit()" @submit="submit()"
@ -339,6 +340,7 @@
const navList2 = ref([]) const navList2 = ref([])
const fileList = ref({}) const fileList = ref({})
const fileList2 = ref({}) const fileList2 = ref({})
const accessoryList = ref({})
const imgList = ref({}) const imgList = ref({})
const videoList = ref({}) const videoList = ref({})
const data = ref({}) const data = ref({})
@ -751,6 +753,9 @@
mybus.on('chageVideoList', (obj) => { mybus.on('chageVideoList', (obj) => {
videoList.value = obj videoList.value = obj
}) })
mybus.on('chageAccessory', (obj) => {
accessoryList.value = obj
})
//datafrom //datafrom
mybus.on('chageDataFromDwon', (obj) => { mybus.on('chageDataFromDwon', (obj) => {
switch (obj.attrType) { switch (obj.attrType) {
@ -793,6 +798,7 @@
mybus.off('chageFileList2') mybus.off('chageFileList2')
mybus.off('chageImgList') mybus.off('chageImgList')
mybus.off('chageDataFromDwon') mybus.off('chageDataFromDwon')
mybus.off('chageAccessory')
}) })
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -69,6 +69,7 @@
:dataFrom="dataFrom" :dataFrom="dataFrom"
:fileList="fileList" :fileList="fileList"
:fileList2="fileList2" :fileList2="fileList2"
:accessoryList="accessoryList"
:configure="bs" :configure="bs"
@submit="submit()" @submit="submit()"
@back="back()" @back="back()"
@ -338,6 +339,7 @@
const navList2 = ref([]) const navList2 = ref([])
const fileList = ref({}) const fileList = ref({})
const fileList2 = ref({}) const fileList2 = ref({})
const accessoryList = ref({})
const imgList = ref({}) const imgList = ref({})
const videoList = ref({}) const videoList = ref({})
const data = ref({}) const data = ref({})
@ -748,6 +750,9 @@
mybus.on('chageVideoList', (obj) => { mybus.on('chageVideoList', (obj) => {
videoList.value = obj videoList.value = obj
}) })
mybus.on('chageAccessory', (obj) => {
accessoryList.value = obj
})
//datafrom //datafrom
mybus.on('chageDataFromDwon', (obj) => { mybus.on('chageDataFromDwon', (obj) => {
switch (obj.attrType) { switch (obj.attrType) {
@ -790,6 +795,7 @@
mybus.off('chageFileList2') mybus.off('chageFileList2')
mybus.off('chageImgList') mybus.off('chageImgList')
mybus.off('chageDataFromDwon') mybus.off('chageDataFromDwon')
mybus.off('chageAccessory')
}) })
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -66,6 +66,7 @@
:dataFrom="dataFrom" :dataFrom="dataFrom"
:fileList="fileList" :fileList="fileList"
:fileList2="fileList2" :fileList2="fileList2"
:accessoryList="accessoryList"
:configure="bs" :configure="bs"
@submit="submit()" @submit="submit()"
@back="back()" @back="back()"
@ -237,6 +238,7 @@
const navList2 = ref([]) const navList2 = ref([])
const fileList = ref({}) const fileList = ref({})
const fileList2 = ref({}) const fileList2 = ref({})
const accessoryList = ref({})
const imgList = ref({}) const imgList = ref({})
const videoList = ref({}) const videoList = ref({})
const data = ref({}) const data = ref({})
@ -618,6 +620,9 @@
mybus.on('chageVideoList', (obj) => { mybus.on('chageVideoList', (obj) => {
videoList.value = obj videoList.value = obj
}) })
mybus.on('chageAccessory', (obj) => {
accessoryList.value = obj
})
//datafrom //datafrom
mybus.on('chageDataFromDwon', (obj) => { mybus.on('chageDataFromDwon', (obj) => {
switch (obj.attrType) { switch (obj.attrType) {
@ -660,6 +665,7 @@
mybus.off('chageFileList2') mybus.off('chageFileList2')
mybus.off('chageImgList') mybus.off('chageImgList')
mybus.off('chageDataFromDwon') mybus.off('chageDataFromDwon')
mybus.off('chageAccessory')
}) })
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -301,6 +301,16 @@
:list="props.fileList2" :list="props.fileList2"
tip="支持文件类型大小不超过100M" tip="支持文件类型大小不超过100M"
></upload> ></upload>
<upload
v-else-if="item.type == 'package' && item.name == '上传附件'"
type="附件"
btnName="上传附件"
:maxCount="1"
:data="item"
:busType="2"
:list="props.fileList2"
tip="支持文件类型大小不超过100M"
></upload>
<upload <upload
v-else-if="item.type == 'package'" v-else-if="item.type == 'package'"
type="压缩包" type="压缩包"

View File

@ -78,6 +78,13 @@
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
} else if (props.type === '压缩包') { } else if (props.type === '压缩包') {
flag = file.type === 'application/x-zip-compressed' flag = file.type === 'application/x-zip-compressed'
} else if (props.type === '附件') {
flag =
file.type === 'application/pdf' ||
file.type === 'application/msword' ||
file.type ===
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ||
file.type === 'application/x-zip-compressed'
} }
console.log(flag) console.log(flag)
if (!flag) { if (!flag) {
@ -131,6 +138,8 @@
} }
} else if (props.type === '压缩包') { } else if (props.type === '压缩包') {
mybus.emit('chagePackageList', fileList.value) mybus.emit('chagePackageList', fileList.value)
} else if (props.type === '附件') {
mybus.emit('chageAccessory', fileList.value)
} else if (props.type === '视频') { } else if (props.type === '视频') {
console.log(fileList.value) console.log(fileList.value)
mybus.emit('chageVideoList', fileList.value) mybus.emit('chageVideoList', fileList.value)

View File

@ -84,7 +84,12 @@
</div> </div>
<div class="box" v-if="item.list.length > 0"> <div class="box" v-if="item.list.length > 0">
<div class="ability" v-for="val in item.list" :key="val.id"> <div
class="ability"
v-for="val in item.list"
:key="val.id"
:class="item.approveStatus === '通过' ? 'clickCursor' : ''"
>
<div <div
class="left" class="left"
:class=" :class="
@ -148,6 +153,25 @@
申请结果{{ 申请结果{{
item.ended ? item.approveStatus || '审核完成' : '审核中' item.ended ? item.approveStatus || '审核完成' : '审核中'
}} }}
<a-button
v-if="
item.approveStatus === '通过' &&
val.infoList.filter(
(item) => item.attrType == '上传附件'
)[0]
"
@click.stop="downloadFile(item, '附件下载')"
class="DownloadAttachment"
>
附件下载
</a-button>
<a-button
v-if="item.approveStatus === '通过'"
@click.stop="switchFunction(item)"
class="DownloadAttachment2"
>
查看详情
</a-button>
</div> </div>
</div> </div>
</div> </div>
@ -313,6 +337,48 @@
} }
} }
} }
const switchFunction = (data) => {
if (data.approveStatus === '通过') {
let id = data.list[0].id
const applypage = router.resolve({
path: '/details', //
query: {
id: id,
},
})
window.open(applypage.href, '_blank')
}
}
const downloadFile = (data, name) => {
let path = data.list[0].infoList.filter(
(item) => item.attrType === '上传附件'
)[0].attrValue
console.log(path, 'obj')
const xhr = new XMLHttpRequest()
xhr.open('get', path)
xhr.responseType = 'blob'
xhr.send()
xhr.onload = function () {
if (this.status === 200 || this.status === 304) {
// IE10downloadmsSaveOrOpenBlobIE10msSaveOrOpenBlob
if ('msSaveOrOpenBlob' in navigator) {
navigator.msSaveOrOpenBlob(this.response, name)
return
}
// const blob = new Blob([this.response], { type: xhr.getResponseHeader('Content-Type') });
// const url = URL.createObjectURL(blob);
const url = URL.createObjectURL(this.response)
const a = document.createElement('a')
a.style.display = 'none'
a.href = url
a.download = name
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
URL.revokeObjectURL(url)
}
}
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.title { .title {
@ -487,8 +553,24 @@
// color: #0058e1; // color: #0058e1;
// cursor: pointer; // cursor: pointer;
// } // }
.result {
position: relative;
}
} }
} }
.DownloadAttachment {
position: absolute;
right: 10px;
top: -150px;
}
.DownloadAttachment2 {
position: absolute;
right: 10px;
top: -110px;
}
}
.clickCursor {
cursor: pointer;
} }
} }
} }