forked from mt-fe-group/mt-yd-ui
update 文件上传组件
This commit is contained in:
parent
0b54133132
commit
d5af6a01f5
@ -58,14 +58,14 @@ export default {
|
|||||||
|
|
||||||
this.$watch('uploaderInjectFileList', function(val) {
|
this.$watch('uploaderInjectFileList', function(val) {
|
||||||
if (val && val.length) {
|
if (val && val.length) {
|
||||||
console.log('this.uploaderInjectFileList', this.uploaderInjectFileList)
|
// console.log('this.uploaderInjectFileList', this.uploaderInjectFileList)
|
||||||
/** uploaderInjectFileList 里关于文件的信息比较全,需要手动过滤一下 */
|
/** uploaderInjectFileList 里关于文件的信息比较全,需要手动过滤一下 */
|
||||||
this.fileList = val.map(item => {
|
this.fileList = val.map(item => {
|
||||||
const name = item.fileUrl.split('/').pop()
|
const name = item.fileUrl.split('/').pop()
|
||||||
return { ...pick(item, ['id', 'fileName', 'typeCode']), name }
|
return { ...pick(item, ['id', 'fileName', 'typeCode']), name }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
console.log('fillist: ', this.fileList)
|
// console.log('fillist: ', this.fileList)
|
||||||
})
|
})
|
||||||
|
|
||||||
// if (this.parentDataForm) {
|
// if (this.parentDataForm) {
|
||||||
@ -111,7 +111,7 @@ export default {
|
|||||||
|
|
||||||
/** 图片验证,由配置文件开启 */
|
/** 图片验证,由配置文件开启 */
|
||||||
validateImage(file) {
|
validateImage(file) {
|
||||||
console.log('[*] 验证图片')
|
// console.log('[*] 验证图片')
|
||||||
|
|
||||||
const isRightSize = file.size / 1024 / 1024 < 2
|
const isRightSize = file.size / 1024 / 1024 < 2
|
||||||
if (!isRightSize) {
|
if (!isRightSize) {
|
||||||
@ -146,10 +146,10 @@ export default {
|
|||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
}).then(({ data: res }) => {
|
}).then(({ data: res }) => {
|
||||||
const blob = new Blob([res])
|
const blob = new Blob([res])
|
||||||
console.log('blob', blob)
|
// console.log('blob', blob)
|
||||||
if ('download' in document.createElement('a')) {
|
if ('download' in document.createElement('a')) {
|
||||||
const alink = document.createElement('a')
|
const alink = document.createElement('a')
|
||||||
console.log('filename: ', fileName)
|
// console.log('filename: ', fileName)
|
||||||
alink.download = fileName
|
alink.download = fileName
|
||||||
alink.style.display = 'none'
|
alink.style.display = 'none'
|
||||||
alink.target = '_blank'
|
alink.target = '_blank'
|
||||||
|
@ -174,8 +174,8 @@ t.hints.date = 'Please select date'
|
|||||||
t.hints.checktime = 'Please select inspection time'
|
t.hints.checktime = 'Please select inspection time'
|
||||||
t.hints.number = 'Please input correct number'
|
t.hints.number = 'Please input correct number'
|
||||||
t.hints.addr = 'Please input address'
|
t.hints.addr = 'Please input address'
|
||||||
t.hints.upload2m = 'File size cannot be larger than 2mb (2048kb)'
|
t.hints.upload2m = 'File size cannot be larger than 2MB (2048KB)'
|
||||||
t.hints.upload2mPic = 'Image files only. File size cannot be larger than 2mb (2048kb)'
|
t.hints.upload2mPic = 'Image files only. File size cannot be larger than 2MB (2048KB)'
|
||||||
|
|
||||||
t.factory = {}
|
t.factory = {}
|
||||||
t.factory.title = 'Factory'
|
t.factory.title = 'Factory'
|
||||||
|
@ -175,8 +175,8 @@ t.hints.date = '请选择日期'
|
|||||||
t.hints.checktime = '请选择检测时间'
|
t.hints.checktime = '请选择检测时间'
|
||||||
t.hints.number = '请输入正确的数值'
|
t.hints.number = '请输入正确的数值'
|
||||||
t.hints.addr = '请输入地址'
|
t.hints.addr = '请输入地址'
|
||||||
t.hints.upload2m = '上传文件大小不要超过 2mb (2048kb)'
|
t.hints.upload2m = '上传文件大小不要超过 2MB (2048KB)'
|
||||||
t.hints.upload2mPic = '上传图片文件,且大小不要超过 2mb (2048kb)'
|
t.hints.upload2mPic = '上传图片文件,且大小不要超过 2MB (2048KB)'
|
||||||
|
|
||||||
t.factory = {}
|
t.factory = {}
|
||||||
t.factory.title = '工厂'
|
t.factory.title = '工厂'
|
||||||
|
Loading…
Reference in New Issue
Block a user