From a5b8938f2be523d3f0a4dfc3acef42aab8c77191 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期四, 19 九月 2024 10:24:25 +0800
Subject: [PATCH] 1
---
src/views/home/widgets/index.vue | 66 ++++++++++++++++++++++++++++----
1 files changed, 57 insertions(+), 9 deletions(-)
diff --git a/src/views/home/widgets/index.vue b/src/views/home/widgets/index.vue
index bcf5b65..d3744a6 100644
--- a/src/views/home/widgets/index.vue
+++ b/src/views/home/widgets/index.vue
@@ -62,13 +62,21 @@
<el-col :span="24"><span></span></el-col>
</el-row>
</div>
+ <div class="selectLayout-item item04" :class="{active:grid.layout.join(',').indexOf('24,12,6,6')>-1}" @click="setLayout([24,12,6,6])">
+ <el-row :gutter="2">
+ <el-col :span="24"><span></span></el-col>
+ <el-col :span="12"><span></span></el-col>
+ <el-col :span="6"><span></span></el-col>
+ <el-col :span="6"><span></span></el-col>
+ </el-row>
+ </div>
</div>
</el-header>
<el-main class="nopadding">
<div class="widgets-list">
- <div v-if="myCompsList.length<=0" class="widgets-list-nodata">
+ <!-- <div v-if="myCompsList.length<=0" class="widgets-list-nodata">
<el-empty description="娌℃湁閮ㄤ欢鍟�" :image-size="60"></el-empty>
- </div>
+ </div> -->
<div v-for="item in myCompsList" :key="item.title" class="widgets-list-item">
<div class="item-logo"><el-icon><component :is="item.icon" /></el-icon></div>
<div class="item-info">
@@ -92,6 +100,7 @@
<script>
import draggable from 'vuedraggable'
import allComps from './components'
+import { arrow } from '@popperjs/core';
export default {
components: {
@@ -141,7 +150,8 @@
})
var myGrid = copmsList;
this.$TOOL.data.set("DASHBOARDGRID", copmsList);
- return this.allCompsList.filter(item => !item.disabled && myGrid.includes(item.key))
+ //return this.allCompsList.filter(item => !item.disabled && myGrid.includes(item.key))
+ return this.allCompsList;
},
nowCompsList(){
var copmsList = [];
@@ -159,13 +169,36 @@
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;
+ });
+ //console.log(cards)
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))
}
@@ -207,6 +240,20 @@
this.customizing = false
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 obj = {
+ workbenchCardAddVOList: data,
+ workbenchId: this.workid
+ }
+ this.$HTTP.post(`/api/blade-system/workbench-card/create-workbench-card`,obj).then(res=> {
+ if(res.code == 200) {
+ this.$message.success("鎿嶄綔鎴愬姛");
+ }
+ })
+ console.log(this.grid,111)
},
//鎭㈠榛樿
backDefaul(){
@@ -217,8 +264,9 @@
},
//鍏抽棴
close(){
- this.customizing = false
- this.$refs.widgets.style.removeProperty('transform')
+ //this.customizing = false
+ //this.$refs.widgets.style.removeProperty('transform')
+ this.backDefaul();
}
}
}
@@ -264,8 +312,8 @@
.selectLayout {width: 100%;display: flex;}
.selectLayout-item {width:60px;height:60px;border: 2px solid var(--el-border-color-light);padding:5px;cursor: pointer;margin-right: 15px;}
.selectLayout-item span {display: block;background: var(--el-border-color-light);height:46px;}
- .selectLayout-item.item02 span {height:30px;}
- .selectLayout-item.item02 .el-col:nth-child(1) span {height:14px;margin-bottom: 2px;}
+ .selectLayout-item.item02 span,.selectLayout-item.item04 span {height:30px;}
+ .selectLayout-item.item02 .el-col:nth-child(1) span,.selectLayout-item.item04 .el-col:nth-child(1) span {height:14px;margin-bottom: 2px;}
.selectLayout-item.item03 span {height:14px;margin-bottom: 2px;}
.selectLayout-item:hover {border-color: var(--el-color-primary);}
.selectLayout-item.active {border-color: var(--el-color-primary);}
--
Gitblit v1.9.3