fix: 当前值获取异常修复 & refactor: 点检表样式调整
This commit is contained in:
parent
89163ce339
commit
1bf80ea3fe
|
@ -73,7 +73,7 @@
|
||||||
'alarm-cell': item.data[hour]?.checkStatus === 0
|
'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">
|
@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) || '--' }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</IxEventListItem>
|
</IxEventListItem>
|
||||||
|
@ -138,6 +138,11 @@ const formatDate = (date) => {
|
||||||
return `${year}/${month}/${day}`;
|
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({
|
const currentAlarmInfo = ref({
|
||||||
currentStatus: '',
|
currentStatus: '',
|
||||||
currentAlarmId: '',
|
currentAlarmId: '',
|
||||||
|
@ -324,9 +329,21 @@ const fetchCurrentValues = async () => {
|
||||||
const params = await getCheckParas(deviceId, dateValue);
|
const params = await getCheckParas(deviceId, dateValue);
|
||||||
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
const currentValues = response.data.data;
|
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 => {
|
inspectionItems.value.forEach(item => {
|
||||||
item.current = currentValues?.[item.name] || '--'; // 添加对 currentValues 的检查
|
item.current = formatNumberWithCommas(currentValues?.[item.name]) || '--'; // 添加对 currentValues 的检查
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
showWarningMessage('获取当前设备当前值失败!');
|
showWarningMessage('获取当前设备当前值失败!');
|
||||||
|
@ -549,7 +566,7 @@ onMounted(async () => {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 90%;
|
height: 90%;
|
||||||
/* 修改为90%,使其高度铺满剩余部分 */
|
/* 修改为90%,使其高度铺满剩余部分 */
|
||||||
overflow-x: auto;
|
overflow-x: visible;
|
||||||
/* 添加水平滚动条 */
|
/* 添加水平滚动条 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +574,7 @@ onMounted(async () => {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
overflow-x: auto;
|
overflow-x: visible;
|
||||||
/* 添加水平滚动条 */
|
/* 添加水平滚动条 */
|
||||||
position: relative; /* 添加此行以确保表头和数据在同一容器内滚动 */
|
position: relative; /* 添加此行以确保表头和数据在同一容器内滚动 */
|
||||||
}
|
}
|
||||||
|
@ -576,11 +593,15 @@ onMounted(async () => {
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 0 0 0 0.5rem;
|
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
background-color: inherit; /* 添加此行以确保表头背景色一致 */
|
background-color: #000028; /* 添加此行以确保表头背景色一致 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-row-1.fixed-row {
|
||||||
|
top: 40px;
|
||||||
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-width {
|
.fixed-width {
|
||||||
|
@ -658,8 +679,9 @@ onMounted(async () => {
|
||||||
.fixed-row {
|
.fixed-row {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
background-color: inherit;
|
background-color: #000028;
|
||||||
z-index: 1;
|
z-index: 2;
|
||||||
|
margin-left: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.highlight-cell {
|
.highlight-cell {
|
||||||
|
|
Loading…
Reference in New Issue