Commit d56b76a2 authored by 杨勇飞's avatar 杨勇飞

增加排序图标,修复显示BUG

parent 9e70bacb
...@@ -380,6 +380,18 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -380,6 +380,18 @@ import { uniIcons } from '@dcloudio/uni-ui'
}, },
methods: { methods: {
initChart() { initChart() {
// 获取数据点数量
const dataCount = this.currentData.chart.receivable.length;
// 计算所需的最小宽度(假设每个数据点需要100px)
const minWidth = Math.max(dataCount * 60, 500);
// 设置容器宽度
const wrapper = document.getElementById('myChart');
if (wrapper) {
wrapper.style.width = `${minWidth}px`;
wrapper.style.padding = '0 0 5px 0';
}
this.myChart = echarts.init(document.getElementById('myChart')) this.myChart = echarts.init(document.getElementById('myChart'))
const option = { const option = {
...@@ -387,6 +399,14 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -387,6 +399,14 @@ import { uniIcons } from '@dcloudio/uni-ui'
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
type: 'shadow' type: 'shadow'
},
formatter: function(params) {
return params.map(item => {
if (item.seriesName === '利润率') {
return `${item.seriesName}: ${item.value}%`
}
return `${item.seriesName}: ${item.value}万元`
}).join('<br/>')
} }
}, },
legend: { legend: {
...@@ -397,19 +417,22 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -397,19 +417,22 @@ import { uniIcons } from '@dcloudio/uni-ui'
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '4%',
// top: '8%', top: '5%',
// bottom: '15%', bottom: '12%',
width: 'auto', width: 'auto',
containLabel: true containLabel: true
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
axisLine: {
axisTick: { show: true,
alignWithLabel: true lineStyle: { color: '#E8E8E8' }
}, },
axisLabel: {
interval: 0,
color: '#666',
fontSize: 12
}
}, },
yAxis: [ yAxis: [
{ {
...@@ -421,7 +444,9 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -421,7 +444,9 @@ import { uniIcons } from '@dcloudio/uni-ui'
}, },
splitLine: { splitLine: {
show: false show: false
} },
nameTextStyle: { color: '#666' },
axisLabel: { color: '#666' }
}, },
{ {
type: 'value', type: 'value',
...@@ -434,7 +459,9 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -434,7 +459,9 @@ import { uniIcons } from '@dcloudio/uni-ui'
}, },
splitLine: { splitLine: {
show: false show: false
} },
nameTextStyle: { color: '#666' },
axisLabel: { color: '#666' }
} }
], ],
series: [ series: [
...@@ -444,7 +471,8 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -444,7 +471,8 @@ import { uniIcons } from '@dcloudio/uni-ui'
barGap: '0%', barGap: '0%',
barWidth: '35%', barWidth: '35%',
itemStyle: { itemStyle: {
color: '#52C41A' color: '#52C41A',
borderRadius: [4, 4, 0, 0]
} }
}, },
{ {
...@@ -452,7 +480,8 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -452,7 +480,8 @@ import { uniIcons } from '@dcloudio/uni-ui'
type: 'bar', type: 'bar',
barWidth: '35%', barWidth: '35%',
itemStyle: { itemStyle: {
color: '#FF4D4F' color: '#FF4D4F',
borderRadius: [4, 4, 0, 0]
} }
}, },
{ {
...@@ -907,11 +936,13 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -907,11 +936,13 @@ import { uniIcons } from '@dcloudio/uni-ui'
border-radius: 8px; border-radius: 8px;
margin-bottom: 15px; margin-bottom: 15px;
.chart-header { .chart-header {
padding: 15px 15px 0px 15px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 15px;
.chart-title { .chart-title {
font-size: 16px; font-size: 16px;
...@@ -921,12 +952,12 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -921,12 +952,12 @@ import { uniIcons } from '@dcloudio/uni-ui'
.sort-buttons { .sort-buttons {
display: flex; display: flex;
gap: 2px; gap: 1px;
.sort-btn { .sort-btn {
font-size: 12px; font-size: 12px;
color: #666; color: #666;
padding: 2px 4px; padding: 4px 10px;
border-radius: 12px; border-radius: 12px;
background: #F5F5F5; background: #F5F5F5;
border: 1px solid #E8E8E8; border: 1px solid #E8E8E8;
...@@ -934,6 +965,7 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -934,6 +965,7 @@ import { uniIcons } from '@dcloudio/uni-ui'
transition: all 0.3s ease; transition: all 0.3s ease;
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 8px;
.sort-icon { .sort-icon {
font-family: "custom-icon" !important; font-family: "custom-icon" !important;
...@@ -952,6 +984,7 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -952,6 +984,7 @@ import { uniIcons } from '@dcloudio/uni-ui'
color: #fff; color: #fff;
background: #52C41A; background: #52C41A;
border-color: #52C41A; border-color: #52C41A;
box-shadow: 0 2px 4px rgba(82, 196, 26, 0.2);
} }
} }
} }
...@@ -961,14 +994,25 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -961,14 +994,25 @@ import { uniIcons } from '@dcloudio/uni-ui'
width: 100%; width: 100%;
overflow-x: auto; overflow-x: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
&::-webkit-scrollbar {
height: 6px;
background: #f5f5f5;
}
&::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.1);
border-radius: 3px;
} }
.chart-wrapper { .chart-wrapper {
height: 300px; height: 250px;
width: 600%; width: 100%;
padding: 0 0 5px 0;
min-width: 100%; min-width: 100%;
} }
} }
}
.table-container { .table-container {
background-color: #fff; background-color: #fff;
...@@ -991,11 +1035,11 @@ import { uniIcons } from '@dcloudio/uni-ui' ...@@ -991,11 +1035,11 @@ import { uniIcons } from '@dcloudio/uni-ui'
@font-face { @font-face {
font-family: "custom-icon"; font-family: "custom-icon";
src: url('/static/fonts/iconfont.ttf') format('truetype'); src: url('/static/fonts/icomoon.ttf') format('truetype');
} }
.sort-icon::before { .sort-icon::before {
content: '\e737'; content: '\ea4d';
font-family: "custom-icon" !important; font-family: "custom-icon" !important;
font-size: 12px; font-size: 12px;
font-style: normal; font-style: normal;
......
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="icomoon" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xea4d;" glyph-name="sort-amount-desc" d="M320 192v768h-128v-768h-160l224-224 224 224h-160zM448 960h576v-128h-576v128zM448 768h448v-128h-448v128zM448 576h320v-128h-320v128zM448 384h192v-128h-192v128z" />
</font></defs></svg>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment