diff --git a/src/views/Inspection/index.vue b/src/views/Inspection/index.vue index ea235e5..8ed9efe 100644 --- a/src/views/Inspection/index.vue +++ b/src/views/Inspection/index.vue @@ -73,7 +73,7 @@ 'alarm-cell': item.data[hour]?.checkStatus === 0 }" @click="item.data[hour]?.checkStatus === 0 || item.data[hour]?.checkStatus === 1 ? handleAlarmInspection(hour, index, item.data[hour]?.checkStatus) : null"> - {{ item.data[hour]?.value || '--' }} + {{ formatNumberWithCommas(item.data[hour]?.value) || '--' }} @@ -138,6 +138,11 @@ const formatDate = (date) => { return `${year}/${month}/${day}`; }; +const formatNumberWithCommas = (number) => { + if (number === null || number === undefined) return '--'; + return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); +}; + const currentAlarmInfo = ref({ currentStatus: '', currentAlarmId: '', @@ -324,10 +329,22 @@ const fetchCurrentValues = async () => { const params = await getCheckParas(deviceId, dateValue); if (response.data) { - const currentValues = response.data.data; - inspectionItems.value.forEach(item => { - item.current = currentValues?.[item.name] || '--'; // 添加对 currentValues 的检查 + const currentValueList = response.data; + console.log("🚀 ~ fetchCurrentValues ~ currentValueList:", currentValueList) + const currentValues = {}; + currentValueList.forEach(item => { + // 解析设备实时数据并过滤掉值为 null 的项 + for (const [key, value] of Object.entries(item.data)) { + if (value !== null) { + currentValues[key] = value; + } + } }); + console.log("🚀 ~ fetchCurrentValues ~ currentValues:", currentValues) + + inspectionItems.value.forEach(item => { + item.current = formatNumberWithCommas(currentValues?.[item.name]) || '--'; // 添加对 currentValues 的检查 + }); } else { showWarningMessage('获取当前设备当前值失败!'); } @@ -549,7 +566,7 @@ onMounted(async () => { width: 100%; height: 90%; /* 修改为90%,使其高度铺满剩余部分 */ - overflow-x: auto; + overflow-x: visible; /* 添加水平滚动条 */ } @@ -557,7 +574,7 @@ onMounted(async () => { display: flex; flex-direction: column; min-width: 100%; - overflow-x: auto; + overflow-x: visible; /* 添加水平滚动条 */ position: relative; /* 添加此行以确保表头和数据在同一容器内滚动 */ } @@ -576,11 +593,15 @@ onMounted(async () => { justify-content: space-around; align-items: center; flex: 1; - padding: 0 0 0 0.5rem; position: sticky; top: 0; z-index: 2; - background-color: inherit; /* 添加此行以确保表头背景色一致 */ + background-color: #000028; /* 添加此行以确保表头背景色一致 */ +} + +.table-row-1.fixed-row { + top: 40px; + z-index: 2; } .fixed-width { @@ -658,8 +679,9 @@ onMounted(async () => { .fixed-row { position: sticky; top: 0; - background-color: inherit; - z-index: 1; + background-color: #000028; + z-index: 2; + margin-left: 1rem; } .highlight-cell {