Browse Source

检验模板版本验证

master_hella_20240701
zhang_li 7 months ago
parent
commit
fe40a18398
  1. 14
      src/utils/validator.ts
  2. 4
      src/views/qms/basicDataManage/inspectionTemplate/addForm.vue

14
src/utils/validator.ts

@ -315,7 +315,18 @@ export function validateTwoNum(rule, value, callback) {
}
callback()
}
// 小数点前位数不得大于6位
export function validateNumSix(rule, value, callback) {
if (value) {
if (value.split('.')[0].length > 6) {// 校验value值不能大于10000
callback(new Error('版本号小数点前位数不得大于6'))
}else{
callback()
}
}
callback()
}
// 数字格式 小数点后两位 小数点前保留五位
export function validateTwoNumThree(rule, value, callback) {
@ -792,5 +803,6 @@ export default {
validateChargeperson,
validateYS,
validateMaxNumber5,
validatePercent
validatePercent,
validateNumSix
}

4
src/views/qms/basicDataManage/inspectionTemplate/addForm.vue

@ -434,7 +434,7 @@ import * as DynamicRuleApi from '@/api/qms/dynamicRule' //动态修改规则
import { DynamicRule } from '@/views/qms/basicDataManage/dynamicRule/dynamicRule.data' //
import * as SelectedSetApi from '@/api/qms/selectedSet' //
import { SelectedSet } from '@/views/qms/basicDataManage/selectedSet/selectedSet.data' //
import { validateInteger,validateTwoNum,validateMaxNumber5 } from '@/utils/validator'
import { validateInteger,validateTwoNum,validateMaxNumber5,validateNumSix } from '@/utils/validator'
const message = useMessage() //
const props = defineProps({
@ -501,6 +501,7 @@ const rules = ref({
description: [{ required: true, message: '请填写描述', trigger: 'blur' }],
version: [
{ required: true, message: '请填写版本', trigger: 'blur' },
{ validator:validateNumSix, message: '版本号小数点前位数不得大于6', trigger: 'blur'},
{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}
],
inspectionCode: [{ required: true, message: '请选择检验方案模板', trigger: 'blur' }],
@ -562,6 +563,7 @@ const open = async (type: string, row?: any, masterParmas?: any, titleName?: any
formType.value = type
if (row) {
data.value = JSON.parse(JSON.stringify(row))
data.value.version = String(data.value.version)
let list = await InspectionProcessPageApi.getListByTempleteCode(row.code)
list.forEach((item, index) => {
editableTabsValue.value = index + 1

Loading…
Cancel
Save