<!-- 环境数据管理 审批通过详情查看 --> <script name="EnvironmentDetailApproved" lang="ts" setup> import { ElMessage } from 'element-plus' // 从路由中传过来的参数 const type = ref<string>('') const id = ref<string>('') const route = useRoute() const router = useRouter() const title = ref('') // 逻辑 // 关闭 const resetForm = () => { router.go(-1) } // 打印 const printClickedHandler = () => { ElMessage.success('打印成功') } // 打印Word const printToWord = () => { // exportFile({ id: noticeInfo.value.id, pdf: false }) } // 打印PDF const printToPDF = () => { } const initDialog = (params: any) => { // 从路由中获取参数 type.value = params.type !== undefined ? params.type : '' id.value = params.id !== undefined ? params.id : '' switch (type.value) { case 'resistance': title.value = '实验室接地电阻记录' break case 'voltage' : title.value = '工作间供电电压记录' break case 'ups' : title.value = 'UPS蓄电池内阻测试记录' break } } onMounted(() => { initDialog(route.query) }) </script> <template> <app-container> <detail-page :title="title"> <template #btns> <el-button type="primary" @click="printToWord"> 导出Word </el-button> <el-button type="primary" @click="printToPDF"> 导出PDF </el-button> <el-button type="primary" @click="printClickedHandler"> 打印 </el-button> <el-button type="info" @click="resetForm()"> 关闭 </el-button> </template> </detail-page> </app-container> </template>