<!--
|
* @Descripttion:
|
* @version:
|
* @Author: Pengjiantian
|
* @Date: 2019-08-26 15:08:09
|
* @LastEditors: PengJianTian
|
* @LastEditTime: 2019-12-10 09:53:46
|
-->
|
<template>
|
<div class="imageData">
|
<el-row>
|
<p class="title">影像资料信息</p>
|
</el-row>
|
<el-card class="box-card" v-if="state" style="border:none">
|
<div class="images" v-for="(item,index) in items" :key="index">
|
<p class="title-half" :class="!item.required ? 'not-require':''"><!-- 标题 -->
|
<i v-if="item.required">*</i> <!-- 是否必填 -->
|
{{item.description}}
|
<span>{{item.count?`(${item.count}张)`:''}}</span><!-- 当前影像多少张 -->
|
</p>
|
<!-- -->
|
<div class="imagesList"> <!-- 包含所有图片的最外层 -->
|
<div v-for="(image,i) in item.images" :key="i" v-show="item.isShow?true:i>showImageNumber?false:true">
|
<!-- 删除图片 -->
|
<span class="el-icon-error" @click="handleDelete(image.attachmentno)" v-if="imageShow"></span>
|
<img
|
src="@/assets/PDF.svg"
|
v-if="image.imagetype=='PDF'"
|
alt
|
@click="handleImageClick(image,item.objectNo,item.docType)"
|
/>
|
<img
|
src="@/assets/excel.svg"
|
v-else-if="image.imagetype=='XLSX'"
|
alt
|
@click="handleImageClick(image,item.objectNo,item.docType)"
|
/>
|
<img
|
src="@/assets/ppt.svg"
|
v-else-if="image.imagetype=='PPTX'"
|
alt
|
@click="handleImageClick(image,item.objectNo,item.docType)"
|
/>
|
<img
|
src="@/assets/word.svg"
|
v-else-if="image.imagetype=='DOCX'"
|
alt
|
@click="handleImageClick(image,item.objectNo,item.docType)"
|
/>
|
<img :src="image.url" v-else @click="handleImageClick(image,item.objectNo,item.docType)" />
|
</div>
|
<img
|
src="../../../../assets/images/hide.png"
|
alt
|
v-show="item.isShow&&item.images.length > showImageIcon"
|
@click="hide(item,index)"
|
/><!-- 多张图右下角的显示图标 -->
|
<img
|
src="../../../../assets/images/show.png"
|
alt=""
|
v-show="!item.isShow&&item.images.length > showImageIcon"
|
@click="show(item)"
|
/><!-- 多张图右下角的显示图标 -->
|
<!-- 图片上传 -->
|
<div @click="setIndex(index)" style="display: inline-block" v-if="imageShow">
|
<el-upload
|
action=""
|
:multiple="true"
|
list-type="picture-card"
|
:headers="uploadHeader"
|
:http-request="handleUpload"
|
:file-list="fileList"
|
:show-file-list="false"
|
>
|
<i class="el-icon-plus"></i>
|
</el-upload>
|
</div>
|
</div>
|
</div>
|
</el-card>
|
</div>
|
</template>
|
|
<script>
|
import { qryEnpImageInfo, addProjectImage, deleteProjectImage, enpFlowSubmit } from '@/api/area/enterprise'
|
import '@/views/area/style/images.styl'
|
import { mapState } from 'vuex'
|
|
import { communal } from '@/views/area/mixins'
|
export default {
|
mixins: [ communal ],
|
data: function() {
|
return {
|
// url: process.env.VUE_APP_API_HOST + 'server/addProjectImage',
|
items: '',
|
index: '',
|
dialogImageUrl: '',
|
dialogVisible: false,
|
fileData: '',
|
fileList: [],
|
newWindow: null,
|
uploadHeader: {
|
'Content-Type': 'multipart/form-data; boundary=ReaquestHeader'
|
},
|
state: false, // 图片请求是否请求回来的状态,
|
imageShow: false
|
}
|
},
|
computed: {
|
...mapState({
|
enterpriseParams: state => state.risk.enterpriseParams
|
}),
|
},
|
created() {
|
// console.log(this.url)
|
this.getForm()
|
},
|
methods: {
|
async getForm(i) {
|
let params = {
|
objectno: this.enterpriseParams.masterSerialNo
|
}
|
const { exhibitionAllImages } = this
|
let res = await qryEnpImageInfo(params)
|
res.result.forEach((value, index) => {
|
if (value.images.length <= exhibitionAllImages) {
|
value.isShow = true
|
} else {
|
value.isShow = false
|
}
|
if (value.images.length >= exhibitionAllImages) {
|
if (i === index) {
|
this.show(value)
|
} else {
|
this.hide(value)
|
}
|
}
|
value.images.forEach((item) => {
|
// item.imagetype = item.filename.split('.')[1].toUpperCase()
|
item.imagetype = item.filename.split('.').slice(-1).toString().toUpperCase()
|
})
|
})
|
this.items = res.result
|
this.state = true
|
this.loading = false
|
},
|
setIndex(index) {
|
this.index = index
|
},
|
handleDelete(value) {
|
// this.$confirm(`请确认是否删除该图片!`, '删除图片确认', {
|
// confirmButtonText: '确定',
|
// cancelButtonText: '取消',
|
// customClass: 'enp_messages_box',
|
// confirmButtonClass: 'enp_messages_box_confirm',
|
// cancelButtonClass: 'enp_messages_box_cancel',
|
// center: true
|
// })
|
// .then(() => {
|
deleteProjectImage(value).then(res => {
|
if (res.code === '00') {
|
this.$message.success('删除成功!')
|
this.getForm()
|
}
|
})
|
// })
|
// .catch(() => {})
|
},
|
handleUpload(file) {
|
this.fileData = file.file
|
var formData = new FormData()
|
formData.append('file', this.fileData)
|
formData.append('docNo', this.items[this.index].docNo)
|
formData.append('docType', this.items[this.index].docType)
|
formData.append('objectNo', this.enterpriseParams.masterSerialNo)
|
formData.append('objectType', this.enterpriseParams.objectType)
|
if (this.fileData !== undefined) {
|
addProjectImage(formData).then(res => {
|
if (res.code === '00') {
|
this.getForm(this.index)
|
}
|
})
|
}
|
},
|
handleSubmit() {
|
this.$emit('handleNextPage', true)
|
},
|
// 保存草稿
|
handleSaveDraft() {
|
this.$message.success('保存成功!')
|
},
|
// 保存
|
async handleSave() {
|
let params = {
|
objectno: this.enterpriseParams.masterSerialNo
|
}
|
let res = await qryEnpImageInfo(params)
|
res.result.map(item => {
|
if (item.description === '合作协议') {
|
if (item.count === 0) {
|
this.$message.error('影像资料信息-合作协议未上传')
|
} else {
|
this.$message.success('保存成功')
|
}
|
}
|
})
|
},
|
handleImageClick(image,objectno,typeno) {
|
// 根据路由模式判断路径分割方式
|
const routeStr = location.href.includes('#') ? '#/' : ''
|
// 图片点击事件
|
let attachmentno = image.attachmentno
|
let serialno = image.docno
|
// console.log('image.attachmentno:'+image.attachmentno)
|
let objecttype = 'jbo.app.ENTERPRISE_INFO'
|
let type = '2' // 1-项目 2-企业 3-合作方
|
let params = `attachmentno=${attachmentno}&serialno=${serialno}&objectno=${objectno}&objecttype=${objecttype}&typeno=${typeno}&type=${type}`
|
this.newWindow = window.open(
|
`${location.origin}${process.env.VUE_APP_HOST_PATH}${routeStr}photoViewer?${params}`,
|
'newwindow',
|
'height=700px, width=800px, top=100px,left=400px, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no'
|
)
|
},
|
// 展开图片
|
show(row) {
|
row.isShow = true
|
},
|
// 收起图片
|
hide(row) {
|
row.isShow = false
|
},
|
}
|
}
|
</script>
|
|
<style scoped lang="stylus"></style>
|