diff --git a/src/api/inspection.js b/src/api/inspection.js
index d65f58f..daf740d 100644
--- a/src/api/inspection.js
+++ b/src/api/inspection.js
@@ -42,10 +42,11 @@ export function exportExcel(deviceId, inputTime, shift) {
}
// 报警相关接口
-// 时间点确认点检,不传时间,默认当前时间
-export function sharpConfirm(alarmId, confirmTime, checkUser) {
+// 时间点确认点检,传递多个 alarmId
+export function sharpConfirm(alarmIdList, confirmTime, checkUser) {
+ const alarmIdParams = alarmIdList.map(id => `alarmIdList=${id}`).join('&');
return request({
- url: `/Check/sharpConfirm?alarmId=${alarmId}&checkUser=${checkUser}`,
+ url: `/Check/sharpConfirm?${alarmIdParams}&checkUser=${checkUser}`,
method: 'post'
});
}
@@ -57,4 +58,12 @@ export function alarmReasonConfirm(data) {
method: 'post',
data
})
+}
+
+// 查询某一报警信息
+export function getAlarmReason(alarmId, checkParamId) {
+ return request({
+ url: `Check/GetAlarmReason?alarmId=${alarmId}&checkParamId=${checkParamId}`,
+ method: 'get'
+ })
}
\ No newline at end of file
diff --git a/src/views/Dashboard/index.vue b/src/views/Dashboard/index.vue
index 0053c6f..bd2107d 100644
--- a/src/views/Dashboard/index.vue
+++ b/src/views/Dashboard/index.vue
@@ -915,10 +915,10 @@ let autoUpdateInterval = null;
// 生命周期钩子
onMounted(async () => {
+ await fetchStatusColors(); // 调用获取颜色状态数据的函数
await fetchData();
fetchGanttData();
- fetchStopReason();
- await fetchStatusColors(); // 调用获取颜色状态数据的函数
+ fetchStopReason();
sendDataToParent();
const setupAutoUpdate = () => {
diff --git a/src/views/Inspection/InspectionForm.vue b/src/views/Inspection/InspectionForm.vue
index e5794aa..97817d3 100644
--- a/src/views/Inspection/InspectionForm.vue
+++ b/src/views/Inspection/InspectionForm.vue
@@ -6,7 +6,7 @@
提交原因
-
+
{{ itemName }}
@@ -29,13 +29,17 @@
@@ -79,17 +85,20 @@ onMounted(() => {
}
.form-validation-example {
- background-color:#23233C;
+ background-color: #23233C;
padding: 2rem;
border-radius: 0.5rem;
- width: 25rem; /* 设置表单宽度 */
+ width: 25rem;
+ /* 设置表单宽度 */
display: flex;
flex-direction: column;
- border: 0.0625rem solid white; /* 增加白色边框 */
+ border: 0.0625rem solid white;
+ /* 增加白色边框 */
}
.form-header h5 {
- color: #9898A8; /* 修改颜色 */
+ color: #9898A8;
+ /* 修改颜色 */
}
.form-body {
@@ -118,32 +127,43 @@ onMounted(() => {
.form-header h5,
.form-body p,
.form-body label {
- color: #9898A8; /* 修改颜色 */
- text-align: left; /* 文字靠左对齐 */
- font-size: 0.7rem; /* 字体大小为9px */
+ color: #9898A8;
+ /* 修改颜色 */
+ text-align: left;
+ /* 文字靠左对齐 */
+ font-size: 0.7rem;
+ /* 字体大小为9px */
}
.form-header p {
- text-align: left; /* 文字靠左对齐 */
- font-size: 0.875rem; /* 字体大小为12px */
-
+ text-align: left;
+ /* 文字靠左对齐 */
+ font-size: 0.875rem;
+ /* 字体大小为12px */
+
}
.item-chip-container {
display: flex;
align-items: center;
- gap: 0.03125rem; /* 0.5px */
- height: 100%; /* 确保容器高度 */
+ gap: 0.03125rem;
+ /* 0.5px */
+ height: 100%;
+ /* 确保容器高度 */
}
.item-chip-container p {
display: flex;
- align-items: center; /* 上下居中 */
- margin: 0; /* 移除默认外边距 */
- line-height: 1; /* 确保行高 */
+ align-items: center;
+ /* 上下居中 */
+ margin: 0;
+ /* 移除默认外边距 */
+ line-height: 1;
+ /* 确保行高 */
}
.chip {
- font-size: 0.7rem; /* 字体大小为9px */
+ font-size: 0.7rem;
+ /* 字体大小为9px */
}
diff --git a/src/views/Inspection/index.vue b/src/views/Inspection/index.vue
index 1e01259..ea235e5 100644
--- a/src/views/Inspection/index.vue
+++ b/src/views/Inspection/index.vue
@@ -81,7 +81,7 @@
-
handleFormSubmit(selectedItemIndex, reason)" />
+ handleFormSubmit(selectedItemIndex, reason)" />
@@ -126,6 +126,8 @@ const selectedItemName = ref('');
const selectedItemTime = ref('');
const selectedItemIndex = ref(null);
+const currentDeviceId = ref(null);
+
const selectedDate = ref(null);
const formatDate = (date) => {
@@ -135,7 +137,12 @@ const formatDate = (date) => {
const day = d.getDate().toString().padStart(2, '0');
return `${year}/${month}/${day}`;
};
-const currentStatus = ref('');
+
+const currentAlarmInfo = ref({
+ currentStatus: '',
+ currentAlarmId: '',
+ currentCheckParamId: '',
+});
const currentDate = formatDate(new Date());
@@ -178,28 +185,35 @@ const formatTime = (time) => {
return `${hours}:${minutes}`;
};
-// 点检按钮点击事件 handleAlarmConfirm
+// 点检按钮点击事件
const handleInspection = (hour, index) => {
selectedItemName.value = inspectionItems.value[index].label;
selectedItemTime.value = hour;
selectedItemIndex.value = index; // 保存当前索引
+ // 获取当前时间点所有设备报警ID
+ const currentAlarmIds = [];
// 校验是否已经确认异常数据
if (hourCheckValid.value[hour] !== 1) {
- console.log("🚀 ~ handleInspection ~ hourCheckValid.value[hour]:", hourCheckValid.value[hour])
showWarningMessage('存在设备异常,无法执行点检操作!');
return;
}
-
- console.log("🚀 ~ handleInspection ~ inspectionItems.value:", inspectionItems.value)
// 校验这个时刻这一列有咩有报警未处理的数据,也就是checkStatus为0的数据
if (inspectionItems.value.some(item => item.data[hour]?.checkStatus === 0)) {
showWarningMessage('存在报警数据未处理,无法执行点检操作!');
return;
}
+ // 遍历所有设备收集报警ID和状态
+ Object.keys(alarmId.value).forEach(deviceId => {
+ if (alarmId.value[deviceId]?.[hour]) {
+ currentAlarmIds.push(alarmId.value[deviceId][hour]);
+ }
+ });
+ console.log("🚀 ~ handleInspection ~ currentAlarmIds:", currentAlarmIds)
+
showConfirmMessage('确认要执行点检操作吗?', async () => {
- await sharpConfirm(alarmId.value[hour], 'admin').then(() => {
+ await sharpConfirm(currentAlarmIds, 'admin').then(() => {
confirmedHours.value.push(selectedItemTime.value);
confirmedTimes.value[selectedItemTime.value] = moment().tz(timezone).format('HH:mm');
hourCheckStatus.value[hour] = 1; // 更新点检状态
@@ -215,15 +229,24 @@ const handleAlarmInspection = (hour, index, status) => {
selectedItemName.value = inspectionItems.value[index].label;
selectedItemTime.value = hour;
selectedItemIndex.value = index; // 确保在这里设置 selectedItemIndex
- currentStatus.value = status === 0 ? '未处理' : '已处理';
+
+ // 从数据项中获取实际设备ID
+ currentDeviceId.value = inspectionItems.value[index].data[hour]?.deviceId;
+
+ currentAlarmInfo.value = {
+ currentStatus : status === 0 ? '未处理' : '已处理',
+ currentAlarmId: alarmId.value[currentDeviceId.value]?.[selectedItemTime.value],
+ currentCheckParamId: inspectionItems.value[index].data[hour]?.checkParamId
+ }
+
showForm.value = true;
};
// 点检表单提交事件
const handleFormSubmit = async (index, reason) => {
await alarmReasonConfirm({
- alarmId: alarmId.value[selectedItemTime.value],
- checkParamId: inspectionItems.value[index].data[selectedItemTime.value].checkParamId,
+ alarmId: currentAlarmInfo.value.currentAlarmId, // alarmId.value[selectedItemTime.value],
+ checkParamId: currentAlarmInfo.value.currentCheckParamId,//inspectionItems.value[index].data[selectedItemTime.value]checkParamId,
alarmReason: reason,
checkUser: 'admin'
}).then(() => {
@@ -343,7 +366,6 @@ const fetchInspectionData = async () => {
const inspectionData = response.data;
const itemsMap = {};
inspectionData.forEach(record => {
- console.log("🚀 ~ fetchInspectionData ~ record:", record)
const recordTime = record.recordTime;
const data = record.data;
const deviceId = record.deviceId;
@@ -374,7 +396,8 @@ const fetchInspectionData = async () => {
checkStatus: valueObj.checkStatus,
checkText: valueObj.checkText,
checkParamId: valueObj.checkParamId,
- checkUser: valueObj.checkUser
+ checkUser: valueObj.checkUser,
+ deviceId: record.deviceId,
// hourCheckStatus: valueObj.hourCheckStatus,
// hourCheckTime: valueObj.hourCheckTime
};
@@ -390,14 +413,17 @@ const fetchInspectionData = async () => {
};
// 查询接口数据
-const handleSearch = () => {
- fetchInspectionData();
- fetchCurrentValues();
+const handleSearch = async () => {
+ try {
+ await Promise.all([fetchInspectionData(), fetchCurrentValues()]);
+ // showInfoMessage('数据刷新成功');
+ } catch (error) {
+ showWarningMessage('数据刷新失败');
+ console.error('Error refreshing data:', error);
+ }
};
const handleExport = () => {
- console.log("🚀 ~ handleExport ~ inspectionItems.value.some(item => Object.values(item.data).some(data => data.checkStatus === 0)):", inspectionItems.value.some(item => Object.values(item.data).some(data => data.checkStatus === 0)))
-
// 增加一个判断,判断当前的数据中inspectionItems.value中是否有报警数据,如果有则提示不允许导出
if (inspectionItems.value.some(item => Object.values(item.data).some(data => data.checkStatus === 0))) {
showWarningMessage('请先处理报警数据,再进行导出!');
@@ -438,8 +464,7 @@ const getDeviceNameById = (id) => {
onMounted(async () => {
await fetchDeviceList();
- fetchCurrentValues();
- fetchInspectionData();
+ await handleSearch();
sendDataToParent();
// const setupAutoUpdate = () => {