<!-- 证书管理 基本信息 -->
<script name="BusinessCertBasic" lang="ts" setup>
import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'
import type { FormRules } from 'element-plus'
import dayjs from 'dayjs'
import showPhoto from '@/components/showPhoto/index.vue'
import type { dictType } from '@/global'
import { getDictByCode } from '@/api/system/dict'
import { SCHEDULE } from '@/utils/scheduleDict'
import useUserStore from '@/store/modules/user'
import useOpenPdfinBrowser from '@/commonMethods/useOpenPdfinBrowser'
import { getMeasureDataList } from '@/api/business/taskMeasure/measureData'
import { getChangeCertApplyList } from '@/api/business/certManage/changeApply'
const props = defineProps({
pageType: { // 页面类型 add新建 edit编辑 detail详情
type: String,
requre: true,
default: 'detail',
},
id: { // id
type: String,
requre: true,
},
approvalStatusName: { // 审批状态名称
type: String,
requre: true,
},
processId: { // 流程实例id
type: String,
},
})
const emits = defineEmits(['addSuccess', 'submitSuccess'])
const $router = useRouter()
const user = useUserStore() // 用户信息
const form = ref({
certificateNo: '', // 证书编号
certificateName: '', // 证书名称
orderNo: '', // 任务单编号
customerName: '', // 委托方
deptName: '', // 使用部门
sampleName: '', // 设备名称
model: '', // 规格型号
manufactureNo: '', // 出厂编号
dataNo: '', // 检定数据编号
createUserName: '', // 检定员
conclusion: '', // 检定结论
limitInstruction: '', // 限用说明
traceDate: '', // 测试、校准检定日期
printStatusName: '', // 打印状态
printFileName: '', // 证书报告
changeApplyNo: [] as any, // 证书/报告补充或更换申请单编号
certSupplementNo: [] as any, // 对编号为XXX的证书/报告的补充件编号
})
const ruleFormRef = ref() // 表单ref
const loading = ref(false) // loading
const infoId = ref('') // id
// 点击证书报告
const clickPrintFile = () => {
useOpenPdfinBrowser(form.value.printFileName)
}
// 请求证书申请更换申请单编号
const fetchCertChangeData = () => {
if (!form.value.certificateNo) {
return false
}
// 查询条件
const listQuery = {
approvalStatus: '0', // 审批状态类型code
changeApplyNo: '', // 申请单编号
changeReportName: '', // 更换证书名称
changeReportNo: form.value.certificateNo, // 更换证书编号
changeType: '', // 变更类型(字典code)
createTimeEnd: '', // 创建结束时间
createTimeStart: '', // 创建开始时间
createUserName: '', // 创建用户名字
formId: SCHEDULE.CERTIFICATE_CHANGE_APPROVAL, // formId
limit: 999999,
offset: 1,
}
getChangeCertApplyList(listQuery).then((response) => {
if (response && response.data && response.data.rows && response.data.rows.length) {
form.value.changeApplyNo = response.data.rows
}
})
}
// 点击证书更换补充申请单
const clickChangeApplyFileNo = (row: any) => {
$router.push({
path: `/certManage/changeCertApplyDoc/detail/${row.id}`,
query: {
approvalStatusName: '全部', // 审批状态名称
processId: row.processId, // 流程实例id
taskId: row.taskId, // 任务id
row: { ...row } as any,
},
})
}
// 点击对编号为XXX的证书/报告的补充件编号:
const clickSupplementFileNo = (row: any) => {
//
}
// 点击检定数据编号跳转检定数据管理详情页
const clickDataNo = () => {
if (!form.value.dataNo) {
return false
}
const params = {
certificateFile: '', // 检定证书(minio存储文件名)
conclusion: '', // 结论
createUserName: '', // 检定员
customerName: '', // 委托单位
dataNo: form.value.dataNo, // 检定数据编号
helpInstruction: '', // 辅助字段
manufactureNo: '', // 出厂编号
measureAddress: '', // 测试、校准或检定地点
measureCategory: '', // 检校类别
measureValidDateEnd: '', // 检定有效期结束
measureValidDateStart: '', // 检定有效期开始
meterIdentify: '', // 计量标识
model: '', // 规格型号
restrictionInstruction: '', // 限用说明
sampleName: '', // 受检设备名称
traceDateStart: '', // 测试、校准或检定日期开始
traceDateEnd: '', // 测试、校准或检定日期结束
deptId: '', // 使用部门
offset: 1,
limit: 20,
}
const loading = ElLoading.service({
lock: true,
text: '加载中...',
background: 'rgba(255, 255, 255, 0.6)',
})
getMeasureDataList(params).then((res) => {
if (res && res.data && res.data.rows && res.data.rows.length) {
loading.close()
$router.push({
path: `/taskMeasure/measureData/detail/${res.data.rows[0].id}`,
query: {
...res.data.rows[0],
},
})
}
else {
loading.close()
ElMessage.warning('跳转失败,请联系管理员')
}
}).catch(() => loading.close())
}
// ---------------------------------------------钩子----------------------------------------------
watch(() => props.id, (newValue) => {
infoId.value = newValue!
}, { immediate: true })
const $route = useRoute()
onMounted(async () => {
form.value.certificateNo = $route.query.certificateNo as string // 证书编号
form.value.certificateName = $route.query.certificateName as string // 证书名称
form.value.orderNo = $route.query.orderNo as string // 任务单编号
form.value.customerName = $route.query.customerName as string // 委托方
form.value.deptName = $route.query.deptName as string // 使用部门
form.value.sampleName = $route.query.sampleName as string // 设备名称
form.value.model = $route.query.model as string // 规格型号
form.value.manufactureNo = $route.query.manufactureNo as string // 出厂编号
form.value.dataNo = $route.query.dataNo as string // 检定数据编号
form.value.createUserName = $route.query.createUserName as string // 检定员
form.value.conclusion = $route.query.conclusion as string // 检定结论
form.value.limitInstruction = $route.query.limitInstruction as string // 限用说明
form.value.traceDate = $route.query.traceDate as string // 测试、校准检定日期
form.value.printStatusName = $route.query.printStatusName as string // 打印状态
form.value.printFileName = $route.query.printFileName as string // 证书报告
fetchCertChangeData() // 证书/报告补充或更换申请单编号
})
</script>
<template>
<detail-block title="">
<el-form
:model="form"
:label-width="120"
label-position="right"
>
<el-row :gutter="24">
<el-col :span="6">
<el-form-item label="证书编号:">
<el-input
v-model="form.certificateNo"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="证书名称:">
<el-input
v-model="form.certificateName"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="任务单编号:">
<el-input
v-model="form.orderNo"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="委托方:">
<el-input
v-model="form.customerName"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="使用部门:">
<el-input
v-model="form.deptName"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="设备名称:">
<el-input
v-model="form.sampleName"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="规格型号:">
<el-input
v-model="form.model"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="出厂编号:">
<el-input
v-model="form.manufactureNo"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="检定数据编号:">
<span class="link" @click="clickDataNo">{{ form.dataNo }}</span>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="检定员:">
<el-input
v-model="form.createUserName"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="检定结论:">
<el-input
v-model="form.conclusion"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="限用说明:">
<el-input
v-model="form.limitInstruction"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="测试、校准检定日期:">
<el-input
v-model="form.traceDate"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="打印状态:">
<el-input
v-model="form.printStatusName"
:class="{ 'detail-input': pageType === 'detail' }"
disabled
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24" class="marg">
<el-col :span="24">
<el-form-item label="证书报告:" label-width="260">
<span class="link" @click="clickPrintFile">{{ form.printFileName }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24" class="marg">
<el-col :span="24">
<el-form-item label="证书/报告补充或更换申请单编号:" label-width="260">
<span v-if="!form.changeApplyNo.length"> / </span>
<div v-if="Array.isArray(form.changeApplyNo) && form.changeApplyNo.length">
<span v-for="(item, index) in form.changeApplyNo" :key="index" class="link" @click="clickChangeApplyFileNo(item)">
<span>{{ item.changeApplyNo }}</span>
<span v-if="index !== form.changeApplyNo.length - 1">;</span>
</span>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24" class="marg">
<el-col :span="24">
<el-form-item label="对编号为XXX的证书/报告的补充件编号:" label-width="260">
<span v-if="!form.certSupplementNo.length"> / </span>
<div v-if="Array.isArray(form.certSupplementNo) && form.certSupplementNo.length">
<span v-for="(item, index) in form.certSupplementNo" :key="index" class="link" @click="clickSupplementFileNo(item)">
<span>{{ item.changeApplyNo }}</span>
<span v-if="index !== form.certSupplementNo.length - 1">;</span>
</span>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</detail-block>
</template>
<style lang="scss" scoped>
.link {
color: #5da0ff;
text-decoration: underline;
cursor: pointer;
margin-right: 8px;
}
</style>