feat: 在查看模式下回显发票详情及附件。
This commit is contained in:
parent
cf19b56b6d
commit
1b64f7c1fd
@ -40,12 +40,34 @@ watch(
|
||||
() => props.visible,
|
||||
(val) => {
|
||||
if (val) {
|
||||
formData.value = {
|
||||
email: props.invoiceData?.email || '',
|
||||
content: '',
|
||||
attachments: [],
|
||||
// 如果是查看模式且有 extra 数据,则回显 extra 中的内容
|
||||
const extra = props.invoiceData?.extra
|
||||
if (props.mode === 'view' && extra) {
|
||||
formData.value = {
|
||||
email: extra.email || props.invoiceData?.email || '',
|
||||
content: extra.body || '',
|
||||
attachments: extra.file_urls || [],
|
||||
}
|
||||
// 回显附件列表
|
||||
if (extra.file_urls && Array.isArray(extra.file_urls)) {
|
||||
fileList.value = extra.file_urls.map((url, index) => ({
|
||||
id: `file-${index}`,
|
||||
name: url.split('/').pop() || `附件${index + 1}`,
|
||||
url: url,
|
||||
status: 'finished',
|
||||
}))
|
||||
} else {
|
||||
fileList.value = []
|
||||
}
|
||||
} else {
|
||||
// 开票模式,使用默认邮箱
|
||||
formData.value = {
|
||||
email: props.invoiceData?.email || '',
|
||||
content: '',
|
||||
attachments: [],
|
||||
}
|
||||
fileList.value = []
|
||||
}
|
||||
fileList.value = []
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user