|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <div class="zt-upload"> | 
|---|
|  |  |  | <div class="zt-upload"  :class="[{'lineHeight':lineHeight}]"> | 
|---|
|  |  |  | <!-- 文件上传 --> | 
|---|
|  |  |  | <el-upload | 
|---|
|  |  |  | ref="upload" | 
|---|
|  |  |  | 
|---|
|  |  |  | </el-upload> | 
|---|
|  |  |  | <br/> | 
|---|
|  |  |  | <div v-show="progressFlag"> | 
|---|
|  |  |  | <el-progress :text-inside="true" :stroke-width="30" :percentage="progressPercent" :format="format"></el-progress> | 
|---|
|  |  |  | <el-progress :text-inside="true" :stroke-width="10" :percentage="progressPercent" :format="format"></el-progress> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <ul class="el-upload-list el-upload-list--text" v-if="!image && !crop && !onlyUploadFile"> | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | dataForm: Object, | 
|---|
|  |  |  | lineHeight:{ | 
|---|
|  |  |  | type: Boolean, | 
|---|
|  |  |  | default: false | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | action: { | 
|---|
|  |  |  | type: String, | 
|---|
|  |  |  | default: '/sys/oss/uploadNew' | 
|---|
|  |  |  | 
|---|
|  |  |  | cropData: {}, | 
|---|
|  |  |  | isShowCrop: false, | 
|---|
|  |  |  | uploading: false, | 
|---|
|  |  |  | fileList: this.getUploadList(this.value), | 
|---|
|  |  |  | uploadList: this.getUploadList(this.value), | 
|---|
|  |  |  | fileList: this.getUploadList(this.value) || [], | 
|---|
|  |  |  | uploadList: this.getUploadList(this.value) || [], | 
|---|
|  |  |  | progressFlag: false | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | 
|---|
|  |  |  | if (val) { | 
|---|
|  |  |  | if (val.length > 0) { | 
|---|
|  |  |  | if (!this.multiple) { // 单选 | 
|---|
|  |  |  | console.log(val, 'getUploadList val') | 
|---|
|  |  |  | return val | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | console.log([...val], 'getUploadList [...val]') | 
|---|
|  |  |  | return [...val] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | async handleRemove(index) { | 
|---|
|  |  |  | let file = this.uploadList[index] | 
|---|
|  |  |  | if (file.status === 1) { // 证书文件,直接从列表删除,不保存数据库 | 
|---|
|  |  |  | if (file.status === 2) { // 证书文件,直接从列表删除,不保存数据库 | 
|---|
|  |  |  | this.handRemoveAndSetValue(index) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (await this.$tip.confirm(this.$t('prompt.info', {'handle': this.$t('delete')}))) { | 
|---|
|  |  |  | 
|---|
|  |  |  | .zt-upload { | 
|---|
|  |  |  | line-height: 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .zt-upload.lineHeight{ | 
|---|
|  |  |  | line-height: 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .zt .upload-input .upload-btn { | 
|---|
|  |  |  | padding: 8px 12px; | 
|---|
|  |  |  | } | 
|---|