|
|
@ -78,15 +78,17 @@ |
|
|
|
</a-row> |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="24"> |
|
|
|
<div |
|
|
|
><span class="titleLabel">故障图片:</span> |
|
|
|
<a-upload v-model:file-list="fileLists" disabled> </a-upload> |
|
|
|
<a-button |
|
|
|
type="primary" |
|
|
|
@click="handleDownload(fileLists[0])" |
|
|
|
v-if="fileLists.length > 0" |
|
|
|
>下载</a-button |
|
|
|
> |
|
|
|
<div> |
|
|
|
<span class="titleLabel">故障图片:</span> |
|
|
|
<div class="file-item" v-for="file in fileLists" :key="file.url"> |
|
|
|
<span>{{ file.name }}</span> |
|
|
|
<a-button size="small" @click="handleDownload(file)" style="margin-left: 8px"> |
|
|
|
下载 |
|
|
|
</a-button> |
|
|
|
<a-button size="small" @click="preview(file)" style="margin-left: -8px"> |
|
|
|
预览 |
|
|
|
</a-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
@ -122,15 +124,17 @@ |
|
|
|
</a-row> |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="24"> |
|
|
|
<div |
|
|
|
><span class="titleLabel">处理图片:</span> |
|
|
|
<a-upload v-model:file-list="fileLists1" disabled> </a-upload> |
|
|
|
<a-button |
|
|
|
type="primary" |
|
|
|
@click="handleDownload(fileLists1[0])" |
|
|
|
v-if="fileLists1.length > 0" |
|
|
|
>下载</a-button |
|
|
|
> |
|
|
|
<div> |
|
|
|
<span class="titleLabel">处理图片:</span> |
|
|
|
<div class="file-item" v-for="file in fileLists1" :key="file.url"> |
|
|
|
<span>{{ file.name }}</span> |
|
|
|
<a-button size="small" @click="handleDownload(file)" style="margin-left: 8px"> |
|
|
|
下载 |
|
|
|
</a-button> |
|
|
|
<a-button size="small" @click="preview(file)" style="margin-left: -8px"> |
|
|
|
预览 |
|
|
|
</a-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
@ -358,6 +362,32 @@ |
|
|
|
const handleDownload = async (record) => { |
|
|
|
const data = await ossDownload(record.ossId); |
|
|
|
downloadByData(data, record.name); |
|
|
|
}; |
|
|
|
const preview = async (record) => { |
|
|
|
const data = await ossDownload(record.ossId); |
|
|
|
const objectURL = URL.createObjectURL(data); |
|
|
|
const newWindow = window.open('', '_blank'); |
|
|
|
if (newWindow) { |
|
|
|
// 创建 img 元素 |
|
|
|
const img = newWindow.document.createElement('img'); |
|
|
|
img.src = objectURL; |
|
|
|
img.style.width = '100%'; |
|
|
|
img.style.height = 'auto'; |
|
|
|
img.style.display = 'block'; |
|
|
|
|
|
|
|
// 创建一个简单的页面结构 |
|
|
|
newWindow.document.body.style.margin = '0'; |
|
|
|
newWindow.document.body.style.backgroundColor = '#000'; |
|
|
|
newWindow.document.body.style.display = 'flex'; |
|
|
|
newWindow.document.body.style.justifyContent = 'center'; |
|
|
|
newWindow.document.body.style.alignItems = 'center'; |
|
|
|
newWindow.document.body.appendChild(img); |
|
|
|
|
|
|
|
// 图片加载完成后释放 Object URL |
|
|
|
img.onload = () => { |
|
|
|
URL.revokeObjectURL(objectURL); |
|
|
|
}; |
|
|
|
} |
|
|
|
}; |
|
|
|
// 关闭抽屉的方法 |
|
|
|
const onClose = () => { |
|
|
@ -410,7 +440,8 @@ |
|
|
|
progress, |
|
|
|
fileLists, |
|
|
|
fileLists1, |
|
|
|
handleDownload |
|
|
|
handleDownload, |
|
|
|
preview |
|
|
|
}; |
|
|
|
}, |
|
|
|
}); |
|
|
|