diff --git a/src/views/IO/workOrder/delayAudit/data.ts b/src/views/IO/workOrder/delayAudit/data.ts index 7024e53..0da056a 100644 --- a/src/views/IO/workOrder/delayAudit/data.ts +++ b/src/views/IO/workOrder/delayAudit/data.ts @@ -35,6 +35,14 @@ import { FormSchema } from '@/components/Form'; // }, // ]; export const formSchemas: FormSchema[] = [ + { + label: '点位名称', + field: 'faultLocation', + component: 'Input', + componentProps: { + placeholder: '输入点位', + }, + }, { field: 'contractName', label: '合同名称', diff --git a/src/views/IO/workOrder/delayAudit/detailDrawer.vue b/src/views/IO/workOrder/delayAudit/detailDrawer.vue index 135aff4..697d4c5 100644 --- a/src/views/IO/workOrder/delayAudit/detailDrawer.vue +++ b/src/views/IO/workOrder/delayAudit/detailDrawer.vue @@ -78,15 +78,17 @@ -
故障图片: - - 下载 +
+ 故障图片: +
+ {{ file.name }} + + 下载 + + + 预览 + +
@@ -239,6 +241,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 = () => { @@ -284,7 +312,8 @@ statusText, progress, fileLists, - handleDownload + handleDownload, + preview }; }, }); diff --git a/src/views/IO/workOrder/orderAudit/detailDrawer.vue b/src/views/IO/workOrder/orderAudit/detailDrawer.vue index b734757..bad7d67 100644 --- a/src/views/IO/workOrder/orderAudit/detailDrawer.vue +++ b/src/views/IO/workOrder/orderAudit/detailDrawer.vue @@ -78,15 +78,17 @@ -
故障图片: - - 下载 +
+ 故障图片: +
+ {{ file.name }} + + 下载 + + + 预览 + +
@@ -122,15 +124,17 @@ -
处理图片: - - 下载 +
+ 处理图片: +
+ {{ file.name }} + + 下载 + + + 预览 + +
@@ -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 }; }, }); diff --git a/src/views/IO/workOrder/orderHandle/detailDrawer.vue b/src/views/IO/workOrder/orderHandle/detailDrawer.vue index b8e69a9..89aef79 100644 --- a/src/views/IO/workOrder/orderHandle/detailDrawer.vue +++ b/src/views/IO/workOrder/orderHandle/detailDrawer.vue @@ -80,13 +80,22 @@
故障图片: - - --> + +
+ {{ file.name }} + + 下载 + + + 预览 + +
@@ -124,13 +133,15 @@
处理图片: - - 下载 +
+ {{ file.name }} + + 下载 + + + 预览 + +
@@ -359,6 +370,32 @@ 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; @@ -412,6 +449,7 @@ fileLists, fileLists1, handleDownload, + preview }; }, }); diff --git a/src/views/IO/workOrder/orderSearch/data.ts b/src/views/IO/workOrder/orderSearch/data.ts index ecb3451..7fb3105 100644 --- a/src/views/IO/workOrder/orderSearch/data.ts +++ b/src/views/IO/workOrder/orderSearch/data.ts @@ -103,9 +103,9 @@ export const formSchemas: FormSchema[] = [ { field: 'faultLocation', label: '故障地点', - component: 'Select', + component: 'Input', componentProps: { - options: [], + placeholder: '输入编号', }, }, { diff --git a/src/views/IO/workOrder/orderSearch/detailDrawer.vue b/src/views/IO/workOrder/orderSearch/detailDrawer.vue index e630775..c0c801a 100644 --- a/src/views/IO/workOrder/orderSearch/detailDrawer.vue +++ b/src/views/IO/workOrder/orderSearch/detailDrawer.vue @@ -80,13 +80,15 @@
故障图片: - - 下载 +
+ {{ file.name }} + + 下载 + + + 预览 + +
@@ -124,13 +126,15 @@
处理图片: - - 下载 +
+ {{ file.name }} + + 下载 + + + 预览 + +
@@ -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 = () => { @@ -411,7 +441,8 @@ progress, fileLists, fileLists1, - handleDownload + handleDownload, + preview }; }, }); diff --git a/src/views/IO/workOrder/orderSearch/index.vue b/src/views/IO/workOrder/orderSearch/index.vue index 41483ec..12524d2 100644 --- a/src/views/IO/workOrder/orderSearch/index.vue +++ b/src/views/IO/workOrder/orderSearch/index.vue @@ -83,20 +83,20 @@ }); formSchemas[4].componentProps.options = faultSubcategoryOptions.value; }; - const faultLocationOptions = ref([]); - const getFaultLocationOptions = async () => { - const res = await queryPointNames(); - faultLocationOptions.value = res; - faultLocationOptions.value.forEach((i: any) => { - i.value = i.pointName; - i.label = i.pointName; - }); - formSchemas[5].componentProps.options = faultLocationOptions.value; - }; + // const faultLocationOptions = ref([]); + // const getFaultLocationOptions = async () => { + // const res = await queryPointNames(); + // faultLocationOptions.value = res; + // faultLocationOptions.value.forEach((i: any) => { + // i.value = i.pointName; + // i.label = i.pointName; + // }); + // formSchemas[5].componentProps.options = faultLocationOptions.value; + // }; const getOptions = () => { getProjectOptions(); getFaultSubcategoryOptions(); - getFaultLocationOptions(); + // getFaultLocationOptions(); }; getOptions(); onActivated(() => { diff --git a/src/views/IO/workOrder/orderSend/detailDrawer.vue b/src/views/IO/workOrder/orderSend/detailDrawer.vue index 62bba0b..fff2082 100644 --- a/src/views/IO/workOrder/orderSend/detailDrawer.vue +++ b/src/views/IO/workOrder/orderSend/detailDrawer.vue @@ -78,15 +78,17 @@ -
故障图片: - - 下载 +
+ 故障图片: +
+ {{ file.name }} + + 下载 + + + 预览 + +
@@ -124,13 +126,15 @@
处理图片: - - 下载 +
+ {{ file.name }} + + 下载 + + + 预览 + +
@@ -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 = () => { @@ -411,7 +441,8 @@ progress, fileLists, fileLists1, - handleDownload + handleDownload, + preview }; }, });