forked from github/dataease
feat(图表): 图片组支持多选
This commit is contained in:
parent
89a3a54e75
commit
f325d523a0
@ -49,16 +49,22 @@ const handlePictureCardPreview = file => {
|
|||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleRemove = (_, fileList) => {
|
const handleRemove = (file, fileListArry) => {
|
||||||
uploadDisabled.value = false
|
uploadDisabled.value = false
|
||||||
element.value.propValue['urlList'] = []
|
let file_static_part = file.url.split('static-resource/')[1]
|
||||||
fileList.value = []
|
let index = element.value.propValue['urlList'].findIndex(
|
||||||
|
item => item.url.split('static-resource/')[1] === file_static_part
|
||||||
|
)
|
||||||
|
if (index !== -1) {
|
||||||
|
element.value.propValue['urlList'].splice(index, 1)
|
||||||
|
useEmitt().emitter.emit('calcData-' + element.value.id)
|
||||||
|
}
|
||||||
snapshotStore.recordSnapshotCache()
|
snapshotStore.recordSnapshotCache()
|
||||||
}
|
}
|
||||||
async function upload(file) {
|
async function upload(file) {
|
||||||
uploadFileResult(file.file, fileUrl => {
|
uploadFileResult(file.file, fileUrl => {
|
||||||
snapshotStore.recordSnapshotCache()
|
snapshotStore.recordSnapshotCache()
|
||||||
element.value.propValue.urlList.push({ name: file.file.name, url: fileUrl })
|
element.value.propValue.urlList.unshift({ name: file.file.name, url: fileUrl })
|
||||||
useEmitt().emitter.emit('calcData-' + element.value.id)
|
useEmitt().emitter.emit('calcData-' + element.value.id)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -123,6 +129,7 @@ onBeforeUnmount(() => {
|
|||||||
:on-remove="handleRemove"
|
:on-remove="handleRemove"
|
||||||
:before-upload="beforeUploadCheck"
|
:before-upload="beforeUploadCheck"
|
||||||
:http-request="upload"
|
:http-request="upload"
|
||||||
|
multiple
|
||||||
:file-list="fileList"
|
:file-list="fileList"
|
||||||
>
|
>
|
||||||
<el-icon><Plus /></el-icon>
|
<el-icon><Plus /></el-icon>
|
||||||
|
Loading…
Reference in New Issue
Block a user