From 5280ccf366c656054731d62c903d97b77d5baf0d Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期四, 24 十月 2024 18:37:25 +0800
Subject: [PATCH] 1
---
src/views/home/widgets/index.vue | 34 +++++++++++++++++++++++++---------
1 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/src/views/home/widgets/index.vue b/src/views/home/widgets/index.vue
index acace0d..837a33b 100644
--- a/src/views/home/widgets/index.vue
+++ b/src/views/home/widgets/index.vue
@@ -143,7 +143,6 @@
})
var myGrid = copmsList;
this.$TOOL.data.set("DASHBOARDGRID", copmsList);
-
return this.allCompsList;
},
nowCompsList(){
@@ -157,7 +156,7 @@
},
methods: {
endDraggable(e) {
-
+ //console.log(this.grid,e,111)
},
getWorkbenchCarList() {
var data = this.$TOOL.data.get("MENU");
@@ -227,9 +226,15 @@
// this.$CONFIG.DEFAULT_GRID.data = cards;
//this.$CONFIG.DEFAULT_GRID.copmsList = [["mdcDeviceStatus"],["mdcRunning","mdcEquipmentRun"],[],[]]
if(res.data.length == 0) {
- this.$CONFIG.DEFAULT_GRID.copmsList = [];
+ this.$CONFIG.DEFAULT_GRID.copmsList = [[],[],[],[]];
}else {
- this.$CONFIG.DEFAULT_GRID.copmsList = res.data[0].layoutConfig == null?[]:JSON.parse(res.data[0].layoutConfig);
+ var layoutConfig = JSON.parse(res.data[0].layoutConfig);
+ //涓嶆弧瓒�4锛岃ˉ瓒�
+ var newArr = [...layoutConfig];
+ for (let i = 0; i < (4-newArr.length); i++) {
+ layoutConfig.push([]);
+ }
+ this.$CONFIG.DEFAULT_GRID.copmsList = res.data[0].layoutConfig == null?[]:layoutConfig;
}
this.$CONFIG.DEFAULT_GRID.layout = [24,12,6,6];
this.$CONFIG.DEFAULT_GRID.data = res.data;
@@ -278,23 +283,34 @@
},
//闅愯棌缁勪欢
remove(item){
- var newCopmsList = this.grid.copmsList
- newCopmsList.forEach((obj, index) => {
- var newObj = obj.filter(o=>o!=item)
- newCopmsList[index] = newObj;
+ this.$nextTick(()=> {
+ var newCopmsList = this.grid.copmsList;
+ newCopmsList.forEach((obj, index) => {
+ var newObj = obj.filter(o=>o!=item)
+ newCopmsList[index] = newObj;
+ })
+ this.grid.data.forEach((item1,index1)=> {
+ if(item1.cardKey == item) {
+ this.grid.data.splice(index1,1);
+ }
+ })
})
},
//淇濆瓨
save(){
this.customizing = false
this.$refs.widgets.style.removeProperty('transform')
- this.$TOOL.data.set("grid", this.grid)
+ this.$TOOL.data.set("grid", this.grid);
+ //this.apiResource.workStationIdList
//淇濆瓨鎺ュ彛
//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);
+ if(item.cardKey == "mdcRunning") {
+ item.apiResource = JSON.stringify({workStationIdList: []})
+ }
})
var obj = {
workbenchCardAddVOList: this.grid.data,
--
Gitblit v1.9.3