bug修复

This commit is contained in:
hongchao 2024-12-20 16:00:38 +08:00
parent 04e9f29efb
commit 04910ecaa9
1 changed files with 56 additions and 16 deletions

View File

@ -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];
}
</script>
@ -1932,13 +1972,13 @@ const changeDate = (row:any,index:number) => {
</el-table-column>
<el-table-column
label="检修人"
prop="jcr"
prop="checkMan"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{row,$index}">
<el-input
v-model="row.jcr"
v-model="row.checkMan"
controls-position="right"
style="width: 100%"
placeholder="请输入检修人"
@ -1947,13 +1987,13 @@ const changeDate = (row:any,index:number) => {
</el-table-column>
<el-table-column
label="检修时间"
prop="jcsj"
prop="checkDate"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{row,$index}">
<el-date-picker
v-model="row.jcsj"
v-model="row.checkDate"
type="date"
placeholder="请选择"
@change="changeDate(row,$index)"
@ -1964,13 +2004,13 @@ const changeDate = (row:any,index:number) => {
<el-table-column
label="下次检测时间"
prop="xcjcsj"
prop="nextCheckDate"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{row,$index}">
<el-date-picker
v-model="row.xcjcsj"
v-model="row.nextCheckDate"
type="date"
placeholder="请选择"
style="width: 100%"