refactor(inspection): 统一检验值批注识别与格式化逻辑
| | |
| | | const config = parseInspectionValueAnnotation(annotation); |
| | | return config && config.error ? config.error : null; |
| | | } |
| | | |
| | | /** 统一识别带小数位等格式参数的数值批注。 */ |
| | | export function isInspectionValueAnnotation(annotation, target) { |
| | | const config = parseInspectionValueAnnotation(annotation); |
| | | return !!config && !config.error && (!target || config.target === target); |
| | | } |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </template> |
| | | <template v-else-if="n.v.ps != undefined && n.v.ps.value === '计算值' && state == 1"><span |
| | | <template v-else-if="n.v.ps != undefined && isInspectionValueAnnotation(n.v.ps.value, '计算值') && state == 1"><span |
| | | :style="`font-family:${n.v.ff} !important;`">{{ n.v.v }}</span></template> |
| | | <template v-else-if="n.v.ps != undefined && n.v.ps.value === '最终值' && state == 1"> |
| | | <template v-else-if="n.v.ps != undefined && isInspectionValueAnnotation(n.v.ps.value, '最终值') && state == 1"> |
| | | <span :style="`font-family:${n.v.ff} !important;`">{{ n.v.v }}</span> |
| | | </template> |
| | | <template v-else-if="n.v.ps != undefined && n.v.ps.value === '样品编号'"> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { parseInspectionValueAnnotation, formatInspectionValue, isInspectionValueAnnotation } from "@/utils/inspectionValueFormat"; |
| | | // Vue3 没有 this.$createElement(下面用 h 造 VNode 当 $msgbox 的 message) |
| | | import { h } from 'vue' |
| | | import { readDetectionTimeRange, isCompleteDetectionTimeRange, toDetectionTimePayload } from '@/utils/detectionTimeRange' |
| | |
| | | this.stopWorker(); |
| | | }, |
| | | methods: { |
| | | isInspectionValueAnnotation, |
| | | closeAddVerifyDia() { |
| | | this.addCheck = false |
| | | this.checkUser = '' |
| | |
| | | b.v.ps != undefined && |
| | | typeof b.v.ps.value === 'string' && |
| | | (b.v.ps.value.includes('检验值') || |
| | | b.v.ps.value === '计算值' || |
| | | b.v.ps.value === '最终值' || |
| | | isInspectionValueAnnotation(b.v.ps.value, '计算值') || |
| | | isInspectionValueAnnotation(b.v.ps.value, '最终值') || |
| | | b.v.ps.value === '设备名称') |
| | | ) { |
| | | b.v['v'] = '' |
| | |
| | | if (value === undefined || value === null) { |
| | | return |
| | | } |
| | | cell.v.v = value |
| | | cell.v.v = formatInspectionValue(value, parseInspectionValueAnnotation(cell.v.ps && cell.v.ps.value)) |
| | | if (typeof item === 'object' && item.u) { |
| | | cell.u = item.u |
| | | } |
| | | this.param[a.templateId][key] = { |
| | | v: value, |
| | | v: cell.v.v, |
| | | u: typeof item === 'object' ? item.u : cell.u |
| | | } |
| | | }) |
| | |
| | | cell.v.ps != undefined && |
| | | typeof cell.v.ps.value === 'string' && |
| | | (cell.v.ps.value.includes('检验值') || |
| | | cell.v.ps.value === '计算值' || |
| | | cell.v.ps.value === '最终值' || |
| | | isInspectionValueAnnotation(cell.v.ps.value, '计算值') || |
| | | isInspectionValueAnnotation(cell.v.ps.value, '最终值') || |
| | | cell.v.ps.value === '设备名称') |
| | | if (!isEditable) { |
| | | return |
| | |
| | | </template> |
| | | <template v-else-if=" |
| | | n.v.ps != undefined && |
| | | n.v.ps.value === '计算值' && |
| | | isInspectionValueAnnotation(n.v.ps.value, '计算值') && |
| | | state == 1 |
| | | "><span :style="`font-family:${n.v.ff} !important;`">{{ |
| | | n.v.v |
| | | }}</span></template> |
| | | <template v-else-if=" |
| | | n.v.ps != undefined && |
| | | n.v.ps.value === '最终值' && |
| | | isInspectionValueAnnotation(n.v.ps.value, '最终值') && |
| | | state == 1 |
| | | "> |
| | | <span :style="`font-family:${n.v.ff} !important;`">{{ |
| | |
| | | import { mapGetters } from "@/utils/store-compat"; |
| | | import viewManHourDia from "@/views/business/inspectionTask/components/viewManHourDia.vue"; |
| | | import {getDicts} from "@/api/system/dict/data"; |
| | | import { parseInspectionValueAnnotation, formatInspectionValue } from "@/utils/inspectionValueFormat"; |
| | | import { parseInspectionValueAnnotation, formatInspectionValue, isInspectionValueAnnotation } from "@/utils/inspectionValueFormat"; |
| | | export default { |
| | | name: 'Inspection', |
| | | components: { |
| | |
| | | this.stopWorker(); |
| | | }, |
| | | methods: { |
| | | isInspectionValueAnnotation, |
| | | syncRouteContext() { |
| | | const { sonLaboratory, orderId, state, inspectorList, typeSource, taskSource } = this.$route.query; |
| | | const orderChanged = this.id !== orderId; |
| | |
| | | b.v.ps != undefined && |
| | | typeof b.v.ps.value === "string" && |
| | | (b.v.ps.value.includes("检验值") || |
| | | b.v.ps.value === "计算值" || |
| | | b.v.ps.value === "最终值" || |
| | | isInspectionValueAnnotation(b.v.ps.value, "计算值") || |
| | | isInspectionValueAnnotation(b.v.ps.value, "最终值") || |
| | | b.v.ps.value === "设备名称") |
| | | ) { |
| | | b.v["v"] = ""; |
| | |
| | | if (value === undefined || value === null) { |
| | | return; |
| | | } |
| | | cell.v.v = value; |
| | | cell.v.v = formatInspectionValue(value, parseInspectionValueAnnotation(cell.v.ps && cell.v.ps.value)); |
| | | if (typeof item === "object" && item.u) { |
| | | cell.u = item.u; |
| | | } |
| | | this.param[a.templateId][key] = { |
| | | v: value, |
| | | v: cell.v.v, |
| | | u: typeof item === "object" ? item.u : cell.u, |
| | | }; |
| | | }); |
| | |
| | | cell.v.ps != undefined && |
| | | typeof cell.v.ps.value === "string" && |
| | | (cell.v.ps.value.includes("检验值") || |
| | | cell.v.ps.value === "计算值" || |
| | | cell.v.ps.value === "最终值" || |
| | | isInspectionValueAnnotation(cell.v.ps.value, "计算值") || |
| | | isInspectionValueAnnotation(cell.v.ps.value, "最终值") || |
| | | cell.v.ps.value === "设备名称"); |
| | | const isExportResult = resultHeader && exportRows.has(cell.r) && cell.c === resultHeader.c; |
| | | if (!isEditable && !isExportResult) { |
| | |
| | | </template> |
| | | <template v-else-if=" |
| | | n.v.ps != undefined && |
| | | n.v.ps.value === '计算值' && |
| | | isInspectionValueAnnotation(n.v.ps.value, '计算值') && |
| | | state == 1 |
| | | "><span :style="`font-family:${n.v.ff} !important;`">{{ |
| | | n.v.v |
| | | }}</span></template> |
| | | <template v-else-if=" |
| | | n.v.ps != undefined && |
| | | n.v.ps.value === '最终值' && |
| | | isInspectionValueAnnotation(n.v.ps.value, '最终值') && |
| | | state == 1 |
| | | "> |
| | | <span :style="`font-family:${n.v.ff} !important;`">{{ |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { parseInspectionValueAnnotation, formatInspectionValue, isInspectionValueAnnotation } from "@/utils/inspectionValueFormat"; |
| | | // Vue3 没有 this.$createElement(下面用 h 造 VNode 当 $msgbox 的 message) |
| | | import { h } from 'vue' |
| | | import { readDetectionTimeRange, isCompleteDetectionTimeRange, toDetectionTimePayload } from '@/utils/detectionTimeRange' |
| | |
| | | this.stopWorker(); |
| | | }, |
| | | methods: { |
| | | isInspectionValueAnnotation, |
| | | syncRouteContext() { |
| | | const { sonLaboratory, orderId, state, inspectorList, typeSource } = this.$route.query; |
| | | const orderChanged = this.id !== orderId; |
| | |
| | | b.v.ps != undefined && |
| | | typeof b.v.ps.value === "string" && |
| | | (b.v.ps.value.includes("检验值") || |
| | | b.v.ps.value === "计算值" || |
| | | b.v.ps.value === "最终值" || |
| | | isInspectionValueAnnotation(b.v.ps.value, "计算值") || |
| | | isInspectionValueAnnotation(b.v.ps.value, "最终值") || |
| | | b.v.ps.value === "设备名称") |
| | | ) { |
| | | b.v["v"] = ""; |
| | |
| | | if (value === undefined || value === null) { |
| | | return; |
| | | } |
| | | cell.v.v = value; |
| | | cell.v.v = formatInspectionValue(value, parseInspectionValueAnnotation(cell.v.ps && cell.v.ps.value)); |
| | | if (typeof item === "object" && item.u) { |
| | | cell.u = item.u; |
| | | } |
| | | this.param[a.templateId][key] = { |
| | | v: value, |
| | | v: cell.v.v, |
| | | u: typeof item === "object" ? item.u : cell.u, |
| | | }; |
| | | }); |
| | |
| | | cell.v.ps != undefined && |
| | | typeof cell.v.ps.value === "string" && |
| | | (cell.v.ps.value.includes("检验值") || |
| | | cell.v.ps.value === "计算值" || |
| | | cell.v.ps.value === "最终值" || |
| | | isInspectionValueAnnotation(cell.v.ps.value, "计算值") || |
| | | isInspectionValueAnnotation(cell.v.ps.value, "最终值") || |
| | | cell.v.ps.value === "设备名称"); |
| | | const isExportResult = resultHeader && exportRows.has(cell.r) && cell.c === resultHeader.c; |
| | | if (!isEditable && !isExportResult) { |
| | |
| | | // 多线程里面需要保存的数据 |
| | | import Big from "big.js"; |
| | | import { parseInspectionValueAnnotation, formatInspectionValue } from "../utils/inspectionValueFormat"; |
| | | import { parseInspectionValueAnnotation, formatInspectionValue, isInspectionValueAnnotation } from "../utils/inspectionValueFormat"; |
| | | |
| | | let code = ""; |
| | | // 表格数据(渲染) |
| | |
| | | b.v.ps != undefined && |
| | | typeof b.v.ps.value == "string" && |
| | | (b.v.ps.value.includes("检验值") || |
| | | b.v.ps.value === "计算值" || |
| | | b.v.ps.value === "最终值" || |
| | | isInspectionValueAnnotation(b.v.ps.value, "计算值") || |
| | | isInspectionValueAnnotation(b.v.ps.value, "最终值") || |
| | | b.v.ps.value === "设备名称"); |
| | | const isExportResult = resultHeader && exportRows.has(b.r) && b.c === resultHeader.c; |
| | | if (!isEditable && !isExportResult) { |