问题修复

This commit is contained in:
bb_pan 2025-02-25 16:55:43 +08:00
parent b8b405afe6
commit cb956732b8
5 changed files with 143 additions and 80 deletions

View File

@ -271,7 +271,7 @@ onMounted(() => {
<ArrowDown />
</el-icon>
<div class="user-center">
<!-- <div class="user-center">
<div style="text-align: right">
<el-button size="small" @click="onAccountManage"
>账号管理</el-button
@ -284,7 +284,7 @@ onMounted(() => {
<div>登录账号{{ form.userName }}</div>
</div>
</div>
</div>
</div> -->
</a>
<div class="line"></div>

View File

@ -289,6 +289,7 @@ const nickNameNew = computed(() => {
})
const onJumpUser = () => {
// router.push({ name: 'my-user' })
const isType: any = localStorage.getItem('rolesType')
if (isType == 3) {
const host = window.location.origin
@ -306,16 +307,6 @@ const onJumpUser = () => {
} else {
router.push({ name: 'my-user' })
}
// const roles = store.userInfo.roles
// if (roles?.length > 0) {
// const isAdmin = roles.some((e: any) => e.roleKey == 'admin')
// if (isAdmin) {
// // window.location.href = `http://192.168.137.101:80/?token=${store.token}`
// window.open(`http://36.33.26.201:17788/glweb/login?token=${store.token}`)
// } else {
// router.push({ name: 'my-user' })
// }
// }
}
const onClickLogin = () => {
@ -416,7 +407,7 @@ onMounted(() => {
<ArrowDown />
</el-icon>
<div class="user-center">
<!-- <div class="user-center">
<div style="text-align: right">
<el-button size="small" @click="onAccountManage">
账号管理
@ -429,7 +420,7 @@ onMounted(() => {
<div>登录账号{{ form.userName }}</div>
</div>
</div>
</div>
</div> -->
</a>
<div class="line"></div>
</div>

View File

@ -172,16 +172,15 @@
</div>
</div>
<div class="appearance">
<div class="publicTitle">证书展示</div>
<div class="certificate">
<el-row>
<!-- <div class="publicTitle">证书展示</div> -->
<!-- <div class="certificate"> -->
<!-- <el-row>
<el-col :span="2">
<div>合格证</div>
</el-col>
<el-col :span="22">
<div class="prove-container">
<div v-for="item in pageData.insurancePdf" :key="item.id">
<!-- <img :src="item.fileUrl" alt="" /> -->
<el-image
style="width: 100%; height: 100%"
:src="item.fileUrl"
@ -197,7 +196,7 @@
</div>
</div>
</el-col>
</el-row>
</el-row> -->
<!-- <el-row>
<el-col :span="2">
<div>检测证明</div>
@ -221,7 +220,7 @@
</div>
</el-col>
</el-row> -->
</div>
<!-- </div> -->
</div>
<div class="appearance">
<div class="publicTitle">检测记录</div>

View File

@ -182,9 +182,9 @@ const equipmentDeployment = () => {
examinationPdf.value = []
//table
;(equipTableList.value = []),
equipTableList.value = []
//
(dialogFormVisibleSettlein.value = true)
dialogFormVisibleSettlein.value = true
}
const isEditForm = ref(false)
const maId: any = ref('')
@ -310,6 +310,13 @@ const getDetailData = async (row: any) => {
if (isEditForm.value == true) {
if (addAndEditForm.tableList != null) {
addAndEditForm.tableList.forEach((item: any) => {
console.log('🚀 ~ addAndEditForm.tableList.forEach ~ item:', item)
if (item.examinationPdf && item.examinationPdf.length > 0) {
item.examinationPdf.forEach((e: any) => {
e.url = e.fileUrl
e.name = e.fileName
})
}
equipTableList.value.push({
id: item.id,
identifyCode: item.identifyCode,
@ -322,6 +329,7 @@ const getDetailData = async (row: any) => {
examinationPdf: item.examinationPdf,
})
})
console.log(equipTableList.value, '--->>>addAndEditForm.tableList')
} else {
equipTableList.value = [
{
@ -338,8 +346,15 @@ const getDetailData = async (row: any) => {
]
}
} else {
console.log('详情--->?>')
if (addAndEditForm.tableList != null) {
addAndEditForm.tableList.forEach((item: any) => {
if (item.examinationPdf && item.examinationPdf.length > 0) {
item.examinationPdf.forEach((e: any) => {
e.url = e.fileUrl
e.name = e.fileName
})
}
equipTableList.value.push({
id: item.id,
identifyCode: item.identifyCode,
@ -487,7 +502,7 @@ const dialogTypeChange = async () => {
// equipmentDeploymentParams.value.deviceCount = 1
// countDisabled.value = true
// }
console.log('deviceTypeList', deviceTypeList[0].data.name)
console.log('deviceTypeList', deviceTypeList[0].data)
warningDays.value = deviceTypeList[0].data.maintenanceAlarmDay
if (deviceTypeList[0].data.maTypeProperties == null) {
propertyNames.value = []
@ -722,14 +737,14 @@ const submitFun = (type: any) => {
if (type == 3 || type == 4) {
// addAndEditForm.identifyCode = e.identifyCode
addAndEditForm.insurancePdf = e.insurancePdfs.map((e: any) => {
return { fileNam: e.fileName, fileUrl: e.fileUrl }
})
// addAndEditForm.insurancePdf = e.insurancePdfs.map((e: any) => {
// return { fileNam: e.fileName, fileUrl: e.fileUrl }
// })
addAndEditForm.examinationPdf = e.examinationPdfs.map((e: any) => {
return { fileNam: e.fileName, fileUrl: e.fileUrl }
})
} else {
addAndEditForm.insurancePdfs[index] = e.insurancePdfs
// addAndEditForm.insurancePdfs[index] = e.insurancePdfs
addAndEditForm.examinationPdfs[index] = e.examinationPdfs
// addAndEditForm.identifyCode.push(e.identifyCode)
}
@ -758,7 +773,8 @@ const submitFun = (type: any) => {
(row[key] === null || row[key] === '' || row[key]?.length === 0) &&
key !== 'name2' &&
key !== 'name6' &&
key !== 'id'
key !== 'id' &&
key !== 'insurancePdf'
) {
if (key == 'identifyCode') {
ElMessage({
@ -780,18 +796,29 @@ const submitFun = (type: any) => {
type: 'error',
message: `${i + 1} 行的 ${'下次检修日期'} 字段不能为空`,
})
} else if (key == 'insurancePdf') {
ElMessage({
type: 'error',
message: `请上传第 ${i + 1} 行的合格证`,
})
} else {
}
// } else if (key == 'insurancePdf') {
// ElMessage({
// type: 'error',
// message: ` ${i + 1} `,
// })
// } else {
// ElMessage({
// type: 'error',
// message: ` ${i + 1} `,
// })
// }
return //
}
console.log(row, '-->提交')
if (row.examinationPdf.length === 0) {
ElMessage({
type: 'error',
message: `请上传第 ${i + 1} 行的检测证明`,
})
}
return //
return
}
}
}
@ -1019,10 +1046,6 @@ const picturePreview = (file: any) => {
dialogImageUrl.value = file.fileUrl
dialogVisible.value = true
}
//
const handleRemove = (list: any, index: Number) => {
list.splice(index, 1)
}
const onTempDownLoad = () => {
ElMessageBox.confirm('是否确定下载', {
@ -1160,6 +1183,50 @@ const onExaminationPdfChange = (fileList: any, index: number) => {
descriptionFormList.value[index].examinationTempPdf.push(...fileListTemp)
}
//
const handlePreview = (e: any) => {
console.log('🚀 ~ handlePreview ~ handlePreview:', e.fileUrl)
//
window.open(e.fileUrl, '_blank')
}
//
const handleRemove = (file: any, row: any) => {
console.log('🚀 ~ handleRemove ~ handleRemove:', file)
if (row.id) {
const index = row.examinationPdf.findIndex((e: any) => e.fileUrl == file.fileUrl)
if (index > -1) {
row.examinationPdf.splice(index, 1)
}
} else {
const index = row.examinationPdf.findIndex((e: any) => e.fileUrl == file.response.data.url)
if (index > -1) {
row.examinationPdf.splice(index, 1)
}
}
console.log('🚀 ~ handleRemove ~ row:', row.examinationPdf)
}
//
const handleSuccess = (uploadFile: any, row: any) => {
console.log('🚀 ~ handleSuccess ~ uploadFile:', uploadFile)
if (uploadFile.code == 200) {
row.examinationPdf.push({
fileName: uploadFile.data.name,
fileUrl: uploadFile.data.url,
})
}
console.log('🚀 ~ handleSuccess ~ row:', row)
}
//
const handleExceed = () => {
ElMessage({
type: 'error',
message: '最多只能上传5个文件',
})
}
//
const onFileChangeEquip = (fileList: any, row: any, index: number, type: number) => {
const origin = window.location.origin
const isProd = origin.indexOf('sgwpdm.ah.sgcc.com.cn') > -1
@ -1278,29 +1345,26 @@ const changeDate = (row: any, index: number) => {
console.log('3333', row)
const currentDate = new Date(row.checkDate)
console.log('1111', currentDate)
console.log('🚀 ~ 告警时间 ~ warningDays.value:', warningDays.value)
currentDate.setDate(currentDate.getDate() + Number(warningDays.value))
equipTableList.value[index].nextCheckDate = dayjs(currentDate).format('YYYY-MM-DD')
// equipTableList.value = [...equipTableList.value];
// console.log('🚀 ~ ~ warningDays.value:', warningDays.value)
//
const nextYearDate = dayjs(currentDate).add(1, 'year').subtract(1, 'day').toDate()
console.log('🚀 ~ changeDate ~ nextDate:', nextYearDate)
// currentDate.setDate(currentDate.getDate() + Number(warningDays.value))
equipTableList.value[index].nextCheckDate = dayjs(nextYearDate).format('YYYY-MM-DD')
}
const getUpdateTimeBgColor = (row: any) => {
// Date
const checkDate = new Date();
const nextCheckDate = new Date(row.nextCheckDate);
//
const diffTime = Math.abs(nextCheckDate - checkDate);
//
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
if (checkDate < nextCheckDate && diffDays <= 30) {
return '#FFFFCC'; //
} else if (checkDate > nextCheckDate) {
return '#FFCCCC'; //
//
const changeNextDate = (row: any) => {
if (row.checkDate && row.nextCheckDate) {
if (dayjs(row.checkDate).isAfter(row.nextCheckDate)) {
ElMessage({
type: 'error',
message: '下次检修时间不能早于检修时间',
})
row.nextCheckDate = ''
}
}
}
return ''; //
};
</script>
<template>
@ -1456,11 +1520,7 @@ const getUpdateTimeBgColor = (row: any) => {
</template>
</el-table-column>
<el-table-column align="center" prop="typeName" label="装备型号" />
<el-table-column align="center" prop="nextCheckDate" label="下次检验日期" >
<template #default="{ row }">
<span :style="{ backgroundColor: getUpdateTimeBgColor(row) }">{{ row.nextCheckDate }}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="updateTime" label="更新时间" />
<el-table-column align="center" label="装备状态">
<template #default="{ row }">
<el-tag v-if="row.maStatus == 0" size="small" type="info">草稿状态</el-tag>
@ -1669,7 +1729,7 @@ const getUpdateTimeBgColor = (row: any) => {
v-model="addAndEditForm.personPhone"
placeholder="请输入联系电话"
clearable
maxlength="20"
maxlength="11"
/>
</el-form-item>
</el-col>
@ -2089,7 +2149,7 @@ const getUpdateTimeBgColor = (row: any) => {
></el-input>
</template>
</el-table-column>
<el-table-column
<!-- <el-table-column
label="合格证"
prop="name2"
align="center"
@ -2127,7 +2187,6 @@ const getUpdateTimeBgColor = (row: any) => {
>
</div>
</UploadComponentNew>
<!-- <el-button size="mini" type="primary" @click="uploadTestReport(row)">上传</el-button> -->
</div>
<div v-else>
<el-button
@ -2138,7 +2197,7 @@ const getUpdateTimeBgColor = (row: any) => {
>
</div>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
label="检修人"
prop="checkMan"
@ -2185,6 +2244,7 @@ const getUpdateTimeBgColor = (row: any) => {
type="date"
placeholder="请选择"
style="width: 100%"
@change="changeNextDate(row)"
></el-date-picker>
</template>
</el-table-column>
@ -2193,10 +2253,24 @@ const getUpdateTimeBgColor = (row: any) => {
label="检测证明"
prop="name6"
align="center"
:show-overflow-tooltip="true"
>
<template #default="{ row, $index }">
<div v-if="row.name6 == ''">
<el-upload
:file-list="row.examinationPdf"
class="upload-demo"
:action="uploadUrl"
:headers="headerInfo"
:before-upload="beforeUpload"
:on-preview="handlePreview"
:on-remove="(file: any) => handleRemove(file, row)"
:on-exceed="handleExceed"
:limit="5"
:on-success="(file: any) => handleSuccess(file, row)"
accept=".jpg,.png,.pdf, .doc, .docx"
>
<el-button v-if="isAdd" type="primary" size="mini">上传</el-button>
</el-upload>
<!-- <div v-if="row.name6 == ''">
<UploadComponentNew
:maxSize="10"
:max-limit="1"
@ -2227,7 +2301,6 @@ const getUpdateTimeBgColor = (row: any) => {
>
</div>
</UploadComponentNew>
<!-- <el-button size="mini" type="primary" @click="uploadTestReport(row)">上传</el-button> -->
</div>
<div v-else>
<el-button
@ -2236,7 +2309,7 @@ const getUpdateTimeBgColor = (row: any) => {
@click="viewCertificate(row.examinationPdf[0].fileUrl)"
>查看</el-button
>
</div>
</div> -->
</template>
</el-table-column>

View File

@ -255,7 +255,7 @@
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="1" style="margin-bottom: 0" class="upload-tip">
支持格式.jpg.png 单个文件大小不能超过2M最多可上传1张
支持格式.jpg.png.pdf.doc.docx 单个文件大小不能超过5M最多可上传1个文件
</el-form-item>
</el-col>
</el-row>
@ -263,7 +263,7 @@
<el-col :span="24">
<el-form-item label="质检附件" prop="fileInfoList">
<UploadComponentNew
:maxSize="2"
:maxSize="5"
:max-limit="1"
width="100px"
height="100px"
@ -273,7 +273,7 @@
:actionUrl="uploadUrl"
listType="picture-card"
@onFileChange="onFileChange"
:acceptTypeList="['.jpg', '.png']"
:acceptTypeList="['.jpg', '.png', '.pdf', '.doc', '.docx']"
>
<template v-slot:default>
<el-icon size="48" color="#aaa"><Plus /></el-icon>