| | |
| | | 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"; |
| | | export default { |
| | | name: 'Inspection', |
| | | components: { |
| | |
| | | // 检验值输入后触发的函数 |
| | | changeInput(m, code, n) { |
| | | if (n) { |
| | | const config = parseInspectionValueAnnotation(n.v && n.v.ps && n.v.ps.value); |
| | | if (config && !config.error && config.decimalPlaces != null && typeof n.v.v === 'string') { |
| | | const numericPattern = config.displayMode === 'SCIENTIFIC' |
| | | ? /^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/ |
| | | : /^[+-]?\d*\.?\d+$/; |
| | | if (n.v.v.trim() && !numericPattern.test(n.v.v.trim())) { |
| | | this.$message.warning('该检验值必须填写数字'); |
| | | return; |
| | | } |
| | | n.v.v = formatInspectionValue(n.v.v, config); |
| | | } |
| | | // 定义一个函数来验证分数是否有效 |
| | | if (typeof n.v.v == "string") { |
| | | function isValidFraction(fraction) { |
| | |
| | | const v = n.v.v; |
| | | // 能力范围已废弃,检验值类型不再作为判断依据。整串只由算式字符组成时才规范化格式, |
| | | // 出现中文等其它字符即按文本处理原样保留,否则文字会被逐字删掉 |
| | | if (typeof v !== "string" || /[^\d.^e>>≥≤<<断裂脆化\-/+]/.test(v)) { |
| | | if (typeof v !== "string" || /[^\d.^eE>>≥≤<<断裂脆化\-/+]/.test(v)) { |
| | | return; |
| | | } |
| | | n.v.v = v |