fix : 修复研究人员每行的回显

This commit is contained in:
2024-07-03 20:47:47 +08:00
parent 9edf5d484f
commit 0f0fa0f4e0
9 changed files with 63 additions and 816 deletions

View File

@@ -82,6 +82,10 @@ const props = defineProps({
labelPosition: {
type: String,
default: ''
},
tag: {
type: String,
default: ''
}
})
const emit = defineEmits(["getAttachment", "getOtherFile"])
@@ -222,32 +226,34 @@ const singleFileList = ref([])
if (props.formData.fileList !== null && props.formData.fileList?.length > 0) {
allFileList.value = props.formData.fileList
}
watch(() => props.showSingleTable, (newVal) => {
props.showSingleTable = newVal
}, {deep: true})
watch(() => props.formData.fileList, (newVal) => {
// console.log('newVal-fileList', newVal)
if (props.preview) {
newVal?.forEach(item => {
allFileList.value.push(item)
})
}
}, {deep: true})
watch(() => props.otherFileList, (newVal) => {
// console.log('newotherFileList', newVal)
if (props.preview) {
if (props.formData.fileList === null || props.formData.fileList?.length === 0) {
allFileList.value = newVal
} else {
newVal?.forEach(item => {
allFileList.value.push(item)
})
}
} else {
allFileList.value = newVal
}
}, {deep: true})
// watch(() => props.formData.fileList, (newVal) => {
// console.log('newVal-fileList', newVal)
// if (props.preview) {
// // newVal?.forEach(item => {
// // allFileList.value.push(item)
// // })
// }
// }, {deep: true})
// watch(() => props.otherFileList, (newVal) => {
// props.otherFileList=newVal
// if (props.preview) {
// console.log('newotherFileList', newVal,props.preview,props.formData.fileList)
// if (props.formData.fileList === null || props.formData.fileList?.length === 0) {
// allFileList.value = newVal
// } else {
// console.log('props.otherFileList',props.otherFileList)
// // props.otherFileList?.forEach(item => {
// // allFileList.value.push(item)
// // })
// }
// } else {
// allFileList.value = newVal
// }
// }, {deep: true})
watch(() => props.showTable, (newVal) => {
props.showTable = newVal
}, {deep: true})
@@ -271,26 +277,44 @@ const handleDelete = (row, type) => {
})
if (res.code === 1000) {
if (type === 'single') {
singleFileList.value.splice(singleFileList.value.findIndex((item) => item.id === row.fileId), 1);
singleFileList.value.splice(singleFileList.value.findIndex((item) => item.fileId === row.fileId), 1);
isSingleFile.value = false
} else {
allFileList.value.splice(allFileList.value.findIndex((item) => item.id === row.fileId), 1);
console.log('allFileList.value',allFileList.value,row)
console.log('allFileList.value.findIndex((item) => item.id === row.fileId)',allFileList.value.findIndex((item) => item.id === row.fileId))
allFileList.value.splice(allFileList.value.findIndex((item) => item.fileId === row.fileId), 1);
}
}
});
}
const handleSingleDelete = (row) => {
console.log('row',row)
// console.log('row',row)
// fileUploadRef.value.handleRemove(deleteFileVal.value.id)
handleDelete(row, 'single')
}
const getAttachment = (val) => {
console.log('getAttachment', val)
// console.log('getAttachment', val)
isSingleFile.value = true
// deleteFileVal.value=val
emit('getAttachment', val)
}
const compositeParam = (item) => {
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag:props.tag
}
}
const getOtherFile = (val) => {
if (props.preview) {
allFileList.value.push(compositeParam(val))
} else {
allFileList.value = props.otherFileList
}
emit('getOtherFile', val)
}
const deleteAttachment = (val) => {