<!-- 测试、校准或检定工作分包通知书-详情 --> <script lang="ts" setup name="NoticeFormEdit"> import type { FormInstance, FormRules, UploadUserFile } from 'element-plus' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' // import VuePdfEmbed from 'vue-pdf-embed' // import * as pdfjsLib from 'pdfjs-dist' import dayjs from 'dayjs' import detection from './detection.vue' import { printContent } from '@/utils/exportUtils' import { printPage } from '@/api/eqpt/MeasurementBusiness/notice' const $route = useRoute() const $router = useRouter() const ruleFormRef = ref<FormInstance>() // from组件 // 显示标题 const textMap: { [key: string]: string } = { update: '编辑', create: '新增', detail: '详情', } // 对话框类型:create,update const dialogStatus = ref('create') const ruleForm = ref({ approvalStatus: '', approvalStatusName: '', contacts: '', createTime: '', createUserId: 0, createUserName: '', customerId: 0, customerName: '', decisionItem: 0, deviceName: '', groupCode: '', groupCodeName: '', id: 0, labCode: '', labCodeName: '', mobile: '', noticeDate: '', noticeName: '', noticeNo: '', noticeUserId: '', noticeUserName: '', outsourcerName: '', processId: '', taskId: '', }) // 表单 // 弹窗初始化 const initDialog = () => { dialogStatus.value = $route.params.type as string ruleFormRef.value?.resetFields() if ($route.params.type !== 'create') { const data = JSON.parse($route.query.row as string) ruleForm.value = data } } onMounted(() => { initDialog() }) // 关闭弹窗 const close = () => { $router.back() } // 取消 const resetForm = (formEl: FormInstance | undefined) => { formEl?.resetFields() close() } // 打印 const print = () => { printPage({ id: ruleForm.value.id, pdf: true }).then((res) => { // pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.js' printContent(res.data) }) } </script> <template> <app-container style="overflow: hidden;"> <detail-page :title="`测试、校准或检定工作分包通知书-${textMap[dialogStatus]}`"> <template #btns> <el-button type="primary" @click="print"> 打印 </el-button> <el-button type="info" @click="resetForm(ruleFormRef)"> 关闭 </el-button> </template> </detail-page> <detail-block-com> <el-form ref="ruleFormRef" :model="ruleForm" :class="$route.path.includes('detail') ? 'isDetail' : ''" label-position="right" label-width="120px" class="form" :disabled="$route.path.includes('detail')"> <el-row :gutter="24" class="marg"> <el-col :span="6"> <el-form-item label="通知单编号" prop="noticeNo"> <el-input v-model.trim="ruleForm.noticeNo" placeholder="通知单编号" disabled /> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="通知单名称" prop="noticeName"> <el-input v-model.trim="ruleForm.noticeName" placeholder="通知单名称" disabled /> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="创建时间"> <el-input v-model.trim="ruleForm.createTime" placeholder="创建时间" disabled /> </el-form-item> </el-col> </el-row> </el-form> </detail-block-com> <detail-block-com><detection :data="ruleForm" /></detail-block-com> </app-container> </template> <style lang="scss" scoped> // 详情页面隐藏小红点 .isDetail { ::v-deep { .el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap > .el-form-item__label::before, .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label::before { content: ""; display: none; } } } </style>