fix:关键指标界面拖拽块设为图标,优化样式

This commit is contained in:
zhongzm
2024-10-15 18:26:02 +08:00
parent 700bff6e38
commit b4623d19e5

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import { DragOutlined } from '@ant-design/icons-vue';
import { GridLayout, GridItem } from 'grid-layout-plus'
import * as echarts from 'echarts';
import { PageContainer } from 'antdv-pro-layout';
@@ -523,7 +524,9 @@ onUnmounted(() => {
drag-ignore-from=".no-drag"
class="grid-item"
>
<div class="drag-handle"></div>
<div class="drag-handle">
<DragOutlined />
</div>
<a-card :bordered="false" class="card-container">
<template #title>
<span class="no-drag">{{ item.i.toUpperCase() }}</span>
@@ -554,11 +557,11 @@ onUnmounted(() => {
<style lang="less" scoped>
.charts-container {
width: 100%;
min-height: 600px; // 减小最小高度
min-height: 600px;
}
.grid-item {
overflow: visible; // 改为 visible 以确保拖拽手柄可见
overflow: visible;
position: relative;
}
@@ -568,62 +571,73 @@ onUnmounted(() => {
flex-direction: column;
}
:deep(.ant-card-body) {
flex: 1;
display: flex;
flex-direction: column;
padding: 12px !important;
overflow: hidden;
}
.chart {
flex: 1;
min-height: 0;
}
.chart > div {
width: 100%;
height: 100%;
> div {
width: 100%;
height: 100%;
}
}
.control-row {
margin-bottom: 16px;
background-color: #ffffff; // 改为白色背景
background-color: #ffffff;
border-radius: 4px;
padding: 16px;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03); // 添加轻微阴影
border: 1px solid #f0f0f0; // 添加浅色边框
}
:deep(.ant-form-item) {
margin-bottom: 0;
}
:deep(.ant-form-item-label) {
font-weight: 500; // 加粗标签文字
color: rgba(0, 0, 0, 0.85); // 调整标签颜色
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
border: 1px solid #f0f0f0;
}
.switch-label {
margin-left: 8px;
font-size: 14px;
color: rgba(0, 0, 0, 0.65); // 调整文字颜色
color: rgba(0, 0, 0, 0.65);
white-space: nowrap;
}
.drag-handle {
position: absolute;
top: 0;
right: 0;
width: 20px;
height: 20px;
background-color: #1890ff;
top: 0px;
right: 0px;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(24, 144, 255, 0.1);
border-radius: 4px;
cursor: move;
z-index: 100; // 增加 z-index 确保在最上层
z-index: 100;
transition: background-color 0.3s;
&:hover {
background-color: rgba(24, 144, 255, 0.2);
}
}
/* 可以根据需要调整卡片标题的样式 */
:deep(.ant-card-head-title) {
padding-right: 25px; /* 为拖拽手柄留出空间 */
:deep {
.ant-card-body {
flex: 1;
display: flex;
flex-direction: column;
padding: 12px !important;
overflow: hidden;
}
.ant-form-item {
margin-bottom: 0;
}
.ant-form-item-label {
font-weight: 500;
color: rgba(0, 0, 0, 0.85);
}
.anticon {
font-size: 16px;
color: #1890ff;
}
}
</style>