vue2-client 0.1.0 → 1.1.0
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/.editorconfig +9 -0
- package/.env +14 -0
- package/.env.development +1 -0
- package/.eslintrc.js +81 -0
- package/.eslintrc.json +5 -0
- package/README.md +54 -36
- package/babel.config.js +11 -2
- package/docs/index.md +29 -0
- package/jest.config.js +3 -0
- package/package.json +68 -22
- package/public/index.html +13 -3
- package/src/App.vue +93 -0
- package/src/assets/img/alipay.png +0 -0
- package/src/assets/img/defect.png +0 -0
- package/src/assets/img/error.png +0 -0
- package/src/assets/img/logo.png +0 -0
- package/src/assets/img/preview-nine.png +0 -0
- package/src/assets/img/preview.png +0 -0
- package/src/assets/img/success.png +0 -0
- package/src/assets/img/success1.png +0 -0
- package/src/assets/img/wechatpay.png +0 -0
- package/src/base-client/all.js +57 -0
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +1159 -0
- package/src/base-client/components/common/CreateQuery/index.js +3 -0
- package/src/base-client/components/common/CreateQuery/index.md +42 -0
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +540 -0
- package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -0
- package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -0
- package/src/{components → base-client/components/common}/CustomColumnsDrawer/CustomColumnsDrawer.vue +21 -15
- package/src/{components → base-client/components/common}/CustomColumnsDrawer/index.js +0 -0
- package/src/{components → base-client/components/common}/CustomColumnsDrawer/index.md +0 -0
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +150 -0
- package/src/base-client/components/common/FormGroupEdit/index.js +3 -0
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -0
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +163 -0
- package/src/base-client/components/common/FormGroupQuery/index.js +3 -0
- package/src/base-client/components/common/FormGroupQuery/index.md +43 -0
- package/src/base-client/components/common/JSONToTree/index.js +3 -0
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -0
- package/src/base-client/components/common/XAddForm/XAddForm.vue +323 -0
- package/src/base-client/components/common/XAddForm/index.js +3 -0
- package/src/base-client/components/common/XAddForm/index.md +60 -0
- package/src/base-client/components/common/XBadge/XBadge.vue +61 -0
- package/src/base-client/components/common/XBadge/index.js +3 -0
- package/src/base-client/components/common/XBadge/index.md +39 -0
- package/src/base-client/components/common/XCard/XCard.vue +59 -0
- package/src/base-client/components/common/XCard/index.js +3 -0
- package/src/base-client/components/common/XCard/index.md +43 -0
- package/src/base-client/components/common/XForm/XForm.vue +275 -0
- package/src/base-client/components/common/XForm/XFormItem.vue +217 -0
- package/src/base-client/components/common/XForm/index.js +3 -0
- package/src/base-client/components/common/XForm/index.md +196 -0
- package/src/{components/FormItem/FormItem.vue → base-client/components/common/XFormCol/XFormCol.vue} +16 -14
- package/src/base-client/components/common/XFormCol/index.js +3 -0
- package/src/{components/FormItem → base-client/components/common/XFormCol}/index.md +2 -2
- package/src/base-client/components/common/XFormTable/XFormTable.vue +405 -0
- package/src/base-client/components/common/XFormTable/index.js +3 -0
- package/src/base-client/components/common/XFormTable/index.md +89 -0
- package/src/base-client/components/common/XTable/XTable.vue +262 -0
- package/src/base-client/components/common/XTable/index.js +3 -0
- package/src/base-client/components/common/XTable/index.md +255 -0
- package/src/base-client/components/common/XTreeOne/XTreeOne.vue +105 -0
- package/src/base-client/components/common/XTreeOne/index.js +3 -0
- package/src/base-client/components/iot/CustomerDetailsView/CustomerDetailsView.vue +226 -0
- package/src/base-client/components/iot/CustomerDetailsView/index.js +3 -0
- package/src/base-client/components/iot/CustomerDetailsView/index.md +41 -0
- package/src/base-client/components/iot/DataAnalysisUser/DataAnalysisUser.vue +127 -0
- package/src/base-client/components/iot/DataAnalysisUser/index.js +3 -0
- package/src/base-client/components/iot/DataAnalysisView/DataAnalysisView.vue +250 -0
- package/src/base-client/components/iot/DataAnalysisView/index.js +3 -0
- package/src/base-client/components/iot/DataAnalysisViewGD/DataAnalysisViewGD.vue +548 -0
- package/src/base-client/components/iot/DataAnalysisViewGD/WindowTemplate/WindowInfotemp.vue +99 -0
- package/src/base-client/components/iot/DataAnalysisViewGD/WindowTemplate/index.js +3 -0
- package/src/base-client/components/iot/DataAnalysisViewGD/index.js +3 -0
- package/src/base-client/components/iot/DeviceBrandDetailsView/DeviceBrandDetailsView.vue +453 -0
- package/src/base-client/components/iot/DeviceBrandDetailsView/index.js +3 -0
- package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +231 -0
- package/src/base-client/components/iot/DeviceDetailsView/index.js +3 -0
- package/src/base-client/components/iot/DeviceDetailsView/index.md +43 -0
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +330 -0
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -0
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstruct.vue +122 -0
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstructOperate.vue +122 -0
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsMain.vue +225 -0
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +135 -0
- package/src/base-client/components/iot/DeviceDetailsView/part/index.js +8 -0
- package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +277 -0
- package/src/base-client/components/iot/DeviceTypeDetailsView/index.js +3 -0
- package/src/base-client/components/iot/InstructDetailsView/InstructDetailsView.vue +472 -0
- package/src/{components → base-client/components/iot}/InstructDetailsView/index.js +0 -0
- package/src/base-client/components/iot/InstructDetailsView/index.md +45 -0
- package/src/base-client/components/iot/LogDetailsView/LogDetailsView.vue +380 -0
- package/src/base-client/components/iot/LogDetailsView/index.js +3 -0
- package/src/base-client/components/iot/LogDetailsView/index.md +43 -0
- package/src/base-client/components/iot/MeterDetailsView/MeterDetailsView.vue +360 -0
- package/src/{components → base-client/components/iot}/MeterDetailsView/index.js +0 -0
- package/src/base-client/components/iot/MeterDetailsView/index.md +43 -0
- package/src/{components → base-client/components/iot}/MeterDetailsView/part/MeterDetailsCount.vue +335 -381
- package/src/{components → base-client/components/iot}/MeterDetailsView/part/MeterDetailsException.vue +185 -204
- package/src/{components → base-client/components/iot}/MeterDetailsView/part/MeterDetailsHandPlan.vue +292 -320
- package/src/{components → base-client/components/iot}/MeterDetailsView/part/MeterDetailsInstruct.vue +237 -278
- package/src/{components → base-client/components/iot}/MeterDetailsView/part/MeterDetailsMain.vue +257 -247
- package/src/{components → base-client/components/iot}/MeterDetailsView/part/MeterDetailsSellGas.vue +190 -211
- package/src/base-client/components/iot/MeterDetailsView/part/index.js +9 -0
- package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +723 -0
- package/src/base-client/components/iot/WebmeterAnalysisView/index.js +3 -0
- package/src/base-client/components/iot/WebmeterAnalysisView/index.md +48 -0
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -0
- package/src/base-client/components/system/DictionaryDetailsView/index.js +3 -0
- package/src/base-client/components/system/DictionaryDetailsView/index.md +41 -0
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +248 -0
- package/src/base-client/components/system/QueryParamsDetailsView/index.js +3 -0
- package/src/base-client/components/ticket/EmployeeDetailsView/EmployeeDetailsView.vue +406 -0
- package/src/base-client/components/ticket/EmployeeDetailsView/index.js +3 -0
- package/src/base-client/components/ticket/EmployeeDetailsView/index.md +28 -0
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +486 -0
- package/src/base-client/components/ticket/TicketDetailsView/index.js +3 -0
- package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -0
- package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +184 -0
- package/src/base-client/components/ticket/TicketDetailsView/part/index.js +3 -0
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +303 -0
- package/src/base-client/components/ticket/TicketSubmitSuccessView/index.js +3 -0
- package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -0
- package/src/base-client/plugins/AppData.js +69 -0
- package/src/{plugins → base-client/plugins}/Config.js +1 -1
- package/src/base-client/plugins/GetLoginInfoService.js +221 -0
- package/src/{plugins → base-client/plugins}/PagedList.js +0 -0
- package/src/base-client/plugins/authority-plugin.js +167 -0
- package/src/base-client/plugins/i18n-extend.js +32 -0
- package/src/base-client/plugins/index.js +21 -0
- package/src/{plugins → base-client/plugins}/moment.js +8 -8
- package/src/base-client/plugins/tabs-page-plugin.js +38 -0
- package/src/bootstrap.js +27 -0
- package/src/components/Charts/Bar.vue +62 -0
- package/src/components/Charts/ChartCard.vue +120 -0
- package/src/components/Charts/DataUserOrderSituation.vue +77 -0
- package/src/components/Charts/DataUserReporting.vue +74 -0
- package/src/components/Charts/DataUserSituation.vue +107 -0
- package/src/components/Charts/Liquid.vue +67 -0
- package/src/components/Charts/MiniArea.vue +39 -0
- package/src/components/Charts/MiniBar.vue +39 -0
- package/src/components/Charts/MiniProgress.vue +75 -0
- package/src/components/Charts/MiniSmoothArea.vue +40 -0
- package/src/components/Charts/Radar.vue +68 -0
- package/src/components/Charts/RankList.vue +77 -0
- package/src/components/Charts/TagCloud.vue +113 -0
- package/src/components/Charts/TransferBar.vue +64 -0
- package/src/components/Charts/Trend.vue +82 -0
- package/src/components/Charts/chart.less +13 -0
- package/src/components/Charts/smooth.area.less +14 -0
- package/src/components/Ellipsis/Ellipsis.vue +64 -0
- package/src/components/Ellipsis/index.js +3 -0
- package/src/components/Ellipsis/index.md +38 -0
- package/src/components/NumberInfo/NumberInfo.vue +54 -0
- package/src/components/NumberInfo/index.js +3 -0
- package/src/components/NumberInfo/index.less +55 -0
- package/src/components/NumberInfo/index.md +43 -0
- package/src/components/STable/README.md +341 -0
- package/src/components/STable/index.js +316 -0
- package/src/components/Trend/Trend.vue +41 -0
- package/src/components/Trend/index.js +3 -0
- package/src/components/Trend/index.less +42 -0
- package/src/components/Trend/index.md +45 -0
- package/src/components/_util/util.js +46 -0
- package/src/components/cache/AKeepAlive.js +172 -0
- package/src/components/card/ChartCard.vue +79 -0
- package/src/components/chart/Bar.vue +60 -0
- package/src/components/chart/MiniArea.vue +67 -0
- package/src/components/chart/MiniBar.vue +59 -0
- package/src/components/chart/MiniProgress.vue +57 -0
- package/src/components/chart/Radar.vue +80 -0
- package/src/components/chart/RankingList.vue +60 -0
- package/src/components/chart/Trend.vue +79 -0
- package/src/components/chart/index.less +9 -0
- package/src/components/checkbox/ColorCheckbox.vue +157 -0
- package/src/components/checkbox/ImgCheckbox.vue +163 -0
- package/src/components/checkbox/index.js +7 -0
- package/src/components/dataAnalysisView/UserData.vue +61 -0
- package/src/components/exception/ExceptionPage.vue +70 -0
- package/src/components/exception/typeConfig.js +19 -0
- package/src/components/form/FormRow.vue +52 -0
- package/src/components/index.js +36 -0
- package/src/components/index.less +6 -0
- package/src/components/input/IInput.vue +66 -0
- package/src/components/menu/Contextmenu.vue +84 -0
- package/src/components/menu/SideMenu.vue +62 -0
- package/src/components/menu/index.less +38 -0
- package/src/components/menu/menu.js +273 -0
- package/src/components/page/header/PageHeader.vue +64 -0
- package/src/components/page/header/index.less +40 -0
- package/src/components/result/Result.vue +77 -0
- package/src/components/setting/Setting.vue +237 -0
- package/src/components/setting/SettingItem.vue +26 -0
- package/src/components/setting/i18n.js +117 -0
- package/src/components/table/StandardTable.vue +142 -0
- package/src/components/table/advance/ActionColumns.vue +158 -0
- package/src/components/table/advance/ActionSize.vue +45 -0
- package/src/components/table/advance/AdvanceTable.vue +275 -0
- package/src/components/table/advance/SearchArea.vue +355 -0
- package/src/components/table/advance/index.js +2 -0
- package/src/components/table/api/ApiTable.vue +50 -0
- package/src/components/task/TaskGroup.vue +80 -0
- package/src/components/task/TaskItem.vue +26 -0
- package/src/components/tool/AStepItem.vue +60 -0
- package/src/components/tool/AvatarList.vue +69 -0
- package/src/components/tool/DetailList.vue +157 -0
- package/src/components/tool/Drawer.vue +142 -0
- package/src/components/tool/FooterToolBar.vue +30 -0
- package/src/components/tool/HeadInfo.vue +35 -0
- package/src/components/tool/TagSelect.vue +83 -0
- package/src/components/tool/TagSelectOption.vue +33 -0
- package/src/components/transition/PageToggleTransition.vue +97 -0
- package/src/config/config.js +13 -0
- package/src/config/default/admin.config.js +18 -0
- package/src/config/default/animate.config.js +21 -0
- package/src/config/default/antd.config.js +84 -0
- package/src/config/default/index.js +6 -0
- package/src/config/default/setting.config.js +33 -0
- package/src/config/index.js +6 -0
- package/src/config/replacer/index.js +10 -0
- package/src/config/replacer/resolve.config.js +67 -0
- package/src/index.js +28 -35
- package/src/layouts/AdminLayout.vue +174 -0
- package/src/layouts/BlankView.vue +22 -0
- package/src/layouts/CommonLayout.vue +42 -0
- package/src/layouts/ComponentLayoutOne.vue +47 -0
- package/src/layouts/PageLayout.vue +151 -0
- package/src/layouts/PageView.vue +55 -0
- package/src/layouts/SinglePageView.vue +74 -0
- package/src/layouts/footer/PageFooter.vue +46 -0
- package/src/layouts/header/AdminHeader.vue +109 -0
- package/src/layouts/header/HeaderAvatar.vue +60 -0
- package/src/layouts/header/HeaderNotice.vue +97 -0
- package/src/layouts/header/HeaderSearch.vue +67 -0
- package/src/layouts/header/index.less +92 -0
- package/src/layouts/tabs/TabsHead.vue +190 -0
- package/src/layouts/tabs/TabsView.vue +355 -0
- package/src/layouts/tabs/i18n.js +25 -0
- package/src/layouts/tabs/index.js +2 -0
- package/src/main.js +15 -7
- package/src/mock/common/activityData.js +32 -0
- package/src/mock/common/index.js +89 -0
- package/src/mock/common/reportData.js +20 -0
- package/src/mock/common/tableData.js +118 -0
- package/src/mock/extend/index.js +83 -0
- package/src/mock/goods/index.js +108 -0
- package/src/mock/index.js +12 -0
- package/src/mock/project/index.js +17 -0
- package/src/mock/user/current.js +13 -0
- package/src/mock/user/login.js +39 -0
- package/src/mock/user/routes.js +61 -0
- package/src/mock/workplace/index.js +15 -0
- package/src/pages/exception/403.vue +25 -0
- package/src/pages/exception/404.vue +25 -0
- package/src/pages/exception/500.vue +25 -0
- package/src/pages/login/Login.vue +194 -0
- package/src/pages/login/index.js +2 -0
- package/src/pages/report/ReportTable.js +125 -0
- package/src/pages/report/ReportTableHome.vue +28 -0
- package/src/pages/resourceManage/resourceManageMain.vue +55 -0
- package/src/pages/system/applyInstallView/Core.vue +570 -0
- package/src/pages/system/applyInstallView/LFComponents/AddPanel.vue +52 -0
- package/src/pages/system/applyInstallView/LFComponents/Control.vue +78 -0
- package/src/pages/system/applyInstallView/LFComponents/DataDialog.vue +24 -0
- package/src/pages/system/applyInstallView/LFComponents/NodePanel.vue +103 -0
- package/src/pages/system/applyInstallView/PropertySetting/Base.vue +124 -0
- package/src/pages/system/applyInstallView/PropertySetting/CommonProperty.vue +104 -0
- package/src/pages/system/applyInstallView/PropertySetting/PropertyDialog.vue +43 -0
- package/src/pages/system/applyInstallView/background/base.png +0 -0
- package/src/pages/system/applyInstallView/background/click.png +0 -0
- package/src/pages/system/applyInstallView/background/download.png +0 -0
- package/src/pages/system/applyInstallView/background/end.png +0 -0
- package/src/pages/system/applyInstallView/background/push.png +0 -0
- package/src/pages/system/applyInstallView/background/start.png +0 -0
- package/src/pages/system/applyInstallView/background/step.png +0 -0
- package/src/pages/system/applyInstallView/background/time.png +0 -0
- package/src/pages/system/applyInstallView/config.js +22 -0
- package/src/pages/system/applyInstallView/data.json +1284 -0
- package/src/pages/system/applyInstallView/index.vue +34 -0
- package/src/pages/system/applyInstallView/registerNode/Connect.vue +43 -0
- package/src/pages/system/applyInstallView/registerNode/index.js +16 -0
- package/src/pages/system/applyInstallView/registerNode/registerBackEdge.js +44 -0
- package/src/pages/system/applyInstallView/registerNode/registerBase.js +139 -0
- package/src/pages/system/applyInstallView/registerNode/registerConnect.js +60 -0
- package/src/pages/system/applyInstallView/registerNode/registerDownload.js +92 -0
- package/src/pages/system/applyInstallView/registerNode/registerEnd.js +110 -0
- package/src/pages/system/applyInstallView/registerNode/registerPolyline.js +14 -0
- package/src/pages/system/applyInstallView/registerNode/registerPush.js +127 -0
- package/src/pages/system/applyInstallView/registerNode/registerStart.js +105 -0
- package/src/pages/system/applyInstallView/registerNode/registerStep.js +209 -0
- package/src/pages/system/applyInstallView/registerNode/registerTask.js +29 -0
- package/src/pages/system/dictionary/index.vue +41 -0
- package/src/pages/system/queryParams/index.vue +41 -0
- package/src/router/async/config.async.js +25 -0
- package/src/router/async/router.map.js +59 -0
- package/src/router/config.js +23 -0
- package/src/router/guards.js +104 -0
- package/src/router/i18n.js +57 -0
- package/src/router/index.js +27 -0
- package/src/services/api/CustomerDetailsViewApi.js +6 -0
- package/src/services/api/DeviceBrandDetailsViewApi.js +14 -0
- package/src/services/api/DeviceDetailsViewApi.js +10 -0
- package/src/services/api/DeviceTypeDetailsViewApi.js +6 -0
- package/src/services/api/DictionaryDetailsViewApi.js +6 -0
- package/src/services/api/EmployeeDetailsViewApi.js +16 -0
- package/src/services/api/FormGroupEditApi.js +6 -0
- package/src/services/api/InstructDetailsViewApi.js +12 -0
- package/src/services/api/LogDetailsViewApi.js +10 -0
- package/src/services/api/MeterDetailsViewApi.js +24 -0
- package/src/services/api/QueryParamsDetailsViewApi.js +6 -0
- package/src/services/api/TicketDetailsViewApi.js +30 -0
- package/src/services/api/WebmeterAnalysisViewApi.js +30 -0
- package/src/services/api/common.js +39 -0
- package/src/services/api/iot.js +7 -0
- package/src/services/api/manage.js +12 -0
- package/src/services/api/restTools.js +23 -0
- package/src/services/api/service.js +12 -0
- package/src/services/api.js +11 -0
- package/src/services/dataSource.js +12 -0
- package/src/services/index.js +7 -0
- package/src/services/user.js +34 -0
- package/src/store/index.js +5 -0
- package/src/store/modules/account.js +103 -0
- package/src/store/modules/index.js +4 -0
- package/src/store/modules/setting.js +114 -0
- package/src/store/mutation-types.js +1 -0
- package/src/theme/antd/ant-menu.less +3 -0
- package/src/theme/antd/ant-message.less +3 -0
- package/src/theme/antd/ant-table.less +22 -0
- package/src/theme/antd/ant-time-picker.less +3 -0
- package/src/theme/antd/index.less +4 -0
- package/src/theme/default/color.less +43 -0
- package/src/theme/default/index.less +3 -0
- package/src/theme/default/nprogress.less +76 -0
- package/src/theme/default/style.less +33 -0
- package/src/theme/global.less +130 -0
- package/src/theme/index.less +5 -0
- package/src/theme/reportTable.less +58 -0
- package/src/theme/theme.less +1 -0
- package/src/utils/Objects.js +25 -0
- package/src/utils/authority-utils.js +85 -0
- package/src/utils/axios-interceptors.js +82 -0
- package/src/utils/colors.js +103 -0
- package/src/utils/excel/Blob.js +181 -0
- package/src/utils/excel/Export2Excel.js +142 -0
- package/src/utils/filter.js +21 -0
- package/src/utils/formatter.js +68 -0
- package/src/utils/i18n.js +80 -0
- package/src/utils/indexedDB.js +146 -0
- package/src/utils/request.js +197 -0
- package/src/utils/routerUtil.js +353 -0
- package/src/utils/theme-color-replacer-extend.js +92 -0
- package/src/utils/themeUtil.js +102 -0
- package/src/utils/util.js +134 -0
- package/tests/unit/ReportTable.spec.js +15 -0
- package/vue.config.js +152 -0
- package/webpack.config.js +12 -0
- package/src/api/business.js +0 -30
- package/src/api/common.js +0 -6
- package/src/assets/logo.png +0 -0
- package/src/components/Criteria/Criteria.vue +0 -191
- package/src/components/Criteria/CriteriaPaged.vue +0 -50
- package/src/components/Criteria/index.js +0 -7
- package/src/components/Criteria/index.md +0 -120
- package/src/components/DataGrid/DataGrid.vue +0 -206
- package/src/components/DataGrid/index.js +0 -3
- package/src/components/DataGrid/index.md +0 -195
- package/src/components/ExportExcel/ExportExcel.vue +0 -246
- package/src/components/ExportExcel/index.js +0 -3
- package/src/components/ExportExcel/index.md +0 -76
- package/src/components/FormItem/index.js +0 -3
- package/src/components/InstructDetailsView/InstructDetailsView.vue +0 -518
- package/src/components/InstructDetailsView/index.md +0 -40
- package/src/components/MetaAnalysis/MetaAnalysis.vue +0 -183
- package/src/components/MetaAnalysis/demo/A.vue +0 -31
- package/src/components/MetaAnalysis/demo/B.vue +0 -31
- package/src/components/MetaAnalysis/demo/C.vue +0 -31
- package/src/components/MetaAnalysis/demo/MetaTest.vue +0 -44
- package/src/components/MetaAnalysis/index.js +0 -3
- package/src/components/MetaAnalysis/index.md +0 -255
- package/src/components/MeterDetailsView/MeterDetailsView.vue +0 -317
- package/src/components/MeterDetailsView/index.md +0 -40
- package/src/components/MeterDetailsView/part/index.js +0 -9
- package/src/components/ModalView/Modal.vue +0 -100
- package/src/components/ModalView/index.js +0 -3
- package/src/components/WCriteria/WCriteria.vue +0 -191
- package/src/components/WCriteria/WCriteriaPaged.vue +0 -95
- package/src/components/WCriteria/index.js +0 -7
- package/src/components/WCriteria/index.md +0 -120
- package/src/components/WTable/WTable.vue +0 -216
- package/src/components/WTable/index.js +0 -3
- package/src/components/WTable/index.md +0 -195
- package/src/plugins/AppData.js +0 -39
- package/src/plugins/GetLoginInfoService.js +0 -475
- package/src/plugins/MessageBox.js +0 -15
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
import Cookie from 'js-cookie'
|
|
3
|
+
import Vue from 'vue'
|
|
4
|
+
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
5
|
+
import notification from 'ant-design-vue/es/notification'
|
|
6
|
+
|
|
7
|
+
// 跨域认证信息 header 名
|
|
8
|
+
const xsrfHeaderName = 'Authorization'
|
|
9
|
+
|
|
10
|
+
axios.defaults.timeout = 5000
|
|
11
|
+
axios.defaults.withCredentials = true
|
|
12
|
+
axios.defaults.xsrfHeaderName = xsrfHeaderName
|
|
13
|
+
axios.defaults.xsrfCookieName = xsrfHeaderName
|
|
14
|
+
|
|
15
|
+
// 认证类型
|
|
16
|
+
const AUTH_TYPE = {
|
|
17
|
+
BEARER: 'Bearer',
|
|
18
|
+
BASIC: 'basic',
|
|
19
|
+
AUTH1: 'auth1',
|
|
20
|
+
AUTH2: 'auth2'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// http method
|
|
24
|
+
const METHOD = {
|
|
25
|
+
GET: 'get',
|
|
26
|
+
POST: 'post'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* axios请求
|
|
31
|
+
* @param url 请求地址
|
|
32
|
+
* @param method {METHOD} http method
|
|
33
|
+
* @param params 请求参数
|
|
34
|
+
* @returns {Promise<AxiosResponse<T>>}
|
|
35
|
+
*/
|
|
36
|
+
async function request (url, method, params, config) {
|
|
37
|
+
switch (method) {
|
|
38
|
+
case METHOD.GET:
|
|
39
|
+
return axios.get(url, { params, ...config })
|
|
40
|
+
case METHOD.POST:
|
|
41
|
+
return axios.post(url, params, config)
|
|
42
|
+
default:
|
|
43
|
+
return axios.get(url, { params, ...config })
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 设置认证信息
|
|
49
|
+
* @param auth {Object}
|
|
50
|
+
* @param authType {AUTH_TYPE} 认证类型,默认:{AUTH_TYPE.BEARER}
|
|
51
|
+
*/
|
|
52
|
+
function setAuthorization (auth, authType = AUTH_TYPE.BEARER) {
|
|
53
|
+
switch (authType) {
|
|
54
|
+
case AUTH_TYPE.BEARER:
|
|
55
|
+
Cookie.set(xsrfHeaderName, 'Bearer ' + auth.token, { expires: auth.expireAt })
|
|
56
|
+
break
|
|
57
|
+
case AUTH_TYPE.BASIC:
|
|
58
|
+
case AUTH_TYPE.AUTH1:
|
|
59
|
+
case AUTH_TYPE.AUTH2:
|
|
60
|
+
default:
|
|
61
|
+
break
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 移出认证信息
|
|
67
|
+
* @param authType {AUTH_TYPE} 认证类型
|
|
68
|
+
*/
|
|
69
|
+
function removeAuthorization (authType = AUTH_TYPE.BEARER) {
|
|
70
|
+
switch (authType) {
|
|
71
|
+
case AUTH_TYPE.BEARER:
|
|
72
|
+
Cookie.remove(xsrfHeaderName)
|
|
73
|
+
break
|
|
74
|
+
case AUTH_TYPE.BASIC:
|
|
75
|
+
case AUTH_TYPE.AUTH1:
|
|
76
|
+
case AUTH_TYPE.AUTH2:
|
|
77
|
+
default:
|
|
78
|
+
break
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 检查认证信息
|
|
84
|
+
* @param authType
|
|
85
|
+
* @returns {boolean}
|
|
86
|
+
*/
|
|
87
|
+
function checkAuthorization (authType = AUTH_TYPE.BEARER) {
|
|
88
|
+
switch (authType) {
|
|
89
|
+
case AUTH_TYPE.BEARER:
|
|
90
|
+
if (Cookie.get(xsrfHeaderName)) {
|
|
91
|
+
return true
|
|
92
|
+
}
|
|
93
|
+
break
|
|
94
|
+
case AUTH_TYPE.BASIC:
|
|
95
|
+
case AUTH_TYPE.AUTH1:
|
|
96
|
+
case AUTH_TYPE.AUTH2:
|
|
97
|
+
default:
|
|
98
|
+
break
|
|
99
|
+
}
|
|
100
|
+
return false
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 加载 axios 拦截器
|
|
105
|
+
* @param interceptors
|
|
106
|
+
* @param options
|
|
107
|
+
*/
|
|
108
|
+
function loadInterceptors () {
|
|
109
|
+
// 加载请求拦截器
|
|
110
|
+
axios.interceptors.request.use(config => {
|
|
111
|
+
const token = localStorage.getItem(ACCESS_TOKEN)
|
|
112
|
+
// 如果 token 存在
|
|
113
|
+
// 让每个请求携带自定义 token 请根据实际情况自行修改
|
|
114
|
+
if (token) {
|
|
115
|
+
config.headers['Access-Token'] = token
|
|
116
|
+
}
|
|
117
|
+
if (!config.headers['Content-Type']) {
|
|
118
|
+
config.headers['Content-Type'] = 'application/json;charset=UTF-8'
|
|
119
|
+
}
|
|
120
|
+
return config
|
|
121
|
+
}, errorHandler)
|
|
122
|
+
// 加载响应拦截器
|
|
123
|
+
axios.interceptors.response.use((response) => {
|
|
124
|
+
return response.data
|
|
125
|
+
}, errorHandler)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 异常拦截处理器
|
|
129
|
+
const errorHandler = (error) => {
|
|
130
|
+
if (error.response) {
|
|
131
|
+
const data = error.response.data
|
|
132
|
+
// 从 localstorage 获取 token
|
|
133
|
+
const token = localStorage.getItem(ACCESS_TOKEN)
|
|
134
|
+
if (error.response.status === 403) {
|
|
135
|
+
notification.error({
|
|
136
|
+
message: '禁止访问',
|
|
137
|
+
description: data
|
|
138
|
+
})
|
|
139
|
+
} else if (error.response.status === 401 && !(data.result && data.result.isLogin)) {
|
|
140
|
+
notification.error({
|
|
141
|
+
message: '鉴权失败',
|
|
142
|
+
description: data
|
|
143
|
+
})
|
|
144
|
+
if (token) {
|
|
145
|
+
Vue.$store.dispatch('Logout').then(() => {
|
|
146
|
+
setTimeout(() => {
|
|
147
|
+
window.location.reload()
|
|
148
|
+
}, 1500)
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
} else if (error.response.status === 500) {
|
|
152
|
+
notification.error({
|
|
153
|
+
message: '系统异常',
|
|
154
|
+
description: data
|
|
155
|
+
})
|
|
156
|
+
} else {
|
|
157
|
+
notification.error({
|
|
158
|
+
message: '数据异常',
|
|
159
|
+
description: data
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return Promise.reject(error)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 解析 url 中的参数
|
|
168
|
+
* @param url
|
|
169
|
+
* @returns {Object}
|
|
170
|
+
*/
|
|
171
|
+
function parseUrlParams (url) {
|
|
172
|
+
const params = {}
|
|
173
|
+
if (!url || url === '' || typeof url !== 'string') {
|
|
174
|
+
return params
|
|
175
|
+
}
|
|
176
|
+
const paramsStr = url.split('?')[1]
|
|
177
|
+
if (!paramsStr) {
|
|
178
|
+
return params
|
|
179
|
+
}
|
|
180
|
+
const paramsArr = paramsStr.replace(/&|=/g, ' ').split(' ')
|
|
181
|
+
for (let i = 0; i < paramsArr.length / 2; i++) {
|
|
182
|
+
const value = paramsArr[i * 2 + 1]
|
|
183
|
+
params[paramsArr[i * 2]] = value === 'true' ? true : (value === 'false' ? false : value)
|
|
184
|
+
}
|
|
185
|
+
return params
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
METHOD,
|
|
190
|
+
AUTH_TYPE,
|
|
191
|
+
request,
|
|
192
|
+
setAuthorization,
|
|
193
|
+
removeAuthorization,
|
|
194
|
+
checkAuthorization,
|
|
195
|
+
loadInterceptors,
|
|
196
|
+
parseUrlParams
|
|
197
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import routerMap from '@/router/async/router.map'
|
|
2
|
+
import { mergeI18nFromRoutes } from '@/utils/i18n'
|
|
3
|
+
import Router from 'vue-router'
|
|
4
|
+
import deepMerge from 'deepmerge'
|
|
5
|
+
import basicOptions from '@/router/async/config.async'
|
|
6
|
+
|
|
7
|
+
// 应用配置
|
|
8
|
+
const appOptions = {
|
|
9
|
+
router: undefined,
|
|
10
|
+
i18n: undefined,
|
|
11
|
+
store: undefined
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 设置应用配置
|
|
16
|
+
* @param options
|
|
17
|
+
*/
|
|
18
|
+
function setAppOptions (options) {
|
|
19
|
+
const { router, store, i18n } = options
|
|
20
|
+
appOptions.router = router
|
|
21
|
+
appOptions.store = store
|
|
22
|
+
appOptions.i18n = i18n
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 根据 路由配置 和 路由组件注册 解析路由
|
|
27
|
+
* @param routesConfig 路由配置
|
|
28
|
+
* @param routerMap 本地路由组件注册配置
|
|
29
|
+
*/
|
|
30
|
+
function parseRoutes (routesConfig, routerMap) {
|
|
31
|
+
const routes = []
|
|
32
|
+
routesConfig.forEach(item => {
|
|
33
|
+
// 获取注册在 routerMap 中的 router,初始化 routeCfg
|
|
34
|
+
let router; let routeCfg = {}
|
|
35
|
+
if (typeof item === 'string') {
|
|
36
|
+
router = routerMap[item]
|
|
37
|
+
routeCfg = { path: (router && router.path) || item, router: item }
|
|
38
|
+
} else if (typeof item === 'object') {
|
|
39
|
+
// 当没有设置路由对象名或者设置的是blank路由对象时, 给空界面, path为名称
|
|
40
|
+
if (!item.router || item.router == 'blank') {
|
|
41
|
+
router = routerMap['blank']
|
|
42
|
+
item.path = item.name
|
|
43
|
+
} else {
|
|
44
|
+
router = routerMap[item.router]
|
|
45
|
+
}
|
|
46
|
+
// 查看是否是单页面
|
|
47
|
+
if (item.meta && item.meta.singlePage) {
|
|
48
|
+
router = routerMap['singlePage']
|
|
49
|
+
item.path = item.name
|
|
50
|
+
}
|
|
51
|
+
// 当没在动态路由对象中找到时, 给404页面
|
|
52
|
+
if (!router) {
|
|
53
|
+
router = routerMap['exp404']
|
|
54
|
+
item.path = item.name
|
|
55
|
+
}
|
|
56
|
+
routeCfg = item
|
|
57
|
+
}
|
|
58
|
+
if (!router) {
|
|
59
|
+
console.warn(`can't find register for router ${routeCfg.router}, please register it in advance.`)
|
|
60
|
+
router = typeof item === 'string' ? { path: item, name: item } : item
|
|
61
|
+
}
|
|
62
|
+
// 从 router 和 routeCfg 解析路由
|
|
63
|
+
const meta = {
|
|
64
|
+
authority: router.authority,
|
|
65
|
+
icon: router.icon,
|
|
66
|
+
page: router.page,
|
|
67
|
+
link: router.link,
|
|
68
|
+
params: router.params,
|
|
69
|
+
query: router.query,
|
|
70
|
+
...router.meta
|
|
71
|
+
}
|
|
72
|
+
const cfgMeta = {
|
|
73
|
+
authority: routeCfg.authority,
|
|
74
|
+
icon: routeCfg.icon,
|
|
75
|
+
page: routeCfg.page,
|
|
76
|
+
link: routeCfg.link,
|
|
77
|
+
params: routeCfg.params,
|
|
78
|
+
query: routeCfg.query,
|
|
79
|
+
...routeCfg.meta
|
|
80
|
+
}
|
|
81
|
+
Object.keys(cfgMeta).forEach(key => {
|
|
82
|
+
if (cfgMeta[key] === undefined || cfgMeta[key] === null || cfgMeta[key] === '') {
|
|
83
|
+
delete cfgMeta[key]
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
Object.assign(meta, cfgMeta)
|
|
87
|
+
const route = {
|
|
88
|
+
path: routeCfg.path || router.path || routeCfg.router,
|
|
89
|
+
name: routeCfg.name || router.name,
|
|
90
|
+
component: router.component || router,
|
|
91
|
+
redirect: routeCfg.redirect || router.redirect,
|
|
92
|
+
meta: { ...meta, authority: meta.authority || '*' }
|
|
93
|
+
}
|
|
94
|
+
if (routeCfg.invisible || router.invisible) {
|
|
95
|
+
route.meta.invisible = true
|
|
96
|
+
}
|
|
97
|
+
if (routeCfg.children && routeCfg.children.length > 0) {
|
|
98
|
+
route.children = parseRoutes(routeCfg.children, routerMap)
|
|
99
|
+
}
|
|
100
|
+
routes.push(route)
|
|
101
|
+
})
|
|
102
|
+
return routes
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 加载路由
|
|
107
|
+
* @param routesConfig {[{router: string, children: [{router: string, children: string[]}, {router: string, children: string[]}, {router: string, authority: string, name: string, icon: string}, {path: string, router: string, name: string, icon: string, link: string}, {path: string, router: string, name: string, icon: string, link: string}]}]} 路由配置
|
|
108
|
+
*/
|
|
109
|
+
function loadRoutes (routesConfig) {
|
|
110
|
+
// 兼容 0.6.1 以下版本
|
|
111
|
+
/** ************* 兼容 version < v0.6.1 *****************/
|
|
112
|
+
if (arguments.length > 0) {
|
|
113
|
+
const arg0 = arguments[0]
|
|
114
|
+
if (arg0.router || arg0.i18n || arg0.store) {
|
|
115
|
+
routesConfig = arguments[1]
|
|
116
|
+
console.error('the usage of signature loadRoutes({router, store, i18n}, routesConfig) is out of date, please use the new signature: loadRoutes(routesConfig).')
|
|
117
|
+
console.error('方法签名 loadRoutes({router, store, i18n}, routesConfig) 的用法已过时, 请使用新的方法签名 loadRoutes(routesConfig)。')
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/** ************* 兼容 version < v0.6.1 *****************/
|
|
121
|
+
|
|
122
|
+
// 应用配置
|
|
123
|
+
const { router, store, i18n } = appOptions
|
|
124
|
+
|
|
125
|
+
// 如果 routesConfig 有值,则更新到本地,否则从本地获取
|
|
126
|
+
if (routesConfig) {
|
|
127
|
+
store.commit('account/setRoutesConfig', routesConfig)
|
|
128
|
+
} else {
|
|
129
|
+
routesConfig = store.getters['account/routesConfig']
|
|
130
|
+
}
|
|
131
|
+
// 如果开启了异步路由,则加载异步路由配置
|
|
132
|
+
const asyncRoutes = store.state.setting.asyncRoutes
|
|
133
|
+
if (asyncRoutes) {
|
|
134
|
+
if (routesConfig && routesConfig.length > 0) {
|
|
135
|
+
const routes = parseRoutes(routesConfig, routerMap)
|
|
136
|
+
const finalRoutes = mergeRoutes(basicOptions.routes, routes)
|
|
137
|
+
formatRoutes(finalRoutes)
|
|
138
|
+
router.options = { ...router.options, routes: finalRoutes }
|
|
139
|
+
router.matcher = new Router({ ...router.options, routes: [] }).matcher
|
|
140
|
+
router.addRoutes(finalRoutes)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// 提取路由国际化数据
|
|
144
|
+
mergeI18nFromRoutes(i18n, router.options.routes)
|
|
145
|
+
// 初始化Admin后台菜单数据
|
|
146
|
+
const rootRoute = router.options.routes.find(item => item.path === '/')
|
|
147
|
+
const menuRoutes = rootRoute && rootRoute.children
|
|
148
|
+
if (menuRoutes) {
|
|
149
|
+
store.commit('setting/setMenuData', menuRoutes)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 合并路由
|
|
155
|
+
* @param target {Route[]}
|
|
156
|
+
* @param source {Route[]}
|
|
157
|
+
* @returns {Route[]}
|
|
158
|
+
*/
|
|
159
|
+
function mergeRoutes (target, source) {
|
|
160
|
+
const routesMap = {}
|
|
161
|
+
// eslint-disable-next-line no-return-assign
|
|
162
|
+
target.forEach(item => routesMap[item.path] = item)
|
|
163
|
+
// eslint-disable-next-line no-return-assign
|
|
164
|
+
source.forEach(item => routesMap[item.path] = item)
|
|
165
|
+
return Object.values(routesMap)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 深度合并路由
|
|
170
|
+
* @param target {Route[]}
|
|
171
|
+
* @param source {Route[]}
|
|
172
|
+
* @returns {Route[]}
|
|
173
|
+
*/
|
|
174
|
+
function deepMergeRoutes (target, source) {
|
|
175
|
+
// 映射路由数组
|
|
176
|
+
const mapRoutes = routes => {
|
|
177
|
+
const routesMap = {}
|
|
178
|
+
routes.forEach(item => {
|
|
179
|
+
routesMap[item.path] = {
|
|
180
|
+
...item,
|
|
181
|
+
children: item.children ? mapRoutes(item.children) : undefined
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
return routesMap
|
|
185
|
+
}
|
|
186
|
+
const tarMap = mapRoutes(target)
|
|
187
|
+
const srcMap = mapRoutes(source)
|
|
188
|
+
|
|
189
|
+
// 合并路由
|
|
190
|
+
const merge = deepMerge(tarMap, srcMap)
|
|
191
|
+
|
|
192
|
+
// 转换为 routes 数组
|
|
193
|
+
const parseRoutesMap = routesMap => {
|
|
194
|
+
return Object.values(routesMap).map(item => {
|
|
195
|
+
if (item.children) {
|
|
196
|
+
item.children = parseRoutesMap(item.children)
|
|
197
|
+
} else {
|
|
198
|
+
delete item.children
|
|
199
|
+
}
|
|
200
|
+
return item
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
return parseRoutesMap(merge)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* 格式化路由
|
|
208
|
+
* @param routes 路由配置
|
|
209
|
+
*/
|
|
210
|
+
function formatRoutes (routes) {
|
|
211
|
+
routes.forEach(route => {
|
|
212
|
+
const { path } = route
|
|
213
|
+
if (!path.startsWith('/') && path !== '*') {
|
|
214
|
+
route.path = '/' + path
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
formatAuthority(routes)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 格式化路由的权限配置
|
|
222
|
+
* @param routes 路由
|
|
223
|
+
* @param pAuthorities 父级路由权限配置集合
|
|
224
|
+
*/
|
|
225
|
+
function formatAuthority (routes, pAuthorities = []) {
|
|
226
|
+
routes.forEach(route => {
|
|
227
|
+
const meta = route.meta
|
|
228
|
+
const defaultAuthority = pAuthorities[pAuthorities.length - 1] || { permission: '*' }
|
|
229
|
+
if (meta) {
|
|
230
|
+
let authority = {}
|
|
231
|
+
if (!meta.authority) {
|
|
232
|
+
authority = defaultAuthority
|
|
233
|
+
} else if (typeof meta.authority === 'string') {
|
|
234
|
+
authority.permission = meta.authority
|
|
235
|
+
} else if (typeof meta.authority === 'object') {
|
|
236
|
+
authority = meta.authority
|
|
237
|
+
const { role } = authority
|
|
238
|
+
if (typeof role === 'string') {
|
|
239
|
+
authority.role = [role]
|
|
240
|
+
}
|
|
241
|
+
if (!authority.permission && !authority.role) {
|
|
242
|
+
authority = defaultAuthority
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
meta.authority = authority
|
|
246
|
+
} else {
|
|
247
|
+
const authority = defaultAuthority
|
|
248
|
+
route.meta = { authority }
|
|
249
|
+
}
|
|
250
|
+
route.meta.pAuthorities = pAuthorities
|
|
251
|
+
if (route.children) {
|
|
252
|
+
formatAuthority(route.children, [...pAuthorities, route.meta.authority])
|
|
253
|
+
}
|
|
254
|
+
})
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* 从路由 path 解析 i18n key
|
|
259
|
+
* @param path
|
|
260
|
+
* @returns {*}
|
|
261
|
+
*/
|
|
262
|
+
function getI18nKey (path) {
|
|
263
|
+
const keys = path.split('/').filter(item => !item.startsWith(':') && item != '')
|
|
264
|
+
keys.push('name')
|
|
265
|
+
return keys.join('.')
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* 加载导航守卫
|
|
270
|
+
* @param guards
|
|
271
|
+
* @param options
|
|
272
|
+
*/
|
|
273
|
+
function loadGuards (guards, options) {
|
|
274
|
+
const { beforeEach, afterEach } = guards
|
|
275
|
+
const { router } = options
|
|
276
|
+
beforeEach.forEach(guard => {
|
|
277
|
+
if (guard && typeof guard === 'function') {
|
|
278
|
+
router.beforeEach((to, from, next) => guard(to, from, next, options))
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
afterEach.forEach(guard => {
|
|
282
|
+
if (guard && typeof guard === 'function') {
|
|
283
|
+
router.afterEach((to, from) => guard(to, from, options))
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 资源服务路由转新路由
|
|
290
|
+
* @param func
|
|
291
|
+
*/
|
|
292
|
+
function funcToRouter (func) {
|
|
293
|
+
const router = [{
|
|
294
|
+
router: 'root',
|
|
295
|
+
children: positionRouter(parsefunc(func))
|
|
296
|
+
}]
|
|
297
|
+
// 任何情况首位加入资源管理
|
|
298
|
+
const resourceManageMain = {
|
|
299
|
+
router: 'resourceManageMain',
|
|
300
|
+
position: 0,
|
|
301
|
+
icon: 'api',
|
|
302
|
+
name: '资源管理'
|
|
303
|
+
}
|
|
304
|
+
router[0].children.unshift(resourceManageMain)
|
|
305
|
+
return router
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function parsefunc (func) {
|
|
309
|
+
const router = []
|
|
310
|
+
for (const row of func) {
|
|
311
|
+
const route = {
|
|
312
|
+
router: row.link,
|
|
313
|
+
meta: {
|
|
314
|
+
singlePage: row.navigate
|
|
315
|
+
},
|
|
316
|
+
position: row.position - 1,
|
|
317
|
+
icon: row.icon,
|
|
318
|
+
name: row.name
|
|
319
|
+
}
|
|
320
|
+
if (row.children && row.children.length > 0) {
|
|
321
|
+
route.children = parsefunc(row.children)
|
|
322
|
+
}
|
|
323
|
+
router.push(route)
|
|
324
|
+
}
|
|
325
|
+
return router
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* 资源服务路由排序
|
|
330
|
+
*/
|
|
331
|
+
function positionRouter (r) {
|
|
332
|
+
let router = []
|
|
333
|
+
for (const row of r) {
|
|
334
|
+
router[row.position] = row
|
|
335
|
+
}
|
|
336
|
+
router = arrRemoveEmpty(router)
|
|
337
|
+
return router
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* 数组去空值
|
|
342
|
+
*/
|
|
343
|
+
function arrRemoveEmpty (arr) {
|
|
344
|
+
for (var i = 0; i < arr.length; i++) {
|
|
345
|
+
if (arr[i] == '' || typeof (arr[i]) == 'undefined') {
|
|
346
|
+
arr.splice(i, 1)
|
|
347
|
+
i--
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return arr
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export { parseRoutes, loadRoutes, formatAuthority, getI18nKey, loadGuards, deepMergeRoutes, formatRoutes, setAppOptions, funcToRouter }
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const { cssResolve } = require('../config/replacer')
|
|
2
|
+
// 修正 webpack-theme-color-replacer 插件提取的 css 结果
|
|
3
|
+
function resolveCss (output, srcArr) {
|
|
4
|
+
const regExps = []
|
|
5
|
+
// 提取 resolve 配置中所有的正则配置
|
|
6
|
+
Object.keys(cssResolve).forEach(key => {
|
|
7
|
+
let isRegExp = false
|
|
8
|
+
let reg = {}
|
|
9
|
+
try {
|
|
10
|
+
reg = eval(key)
|
|
11
|
+
isRegExp = reg instanceof RegExp
|
|
12
|
+
} catch (e) {
|
|
13
|
+
isRegExp = false
|
|
14
|
+
}
|
|
15
|
+
if (isRegExp) {
|
|
16
|
+
regExps.push([reg, cssResolve[key]])
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// 去重
|
|
21
|
+
srcArr = dropDuplicate(srcArr)
|
|
22
|
+
|
|
23
|
+
// 处理 css
|
|
24
|
+
const outArr = []
|
|
25
|
+
srcArr.forEach(text => {
|
|
26
|
+
// 转换为 css 对象
|
|
27
|
+
const cssObj = parseCssObj(text)
|
|
28
|
+
// 根据selector匹配配置,匹配成功,则按配置处理 css
|
|
29
|
+
if (cssResolve[cssObj.selector] != undefined) {
|
|
30
|
+
const cfg = cssResolve[cssObj.selector]
|
|
31
|
+
if (cfg) {
|
|
32
|
+
outArr.push(cfg.resolve(text, cssObj))
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
let cssText = ''
|
|
36
|
+
// 匹配不成功,则测试是否有匹配的正则配置,有则按正则对应的配置处理
|
|
37
|
+
for (const regExp of regExps) {
|
|
38
|
+
if (regExp[0].test(cssObj.selector)) {
|
|
39
|
+
const cssCfg = regExp[1]
|
|
40
|
+
cssText = cssCfg ? cssCfg.resolve(text, cssObj) : ''
|
|
41
|
+
break
|
|
42
|
+
}
|
|
43
|
+
// 未匹配到正则,则设置 cssText 为默认的 css(即不处理)
|
|
44
|
+
cssText = text
|
|
45
|
+
}
|
|
46
|
+
if (cssText != '') {
|
|
47
|
+
outArr.push(cssText)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
output = outArr.join('\n')
|
|
52
|
+
return output
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 数组去重
|
|
56
|
+
function dropDuplicate (arr) {
|
|
57
|
+
const map = {}
|
|
58
|
+
const r = []
|
|
59
|
+
for (const s of arr) {
|
|
60
|
+
if (!map[s]) {
|
|
61
|
+
r.push(s)
|
|
62
|
+
map[s] = 1
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return r
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 从字符串解析 css 对象
|
|
70
|
+
* @param cssText
|
|
71
|
+
* @returns {{
|
|
72
|
+
* name: String,
|
|
73
|
+
* rules: Array[String],
|
|
74
|
+
* toText: function
|
|
75
|
+
* }}
|
|
76
|
+
*/
|
|
77
|
+
function parseCssObj (cssText) {
|
|
78
|
+
const css = {}
|
|
79
|
+
const ruleIndex = cssText.indexOf('{')
|
|
80
|
+
css.selector = cssText.substring(0, ruleIndex)
|
|
81
|
+
const ruleBody = cssText.substring(ruleIndex + 1, cssText.length - 1)
|
|
82
|
+
const rules = ruleBody.split(';')
|
|
83
|
+
css.rules = rules
|
|
84
|
+
css.toText = function () {
|
|
85
|
+
let body = ''
|
|
86
|
+
this.rules.forEach(item => { body += item + ';' })
|
|
87
|
+
return `${this.selector}{${body}}`
|
|
88
|
+
}
|
|
89
|
+
return css
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
module.exports = { resolveCss }
|