|
|
|
|
@ -382,6 +382,20 @@
|
|
|
|
|
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.createTime')" align="center" prop="createTime" :formatter="dateFormatter" width="180" sortable />
|
|
|
|
|
</el-table>
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
|
|
|
|
<el-tab-pane :label="t('EquipmentManagement.EquipmentLedger.fileUrl')" name="fileUrl">
|
|
|
|
|
<el-table :data="fileUrlList" :stripe="true" :show-overflow-tooltip="true">
|
|
|
|
|
<el-table-column label="文件名称" align="left" prop="fileName" min-width="220" />
|
|
|
|
|
<el-table-column label="文件地址" align="left" prop="fileUrl" min-width="420" />
|
|
|
|
|
<el-table-column label="操作" align="center" width="120" fixed="right">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-button type="primary" link @click="handleDownloadFile(row)">
|
|
|
|
|
<Icon icon="ep:download" class="mr-5px" /> 下载
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
</el-tabs>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@ -398,6 +412,7 @@ import { TicketManagementApi } from '@/api/mes/ticketManagement'
|
|
|
|
|
import { DvRepairApi } from '@/api/mes/dvrepair'
|
|
|
|
|
import QrcodeActionCard from '@/components/QrcodeActionCard/index.vue'
|
|
|
|
|
import { useTagsViewStore } from '@/store/modules/tagsView'
|
|
|
|
|
import { downloadByUrl } from '@/utils/filt'
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'MesDeviceLedgerDetail' })
|
|
|
|
|
|
|
|
|
|
@ -445,6 +460,66 @@ const detailTemplateJson = computed(() => {
|
|
|
|
|
return templateJson
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
type FileUrlItem = {
|
|
|
|
|
fileName: string
|
|
|
|
|
fileUrl: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getFileNameFromUrl = (url: string) => {
|
|
|
|
|
const cleanUrl = url.split('?')[0]
|
|
|
|
|
const fileName = cleanUrl.substring(cleanUrl.lastIndexOf('/') + 1)
|
|
|
|
|
return decodeURIComponent(fileName || url)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const parseFileUrlList = (value: any): FileUrlItem[] => {
|
|
|
|
|
if (!value) return []
|
|
|
|
|
let rawList: any[] = []
|
|
|
|
|
if (Array.isArray(value)) {
|
|
|
|
|
rawList = value
|
|
|
|
|
} else if (typeof value === 'string') {
|
|
|
|
|
const trimmed = value.trim()
|
|
|
|
|
if (!trimmed) return []
|
|
|
|
|
try {
|
|
|
|
|
const parsed = JSON.parse(trimmed)
|
|
|
|
|
rawList = Array.isArray(parsed) ? parsed : [parsed]
|
|
|
|
|
} catch {
|
|
|
|
|
rawList = trimmed
|
|
|
|
|
.split(',')
|
|
|
|
|
.map((url) => ({ fileUrl: url.trim() }))
|
|
|
|
|
.filter((item) => item.fileUrl)
|
|
|
|
|
}
|
|
|
|
|
} else if (typeof value === 'object') {
|
|
|
|
|
rawList = [value]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rawList
|
|
|
|
|
.map((item) => {
|
|
|
|
|
if (!item) return undefined
|
|
|
|
|
const fileUrl = typeof item === 'string' ? item : item.fileUrl
|
|
|
|
|
if (!fileUrl) return undefined
|
|
|
|
|
const normalizedUrl = String(fileUrl).trim()
|
|
|
|
|
if (!normalizedUrl) return undefined
|
|
|
|
|
const fileName =
|
|
|
|
|
typeof item === 'string'
|
|
|
|
|
? getFileNameFromUrl(normalizedUrl)
|
|
|
|
|
: item.fileName || getFileNameFromUrl(normalizedUrl)
|
|
|
|
|
return {
|
|
|
|
|
fileName: String(fileName),
|
|
|
|
|
fileUrl: normalizedUrl
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.filter((item): item is FileUrlItem => Boolean(item))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const fileUrlList = computed(() => parseFileUrlList(detailData.value?.fileUrl))
|
|
|
|
|
|
|
|
|
|
const handleDownloadFile = (row: FileUrlItem) => {
|
|
|
|
|
downloadByUrl({
|
|
|
|
|
url: row.fileUrl,
|
|
|
|
|
fileName: row.fileName
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const buildDetailPrintData = () => {
|
|
|
|
|
return {
|
|
|
|
|
id: detailData.value?.id,
|
|
|
|
|
|