diff --git a/src/views/business/measure/item/components/seventh/templateDetail.vue b/src/views/business/measure/item/components/seventh/templateDetail.vue index bf198f5..ceaf58f 100644 --- a/src/views/business/measure/item/components/seventh/templateDetail.vue +++ b/src/views/business/measure/item/components/seventh/templateDetail.vue @@ -57,6 +57,13 @@ indicationError: 1, appearanceFunctionCheck: 1, }) +watch(() => props.form, (newVal) => { + if (newVal) { + form.value = newVal + } +}, { + deep: true, +}) // --------------------------------------------钩子---------------------------------------------------- watch(() => props.itemCategoryName, (newValue) => { if (newValue) { @@ -126,12 +133,11 @@ // ---------------------------------------------校验--------------------------------------------------- // 校验表格(点击保存的时候用、生成标准器示值) function checkList() { - console.log(form.value) - if (!Number(form.value.indicationError)! && Number(form.value.appearanceFunctionCheck)) { + if (!Number(form.value.indicationError) && !Number(form.value.appearanceFunctionCheck)) { ElMessage.warning('检定项不能为空') return false } - if (form.value.indicationError) { + if (Number(form.value.indicationError)) { if (!list.value.length) { ElMessage.warning('示值测试列表不能为空') return false diff --git a/src/views/business/measure/item/components/seventh/templateDetail.vue b/src/views/business/measure/item/components/seventh/templateDetail.vue index bf198f5..ceaf58f 100644 --- a/src/views/business/measure/item/components/seventh/templateDetail.vue +++ b/src/views/business/measure/item/components/seventh/templateDetail.vue @@ -57,6 +57,13 @@ indicationError: 1, appearanceFunctionCheck: 1, }) +watch(() => props.form, (newVal) => { + if (newVal) { + form.value = newVal + } +}, { + deep: true, +}) // --------------------------------------------钩子---------------------------------------------------- watch(() => props.itemCategoryName, (newValue) => { if (newValue) { @@ -126,12 +133,11 @@ // ---------------------------------------------校验--------------------------------------------------- // 校验表格(点击保存的时候用、生成标准器示值) function checkList() { - console.log(form.value) - if (!Number(form.value.indicationError)! && Number(form.value.appearanceFunctionCheck)) { + if (!Number(form.value.indicationError) && !Number(form.value.appearanceFunctionCheck)) { ElMessage.warning('检定项不能为空') return false } - if (form.value.indicationError) { + if (Number(form.value.indicationError)) { if (!list.value.length) { ElMessage.warning('示值测试列表不能为空') return false diff --git a/src/views/business/measure/item/detail.vue b/src/views/business/measure/item/detail.vue index 87cbf82..83cc8ca 100644 --- a/src/views/business/measure/item/detail.vue +++ b/src/views/business/measure/item/detail.vue @@ -340,10 +340,12 @@ helpFieldInstruction: form.value.helpFieldInstruction, // 辅助字段说明 itemRemark: form.value.itemRemark, // 检定项备注 itemId: infoId.value, // 检定项id - measureItemDataPointMeterList: standardRef.value.list.map((item: any) => ({ - ...item, - itemId: infoId.value, - })), + measureItemDataPointMeterList: Number(standardRef.value.form.indicationError) + ? standardRef.value.list.map((item: any) => ({ + ...item, + itemId: infoId.value, + })) + : [{}], appearanceFunctionCheck: standardRef.value.form.appearanceFunctionCheck, // 外观及功能检查 indicationError: standardRef.value.form.indicationError, // 外观及功能检查 } diff --git a/src/views/business/measure/item/components/seventh/templateDetail.vue b/src/views/business/measure/item/components/seventh/templateDetail.vue index bf198f5..ceaf58f 100644 --- a/src/views/business/measure/item/components/seventh/templateDetail.vue +++ b/src/views/business/measure/item/components/seventh/templateDetail.vue @@ -57,6 +57,13 @@ indicationError: 1, appearanceFunctionCheck: 1, }) +watch(() => props.form, (newVal) => { + if (newVal) { + form.value = newVal + } +}, { + deep: true, +}) // --------------------------------------------钩子---------------------------------------------------- watch(() => props.itemCategoryName, (newValue) => { if (newValue) { @@ -126,12 +133,11 @@ // ---------------------------------------------校验--------------------------------------------------- // 校验表格(点击保存的时候用、生成标准器示值) function checkList() { - console.log(form.value) - if (!Number(form.value.indicationError)! && Number(form.value.appearanceFunctionCheck)) { + if (!Number(form.value.indicationError) && !Number(form.value.appearanceFunctionCheck)) { ElMessage.warning('检定项不能为空') return false } - if (form.value.indicationError) { + if (Number(form.value.indicationError)) { if (!list.value.length) { ElMessage.warning('示值测试列表不能为空') return false diff --git a/src/views/business/measure/item/detail.vue b/src/views/business/measure/item/detail.vue index 87cbf82..83cc8ca 100644 --- a/src/views/business/measure/item/detail.vue +++ b/src/views/business/measure/item/detail.vue @@ -340,10 +340,12 @@ helpFieldInstruction: form.value.helpFieldInstruction, // 辅助字段说明 itemRemark: form.value.itemRemark, // 检定项备注 itemId: infoId.value, // 检定项id - measureItemDataPointMeterList: standardRef.value.list.map((item: any) => ({ - ...item, - itemId: infoId.value, - })), + measureItemDataPointMeterList: Number(standardRef.value.form.indicationError) + ? standardRef.value.list.map((item: any) => ({ + ...item, + itemId: infoId.value, + })) + : [{}], appearanceFunctionCheck: standardRef.value.form.appearanceFunctionCheck, // 外观及功能检查 indicationError: standardRef.value.form.indicationError, // 外观及功能检查 } diff --git a/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue b/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue index 249abb1..aceb056 100644 --- a/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue +++ b/src/views/business/taskMeasure/measureData/components/seventh/templateDetail.vue @@ -299,7 +299,18 @@ belongStandardEquipment, // 检校标准装置字典code } getItemInfo(params).then((res) => { - initInputData(res.data.measureItemDataPointMeterList) + if (Number(res.data.appearanceFunctionCheck)) { + itemFormData.value.appearanceFunctionCheck = '1' + } + else { + itemFormData.value.appearanceFunctionCheck = '' + } + if (Number(res.data.indicationError)) { + initInputData(res.data.measureItemDataPointMeterList) + } + else { + list.value = [] + } }) } @@ -307,15 +318,17 @@ // 校验 const checkout = () => { let result = true - if (itemFormData.value.appearanceFunctionCheck === '') { - return true - } - if (!list.value.length) { - ElMessage.warning('该设备未配置检定项') - result = false - } - if (!useCheckList(list.value, columns.value, '示值测试')) { - result = false + // if (itemFormData.value.appearanceFunctionCheck === '') { + // return true + // } + // if (!list.value.length) { + // ElMessage.warning('该设备未配置检定项') + // result = false + // } + if (list.value.length) { + if (!useCheckList(list.value, columns.value, '示值测试')) { + result = false + } } return result } @@ -440,7 +453,7 @@ @@ -470,7 +483,7 @@ - +