Răsfoiți Sursa

fix: 完成系统故障验证和模块加载修复

本次更新包含:
- 修复 mini-charts 包 ESM 模块加载问题
  - 将 package.json 类型改为 module
  - 更新 TypeScript 配置使用 ESNext 模块
  - 修复组件导出路径
- 完成系统故障文档验证 (9个问题)
  - 问题1-5,7-9 已验证修复
  - 问题6 需进一步处理

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname 1 zi în urmă
părinte
comite
e9027e56f8

+ 1 - 3
mini-talent/src/utils/mockAttendanceData.ts

@@ -58,7 +58,6 @@ export function generateMockAttendanceData(year: number, month: number): {
 } {
   const dates = getDatesInMonth(year, month)
   const records: AttendanceRecord[] = []
-  let workDayCount = 0
 
   // 从后向前生成记录(倒序)
   for (let i = dates.length - 1; i >= 0; i--) {
@@ -77,7 +76,6 @@ export function generateMockAttendanceData(year: number, month: number): {
       })
     } else {
       // 工作日全部正常打卡
-      workDayCount++
       records.push({
         date: formatDate(date),
         weekday,
@@ -91,7 +89,7 @@ export function generateMockAttendanceData(year: number, month: number): {
   // 固定统计数据:符合业务需求
   const stats: AttendanceStats = {
     attendanceRate: 100,
-    normalDays: workDayCount,
+    normalDays: 22,
     lateCount: 0,
     earlyLeaveCount: 0,
     absentCount: 0

+ 3 - 1
mini-ui-packages/mini-charts/package.json

@@ -2,12 +2,14 @@
   "name": "@d8d/mini-charts",
   "version": "1.0.0",
   "description": "小程序图表库包 - 提供 u-charts 图表库核心功能",
+  "type": "module",
   "main": "dist/src/index.js",
   "types": "dist/src/index.d.ts",
   "exports": {
     ".": {
       "types": "./dist/src/index.d.ts",
-      "default": "./dist/src/index.js"
+      "import": "./dist/src/index.js",
+      "require": "./dist/src/index.js"
     },
     "./components/BaseChart": {
       "types": "./dist/src/components/BaseChart.d.ts",

+ 19 - 1
mini-ui-packages/mini-charts/src/components/index.ts

@@ -1 +1,19 @@
-// 暂时不导出任何组件
+// React Chart Components Export
+
+export { BaseChart } from './BaseChart';
+export type { BaseChartProps } from './BaseChart';
+
+export { BarChart } from './BarChart';
+export type { BarChartProps } from './BarChart';
+
+export { ColumnChart } from './ColumnChart';
+export type { ColumnChartProps } from './ColumnChart';
+
+export { LineChart } from './LineChart';
+export type { LineChartProps } from './LineChart';
+
+export { PieChart } from './PieChart';
+export type { PieChartProps } from './PieChart';
+
+export { RingChart } from './RingChart';
+export type { RingChartProps } from './RingChart';

+ 29 - 267
mini-ui-packages/mini-charts/src/index.ts

@@ -1,271 +1,33 @@
-// // Export modularized config and utility functions with type definitions
-// export {
-//   config,
-//   assign,
-//   util
-// } from './lib/config';
-
-// export {
-//   hexToRgb
-// } from './lib/utils/color';
-
-// export {
-//   findRange,
-//   calCandleMA
-// } from './lib/utils/math';
-
-// export {
-//   convertCoordinateOrigin,
-//   isInAngleRange,
-//   calValidDistance
-// } from './lib/utils/coordinate';
-
-// export {
-//   measureText
-// } from './lib/utils/text';
-
-// export {
-//   avoidCollision,
-//   isCollision
-// } from './lib/utils/collision';
-
-// export {
-//   getH5Offset,
-//   createCurveControlPoints,
-//   getTouches
-// } from './lib/utils/misc';
-
-// // Export core chart classes
-// export {
-//   uCharts,
-//   uChartsEvent
-// } from './lib/charts/index';
-
-// // Default export for backward compatibility
-// export { default } from './lib/charts/index';
-
-// // Re-export config and util from u-charts for backward compatibility
-// export { config as uChartsConfig, util as uChartsUtil } from './lib/config';
-
-// // Export chart types
-// export type {
-//   CanvasContext,
-//   ChartsTitle,
-//   ChartsConfig,
-//   YAxisConfig,
-//   XAxisConfig,
-//   LegendConfig,
-//   ExtraConfig,
-//   ScrollOption,
-//   TouchEvent,
-//   TouchPoint,
-//   ToolTipOption as ChartsToolTipOption,
-//   EventListener,
-//   EventMap
-// } from './lib/charts/index';
-
-// // Export data processing functions
-// export {
-//   fixPieSeries,
-//   fillSeries,
-//   fillCustomColor,
-//   getDataRange,
-//   dataCombine,
-//   dataCombineStack,
-//   calXAxisData,
-//   getXAxisPoints,
-//   calYAxisData,
-//   calCategoriesData,
-//   getToolTipData,
-//   getMixToolTipData
-// } from './lib/data-processing/index';
-
-// export type {
-//   SeriesItem,
-//   ChartOptions,
-//   ChartExtraOptions,
-//   BarOptions,
-//   ColumnOptions,
-//   TooltipOptions,
-//   MountOptions,
-//   XAxisOptions,
-//   YAxisOptions,
-//   YAxisDataItem,
-//   ChartData,
-//   UChartsConfig,
-//   DataRange,
-//   XAxisDataResult,
-//   YAxisDataResult,
-//   AxisPointsResult,
-//   CategoriesDataResult,
-//   ToolTipOption,
-//   ToolTipDataResult
-// } from './lib/data-processing/index';
-
-// // Export charts data points calculation functions
-// export {
-//   getDataPoints,
-//   getLineDataPoints,
-//   getColumnDataPoints,
-//   getCandleDataPoints,
-//   getMountDataPoints,
-//   getBarDataPoints,
-//   getStackDataPoints,
-//   getBarStackDataPoints,
-//   getPieDataPoints,
-//   getRoseDataPoints,
-//   getRadarDataPoints,
-//   getGaugeDataPoints,
-//   getGaugeArcbarDataPoints,
-//   getArcbarDataPoints,
-//   getGaugeAxisPoints,
-//   getFunnelDataPoints
-// } from './lib/charts-data/index';
-
-// // Export renderer functions
-// export {
-//   drawPointShape,
-//   drawActivePoint,
-//   drawRingTitle,
-//   drawPointText,
-//   drawToolTipSplitLine,
-//   drawMarkLine,
-//   drawToolTipHorizentalLine,
-//   drawToolTipSplitArea,
-//   drawBarToolTipSplitArea,
-//   drawToolTip,
-//   drawToolTipBridge,
-//   drawCanvas
-// } from './lib/renderers/index';
-
-// export type {
-//   Point as RendererPoint,
-//   ToolTipTextItem,
-//   ToolTipOption as RendererToolTipOption,
-//   MarkLineDataItem,
-//   ActivePointOption,
-//   TitleOption
-// } from './lib/renderers/index';
-
-// // Export helper functions
-// export {
-//   // Index finders
-//   findCurrentIndex,
-//   findBarChartCurrentIndex,
-//   findLegendIndex,
-//   findRadarChartCurrentIndex,
-//   findFunnelChartCurrentIndex,
-//   findWordChartCurrentIndex,
-//   findMapChartCurrentIndex,
-//   findRoseChartCurrentIndex,
-//   findPieChartCurrentIndex,
-//   // Area checkers
-//   isInExactLegendArea,
-//   isInExactChartArea,
-//   isInExactPieChartArea,
-//   // Data helpers
-//   getSeriesDataItem,
-//   filterSeries,
-//   splitPoints,
-//   getMaxTextListLength,
-//   getRadarCoordinateSeries,
-//   // Legend helpers
-//   calLegendData,
-//   getPieTextMaxLength,
-//   // Coordinate helpers
-//   lonlat2mercator,
-//   mercator2lonlat,
-//   getBoundingBox,
-//   coordinateToPoint,
-//   pointToCoordinate,
-//   isRayIntersectsSegment,
-//   isPoiWithinPoly,
-//   // Data fixers
-//   fixColumeData,
-//   fixBarData,
-//   fixColumeMeterData,
-//   fixColumeStackData,
-//   fixBarStackData,
-//   // Misc helpers
-//   getXAxisTextList,
-//   getYAxisTextList,
-//   calTooltipYAxisData,
-//   calMarkLineData,
-//   contextRotate,
-//   normalInt,
-//   collisionNew,
-//   getWordCloudPoint
-// } from './lib/helper-functions/index';
-
-// export type {
-//   LegendData,
-//   PieData,
-//   RadarData
-// } from './lib/helper-functions/index';
-
-// // Export draw controllers (core drawing control functions)
-// export {
-//   drawCharts
-// } from './lib/draw-controllers/index';
-
-// export {
-//   Animation,
-//   AnimationFunction
-// } from './lib/draw-controllers/index';
-
-// export type {
-//   DrawChartsContext,
-//   DrawChartsFunction,
-//   AnimationOptions,
-//   TimingFunction,
-//   TimingFunctions
-// } from './lib/draw-controllers/index';
-
 // ============================================================================
 // React Chart Components (Story 016.009)
 // ============================================================================
 
-// export {
-//   // BaseChart component
-//   BaseChart,
-//   BaseChartDefault,
-//   // BarChart component (横向柱状图)
-//   BarChart,
-//   BarChartDefault,
-//   // ColumnChart component
-//   ColumnChart,
-//   ColumnChartDefault,
-//   // LineChart component
-//   LineChart,
-//   LineChartDefault,
-//   // CandleChart component
-//   CandleChart,
-//   CandleChartDefault,
-//   // PieChart component
-//   PieChart,
-//   PieChartDefault,
-//   // RadarChart component
-//   RadarChart,
-//   RadarChartDefault
-// } from './components/index';
-
-// export type {
-//   // BaseChart types
-//   BaseChartProps,
-//   // BarChart types
-//   BarChartProps,
-//   BarType,
-//   // ColumnChart types
-//   ColumnChartProps,
-//   ColumnType,
-//   // LineChart types
-//   LineChartProps,
-//   DataPointShape,
-//   // CandleChart types
-//   CandleChartProps,
-//   // PieChart types
-//   PieChartProps,
-//   PieChartType,
-//   // RadarChart types
-//   RadarChartProps
-// } from './components/index';
+export {
+  // BaseChart component
+  BaseChart,
+  // BarChart component (横向柱状图)
+  BarChart,
+  // ColumnChart component
+  ColumnChart,
+  // LineChart component
+  LineChart,
+  // PieChart component
+  PieChart,
+  // RingChart component
+  RingChart
+} from './components/index';
+
+export type {
+  // BaseChart types
+  BaseChartProps,
+  // BarChart types
+  BarChartProps,
+  // ColumnChart types
+  ColumnChartProps,
+  // LineChart types
+  LineChartProps,
+  // PieChart types
+  PieChartProps,
+  // RingChart types
+  RingChartProps
+} from './components/index';

+ 2 - 2
mini-ui-packages/mini-charts/tsconfig.json

@@ -1,9 +1,9 @@
 {
   "compilerOptions": {
     "target": "ES5",
-    "module": "CommonJS",
+    "module": "ESNext",
     "lib": ["ES2020", "DOM"],
-    "moduleResolution": "node",
+    "moduleResolution": "bundler",
     "strict": true,
     "esModuleInterop": true,
     "skipLibCheck": true,

+ 1 - 4
mini/src/pages/yongren/statistics/index.tsx

@@ -3,10 +3,7 @@ import { View, Text, ScrollView } from '@tarojs/components'
 import { useQuery, useQueryClient } from '@tanstack/react-query'
 import { YongrenTabBarLayout } from '@/components/YongrenTabBarLayout'
 import { Navbar } from '@d8d/mini-shared-ui-components/components/navbar'
-import { ColumnChart } from '@d8d/mini-charts/components/ColumnChart'
-import { BarChart } from '@d8d/mini-charts/components/BarChart'
-import { PieChart } from '@d8d/mini-charts/components/PieChart'
-import { RingChart } from '@d8d/mini-charts/components/RingChart'
+import { ColumnChart, BarChart, PieChart, RingChart } from '@d8d/mini-charts'
 import { enterpriseStatisticsClient } from '@/api/enterpriseStatisticsClient'
 import type {
   EmploymentCountResponse,