style: 格式化代码
This commit is contained in:
@@ -5,15 +5,17 @@
|
||||
style="display: none;"
|
||||
:value="ids"
|
||||
clearable
|
||||
></el-input>
|
||||
/>
|
||||
<div style="display: flex;justify-content: space-between">
|
||||
<div style="margin-top: 13px" :style="{width: view ? '100%' : '80%'}">
|
||||
<template v-if="FileList.length > 0">
|
||||
<div v-for="file in FileList"
|
||||
<div
|
||||
v-for="file in FileList"
|
||||
:key="file.id"
|
||||
@click="onPreview(file)"
|
||||
style="color: #409eff;cursor:pointer"
|
||||
class="fileClass">
|
||||
class="fileClass"
|
||||
@click="onPreview(file)"
|
||||
>
|
||||
{{ file.name }}
|
||||
</div>
|
||||
</template>
|
||||
@@ -22,24 +24,31 @@
|
||||
</template>
|
||||
</div>
|
||||
<div v-if="!view" style="width: 20%;">
|
||||
<el-button :disabled="disabled"
|
||||
<el-button
|
||||
:disabled="disabled"
|
||||
type="primary"
|
||||
class="common-button-primary"
|
||||
size="mini"
|
||||
style="margin-left: 10px; margin-top: 11px; float: right;"
|
||||
@click="showUpload"
|
||||
style="margin-left: 10px; margin-top: 11px; float: right;">
|
||||
<i class="el-icon-upload"></i>
|
||||
>
|
||||
<i class="el-icon-upload" />
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog width='400px' :visible.sync="fileMadel" title="上传文件" v-dragDialogWidth
|
||||
:close-on-click-modal="false">
|
||||
<el-dialog
|
||||
v-dragDialogWidth
|
||||
width="400px"
|
||||
:visible.sync="fileMadel"
|
||||
title="上传文件"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-upload
|
||||
ref="importfile"
|
||||
multiple
|
||||
drag
|
||||
:file-list="fileList"
|
||||
:action="fileUrl"
|
||||
ref="importfile"
|
||||
name="file"
|
||||
:accept="accept"
|
||||
:before-upload="beforeUpload"
|
||||
@@ -49,7 +58,7 @@
|
||||
:show-file-list="true"
|
||||
>
|
||||
<div style="padding: 20px 0">
|
||||
<i class="el-icon-upload" style="color: #3399ff"></i>
|
||||
<i class="el-icon-upload" style="color: #3399ff" />
|
||||
<p>点击或拖拽上传文件</p>
|
||||
</div>
|
||||
</el-upload>
|
||||
@@ -59,7 +68,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "UploadFormItem",
|
||||
name: 'UploadFormItem',
|
||||
props: {
|
||||
ids: {
|
||||
required: true,
|
||||
@@ -97,9 +106,6 @@ export default {
|
||||
default: false
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.initFileList()
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
fileMadel: false,
|
||||
@@ -107,13 +113,16 @@ export default {
|
||||
FileList: [], // 用于回显
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.initFileList()
|
||||
},
|
||||
methods: {
|
||||
showUpload () {
|
||||
this.fileMadel = true;
|
||||
},
|
||||
initFileList () {
|
||||
if (this.ids && this.ids !== '' && this.names && this.names !== '') {
|
||||
let fileList = []
|
||||
const fileList = []
|
||||
const idArr = this.ids.split(',')
|
||||
const nameArr = this.names.split(',')
|
||||
for (let i = 0; i < idArr.length; i++) {
|
||||
@@ -200,7 +209,7 @@ export default {
|
||||
},
|
||||
// 文件预览及下载
|
||||
onPreview (file) {
|
||||
let attId = ""
|
||||
let attId = ''
|
||||
if(file && file.id) {
|
||||
attId = file.id
|
||||
}else {
|
||||
|
||||
Reference in New Issue
Block a user