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,62 +571,73 @@ onUnmounted(() => {
flex-direction: column; flex-direction: column;
} }
:deep(.ant-card-body) {
flex: 1;
display: flex;
flex-direction: column;
padding: 12px !important;
overflow: hidden;
}
.chart { .chart {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
}
.chart > div { > div {
width: 100%; width: 100%;
height: 100%; height: 100%;
}
} }
.control-row { .control-row {
margin-bottom: 16px; margin-bottom: 16px;
background-color: #ffffff; // 改为白色背景 background-color: #ffffff;
border-radius: 4px; border-radius: 4px;
padding: 16px; padding: 16px;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03); // 添加轻微阴影 box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
border: 1px solid #f0f0f0; // 添加浅色边框 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); // 调整标签颜色
} }
.switch-label { .switch-label {
margin-left: 8px; margin-left: 8px;
font-size: 14px; font-size: 14px;
color: rgba(0, 0, 0, 0.65); // 调整文字颜色 color: rgba(0, 0, 0, 0.65);
white-space: nowrap; white-space: nowrap;
} }
.drag-handle { .drag-handle {
position: absolute; position: absolute;
top: 0; top: 0px;
right: 0; right: 0px;
width: 20px; width: 24px;
height: 20px; height: 24px;
background-color: #1890ff; display: flex;
align-items: center;
justify-content: center;
background-color: rgba(24, 144, 255, 0.1);
border-radius: 4px;
cursor: move; 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 {
:deep(.ant-card-head-title) { .ant-card-body {
padding-right: 25px; /* 为拖拽手柄留出空间 */ 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> </style>