vue2-client 1.17.42 → 1.17.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +20 -20
- package/.cursorrules +19 -19
- package/.env.apply +19 -19
- package/.env.gaslink +19 -19
- package/.env.his +19 -19
- package/.env.liuli +20 -20
- package/.env.scada +19 -19
- package/.eslintrc.js +90 -90
- package/.serena/memories/code_style_conventions.md +217 -217
- package/.serena/memories/project_overview.md +54 -54
- package/.serena/memories/project_structure.md +329 -329
- package/.serena/memories/suggested_commands.md +127 -127
- package/.serena/memories/task_completion_checklist.md +183 -183
- package/.serena/memories/tech_stack.md +94 -94
- package/CHANGELOG.md +830 -830
- package/CLAUDE.md +97 -97
- package/Components.md +60 -60
- package/docs/LowCode/lowcode.md +155 -155
- package/docs/LowCode/lowcodeForDeveloper.md +230 -230
- package/docs/index.md +30 -30
- package/index.js +31 -31
- package/jest-transform-stub.js +8 -8
- package/jest.setup.js +7 -7
- package/jsconfig.json +19 -19
- package/package.json +1 -1
- package/public/his/editor/editor.html +51 -51
- package/public/his/editor/mock/bind_data.html +779 -779
- package/public/his/editor/mock/data_table.html +40 -40
- package/public/his/editor/mock/sign.html +75 -75
- package/public/his/editor/vender/JsBarcode.all.js +3669 -3669
- package/public/his/editor/vender/date97/My97DatePicker.htm +65 -65
- package/public/his/editor/vender/date97/WdatePicker.js +677 -677
- package/public/his/editor/vender/date97/calendar.js +4 -4
- package/public/his/editor/vender/date97/lang/en.js +13 -13
- package/public/his/editor/vender/date97/lang/zh-cn.js +13 -13
- package/public/his/editor/vender/date97/lang/zh-tw.js +13 -13
- package/public/his/editor/vender/date97/skin/WdatePicker.css +10 -10
- package/public/his/editor/vender/date97/skin/default/datepicker.css +328 -328
- package/public/his/editor/vender/date97/skin/ext/datepicker.css +308 -308
- package/public/his/editor/vender/date97/skin/whyGreen/datepicker.css +255 -255
- package/public/his/editor/vender/diff.js +1627 -1627
- package/public/his/editor/vender/editor.js +1 -1
- package/public/his/editor/vender/fabric.js +31187 -31187
- package/public/his/editor/vender/jquery/jquery.base64.js +190 -190
- package/public/his/editor/vender/jquery/jquery.js +10872 -10872
- package/public/his/editor/vender/jquery/jquery.print.js +255 -255
- package/public/his/editor/vender/jquery/zTreeStyle/zTreeStyle.css +96 -96
- package/public/his/editor/vender/mui/mui.min.css +4 -4
- package/public/his/editor/vender/mui/mui.min.js +5 -5
- package/public/his/editor/vender/mui/mui.picker.min.css +6 -6
- package/public/his/editor/vender/mui/mui.picker.min.js +6 -6
- package/public/his/editor/vender/qrcode.js +7 -7
- package/public/his/editor/vender/requirejs/require.js +2145 -2145
- package/public/his/editor/vender/signature/jSignature.CompressorSVG.js +518 -518
- package/public/his/editor/vender/signature/jSignature.UndoButton.js +164 -164
- package/public/his/editor/vender/signature/jSignature.js +1486 -1486
- package/public/his/editor/vender/validator.js +5094 -5094
- package/public/his/editor/vender/weui/weui.css +5659 -5659
- package/public/his/editor/vender/weui/weui.min.css +4 -4
- package/public/his/editor/vender/weui/weui.min.js +11 -11
- package/src/assets/img/paymentMethod/package.info +1 -1
- package/src/assets/img/querySlotDemo.svg +15 -15
- package/src/assets/svg/badtwo.svg +1 -1
- package/src/assets/svg/goodtwo.svg +1 -1
- package/src/base-client/components/AI/AskAiBtn.vue +136 -136
- package/src/base-client/components/AI/demo.vue +31 -31
- package/src/base-client/components/common/AddressSearchCombobox/IcMapIcon.vue +16 -16
- package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
- package/src/base-client/components/common/AddressSearchCombobox/ic_map.svg +6 -6
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
- package/src/base-client/components/common/CitySelect/index.js +3 -3
- package/src/base-client/components/common/CitySelect/index.md +109 -109
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
- package/src/base-client/components/common/CreateQuery/index.js +3 -3
- package/src/base-client/components/common/CreateQuery/index.md +42 -42
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
- package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
- package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
- package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
- package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
- package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
- package/src/base-client/components/common/HIS/demo.vue +61 -61
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
- package/src/base-client/components/common/LowCodeComponent/LowCodeEditorModal.vue +108 -108
- package/src/base-client/components/common/LowCodeComponent/LowCodeEditorPanel.vue +413 -413
- package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +502 -502
- package/src/base-client/components/common/LowCodeComponent/LowCodeRender.vue +728 -728
- package/src/base-client/components/common/LowCodeComponent/LowCodeRenderEnter.vue +29 -29
- package/src/base-client/components/common/LowCodeComponent/LowCodeUIStore.vue +219 -219
- package/src/base-client/components/common/LowCodeComponent/modal/lowCodeAddPageModal.vue +117 -117
- package/src/base-client/components/common/LowCodeComponent/modal/lowCodeCustomJSModal.vue +80 -80
- package/src/base-client/components/common/LowCodeComponent/modal/lowCodeEventEditorModal.vue +398 -398
- package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLifeCycleModal.vue +65 -65
- package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicCallbackModal.vue +64 -64
- package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicParamModal.vue +73 -73
- package/src/base-client/components/common/LowCodeComponent/modal/lowCodeRunFunctionParamModal.vue +76 -76
- package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
- package/src/base-client/components/common/PersonSetting/index.js +3 -3
- package/src/base-client/components/common/Recording/Recording.vue +243 -243
- package/src/base-client/components/common/Recording/index.js +3 -3
- package/src/base-client/components/common/Tree/Tree.vue +149 -149
- package/src/base-client/components/common/Tree/index.js +2 -2
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/base-client/components/common/XAddForm/XAddForm.vue +113 -113
- package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
- package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +304 -304
- package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
- package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
- package/src/base-client/components/common/XAddReport/index.js +3 -3
- package/src/base-client/components/common/XAddReport/index.md +56 -56
- package/src/base-client/components/common/XBadge/XBadge.vue +94 -94
- package/src/base-client/components/common/XButtons/XButtonDemo.vue +28 -28
- package/src/base-client/components/common/XButtons/index.js +3 -3
- package/src/base-client/components/common/XButtons/index.md +61 -61
- package/src/base-client/components/common/XCalendar/XCalendar.vue +4 -4
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XCheckList/XCheckList.vue +106 -106
- package/src/base-client/components/common/XCheckList/XCheckListDemo.vue +41 -41
- package/src/base-client/components/common/XDataCard/index.js +3 -3
- package/src/base-client/components/common/XDataCard/index.md +1 -1
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
- package/src/base-client/components/common/XDataDrawer/index.js +3 -3
- package/src/base-client/components/common/XDataDrawer/index.md +41 -41
- package/src/base-client/components/common/XDatePicker/demo.vue +153 -153
- package/src/base-client/components/common/XDescriptions/index.js +3 -3
- package/src/base-client/components/common/XDescriptions/index.md +83 -83
- package/src/base-client/components/common/XDetailsView/XDetailsView.vue +238 -238
- package/src/base-client/components/common/XDetailsView/index.js +3 -3
- package/src/base-client/components/common/XForm/XStatusButton.vue +54 -54
- package/src/base-client/components/common/XForm/index.md +178 -178
- package/src/base-client/components/common/XForm/itemComponent/XClickChangeBtn/index.vue +49 -49
- package/src/base-client/components/common/XFormGroup/index.js +3 -3
- package/src/base-client/components/common/XFormGroup/index.md +38 -38
- package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
- package/src/base-client/components/common/XFormTable/XFormTable.vue +1093 -1093
- package/src/base-client/components/common/XFormTable/demo.vue +113 -113
- package/src/base-client/components/common/XFormTable/index.md +92 -92
- package/src/base-client/components/common/XLabelSelect/XLabelSelect.vue +110 -110
- package/src/base-client/components/common/XLabelSelect/XLabelSelectDemo.vue +35 -35
- package/src/base-client/components/common/XLicensePlate/XLicensePlate.vue +193 -193
- package/src/base-client/components/common/XLicensePlate/XLicensePlateDemo.vue +48 -48
- package/src/base-client/components/common/XPrint/OpenInvoice.vue +21 -21
- package/src/base-client/components/common/XPrint/PrintHtml.js +98 -98
- package/src/base-client/components/common/XPrint/css/hiPrintCss.js +359 -359
- package/src/base-client/components/common/XPrint/css/lodopCss.js +26 -26
- package/src/base-client/components/common/XPrint/css/print-lock.css +351 -351
- package/src/base-client/components/common/XPrint/index.vue +97 -97
- package/src/base-client/components/common/XReport/XReportDesign.vue +463 -463
- package/src/base-client/components/common/XReport/XReportJsonRender.vue +381 -381
- package/src/base-client/components/common/XReport/index.js +3 -3
- package/src/base-client/components/common/XReport/print.js +186 -186
- package/src/base-client/components/common/XReportDrawer/index.js +3 -3
- package/src/base-client/components/common/XReportGrid/index.js +3 -3
- package/src/base-client/components/common/XReportGrid/index.md +44 -44
- package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
- package/src/base-client/components/common/XReportSlot/index.js +3 -3
- package/src/base-client/components/common/XReportSlot/index.md +48 -48
- package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
- package/src/base-client/components/common/XSimpleDescriptions/index.js +3 -3
- package/src/base-client/components/common/XSimpleDescriptions/index.md +7 -7
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
- package/src/base-client/components/common/XStepView/index.js +3 -3
- package/src/base-client/components/common/XStepView/index.md +31 -31
- package/src/base-client/components/common/XTab/XTabDemo.vue +22 -22
- package/src/base-client/components/common/XTab/index.js +3 -3
- package/src/base-client/components/common/XTable/CustomFuncCel.vue +51 -51
- package/src/base-client/components/common/XTable/TableCellRenderer.vue +161 -161
- package/src/base-client/components/common/XTable/XTableWrapper.vue +732 -706
- package/src/base-client/components/common/XTable/index.md +255 -255
- package/src/base-client/components/common/XTagGroup/index.vue +52 -52
- package/src/base-client/components/common/XTree/XTree.vue +424 -424
- package/src/base-client/components/common/XTree/index.js +3 -3
- package/src/base-client/components/common/XTree/index.md +36 -36
- package/src/base-client/components/common/XTreeOne/XTreeOne.vue +113 -113
- package/src/base-client/components/common/XTreeOne/XTreeOnePro.vue +128 -128
- package/src/base-client/components/common/richTextModal/index.vue +56 -56
- package/src/base-client/components/common/richTextModal/richDemo.vue +48 -48
- package/src/base-client/components/his/HChart/HChart.vue +493 -493
- package/src/base-client/components/his/HChart/demo.vue +88 -88
- package/src/base-client/components/his/HChart/index.md +798 -798
- package/src/base-client/components/his/XCharge/XChargeDemo.vue +145 -145
- package/src/base-client/components/his/XHisEditor/index.js +3 -3
- package/src/base-client/components/his/XIcon/XIcon.vue +73 -73
- package/src/base-client/components/his/XIcon/index.js +3 -3
- package/src/base-client/components/his/XIcon/index.md +177 -177
- package/src/base-client/components/index.js +51 -51
- package/src/base-client/components/layout/XTreeView/XTreeView.vue +130 -130
- package/src/base-client/components/layout/XTreeView/index.js +3 -3
- package/src/base-client/components/layout/XTreeView/index.md +46 -46
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
- package/src/base-client/plugins/Config.js +19 -19
- package/src/base-client/plugins/GetLoginInfoService.js +183 -183
- package/src/base-client/plugins/Recording.js +258 -258
- package/src/base-client/plugins/index.js +23 -23
- package/src/base-client/plugins/tabs-page-plugin.js +39 -39
- package/src/components/Charts/Bar.vue +62 -62
- package/src/components/Charts/ChartCard.vue +134 -134
- package/src/components/Charts/Liquid.vue +67 -67
- package/src/components/Charts/MiniArea.vue +39 -39
- package/src/components/Charts/MiniBar.vue +39 -39
- package/src/components/Charts/MiniProgress.vue +75 -75
- package/src/components/Charts/MiniSmoothArea.vue +40 -40
- package/src/components/Charts/Radar.vue +68 -68
- package/src/components/Charts/RankList.vue +77 -77
- package/src/components/Charts/TagCloud.vue +113 -113
- package/src/components/Charts/TransferBar.vue +64 -64
- package/src/components/Charts/Trend.vue +82 -82
- package/src/components/Charts/chart.less +12 -12
- package/src/components/Charts/smooth.area.less +13 -13
- package/src/components/CodeMirror/inedx.vue +118 -118
- package/src/components/CodeMirror/setting.js +40 -40
- package/src/components/NumberInfo/NumberInfo.vue +54 -54
- package/src/components/NumberInfo/index.js +3 -3
- package/src/components/NumberInfo/index.less +54 -54
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/card/ChartCard.vue +79 -79
- package/src/components/chart/Bar.vue +60 -60
- package/src/components/chart/MiniArea.vue +67 -67
- package/src/components/chart/MiniBar.vue +59 -59
- package/src/components/chart/MiniProgress.vue +57 -57
- package/src/components/chart/Radar.vue +80 -80
- package/src/components/chart/RankingList.vue +60 -60
- package/src/components/chart/Trend.vue +79 -79
- package/src/components/chart/index.less +9 -9
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/checkbox/ImgCheckbox.vue +117 -117
- package/src/components/checkbox/ImgCheckboxGroup.vue +76 -76
- package/src/components/checkbox/index.js +9 -9
- package/src/components/exception/ExceptionPage.vue +70 -70
- package/src/components/g2Charts/constants.js +202 -202
- package/src/components/g2Charts/demo.vue +808 -808
- package/src/components/g2Charts/designer.vue +228 -228
- package/src/components/g2Charts/designerBaseConfig.vue +61 -61
- package/src/components/g2Charts/designerDataConfig.vue +259 -259
- package/src/components/g2Charts/designerStyleConfig.vue +16 -16
- package/src/components/g2Charts/index.vue +397 -397
- package/src/components/index.js +36 -36
- package/src/components/input/IInput.vue +66 -66
- package/src/components/menu/SideMenu.vue +75 -75
- package/src/components/menu/menu.js +273 -273
- package/src/components/setting/Setting.vue +234 -234
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/config/CreateQueryConfig.js +325 -325
- package/src/config/default/antd.config.js +89 -89
- package/src/config/default/setting.config.js +55 -55
- package/src/font-style/font.css +60 -60
- package/src/layouts/CommonLayout.vue +56 -56
- package/src/layouts/PageLayout.vue +151 -151
- package/src/layouts/SinglePageView.vue +136 -136
- package/src/layouts/header/AdminHeader.vue +132 -132
- package/src/layouts/header/HeaderNotice.vue +177 -177
- package/src/layouts/header/InstitutionDetail.vue +181 -181
- package/src/layouts/tabs/TabsHead.vue +189 -189
- package/src/lib.js +1 -1
- package/src/mock/extend/index.js +84 -84
- package/src/mock/goods/index.js +108 -108
- package/src/pages/DefaultExample/index.vue +77 -77
- package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
- package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
- package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
- package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
- package/src/pages/DynamicStatistics/FavoriteList.vue +50 -50
- package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
- package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
- package/src/pages/DynamicStatistics/index.vue +282 -282
- package/src/pages/Example/childIndex.vue +15 -15
- package/src/pages/Example/index.vue +30 -30
- package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
- package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
- package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
- package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
- package/src/pages/NewDynamicStatistics/FavoriteList.vue +50 -50
- package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
- package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
- package/src/pages/NewDynamicStatistics/index.vue +258 -258
- package/src/pages/Recording/index.vue +77 -77
- package/src/pages/ServiceReview/index.vue +284 -284
- package/src/pages/SubExample/index.vue +26 -26
- package/src/pages/WorkflowDetail/WorkflowPageDetail/TrimTextTail.vue +23 -23
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +1815 -1815
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowTimeline.vue +1014 -1014
- package/src/pages/XReportView/index.vue +64 -64
- package/src/pages/XTreeOneProExample/index.vue +67 -67
- package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
- package/src/pages/login/Login.vue +379 -379
- package/src/pages/login/LoginV3.vue +389 -389
- package/src/pages/lowCode/lowCodeEditor.vue +1219 -1219
- package/src/pages/lowCode/lowCodeRenderPage.vue +43 -43
- package/src/pages/report/ReportTable.js +124 -124
- package/src/pages/resourceManage/orgListManage.vue +98 -98
- package/src/pages/system/dictionary/index.vue +44 -44
- package/src/pages/system/monitor/loginInfor/index.vue +37 -37
- package/src/pages/system/monitor/operLog/index.vue +37 -37
- package/src/pages/system/settings/modifyPassword.vue +117 -117
- package/src/pages/system/ticket/index.vue +480 -480
- package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
- package/src/pages/userInfoDetailManage/ChangeMeterRecordQuery/index.vue +64 -64
- package/src/pages/userInfoDetailManage/InfoChangeRecordQuery/index.vue +64 -64
- package/src/pages/userInfoDetailManage/InstructRecordQuery/index.vue +64 -64
- package/src/pages/userInfoDetailManage/MeterParamRecordQuery/index.vue +64 -64
- package/src/pages/userInfoDetailManage/TransferRecordQuery/index.vue +66 -66
- package/src/pages/userInfoDetailManage/WatchCollectionRecordQuery/index.vue +64 -64
- package/src/plugins/EventLogPlugin.js +33 -33
- package/src/plugins/FindParentsData.js +17 -17
- package/src/services/DataModel.js +30 -30
- package/src/services/LodopFuncs.js +137 -137
- package/src/services/api/TicketDetailsViewApi.js +46 -46
- package/src/services/api/cas.js +79 -79
- package/src/services/api/entity.js +18 -18
- package/src/services/api/index.js +17 -17
- package/src/store/modules/account.js +121 -121
- package/src/store/modules/index.js +5 -5
- package/src/store/modules/lowCode.js +33 -33
- package/src/store/modules/setting.js +119 -119
- package/src/theme/default/style.less +58 -58
- package/src/theme/global.less +313 -311
- package/src/utils/authority-utils.js +85 -85
- package/src/utils/errorCode.js +6 -6
- package/src/utils/formatter.js +74 -74
- package/src/utils/htmlToPDF.js +108 -108
- package/src/utils/htmlToPDFApi.js +5 -5
- package/src/utils/login.js +188 -188
- package/src/utils/lowcode/lowcodeComponentMixin.js +120 -120
- package/src/utils/lowcode/lowcodeLog.js +29 -29
- package/src/utils/lowcode/lowcodeUtils.js +373 -373
- package/src/utils/lowcode/registerComponentForEditor.js +1 -1
- package/src/utils/lowcode/registerComponentForRender.js +11 -11
- package/src/utils/map-utils.js +47 -47
- package/src/utils/reg.js +95 -95
- package/src/utils/runEvalFunction.js +14 -14
- package/src/utils/theme-color-replacer-extend.js +92 -92
- package/src/utils/util.js +329 -329
- package/src/utils/waterMark.js +31 -31
- package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
- package/src/assets/img/paymentMethod/icon1.png +0 -0
- package/src/assets/img/paymentMethod/icon2.png +0 -0
- package/src/assets/img/paymentMethod/icon3.png +0 -0
- package/src/assets/img/paymentMethod/icon4.png +0 -0
- package/src/assets/img/paymentMethod/icon5.png +0 -0
- package/src/assets/img/paymentMethod/icon6.png +0 -0
- package/src/base-client/components/common/XReport/XReportHospitalizationDemo.vue +0 -45
- package/src-base-client/components/his/XCharge/README.md +0 -0
- package/src-base-client/components/his/XCharge/XCharge.vue +0 -0
|
@@ -1,798 +1,798 @@
|
|
|
1
|
-
# HChart 组件使用文档
|
|
2
|
-
|
|
3
|
-
## 目录
|
|
4
|
-
|
|
5
|
-
- [组件介绍](#组件介绍)
|
|
6
|
-
- [基本用法](#基本用法)
|
|
7
|
-
- [Props API](#props-api)
|
|
8
|
-
- [Events API](#events-api)
|
|
9
|
-
- [Methods API](#methods-api)
|
|
10
|
-
- [配置结构](#配置结构)
|
|
11
|
-
- [数据格式](#数据格式)
|
|
12
|
-
- [从 ECharts 配置转换](#从-echarts-配置转换)
|
|
13
|
-
- [完整示例](#完整示例)
|
|
14
|
-
- [样式属性](#样式属性)
|
|
15
|
-
- [注意事项](#注意事项)
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## 组件介绍
|
|
20
|
-
|
|
21
|
-
`HChart` 是一个基于 ECharts 的可配置图表组件,支持柱状图、折线图、饼图三种常用图表类型。组件提供了预设的样式配置,支持静态数据、动态数据(Logic)和配置化使用方式。
|
|
22
|
-
|
|
23
|
-
### 特性
|
|
24
|
-
|
|
25
|
-
- ✅ 支持三种图表类型:柱状图(bar)、折线图(line)、饼图(pie)
|
|
26
|
-
- ✅ 支持静态数据(dataset)和动态数据(logicName)
|
|
27
|
-
- ✅ 自动数据格式转换和字段映射
|
|
28
|
-
- ✅ 预设样式,支持自定义覆盖
|
|
29
|
-
- ✅ 响应式布局,自动适配窗口大小
|
|
30
|
-
- ✅ 支持从后端配置中心获取配置
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## 基本用法
|
|
35
|
-
|
|
36
|
-
### 方式1:直接传入配置(推荐)
|
|
37
|
-
|
|
38
|
-
<template>
|
|
39
|
-
<HChart :config="chartConfig" />
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<script setup>
|
|
43
|
-
import { ref } from 'vue'
|
|
44
|
-
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
45
|
-
|
|
46
|
-
const chartConfig = ref({
|
|
47
|
-
type: 'pie',
|
|
48
|
-
xtitle: '访问来源',
|
|
49
|
-
dataset: [
|
|
50
|
-
{ label: '直接访问', value: 335 },
|
|
51
|
-
{ label: '邮件营销', value: 310 },
|
|
52
|
-
{ label: '联盟广告', value: 234 }
|
|
53
|
-
]
|
|
54
|
-
})
|
|
55
|
-
</script>### 方式2:通过配置名称查询
|
|
56
|
-
|
|
57
|
-
<template>
|
|
58
|
-
<HChart
|
|
59
|
-
query-params-name="chart-patient-stats"
|
|
60
|
-
:fixed-query-form="{ condition: '1=1', dateRange: '2024-01' }"
|
|
61
|
-
service-name="af-his"
|
|
62
|
-
/>
|
|
63
|
-
</template>
|
|
64
|
-
|
|
65
|
-
<script setup>
|
|
66
|
-
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
67
|
-
</script>### 方式3:使用 Logic 获取数据
|
|
68
|
-
|
|
69
|
-
<template>
|
|
70
|
-
<HChart
|
|
71
|
-
:config="chartConfig"
|
|
72
|
-
:fixed-query-form="queryForm"
|
|
73
|
-
/>
|
|
74
|
-
</template>
|
|
75
|
-
|
|
76
|
-
<script setup>
|
|
77
|
-
import { ref, reactive } from 'vue'
|
|
78
|
-
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
79
|
-
|
|
80
|
-
const queryForm = reactive({
|
|
81
|
-
condition: '1=1',
|
|
82
|
-
startDate: '2024-01-01',
|
|
83
|
-
endDate: '2024-01-31'
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
const chartConfig = ref({
|
|
87
|
-
type: 'bar',
|
|
88
|
-
xtitle: '患者统计',
|
|
89
|
-
data: 'getPatientStatistics', // logicName
|
|
90
|
-
dataMapping: {
|
|
91
|
-
labelField: 'month',
|
|
92
|
-
valueField: 'count'
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
</script>---
|
|
96
|
-
|
|
97
|
-
## Props API
|
|
98
|
-
|
|
99
|
-
| 参数 | 说明 | 类型 | 默认值 | 必填 |
|
|
100
|
-
|------|------|------|--------|------|
|
|
101
|
-
| `queryParamsName` | 配置名称(用于从后端查询配置) | `String` | `''` | 否 |
|
|
102
|
-
| `serviceName` | 服务名 | `String` | `'af-his'` | 否 |
|
|
103
|
-
| `fixedQueryForm` | 固定查询参数(传递给 logic) | `Object` | `{ condition: '1=1' }` | 否 |
|
|
104
|
-
| `config` | 图表配置对象 | `Object` | `null` | 否 |
|
|
105
|
-
|
|
106
|
-
**注意**:`queryParamsName` 和 `config` 必须提供一个。
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## Events API
|
|
111
|
-
|
|
112
|
-
| 事件名 | 说明 | 回调参数 |
|
|
113
|
-
|--------|------|----------|
|
|
114
|
-
| `init` | 图表初始化完成 | `(config: Object)` - 配置对象 |
|
|
115
|
-
| `dataLoaded` | 数据加载完成 | `(data: Array)` - 转换后的数据数组 |
|
|
116
|
-
| `error` | 发生错误 | `(error: Error)` - 错误对象 |
|
|
117
|
-
|
|
118
|
-
### 使用示例
|
|
119
|
-
|
|
120
|
-
<template>
|
|
121
|
-
<HChart
|
|
122
|
-
:config="chartConfig"
|
|
123
|
-
@init="handleInit"
|
|
124
|
-
@dataLoaded="handleDataLoaded"
|
|
125
|
-
@error="handleError"
|
|
126
|
-
/>
|
|
127
|
-
</template>
|
|
128
|
-
|
|
129
|
-
<script setup>
|
|
130
|
-
const handleInit = (config) => {
|
|
131
|
-
console.log('图表初始化:', config)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const handleDataLoaded = (data) => {
|
|
135
|
-
console.log('数据加载完成:', data)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const handleError = (error) => {
|
|
139
|
-
console.error('发生错误:', error)
|
|
140
|
-
}
|
|
141
|
-
</script>---
|
|
142
|
-
|
|
143
|
-
## Methods API
|
|
144
|
-
|
|
145
|
-
通过 `ref` 调用组件方法:
|
|
146
|
-
|
|
147
|
-
| 方法名 | 说明 | 参数 |
|
|
148
|
-
|--------|------|------|
|
|
149
|
-
| `refresh()` | 刷新图表(重新获取配置和数据) | - |
|
|
150
|
-
| `reload(newQueryForm)` | 重新加载图表(可更新查询参数) | `newQueryForm?: Object` |
|
|
151
|
-
| `chartInstance` | 获取 ECharts 实例(用于高级操作) | - |
|
|
152
|
-
|
|
153
|
-
### 使用示例
|
|
154
|
-
e
|
|
155
|
-
<template>
|
|
156
|
-
<HChart ref="chartRef" :config="chartConfig" />
|
|
157
|
-
<a-button @click="handleRefresh">刷新</a-button>
|
|
158
|
-
<a-button @click="handleReload">重新加载</a-button>
|
|
159
|
-
</template>
|
|
160
|
-
|
|
161
|
-
<script setup>
|
|
162
|
-
import { ref } from 'vue'
|
|
163
|
-
|
|
164
|
-
const chartRef = ref(null)
|
|
165
|
-
|
|
166
|
-
const handleRefresh = () => {
|
|
167
|
-
chartRef.value?.refresh()
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const handleReload = () => {
|
|
171
|
-
chartRef.value?.reload({ condition: '1=1', dateRange: '2024-02' })
|
|
172
|
-
}
|
|
173
|
-
</script>---
|
|
174
|
-
|
|
175
|
-
## 配置结构
|
|
176
|
-
|
|
177
|
-
### 完整配置对象
|
|
178
|
-
ript
|
|
179
|
-
interface HChartConfig {
|
|
180
|
-
// 图表类型
|
|
181
|
-
type: 'bar' | 'line' | 'pie'
|
|
182
|
-
|
|
183
|
-
// 图表标题(显示在组件顶部)
|
|
184
|
-
xtitle?: string
|
|
185
|
-
|
|
186
|
-
// 静态数据(与 data 二选一)
|
|
187
|
-
dataset?: Array<{ label: string, value: number }>
|
|
188
|
-
|
|
189
|
-
// Logic 名称(与 dataset 二选一)
|
|
190
|
-
data?: string
|
|
191
|
-
|
|
192
|
-
// 数据映射配置(当后端返回的字段名不是 label/value 时使用)
|
|
193
|
-
dataMapping?: {
|
|
194
|
-
labelField?: string // 默认: 'label'
|
|
195
|
-
valueField?: string // 默认: 'value'
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Legend 配置(ECharts legend 配置)
|
|
199
|
-
legend?: Object
|
|
200
|
-
|
|
201
|
-
// Grid 配置(ECharts grid 配置)
|
|
202
|
-
grid?: Object
|
|
203
|
-
|
|
204
|
-
// 自定义 ECharts 配置(会与预设配置合并)
|
|
205
|
-
options?: Object
|
|
206
|
-
}### 配置字段说明
|
|
207
|
-
|
|
208
|
-
#### `type` - 图表类型
|
|
209
|
-
|
|
210
|
-
- `'bar'`:柱状图
|
|
211
|
-
- `'line'`:折线图
|
|
212
|
-
- `'pie'`:饼图
|
|
213
|
-
|
|
214
|
-
#### `xtitle` - 图表标题
|
|
215
|
-
|
|
216
|
-
显示在组件顶部的标题文本。
|
|
217
|
-
|
|
218
|
-
#### `dataset` - 静态数据
|
|
219
|
-
|
|
220
|
-
数组格式,每个元素包含 `label` 和 `value`:
|
|
221
|
-
t
|
|
222
|
-
dataset: [
|
|
223
|
-
{ label: '1月', value: 120 },
|
|
224
|
-
{ label: '2月', value: 200 }
|
|
225
|
-
]#### `data` - Logic 名称
|
|
226
|
-
|
|
227
|
-
后端 Logic 的名称,组件会通过 `runLogic` 获取数据。
|
|
228
|
-
|
|
229
|
-
#### `dataMapping` - 数据映射
|
|
230
|
-
|
|
231
|
-
当后端返回的字段名不是标准格式时,使用此配置映射:
|
|
232
|
-
ipt
|
|
233
|
-
dataMapping: {
|
|
234
|
-
labelField: 'month', // 后端字段名 → label
|
|
235
|
-
valueField: 'count' // 后端字段名 → value
|
|
236
|
-
}#### `legend` - 图例配置
|
|
237
|
-
|
|
238
|
-
ECharts legend 配置对象:
|
|
239
|
-
script
|
|
240
|
-
legend: {
|
|
241
|
-
orient: 'vertical',
|
|
242
|
-
left: 'left'
|
|
243
|
-
}#### `grid` - 网格配置
|
|
244
|
-
|
|
245
|
-
ECharts grid 配置对象:
|
|
246
|
-
cript
|
|
247
|
-
grid: {
|
|
248
|
-
left: 48,
|
|
249
|
-
right: 24,
|
|
250
|
-
bottom: 24,
|
|
251
|
-
top: 36
|
|
252
|
-
}#### `options` - 自定义配置
|
|
253
|
-
|
|
254
|
-
可以覆盖或扩展预设配置,支持所有 ECharts 配置项:
|
|
255
|
-
vascript
|
|
256
|
-
options: {
|
|
257
|
-
title: {
|
|
258
|
-
text: '自定义标题',
|
|
259
|
-
subtext: '副标题'
|
|
260
|
-
},
|
|
261
|
-
tooltip: {
|
|
262
|
-
trigger: 'item',
|
|
263
|
-
formatter: '{a} <br/>{b}: {c} ({d}%)'
|
|
264
|
-
},
|
|
265
|
-
series: [
|
|
266
|
-
{
|
|
267
|
-
radius: '50%',
|
|
268
|
-
emphasis: {
|
|
269
|
-
itemStyle: {
|
|
270
|
-
shadowBlur: 10
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
]
|
|
275
|
-
}**注意**:`options.series` 会与预设配置深度合并,但 `data` 字段会保留预设值(从 logic 获取的数据)。
|
|
276
|
-
|
|
277
|
-
---
|
|
278
|
-
|
|
279
|
-
## 数据格式
|
|
280
|
-
|
|
281
|
-
### Logic 返回值格式
|
|
282
|
-
|
|
283
|
-
`accountsReceivableChartLogic` 或其他 Logic 应该返回一个对象数组。
|
|
284
|
-
|
|
285
|
-
#### 标准格式(推荐)
|
|
286
|
-
avascript
|
|
287
|
-
// 使用 label 和 value(无需配置 dataMapping)
|
|
288
|
-
[
|
|
289
|
-
{ label: '直接访问', value: 335 },
|
|
290
|
-
{ label: '邮件营销', value: 310 },
|
|
291
|
-
{ label: '联盟广告', value: 234 }
|
|
292
|
-
]#### 自动识别格式
|
|
293
|
-
|
|
294
|
-
组件会自动识别以下字段:
|
|
295
|
-
|
|
296
|
-
// 方式1:使用 name/value
|
|
297
|
-
[
|
|
298
|
-
{ name: '直接访问', value: 335 },
|
|
299
|
-
{ name: '邮件营销', value: 310 }
|
|
300
|
-
]
|
|
301
|
-
|
|
302
|
-
// 方式2:使用 text/value
|
|
303
|
-
[
|
|
304
|
-
{ text: 'Q1', value: 320 },
|
|
305
|
-
{ text: 'Q2', value: 280 }
|
|
306
|
-
]
|
|
307
|
-
|
|
308
|
-
// 方式3:使用 x/y
|
|
309
|
-
[
|
|
310
|
-
{ x: 'Mon', y: 120 },
|
|
311
|
-
{ x: 'Tue', y: 200 }
|
|
312
|
-
]
|
|
313
|
-
|
|
314
|
-
// 方式4:使用 count
|
|
315
|
-
[
|
|
316
|
-
{ name: '内科', count: 120 },
|
|
317
|
-
{ name: '外科', count: 96 }
|
|
318
|
-
]#### 自定义字段格式
|
|
319
|
-
|
|
320
|
-
如果后端返回的字段名不是上述标准字段,需要配置 `dataMapping`:
|
|
321
|
-
|
|
322
|
-
// 后端返回
|
|
323
|
-
[
|
|
324
|
-
{ category: '直接访问', amount: 335 },
|
|
325
|
-
{ category: '邮件营销', amount: 310 }
|
|
326
|
-
]
|
|
327
|
-
|
|
328
|
-
// HChart 配置
|
|
329
|
-
{
|
|
330
|
-
type: 'pie',
|
|
331
|
-
data: 'accountsReceivableChartLogic',
|
|
332
|
-
dataMapping: {
|
|
333
|
-
labelField: 'category',
|
|
334
|
-
valueField: 'amount'
|
|
335
|
-
}
|
|
336
|
-
}### 数据转换规则
|
|
337
|
-
|
|
338
|
-
根据 `transformData` 函数的逻辑:
|
|
339
|
-
|
|
340
|
-
**有 `dataMapping` 配置时**:
|
|
341
|
-
- 使用指定的 `labelField` 和 `valueField`
|
|
342
|
-
- 如果字段不存在,label 回退到 `name` 或 `label`,value 回退到 `value` 或 `0`
|
|
343
|
-
|
|
344
|
-
**无 `dataMapping` 配置时**(自动识别):
|
|
345
|
-
- Label 字段优先级:`label` → `name` → `text` → `x` → 对象第一个键
|
|
346
|
-
- Value 字段优先级:`value` → `count` → `y` → 对象第二个键 → `0`
|
|
347
|
-
|
|
348
|
-
---
|
|
349
|
-
|
|
350
|
-
## 从 ECharts 配置转换
|
|
351
|
-
|
|
352
|
-
### 转换对照表
|
|
353
|
-
|
|
354
|
-
| ECharts 配置 | HChart 配置 | 说明 |
|
|
355
|
-
|-------------|------------|------|
|
|
356
|
-
| `series[0].type` | `type` | 提取图表类型 |
|
|
357
|
-
| `title.text` | `xtitle` | 图表标题 |
|
|
358
|
-
| `series[0].data` | `dataset` 或 `data` | 数据源 |
|
|
359
|
-
| `legend` | `legend` | 图例配置 |
|
|
360
|
-
| `grid` | `grid` | 网格配置 |
|
|
361
|
-
| 其他配置 | `options` | 自定义配置 |
|
|
362
|
-
|
|
363
|
-
### 转换示例
|
|
364
|
-
|
|
365
|
-
#### 示例1:饼图转换
|
|
366
|
-
|
|
367
|
-
**原始 ECharts 配置**:ascript
|
|
368
|
-
const echartsOption = {
|
|
369
|
-
title: {
|
|
370
|
-
text: 'Referer of a Website',
|
|
371
|
-
subtext: 'Fake Data',
|
|
372
|
-
left: 'center'
|
|
373
|
-
},
|
|
374
|
-
tooltip: {
|
|
375
|
-
trigger: 'item'
|
|
376
|
-
},
|
|
377
|
-
legend: {
|
|
378
|
-
orient: 'vertical',
|
|
379
|
-
left: 'left'
|
|
380
|
-
},
|
|
381
|
-
series: [
|
|
382
|
-
{
|
|
383
|
-
name: 'Access From',
|
|
384
|
-
type: 'pie',
|
|
385
|
-
radius: '50%',
|
|
386
|
-
data: [
|
|
387
|
-
{ value: 1048, name: 'Search Engine' },
|
|
388
|
-
{ value: 735, name: 'Direct' },
|
|
389
|
-
{ value: 580, name: 'Email' }
|
|
390
|
-
],
|
|
391
|
-
emphasis: {
|
|
392
|
-
itemStyle: {
|
|
393
|
-
shadowBlur: 10,
|
|
394
|
-
shadowOffsetX: 0,
|
|
395
|
-
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
]
|
|
400
|
-
}**转换为 HChart 配置**:ript
|
|
401
|
-
const hChartConfig = {
|
|
402
|
-
type: 'pie',
|
|
403
|
-
xtitle: 'Referer of a Website',
|
|
404
|
-
// 方式1:静态数据
|
|
405
|
-
dataset: [
|
|
406
|
-
{ label: 'Search Engine', value: 1048 },
|
|
407
|
-
{ label: 'Direct', value: 735 },
|
|
408
|
-
{ label: 'Email', value: 580 }
|
|
409
|
-
],
|
|
410
|
-
// 方式2:动态数据
|
|
411
|
-
// data: 'accountsReceivableChartLogic',
|
|
412
|
-
legend: {
|
|
413
|
-
orient: 'vertical',
|
|
414
|
-
left: 'left'
|
|
415
|
-
},
|
|
416
|
-
options: {
|
|
417
|
-
title: {
|
|
418
|
-
text: 'Referer of a Website',
|
|
419
|
-
subtext: 'Fake Data',
|
|
420
|
-
left: 'center'
|
|
421
|
-
},
|
|
422
|
-
tooltip: {
|
|
423
|
-
trigger: 'item'
|
|
424
|
-
},
|
|
425
|
-
series: [
|
|
426
|
-
{
|
|
427
|
-
name: 'Access From',
|
|
428
|
-
radius: '50%',
|
|
429
|
-
emphasis: {
|
|
430
|
-
itemStyle: {
|
|
431
|
-
shadowBlur: 10,
|
|
432
|
-
shadowOffsetX: 0,
|
|
433
|
-
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
]
|
|
438
|
-
}
|
|
439
|
-
}#### 示例2:柱状图转换
|
|
440
|
-
|
|
441
|
-
**原始 ECharts 配置**:ascript
|
|
442
|
-
const echartsOption = {
|
|
443
|
-
xAxis: {
|
|
444
|
-
type: 'category',
|
|
445
|
-
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']
|
|
446
|
-
},
|
|
447
|
-
yAxis: {
|
|
448
|
-
type: 'value'
|
|
449
|
-
},
|
|
450
|
-
series: [
|
|
451
|
-
{
|
|
452
|
-
type: 'bar',
|
|
453
|
-
data: [120, 200, 150, 80, 70]
|
|
454
|
-
}
|
|
455
|
-
]
|
|
456
|
-
}**转换为 HChart 配置**:
|
|
457
|
-
const hChartConfig = {
|
|
458
|
-
type: 'bar',
|
|
459
|
-
dataset: [
|
|
460
|
-
{ label: 'Mon', value: 120 },
|
|
461
|
-
{ label: 'Tue', value: 200 },
|
|
462
|
-
{ label: 'Wed', value: 150 },
|
|
463
|
-
{ label: 'Thu', value: 80 },
|
|
464
|
-
{ label: 'Fri', value: 70 }
|
|
465
|
-
]
|
|
466
|
-
}#### 示例3:折线图转换
|
|
467
|
-
|
|
468
|
-
**原始 ECharts 配置**:ascript
|
|
469
|
-
const echartsOption = {
|
|
470
|
-
xAxis: {
|
|
471
|
-
type: 'category',
|
|
472
|
-
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']
|
|
473
|
-
},
|
|
474
|
-
yAxis: {
|
|
475
|
-
type: 'value'
|
|
476
|
-
},
|
|
477
|
-
series: [
|
|
478
|
-
{
|
|
479
|
-
type: 'line',
|
|
480
|
-
smooth: true,
|
|
481
|
-
data: [120, 200, 150, 80, 70]
|
|
482
|
-
}
|
|
483
|
-
]
|
|
484
|
-
}**转换为 HChart 配置**:
|
|
485
|
-
const hChartConfig = {
|
|
486
|
-
type: 'line',
|
|
487
|
-
dataset: [
|
|
488
|
-
{ label: 'Mon', value: 120 },
|
|
489
|
-
{ label: 'Tue', value: 200 },
|
|
490
|
-
{ label: 'Wed', value: 150 },
|
|
491
|
-
{ label: 'Thu', value: 80 },
|
|
492
|
-
{ label: 'Fri', value: 70 }
|
|
493
|
-
]
|
|
494
|
-
}---
|
|
495
|
-
|
|
496
|
-
## 完整示例
|
|
497
|
-
|
|
498
|
-
### 示例1:静态数据饼图
|
|
499
|
-
|
|
500
|
-
<template>
|
|
501
|
-
<HChart :config="pieConfig" />
|
|
502
|
-
</template>
|
|
503
|
-
|
|
504
|
-
<script setup>
|
|
505
|
-
import { ref } from 'vue'
|
|
506
|
-
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
507
|
-
|
|
508
|
-
const pieConfig = ref({
|
|
509
|
-
type: 'pie',
|
|
510
|
-
xtitle: '访问来源',
|
|
511
|
-
dataset: [
|
|
512
|
-
{ label: '直接访问', value: 335 },
|
|
513
|
-
{ label: '邮件营销', value: 310 },
|
|
514
|
-
{ label: '联盟广告', value: 234 },
|
|
515
|
-
{ label: '视频广告', value: 135 },
|
|
516
|
-
{ label: '搜索引擎', value: 1548 }
|
|
517
|
-
],
|
|
518
|
-
legend: {
|
|
519
|
-
orient: 'vertical',
|
|
520
|
-
left: 'left'
|
|
521
|
-
},
|
|
522
|
-
options: {
|
|
523
|
-
tooltip: {
|
|
524
|
-
trigger: 'item',
|
|
525
|
-
formatter: '{a} <br/>{b}: {c} ({d}%)'
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
})
|
|
529
|
-
</script>### 示例2:动态数据柱状图
|
|
530
|
-
|
|
531
|
-
<template>
|
|
532
|
-
<HChart
|
|
533
|
-
:config="barConfig"
|
|
534
|
-
:fixed-query-form="queryForm"
|
|
535
|
-
@dataLoaded="handleDataLoaded"
|
|
536
|
-
/>
|
|
537
|
-
</template>
|
|
538
|
-
|
|
539
|
-
<script setup>
|
|
540
|
-
import { ref, reactive } from 'vue'
|
|
541
|
-
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
542
|
-
|
|
543
|
-
const queryForm = reactive({
|
|
544
|
-
condition: '1=1',
|
|
545
|
-
startDate: '2024-01-01',
|
|
546
|
-
endDate: '2024-01-31'
|
|
547
|
-
})
|
|
548
|
-
|
|
549
|
-
const barConfig = ref({
|
|
550
|
-
type: 'bar',
|
|
551
|
-
xtitle: '患者统计',
|
|
552
|
-
data: 'getPatientStatistics',
|
|
553
|
-
dataMapping: {
|
|
554
|
-
labelField: 'month',
|
|
555
|
-
valueField: 'count'
|
|
556
|
-
},
|
|
557
|
-
options: {
|
|
558
|
-
grid: {
|
|
559
|
-
left: 48,
|
|
560
|
-
right: 24,
|
|
561
|
-
bottom: 24,
|
|
562
|
-
top: 36
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
})
|
|
566
|
-
|
|
567
|
-
const handleDataLoaded = (data) => {
|
|
568
|
-
console.log('数据加载完成:', data)
|
|
569
|
-
}
|
|
570
|
-
</script>### 示例3:多个图表展示
|
|
571
|
-
|
|
572
|
-
<template>
|
|
573
|
-
<div class="charts-container">
|
|
574
|
-
<HChart
|
|
575
|
-
v-for="chart in charts"
|
|
576
|
-
:key="chart.id"
|
|
577
|
-
:config="chart"
|
|
578
|
-
/>
|
|
579
|
-
</div>
|
|
580
|
-
</template>
|
|
581
|
-
|
|
582
|
-
<script setup>
|
|
583
|
-
import { ref } from 'vue'
|
|
584
|
-
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
585
|
-
|
|
586
|
-
const charts = ref([
|
|
587
|
-
{
|
|
588
|
-
id: 'chart-1',
|
|
589
|
-
type: 'line',
|
|
590
|
-
xtitle: '平均住院日趋势',
|
|
591
|
-
dataset: [
|
|
592
|
-
{ label: '1月', value: 6.1 },
|
|
593
|
-
{ label: '2月', value: 5.8 },
|
|
594
|
-
{ label: '3月', value: 5.6 }
|
|
595
|
-
]
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
id: 'chart-2',
|
|
599
|
-
type: 'pie',
|
|
600
|
-
xtitle: '科室占比',
|
|
601
|
-
dataset: [
|
|
602
|
-
{ label: '内科', value: 120 },
|
|
603
|
-
{ label: '外科', value: 96 },
|
|
604
|
-
{ label: '儿科', value: 82 }
|
|
605
|
-
]
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
id: 'chart-3',
|
|
609
|
-
type: 'bar',
|
|
610
|
-
xtitle: '工作量对比',
|
|
611
|
-
dataset: [
|
|
612
|
-
{ label: 'A组', value: 320 },
|
|
613
|
-
{ label: 'B组', value: 280 },
|
|
614
|
-
{ label: 'C组', value: 260 }
|
|
615
|
-
]
|
|
616
|
-
}
|
|
617
|
-
])
|
|
618
|
-
</script>
|
|
619
|
-
|
|
620
|
-
<style scoped>
|
|
621
|
-
.charts-container {
|
|
622
|
-
display: grid;
|
|
623
|
-
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
|
|
624
|
-
gap: 24px;
|
|
625
|
-
}
|
|
626
|
-
</style>### 示例4:动态更新数据
|
|
627
|
-
|
|
628
|
-
<template>
|
|
629
|
-
<div>
|
|
630
|
-
<HChart ref="chartRef" :config="chartConfig" />
|
|
631
|
-
<a-button @click="updateData">更新数据</a-button>
|
|
632
|
-
</div>
|
|
633
|
-
</template>
|
|
634
|
-
|
|
635
|
-
<script setup>
|
|
636
|
-
import { ref } from 'vue'
|
|
637
|
-
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
638
|
-
|
|
639
|
-
const chartRef = ref(null)
|
|
640
|
-
const chartConfig = ref({
|
|
641
|
-
type: 'line',
|
|
642
|
-
xtitle: '动态数据图表',
|
|
643
|
-
dataset: [
|
|
644
|
-
{ label: '1', value: Math.random() * 100 },
|
|
645
|
-
{ label: '2', value: Math.random() * 100 },
|
|
646
|
-
{ label: '3', value: Math.random() * 100 }
|
|
647
|
-
]
|
|
648
|
-
})
|
|
649
|
-
|
|
650
|
-
const updateData = () => {
|
|
651
|
-
chartConfig.value.dataset = chartConfig.value.dataset.map(item => ({
|
|
652
|
-
...item,
|
|
653
|
-
value: Math.random() * 100
|
|
654
|
-
}))
|
|
655
|
-
}
|
|
656
|
-
</script>### 示例5:使用配置中心
|
|
657
|
-
|
|
658
|
-
<template>
|
|
659
|
-
<HChart
|
|
660
|
-
query-params-name="chart-patient-stats"
|
|
661
|
-
:fixed-query-form="queryForm"
|
|
662
|
-
service-name="af-his"
|
|
663
|
-
@init="handleInit"
|
|
664
|
-
@error="handleError"
|
|
665
|
-
/>
|
|
666
|
-
</template>
|
|
667
|
-
|
|
668
|
-
<script setup>
|
|
669
|
-
import { reactive } from 'vue'
|
|
670
|
-
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
671
|
-
import { message } from 'ant-design-vue'
|
|
672
|
-
|
|
673
|
-
const queryForm = reactive({
|
|
674
|
-
condition: '1=1',
|
|
675
|
-
dateRange: '2024-01'
|
|
676
|
-
})
|
|
677
|
-
|
|
678
|
-
const handleInit = (config) => {
|
|
679
|
-
console.log('配置加载完成:', config)
|
|
680
|
-
message.success('图表初始化成功')
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
const handleError = (error) => {
|
|
684
|
-
console.error('错误:', error)
|
|
685
|
-
message.error('图表加载失败')
|
|
686
|
-
}
|
|
687
|
-
</script>---
|
|
688
|
-
|
|
689
|
-
## 样式属性
|
|
690
|
-
|
|
691
|
-
### 布尔样式开关
|
|
692
|
-
|
|
693
|
-
通过属性控制样式:
|
|
694
|
-
|
|
695
|
-
| 属性 | 说明 | 类型 |
|
|
696
|
-
|------|------|------|
|
|
697
|
-
| `show-border` | 显示边框 | `Boolean` 或 `String` |
|
|
698
|
-
|
|
699
|
-
### 使用示例
|
|
700
|
-
|
|
701
|
-
<template>
|
|
702
|
-
<!-- 显示边框 -->
|
|
703
|
-
<HChart :config="config" show-border />
|
|
704
|
-
|
|
705
|
-
<!-- 或者使用字符串 -->
|
|
706
|
-
<HChart :config="config" show-border="true" />
|
|
707
|
-
</template>---
|
|
708
|
-
|
|
709
|
-
## 预设配置说明
|
|
710
|
-
|
|
711
|
-
HChart 为每种图表类型提供了预设样式:
|
|
712
|
-
|
|
713
|
-
### 柱状图(Bar)
|
|
714
|
-
|
|
715
|
-
- 颜色:`#3362DA`(主色)、`#4C7CFF`(hover)
|
|
716
|
-
- 圆角:顶部 4px
|
|
717
|
-
- 动画:420ms,延迟 60ms/项
|
|
718
|
-
- 阴影:hover 时显示
|
|
719
|
-
|
|
720
|
-
### 折线图(Line)
|
|
721
|
-
|
|
722
|
-
- 颜色:`#28C8B5`(主色)、`#4BE1CD`(hover)
|
|
723
|
-
- 平滑曲线:`smooth: true`
|
|
724
|
-
- 面积填充:透明度 0.1
|
|
725
|
-
- 动画:420ms,延迟 50ms/项
|
|
726
|
-
|
|
727
|
-
### 饼图(Pie)
|
|
728
|
-
|
|
729
|
-
- 半径:55%
|
|
730
|
-
- 边框:白色,2px
|
|
731
|
-
- 动画:420ms
|
|
732
|
-
- Hover:放大 6px,显示阴影
|
|
733
|
-
|
|
734
|
-
可以通过 `options` 覆盖这些预设配置。
|
|
735
|
-
|
|
736
|
-
---
|
|
737
|
-
|
|
738
|
-
## 注意事项
|
|
739
|
-
|
|
740
|
-
1. **数据格式**:Logic 必须返回数组,即使只有一条数据也要返回 `[{...}]`
|
|
741
|
-
2. **字段映射**:如果后端字段名不是标准格式,必须配置 `dataMapping`
|
|
742
|
-
3. **配置优先级**:`options` 中的配置会覆盖预设配置,但 `data` 字段会保留预设值
|
|
743
|
-
4. **响应式**:组件会自动监听窗口大小变化并调整图表尺寸
|
|
744
|
-
5. **内存管理**:组件卸载时会自动销毁 ECharts 实例
|
|
745
|
-
6. **数据更新**:修改 `config` 或 `fixedQueryForm` 会自动重新加载数据
|
|
746
|
-
7. **错误处理**:建议监听 `error` 事件处理错误情况
|
|
747
|
-
8. **配置来源**:`queryParamsName` 和 `config` 必须提供一个
|
|
748
|
-
|
|
749
|
-
---
|
|
750
|
-
|
|
751
|
-
## 常见问题
|
|
752
|
-
|
|
753
|
-
### Q1: 如何自定义图表颜色?
|
|
754
|
-
|
|
755
|
-
A: 在 `options.series[0]` 中配置 `itemStyle.color`:
|
|
756
|
-
|
|
757
|
-
{
|
|
758
|
-
type: 'bar',
|
|
759
|
-
dataset: [...],
|
|
760
|
-
options: {
|
|
761
|
-
series: [{
|
|
762
|
-
itemStyle: {
|
|
763
|
-
color: '#FF6B6B'
|
|
764
|
-
}
|
|
765
|
-
}]
|
|
766
|
-
}
|
|
767
|
-
}### Q2: 如何显示多个系列?
|
|
768
|
-
|
|
769
|
-
A: 目前 HChart 只支持单系列图表。如需多系列,建议直接使用 ECharts 或扩展组件。
|
|
770
|
-
|
|
771
|
-
### Q3: Logic 返回的数据格式不对怎么办?
|
|
772
|
-
|
|
773
|
-
A: 配置 `dataMapping` 指定字段映射:
|
|
774
|
-
|
|
775
|
-
{
|
|
776
|
-
data: 'yourLogic',
|
|
777
|
-
dataMapping: {
|
|
778
|
-
labelField: 'yourLabelField',
|
|
779
|
-
valueField: 'yourValueField'
|
|
780
|
-
}
|
|
781
|
-
}### Q4: 如何获取 ECharts 实例进行高级操作?
|
|
782
|
-
|
|
783
|
-
A: 通过 `ref` 获取 `chartInstance`:
|
|
784
|
-
|
|
785
|
-
const chartRef = ref(null)
|
|
786
|
-
// 获取实例
|
|
787
|
-
const instance = chartRef.value?.chartInstance
|
|
788
|
-
// 调用 ECharts API
|
|
789
|
-
instance?.setOption({...})---
|
|
790
|
-
|
|
791
|
-
## 更新日志
|
|
792
|
-
|
|
793
|
-
- **v1.0.0**:初始版本,支持 bar、line、pie 三种图表类型
|
|
794
|
-
|
|
795
|
-
---
|
|
796
|
-
|
|
797
|
-
**文档版本**:1.0.0
|
|
798
|
-
**最后更新**:2024-01-XX
|
|
1
|
+
# HChart 组件使用文档
|
|
2
|
+
|
|
3
|
+
## 目录
|
|
4
|
+
|
|
5
|
+
- [组件介绍](#组件介绍)
|
|
6
|
+
- [基本用法](#基本用法)
|
|
7
|
+
- [Props API](#props-api)
|
|
8
|
+
- [Events API](#events-api)
|
|
9
|
+
- [Methods API](#methods-api)
|
|
10
|
+
- [配置结构](#配置结构)
|
|
11
|
+
- [数据格式](#数据格式)
|
|
12
|
+
- [从 ECharts 配置转换](#从-echarts-配置转换)
|
|
13
|
+
- [完整示例](#完整示例)
|
|
14
|
+
- [样式属性](#样式属性)
|
|
15
|
+
- [注意事项](#注意事项)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 组件介绍
|
|
20
|
+
|
|
21
|
+
`HChart` 是一个基于 ECharts 的可配置图表组件,支持柱状图、折线图、饼图三种常用图表类型。组件提供了预设的样式配置,支持静态数据、动态数据(Logic)和配置化使用方式。
|
|
22
|
+
|
|
23
|
+
### 特性
|
|
24
|
+
|
|
25
|
+
- ✅ 支持三种图表类型:柱状图(bar)、折线图(line)、饼图(pie)
|
|
26
|
+
- ✅ 支持静态数据(dataset)和动态数据(logicName)
|
|
27
|
+
- ✅ 自动数据格式转换和字段映射
|
|
28
|
+
- ✅ 预设样式,支持自定义覆盖
|
|
29
|
+
- ✅ 响应式布局,自动适配窗口大小
|
|
30
|
+
- ✅ 支持从后端配置中心获取配置
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 基本用法
|
|
35
|
+
|
|
36
|
+
### 方式1:直接传入配置(推荐)
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<HChart :config="chartConfig" />
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script setup>
|
|
43
|
+
import { ref } from 'vue'
|
|
44
|
+
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
45
|
+
|
|
46
|
+
const chartConfig = ref({
|
|
47
|
+
type: 'pie',
|
|
48
|
+
xtitle: '访问来源',
|
|
49
|
+
dataset: [
|
|
50
|
+
{ label: '直接访问', value: 335 },
|
|
51
|
+
{ label: '邮件营销', value: 310 },
|
|
52
|
+
{ label: '联盟广告', value: 234 }
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
</script>### 方式2:通过配置名称查询
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<HChart
|
|
59
|
+
query-params-name="chart-patient-stats"
|
|
60
|
+
:fixed-query-form="{ condition: '1=1', dateRange: '2024-01' }"
|
|
61
|
+
service-name="af-his"
|
|
62
|
+
/>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script setup>
|
|
66
|
+
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
67
|
+
</script>### 方式3:使用 Logic 获取数据
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<HChart
|
|
71
|
+
:config="chartConfig"
|
|
72
|
+
:fixed-query-form="queryForm"
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<script setup>
|
|
77
|
+
import { ref, reactive } from 'vue'
|
|
78
|
+
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
79
|
+
|
|
80
|
+
const queryForm = reactive({
|
|
81
|
+
condition: '1=1',
|
|
82
|
+
startDate: '2024-01-01',
|
|
83
|
+
endDate: '2024-01-31'
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
const chartConfig = ref({
|
|
87
|
+
type: 'bar',
|
|
88
|
+
xtitle: '患者统计',
|
|
89
|
+
data: 'getPatientStatistics', // logicName
|
|
90
|
+
dataMapping: {
|
|
91
|
+
labelField: 'month',
|
|
92
|
+
valueField: 'count'
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
</script>---
|
|
96
|
+
|
|
97
|
+
## Props API
|
|
98
|
+
|
|
99
|
+
| 参数 | 说明 | 类型 | 默认值 | 必填 |
|
|
100
|
+
|------|------|------|--------|------|
|
|
101
|
+
| `queryParamsName` | 配置名称(用于从后端查询配置) | `String` | `''` | 否 |
|
|
102
|
+
| `serviceName` | 服务名 | `String` | `'af-his'` | 否 |
|
|
103
|
+
| `fixedQueryForm` | 固定查询参数(传递给 logic) | `Object` | `{ condition: '1=1' }` | 否 |
|
|
104
|
+
| `config` | 图表配置对象 | `Object` | `null` | 否 |
|
|
105
|
+
|
|
106
|
+
**注意**:`queryParamsName` 和 `config` 必须提供一个。
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Events API
|
|
111
|
+
|
|
112
|
+
| 事件名 | 说明 | 回调参数 |
|
|
113
|
+
|--------|------|----------|
|
|
114
|
+
| `init` | 图表初始化完成 | `(config: Object)` - 配置对象 |
|
|
115
|
+
| `dataLoaded` | 数据加载完成 | `(data: Array)` - 转换后的数据数组 |
|
|
116
|
+
| `error` | 发生错误 | `(error: Error)` - 错误对象 |
|
|
117
|
+
|
|
118
|
+
### 使用示例
|
|
119
|
+
|
|
120
|
+
<template>
|
|
121
|
+
<HChart
|
|
122
|
+
:config="chartConfig"
|
|
123
|
+
@init="handleInit"
|
|
124
|
+
@dataLoaded="handleDataLoaded"
|
|
125
|
+
@error="handleError"
|
|
126
|
+
/>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<script setup>
|
|
130
|
+
const handleInit = (config) => {
|
|
131
|
+
console.log('图表初始化:', config)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const handleDataLoaded = (data) => {
|
|
135
|
+
console.log('数据加载完成:', data)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const handleError = (error) => {
|
|
139
|
+
console.error('发生错误:', error)
|
|
140
|
+
}
|
|
141
|
+
</script>---
|
|
142
|
+
|
|
143
|
+
## Methods API
|
|
144
|
+
|
|
145
|
+
通过 `ref` 调用组件方法:
|
|
146
|
+
|
|
147
|
+
| 方法名 | 说明 | 参数 |
|
|
148
|
+
|--------|------|------|
|
|
149
|
+
| `refresh()` | 刷新图表(重新获取配置和数据) | - |
|
|
150
|
+
| `reload(newQueryForm)` | 重新加载图表(可更新查询参数) | `newQueryForm?: Object` |
|
|
151
|
+
| `chartInstance` | 获取 ECharts 实例(用于高级操作) | - |
|
|
152
|
+
|
|
153
|
+
### 使用示例
|
|
154
|
+
e
|
|
155
|
+
<template>
|
|
156
|
+
<HChart ref="chartRef" :config="chartConfig" />
|
|
157
|
+
<a-button @click="handleRefresh">刷新</a-button>
|
|
158
|
+
<a-button @click="handleReload">重新加载</a-button>
|
|
159
|
+
</template>
|
|
160
|
+
|
|
161
|
+
<script setup>
|
|
162
|
+
import { ref } from 'vue'
|
|
163
|
+
|
|
164
|
+
const chartRef = ref(null)
|
|
165
|
+
|
|
166
|
+
const handleRefresh = () => {
|
|
167
|
+
chartRef.value?.refresh()
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const handleReload = () => {
|
|
171
|
+
chartRef.value?.reload({ condition: '1=1', dateRange: '2024-02' })
|
|
172
|
+
}
|
|
173
|
+
</script>---
|
|
174
|
+
|
|
175
|
+
## 配置结构
|
|
176
|
+
|
|
177
|
+
### 完整配置对象
|
|
178
|
+
ript
|
|
179
|
+
interface HChartConfig {
|
|
180
|
+
// 图表类型
|
|
181
|
+
type: 'bar' | 'line' | 'pie'
|
|
182
|
+
|
|
183
|
+
// 图表标题(显示在组件顶部)
|
|
184
|
+
xtitle?: string
|
|
185
|
+
|
|
186
|
+
// 静态数据(与 data 二选一)
|
|
187
|
+
dataset?: Array<{ label: string, value: number }>
|
|
188
|
+
|
|
189
|
+
// Logic 名称(与 dataset 二选一)
|
|
190
|
+
data?: string
|
|
191
|
+
|
|
192
|
+
// 数据映射配置(当后端返回的字段名不是 label/value 时使用)
|
|
193
|
+
dataMapping?: {
|
|
194
|
+
labelField?: string // 默认: 'label'
|
|
195
|
+
valueField?: string // 默认: 'value'
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Legend 配置(ECharts legend 配置)
|
|
199
|
+
legend?: Object
|
|
200
|
+
|
|
201
|
+
// Grid 配置(ECharts grid 配置)
|
|
202
|
+
grid?: Object
|
|
203
|
+
|
|
204
|
+
// 自定义 ECharts 配置(会与预设配置合并)
|
|
205
|
+
options?: Object
|
|
206
|
+
}### 配置字段说明
|
|
207
|
+
|
|
208
|
+
#### `type` - 图表类型
|
|
209
|
+
|
|
210
|
+
- `'bar'`:柱状图
|
|
211
|
+
- `'line'`:折线图
|
|
212
|
+
- `'pie'`:饼图
|
|
213
|
+
|
|
214
|
+
#### `xtitle` - 图表标题
|
|
215
|
+
|
|
216
|
+
显示在组件顶部的标题文本。
|
|
217
|
+
|
|
218
|
+
#### `dataset` - 静态数据
|
|
219
|
+
|
|
220
|
+
数组格式,每个元素包含 `label` 和 `value`:
|
|
221
|
+
t
|
|
222
|
+
dataset: [
|
|
223
|
+
{ label: '1月', value: 120 },
|
|
224
|
+
{ label: '2月', value: 200 }
|
|
225
|
+
]#### `data` - Logic 名称
|
|
226
|
+
|
|
227
|
+
后端 Logic 的名称,组件会通过 `runLogic` 获取数据。
|
|
228
|
+
|
|
229
|
+
#### `dataMapping` - 数据映射
|
|
230
|
+
|
|
231
|
+
当后端返回的字段名不是标准格式时,使用此配置映射:
|
|
232
|
+
ipt
|
|
233
|
+
dataMapping: {
|
|
234
|
+
labelField: 'month', // 后端字段名 → label
|
|
235
|
+
valueField: 'count' // 后端字段名 → value
|
|
236
|
+
}#### `legend` - 图例配置
|
|
237
|
+
|
|
238
|
+
ECharts legend 配置对象:
|
|
239
|
+
script
|
|
240
|
+
legend: {
|
|
241
|
+
orient: 'vertical',
|
|
242
|
+
left: 'left'
|
|
243
|
+
}#### `grid` - 网格配置
|
|
244
|
+
|
|
245
|
+
ECharts grid 配置对象:
|
|
246
|
+
cript
|
|
247
|
+
grid: {
|
|
248
|
+
left: 48,
|
|
249
|
+
right: 24,
|
|
250
|
+
bottom: 24,
|
|
251
|
+
top: 36
|
|
252
|
+
}#### `options` - 自定义配置
|
|
253
|
+
|
|
254
|
+
可以覆盖或扩展预设配置,支持所有 ECharts 配置项:
|
|
255
|
+
vascript
|
|
256
|
+
options: {
|
|
257
|
+
title: {
|
|
258
|
+
text: '自定义标题',
|
|
259
|
+
subtext: '副标题'
|
|
260
|
+
},
|
|
261
|
+
tooltip: {
|
|
262
|
+
trigger: 'item',
|
|
263
|
+
formatter: '{a} <br/>{b}: {c} ({d}%)'
|
|
264
|
+
},
|
|
265
|
+
series: [
|
|
266
|
+
{
|
|
267
|
+
radius: '50%',
|
|
268
|
+
emphasis: {
|
|
269
|
+
itemStyle: {
|
|
270
|
+
shadowBlur: 10
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}**注意**:`options.series` 会与预设配置深度合并,但 `data` 字段会保留预设值(从 logic 获取的数据)。
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## 数据格式
|
|
280
|
+
|
|
281
|
+
### Logic 返回值格式
|
|
282
|
+
|
|
283
|
+
`accountsReceivableChartLogic` 或其他 Logic 应该返回一个对象数组。
|
|
284
|
+
|
|
285
|
+
#### 标准格式(推荐)
|
|
286
|
+
avascript
|
|
287
|
+
// 使用 label 和 value(无需配置 dataMapping)
|
|
288
|
+
[
|
|
289
|
+
{ label: '直接访问', value: 335 },
|
|
290
|
+
{ label: '邮件营销', value: 310 },
|
|
291
|
+
{ label: '联盟广告', value: 234 }
|
|
292
|
+
]#### 自动识别格式
|
|
293
|
+
|
|
294
|
+
组件会自动识别以下字段:
|
|
295
|
+
|
|
296
|
+
// 方式1:使用 name/value
|
|
297
|
+
[
|
|
298
|
+
{ name: '直接访问', value: 335 },
|
|
299
|
+
{ name: '邮件营销', value: 310 }
|
|
300
|
+
]
|
|
301
|
+
|
|
302
|
+
// 方式2:使用 text/value
|
|
303
|
+
[
|
|
304
|
+
{ text: 'Q1', value: 320 },
|
|
305
|
+
{ text: 'Q2', value: 280 }
|
|
306
|
+
]
|
|
307
|
+
|
|
308
|
+
// 方式3:使用 x/y
|
|
309
|
+
[
|
|
310
|
+
{ x: 'Mon', y: 120 },
|
|
311
|
+
{ x: 'Tue', y: 200 }
|
|
312
|
+
]
|
|
313
|
+
|
|
314
|
+
// 方式4:使用 count
|
|
315
|
+
[
|
|
316
|
+
{ name: '内科', count: 120 },
|
|
317
|
+
{ name: '外科', count: 96 }
|
|
318
|
+
]#### 自定义字段格式
|
|
319
|
+
|
|
320
|
+
如果后端返回的字段名不是上述标准字段,需要配置 `dataMapping`:
|
|
321
|
+
|
|
322
|
+
// 后端返回
|
|
323
|
+
[
|
|
324
|
+
{ category: '直接访问', amount: 335 },
|
|
325
|
+
{ category: '邮件营销', amount: 310 }
|
|
326
|
+
]
|
|
327
|
+
|
|
328
|
+
// HChart 配置
|
|
329
|
+
{
|
|
330
|
+
type: 'pie',
|
|
331
|
+
data: 'accountsReceivableChartLogic',
|
|
332
|
+
dataMapping: {
|
|
333
|
+
labelField: 'category',
|
|
334
|
+
valueField: 'amount'
|
|
335
|
+
}
|
|
336
|
+
}### 数据转换规则
|
|
337
|
+
|
|
338
|
+
根据 `transformData` 函数的逻辑:
|
|
339
|
+
|
|
340
|
+
**有 `dataMapping` 配置时**:
|
|
341
|
+
- 使用指定的 `labelField` 和 `valueField`
|
|
342
|
+
- 如果字段不存在,label 回退到 `name` 或 `label`,value 回退到 `value` 或 `0`
|
|
343
|
+
|
|
344
|
+
**无 `dataMapping` 配置时**(自动识别):
|
|
345
|
+
- Label 字段优先级:`label` → `name` → `text` → `x` → 对象第一个键
|
|
346
|
+
- Value 字段优先级:`value` → `count` → `y` → 对象第二个键 → `0`
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## 从 ECharts 配置转换
|
|
351
|
+
|
|
352
|
+
### 转换对照表
|
|
353
|
+
|
|
354
|
+
| ECharts 配置 | HChart 配置 | 说明 |
|
|
355
|
+
|-------------|------------|------|
|
|
356
|
+
| `series[0].type` | `type` | 提取图表类型 |
|
|
357
|
+
| `title.text` | `xtitle` | 图表标题 |
|
|
358
|
+
| `series[0].data` | `dataset` 或 `data` | 数据源 |
|
|
359
|
+
| `legend` | `legend` | 图例配置 |
|
|
360
|
+
| `grid` | `grid` | 网格配置 |
|
|
361
|
+
| 其他配置 | `options` | 自定义配置 |
|
|
362
|
+
|
|
363
|
+
### 转换示例
|
|
364
|
+
|
|
365
|
+
#### 示例1:饼图转换
|
|
366
|
+
|
|
367
|
+
**原始 ECharts 配置**:ascript
|
|
368
|
+
const echartsOption = {
|
|
369
|
+
title: {
|
|
370
|
+
text: 'Referer of a Website',
|
|
371
|
+
subtext: 'Fake Data',
|
|
372
|
+
left: 'center'
|
|
373
|
+
},
|
|
374
|
+
tooltip: {
|
|
375
|
+
trigger: 'item'
|
|
376
|
+
},
|
|
377
|
+
legend: {
|
|
378
|
+
orient: 'vertical',
|
|
379
|
+
left: 'left'
|
|
380
|
+
},
|
|
381
|
+
series: [
|
|
382
|
+
{
|
|
383
|
+
name: 'Access From',
|
|
384
|
+
type: 'pie',
|
|
385
|
+
radius: '50%',
|
|
386
|
+
data: [
|
|
387
|
+
{ value: 1048, name: 'Search Engine' },
|
|
388
|
+
{ value: 735, name: 'Direct' },
|
|
389
|
+
{ value: 580, name: 'Email' }
|
|
390
|
+
],
|
|
391
|
+
emphasis: {
|
|
392
|
+
itemStyle: {
|
|
393
|
+
shadowBlur: 10,
|
|
394
|
+
shadowOffsetX: 0,
|
|
395
|
+
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
]
|
|
400
|
+
}**转换为 HChart 配置**:ript
|
|
401
|
+
const hChartConfig = {
|
|
402
|
+
type: 'pie',
|
|
403
|
+
xtitle: 'Referer of a Website',
|
|
404
|
+
// 方式1:静态数据
|
|
405
|
+
dataset: [
|
|
406
|
+
{ label: 'Search Engine', value: 1048 },
|
|
407
|
+
{ label: 'Direct', value: 735 },
|
|
408
|
+
{ label: 'Email', value: 580 }
|
|
409
|
+
],
|
|
410
|
+
// 方式2:动态数据
|
|
411
|
+
// data: 'accountsReceivableChartLogic',
|
|
412
|
+
legend: {
|
|
413
|
+
orient: 'vertical',
|
|
414
|
+
left: 'left'
|
|
415
|
+
},
|
|
416
|
+
options: {
|
|
417
|
+
title: {
|
|
418
|
+
text: 'Referer of a Website',
|
|
419
|
+
subtext: 'Fake Data',
|
|
420
|
+
left: 'center'
|
|
421
|
+
},
|
|
422
|
+
tooltip: {
|
|
423
|
+
trigger: 'item'
|
|
424
|
+
},
|
|
425
|
+
series: [
|
|
426
|
+
{
|
|
427
|
+
name: 'Access From',
|
|
428
|
+
radius: '50%',
|
|
429
|
+
emphasis: {
|
|
430
|
+
itemStyle: {
|
|
431
|
+
shadowBlur: 10,
|
|
432
|
+
shadowOffsetX: 0,
|
|
433
|
+
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
}#### 示例2:柱状图转换
|
|
440
|
+
|
|
441
|
+
**原始 ECharts 配置**:ascript
|
|
442
|
+
const echartsOption = {
|
|
443
|
+
xAxis: {
|
|
444
|
+
type: 'category',
|
|
445
|
+
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']
|
|
446
|
+
},
|
|
447
|
+
yAxis: {
|
|
448
|
+
type: 'value'
|
|
449
|
+
},
|
|
450
|
+
series: [
|
|
451
|
+
{
|
|
452
|
+
type: 'bar',
|
|
453
|
+
data: [120, 200, 150, 80, 70]
|
|
454
|
+
}
|
|
455
|
+
]
|
|
456
|
+
}**转换为 HChart 配置**:
|
|
457
|
+
const hChartConfig = {
|
|
458
|
+
type: 'bar',
|
|
459
|
+
dataset: [
|
|
460
|
+
{ label: 'Mon', value: 120 },
|
|
461
|
+
{ label: 'Tue', value: 200 },
|
|
462
|
+
{ label: 'Wed', value: 150 },
|
|
463
|
+
{ label: 'Thu', value: 80 },
|
|
464
|
+
{ label: 'Fri', value: 70 }
|
|
465
|
+
]
|
|
466
|
+
}#### 示例3:折线图转换
|
|
467
|
+
|
|
468
|
+
**原始 ECharts 配置**:ascript
|
|
469
|
+
const echartsOption = {
|
|
470
|
+
xAxis: {
|
|
471
|
+
type: 'category',
|
|
472
|
+
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']
|
|
473
|
+
},
|
|
474
|
+
yAxis: {
|
|
475
|
+
type: 'value'
|
|
476
|
+
},
|
|
477
|
+
series: [
|
|
478
|
+
{
|
|
479
|
+
type: 'line',
|
|
480
|
+
smooth: true,
|
|
481
|
+
data: [120, 200, 150, 80, 70]
|
|
482
|
+
}
|
|
483
|
+
]
|
|
484
|
+
}**转换为 HChart 配置**:
|
|
485
|
+
const hChartConfig = {
|
|
486
|
+
type: 'line',
|
|
487
|
+
dataset: [
|
|
488
|
+
{ label: 'Mon', value: 120 },
|
|
489
|
+
{ label: 'Tue', value: 200 },
|
|
490
|
+
{ label: 'Wed', value: 150 },
|
|
491
|
+
{ label: 'Thu', value: 80 },
|
|
492
|
+
{ label: 'Fri', value: 70 }
|
|
493
|
+
]
|
|
494
|
+
}---
|
|
495
|
+
|
|
496
|
+
## 完整示例
|
|
497
|
+
|
|
498
|
+
### 示例1:静态数据饼图
|
|
499
|
+
|
|
500
|
+
<template>
|
|
501
|
+
<HChart :config="pieConfig" />
|
|
502
|
+
</template>
|
|
503
|
+
|
|
504
|
+
<script setup>
|
|
505
|
+
import { ref } from 'vue'
|
|
506
|
+
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
507
|
+
|
|
508
|
+
const pieConfig = ref({
|
|
509
|
+
type: 'pie',
|
|
510
|
+
xtitle: '访问来源',
|
|
511
|
+
dataset: [
|
|
512
|
+
{ label: '直接访问', value: 335 },
|
|
513
|
+
{ label: '邮件营销', value: 310 },
|
|
514
|
+
{ label: '联盟广告', value: 234 },
|
|
515
|
+
{ label: '视频广告', value: 135 },
|
|
516
|
+
{ label: '搜索引擎', value: 1548 }
|
|
517
|
+
],
|
|
518
|
+
legend: {
|
|
519
|
+
orient: 'vertical',
|
|
520
|
+
left: 'left'
|
|
521
|
+
},
|
|
522
|
+
options: {
|
|
523
|
+
tooltip: {
|
|
524
|
+
trigger: 'item',
|
|
525
|
+
formatter: '{a} <br/>{b}: {c} ({d}%)'
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
})
|
|
529
|
+
</script>### 示例2:动态数据柱状图
|
|
530
|
+
|
|
531
|
+
<template>
|
|
532
|
+
<HChart
|
|
533
|
+
:config="barConfig"
|
|
534
|
+
:fixed-query-form="queryForm"
|
|
535
|
+
@dataLoaded="handleDataLoaded"
|
|
536
|
+
/>
|
|
537
|
+
</template>
|
|
538
|
+
|
|
539
|
+
<script setup>
|
|
540
|
+
import { ref, reactive } from 'vue'
|
|
541
|
+
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
542
|
+
|
|
543
|
+
const queryForm = reactive({
|
|
544
|
+
condition: '1=1',
|
|
545
|
+
startDate: '2024-01-01',
|
|
546
|
+
endDate: '2024-01-31'
|
|
547
|
+
})
|
|
548
|
+
|
|
549
|
+
const barConfig = ref({
|
|
550
|
+
type: 'bar',
|
|
551
|
+
xtitle: '患者统计',
|
|
552
|
+
data: 'getPatientStatistics',
|
|
553
|
+
dataMapping: {
|
|
554
|
+
labelField: 'month',
|
|
555
|
+
valueField: 'count'
|
|
556
|
+
},
|
|
557
|
+
options: {
|
|
558
|
+
grid: {
|
|
559
|
+
left: 48,
|
|
560
|
+
right: 24,
|
|
561
|
+
bottom: 24,
|
|
562
|
+
top: 36
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
})
|
|
566
|
+
|
|
567
|
+
const handleDataLoaded = (data) => {
|
|
568
|
+
console.log('数据加载完成:', data)
|
|
569
|
+
}
|
|
570
|
+
</script>### 示例3:多个图表展示
|
|
571
|
+
|
|
572
|
+
<template>
|
|
573
|
+
<div class="charts-container">
|
|
574
|
+
<HChart
|
|
575
|
+
v-for="chart in charts"
|
|
576
|
+
:key="chart.id"
|
|
577
|
+
:config="chart"
|
|
578
|
+
/>
|
|
579
|
+
</div>
|
|
580
|
+
</template>
|
|
581
|
+
|
|
582
|
+
<script setup>
|
|
583
|
+
import { ref } from 'vue'
|
|
584
|
+
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
585
|
+
|
|
586
|
+
const charts = ref([
|
|
587
|
+
{
|
|
588
|
+
id: 'chart-1',
|
|
589
|
+
type: 'line',
|
|
590
|
+
xtitle: '平均住院日趋势',
|
|
591
|
+
dataset: [
|
|
592
|
+
{ label: '1月', value: 6.1 },
|
|
593
|
+
{ label: '2月', value: 5.8 },
|
|
594
|
+
{ label: '3月', value: 5.6 }
|
|
595
|
+
]
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
id: 'chart-2',
|
|
599
|
+
type: 'pie',
|
|
600
|
+
xtitle: '科室占比',
|
|
601
|
+
dataset: [
|
|
602
|
+
{ label: '内科', value: 120 },
|
|
603
|
+
{ label: '外科', value: 96 },
|
|
604
|
+
{ label: '儿科', value: 82 }
|
|
605
|
+
]
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
id: 'chart-3',
|
|
609
|
+
type: 'bar',
|
|
610
|
+
xtitle: '工作量对比',
|
|
611
|
+
dataset: [
|
|
612
|
+
{ label: 'A组', value: 320 },
|
|
613
|
+
{ label: 'B组', value: 280 },
|
|
614
|
+
{ label: 'C组', value: 260 }
|
|
615
|
+
]
|
|
616
|
+
}
|
|
617
|
+
])
|
|
618
|
+
</script>
|
|
619
|
+
|
|
620
|
+
<style scoped>
|
|
621
|
+
.charts-container {
|
|
622
|
+
display: grid;
|
|
623
|
+
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
|
|
624
|
+
gap: 24px;
|
|
625
|
+
}
|
|
626
|
+
</style>### 示例4:动态更新数据
|
|
627
|
+
|
|
628
|
+
<template>
|
|
629
|
+
<div>
|
|
630
|
+
<HChart ref="chartRef" :config="chartConfig" />
|
|
631
|
+
<a-button @click="updateData">更新数据</a-button>
|
|
632
|
+
</div>
|
|
633
|
+
</template>
|
|
634
|
+
|
|
635
|
+
<script setup>
|
|
636
|
+
import { ref } from 'vue'
|
|
637
|
+
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
638
|
+
|
|
639
|
+
const chartRef = ref(null)
|
|
640
|
+
const chartConfig = ref({
|
|
641
|
+
type: 'line',
|
|
642
|
+
xtitle: '动态数据图表',
|
|
643
|
+
dataset: [
|
|
644
|
+
{ label: '1', value: Math.random() * 100 },
|
|
645
|
+
{ label: '2', value: Math.random() * 100 },
|
|
646
|
+
{ label: '3', value: Math.random() * 100 }
|
|
647
|
+
]
|
|
648
|
+
})
|
|
649
|
+
|
|
650
|
+
const updateData = () => {
|
|
651
|
+
chartConfig.value.dataset = chartConfig.value.dataset.map(item => ({
|
|
652
|
+
...item,
|
|
653
|
+
value: Math.random() * 100
|
|
654
|
+
}))
|
|
655
|
+
}
|
|
656
|
+
</script>### 示例5:使用配置中心
|
|
657
|
+
|
|
658
|
+
<template>
|
|
659
|
+
<HChart
|
|
660
|
+
query-params-name="chart-patient-stats"
|
|
661
|
+
:fixed-query-form="queryForm"
|
|
662
|
+
service-name="af-his"
|
|
663
|
+
@init="handleInit"
|
|
664
|
+
@error="handleError"
|
|
665
|
+
/>
|
|
666
|
+
</template>
|
|
667
|
+
|
|
668
|
+
<script setup>
|
|
669
|
+
import { reactive } from 'vue'
|
|
670
|
+
import HChart from '@/base-client/components/his/HChart/HChart.vue'
|
|
671
|
+
import { message } from 'ant-design-vue'
|
|
672
|
+
|
|
673
|
+
const queryForm = reactive({
|
|
674
|
+
condition: '1=1',
|
|
675
|
+
dateRange: '2024-01'
|
|
676
|
+
})
|
|
677
|
+
|
|
678
|
+
const handleInit = (config) => {
|
|
679
|
+
console.log('配置加载完成:', config)
|
|
680
|
+
message.success('图表初始化成功')
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const handleError = (error) => {
|
|
684
|
+
console.error('错误:', error)
|
|
685
|
+
message.error('图表加载失败')
|
|
686
|
+
}
|
|
687
|
+
</script>---
|
|
688
|
+
|
|
689
|
+
## 样式属性
|
|
690
|
+
|
|
691
|
+
### 布尔样式开关
|
|
692
|
+
|
|
693
|
+
通过属性控制样式:
|
|
694
|
+
|
|
695
|
+
| 属性 | 说明 | 类型 |
|
|
696
|
+
|------|------|------|
|
|
697
|
+
| `show-border` | 显示边框 | `Boolean` 或 `String` |
|
|
698
|
+
|
|
699
|
+
### 使用示例
|
|
700
|
+
|
|
701
|
+
<template>
|
|
702
|
+
<!-- 显示边框 -->
|
|
703
|
+
<HChart :config="config" show-border />
|
|
704
|
+
|
|
705
|
+
<!-- 或者使用字符串 -->
|
|
706
|
+
<HChart :config="config" show-border="true" />
|
|
707
|
+
</template>---
|
|
708
|
+
|
|
709
|
+
## 预设配置说明
|
|
710
|
+
|
|
711
|
+
HChart 为每种图表类型提供了预设样式:
|
|
712
|
+
|
|
713
|
+
### 柱状图(Bar)
|
|
714
|
+
|
|
715
|
+
- 颜色:`#3362DA`(主色)、`#4C7CFF`(hover)
|
|
716
|
+
- 圆角:顶部 4px
|
|
717
|
+
- 动画:420ms,延迟 60ms/项
|
|
718
|
+
- 阴影:hover 时显示
|
|
719
|
+
|
|
720
|
+
### 折线图(Line)
|
|
721
|
+
|
|
722
|
+
- 颜色:`#28C8B5`(主色)、`#4BE1CD`(hover)
|
|
723
|
+
- 平滑曲线:`smooth: true`
|
|
724
|
+
- 面积填充:透明度 0.1
|
|
725
|
+
- 动画:420ms,延迟 50ms/项
|
|
726
|
+
|
|
727
|
+
### 饼图(Pie)
|
|
728
|
+
|
|
729
|
+
- 半径:55%
|
|
730
|
+
- 边框:白色,2px
|
|
731
|
+
- 动画:420ms
|
|
732
|
+
- Hover:放大 6px,显示阴影
|
|
733
|
+
|
|
734
|
+
可以通过 `options` 覆盖这些预设配置。
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
## 注意事项
|
|
739
|
+
|
|
740
|
+
1. **数据格式**:Logic 必须返回数组,即使只有一条数据也要返回 `[{...}]`
|
|
741
|
+
2. **字段映射**:如果后端字段名不是标准格式,必须配置 `dataMapping`
|
|
742
|
+
3. **配置优先级**:`options` 中的配置会覆盖预设配置,但 `data` 字段会保留预设值
|
|
743
|
+
4. **响应式**:组件会自动监听窗口大小变化并调整图表尺寸
|
|
744
|
+
5. **内存管理**:组件卸载时会自动销毁 ECharts 实例
|
|
745
|
+
6. **数据更新**:修改 `config` 或 `fixedQueryForm` 会自动重新加载数据
|
|
746
|
+
7. **错误处理**:建议监听 `error` 事件处理错误情况
|
|
747
|
+
8. **配置来源**:`queryParamsName` 和 `config` 必须提供一个
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
## 常见问题
|
|
752
|
+
|
|
753
|
+
### Q1: 如何自定义图表颜色?
|
|
754
|
+
|
|
755
|
+
A: 在 `options.series[0]` 中配置 `itemStyle.color`:
|
|
756
|
+
|
|
757
|
+
{
|
|
758
|
+
type: 'bar',
|
|
759
|
+
dataset: [...],
|
|
760
|
+
options: {
|
|
761
|
+
series: [{
|
|
762
|
+
itemStyle: {
|
|
763
|
+
color: '#FF6B6B'
|
|
764
|
+
}
|
|
765
|
+
}]
|
|
766
|
+
}
|
|
767
|
+
}### Q2: 如何显示多个系列?
|
|
768
|
+
|
|
769
|
+
A: 目前 HChart 只支持单系列图表。如需多系列,建议直接使用 ECharts 或扩展组件。
|
|
770
|
+
|
|
771
|
+
### Q3: Logic 返回的数据格式不对怎么办?
|
|
772
|
+
|
|
773
|
+
A: 配置 `dataMapping` 指定字段映射:
|
|
774
|
+
|
|
775
|
+
{
|
|
776
|
+
data: 'yourLogic',
|
|
777
|
+
dataMapping: {
|
|
778
|
+
labelField: 'yourLabelField',
|
|
779
|
+
valueField: 'yourValueField'
|
|
780
|
+
}
|
|
781
|
+
}### Q4: 如何获取 ECharts 实例进行高级操作?
|
|
782
|
+
|
|
783
|
+
A: 通过 `ref` 获取 `chartInstance`:
|
|
784
|
+
|
|
785
|
+
const chartRef = ref(null)
|
|
786
|
+
// 获取实例
|
|
787
|
+
const instance = chartRef.value?.chartInstance
|
|
788
|
+
// 调用 ECharts API
|
|
789
|
+
instance?.setOption({...})---
|
|
790
|
+
|
|
791
|
+
## 更新日志
|
|
792
|
+
|
|
793
|
+
- **v1.0.0**:初始版本,支持 bar、line、pie 三种图表类型
|
|
794
|
+
|
|
795
|
+
---
|
|
796
|
+
|
|
797
|
+
**文档版本**:1.0.0
|
|
798
|
+
**最后更新**:2024-01-XX
|