From 9d58c13ce013e2791193e60c58bdda69194115ce Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期二, 22 十月 2024 20:14:57 +0800
Subject: [PATCH] 1
---
src/views/mdc/realtime-status/index.vue | 3
src/views/home/widgets/index.vue | 134 ++++++++++++++++++++++++--------------------
2 files changed, 73 insertions(+), 64 deletions(-)
diff --git a/src/views/home/widgets/index.vue b/src/views/home/widgets/index.vue
index e8f9bd9..d1497d7 100644
--- a/src/views/home/widgets/index.vue
+++ b/src/views/home/widgets/index.vue
@@ -143,6 +143,7 @@
})
var myGrid = copmsList;
this.$TOOL.data.set("DASHBOARDGRID", copmsList);
+
return this.allCompsList;
},
nowCompsList(){
@@ -156,7 +157,7 @@
},
methods: {
endDraggable(e) {
- console.log(e,this.grid)
+
},
getWorkbenchCarList() {
var data = this.$TOOL.data.get("MENU");
@@ -169,64 +170,70 @@
//鎸墆coordinate杩涜浠庡皬鍒板ぇ鎺掑簭锛屽鏋測coordinate涓�鏍锋椂锛屾寜鐓coordinate浠庡皬鍒板ぇ鎺掑簭
//cardWide浠h〃瀹藉害
//cardKey浠h〃缁勪欢鍚嶇О
- cards.sort((a, b) => {
- // 鍏堟瘮杈� ycoordinate
- if (a.ycoordinate < b.ycoordinate) {
- return -1;
- }
- if (a.ycoordinate > b.ycoordinate) {
- return 1;
- }
- // 濡傛灉 ycoordinate 鐩稿悓锛屽垯姣旇緝 xcoordinate
- if (a.xcoordinate < b.xcoordinate) {
- return -1;
- }
- if (a.xcoordinate > b.xcoordinate) {
- return 1;
- }
- // 濡傛灉 xcoordinate 涔熺浉鍚岋紝鍒欎笉浜ゆ崲浣嶇疆
- return 0;
- });
- var layout = [...new Set(cards.map(v => v.cardWide *2))]; //甯冨眬
- if(layout.length < 3) {
- layout = [24,12,6,6];
- }
+ // cards.sort((a, b) => {
+ // // 鍏堟瘮杈� ycoordinate
+ // if (a.ycoordinate < b.ycoordinate) {
+ // return -1;
+ // }
+ // if (a.ycoordinate > b.ycoordinate) {
+ // return 1;
+ // }
+ // // 濡傛灉 ycoordinate 鐩稿悓锛屽垯姣旇緝 xcoordinate
+ // if (a.xcoordinate < b.xcoordinate) {
+ // return -1;
+ // }
+ // if (a.xcoordinate > b.xcoordinate) {
+ // return 1;
+ // }
+ // // 濡傛灉 xcoordinate 涔熺浉鍚岋紝鍒欎笉浜ゆ崲浣嶇疆
+ // return 0;
+ // });
+ // var layout = [...new Set(cards.map(v => v.cardWide *2))]; //甯冨眬
+ // if(layout.length < 3) {
+ // layout = [24,12,6,6];
+ // }
var result = {}
//鎺掑簭
- cards.forEach(v=> {
- if(!result[`${v.cardWide}-${v.xcoordinate}`]) {
- result[`${v.cardWide}-${v.xcoordinate}`] = []
- }
- result[`${v.cardWide}-${v.xcoordinate}`].push(v)
- })
- let resdata = []
- Object.values(result).forEach(v => {
- let min = v.sort((a,b) => a.ycoordinate - b.ycoordinate)[0];
- let minYX = Number(min.ycoordinate)*10 + Number(min.xcoordinate);
- let obj = {};
- obj[minYX] = v;
- resdata.push(obj);
- })
- var lastData = resdata.map(v => Object.values(v));
- //杞寲
- var copmsList = lastData.map(function(outerArray) {
- // 璁块棶鏈�鍐呭眰鐨勫璞℃暟缁�
- var innerArray = outerArray[0];
- return innerArray.map(function(obj) {
- return obj.cardKey;
- });
- });
+ // cards.forEach(v=> {
+ // if(!result[`${v.cardWide}-${v.xcoordinate}`]) {
+ // result[`${v.cardWide}-${v.xcoordinate}`] = []
+ // }
+ // result[`${v.cardWide}-${v.xcoordinate}`].push(v)
+ // })
+ // let resdata = []
+ // Object.values(result).forEach(v => {
+ // let min = v.sort((a,b) => a.ycoordinate - b.ycoordinate)[0];
+ // let minYX = Number(min.ycoordinate)*10 + Number(min.xcoordinate);
+ // let obj = {};
+ // obj[minYX] = v;
+ // resdata.push(obj);
+ // })
+ // var lastData = resdata.map(v => Object.values(v));
+ // //杞寲
+ // var copmsList = lastData.map(function(outerArray) {
+ // // 璁块棶鏈�鍐呭眰鐨勫璞℃暟缁�
+ // var innerArray = outerArray[0];
+ // return innerArray.map(function(obj) {
+ // return obj.cardKey;
+ // });
+ // });
//淇濊瘉鏈�4涓暟缁勶紝鎵嶈兘鎷栨嫿
- var neededLength = 4 - copmsList.length;
- for (var i = 0; i < neededLength; i++) {
- copmsList.push([]);
- }
- this.$CONFIG.DEFAULT_GRID.copmsList = copmsList;
- this.$CONFIG.DEFAULT_GRID.layout = layout;
- this.$CONFIG.DEFAULT_GRID.data = cards;
+ // var neededLength = 4 - copmsList.length;
+ // for (var i = 0; i < neededLength; i++) {
+ // copmsList.push([]);
+ // }
+ // this.$CONFIG.DEFAULT_GRID.copmsList = copmsList;
+ // this.$CONFIG.DEFAULT_GRID.layout = layout;
+ // this.$CONFIG.DEFAULT_GRID.data = cards;
+ //this.$CONFIG.DEFAULT_GRID.copmsList = [["mdcDeviceStatus"],["mdcRunning","mdcEquipmentRun"],[],[]]
+ this.$CONFIG.DEFAULT_GRID.copmsList = res.data[0].layoutConfig == null?[]:JSON.parse(res.data[0].layoutConfig);
+ // if(this.$CONFIG.DEFAULT_GRID.copmsList.length == 0) {
+ // this.$CONFIG.DEFAULT_GRID.copmsList = [["mdcDeviceStatus"],["mdcRunning","mdcEquipmentRun"],[],[]]
+ // }
+ this.$CONFIG.DEFAULT_GRID.layout = [24,12,6,6];
+ this.$CONFIG.DEFAULT_GRID.data = res.data;
this.defaultGrid = this.$CONFIG.DEFAULT_GRID;
this.grid = this.$TOOL.data.get("grid") || JSON.parse(JSON.stringify(this.defaultGrid));
- console.log(this.$TOOL.data.get("grid"),JSON.parse(JSON.stringify(this.defaultGrid)),555)
}
})
},
@@ -258,10 +265,10 @@
target.copmsList[0].push(item.key)
}
this.$nextTick(()=> {
- var height = String(Math.floor(this.$refs.Access[0].offsetHeight/ 57));
- item.cardLength = height;
- item.cardWide = '12';
- item.xcoordinate = '0';
+ //var height = String(Math.floor(this.$refs.Access[0].offsetHeight/ 57));
+ //item.cardLength = height;
+ //item.cardWide = '12';
+ //item.xcoordinate = '0';
//item.ycoordinate = '4';
item.cardKey = item.key;
item.workbenchId = that.workid;
@@ -282,11 +289,14 @@
this.$refs.widgets.style.removeProperty('transform')
this.$TOOL.data.set("grid", this.grid)
//淇濆瓨鎺ュ彛
- var copmsList = this.grid.copmsList;
- var flattened = copmsList.reduce((acc, val) => acc.concat(val), []); //鎵佸钩鍖�
- var data = this.grid.data.filter(item=>flattened.includes(item.cardKey));
+ //var copmsList = this.grid.copmsList;
+ //var flattened = copmsList.reduce((acc, val) => acc.concat(val), []); //鎵佸钩鍖�
+ //var data = this.grid.data.filter(item=>this.nowCompsList.includes(item.cardKey));
+ this.grid.data.forEach(item=> {
+ item.layoutConfig = JSON.stringify(this.grid.copmsList);
+ })
var obj = {
- workbenchCardAddVOList: data,
+ workbenchCardAddVOList: this.grid.data,
workbenchId: this.workid
}
this.$HTTP.post(`/api/blade-system/workbench-card/create-workbench-card`,obj).then(res=> {
diff --git a/src/views/mdc/realtime-status/index.vue b/src/views/mdc/realtime-status/index.vue
index ece0fac..1f101ae 100644
--- a/src/views/mdc/realtime-status/index.vue
+++ b/src/views/mdc/realtime-status/index.vue
@@ -1,7 +1,7 @@
<!--
* @Date: 2024-04-09 22:11:21
* @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-10-22 19:46:11
+ * @LastEditTime: 2024-10-22 20:01:19
* @FilePath: /cps-web/src/views/mdc/realtime-status/index.vue
瀹炴椂鐪嬫澘
-->
@@ -251,7 +251,6 @@
}
},
goSet() {
- //console.log(this.$TOOL.data.get("MENU"));name == "閰嶇疆涓績"
this.$router.push('/mdc/configuration'); //鍒嗘瀽璁剧疆
},
gostatus(item) {
--
Gitblit v1.9.3