diff --git a/src/components/header/index.vue b/src/components/header/index.vue
index d297c27..685227f 100644
--- a/src/components/header/index.vue
+++ b/src/components/header/index.vue
@@ -271,7 +271,7 @@ onMounted(() => {
-
+
diff --git a/src/layout/header.vue b/src/layout/header.vue
index 54fd007..40f0e4b 100644
--- a/src/layout/header.vue
+++ b/src/layout/header.vue
@@ -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(() => {
-
diff --git a/src/views/equip/detail.vue b/src/views/equip/detail.vue
index 03f639b..4196b6c 100644
--- a/src/views/equip/detail.vue
+++ b/src/views/equip/detail.vue
@@ -172,16 +172,15 @@
检测记录
diff --git a/src/views/user/goodsManagement/index.vue b/src/views/user/goodsManagement/index.vue
index 4f10160..673b95f 100644
--- a/src/views/user/goodsManagement/index.vue
+++ b/src/views/user/goodsManagement/index.vue
@@ -182,9 +182,9 @@ const equipmentDeployment = () => {
examinationPdf.value = []
//装备证书table
- ;(equipTableList.value = []),
- // 打开入驻弹框
- (dialogFormVisibleSettlein.value = true)
+ equipTableList.value = []
+ // 打开入驻弹框
+ 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,19 +796,30 @@ const submitFun = (type: any) => {
type: 'error',
message: `第 ${i + 1} 行的 ${'下次检修日期'} 字段不能为空`,
})
- } else if (key == 'insurancePdf') {
- ElMessage({
- type: 'error',
- message: `请上传第 ${i + 1} 行的合格证`,
- })
- } else {
- ElMessage({
- type: 'error',
- message: `请上传第 ${i + 1} 行的检测证明`,
- })
}
+
+ // } 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
+ }
}
}
if (isDescription) 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'; // 红色背景
- }
- return ''; // 返回空字符串,让背景色保持默认
-};
+// 下次检修时间不能早于检修时间
+const changeNextDate = (row: any) => {
+ if (row.checkDate && row.nextCheckDate) {
+ if (dayjs(row.checkDate).isAfter(row.nextCheckDate)) {
+ ElMessage({
+ type: 'error',
+ message: '下次检修时间不能早于检修时间',
+ })
+ row.nextCheckDate = ''
+ }
+ }
+}
@@ -1456,11 +1520,7 @@ const getUpdateTimeBgColor = (row: any) => {
-
-
- {{ row.nextCheckDate }}
-
-
+
草稿状态
@@ -1669,7 +1729,7 @@ const getUpdateTimeBgColor = (row: any) => {
v-model="addAndEditForm.personPhone"
placeholder="请输入联系电话"
clearable
- maxlength="20"
+ maxlength="11"
/>
@@ -2089,7 +2149,7 @@ const getUpdateTimeBgColor = (row: any) => {
>
-
{
>
-