|
|
@@ -13,7 +13,7 @@
|
|
|
<!-- 导航栏 -->
|
|
|
<NavBar>
|
|
|
<template #title>
|
|
|
- <HeadView v-if="renderCenter" title="操作指导书批准详情" :btn-array="btnArray" />
|
|
|
+ <HeadView v-if="renderCenter" title="安全检查记录详情" :btn-array="btnArray" />
|
|
|
<text v-else class="nav-title">安全检查记录详情</text>
|
|
|
</template>
|
|
|
</NavBar>
|
|
|
@@ -23,11 +23,16 @@
|
|
|
<view v-if="loading" class="loading-container">
|
|
|
<text class="loading-text">加载中...</text>
|
|
|
</view>
|
|
|
- <SpreadPDFViewer
|
|
|
+ <!-- <SpreadPDFViewer
|
|
|
ref="spreadPdfViewerRef"
|
|
|
:businessConfig="businessConfig"
|
|
|
:templateData="templateData"
|
|
|
:templateBlob="templateBlob"
|
|
|
+ /> -->
|
|
|
+ <BackendPDFViewer
|
|
|
+ ref="backendPdfViewerRef"
|
|
|
+ :refId="securityCheckId"
|
|
|
+ :templateId="templateId"
|
|
|
/>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -39,6 +44,7 @@ import { onLoad } from '@dcloudio/uni-app'
|
|
|
import HeadView from '../components/HeadView.vue'
|
|
|
import NavBar from '@/components/NavBar/NavBar.vue'
|
|
|
import SpreadPDFViewer from '@/components/SpreadDesigner/SpreadPDFViewer.vue'
|
|
|
+import BackendPDFViewer from '@/components/BackendPDFViewer/index.vue'
|
|
|
|
|
|
import { useConfigStore } from '@/store/config'
|
|
|
|
|
|
@@ -57,6 +63,7 @@ const orderId = ref('')
|
|
|
const unitContact = ref('')
|
|
|
const unitPhone = ref('')
|
|
|
const receiverEmail = ref('')
|
|
|
+const securityCheckId = ref('')
|
|
|
const templateId = ref('')
|
|
|
const spreadPdfViewerRef = ref<any>(null)
|
|
|
|
|
|
@@ -121,34 +128,36 @@ const init = async () => {
|
|
|
const id = detailItem.value?.id || ''
|
|
|
if (!id) return
|
|
|
const defaultTemplateResp = await requestFunc(SecurityCheckFuncName.getTemplate, equipType, { orderId: orderId.value })
|
|
|
- const res = await getStandardTemplate({ id: defaultTemplateResp.data?.templateId })
|
|
|
- const resData = (res as any).data
|
|
|
- const dataMap: any = {}
|
|
|
- const dynamicTbValResp = await getDynamicTbVal({ refId: id })
|
|
|
- const dynamicTb: any = dynamicTbValResp.data
|
|
|
- for (let i = 0; i < dynamicTb.dynamicTbValRespVOList.length; i++) {
|
|
|
- const item = dynamicTb.dynamicTbValRespVOList[i]
|
|
|
- dataMap[item.colCode] = item.valValue
|
|
|
- }
|
|
|
- // 组装templateData
|
|
|
- templateData.value = {
|
|
|
- schema: resData.bindingPathSchema ? JSON.parse(resData.bindingPathSchema) : {},
|
|
|
- data: {
|
|
|
- ...dataMap,
|
|
|
- templateId,
|
|
|
- templateUrl: resData.fileUrl,
|
|
|
- },
|
|
|
- pathNameMapping: JSON.parse(resData.bindingPathNameJson),
|
|
|
- template: templateId,
|
|
|
- templateUrl: resData.fileUrl,
|
|
|
- }
|
|
|
+ securityCheckId.value = id
|
|
|
+ templateId.value = defaultTemplateResp.data?.templateId || ''
|
|
|
+ // const res = await getStandardTemplate({ id: defaultTemplateResp.data?.templateId })
|
|
|
+ // const resData = (res as any).data
|
|
|
+ // const dataMap: any = {}
|
|
|
+ // const dynamicTbValResp = await getDynamicTbVal({ refId: id })
|
|
|
+ // const dynamicTb: any = dynamicTbValResp.data
|
|
|
+ // for (let i = 0; i < dynamicTb.dynamicTbValRespVOList.length; i++) {
|
|
|
+ // const item = dynamicTb.dynamicTbValRespVOList[i]
|
|
|
+ // dataMap[item.colCode] = item.valValue
|
|
|
+ // }
|
|
|
+ // // 组装templateData
|
|
|
+ // templateData.value = {
|
|
|
+ // schema: resData.bindingPathSchema ? JSON.parse(resData.bindingPathSchema) : {},
|
|
|
+ // data: {
|
|
|
+ // ...dataMap,
|
|
|
+ // templateId,
|
|
|
+ // templateUrl: resData.fileUrl,
|
|
|
+ // },
|
|
|
+ // pathNameMapping: JSON.parse(resData.bindingPathNameJson),
|
|
|
+ // template: templateId,
|
|
|
+ // templateUrl: resData.fileUrl,
|
|
|
+ // }
|
|
|
|
|
|
- console.log(templateData.value)
|
|
|
- // 获取 template 文件
|
|
|
- const fileUri = resData.fileUrl
|
|
|
- const fileUrl = buildFileUrl(fileUri)
|
|
|
- const fileBase64 = await spreadPdfViewerRef.value.downloadFileAsBase64(fileUrl)
|
|
|
- templateBlob.value = fileBase64
|
|
|
+ // console.log(templateData.value)
|
|
|
+ // // 获取 template 文件
|
|
|
+ // const fileUri = resData.fileUrl
|
|
|
+ // const fileUrl = buildFileUrl(fileUri)
|
|
|
+ // const fileBase64 = await spreadPdfViewerRef.value.downloadFileAsBase64(fileUrl)
|
|
|
+ // templateBlob.value = fileBase64
|
|
|
} catch (error) {
|
|
|
console.error('[Page] 初始化失败:', error)
|
|
|
uni.showToast({ title: 'PDF 加载失败', icon: 'none' })
|