diff --git a/pages/DigitalIntelligenceDashboard/components/ProductReport.vue b/pages/DigitalIntelligenceDashboard/components/ProductReport.vue index 51100f5..436dfb2 100644 --- a/pages/DigitalIntelligenceDashboard/components/ProductReport.vue +++ b/pages/DigitalIntelligenceDashboard/components/ProductReport.vue @@ -179,8 +179,13 @@ export default { { type: '饮品', code: 'KF004', name: '云南咖啡', sales: 1876, revenue: 234567 }, { type: '保健品', code: 'SQ005', name: '三七粉', sales: 1567, revenue: 456789 }, { type: '工艺品', code: 'YS006', name: '玉石手镯', sales: 1234, revenue: 345678 } - ], - pageScrollTop: 0 + ] + } + }, + props: { + pageScrollTop: { + type: Number, + default: 0 } }, @@ -224,7 +229,7 @@ export default { barChartData() { return { categories: this.salesRankingData.map(item => - this.formatXAxisLabel(item.name) + item.name ), series: [{ name: '销量', @@ -375,23 +380,7 @@ export default { this.salesRankingData = res }, - // 格式化X轴标签文字 - formatXAxisLabel(name) { - if (!name) return ''; - // 获取屏幕宽度决定显示长度 - const screenWidth = this.getScreenWidth(); - let maxLength = 4; // 默认长度 - - if (screenWidth > 750) { - maxLength = 6; // 大屏显示更长 - } else if (screenWidth < 375) { - maxLength = 3; // 小屏显示更短 - } - - // 如果名称超过最大长度,截取并添加省略号 - return name.length > maxLength ? name.substring(0, maxLength) + '...' : name; - }, // 获取屏幕宽度 getScreenWidth() { diff --git a/pages/DigitalIntelligenceDashboard/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js b/pages/DigitalIntelligenceDashboard/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js index a104c55..677a6fe 100644 --- a/pages/DigitalIntelligenceDashboard/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js +++ b/pages/DigitalIntelligenceDashboard/components/qiun-data-charts/js_sdk/u-charts/config-ucharts.js @@ -96,8 +96,11 @@ const cfu = { //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换 "formatter": { 'SalesRankingOfProducts': function (item, category, index, opts) { - console.log('2222', item, category, index, opts); - + console.log('', item); + console.log('', category); + console.log('', index); + console.log('', opts); + return `${category}:${item.data.toLocaleString()}件` }, "yAxisDemo1": function (val, index, opts) { return val + '元' }, "yAxisDemo2": function (val, index, opts) { return val.toFixed(2) }, diff --git a/pages/DigitalIntelligenceDashboard/index.vue b/pages/DigitalIntelligenceDashboard/index.vue index 83b9881..12479a3 100644 --- a/pages/DigitalIntelligenceDashboard/index.vue +++ b/pages/DigitalIntelligenceDashboard/index.vue @@ -1,6 +1,6 @@