diff --git a/src/views/user/goodsManagement/index.vue b/src/views/user/goodsManagement/index.vue index acff7b9..f76b842 100644 --- a/src/views/user/goodsManagement/index.vue +++ b/src/views/user/goodsManagement/index.vue @@ -443,9 +443,9 @@ const dialogTypeChange = async () => { equipTableList.value.push({ identifyCodes: '', name2: '', - jcr: '', - jcsj: '', - xcjcsj: '', + checkMan: '', + checkDate: '', + nextCheckDate: '', name6: '', insurancePdf: [], examinationPdf: [], @@ -673,14 +673,52 @@ const submitFun = (type: any) => { // } // } catch (error) {} // } - + addAndEditForm.tableList = equipTableList.value + for (let i = 0; i < addAndEditForm.tableList.length; i++) { + const row = addAndEditForm.tableList[i]; + for (const key in row) { + if (row.hasOwnProperty(key) && (row[key] === null || row[key] === '' || row[key].length ===0) && key !== 'name2' && key !== 'name6') { + if(key=='identifyCode'){ + ElMessage({ + type: 'error', + message: `第 ${i + 1} 行的 ${'唯一标识符'} 字段不能为空`, + }); + }else if(key=='checkMan'){ + ElMessage({ + type: 'error', + message: `第 ${i + 1} 行的 ${'检修人'} 字段不能为空`, + }); + }else if(key=='checkDate'){ + ElMessage({ + type: 'error', + message: `第 ${i + 1} 行的 ${'检修日期'} 字段不能为空`, + }); + }else if(key=='nextCheckDate'){ + ElMessage({ + type: 'error', + message: `第 ${i + 1} 行的 ${'下次检修日期'} 字段不能为空`, + }); + }else if(key=='insurancePdf'){ + ElMessage({ + type: 'error', + message: `请上传第 ${i + 1} 行的合格证`, + }); + }else{ + ElMessage({ + type: 'error', + message: `请上传第 ${i + 1} 行的检测证明`, + }); + } + return; // 如果有任何字段为空,直接返回,不进行提交 + } + } + } if (isDescription) return addAndEditForm.devInfoProperties = propertyNames.value addAndEditForm.typeId = addAndEditForm.deviceTypeList[addAndEditForm.deviceTypeList.length - 1] - addAndEditForm.tableList = equipTableList.value let SEND_FUN_API: any = null if (type == 1) { SEND_FUN_API = equipmentAddApi @@ -1098,9 +1136,9 @@ const handleAddBack = () => { let obj = { identifyCodes: '', name2: '', - jcr: '', - jcsj: '', - xcjcsj: '', + checkMan: '', + checkDate: '', + nextCheckDate: '', name6: '', insurancePdf: [], examinationPdf: [], @@ -1117,9 +1155,11 @@ const viewCertificate = (url:string) => { window.open(url, '_blank'); }; const changeDate = (row:any,index:number) => { - const currentDate = new Date(row.jcsj); + const currentDate = new Date(row.checkDate); + console.log('1222',warningDays.value) currentDate.setDate(currentDate.getDate() + warningDays.value); - equipTableList.value[index].xcjcsj = currentDate.toISOString().split('T')[0]; + console.log('1111',currentDate) + equipTableList.value[index].nextCheckDate = currentDate.toISOString().split('T')[0]; equipTableList.value = [...equipTableList.value]; } @@ -1932,13 +1972,13 @@ const changeDate = (row:any,index:number) => {