|
|
@ -78,9 +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> |
|
|
|
<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> |
|
|
@ -116,9 +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> |
|
|
|
<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> |
|
|
@ -166,6 +182,8 @@ |
|
|
|
import { getInfo, dealInfo, queryProcess, getOrderDelayHistory } from './api'; |
|
|
|
import AMapLoader from '@amap/amap-jsapi-loader'; |
|
|
|
import Icon from '@/components/Icon/Icon.vue'; |
|
|
|
import { ossDownload } from '@/api/system/oss'; |
|
|
|
import { downloadByData } from '@/utils/file/download'; |
|
|
|
export default defineComponent({ |
|
|
|
components: { Icon }, |
|
|
|
setup(props, { emit }) { |
|
|
@ -321,6 +339,7 @@ |
|
|
|
fileLists.value.push({ |
|
|
|
url: i.url, |
|
|
|
name: i.name, |
|
|
|
ossId: i.ossId, |
|
|
|
status: 'done', |
|
|
|
}); |
|
|
|
}); |
|
|
@ -340,7 +359,36 @@ |
|
|
|
} |
|
|
|
initMap(detail.longitude, detail.latitude, detail.faultLocation); |
|
|
|
}; |
|
|
|
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 = () => { |
|
|
|
visible.value = false; |
|
|
@ -392,6 +440,8 @@ |
|
|
|
progress, |
|
|
|
fileLists, |
|
|
|
fileLists1, |
|
|
|
handleDownload, |
|
|
|
preview |
|
|
|
}; |
|
|
|
}, |
|
|
|
}); |
|
|
|