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