vue2-client 1.17.44 → 1.17.45
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/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/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/XReportHospitalizationDemo.vue +45 -0
- 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/XReportTrGroup.vue +6 -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 -732
- 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 -313
- 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/src-base-client/components/his/XCharge/README.md +0 -0
- package/src-base-client/components/his/XCharge/XCharge.vue +0 -0
- package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
|
@@ -1,732 +1,732 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 当expandedGrid存在时渲染带有expandedRowRender的表格 -->
|
|
3
|
-
<s-table
|
|
4
|
-
v-if="tableContext.expandedGrid"
|
|
5
|
-
ref="expandableTable"
|
|
6
|
-
:id="tableContext.uniqueId"
|
|
7
|
-
:alert="true"
|
|
8
|
-
:columns="realTableColumns"
|
|
9
|
-
:data="loadData()"
|
|
10
|
-
:rowKey="tableContext.rowKey"
|
|
11
|
-
:showSummary="tableContext.showSummary"
|
|
12
|
-
:rowSelection="tableContext.rowSelection"
|
|
13
|
-
:scroll="{ x: tableContext.scrollXWidth, y: tableContext.scrollYHeight }"
|
|
14
|
-
:showPagination="tableContext.showPagination"
|
|
15
|
-
:hidePagination="tableContext.simpleMode"
|
|
16
|
-
:customPagination="tableContext.customPagination"
|
|
17
|
-
:showSelected="!tableContext.simpleMode"
|
|
18
|
-
:pageSize="tableContext.simpleMode ? 1000 : undefined"
|
|
19
|
-
:pageMaxSize="tableContext.pageMaxSize"
|
|
20
|
-
:setScrollYHeight="tableContext.setScrollYHeight"
|
|
21
|
-
:selectRowMode="tableContext.selectRowMode"
|
|
22
|
-
:size="tableContext.tableSize"
|
|
23
|
-
:components="components"
|
|
24
|
-
:rowStyleFunction="tableContext.rowStyleFunction"
|
|
25
|
-
@beforeDataChange="beforeDataChange"
|
|
26
|
-
@expand="onExpand"
|
|
27
|
-
@rowClick="handleRowClick"
|
|
28
|
-
>
|
|
29
|
-
<template
|
|
30
|
-
v-for="(item, c_index) in realTableColumns"
|
|
31
|
-
:slot="item.dataIndex"
|
|
32
|
-
slot-scope="text, record, index">
|
|
33
|
-
<template v-if="tableContext.isEditMode && getFromItem(item.dataIndex,text, record, index)">
|
|
34
|
-
<x-form-item
|
|
35
|
-
class="innerTable"
|
|
36
|
-
:style="{ paddingTop: 0, paddingBottom: 0, paddingLeft: 0, paddingRight: 0 }"
|
|
37
|
-
:form="record"
|
|
38
|
-
:attr="getFromItem(item.dataIndex,text, record, index)"
|
|
39
|
-
:service-name="tableContext.serviceName"
|
|
40
|
-
mode="新增/修改"
|
|
41
|
-
:env="tableContext.env"
|
|
42
|
-
:setForm="(obj)=>tableContext.setForm(record,obj)"
|
|
43
|
-
@rowChoose="(row, attr, callback) => tableContext.rowChoose(row, attr, callback, record)"
|
|
44
|
-
@x-form-item-emit-func="(func, attr, value) => handleFormItemEvent(func, attr, value, record, index)"
|
|
45
|
-
:showLabel="false"
|
|
46
|
-
:key="'editRow-' + c_index"
|
|
47
|
-
:row-index="index"
|
|
48
|
-
/>
|
|
49
|
-
</template>
|
|
50
|
-
<span v-else-if="item.slotType === 'rate'" :key="'rate-' + c_index">
|
|
51
|
-
<x-rate
|
|
52
|
-
:value="text"
|
|
53
|
-
:disabled="true"
|
|
54
|
-
:allow-half="item.allowHalf"
|
|
55
|
-
:icon="item.rateIcon"
|
|
56
|
-
:max-count="item.maxCount"
|
|
57
|
-
style="zoom:0.9"/>
|
|
58
|
-
</span>
|
|
59
|
-
<span v-else-if="item.slotType === 'index'" :key="'index-' + c_index">
|
|
60
|
-
{{ index + 1 }}
|
|
61
|
-
</span>
|
|
62
|
-
<CustomFuncCel
|
|
63
|
-
:text="text"
|
|
64
|
-
:record="text"
|
|
65
|
-
:index="index"
|
|
66
|
-
:item="item"
|
|
67
|
-
:localDataSource="activeTable?.localDataSource"
|
|
68
|
-
v-else-if="item.slotCustomFunction"
|
|
69
|
-
:key="'customJs-' + c_index"></CustomFuncCel>
|
|
70
|
-
<span v-else-if="item.slotType === 'link'" :key="'link-' + c_index">
|
|
71
|
-
<a @click="tableContext.columnClick(item.dataIndex,text,record)">{{ text }}</a>
|
|
72
|
-
</span>
|
|
73
|
-
<span v-else-if="item.slotType === 'gotoUserDetail'" :key="'gotoUserDetail-' + c_index">
|
|
74
|
-
<a @click="tableContext.gotoUserDetail(item.dataIndex,text,record)">{{ text }}</a>
|
|
75
|
-
</span>
|
|
76
|
-
<span v-else-if="['ellipsis','fixed'].includes(item.slotType)" :key="'ellipsis-' + c_index">
|
|
77
|
-
<span>{{ text === '' ? '--' : text }}</span>
|
|
78
|
-
</span>
|
|
79
|
-
<span v-else-if="item.slotType === 'badge'" :key="'badge-' + c_index">
|
|
80
|
-
<x-badge
|
|
81
|
-
:service-name="tableContext.serviceName"
|
|
82
|
-
:env="tableContext.env"
|
|
83
|
-
v-if="text !== null && text !== undefined"
|
|
84
|
-
:badge-key="item.slotKeyMap"
|
|
85
|
-
:value="text"/>
|
|
86
|
-
</span>
|
|
87
|
-
<span v-else-if="item.slotType === 'date'" :key="'date-' + c_index">
|
|
88
|
-
{{ format(text, 'yyyy-MM-dd') }}
|
|
89
|
-
</span>
|
|
90
|
-
<span v-else-if="item.slotType === 'dateTime'" :key="'dateTime-' + c_index">
|
|
91
|
-
{{ format(text, 'yyyy-MM-dd hh:mm:ss') }}
|
|
92
|
-
</span>
|
|
93
|
-
<span v-else-if="item.slotType === 'towDecimal'" :key="'towDecimal-' + c_index">
|
|
94
|
-
{{ numberFormat(text, 2) }}
|
|
95
|
-
</span>
|
|
96
|
-
<span v-else-if="item.slotType === 'fourDecimal'" :key="'fourDecimal-' + c_index">
|
|
97
|
-
{{ numberFormat(text, 4) }}
|
|
98
|
-
</span>
|
|
99
|
-
<span v-else-if="item.slotType === 'int'" :key="'int-' + c_index">
|
|
100
|
-
{{ numberFormat(text, 0) }}
|
|
101
|
-
</span>
|
|
102
|
-
<span v-else-if="item.slotType === 'action'" :key="'action-' + c_index">
|
|
103
|
-
<template v-if="item.actionArr && item.actionArr.length > 0">
|
|
104
|
-
<a-dropdown placement="bottomCenter" :getPopupContainer=" triggerNode => { return triggerNode.parentNode } ">
|
|
105
|
-
<a class="ant-dropdown-link" @click="e => e.preventDefault()">
|
|
106
|
-
{{ item.scopedSlots?.customRender || item.slotValue }} <a-icon type="down"/>
|
|
107
|
-
</a>
|
|
108
|
-
<a-menu slot="overlay" style="min-width: 60px">
|
|
109
|
-
<a-menu-item
|
|
110
|
-
v-for="(action_item, actionIndex) in item.actionArr"
|
|
111
|
-
:key="actionIndex"
|
|
112
|
-
v-show="!action_item.customFunction || tableContext.customFunctionShow(action_item.customFunction,record,c_index)">
|
|
113
|
-
<a
|
|
114
|
-
style="text-align: center"
|
|
115
|
-
@click="tableContext.action(record, item.dataIndex, action_item.func)"
|
|
116
|
-
>{{ action_item.text }}</a>
|
|
117
|
-
</a-menu-item>
|
|
118
|
-
</a-menu>
|
|
119
|
-
</a-dropdown>
|
|
120
|
-
</template>
|
|
121
|
-
<template v-if="!item.actionArr || item.actionArr.length === 0">
|
|
122
|
-
<a @click="tableContext.action(record, item.dataIndex,'action', index)">{{ item.slotValue }}</a>
|
|
123
|
-
</template>
|
|
124
|
-
</span>
|
|
125
|
-
</template>
|
|
126
|
-
<template slot="expandedRowRender" slot-scope="record">
|
|
127
|
-
<slot
|
|
128
|
-
name="expandedRowRender"
|
|
129
|
-
:selectedRowKeys="tableContext.selectedRowKeys"
|
|
130
|
-
:selectedRows="tableContext.selectedRows"
|
|
131
|
-
:record="record"
|
|
132
|
-
></slot>
|
|
133
|
-
</template>
|
|
134
|
-
<template slot="footer">
|
|
135
|
-
<slot
|
|
136
|
-
name="footer"
|
|
137
|
-
:selectedRowKeys="tableContext.selectedRowKeys"
|
|
138
|
-
:selectedRows="tableContext.selectedRows"></slot>
|
|
139
|
-
</template>
|
|
140
|
-
</s-table>
|
|
141
|
-
|
|
142
|
-
<!-- 当expandedGrid不存在时渲染不带expandedRowRender的表格 -->
|
|
143
|
-
<s-table
|
|
144
|
-
v-else
|
|
145
|
-
ref="simpleTable"
|
|
146
|
-
:id="tableContext.uniqueId"
|
|
147
|
-
:alert="true"
|
|
148
|
-
:columns="realTableColumns"
|
|
149
|
-
:data="loadData()"
|
|
150
|
-
:rowKey="tableContext.rowKey"
|
|
151
|
-
:showSummary="tableContext.showSummary"
|
|
152
|
-
:rowSelection="tableContext.rowSelection"
|
|
153
|
-
:scroll="{ x: tableContext.scrollXWidth, y: tableContext.scrollYHeight }"
|
|
154
|
-
:showPagination="tableContext.showPagination"
|
|
155
|
-
:hidePagination="tableContext.simpleMode"
|
|
156
|
-
:customPagination="tableContext.customPagination"
|
|
157
|
-
:showSelected="!tableContext.simpleMode"
|
|
158
|
-
:pageSize="tableContext.simpleMode ? 1000 : undefined"
|
|
159
|
-
:pageMaxSize="tableContext.pageMaxSize"
|
|
160
|
-
:setScrollYHeight="tableContext.setScrollYHeight"
|
|
161
|
-
:selectRowMode="tableContext.selectRowMode"
|
|
162
|
-
:size="tableContext.tableSize"
|
|
163
|
-
:components="components"
|
|
164
|
-
:rowStyleFunction="tableContext.rowStyleFunction"
|
|
165
|
-
@rowClick="handleRowClick"
|
|
166
|
-
@beforeDataChange="beforeDataChange"
|
|
167
|
-
>
|
|
168
|
-
<template
|
|
169
|
-
v-for="(item, c_index) in realTableColumns"
|
|
170
|
-
:slot="item.dataIndex"
|
|
171
|
-
slot-scope="text, record, index">
|
|
172
|
-
<template v-if="tableContext.isEditMode && getFromItem(item.dataIndex,text, record, index)">
|
|
173
|
-
<x-form-item
|
|
174
|
-
class="innerTable"
|
|
175
|
-
:style="{ paddingTop: 0, paddingBottom: 0, paddingLeft: 0, paddingRight: 0 }"
|
|
176
|
-
:form="record"
|
|
177
|
-
:attr="getFromItem(item.dataIndex,text, record, index)"
|
|
178
|
-
:service-name="tableContext.serviceName"
|
|
179
|
-
mode="新增/修改"
|
|
180
|
-
:env="tableContext.env"
|
|
181
|
-
:setForm="(obj)=>tableContext.setForm(record,obj)"
|
|
182
|
-
@rowChoose="(row, attr, callback) => tableContext.rowChoose(row, attr, callback, record)"
|
|
183
|
-
@x-form-item-emit-func="(func, attr, value) => handleFormItemEvent(func, attr, value, record, index)"
|
|
184
|
-
:showLabel="false"
|
|
185
|
-
:key="'editRow-' + c_index"
|
|
186
|
-
:row-index="index"
|
|
187
|
-
/>
|
|
188
|
-
</template>
|
|
189
|
-
<span v-else-if="item.slotType === 'rate'" :key="'rate-' + c_index">
|
|
190
|
-
<x-rate
|
|
191
|
-
:value="text"
|
|
192
|
-
:disabled="true"
|
|
193
|
-
:allow-half="item.allowHalf"
|
|
194
|
-
:icon="item.rateIcon"
|
|
195
|
-
:max-count="item.maxCount"
|
|
196
|
-
style="zoom:0.9"/>
|
|
197
|
-
</span>
|
|
198
|
-
<span v-else-if="item.slotType === 'index'" :key="'index-' + c_index">
|
|
199
|
-
{{ index + 1 }}
|
|
200
|
-
</span>
|
|
201
|
-
<CustomFuncCel
|
|
202
|
-
:text="text"
|
|
203
|
-
:record="text"
|
|
204
|
-
:index="index"
|
|
205
|
-
:item="item"
|
|
206
|
-
:localDataSource="activeTable?.localDataSource"
|
|
207
|
-
v-else-if="item.slotCustomFunction"
|
|
208
|
-
:key="'customJs-' + c_index"></CustomFuncCel>
|
|
209
|
-
<span v-else-if="item.slotType === 'link'" :key="'link-' + c_index">
|
|
210
|
-
<a @click="tableContext.columnClick(item.dataIndex,text,record)">{{ text }}</a>
|
|
211
|
-
</span>
|
|
212
|
-
<span v-else-if="item.slotType === 'gotoUserDetail'" :key="'gotoUserDetail-' + c_index">
|
|
213
|
-
<a @click="tableContext.gotoUserDetail(item.dataIndex,text,record)">{{ text }}</a>
|
|
214
|
-
</span>
|
|
215
|
-
<span v-else-if="['ellipsis','fixed'].includes(item.slotType)" :key="'ellipsis-' + c_index">
|
|
216
|
-
<!-- <ellipsis :length="item.slotValue" tooltip>{{ text === '' ? '--' : text }}</ellipsis> -->
|
|
217
|
-
<span>{{ text === '' ? '--' : text }}</span>
|
|
218
|
-
</span>
|
|
219
|
-
<span v-else-if="item.slotType === 'progress'" :key="'progress-' + c_index">
|
|
220
|
-
<!-- websocket-id (配置名称-字段名称-用户id-数据行id) -->
|
|
221
|
-
<x-web-socket-progress
|
|
222
|
-
v-if="item.webSocket"
|
|
223
|
-
:key="`${tableContext.requestParameters?.pageNo || 1}-${item.dataIndex}-${record[tableContext.rowKey] || index}`"
|
|
224
|
-
:websocket-id="`${queryParamsName}-${item.dataIndex}-${currUser.id}-${record[tableContext.rowKey] || index}`"
|
|
225
|
-
:initial-value="text || 0"
|
|
226
|
-
@progress-updated="(data) => handleProgressUpdated(data, record, item.dataIndex)"
|
|
227
|
-
/>
|
|
228
|
-
<!-- 表格进度组件 -->
|
|
229
|
-
<a-progress v-else :percent="text" status="active" style="padding-right: 20px;" />
|
|
230
|
-
</span>
|
|
231
|
-
<span v-else-if="item.slotType === 'badge'" :key="'badge-' + c_index">
|
|
232
|
-
<x-badge
|
|
233
|
-
:service-name="tableContext.serviceName"
|
|
234
|
-
:env="tableContext.env"
|
|
235
|
-
v-if="text !== null && text !== undefined"
|
|
236
|
-
:badge-key="item.slotKeyMap"
|
|
237
|
-
:value="text"/>
|
|
238
|
-
</span>
|
|
239
|
-
<span v-else-if="item.slotType === 'date'" :key="'date-' + c_index">
|
|
240
|
-
{{ format(text, 'yyyy-MM-dd') }}
|
|
241
|
-
</span>
|
|
242
|
-
<span v-else-if="item.slotType === 'dateTime'" :key="'dateTime-' + c_index">
|
|
243
|
-
{{ format(text, 'yyyy-MM-dd hh:mm:ss') }}
|
|
244
|
-
</span>
|
|
245
|
-
<span v-else-if="item.slotType === 'towDecimal'" :key="'towDecimal-' + c_index">
|
|
246
|
-
{{ numberFormat(text, 2) }}
|
|
247
|
-
</span>
|
|
248
|
-
<span v-else-if="item.slotType === 'fourDecimal'" :key="'fourDecimal-' + c_index">
|
|
249
|
-
{{ numberFormat(text, 4) }}
|
|
250
|
-
</span>
|
|
251
|
-
<span v-else-if="item.slotType === 'int'" :key="'int-' + c_index">
|
|
252
|
-
{{ numberFormat(text, 0) }}
|
|
253
|
-
</span>
|
|
254
|
-
<span v-else-if="item.slotType === 'action'" :key="'action-' + c_index">
|
|
255
|
-
<template v-if="item.actionArr && item.actionArr.length > 0">
|
|
256
|
-
<a-dropdown
|
|
257
|
-
placement="bottomRight"
|
|
258
|
-
:overlayStyle="{
|
|
259
|
-
whiteSpace: 'nowrap',
|
|
260
|
-
maxWidth: '250px',
|
|
261
|
-
overflow: 'hidden',
|
|
262
|
-
textOverflow: 'ellipsis'
|
|
263
|
-
}"
|
|
264
|
-
>
|
|
265
|
-
<a class="ant-dropdown-link" @click="e => e.preventDefault()">
|
|
266
|
-
{{ item.scopedSlots?.customRender || item.slotValue }} <a-icon type="down"/>
|
|
267
|
-
</a>
|
|
268
|
-
<a-menu slot="overlay" style="min-width: 60px">
|
|
269
|
-
<a-menu-item
|
|
270
|
-
v-for="(action_item, actionIndex) in item.actionArr"
|
|
271
|
-
:key="actionIndex"
|
|
272
|
-
v-show="!action_item.customFunction || tableContext.customFunctionShow(action_item.customFunction,record,c_index)">
|
|
273
|
-
<a
|
|
274
|
-
style="text-align: center"
|
|
275
|
-
@click="tableContext.action(record, item.dataIndex, action_item.func)"
|
|
276
|
-
>{{ action_item.text }}</a>
|
|
277
|
-
</a-menu-item>
|
|
278
|
-
</a-menu>
|
|
279
|
-
</a-dropdown>
|
|
280
|
-
</template>
|
|
281
|
-
<template v-if="!item.actionArr || item.actionArr.length === 0">
|
|
282
|
-
<a @click="tableContext.action(record, item.dataIndex,'action', index)">{{ item.slotValue }}</a>
|
|
283
|
-
</template>
|
|
284
|
-
</span>
|
|
285
|
-
</template>
|
|
286
|
-
<template slot="footer">
|
|
287
|
-
<slot
|
|
288
|
-
name="footer"
|
|
289
|
-
:selectedRowKeys="tableContext.selectedRowKeys"
|
|
290
|
-
:selectedRows="tableContext.selectedRows"></slot>
|
|
291
|
-
</template>
|
|
292
|
-
</s-table>
|
|
293
|
-
</template>
|
|
294
|
-
|
|
295
|
-
<script>
|
|
296
|
-
import { Ellipsis, STable } from '@vue2-client/components'
|
|
297
|
-
import { formatDate } from '@vue2-client/utils/util'
|
|
298
|
-
import XBadge from '@vue2-client/base-client/components/common/XBadge'
|
|
299
|
-
import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
|
|
300
|
-
import CustomFuncCel from '@vue2-client/base-client/components/common/XTable/CustomFuncCel.vue'
|
|
301
|
-
import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
|
|
302
|
-
import XRate from '@vue2-client/base-client/components/common/XRate/index.vue'
|
|
303
|
-
import XWebSocketProgress from '@vue2-client/base-client/components/common/XWebSocketProgress'
|
|
304
|
-
import VueDraggableResizable from 'vue-draggable-resizable'
|
|
305
|
-
import { mapState } from 'vuex'
|
|
306
|
-
|
|
307
|
-
export default {
|
|
308
|
-
name: 'XTableWrapper',
|
|
309
|
-
components: {
|
|
310
|
-
Ellipsis,
|
|
311
|
-
STable,
|
|
312
|
-
XBadge,
|
|
313
|
-
XFormItem,
|
|
314
|
-
XRate,
|
|
315
|
-
CustomFuncCel,
|
|
316
|
-
XWebSocketProgress,
|
|
317
|
-
VueDraggableResizable
|
|
318
|
-
},
|
|
319
|
-
data () {
|
|
320
|
-
return {
|
|
321
|
-
isDragging: false, // 添加拖拽状态标记
|
|
322
|
-
// eslint-disable-next-line vue/no-reserved-keys
|
|
323
|
-
_rafId: null // 添加requestAnimationFrame ID标记
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
computed: {
|
|
327
|
-
...mapState('account', { currUser: 'user' }),
|
|
328
|
-
localDataSource () {
|
|
329
|
-
return this.activeTable?.localDataSource
|
|
330
|
-
},
|
|
331
|
-
// 获取当前活动的表格实例
|
|
332
|
-
activeTable () {
|
|
333
|
-
return this.tableContext.expandedGrid ? this.$refs.expandableTable : this.$refs.simpleTable
|
|
334
|
-
},
|
|
335
|
-
realTableColumns () {
|
|
336
|
-
// 1. 先过滤列并设置 ellipsis 属性
|
|
337
|
-
const filteredColumns = this.tableContext.tableColumns
|
|
338
|
-
.filter(item => item.slotType !== 'action' || !this.disableAction)
|
|
339
|
-
.map((item) => {
|
|
340
|
-
// 设置 ellipsis 属性
|
|
341
|
-
if (['ellipsis', 'badge', 'towDecimal', 'date', 'dateTime', 'fourDecimal', 'int'].includes(item.slotType)) {
|
|
342
|
-
item.ellipsis = true
|
|
343
|
-
}
|
|
344
|
-
return item
|
|
345
|
-
})
|
|
346
|
-
|
|
347
|
-
// 2. 分组:左固定、普通、右固定
|
|
348
|
-
const leftFixedColumns = []
|
|
349
|
-
const normalColumns = []
|
|
350
|
-
const rightFixedColumns = []
|
|
351
|
-
|
|
352
|
-
filteredColumns.forEach(col => {
|
|
353
|
-
if (col.fixed === 'left') {
|
|
354
|
-
leftFixedColumns.push(col)
|
|
355
|
-
} else if (col.fixed === 'right') {
|
|
356
|
-
rightFixedColumns.push(col)
|
|
357
|
-
} else {
|
|
358
|
-
normalColumns.push(col)
|
|
359
|
-
}
|
|
360
|
-
})
|
|
361
|
-
|
|
362
|
-
// 3. 按顺序合并:左固定 + 普通 + 右固定
|
|
363
|
-
return [...leftFixedColumns, ...normalColumns, ...rightFixedColumns]
|
|
364
|
-
},
|
|
365
|
-
components () {
|
|
366
|
-
return {
|
|
367
|
-
header: {
|
|
368
|
-
cell: (h, props, children) => {
|
|
369
|
-
const { key, ...restProps } = props
|
|
370
|
-
// 此处的this.realTableColumns 是定义的table的表头属性变量
|
|
371
|
-
const col = this.realTableColumns.find((col) => {
|
|
372
|
-
const k = col.dataIndex || col.key
|
|
373
|
-
return k === key
|
|
374
|
-
})
|
|
375
|
-
if (!col || !col.width || col.slotType === 'action') {
|
|
376
|
-
if (children) {
|
|
377
|
-
return h('th', { ...restProps }, [...children])
|
|
378
|
-
} else {
|
|
379
|
-
return h('th', { ...restProps })
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// 创建一个防止点击排序的容器
|
|
384
|
-
const preventSortProps = {
|
|
385
|
-
style: {
|
|
386
|
-
position: 'absolute',
|
|
387
|
-
right: 0,
|
|
388
|
-
top: 0,
|
|
389
|
-
width: '20px',
|
|
390
|
-
height: '100%',
|
|
391
|
-
zIndex: 10
|
|
392
|
-
},
|
|
393
|
-
on: {
|
|
394
|
-
mousedown: (e) => {
|
|
395
|
-
e.stopPropagation()
|
|
396
|
-
e.preventDefault()
|
|
397
|
-
this.isDragging = true
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
const dragProps = {
|
|
403
|
-
key: col.dataIndex || col.key,
|
|
404
|
-
class: 'table-draggable-handle',
|
|
405
|
-
attrs: {
|
|
406
|
-
w: 10,
|
|
407
|
-
x: col.width,
|
|
408
|
-
z: 1,
|
|
409
|
-
axis: 'x',
|
|
410
|
-
draggable: true,
|
|
411
|
-
resizable: false,
|
|
412
|
-
},
|
|
413
|
-
on: {
|
|
414
|
-
dragging: (x, y) => {
|
|
415
|
-
// 使用requestAnimationFrame优化性能,减少卡顿
|
|
416
|
-
if (!this._rafId) {
|
|
417
|
-
this._rafId = requestAnimationFrame(() => {
|
|
418
|
-
col.width = Math.max(x, 50) // 设置最小列宽为50px
|
|
419
|
-
this.isDragging = true // 设置拖拽状态
|
|
420
|
-
this._rafId = null
|
|
421
|
-
})
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
mousedown: (e) => {
|
|
425
|
-
// 阻止事件冒泡,防止触发排序
|
|
426
|
-
e.stopPropagation()
|
|
427
|
-
e.preventDefault()
|
|
428
|
-
this.isDragging = true // 设置拖拽状态
|
|
429
|
-
},
|
|
430
|
-
dragstop: () => {
|
|
431
|
-
// 清除可能存在的动画帧请求
|
|
432
|
-
if (this._rafId) {
|
|
433
|
-
cancelAnimationFrame(this._rafId)
|
|
434
|
-
this._rafId = null
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// 拖拽结束时,延迟重置拖拽状态,以防止排序被触发
|
|
438
|
-
setTimeout(() => {
|
|
439
|
-
this.isDragging = false
|
|
440
|
-
}, 100)
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
nativeOn: {
|
|
444
|
-
mousedown: (e) => {
|
|
445
|
-
e.stopPropagation()
|
|
446
|
-
e.preventDefault()
|
|
447
|
-
this.isDragging = true // 设置拖拽状态
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
const preventSort = h('div', preventSortProps)
|
|
453
|
-
const drag = h('vue-draggable-resizable', { ...dragProps })
|
|
454
|
-
|
|
455
|
-
// 修改th的点击事件,在拖拽状态下阻止排序
|
|
456
|
-
const newRestProps = { ...restProps }
|
|
457
|
-
const originalClick = newRestProps.on && newRestProps.on.click
|
|
458
|
-
if (originalClick) {
|
|
459
|
-
newRestProps.on = {
|
|
460
|
-
...newRestProps.on,
|
|
461
|
-
click: (e) => {
|
|
462
|
-
if (this.isDragging) {
|
|
463
|
-
e.stopPropagation()
|
|
464
|
-
e.preventDefault()
|
|
465
|
-
return
|
|
466
|
-
}
|
|
467
|
-
originalClick(e)
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
if (children) {
|
|
473
|
-
return h('th', { ...newRestProps, class: 'resize-table-th' }, [...children, preventSort, drag])
|
|
474
|
-
} else {
|
|
475
|
-
return h('th', { ...newRestProps, class: 'resize-table-th' }, [preventSort, drag])
|
|
476
|
-
}
|
|
477
|
-
},
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
},
|
|
482
|
-
props: {
|
|
483
|
-
// 查询配置文件名
|
|
484
|
-
queryParamsName: {
|
|
485
|
-
type: String,
|
|
486
|
-
default: () => {
|
|
487
|
-
return ''
|
|
488
|
-
}
|
|
489
|
-
},
|
|
490
|
-
loadSelectedData: {
|
|
491
|
-
type: Boolean,
|
|
492
|
-
required: false,
|
|
493
|
-
default: false
|
|
494
|
-
},
|
|
495
|
-
disableAction: {
|
|
496
|
-
type: Boolean,
|
|
497
|
-
default: false
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
inject: ['tableContext'],
|
|
501
|
-
methods: {
|
|
502
|
-
handleRowClick (record) {
|
|
503
|
-
this.$emit('rowClick', record)
|
|
504
|
-
},
|
|
505
|
-
beforeDataChange (record) {
|
|
506
|
-
this.$emit('beforeDataChange', record)
|
|
507
|
-
},
|
|
508
|
-
onExpand (expanded, record) {
|
|
509
|
-
this.$emit('expand', expanded, record)
|
|
510
|
-
},
|
|
511
|
-
setLocalDataSource (data) {
|
|
512
|
-
this.activeTable?.setLocalDataSource(data)
|
|
513
|
-
},
|
|
514
|
-
loadData () {
|
|
515
|
-
if (this.loadSelectedData) {
|
|
516
|
-
return this.loadSelectedDataGen
|
|
517
|
-
} else {
|
|
518
|
-
return this.tableContext.loadData
|
|
519
|
-
}
|
|
520
|
-
},
|
|
521
|
-
loadSelectedDataGen (requestParameters) {
|
|
522
|
-
console.log('loadSelectedDataGen', {
|
|
523
|
-
pageNo: requestParameters?.pageNo,
|
|
524
|
-
pageSize: requestParameters?.pageSize
|
|
525
|
-
})
|
|
526
|
-
|
|
527
|
-
const { pageNo = 1, pageSize = 10 } = requestParameters || {}
|
|
528
|
-
const startIndex = (pageNo - 1) * pageSize
|
|
529
|
-
const endIndex = startIndex + pageSize
|
|
530
|
-
const paginatedData = this.tableContext.selectedRows.slice(startIndex, endIndex)
|
|
531
|
-
|
|
532
|
-
return new Promise((resolve) => {
|
|
533
|
-
resolve({
|
|
534
|
-
data: paginatedData,
|
|
535
|
-
pageNo,
|
|
536
|
-
pageSize,
|
|
537
|
-
totalPage: Math.ceil(this.tableContext.selectedRows.length / pageSize),
|
|
538
|
-
totalCount: this.tableContext.selectedRows.length
|
|
539
|
-
})
|
|
540
|
-
})
|
|
541
|
-
},
|
|
542
|
-
updateSelect (selectedRowKeys, selectedRows) {
|
|
543
|
-
this.activeTable?.updateSelect(selectedRowKeys, selectedRows)
|
|
544
|
-
},
|
|
545
|
-
clearSelected () {
|
|
546
|
-
this.activeTable?.clearSelected()
|
|
547
|
-
},
|
|
548
|
-
refresh (bool) {
|
|
549
|
-
this.activeTable?.refresh(bool)
|
|
550
|
-
},
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* 格式化日期
|
|
554
|
-
* @param date 日期字符串
|
|
555
|
-
* @param format 格式化方式
|
|
556
|
-
*/
|
|
557
|
-
format (date, format) {
|
|
558
|
-
return formatDate(date, format)
|
|
559
|
-
},
|
|
560
|
-
/**
|
|
561
|
-
* 格式化数字
|
|
562
|
-
* @param number string 或者 number
|
|
563
|
-
* @param decimalPlaces 小数位数
|
|
564
|
-
*/
|
|
565
|
-
numberFormat (number, decimalPlaces = 2) {
|
|
566
|
-
const value = parseFloat(number)
|
|
567
|
-
if (!isNaN(value)) {
|
|
568
|
-
return value.toFixed(decimalPlaces)
|
|
569
|
-
} else {
|
|
570
|
-
return ''
|
|
571
|
-
}
|
|
572
|
-
},
|
|
573
|
-
getFromItem (model, text, record, index) {
|
|
574
|
-
const aa = this.tableContext.formItems.reduce((acc, item) => {
|
|
575
|
-
if (item.type === 'group') {
|
|
576
|
-
const foundItem = item.groupItems.find(_item => _item.model === model && _item.editRow)
|
|
577
|
-
if (foundItem) {
|
|
578
|
-
acc = foundItem
|
|
579
|
-
}
|
|
580
|
-
} else if (item.model === model && item.editRow) {
|
|
581
|
-
acc = item
|
|
582
|
-
}
|
|
583
|
-
return acc
|
|
584
|
-
}, null)
|
|
585
|
-
if (aa) {
|
|
586
|
-
const tempConfig = JSON.parse(JSON.stringify(aa))
|
|
587
|
-
// 如果找到了字段
|
|
588
|
-
const ColumnIndex = this.realTableColumns.findIndex(item => item.dataIndex === model)
|
|
589
|
-
// 并且表单项是日期框
|
|
590
|
-
if (ColumnIndex !== -1 && ['yearPicker', 'monthPicker', 'datePicker', 'rangePicker'].includes(tempConfig.type)) {
|
|
591
|
-
// 修改他的列宽
|
|
592
|
-
this.realTableColumns[ColumnIndex].width = 220
|
|
593
|
-
}
|
|
594
|
-
// 如果有检验规则检验是数字
|
|
595
|
-
if (ColumnIndex !== -1 && ['number', 'integer', 'float'].includes(tempConfig?.rule?.type)) {
|
|
596
|
-
// 修改他的列宽
|
|
597
|
-
tempConfig.numberInput = true
|
|
598
|
-
}
|
|
599
|
-
if (tempConfig.editRowShowFunc) {
|
|
600
|
-
if (executeStrFunctionByContext(this.tableContext, tempConfig.editRowShowFunc, [text, record, index, tempConfig])) {
|
|
601
|
-
return tempConfig
|
|
602
|
-
}
|
|
603
|
-
} else {
|
|
604
|
-
return tempConfig
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
return false
|
|
608
|
-
},
|
|
609
|
-
handleResizeColumn (w, col) {
|
|
610
|
-
col.width = w
|
|
611
|
-
},
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* 处理进度更新事件
|
|
615
|
-
* @param {Object} data 进度数据
|
|
616
|
-
* @param {Object} record 行数据
|
|
617
|
-
* @param {String} dataIndex 列字段名
|
|
618
|
-
*/
|
|
619
|
-
handleProgressUpdated (data, record, dataIndex) {
|
|
620
|
-
// 更新行数据中的进度值
|
|
621
|
-
if (record && dataIndex) {
|
|
622
|
-
this.$set(record, dataIndex, data.value)
|
|
623
|
-
}
|
|
624
|
-
},
|
|
625
|
-
/**
|
|
626
|
-
* 处理表单项事件,增强事件数据
|
|
627
|
-
* @param {String} func 事件函数名
|
|
628
|
-
* @param {Object} attr 字段配置
|
|
629
|
-
* @param {*} value 字段值
|
|
630
|
-
* @param {Object} record 当前行数据
|
|
631
|
-
* @param {Number} index 当前行索引
|
|
632
|
-
*/
|
|
633
|
-
handleFormItemEvent (func, attr, value, record, index) {
|
|
634
|
-
// 获取表格数据源
|
|
635
|
-
const dataSource = this.localDataSource || []
|
|
636
|
-
|
|
637
|
-
// 计算下一行的索引和数据
|
|
638
|
-
const nextIndex = index + 1
|
|
639
|
-
const nextRecord = nextIndex < dataSource.length ? dataSource[nextIndex] : null
|
|
640
|
-
|
|
641
|
-
// 构建增强的上下文数据
|
|
642
|
-
const enhancedContext = {
|
|
643
|
-
func,
|
|
644
|
-
attr,
|
|
645
|
-
value,
|
|
646
|
-
currentRecord: record,
|
|
647
|
-
currentIndex: index,
|
|
648
|
-
nextRecord,
|
|
649
|
-
nextIndex: nextRecord ? nextIndex : null,
|
|
650
|
-
tableContext: this.tableContext
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// 调用 tableContext 的事件处理方法
|
|
654
|
-
if (this.tableContext && typeof this.tableContext.handleFormItemEvent === 'function') {
|
|
655
|
-
this.tableContext.handleFormItemEvent(enhancedContext)
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
</script>
|
|
661
|
-
|
|
662
|
-
<style scoped lang="less">
|
|
663
|
-
/* 精确修复表头空白问题 */
|
|
664
|
-
:deep(.ant-table-fixed-header .ant-table-scroll .ant-table-header) {
|
|
665
|
-
margin-bottom: 0 !important;
|
|
666
|
-
overflow-x: hidden !important;
|
|
667
|
-
}
|
|
668
|
-
/* 统一表头行高和垂直对齐 */
|
|
669
|
-
:deep(.ant-table-thead > tr) {
|
|
670
|
-
height: 54px !important;
|
|
671
|
-
line-height: 54px !important;
|
|
672
|
-
}
|
|
673
|
-
:deep(.ant-table-thead > tr > th) {
|
|
674
|
-
padding: 0 16px !important;
|
|
675
|
-
vertical-align: middle !important;
|
|
676
|
-
border-bottom: 1px solid #f0f0f0;
|
|
677
|
-
}
|
|
678
|
-
/* 分页组件不换行 */
|
|
679
|
-
:deep(.ant-pagination > li) {
|
|
680
|
-
white-space: nowrap;
|
|
681
|
-
}
|
|
682
|
-
</style>
|
|
683
|
-
<style>
|
|
684
|
-
/* vue-draggable-resizable 拖动手柄样式 */
|
|
685
|
-
.table-draggable-handle {
|
|
686
|
-
height: 100% !important;
|
|
687
|
-
left: auto !important;
|
|
688
|
-
right: 0;
|
|
689
|
-
cursor: col-resize;
|
|
690
|
-
touch-action: none;
|
|
691
|
-
border: none;
|
|
692
|
-
position: absolute;
|
|
693
|
-
transform: none !important;
|
|
694
|
-
bottom: 0;
|
|
695
|
-
width: 10px !important; /* 减小到10px */
|
|
696
|
-
z-index: 99 !important; /* 提高z-index */
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
/* 拖动手柄的分隔线 */
|
|
700
|
-
.table-draggable-handle::after {
|
|
701
|
-
content: "";
|
|
702
|
-
position: absolute;
|
|
703
|
-
top: 50%;
|
|
704
|
-
height: 20px;
|
|
705
|
-
width: 2px;
|
|
706
|
-
background-color: #e8e8e8;
|
|
707
|
-
transition: background-color 0.2s;
|
|
708
|
-
transform: translateY(-50%);
|
|
709
|
-
right: 0;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
/* 悬停效果 - 只改变颜色 */
|
|
713
|
-
.table-draggable-handle:hover::after {
|
|
714
|
-
background-color: #1890ff;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
/* 拖动时的效果 */
|
|
718
|
-
.table-draggable-handle:active::after {
|
|
719
|
-
background-color: #096dd9;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
/* 表头单元格样式 */
|
|
723
|
-
.resize-table-th {
|
|
724
|
-
position: relative;
|
|
725
|
-
overflow: visible !important; /* 确保内容不被裁剪 */
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
/* 表头单元格悬停时的手柄高亮 */
|
|
729
|
-
.resize-table-th:hover .table-draggable-handle::after {
|
|
730
|
-
background-color: rgba(24, 144, 255, 0.6);
|
|
731
|
-
}
|
|
732
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 当expandedGrid存在时渲染带有expandedRowRender的表格 -->
|
|
3
|
+
<s-table
|
|
4
|
+
v-if="tableContext.expandedGrid"
|
|
5
|
+
ref="expandableTable"
|
|
6
|
+
:id="tableContext.uniqueId"
|
|
7
|
+
:alert="true"
|
|
8
|
+
:columns="realTableColumns"
|
|
9
|
+
:data="loadData()"
|
|
10
|
+
:rowKey="tableContext.rowKey"
|
|
11
|
+
:showSummary="tableContext.showSummary"
|
|
12
|
+
:rowSelection="tableContext.rowSelection"
|
|
13
|
+
:scroll="{ x: tableContext.scrollXWidth, y: tableContext.scrollYHeight }"
|
|
14
|
+
:showPagination="tableContext.showPagination"
|
|
15
|
+
:hidePagination="tableContext.simpleMode"
|
|
16
|
+
:customPagination="tableContext.customPagination"
|
|
17
|
+
:showSelected="!tableContext.simpleMode"
|
|
18
|
+
:pageSize="tableContext.simpleMode ? 1000 : undefined"
|
|
19
|
+
:pageMaxSize="tableContext.pageMaxSize"
|
|
20
|
+
:setScrollYHeight="tableContext.setScrollYHeight"
|
|
21
|
+
:selectRowMode="tableContext.selectRowMode"
|
|
22
|
+
:size="tableContext.tableSize"
|
|
23
|
+
:components="components"
|
|
24
|
+
:rowStyleFunction="tableContext.rowStyleFunction"
|
|
25
|
+
@beforeDataChange="beforeDataChange"
|
|
26
|
+
@expand="onExpand"
|
|
27
|
+
@rowClick="handleRowClick"
|
|
28
|
+
>
|
|
29
|
+
<template
|
|
30
|
+
v-for="(item, c_index) in realTableColumns"
|
|
31
|
+
:slot="item.dataIndex"
|
|
32
|
+
slot-scope="text, record, index">
|
|
33
|
+
<template v-if="tableContext.isEditMode && getFromItem(item.dataIndex,text, record, index)">
|
|
34
|
+
<x-form-item
|
|
35
|
+
class="innerTable"
|
|
36
|
+
:style="{ paddingTop: 0, paddingBottom: 0, paddingLeft: 0, paddingRight: 0 }"
|
|
37
|
+
:form="record"
|
|
38
|
+
:attr="getFromItem(item.dataIndex,text, record, index)"
|
|
39
|
+
:service-name="tableContext.serviceName"
|
|
40
|
+
mode="新增/修改"
|
|
41
|
+
:env="tableContext.env"
|
|
42
|
+
:setForm="(obj)=>tableContext.setForm(record,obj)"
|
|
43
|
+
@rowChoose="(row, attr, callback) => tableContext.rowChoose(row, attr, callback, record)"
|
|
44
|
+
@x-form-item-emit-func="(func, attr, value) => handleFormItemEvent(func, attr, value, record, index)"
|
|
45
|
+
:showLabel="false"
|
|
46
|
+
:key="'editRow-' + c_index"
|
|
47
|
+
:row-index="index"
|
|
48
|
+
/>
|
|
49
|
+
</template>
|
|
50
|
+
<span v-else-if="item.slotType === 'rate'" :key="'rate-' + c_index">
|
|
51
|
+
<x-rate
|
|
52
|
+
:value="text"
|
|
53
|
+
:disabled="true"
|
|
54
|
+
:allow-half="item.allowHalf"
|
|
55
|
+
:icon="item.rateIcon"
|
|
56
|
+
:max-count="item.maxCount"
|
|
57
|
+
style="zoom:0.9"/>
|
|
58
|
+
</span>
|
|
59
|
+
<span v-else-if="item.slotType === 'index'" :key="'index-' + c_index">
|
|
60
|
+
{{ index + 1 }}
|
|
61
|
+
</span>
|
|
62
|
+
<CustomFuncCel
|
|
63
|
+
:text="text"
|
|
64
|
+
:record="text"
|
|
65
|
+
:index="index"
|
|
66
|
+
:item="item"
|
|
67
|
+
:localDataSource="activeTable?.localDataSource"
|
|
68
|
+
v-else-if="item.slotCustomFunction"
|
|
69
|
+
:key="'customJs-' + c_index"></CustomFuncCel>
|
|
70
|
+
<span v-else-if="item.slotType === 'link'" :key="'link-' + c_index">
|
|
71
|
+
<a @click="tableContext.columnClick(item.dataIndex,text,record)">{{ text }}</a>
|
|
72
|
+
</span>
|
|
73
|
+
<span v-else-if="item.slotType === 'gotoUserDetail'" :key="'gotoUserDetail-' + c_index">
|
|
74
|
+
<a @click="tableContext.gotoUserDetail(item.dataIndex,text,record)">{{ text }}</a>
|
|
75
|
+
</span>
|
|
76
|
+
<span v-else-if="['ellipsis','fixed'].includes(item.slotType)" :key="'ellipsis-' + c_index">
|
|
77
|
+
<span>{{ text === '' ? '--' : text }}</span>
|
|
78
|
+
</span>
|
|
79
|
+
<span v-else-if="item.slotType === 'badge'" :key="'badge-' + c_index">
|
|
80
|
+
<x-badge
|
|
81
|
+
:service-name="tableContext.serviceName"
|
|
82
|
+
:env="tableContext.env"
|
|
83
|
+
v-if="text !== null && text !== undefined"
|
|
84
|
+
:badge-key="item.slotKeyMap"
|
|
85
|
+
:value="text"/>
|
|
86
|
+
</span>
|
|
87
|
+
<span v-else-if="item.slotType === 'date'" :key="'date-' + c_index">
|
|
88
|
+
{{ format(text, 'yyyy-MM-dd') }}
|
|
89
|
+
</span>
|
|
90
|
+
<span v-else-if="item.slotType === 'dateTime'" :key="'dateTime-' + c_index">
|
|
91
|
+
{{ format(text, 'yyyy-MM-dd hh:mm:ss') }}
|
|
92
|
+
</span>
|
|
93
|
+
<span v-else-if="item.slotType === 'towDecimal'" :key="'towDecimal-' + c_index">
|
|
94
|
+
{{ numberFormat(text, 2) }}
|
|
95
|
+
</span>
|
|
96
|
+
<span v-else-if="item.slotType === 'fourDecimal'" :key="'fourDecimal-' + c_index">
|
|
97
|
+
{{ numberFormat(text, 4) }}
|
|
98
|
+
</span>
|
|
99
|
+
<span v-else-if="item.slotType === 'int'" :key="'int-' + c_index">
|
|
100
|
+
{{ numberFormat(text, 0) }}
|
|
101
|
+
</span>
|
|
102
|
+
<span v-else-if="item.slotType === 'action'" :key="'action-' + c_index">
|
|
103
|
+
<template v-if="item.actionArr && item.actionArr.length > 0">
|
|
104
|
+
<a-dropdown placement="bottomCenter" :getPopupContainer=" triggerNode => { return triggerNode.parentNode } ">
|
|
105
|
+
<a class="ant-dropdown-link" @click="e => e.preventDefault()">
|
|
106
|
+
{{ item.scopedSlots?.customRender || item.slotValue }} <a-icon type="down"/>
|
|
107
|
+
</a>
|
|
108
|
+
<a-menu slot="overlay" style="min-width: 60px">
|
|
109
|
+
<a-menu-item
|
|
110
|
+
v-for="(action_item, actionIndex) in item.actionArr"
|
|
111
|
+
:key="actionIndex"
|
|
112
|
+
v-show="!action_item.customFunction || tableContext.customFunctionShow(action_item.customFunction,record,c_index)">
|
|
113
|
+
<a
|
|
114
|
+
style="text-align: center"
|
|
115
|
+
@click="tableContext.action(record, item.dataIndex, action_item.func)"
|
|
116
|
+
>{{ action_item.text }}</a>
|
|
117
|
+
</a-menu-item>
|
|
118
|
+
</a-menu>
|
|
119
|
+
</a-dropdown>
|
|
120
|
+
</template>
|
|
121
|
+
<template v-if="!item.actionArr || item.actionArr.length === 0">
|
|
122
|
+
<a @click="tableContext.action(record, item.dataIndex,'action', index)">{{ item.slotValue }}</a>
|
|
123
|
+
</template>
|
|
124
|
+
</span>
|
|
125
|
+
</template>
|
|
126
|
+
<template slot="expandedRowRender" slot-scope="record">
|
|
127
|
+
<slot
|
|
128
|
+
name="expandedRowRender"
|
|
129
|
+
:selectedRowKeys="tableContext.selectedRowKeys"
|
|
130
|
+
:selectedRows="tableContext.selectedRows"
|
|
131
|
+
:record="record"
|
|
132
|
+
></slot>
|
|
133
|
+
</template>
|
|
134
|
+
<template slot="footer">
|
|
135
|
+
<slot
|
|
136
|
+
name="footer"
|
|
137
|
+
:selectedRowKeys="tableContext.selectedRowKeys"
|
|
138
|
+
:selectedRows="tableContext.selectedRows"></slot>
|
|
139
|
+
</template>
|
|
140
|
+
</s-table>
|
|
141
|
+
|
|
142
|
+
<!-- 当expandedGrid不存在时渲染不带expandedRowRender的表格 -->
|
|
143
|
+
<s-table
|
|
144
|
+
v-else
|
|
145
|
+
ref="simpleTable"
|
|
146
|
+
:id="tableContext.uniqueId"
|
|
147
|
+
:alert="true"
|
|
148
|
+
:columns="realTableColumns"
|
|
149
|
+
:data="loadData()"
|
|
150
|
+
:rowKey="tableContext.rowKey"
|
|
151
|
+
:showSummary="tableContext.showSummary"
|
|
152
|
+
:rowSelection="tableContext.rowSelection"
|
|
153
|
+
:scroll="{ x: tableContext.scrollXWidth, y: tableContext.scrollYHeight }"
|
|
154
|
+
:showPagination="tableContext.showPagination"
|
|
155
|
+
:hidePagination="tableContext.simpleMode"
|
|
156
|
+
:customPagination="tableContext.customPagination"
|
|
157
|
+
:showSelected="!tableContext.simpleMode"
|
|
158
|
+
:pageSize="tableContext.simpleMode ? 1000 : undefined"
|
|
159
|
+
:pageMaxSize="tableContext.pageMaxSize"
|
|
160
|
+
:setScrollYHeight="tableContext.setScrollYHeight"
|
|
161
|
+
:selectRowMode="tableContext.selectRowMode"
|
|
162
|
+
:size="tableContext.tableSize"
|
|
163
|
+
:components="components"
|
|
164
|
+
:rowStyleFunction="tableContext.rowStyleFunction"
|
|
165
|
+
@rowClick="handleRowClick"
|
|
166
|
+
@beforeDataChange="beforeDataChange"
|
|
167
|
+
>
|
|
168
|
+
<template
|
|
169
|
+
v-for="(item, c_index) in realTableColumns"
|
|
170
|
+
:slot="item.dataIndex"
|
|
171
|
+
slot-scope="text, record, index">
|
|
172
|
+
<template v-if="tableContext.isEditMode && getFromItem(item.dataIndex,text, record, index)">
|
|
173
|
+
<x-form-item
|
|
174
|
+
class="innerTable"
|
|
175
|
+
:style="{ paddingTop: 0, paddingBottom: 0, paddingLeft: 0, paddingRight: 0 }"
|
|
176
|
+
:form="record"
|
|
177
|
+
:attr="getFromItem(item.dataIndex,text, record, index)"
|
|
178
|
+
:service-name="tableContext.serviceName"
|
|
179
|
+
mode="新增/修改"
|
|
180
|
+
:env="tableContext.env"
|
|
181
|
+
:setForm="(obj)=>tableContext.setForm(record,obj)"
|
|
182
|
+
@rowChoose="(row, attr, callback) => tableContext.rowChoose(row, attr, callback, record)"
|
|
183
|
+
@x-form-item-emit-func="(func, attr, value) => handleFormItemEvent(func, attr, value, record, index)"
|
|
184
|
+
:showLabel="false"
|
|
185
|
+
:key="'editRow-' + c_index"
|
|
186
|
+
:row-index="index"
|
|
187
|
+
/>
|
|
188
|
+
</template>
|
|
189
|
+
<span v-else-if="item.slotType === 'rate'" :key="'rate-' + c_index">
|
|
190
|
+
<x-rate
|
|
191
|
+
:value="text"
|
|
192
|
+
:disabled="true"
|
|
193
|
+
:allow-half="item.allowHalf"
|
|
194
|
+
:icon="item.rateIcon"
|
|
195
|
+
:max-count="item.maxCount"
|
|
196
|
+
style="zoom:0.9"/>
|
|
197
|
+
</span>
|
|
198
|
+
<span v-else-if="item.slotType === 'index'" :key="'index-' + c_index">
|
|
199
|
+
{{ index + 1 }}
|
|
200
|
+
</span>
|
|
201
|
+
<CustomFuncCel
|
|
202
|
+
:text="text"
|
|
203
|
+
:record="text"
|
|
204
|
+
:index="index"
|
|
205
|
+
:item="item"
|
|
206
|
+
:localDataSource="activeTable?.localDataSource"
|
|
207
|
+
v-else-if="item.slotCustomFunction"
|
|
208
|
+
:key="'customJs-' + c_index"></CustomFuncCel>
|
|
209
|
+
<span v-else-if="item.slotType === 'link'" :key="'link-' + c_index">
|
|
210
|
+
<a @click="tableContext.columnClick(item.dataIndex,text,record)">{{ text }}</a>
|
|
211
|
+
</span>
|
|
212
|
+
<span v-else-if="item.slotType === 'gotoUserDetail'" :key="'gotoUserDetail-' + c_index">
|
|
213
|
+
<a @click="tableContext.gotoUserDetail(item.dataIndex,text,record)">{{ text }}</a>
|
|
214
|
+
</span>
|
|
215
|
+
<span v-else-if="['ellipsis','fixed'].includes(item.slotType)" :key="'ellipsis-' + c_index">
|
|
216
|
+
<!-- <ellipsis :length="item.slotValue" tooltip>{{ text === '' ? '--' : text }}</ellipsis> -->
|
|
217
|
+
<span>{{ text === '' ? '--' : text }}</span>
|
|
218
|
+
</span>
|
|
219
|
+
<span v-else-if="item.slotType === 'progress'" :key="'progress-' + c_index">
|
|
220
|
+
<!-- websocket-id (配置名称-字段名称-用户id-数据行id) -->
|
|
221
|
+
<x-web-socket-progress
|
|
222
|
+
v-if="item.webSocket"
|
|
223
|
+
:key="`${tableContext.requestParameters?.pageNo || 1}-${item.dataIndex}-${record[tableContext.rowKey] || index}`"
|
|
224
|
+
:websocket-id="`${queryParamsName}-${item.dataIndex}-${currUser.id}-${record[tableContext.rowKey] || index}`"
|
|
225
|
+
:initial-value="text || 0"
|
|
226
|
+
@progress-updated="(data) => handleProgressUpdated(data, record, item.dataIndex)"
|
|
227
|
+
/>
|
|
228
|
+
<!-- 表格进度组件 -->
|
|
229
|
+
<a-progress v-else :percent="text" status="active" style="padding-right: 20px;" />
|
|
230
|
+
</span>
|
|
231
|
+
<span v-else-if="item.slotType === 'badge'" :key="'badge-' + c_index">
|
|
232
|
+
<x-badge
|
|
233
|
+
:service-name="tableContext.serviceName"
|
|
234
|
+
:env="tableContext.env"
|
|
235
|
+
v-if="text !== null && text !== undefined"
|
|
236
|
+
:badge-key="item.slotKeyMap"
|
|
237
|
+
:value="text"/>
|
|
238
|
+
</span>
|
|
239
|
+
<span v-else-if="item.slotType === 'date'" :key="'date-' + c_index">
|
|
240
|
+
{{ format(text, 'yyyy-MM-dd') }}
|
|
241
|
+
</span>
|
|
242
|
+
<span v-else-if="item.slotType === 'dateTime'" :key="'dateTime-' + c_index">
|
|
243
|
+
{{ format(text, 'yyyy-MM-dd hh:mm:ss') }}
|
|
244
|
+
</span>
|
|
245
|
+
<span v-else-if="item.slotType === 'towDecimal'" :key="'towDecimal-' + c_index">
|
|
246
|
+
{{ numberFormat(text, 2) }}
|
|
247
|
+
</span>
|
|
248
|
+
<span v-else-if="item.slotType === 'fourDecimal'" :key="'fourDecimal-' + c_index">
|
|
249
|
+
{{ numberFormat(text, 4) }}
|
|
250
|
+
</span>
|
|
251
|
+
<span v-else-if="item.slotType === 'int'" :key="'int-' + c_index">
|
|
252
|
+
{{ numberFormat(text, 0) }}
|
|
253
|
+
</span>
|
|
254
|
+
<span v-else-if="item.slotType === 'action'" :key="'action-' + c_index">
|
|
255
|
+
<template v-if="item.actionArr && item.actionArr.length > 0">
|
|
256
|
+
<a-dropdown
|
|
257
|
+
placement="bottomRight"
|
|
258
|
+
:overlayStyle="{
|
|
259
|
+
whiteSpace: 'nowrap',
|
|
260
|
+
maxWidth: '250px',
|
|
261
|
+
overflow: 'hidden',
|
|
262
|
+
textOverflow: 'ellipsis'
|
|
263
|
+
}"
|
|
264
|
+
>
|
|
265
|
+
<a class="ant-dropdown-link" @click="e => e.preventDefault()">
|
|
266
|
+
{{ item.scopedSlots?.customRender || item.slotValue }} <a-icon type="down"/>
|
|
267
|
+
</a>
|
|
268
|
+
<a-menu slot="overlay" style="min-width: 60px">
|
|
269
|
+
<a-menu-item
|
|
270
|
+
v-for="(action_item, actionIndex) in item.actionArr"
|
|
271
|
+
:key="actionIndex"
|
|
272
|
+
v-show="!action_item.customFunction || tableContext.customFunctionShow(action_item.customFunction,record,c_index)">
|
|
273
|
+
<a
|
|
274
|
+
style="text-align: center"
|
|
275
|
+
@click="tableContext.action(record, item.dataIndex, action_item.func)"
|
|
276
|
+
>{{ action_item.text }}</a>
|
|
277
|
+
</a-menu-item>
|
|
278
|
+
</a-menu>
|
|
279
|
+
</a-dropdown>
|
|
280
|
+
</template>
|
|
281
|
+
<template v-if="!item.actionArr || item.actionArr.length === 0">
|
|
282
|
+
<a @click="tableContext.action(record, item.dataIndex,'action', index)">{{ item.slotValue }}</a>
|
|
283
|
+
</template>
|
|
284
|
+
</span>
|
|
285
|
+
</template>
|
|
286
|
+
<template slot="footer">
|
|
287
|
+
<slot
|
|
288
|
+
name="footer"
|
|
289
|
+
:selectedRowKeys="tableContext.selectedRowKeys"
|
|
290
|
+
:selectedRows="tableContext.selectedRows"></slot>
|
|
291
|
+
</template>
|
|
292
|
+
</s-table>
|
|
293
|
+
</template>
|
|
294
|
+
|
|
295
|
+
<script>
|
|
296
|
+
import { Ellipsis, STable } from '@vue2-client/components'
|
|
297
|
+
import { formatDate } from '@vue2-client/utils/util'
|
|
298
|
+
import XBadge from '@vue2-client/base-client/components/common/XBadge'
|
|
299
|
+
import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
|
|
300
|
+
import CustomFuncCel from '@vue2-client/base-client/components/common/XTable/CustomFuncCel.vue'
|
|
301
|
+
import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
|
|
302
|
+
import XRate from '@vue2-client/base-client/components/common/XRate/index.vue'
|
|
303
|
+
import XWebSocketProgress from '@vue2-client/base-client/components/common/XWebSocketProgress'
|
|
304
|
+
import VueDraggableResizable from 'vue-draggable-resizable'
|
|
305
|
+
import { mapState } from 'vuex'
|
|
306
|
+
|
|
307
|
+
export default {
|
|
308
|
+
name: 'XTableWrapper',
|
|
309
|
+
components: {
|
|
310
|
+
Ellipsis,
|
|
311
|
+
STable,
|
|
312
|
+
XBadge,
|
|
313
|
+
XFormItem,
|
|
314
|
+
XRate,
|
|
315
|
+
CustomFuncCel,
|
|
316
|
+
XWebSocketProgress,
|
|
317
|
+
VueDraggableResizable
|
|
318
|
+
},
|
|
319
|
+
data () {
|
|
320
|
+
return {
|
|
321
|
+
isDragging: false, // 添加拖拽状态标记
|
|
322
|
+
// eslint-disable-next-line vue/no-reserved-keys
|
|
323
|
+
_rafId: null // 添加requestAnimationFrame ID标记
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
computed: {
|
|
327
|
+
...mapState('account', { currUser: 'user' }),
|
|
328
|
+
localDataSource () {
|
|
329
|
+
return this.activeTable?.localDataSource
|
|
330
|
+
},
|
|
331
|
+
// 获取当前活动的表格实例
|
|
332
|
+
activeTable () {
|
|
333
|
+
return this.tableContext.expandedGrid ? this.$refs.expandableTable : this.$refs.simpleTable
|
|
334
|
+
},
|
|
335
|
+
realTableColumns () {
|
|
336
|
+
// 1. 先过滤列并设置 ellipsis 属性
|
|
337
|
+
const filteredColumns = this.tableContext.tableColumns
|
|
338
|
+
.filter(item => item.slotType !== 'action' || !this.disableAction)
|
|
339
|
+
.map((item) => {
|
|
340
|
+
// 设置 ellipsis 属性
|
|
341
|
+
if (['ellipsis', 'badge', 'towDecimal', 'date', 'dateTime', 'fourDecimal', 'int'].includes(item.slotType)) {
|
|
342
|
+
item.ellipsis = true
|
|
343
|
+
}
|
|
344
|
+
return item
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
// 2. 分组:左固定、普通、右固定
|
|
348
|
+
const leftFixedColumns = []
|
|
349
|
+
const normalColumns = []
|
|
350
|
+
const rightFixedColumns = []
|
|
351
|
+
|
|
352
|
+
filteredColumns.forEach(col => {
|
|
353
|
+
if (col.fixed === 'left') {
|
|
354
|
+
leftFixedColumns.push(col)
|
|
355
|
+
} else if (col.fixed === 'right') {
|
|
356
|
+
rightFixedColumns.push(col)
|
|
357
|
+
} else {
|
|
358
|
+
normalColumns.push(col)
|
|
359
|
+
}
|
|
360
|
+
})
|
|
361
|
+
|
|
362
|
+
// 3. 按顺序合并:左固定 + 普通 + 右固定
|
|
363
|
+
return [...leftFixedColumns, ...normalColumns, ...rightFixedColumns]
|
|
364
|
+
},
|
|
365
|
+
components () {
|
|
366
|
+
return {
|
|
367
|
+
header: {
|
|
368
|
+
cell: (h, props, children) => {
|
|
369
|
+
const { key, ...restProps } = props
|
|
370
|
+
// 此处的this.realTableColumns 是定义的table的表头属性变量
|
|
371
|
+
const col = this.realTableColumns.find((col) => {
|
|
372
|
+
const k = col.dataIndex || col.key
|
|
373
|
+
return k === key
|
|
374
|
+
})
|
|
375
|
+
if (!col || !col.width || col.slotType === 'action') {
|
|
376
|
+
if (children) {
|
|
377
|
+
return h('th', { ...restProps }, [...children])
|
|
378
|
+
} else {
|
|
379
|
+
return h('th', { ...restProps })
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// 创建一个防止点击排序的容器
|
|
384
|
+
const preventSortProps = {
|
|
385
|
+
style: {
|
|
386
|
+
position: 'absolute',
|
|
387
|
+
right: 0,
|
|
388
|
+
top: 0,
|
|
389
|
+
width: '20px',
|
|
390
|
+
height: '100%',
|
|
391
|
+
zIndex: 10
|
|
392
|
+
},
|
|
393
|
+
on: {
|
|
394
|
+
mousedown: (e) => {
|
|
395
|
+
e.stopPropagation()
|
|
396
|
+
e.preventDefault()
|
|
397
|
+
this.isDragging = true
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const dragProps = {
|
|
403
|
+
key: col.dataIndex || col.key,
|
|
404
|
+
class: 'table-draggable-handle',
|
|
405
|
+
attrs: {
|
|
406
|
+
w: 10,
|
|
407
|
+
x: col.width,
|
|
408
|
+
z: 1,
|
|
409
|
+
axis: 'x',
|
|
410
|
+
draggable: true,
|
|
411
|
+
resizable: false,
|
|
412
|
+
},
|
|
413
|
+
on: {
|
|
414
|
+
dragging: (x, y) => {
|
|
415
|
+
// 使用requestAnimationFrame优化性能,减少卡顿
|
|
416
|
+
if (!this._rafId) {
|
|
417
|
+
this._rafId = requestAnimationFrame(() => {
|
|
418
|
+
col.width = Math.max(x, 50) // 设置最小列宽为50px
|
|
419
|
+
this.isDragging = true // 设置拖拽状态
|
|
420
|
+
this._rafId = null
|
|
421
|
+
})
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
mousedown: (e) => {
|
|
425
|
+
// 阻止事件冒泡,防止触发排序
|
|
426
|
+
e.stopPropagation()
|
|
427
|
+
e.preventDefault()
|
|
428
|
+
this.isDragging = true // 设置拖拽状态
|
|
429
|
+
},
|
|
430
|
+
dragstop: () => {
|
|
431
|
+
// 清除可能存在的动画帧请求
|
|
432
|
+
if (this._rafId) {
|
|
433
|
+
cancelAnimationFrame(this._rafId)
|
|
434
|
+
this._rafId = null
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// 拖拽结束时,延迟重置拖拽状态,以防止排序被触发
|
|
438
|
+
setTimeout(() => {
|
|
439
|
+
this.isDragging = false
|
|
440
|
+
}, 100)
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
nativeOn: {
|
|
444
|
+
mousedown: (e) => {
|
|
445
|
+
e.stopPropagation()
|
|
446
|
+
e.preventDefault()
|
|
447
|
+
this.isDragging = true // 设置拖拽状态
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const preventSort = h('div', preventSortProps)
|
|
453
|
+
const drag = h('vue-draggable-resizable', { ...dragProps })
|
|
454
|
+
|
|
455
|
+
// 修改th的点击事件,在拖拽状态下阻止排序
|
|
456
|
+
const newRestProps = { ...restProps }
|
|
457
|
+
const originalClick = newRestProps.on && newRestProps.on.click
|
|
458
|
+
if (originalClick) {
|
|
459
|
+
newRestProps.on = {
|
|
460
|
+
...newRestProps.on,
|
|
461
|
+
click: (e) => {
|
|
462
|
+
if (this.isDragging) {
|
|
463
|
+
e.stopPropagation()
|
|
464
|
+
e.preventDefault()
|
|
465
|
+
return
|
|
466
|
+
}
|
|
467
|
+
originalClick(e)
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (children) {
|
|
473
|
+
return h('th', { ...newRestProps, class: 'resize-table-th' }, [...children, preventSort, drag])
|
|
474
|
+
} else {
|
|
475
|
+
return h('th', { ...newRestProps, class: 'resize-table-th' }, [preventSort, drag])
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
props: {
|
|
483
|
+
// 查询配置文件名
|
|
484
|
+
queryParamsName: {
|
|
485
|
+
type: String,
|
|
486
|
+
default: () => {
|
|
487
|
+
return ''
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
loadSelectedData: {
|
|
491
|
+
type: Boolean,
|
|
492
|
+
required: false,
|
|
493
|
+
default: false
|
|
494
|
+
},
|
|
495
|
+
disableAction: {
|
|
496
|
+
type: Boolean,
|
|
497
|
+
default: false
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
inject: ['tableContext'],
|
|
501
|
+
methods: {
|
|
502
|
+
handleRowClick (record) {
|
|
503
|
+
this.$emit('rowClick', record)
|
|
504
|
+
},
|
|
505
|
+
beforeDataChange (record) {
|
|
506
|
+
this.$emit('beforeDataChange', record)
|
|
507
|
+
},
|
|
508
|
+
onExpand (expanded, record) {
|
|
509
|
+
this.$emit('expand', expanded, record)
|
|
510
|
+
},
|
|
511
|
+
setLocalDataSource (data) {
|
|
512
|
+
this.activeTable?.setLocalDataSource(data)
|
|
513
|
+
},
|
|
514
|
+
loadData () {
|
|
515
|
+
if (this.loadSelectedData) {
|
|
516
|
+
return this.loadSelectedDataGen
|
|
517
|
+
} else {
|
|
518
|
+
return this.tableContext.loadData
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
loadSelectedDataGen (requestParameters) {
|
|
522
|
+
console.log('loadSelectedDataGen', {
|
|
523
|
+
pageNo: requestParameters?.pageNo,
|
|
524
|
+
pageSize: requestParameters?.pageSize
|
|
525
|
+
})
|
|
526
|
+
|
|
527
|
+
const { pageNo = 1, pageSize = 10 } = requestParameters || {}
|
|
528
|
+
const startIndex = (pageNo - 1) * pageSize
|
|
529
|
+
const endIndex = startIndex + pageSize
|
|
530
|
+
const paginatedData = this.tableContext.selectedRows.slice(startIndex, endIndex)
|
|
531
|
+
|
|
532
|
+
return new Promise((resolve) => {
|
|
533
|
+
resolve({
|
|
534
|
+
data: paginatedData,
|
|
535
|
+
pageNo,
|
|
536
|
+
pageSize,
|
|
537
|
+
totalPage: Math.ceil(this.tableContext.selectedRows.length / pageSize),
|
|
538
|
+
totalCount: this.tableContext.selectedRows.length
|
|
539
|
+
})
|
|
540
|
+
})
|
|
541
|
+
},
|
|
542
|
+
updateSelect (selectedRowKeys, selectedRows) {
|
|
543
|
+
this.activeTable?.updateSelect(selectedRowKeys, selectedRows)
|
|
544
|
+
},
|
|
545
|
+
clearSelected () {
|
|
546
|
+
this.activeTable?.clearSelected()
|
|
547
|
+
},
|
|
548
|
+
refresh (bool) {
|
|
549
|
+
this.activeTable?.refresh(bool)
|
|
550
|
+
},
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* 格式化日期
|
|
554
|
+
* @param date 日期字符串
|
|
555
|
+
* @param format 格式化方式
|
|
556
|
+
*/
|
|
557
|
+
format (date, format) {
|
|
558
|
+
return formatDate(date, format)
|
|
559
|
+
},
|
|
560
|
+
/**
|
|
561
|
+
* 格式化数字
|
|
562
|
+
* @param number string 或者 number
|
|
563
|
+
* @param decimalPlaces 小数位数
|
|
564
|
+
*/
|
|
565
|
+
numberFormat (number, decimalPlaces = 2) {
|
|
566
|
+
const value = parseFloat(number)
|
|
567
|
+
if (!isNaN(value)) {
|
|
568
|
+
return value.toFixed(decimalPlaces)
|
|
569
|
+
} else {
|
|
570
|
+
return ''
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
getFromItem (model, text, record, index) {
|
|
574
|
+
const aa = this.tableContext.formItems.reduce((acc, item) => {
|
|
575
|
+
if (item.type === 'group') {
|
|
576
|
+
const foundItem = item.groupItems.find(_item => _item.model === model && _item.editRow)
|
|
577
|
+
if (foundItem) {
|
|
578
|
+
acc = foundItem
|
|
579
|
+
}
|
|
580
|
+
} else if (item.model === model && item.editRow) {
|
|
581
|
+
acc = item
|
|
582
|
+
}
|
|
583
|
+
return acc
|
|
584
|
+
}, null)
|
|
585
|
+
if (aa) {
|
|
586
|
+
const tempConfig = JSON.parse(JSON.stringify(aa))
|
|
587
|
+
// 如果找到了字段
|
|
588
|
+
const ColumnIndex = this.realTableColumns.findIndex(item => item.dataIndex === model)
|
|
589
|
+
// 并且表单项是日期框
|
|
590
|
+
if (ColumnIndex !== -1 && ['yearPicker', 'monthPicker', 'datePicker', 'rangePicker'].includes(tempConfig.type)) {
|
|
591
|
+
// 修改他的列宽
|
|
592
|
+
this.realTableColumns[ColumnIndex].width = 220
|
|
593
|
+
}
|
|
594
|
+
// 如果有检验规则检验是数字
|
|
595
|
+
if (ColumnIndex !== -1 && ['number', 'integer', 'float'].includes(tempConfig?.rule?.type)) {
|
|
596
|
+
// 修改他的列宽
|
|
597
|
+
tempConfig.numberInput = true
|
|
598
|
+
}
|
|
599
|
+
if (tempConfig.editRowShowFunc) {
|
|
600
|
+
if (executeStrFunctionByContext(this.tableContext, tempConfig.editRowShowFunc, [text, record, index, tempConfig])) {
|
|
601
|
+
return tempConfig
|
|
602
|
+
}
|
|
603
|
+
} else {
|
|
604
|
+
return tempConfig
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return false
|
|
608
|
+
},
|
|
609
|
+
handleResizeColumn (w, col) {
|
|
610
|
+
col.width = w
|
|
611
|
+
},
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* 处理进度更新事件
|
|
615
|
+
* @param {Object} data 进度数据
|
|
616
|
+
* @param {Object} record 行数据
|
|
617
|
+
* @param {String} dataIndex 列字段名
|
|
618
|
+
*/
|
|
619
|
+
handleProgressUpdated (data, record, dataIndex) {
|
|
620
|
+
// 更新行数据中的进度值
|
|
621
|
+
if (record && dataIndex) {
|
|
622
|
+
this.$set(record, dataIndex, data.value)
|
|
623
|
+
}
|
|
624
|
+
},
|
|
625
|
+
/**
|
|
626
|
+
* 处理表单项事件,增强事件数据
|
|
627
|
+
* @param {String} func 事件函数名
|
|
628
|
+
* @param {Object} attr 字段配置
|
|
629
|
+
* @param {*} value 字段值
|
|
630
|
+
* @param {Object} record 当前行数据
|
|
631
|
+
* @param {Number} index 当前行索引
|
|
632
|
+
*/
|
|
633
|
+
handleFormItemEvent (func, attr, value, record, index) {
|
|
634
|
+
// 获取表格数据源
|
|
635
|
+
const dataSource = this.localDataSource || []
|
|
636
|
+
|
|
637
|
+
// 计算下一行的索引和数据
|
|
638
|
+
const nextIndex = index + 1
|
|
639
|
+
const nextRecord = nextIndex < dataSource.length ? dataSource[nextIndex] : null
|
|
640
|
+
|
|
641
|
+
// 构建增强的上下文数据
|
|
642
|
+
const enhancedContext = {
|
|
643
|
+
func,
|
|
644
|
+
attr,
|
|
645
|
+
value,
|
|
646
|
+
currentRecord: record,
|
|
647
|
+
currentIndex: index,
|
|
648
|
+
nextRecord,
|
|
649
|
+
nextIndex: nextRecord ? nextIndex : null,
|
|
650
|
+
tableContext: this.tableContext
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// 调用 tableContext 的事件处理方法
|
|
654
|
+
if (this.tableContext && typeof this.tableContext.handleFormItemEvent === 'function') {
|
|
655
|
+
this.tableContext.handleFormItemEvent(enhancedContext)
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
</script>
|
|
661
|
+
|
|
662
|
+
<style scoped lang="less">
|
|
663
|
+
/* 精确修复表头空白问题 */
|
|
664
|
+
:deep(.ant-table-fixed-header .ant-table-scroll .ant-table-header) {
|
|
665
|
+
margin-bottom: 0 !important;
|
|
666
|
+
overflow-x: hidden !important;
|
|
667
|
+
}
|
|
668
|
+
/* 统一表头行高和垂直对齐 */
|
|
669
|
+
:deep(.ant-table-thead > tr) {
|
|
670
|
+
height: 54px !important;
|
|
671
|
+
line-height: 54px !important;
|
|
672
|
+
}
|
|
673
|
+
:deep(.ant-table-thead > tr > th) {
|
|
674
|
+
padding: 0 16px !important;
|
|
675
|
+
vertical-align: middle !important;
|
|
676
|
+
border-bottom: 1px solid #f0f0f0;
|
|
677
|
+
}
|
|
678
|
+
/* 分页组件不换行 */
|
|
679
|
+
:deep(.ant-pagination > li) {
|
|
680
|
+
white-space: nowrap;
|
|
681
|
+
}
|
|
682
|
+
</style>
|
|
683
|
+
<style>
|
|
684
|
+
/* vue-draggable-resizable 拖动手柄样式 */
|
|
685
|
+
.table-draggable-handle {
|
|
686
|
+
height: 100% !important;
|
|
687
|
+
left: auto !important;
|
|
688
|
+
right: 0;
|
|
689
|
+
cursor: col-resize;
|
|
690
|
+
touch-action: none;
|
|
691
|
+
border: none;
|
|
692
|
+
position: absolute;
|
|
693
|
+
transform: none !important;
|
|
694
|
+
bottom: 0;
|
|
695
|
+
width: 10px !important; /* 减小到10px */
|
|
696
|
+
z-index: 99 !important; /* 提高z-index */
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/* 拖动手柄的分隔线 */
|
|
700
|
+
.table-draggable-handle::after {
|
|
701
|
+
content: "";
|
|
702
|
+
position: absolute;
|
|
703
|
+
top: 50%;
|
|
704
|
+
height: 20px;
|
|
705
|
+
width: 2px;
|
|
706
|
+
background-color: #e8e8e8;
|
|
707
|
+
transition: background-color 0.2s;
|
|
708
|
+
transform: translateY(-50%);
|
|
709
|
+
right: 0;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/* 悬停效果 - 只改变颜色 */
|
|
713
|
+
.table-draggable-handle:hover::after {
|
|
714
|
+
background-color: #1890ff;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/* 拖动时的效果 */
|
|
718
|
+
.table-draggable-handle:active::after {
|
|
719
|
+
background-color: #096dd9;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/* 表头单元格样式 */
|
|
723
|
+
.resize-table-th {
|
|
724
|
+
position: relative;
|
|
725
|
+
overflow: visible !important; /* 确保内容不被裁剪 */
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/* 表头单元格悬停时的手柄高亮 */
|
|
729
|
+
.resize-table-th:hover .table-draggable-handle::after {
|
|
730
|
+
background-color: rgba(24, 144, 255, 0.6);
|
|
731
|
+
}
|
|
732
|
+
</style>
|