装备新增bug

This commit is contained in:
hongchao 2024-12-20 15:05:20 +08:00
parent 48b4d6aab6
commit ea1926121e
1 changed files with 105 additions and 54 deletions

View File

@ -178,6 +178,7 @@ const equipmentDeployment = () => {
}
const isEditForm = ref(false)
const maId: any = ref('')
const warningDays:any = ref(0)
//
const editRowInfo = (row: any) => {
settleinTitle.value = '装备编辑'
@ -418,7 +419,8 @@ const dialogTypeChange = async () => {
// equipmentDeploymentParams.value.deviceCount = 1
// countDisabled.value = true
// }
console.log('deviceTypeList', deviceTypeList[0].data.maTypeProperties)
console.log('deviceTypeList', deviceTypeList[0].data.name)
warningDays.value = deviceTypeList[0].data.maintenanceAlarmDay
if (deviceTypeList[0].data.maTypeProperties == null) {
propertyNames.value = []
} else {
@ -439,15 +441,18 @@ const dialogTypeChange = async () => {
addAndEditFormRef.value.clearValidate(['unitName', 'dayLeasePrice'])
equipTableList.value = []
equipTableList.value.push({
name1: '',
identifyCodes: '',
name2: '',
name3: '',
name4: '',
name5: '',
jcr: '',
jcsj: '',
xcjcsj: '',
name6: '',
fileListEquip: [],
insurancePdf: [],
examinationPdf: [],
})
}
//
const getCompanyList = async () => {
const res: any = await getCompanyListApi()
@ -654,20 +659,20 @@ const submitFun = (type: any) => {
}
})
for (let index = 0; index < descriptionFormList.value.length; index++) {
try {
const result = await new Promise((resolve) => {
descriptionFormRefList.value[index].validate((res: any) => {
resolve(res)
})
})
// for (let index = 0; index < descriptionFormList.value.length; index++) {
// try {
// const result = await new Promise((resolve) => {
// descriptionFormRefList.value[index].validate((res: any) => {
// resolve(res)
// })
// })
if (!result) {
isDescription = true
throw new Error('表单校验失败')
}
} catch (error) {}
}
// if (!result) {
// isDescription = true
// throw new Error('')
// }
// } catch (error) {}
// }
if (isDescription) return
@ -675,6 +680,7 @@ const submitFun = (type: any) => {
addAndEditForm.typeId =
addAndEditForm.deviceTypeList[addAndEditForm.deviceTypeList.length - 1]
addAndEditForm.tableData = equipTableList.value
let SEND_FUN_API: any = null
if (type == 1) {
SEND_FUN_API = equipmentAddApi
@ -932,6 +938,7 @@ const addAndEditForm = reactive<any>({
examinationPdfs: [],
devInfoProperties: [],
identifyCodes: [],
tableList: [],
})
// const addAndEditFormTemp = reactive<any>()
const uploadUrl = import.meta.env.VITE_API_URL + '/file/upload'
@ -1000,8 +1007,12 @@ const onExaminationPdfChange = (fileList: any, index: number) => {
descriptionFormList.value[index].examinationTempPdf.push(...fileListTemp)
}
const onFileChangeEquip = (fileList: any,row:any,index:number) => {
equipTableList.value[index].fileListEquip = []
const onFileChangeEquip = (fileList: any,row:any,index:number,type:number) => {
if(type == 1){
equipTableList.value[index].insurancePdf = []
}else{
equipTableList.value[index].examinationPdf = []
}
const fileListTemp = fileList.map((e: any) => {
return {
fileName: e.name,
@ -1009,11 +1020,17 @@ const onFileChangeEquip = (fileList: any,row:any,index:number) => {
}
})
console.log('11111',fileListTemp[0].fileUrl)
equipTableList.value[index].name2 = fileListTemp[0].fileUrl
console.log('333',equipTableList.value[index].name2)
equipTableList.value[index].fileListEquip.push(fileListTemp[0])
if(type == 1){
equipTableList.value[index].name2 = fileListTemp[0].fileUrl
equipTableList.value[index].insurancePdf.push(fileListTemp[0])
}else{
equipTableList.value[index].name6 = fileListTemp[0].fileUrl
equipTableList.value[index].examinationPdf.push(fileListTemp[0])
}
}
// const onDeleteImgInDetails = () => {}
const onDeleteImgInMain = (index: any) => {
@ -1079,13 +1096,14 @@ const equipTableList = ref<any>([])
const handleAddBack = () => {
let obj = {
name1: '',
identifyCodes: '',
name2: '',
name3: '',
name4: '',
name5: '',
jcr: '',
jcsj: '',
xcjcsj: '',
name6: '',
fileListEquip: [],
insurancePdf: [],
examinationPdf: [],
};
equipTableList.value.push(obj);
}
@ -1096,9 +1114,14 @@ const handleDeleteBack = (index:number) => {
const fileListEquip = ref<any>([])
const viewCertificate = (url:string) => {
console.log('2233',url)
window.open(url, '_blank');
};
const changeDate = (row:any,index:number) => {
const currentDate = new Date(row.jcsj);
currentDate.setDate(currentDate.getDate() + warningDays.value);
equipTableList.value[index].xcjcsj = currentDate.toISOString().split('T')[0];
equipTableList.value = [...equipTableList.value];
}
</script>
<template>
@ -1853,14 +1876,15 @@ const viewCertificate = (url:string) => {
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column
label="唯一标识符"
prop="name1"
prop="identifyCodes"
align="center"
:show-overflow-tooltip="true"
>
<template v-slot="scope">
<template #default="{row,$index}">
<el-input
v-model="scope.row.partName"
v-model="row.identifyCodes"
style="width: 100%"
placeholder="请输入唯一标识符"
maxlength="20"
></el-input>
</template>
@ -1881,11 +1905,11 @@ const viewCertificate = (url:string) => {
:multiple="true"
:autoUpload="true"
:actionUrl="uploadUrl"
:minLimit="row.fileListEquip.length"
:minLimit="row.insurancePdf.length"
listType="text"
:justifyContent="`flex-start`"
:acceptTypeList="['.jpg', '.png']"
@onFileChange="(fileList) =>onFileChangeEquip(fileList,row,$index)"
@onFileChange="(fileList) =>onFileChangeEquip(fileList,row,$index,1)"
>
<div style="display: flex; justify-content: center;align-items: center;">
<el-button
@ -1900,7 +1924,7 @@ const viewCertificate = (url:string) => {
<el-button
type="text"
style="color: #00a288; text-decoration: underline"
@click="viewCertificate(row.fileListEquip[0].fileUrl)"
@click="viewCertificate(row.insurancePdf[0].fileUrl)"
>查看</el-button
>
</div>
@ -1908,30 +1932,31 @@ const viewCertificate = (url:string) => {
</el-table-column>
<el-table-column
label="检修人"
prop="name3"
prop="jcr"
align="center"
:show-overflow-tooltip="true"
>
<template v-slot="scope">
<template #default="{row,$index}">
<el-input
v-model="scope.row.backCost"
v-model="row.jcr"
controls-position="right"
style="width: 100%"
:min="0"
placeholder="请输入检修人"
></el-input>
</template>
</el-table-column>
<el-table-column
label="检修时间"
prop="name4"
prop="jcsj"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{row}">
<template #default="{row,$index}">
<el-date-picker
v-model="row.name4"
v-model="row.jcsj"
type="date"
placeholder="请选择"
@change="changeDate(row,$index)"
style="width: 100%"
></el-date-picker>
</template>
@ -1939,13 +1964,13 @@ const viewCertificate = (url:string) => {
<el-table-column
label="下次检测时间"
prop="name5"
prop="xcjcsj"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{row}">
<template #default="{row,$index}">
<el-date-picker
v-model="row.name5"
v-model="row.xcjcsj"
type="date"
placeholder="请选择"
style="width: 100%"
@ -1959,14 +1984,40 @@ const viewCertificate = (url:string) => {
align="center"
:show-overflow-tooltip="true"
>
<template v-slot="scope">
<el-input
v-model="scope.row.backCost"
controls-position="right"
style="width: 100%"
:min="0"
></el-input>
</template>
<template #default="{row,$index}">
<div v-if="row.name6==''">
<UploadComponentNew
:maxSize="10"
:max-limit="1"
width="100%"
height="100%"
:multiple="true"
:autoUpload="true"
:actionUrl="uploadUrl"
:minLimit="row.examinationPdf.length"
listType="text"
:justifyContent="`flex-start`"
:acceptTypeList="['.jpg', '.png']"
@onFileChange="(fileList) =>onFileChangeEquip(fileList,row,$index,2)"
>
<div style="display: flex; justify-content: center;align-items: center;">
<el-button
type="text"
style="color: #00a288; text-decoration: underline"
>上传</el-button>
</div>
</UploadComponentNew>
<!-- <el-button size="mini" type="primary" @click="uploadTestReport(row)">上传</el-button> -->
</div>
<div v-else>
<el-button
type="text"
style="color: #00a288; text-decoration: underline"
@click="viewCertificate(row.examinationPdf[0].fileUrl)"
>查看</el-button
>
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150px">