diff --git a/src/components/Detail/src/Detail.vue b/src/components/Detail/src/Detail.vue index 37a5f7f..186f463 100644 --- a/src/components/Detail/src/Detail.vue +++ b/src/components/Detail/src/Detail.vue @@ -496,6 +496,7 @@ const openForm = async (type: string, row?: number) => { } } } + if (await props.openFormCallBack) { props.openFormCallBack(type, row, masterParmas.value, () => { formRef.value.open(type, row, masterParmas.value) @@ -603,8 +604,8 @@ watch( } ) -function onChange(field, cur, item) { - emit('detailOnChange', field, cur, item) +function onChange(field, cur, item,formRef) { + emit('detailOnChange', field, cur, item,formRef) } diff --git a/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts b/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts index 35efad3..ecddefa 100644 --- a/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts +++ b/src/views/eam/device/deviceinspectionjob/deviceInspectionMain.data.ts @@ -35,6 +35,7 @@ export const DeviceInspectionMainRules = reactive({ maintenancePhone: [ { validator:validateHanset, message: '输入电话格式不正确', trigger: 'blur'} ], + status: [required], type: [required], faultType: [required], @@ -323,6 +324,9 @@ export const DeviceInspectionDetailRules = reactive({ { validator:validateNum, message: '请输入正整数', trigger: 'blur'}, ], maintenance: [required], + uncompleted :[ + { required:true, message: '该项为必填项', trigger: 'blur'} + ], }) export const DeviceInspectionDetail = useCrudSchemas(reactive([ @@ -377,7 +381,6 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ label: '预计分钟', field: 'estimatedMinutes', sort: 'custom', - formatter: dateFormatter, table: { width: '150', }, @@ -417,29 +420,6 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ component: 'Input', }, }, - - { - label: '完成时间', - field: 'completionTime', - sort: 'custom', - formatter: dateFormatter, - table: { - width: '150', - }, - isSearch: false, - isTable: true, - form: { - component: 'DatePicker', - componentProps: { - type: 'datetime', - valueFormat: 'x' - } - }, - tableForm: { - type: 'FormDateTime', - valueFormat: 'x' - }, - }, { label: '工程师确认', field: 'engineer', @@ -476,6 +456,29 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ } }, }, + + { + label: '完成时间', + field: 'completionTime', + sort: 'custom', + formatter: dateFormatter, + table: { + width: '150', + }, + isSearch: false, + isTable: true, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + tableForm: { + type: 'FormDateTime', + valueFormat: 'x' + }, + }, { label: '未完成原因', field: 'uncompleted', @@ -483,7 +486,6 @@ export const DeviceInspectionDetail = useCrudSchemas(reactive([ isSearch: false, isTable: true, form: { - component: 'Input', componentProps: { type: 'textarea', disabled: true, diff --git a/src/views/eam/device/deviceinspectionjob/index.vue b/src/views/eam/device/deviceinspectionjob/index.vue index 3bc7061..4f69b54 100644 --- a/src/views/eam/device/deviceinspectionjob/index.vue +++ b/src/views/eam/device/deviceinspectionjob/index.vue @@ -389,24 +389,7 @@ const detailOpenForm = (type, row) => { // 子表新增/编辑校验 const detailValidate = (data) => { // return true; - let tag = false; - // if (data.qty <= 0) { - // message.warning('数量必须大于0') - // tag = false; - // return tag; - // } else { - // tag = true; - // return tag; - // } - let req = DeviceInspectionDetailRules.uncompleted?.find(item => { - return item.required == true - }) - if (req !== undefined) { - tag = false - message.warning('需填入未完成原因') - } else { - tag = true - } + let tag = true; return tag } // 子表提交 @@ -501,15 +484,20 @@ const submitForm = async (formType, data) => { } -function detailOnChange(field, cur, item) { +function detailOnChange(field, cur, item,formRef) { if (field == 'status') { if (cur == '1') { DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false - DeviceInspectionDetailRules.uncompleted = [{ required: true }] + DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = true + formRef.setValues({completionTime:''}) + DeviceInspectionDetailRules.uncompleted = [{ required: true, message: '该项为必填项' }] + DeviceInspectionDetailRules.completionTime = [{ required: false }] } else { DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' + DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false DeviceInspectionDetailRules.uncompleted = [{ required: false }] + formRef.setValues({uncompleted:''}) + DeviceInspectionDetailRules.completionTime = [{ required: true , message: '该项为必填项'}] } } } @@ -517,17 +505,22 @@ function detailOnChange(field, cur, item) { const openFormCallBack = (type, row, masterParmas, callback) => { if (row == undefined || row == null) { DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' - DeviceInspectionDetailRules.uncompleted = [{ required: false }] + DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false + DeviceInspectionDetailRules.uncompleted = [{ required: false }] + DeviceInspectionDetailRules.completionTime = [{ required: true ,message: '该项为必填项'}] DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'status').value = '0' } else { if (row.status == '1') { DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false - DeviceInspectionDetailRules.uncompleted = [{ required: true }] + DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = true + + DeviceInspectionDetailRules.uncompleted = [{ required: true,message: '该项为必填项' }] + DeviceInspectionDetailRules.completionTime = [{ required: false }] } else { DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' + DeviceInspectionDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false DeviceInspectionDetailRules.uncompleted = [{ required: false }] + DeviceInspectionDetailRules.completionTime = [{ required: true ,message: '该项为必填项'}] } } diff --git a/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts b/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts index 5e1d466..568209e 100644 --- a/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts +++ b/src/views/eam/device/devicemaintainjob/deviceMaintainOrderMain.data.ts @@ -348,6 +348,28 @@ export const DeviceMaintainOrderDetail = useCrudSchemas(reactive([ } }, }, + { + label: '完成时间', + field: 'completionTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + } + }, { label: '未完成原因', field: 'uncompleted', @@ -430,28 +452,6 @@ export const DeviceMaintainOrderDetail = useCrudSchemas(reactive([ isSearch: false, isTableForm: false, }, - { - label: '完成时间', - field: 'completionTime', - sort: 'custom', - formatter: dateFormatter, - isSearch: true, - search: { - component: 'DatePicker', - componentProps: { - valueFormat: 'YYYY-MM-DD HH:mm:ss', - type: 'daterange', - defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] - } - }, - form: { - component: 'DatePicker', - componentProps: { - type: 'datetime', - valueFormat: 'x' - } - } - }, { label: '工程师确认', diff --git a/src/views/eam/device/devicemaintainjob/index.vue b/src/views/eam/device/devicemaintainjob/index.vue index 3ce43d6..92d6b0d 100644 --- a/src/views/eam/device/devicemaintainjob/index.vue +++ b/src/views/eam/device/devicemaintainjob/index.vue @@ -517,15 +517,20 @@ function buttonControllFunction(row, val) { } } -function detailOnChange(field, cur, item) { +function detailOnChange(field, cur, item,formRef) { if (field == 'status') { if (cur == '1') { DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false - DeviceMaintainOrderDetailRules.uncompleted = [{ required: true }] + DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = true + formRef.setValues({completionTime:''}) + DeviceMaintainOrderDetailRules.uncompleted = [{ required: true, message: '该项为必填项' }] + DeviceMaintainOrderDetailRules.completionTime = [{ required: false }] } else { DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' - DeviceMaintainOrderDetailRules.uncompleted= [{ required: false }] + DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false + DeviceMaintainOrderDetailRules.uncompleted = [{ required: false }] + formRef.setValues({uncompleted:''}) + DeviceMaintainOrderDetailRules.completionTime = [{ required: true , message: '该项为必填项'}] } } } @@ -533,17 +538,21 @@ function detailOnChange(field, cur, item) { const openFormCallBack = (type, row, masterParmas, callback) => { if (row == undefined || row == null) { DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' + DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false DeviceMaintainOrderDetailRules.uncompleted = [{ required: false }] - DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'status').value = '0' + DeviceMaintainOrderDetailRules.completionTime = [{ required: true ,message: '该项为必填项'}] + DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'status').value = '0' } else { if (row.status == '1') { DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false - DeviceMaintainOrderDetailRules.uncompleted = [{ required: true }] + DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = true + DeviceMaintainOrderDetailRules.uncompleted = [{ required: true,message: '该项为必填项' }] + DeviceMaintainOrderDetailRules.completionTime = [{ required: false }] } else { DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' + DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false DeviceMaintainOrderDetailRules.uncompleted = [{ required: false }] + DeviceMaintainOrderDetailRules.completionTime = [{ required: true ,message: '该项为必填项'}] } } callback() diff --git a/src/views/eam/mold/moldinspectionjob/index.vue b/src/views/eam/mold/moldinspectionjob/index.vue index 1536163..730ad6a 100644 --- a/src/views/eam/mold/moldinspectionjob/index.vue +++ b/src/views/eam/mold/moldinspectionjob/index.vue @@ -375,25 +375,7 @@ const detailOpenForm = (type, row) => { // 子表新增/编辑校验 const detailValidate = (data) => { - // return true; - let tag = false; - // if (data.qty <= 0) { - // message.warning('数量必须大于0') - // tag = false; - // return tag; - // } else { - // tag = true; - // return tag; - // } - let req = MoldInspectionDetailRules.uncompleted?.find(item => { - return item.required == true - }) - if (req !== undefined) { - tag = false - message.warning('需填入未完成原因') - } else { - tag = true - } + let tag = true; return tag } // 子表提交 @@ -492,15 +474,20 @@ const submitForm = async (formType, data) => { -function detailOnChange(field, cur, item) { +function detailOnChange(field, cur, item,formRef) { if (field == 'status') { if (cur == '1') { MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false - MoldInspectionDetailRules.uncompleted = [{ required: true }] + MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = true + formRef.setValues({completionTime:''}) + MoldInspectionDetailRules.uncompleted = [{ required: true, message: '该项为必填项' }] + MoldInspectionDetailRules.completionTime = [{ required: false }] } else { MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' + MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false MoldInspectionDetailRules.uncompleted = [{ required: false }] + formRef.setValues({uncompleted:''}) + MoldInspectionDetailRules.completionTime = [{ required: true , message: '该项为必填项'}] } } } @@ -508,17 +495,21 @@ function detailOnChange(field, cur, item) { const openFormCallBack = (type, row, masterParmas, callback) => { if (row == undefined || row == null) { MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' + MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false MoldInspectionDetailRules.uncompleted = [{ required: false }] - MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'status').value = '0' + MoldInspectionDetailRules.completionTime = [{ required: true ,message: '该项为必填项'}] + MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'status').value = '0' } else { - if (row.status == '1') { + if (cur == '1') { MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false - MoldInspectionDetailRules.uncompleted = [{ required: true }] + MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = true + MoldInspectionDetailRules.uncompleted = [{ required: true,message: '该项为必填项' }] + MoldInspectionDetailRules.completionTime = [{ required: false }] } else { MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' + MoldInspectionDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false MoldInspectionDetailRules.uncompleted = [{ required: false }] + MoldInspectionDetailRules.completionTime = [{ required: true ,message: '该项为必填项'}] } } callback() diff --git a/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts b/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts index 443fc7b..dd51c75 100644 --- a/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts +++ b/src/views/eam/mold/moldinspectionjob/moldInspectionMain.data.ts @@ -311,12 +311,12 @@ export const MoldInspectionDetailRules = reactive({ ], estimatedMinutes:[ required, - { validator:validateNum, message: '请输入数字格式', trigger: 'blur'} + { validator:validateNum, message: '请输入正整数', trigger: 'blur'} ], number: [required], actualMinutes: [ required, - { validator:validateNum, message: '请输入数字格式', trigger: 'blur'} + { validator:validateNum, message: '请输入正整数', trigger: 'blur'} ], maintenance: [required], }) @@ -374,7 +374,6 @@ export const MoldInspectionDetail = useCrudSchemas(reactive([ label: '预计分钟', field: 'estimatedMinutes', sort: 'custom', - formatter: dateFormatter, table: { width: '150', }, @@ -414,29 +413,6 @@ export const MoldInspectionDetail = useCrudSchemas(reactive([ component: 'Input', }, }, - - { - label: '完成时间', - field: 'completionTime', - sort: 'custom', - formatter: dateFormatter, - table: { - width: '150', - }, - isSearch: false, - isTable: true, - form: { - component: 'DatePicker', - componentProps: { - type: 'datetime', - valueFormat: 'x' - } - }, - tableForm: { - type: 'FormDateTime', - valueFormat: 'x' - }, - }, { label: '工程师确认', field: 'engineer', @@ -473,6 +449,28 @@ export const MoldInspectionDetail = useCrudSchemas(reactive([ } }, }, + { + label: '完成时间', + field: 'completionTime', + sort: 'custom', + formatter: dateFormatter, + table: { + width: '150', + }, + isSearch: false, + isTable: true, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + }, + tableForm: { + type: 'FormDateTime', + valueFormat: 'x' + }, + }, { label: '未完成原因', field: 'uncompleted', diff --git a/src/views/eam/mold/moldmaintainjob/index.vue b/src/views/eam/mold/moldmaintainjob/index.vue index c99a066..43673f4 100644 --- a/src/views/eam/mold/moldmaintainjob/index.vue +++ b/src/views/eam/mold/moldmaintainjob/index.vue @@ -512,36 +512,44 @@ function buttonControllFunction(row, val) { } } -function detailOnChange(field, cur, item) { +function detailOnChange(field, cur, item,formRef) { if (field == 'status') { if (cur == '1') { MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false - MoldMaintainOrderDetailRules.uncompleted = [{ required: true }] + MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = true + formRef.setValues({completionTime:''}) + MoldMaintainOrderDetailRules.uncompleted = [{ required: true, message: '该项为必填项' }] + MoldMaintainOrderDetailRules.completionTime = [{ required: false }] } else { MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' + MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false MoldMaintainOrderDetailRules.uncompleted = [{ required: false }] + formRef.setValues({uncompleted:''}) + MoldMaintainOrderDetailRules.completionTime = [{ required: true , message: '该项为必填项'}] } } } const openFormCallBack = (type, row, masterParmas, callback) => { if (row == undefined || row == null) { - MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' - MoldMaintainOrderDetailRules.uncompleted = [{ required: false }] - MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'status').value = '0' + MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true + MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false + MoldMaintainOrderDetailRules.uncompleted = [{ required: false }] + MoldMaintainOrderDetailRules.completionTime = [{ required: true ,message: '该项为必填项'}] + MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'status').value = '0' } else { - if (row.status == '1') { + if (cur == '1') { MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false - MoldMaintainOrderDetailRules.uncompleted = [{ required: true }] + MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = true + MoldMaintainOrderDetailRules.uncompleted = [{ required: true,message: '该项为必填项' }] + MoldMaintainOrderDetailRules.completionTime = [{ required: false }] } else { MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true - MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = '' + MoldMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'completionTime').componentProps.disabled = false MoldMaintainOrderDetailRules.uncompleted = [{ required: false }] + MoldMaintainOrderDetailRules.completionTime = [{ required: true ,message: '该项为必填项'}] } } - callback() } /** 初始化 **/ diff --git a/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts b/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts index 440ddca..fca5b68 100644 --- a/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts +++ b/src/views/eam/mold/moldmaintainjob/moldMaintainOrderMain.data.ts @@ -395,6 +395,27 @@ export const MoldMaintainOrderDetail = useCrudSchemas(reactive([ disabled: false, } }, + },{ + label: '完成时间', + field: 'completionTime', + sort: 'custom', + formatter: dateFormatter, + isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + form: { + component: 'DatePicker', + componentProps: { + type: 'datetime', + valueFormat: 'x' + } + } }, { label: '未完成原因', @@ -479,28 +500,7 @@ export const MoldMaintainOrderDetail = useCrudSchemas(reactive([ isSearch: false, isTableForm: false, }, - { - label: '完成时间', - field: 'completionTime', - sort: 'custom', - formatter: dateFormatter, - isSearch: true, - search: { - component: 'DatePicker', - componentProps: { - valueFormat: 'YYYY-MM-DD HH:mm:ss', - type: 'daterange', - defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] - } - }, - form: { - component: 'DatePicker', - componentProps: { - type: 'datetime', - valueFormat: 'x' - } - } - }, + { label: '工程师确认',