From 2394df8c41a726c9230a975d13efc12393df7a37 Mon Sep 17 00:00:00 2001
From: 李喆(开发组) <lzhe@yxqiche.com>
Date: 星期二, 11 三月 2025 09:50:09 +0800
Subject: [PATCH] 1
---
src/views/home/widgets/components/mdcRunning.vue | 45 ++++++++++++++++++++++++++++++++-------------
1 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/src/views/home/widgets/components/mdcRunning.vue b/src/views/home/widgets/components/mdcRunning.vue
index dbcb9d6..5313746 100644
--- a/src/views/home/widgets/components/mdcRunning.vue
+++ b/src/views/home/widgets/components/mdcRunning.vue
@@ -1,8 +1,8 @@
<!--
* @Author: lzhe lzhe@example.com
* @Date: 2024-04-16 15:22:46
- * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-10-23 16:13:47
+ * @LastEditors: 鏉庡枂(寮�鍙戠粍) lzhe@yxqiche.com
+ * @LastEditTime: 2025-03-11 09:49:57
* @FilePath: /CPSnew/smart-web/src/views/home/widgets/components/mdcDeviceStatus.vue
* @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -143,7 +143,6 @@
mounted() {
this.getList();
this.getParentData();
- var arr = [];
for(var i=1;i<=30;i++) {
this.timeLevelList.push({value:i,label:i});
this.topList.push({value:i,label:i});
@@ -154,8 +153,6 @@
this.getList();
},
showSearch() {
- this.search.timeLevel = this.timeLevel;
- this.search.top = this.top;
this.isSearch = true;
},
serchSubmit() {
@@ -193,6 +190,22 @@
}
return newData
},
+ extractLastLevelIds(items, result = []) { //閫掑綊鑾峰彇children鏈�鍚庝竴绾х殑id鐨勬暟缁�
+ items.forEach(item => {
+ // 濡傛灉褰撳墠椤规湁id灞炴�т笖娌℃湁children鎴朿hildren涓虹┖鏁扮粍
+ if (item.id && (!item.children || item.children.length === 0)) {
+ result.push(item.id);
+ }
+
+ // 濡傛灉褰撳墠椤规湁children灞炴�т笖鏄暟缁勶紝鍒欓�掑綊璋冪敤collectIds
+ if (Array.isArray(item.children)) {
+ this.extractLastLevelIds(item.children, result);
+ }
+ });
+
+ // 杩斿洖鏀堕泦鍒扮殑id鏁扮粍
+ return result;
+ },
getParentData() {
this.$HTTP.post('/api/smis/group/groupWorkstation/type', {
groupCategory: 1,
@@ -202,6 +215,10 @@
this.data = this.formatData(data)
this.$nextTick(() => {
this.parentData = this.data;
+ var ids = this.extractLastLevelIds(this.parentData);
+ this.selectedIds = ids;
+ this.search.workStationIdList = ids;
+ this.getRunData();
})
}
})
@@ -216,18 +233,20 @@
if(item.cardKey == "mdcRunning") {
if(item.apiResource == "") return;
this.apiResource = JSON.parse(item.apiResource);
- this.selectedIds = this.apiResource.workStationIdList;
- this.search.workStationIdList = this.apiResource.workStationIdList;
- this.timeLevel = this.apiResource.timeLevel;
- this.top = this.apiResource.top;
- if(this.apiResource.workStationIdList.length > 0) {
- this.getRunData();
- }
+ //this.selectedIds = this.apiResource.workStationIdList;
+ //this.search.workStationIdList = this.apiResource.workStationIdList;
+ //this.timeLevel = this.apiResource.timeLevel;
+ //this.top = this.apiResource.top;
+ // if(this.apiResource.workStationIdList.length > 0) {
+ // this.getRunData();
+ // }
}
})
},
getRunData() {
- this.$HTTP.post(`/api/blade-visual/status/running-top`,this.apiResource).then(res=> {
+ this.search.top = this.topList[0].value;
+ this.search.timeLevel = this.timeLevelList[0].value;
+ this.$HTTP.post(`/api/blade-visual/status/running-top`,this.search).then(res=> {
if(res.code == 200) {
this.isSearch = false;
var recordDom = document.getElementById('running');
--
Gitblit v1.9.3