Browse Source

校验字段

master_hella_20240701
zhaoyiran 7 months ago
parent
commit
14a5d8ed3f
  1. 1
      src/views/qms/aql/index.vue
  2. 10
      src/views/qms/sampleCode/index.vue
  3. 17
      src/views/qms/sampleCode/sampleCode.data.ts

1
src/views/qms/aql/index.vue

@ -243,7 +243,6 @@ const onChange = async (field, value, formRef) => {
const suffix = field.slice(1);
// "r"
const correspondingField = field.startsWith("a") ? "r" + suffix : "a" + suffix ;
console.log(correspondingField)
// "r"
if (value) {
// "r"

10
src/views/qms/sampleCode/index.vue

@ -48,6 +48,7 @@
:apiCreate="SampleCodeApi.createSampleCode"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
@onChange="onChange"
/>
<!-- 详情 -->
@ -65,6 +66,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import {connection} from "@antv/x6/es/registry/attr/connection";
defineOptions({ name: 'SampleCode' })
@ -234,7 +236,13 @@ const searchFormClick = (searchData) => {
}
getList() //
}
const onChange = async (field, value, formRef) => {
var upperLimit = formRef.value.formModel.batchUpperLimiting
var lowLimit = formRef.value.formModel.batchLowLimiting
if(parseInt(upperLimit) <= parseInt(lowLimit)){
message.warning("批量上限须大于批量下限")
}
}
/** 初始化 **/
onMounted(async () => {
getList()

17
src/views/qms/sampleCode/sampleCode.data.ts

@ -1,12 +1,15 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import {getSamplingScheme} from '@/api/qms/sampleCode/index'
import {validateNum} from "@/utils/validator";
// 表单校验
export const SampleCodeRules = reactive({
code: [required],
batchUpperLimiting: [required],
// available: [required],
batchLowLimiting: [{ validator:validateNum, message: '请输入整数', trigger: 'blur'}],
batchUpperLimiting: [
{ required:true, message: '该项为必填', trigger: 'blur'},
{ validator:validateNum, message: '请输入整数', trigger: 'blur'}],
})
const samplingSchemeList = await getSamplingScheme()
export const SampleCode = useCrudSchemas(reactive<CrudSchema[]>([
@ -92,16 +95,6 @@ export const SampleCode = useCrudSchemas(reactive<CrudSchema[]>([
field: 'g3',
sort: 'custom',
},
// {
// label: '是否可用',
// field: 'available',
// sort: 'custom',
// dictType: DICT_TYPE.TRUE_FALSE,
// dictClass: 'string', // 默认都是字符串类型其他暂不考虑
// form: {
// component: 'Select'
// },
// },
{
label: '创建时间',
field: 'createTime',

Loading…
Cancel
Save