From e051ca94fc5ab5f956e6bbf9ff7fa9d91cf47bb9 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期日, 10 十一月 2024 19:37:55 +0800
Subject: [PATCH] 添加饼图
---
src/views/home/widgets/index.vue | 39 ++++++++++++++++++++++++++++-----------
1 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/src/views/home/widgets/index.vue b/src/views/home/widgets/index.vue
index 9aca63e..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");
@@ -226,10 +225,17 @@
// 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"],[],[]]
- // }
+ if(res.data.length == 0) {
+ this.$CONFIG.DEFAULT_GRID.copmsList = [[],[],[],[]];
+ }else {
+ 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;
this.defaultGrid = this.$CONFIG.DEFAULT_GRID;
@@ -277,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