<template>
|
<GlobalWindow
|
:title="title"
|
width="50%"
|
:visible.sync="visible"
|
:confirm-working="isWorking"
|
@confirm="confirm"
|
>
|
<div class="box">
|
<el-form :model="form" :rules="rules" ref="form">
|
<el-form-item label="材料" prop="supplementFileList">
|
<div class="box_item_list_row_l">
|
<div class="desc_data_list_item" v-for="(item, index) in form.supplementFileList" :key="index">
|
<div class="desc_data_list_item_dele" @click="delFile(index, 1)">删除</div>
|
<div class="desc_data_list_item_img" v-if="item.type === 0">
|
<img :src="item.fileurlFull" alt="img"/>
|
</div>
|
<div class="desc_data_list_item_img" v-if="item.type === 1">
|
<video controls :src="item.fileurlFull" />
|
</div>
|
<div class="desc_data_list_item_img" v-if="item.type === 2">
|
<i class="el-icon-folder-opened"></i>
|
</div>
|
<div class="desc_data_list_item_info">
|
<span>{{ item.name }}</span>
|
</div>
|
</div>
|
<upload width="100px" height="100px" :list="[]" accept=".png,.jpg,.jpeg,.mp4,.word,.xlsx,.xls,.pdf,.excel" folder="settle" @success="claimsUploadFile($event, 1)" />
|
</div>
|
</el-form-item>
|
</el-form>
|
</div>
|
</GlobalWindow>
|
</template>
|
|
<script>
|
import BaseOpera from '@/components/base/BaseOpera'
|
import GlobalWindow from '@/components/common/GlobalWindow'
|
import upload from '@/components/common/upload'
|
import { saveSupplementFile } from '@/api/business/settleRisk'
|
export default {
|
name: 'additionMaterial_ba',
|
extends: BaseOpera,
|
components: { GlobalWindow, upload },
|
data () {
|
return {
|
form: {
|
id: null,
|
supplementFileList: []
|
},
|
rules: {
|
supplementFileList: [
|
{ required: true, message: '至少上传一个材料', trigger: 'blur' }
|
]
|
}
|
}
|
},
|
methods: {
|
open (title, id) {
|
this.title = title
|
this.form.id = id
|
this.form.supplementFileList = []
|
this.visible = true
|
},
|
delFile (index) {
|
this.form.supplementFileList.splice(index, 1)
|
},
|
claimsUploadFile(file) {
|
file.fileurl = file.imgaddr
|
file.name = file.originname
|
file.fileurlFull = file.url
|
this.form.supplementFileList.push(file)
|
},
|
confirm() {
|
this.$refs.form.validate((valid) => {
|
if (!valid) return
|
this.isWorking = true
|
saveSupplementFile(this.form)
|
.then(() => {
|
this.visible = false
|
this.$tip.apiSuccess('添加成功')
|
this.$emit('success')
|
})
|
.catch(e => {
|
this.$tip.apiFailed(e)
|
})
|
.finally(() => {
|
this.isWorking = false
|
})
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.box {
|
width: 100%;
|
.box_item_list_row_l {
|
width: 100%;
|
display: flex;
|
align-items: center;
|
flex-wrap: wrap;
|
.desc_data_list_item {
|
width: 100px;
|
height: 100px;
|
padding: 10px;
|
box-sizing: border-box;
|
border: 1px solid #e2e2e2;
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
position: relative;
|
margin-bottom: 10px;
|
margin-left: 10px;
|
&:first-child {
|
margin-left: 0 !important;
|
}
|
.desc_data_list_item_dele {
|
position: absolute;
|
top: 5px;
|
right: 5px;
|
font-size: 14px;
|
cursor: pointer;
|
color: rgba(249, 86, 1, 0.996078431372549);
|
}
|
.desc_data_list_item_upload {
|
flex: 1;
|
height: 80px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
.desc_data_list_item_img {
|
flex-shrink: 0;
|
width: 70px;
|
height: 70px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
overflow: hidden;
|
margin-right: 10px;
|
.el-icon-folder-opened {
|
font-size: 34px;
|
color: #666666;
|
}
|
.el-icon-plus {
|
font-size: 26px;
|
color: #ffffff;
|
}
|
img {
|
width: 100%;
|
}
|
video {
|
width: 100%;
|
}
|
}
|
.desc_data_list_item_info {
|
width: 100%;
|
display: flex;
|
flex-direction: column;
|
justify-content: space-between;
|
word-break: break-all;
|
span {
|
width: 100%;
|
white-space: nowrap;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
font-size: 14px;
|
color: black;
|
}
|
}
|
}
|
}
|
}
|
</style>
|