叶静 vor 2 Wochen
Ursprung
Commit
26977b18d5

+ 57 - 10
src/app/shop/admin/data/report/components/report-chart.vue

@@ -458,6 +458,14 @@ const generatePieChart = (baseOption) => {
 
   return {
     ...baseOption,
+    // 调整grid以给标签留出更多空间
+    grid: {
+      left: '15%',
+      right: '15%',
+      bottom: '15%',
+      top: '15%',
+      containLabel: true
+    },
     tooltip: {
       trigger: 'item',
       formatter: '{a} <br/>{b}: {c} ({d}%)',
@@ -468,17 +476,13 @@ const generatePieChart = (baseOption) => {
       }
     },
     legend: {
-      orient: 'vertical',
-      left: 'left',
-      textStyle: {
-        color: 'var(--sa-subtitle)'
-      }
+      show: false // 隐藏图例
     },
     series: [{
       name: props.title,
       type: 'pie',
-      radius: ['40%', '70%'],
-      center: ['60%', '50%'],
+      radius: ['25%', '50%'], // 进一步缩小饼图半径,为标签留出更多空间
+      center: ['50%', '50%'], // 居中显示
       data: pieData,
       emphasis: {
         itemStyle: {
@@ -489,11 +493,54 @@ const generatePieChart = (baseOption) => {
       },
       label: {
         show: true,
-        formatter: '{b}: {d}%'
+        formatter: function (params) {
+          // 格式化日期显示,如果日期太长则截断
+          let name = params.name;
+          if (name.length > 10) {
+            // 如果是日期格式,尝试简化显示
+            if (name.includes('-')) {
+              const parts = name.split('-');
+              if (parts.length >= 2) {
+                name = parts[1] + '-' + parts[2]; // 显示月-日
+              }
+            } else if (name.length > 8) {
+              name = name.substring(0, 8) + '...'; // 截断长文本
+            }
+          }
+          return name + ': ' + params.percent + '%';
+        },
+        fontSize: 11,
+        color: 'var(--sa-subfont)',
+        // 标签位置优化
+        position: 'outside',
+        distanceToLabelLine: 8,
+        // 文字换行
+        rich: {
+          name: {
+            fontSize: 11,
+            color: 'var(--sa-subfont)'
+          }
+        }
       },
       labelLine: {
-        show: true
-      }
+        show: true,
+        length: 20,      // 增加第一段线长度
+        length2: 15,     // 增加第二段线长度
+        smooth: 0.2,     // 线条平滑度
+        lineStyle: {
+          color: 'var(--sa-space)',
+          width: 1
+        }
+      },
+      // 避免标签重叠
+      avoidLabelOverlap: true,
+      // 标签布局优化
+      labelLayout: {
+        hideOverlap: true,
+        moveOverlap: 'shiftY' // 当标签重叠时,垂直移动标签
+      },
+      // 确保标签在容器内
+      silent: false
     }]
   }
 }

+ 4 - 4
src/app/shop/admin/user/list/select.vue

@@ -22,7 +22,7 @@
                   </el-icon>
                 </el-avatar>
                 <div class="user-details">
-                  <div class="user-name">{{ scope.row.nickname || scope.row.name || t('modules.userSelect.noNickname')
+                  <div class="user-name">{{ scope.row.name || t('modules.userSelect.noNickname')
                   }}</div>
                   <div class="user-phone">{{ scope.row.phoneNo || t('modules.userSelect.noPhone') }}</div>
                 </div>
@@ -125,9 +125,9 @@ async function getData(page, searchParams = {}) {
     const { code, data } = await api.list.list(params);
     if (code == 200) {
       table.list = data.list || [];
-      pageData.page = data.current || 1;
-      pageData.size = data.size || 10;
-      pageData.total = data.total || 0;
+      pageData.page = data.pageNum;
+      pageData.size = data.pageSize;
+      pageData.total = data.total;
 
       nextTick(() => {
         setDefaultSelected();

+ 3 - 5
src/locales/en-US/index.json

@@ -443,7 +443,7 @@
     "valueTooLong": "Value is too long",
     "valueTooShort": "Value is too short",
     "confirmDelete": "Are you sure you want to delete this record?",
-    "confirmBatchDelete": "Are you sure you want to delete selected records?",
+    "confirmBatchDelete": "Are you sure you want to delete the selected goods?",
     "confirmSave": "Are you sure you want to save?",
     "confirmSubmit": "Are you sure you want to submit?",
     "deleteConfirm": "This operation will delete, continue?",
@@ -478,7 +478,6 @@
     "passwordChangeSuccess": "Password changed successfully, please login again",
     "editFeatureNotDeveloped": "Edit feature is under development",
     "goodsAttributeSaveSuccess": "Product attributes saved successfully",
-    "confirmBatchDelete": "Are you sure you want to delete the selected goods?",
     "invalidAspectRatio": "Image aspect ratio does not meet requirements, please upload {ratio} ratio image"
   },
   "placeholders": {
@@ -1180,8 +1179,7 @@
       "goodsSupplierRequired": "Please enter goods supplier",
       "goodsImageRequired": "Please upload goods image",
       "goodsDetailImageRequired": "Please upload goods detail image",
-      "mainImageRatioTip": "Image must be in 1:1 square aspect ratio",
-      "goodsId": "Goods ID"
+      "mainImageRatioTip": "Image must be in 1:1 square aspect ratio"
     },
     "order": {
       "orderManagement": "Order Management",
@@ -1460,7 +1458,7 @@
       "confirmSelect": "Confirm Selection",
       "normal": "Normal",
       "disabled": "Disabled",
-      "noNickname": "No nickname set",
+      "noNickname": "No set",
       "noPhone": "No phone bound",
       "getUserListFailed": "Failed to get user list"
     },

+ 4 - 10
src/locales/zh-CN/index.json

@@ -441,7 +441,7 @@
     "valueTooLong": "输入内容过长",
     "valueTooShort": "输入内容过短",
     "confirmDelete": "确定要删除这条记录吗?",
-    "confirmBatchDelete": "确定要删除选中的记录吗?",
+    "confirmBatchDelete": "确定要删除选中的商品吗?",
     "confirmSave": "确定要保存吗?",
     "confirmSubmit": "确定要提交吗?",
     "deleteConfirm": "此操作将删除, 是否继续?",
@@ -477,9 +477,7 @@
     "passwordChangeSuccess": "密码修改成功,请重新登录",
     "editFeatureNotDeveloped": "编辑功能待开发",
     "goodsAttributeSaveSuccess": "商品属性保存成功",
-    "confirmBatchDelete": "确定要删除选中的商品吗?",
-    "invalidAspectRatio": "图片比例不符合要求,请上传{ratio}比例的图片",
-    "confirmBatchDelete": "确定要删除选中的商品吗?"
+    "invalidAspectRatio": "图片比例不符合要求,请上传{ratio}比例的图片"
   },
   "placeholders": {
     "inputOrderNo": "请输入订单号",
@@ -1189,11 +1187,7 @@
       "sortPriceDesc": "价格降序",
       "sortSalesAsc": "销量升序",
       "sortSalesDesc": "销量降序",
-      "batchOnSale": "批量上架",
-      "batchOffSale": "批量下架",
-      "batchDelete": "批量删除",
-      "mainImageRatioTip": "图片必须为1:1正方形比例",
-      "goodsId": "商品ID"
+      "mainImageRatioTip": "图片必须为1:1正方形比例"
     },
     "order": {
       "orderManagement": "订单管理",
@@ -1472,7 +1466,7 @@
       "confirmSelect": "确认选择",
       "normal": "正常",
       "disabled": "禁用",
-      "noNickname": "未设置昵称",
+      "noNickname": "未设置",
       "noPhone": "未绑定手机",
       "getUserListFailed": "获取用户列表失败"
     },