Commit d9373859 by guibin

Merge branch 'master' of https://git.rokedata.com/dws/dwsproject

parents 4abcdfdc d2679474
......@@ -37,7 +37,11 @@
<div v-for="(device, index) in category.data" :key="index" class="device-card new-design"
:class="getCardClass(device.status)">
<!-- 设备名称 - 左上角 -->
<div class="device-name">[[truncateText(device.name, 12)]]</div>
<el-tooltip :disabled="device.name.length<16" effect="dark" :content="device.name" placement="top">
<div class="device-name">
[[truncateText(device.name, 16)]]
</div>
</el-tooltip>
<!-- 设备状态 - 右上角 -->
<div class="device-status-tag" :class="getStatusClass(device.status)">
......@@ -85,7 +89,7 @@
</div>
<div style="width: 100%; display: flex;margin-left: 13px;">
<div class="flxe_sty">
<div class="flxe_label_sty" style=" background-color: #00aa00;"></div>
<div class="flxe_label_sty" style=" background-color: #00aa00;"></div>
[[ device.run_seconds ]]
</div>
<div class="flxe_sty">
......@@ -536,6 +540,7 @@
// 从所有设备列表中获取准确的设备名称
let deviceName = device.name || device.code // 默认使用API返回的名称或编码
let categoryName = null
let categorySequence = null
// 在所有设备列表中查找匹配的设备
if (this.allEquipmentData && this.allEquipmentData.length > 0) {
const matchedDevice = this.allEquipmentData.find(
......@@ -545,6 +550,7 @@
if (matchedDevice && matchedDevice.name) {
deviceName = device.name ? matchedDevice.name : device.code
categoryName = matchedDevice.category_name
categorySequence = matchedDevice.category_sequence
}
}
return {
......@@ -558,7 +564,8 @@
green_seconds: green_seconds,
yellow_seconds: yellow_seconds,
red_seconds: red_seconds,
category_name: categoryName
category_name: categoryName,
category_sequence: categorySequence
}
});
......@@ -574,9 +581,12 @@
const result = Object.keys(grouped).map(category_name => {
// 每组内部按percentage降序排序
const data = grouped[category_name].sort((a, b) => b.percentage - a.percentage);
return { category_name, data };
// 取第一个的category_sequence作为分组的category_sequence
const category_sequence = data[0]?.category_sequence ?? 9999;
return { category_name, category_sequence, data };
});
console.log(result)
// 最终按category_sequence从小到大排序
result.sort((a, b) => (a.category_sequence ?? 9999) - (b.category_sequence ?? 9999));
this.deviceList = result
},
......@@ -778,7 +788,7 @@
truncateText(text, maxLength) {
if (!text) return "";
if (text.length <= maxLength) return text;
return text.substring(0, maxLength) + "...";
return text.substring(0, maxLength);
},
// 显示完整标题
......@@ -967,7 +977,7 @@
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
/* text-overflow: ellipsis; */
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
margin-bottom: 5px;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment