From ff2af13cd41b8528e830e22300fb14f2c5778e7c Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期五, 21 六月 2024 17:35:46 +0800
Subject: [PATCH] 1
---
src/views/home/widgets/index.vue | 34 ++++++++++++++++++++++++++++++----
1 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/src/views/home/widgets/index.vue b/src/views/home/widgets/index.vue
index d7cebf5..bd5febd 100644
--- a/src/views/home/widgets/index.vue
+++ b/src/views/home/widgets/index.vue
@@ -21,7 +21,10 @@
<template #item="{ element }">
<div class="widgets-item">
<component :is="allComps[element]"></component>
-
+ <div v-if="customizing" class="customize-overlay">
+ <el-button class="close" type="danger" plain icon="el-icon-close" size="small" @click="remove(element)"></el-button>
+ <label><el-icon><component :is="allComps[element].icon" /></el-icon>{{ allComps[element].title }}</label>
+ </div>
</div>
</template>
</draggable>
@@ -108,7 +111,6 @@
this.getWorkbenchCarList();
},
mounted() {
- console.log(this.allComps,this.element,this.grid.layout)
this.$emit('on-mounted')
},
computed: {
@@ -132,6 +134,7 @@
return allCompsList
},
myCompsList(){
+ alert(1)
var copmsList = [];
if(this.defaultGrid.copmsList == undefined) return [];
this.defaultGrid.copmsList.forEach(item=> {
@@ -157,13 +160,34 @@
this.$HTTP.get(`/api/blade-system/workbench-card/list?workbenchId=${this.workid}`).then(res=> {
if(res.code == 200) {
let cards = res.data;
+ //ycoordinate琛ㄧず浠庝笂寰�涓嬩粠绗嚑涓紑濮嬶紝浠�0寮�濮嬫暟
+ //xcoordinate琛ㄧず浠庡乏寰�鍙充粠绗嚑涓紑濮嬶紝浠�0寮�濮嬫暟
+ //鎸墆coordinate杩涜浠庡皬鍒板ぇ鎺掑簭锛屽鏋測coordinate涓�鏍锋椂锛屾寜鐓coordinate浠庡皬鍒板ぇ鎺掑簭
+ //cardWide浠h〃瀹藉害
+ //cardKey浠h〃缁勪欢鍚嶇О
cards.sort((a, b) => {
- return parseInt(a.xcoordinate, 10) - parseInt(b.xcoordinate, 10);
- });
+ // 鍏堟瘮杈� 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;
+ });
cards.forEach((item,index)=> {
this.$CONFIG.DEFAULT_GRID.copmsList[index] = [item.cardKey];
this.$CONFIG.DEFAULT_GRID.layout[index] = item.cardWide * 2;
})
+ console.log(this.$CONFIG.DEFAULT_GRID.copmsList,this.$CONFIG.DEFAULT_GRID.layout,234)
this.$CONFIG.DEFAULT_GRID.data = cards;
this.defaultGrid = this.$CONFIG.DEFAULT_GRID;
this.grid = this.$TOOL.data.get("grid") || JSON.parse(JSON.stringify(this.defaultGrid))
@@ -195,11 +219,13 @@
},
//闅愯棌缁勪欢
remove(item){
+ console.log(item,222)
var newCopmsList = this.grid.copmsList
newCopmsList.forEach((obj, index) => {
var newObj = obj.filter(o=>o!=item)
newCopmsList[index] = newObj;
})
+ //console.log(newCopmsList,123)
},
//淇濆瓨
save(){
--
Gitblit v1.9.3