vue2-client 0.1.1 → 1.2.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 +56 -36
- package/babel.config.js +14 -5
- package/docs/index.md +29 -0
- package/index.js +28 -35
- package/jest.config.js +3 -0
- package/package.json +68 -22
- package/public/index.html +27 -17
- 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 +46 -46
- 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 +35 -35
- 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/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/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 +153 -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,181 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* Blob.js
|
|
3
|
+
* A Blob implementation.
|
|
4
|
+
* 2014-05-27
|
|
5
|
+
*
|
|
6
|
+
* By Eli Grey, http://eligrey.com
|
|
7
|
+
* By Devin Samarin, https://github.com/eboyjr
|
|
8
|
+
* License: X11/MIT
|
|
9
|
+
* See LICENSE.md
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/*global self, unescape */
|
|
13
|
+
/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
|
|
14
|
+
plusplus: true */
|
|
15
|
+
|
|
16
|
+
/*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
|
|
17
|
+
|
|
18
|
+
(function (view) {
|
|
19
|
+
"use strict";
|
|
20
|
+
|
|
21
|
+
view.URL = view.URL || view.webkitURL;
|
|
22
|
+
|
|
23
|
+
if (view.Blob && view.URL) {
|
|
24
|
+
try {
|
|
25
|
+
new Blob;
|
|
26
|
+
return;
|
|
27
|
+
} catch (e) {
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Internally we use a BlobBuilder implementation to base Blob off of
|
|
32
|
+
// in order to support older browsers that only have BlobBuilder
|
|
33
|
+
var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function (view) {
|
|
34
|
+
var
|
|
35
|
+
get_class = function (object) {
|
|
36
|
+
return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
|
|
37
|
+
}
|
|
38
|
+
, FakeBlobBuilder = function BlobBuilder() {
|
|
39
|
+
this.data = [];
|
|
40
|
+
}
|
|
41
|
+
, FakeBlob = function Blob(data, type, encoding) {
|
|
42
|
+
this.data = data;
|
|
43
|
+
this.size = data.length;
|
|
44
|
+
this.type = type;
|
|
45
|
+
this.encoding = encoding;
|
|
46
|
+
}
|
|
47
|
+
, FBB_proto = FakeBlobBuilder.prototype
|
|
48
|
+
, FB_proto = FakeBlob.prototype
|
|
49
|
+
, FileReaderSync = view.FileReaderSync
|
|
50
|
+
, FileException = function (type) {
|
|
51
|
+
this.code = this[this.name = type];
|
|
52
|
+
}
|
|
53
|
+
, file_ex_codes = (
|
|
54
|
+
"NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
|
|
55
|
+
+ "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
|
|
56
|
+
).split(" ")
|
|
57
|
+
, file_ex_code = file_ex_codes.length
|
|
58
|
+
, real_URL = view.URL || view.webkitURL || view
|
|
59
|
+
, real_create_object_URL = real_URL.createObjectURL
|
|
60
|
+
, real_revoke_object_URL = real_URL.revokeObjectURL
|
|
61
|
+
, URL = real_URL
|
|
62
|
+
, btoa = view.btoa
|
|
63
|
+
, atob = view.atob
|
|
64
|
+
|
|
65
|
+
, ArrayBuffer = view.ArrayBuffer
|
|
66
|
+
, Uint8Array = view.Uint8Array
|
|
67
|
+
;
|
|
68
|
+
FakeBlob.fake = FB_proto.fake = true;
|
|
69
|
+
while (file_ex_code--) {
|
|
70
|
+
FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
|
|
71
|
+
}
|
|
72
|
+
if (!real_URL.createObjectURL) {
|
|
73
|
+
URL = view.URL = {};
|
|
74
|
+
}
|
|
75
|
+
URL.createObjectURL = function (blob) {
|
|
76
|
+
var
|
|
77
|
+
type = blob.type
|
|
78
|
+
, data_URI_header
|
|
79
|
+
;
|
|
80
|
+
if (type === null) {
|
|
81
|
+
type = "application/octet-stream";
|
|
82
|
+
}
|
|
83
|
+
if (blob instanceof FakeBlob) {
|
|
84
|
+
data_URI_header = "data:" + type;
|
|
85
|
+
if (blob.encoding === "base64") {
|
|
86
|
+
return data_URI_header + ";base64," + blob.data;
|
|
87
|
+
} else if (blob.encoding === "URI") {
|
|
88
|
+
return data_URI_header + "," + decodeURIComponent(blob.data);
|
|
89
|
+
}
|
|
90
|
+
if (btoa) {
|
|
91
|
+
return data_URI_header + ";base64," + btoa(blob.data);
|
|
92
|
+
} else {
|
|
93
|
+
return data_URI_header + "," + encodeURIComponent(blob.data);
|
|
94
|
+
}
|
|
95
|
+
} else if (real_create_object_URL) {
|
|
96
|
+
return real_create_object_URL.call(real_URL, blob);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
URL.revokeObjectURL = function (object_URL) {
|
|
100
|
+
if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
|
|
101
|
+
real_revoke_object_URL.call(real_URL, object_URL);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
FBB_proto.append = function (data/*, endings*/) {
|
|
105
|
+
var bb = this.data;
|
|
106
|
+
// decode data to a binary string
|
|
107
|
+
if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
|
|
108
|
+
var
|
|
109
|
+
str = ""
|
|
110
|
+
, buf = new Uint8Array(data)
|
|
111
|
+
, i = 0
|
|
112
|
+
, buf_len = buf.length
|
|
113
|
+
;
|
|
114
|
+
for (; i < buf_len; i++) {
|
|
115
|
+
str += String.fromCharCode(buf[i]);
|
|
116
|
+
}
|
|
117
|
+
bb.push(str);
|
|
118
|
+
} else if (get_class(data) === "Blob" || get_class(data) === "File") {
|
|
119
|
+
if (FileReaderSync) {
|
|
120
|
+
var fr = new FileReaderSync;
|
|
121
|
+
bb.push(fr.readAsBinaryString(data));
|
|
122
|
+
} else {
|
|
123
|
+
// async FileReader won't work as BlobBuilder is sync
|
|
124
|
+
throw new FileException("NOT_READABLE_ERR");
|
|
125
|
+
}
|
|
126
|
+
} else if (data instanceof FakeBlob) {
|
|
127
|
+
if (data.encoding === "base64" && atob) {
|
|
128
|
+
bb.push(atob(data.data));
|
|
129
|
+
} else if (data.encoding === "URI") {
|
|
130
|
+
bb.push(decodeURIComponent(data.data));
|
|
131
|
+
} else if (data.encoding === "raw") {
|
|
132
|
+
bb.push(data.data);
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
if (typeof data !== "string") {
|
|
136
|
+
data += ""; // convert unsupported types to strings
|
|
137
|
+
}
|
|
138
|
+
// decode UTF-16 to binary string
|
|
139
|
+
bb.push(unescape(encodeURIComponent(data)));
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
FBB_proto.getBlob = function (type) {
|
|
143
|
+
if (!arguments.length) {
|
|
144
|
+
type = null;
|
|
145
|
+
}
|
|
146
|
+
return new FakeBlob(this.data.join(""), type, "raw");
|
|
147
|
+
};
|
|
148
|
+
FBB_proto.toString = function () {
|
|
149
|
+
return "[object BlobBuilder]";
|
|
150
|
+
};
|
|
151
|
+
FB_proto.slice = function (start, end, type) {
|
|
152
|
+
var args = arguments.length;
|
|
153
|
+
if (args < 3) {
|
|
154
|
+
type = null;
|
|
155
|
+
}
|
|
156
|
+
return new FakeBlob(
|
|
157
|
+
this.data.slice(start, args > 1 ? end : this.data.length)
|
|
158
|
+
, type
|
|
159
|
+
, this.encoding
|
|
160
|
+
);
|
|
161
|
+
};
|
|
162
|
+
FB_proto.toString = function () {
|
|
163
|
+
return "[object Blob]";
|
|
164
|
+
};
|
|
165
|
+
FB_proto.close = function () {
|
|
166
|
+
this.size = this.data.length = 0;
|
|
167
|
+
};
|
|
168
|
+
return FakeBlobBuilder;
|
|
169
|
+
}(view));
|
|
170
|
+
|
|
171
|
+
view.Blob = function Blob(blobParts, options) {
|
|
172
|
+
var type = options ? (options.type || "") : "";
|
|
173
|
+
var builder = new BlobBuilder();
|
|
174
|
+
if (blobParts) {
|
|
175
|
+
for (var i = 0, len = blobParts.length; i < len; i++) {
|
|
176
|
+
builder.append(blobParts[i]);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return builder.getBlob(type);
|
|
180
|
+
};
|
|
181
|
+
}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
require('script-loader!file-saver');
|
|
3
|
+
require('./Blob.js');
|
|
4
|
+
require('script-loader!xlsx/dist/xlsx.core.min');
|
|
5
|
+
|
|
6
|
+
function generateArray(table) {
|
|
7
|
+
var out = [];
|
|
8
|
+
var rows = table.querySelectorAll('tr');
|
|
9
|
+
var ranges = [];
|
|
10
|
+
for (var R = 0; R < rows.length; ++R) {
|
|
11
|
+
var outRow = [];
|
|
12
|
+
var row = rows[R];
|
|
13
|
+
var columns = row.querySelectorAll('td');
|
|
14
|
+
for (var C = 0; C < columns.length; ++C) {
|
|
15
|
+
var cell = columns[C];
|
|
16
|
+
var colspan = cell.getAttribute('colspan');
|
|
17
|
+
var rowspan = cell.getAttribute('rowspan');
|
|
18
|
+
var cellValue = cell.innerText;
|
|
19
|
+
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
|
|
20
|
+
|
|
21
|
+
//Skip ranges
|
|
22
|
+
ranges.forEach(function (range) {
|
|
23
|
+
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
|
|
24
|
+
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
//Handle Row Span
|
|
29
|
+
if (rowspan || colspan) {
|
|
30
|
+
rowspan = rowspan || 1;
|
|
31
|
+
colspan = colspan || 1;
|
|
32
|
+
ranges.push({s: {r: R, c: outRow.length}, e: {r: R + rowspan - 1, c: outRow.length + colspan - 1}});
|
|
33
|
+
}
|
|
34
|
+
;
|
|
35
|
+
|
|
36
|
+
//Handle Value
|
|
37
|
+
outRow.push(cellValue !== "" ? cellValue : null);
|
|
38
|
+
|
|
39
|
+
//Handle Colspan
|
|
40
|
+
if (colspan) for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
|
|
41
|
+
}
|
|
42
|
+
out.push(outRow);
|
|
43
|
+
}
|
|
44
|
+
return [out, ranges];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function datenum(v, date1904) {
|
|
48
|
+
if (date1904) v += 1462;
|
|
49
|
+
var epoch = Date.parse(v);
|
|
50
|
+
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function sheet_from_array_of_arrays(data, opts) {
|
|
54
|
+
var ws = {};
|
|
55
|
+
var range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}};
|
|
56
|
+
for (var R = 0; R != data.length; ++R) {
|
|
57
|
+
for (var C = 0; C != data[R].length; ++C) {
|
|
58
|
+
if (range.s.r > R) range.s.r = R;
|
|
59
|
+
if (range.s.c > C) range.s.c = C;
|
|
60
|
+
if (range.e.r < R) range.e.r = R;
|
|
61
|
+
if (range.e.c < C) range.e.c = C;
|
|
62
|
+
var cell = {v: data[R][C]};
|
|
63
|
+
if (cell.v == null) continue;
|
|
64
|
+
var cell_ref = XLSX.utils.encode_cell({c: C, r: R});
|
|
65
|
+
|
|
66
|
+
if (typeof cell.v === 'number') cell.t = 'n';
|
|
67
|
+
else if (typeof cell.v === 'boolean') cell.t = 'b';
|
|
68
|
+
else if (cell.v instanceof Date) {
|
|
69
|
+
cell.t = 'n';
|
|
70
|
+
cell.z = XLSX.SSF._table[14];
|
|
71
|
+
cell.v = datenum(cell.v);
|
|
72
|
+
} else cell.t = 's';
|
|
73
|
+
|
|
74
|
+
ws[cell_ref] = cell;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
|
|
78
|
+
return ws;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function Workbook() {
|
|
82
|
+
if (!(this instanceof Workbook)) return new Workbook();
|
|
83
|
+
this.SheetNames = [];
|
|
84
|
+
this.Sheets = {};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function s2ab(s) {
|
|
88
|
+
var buf = new ArrayBuffer(s.length);
|
|
89
|
+
var view = new Uint8Array(buf);
|
|
90
|
+
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
|
91
|
+
return buf;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function exportTable(id) {
|
|
95
|
+
var theTable = document.getElementById(id);
|
|
96
|
+
console.log('a')
|
|
97
|
+
var oo = generateArray(theTable);
|
|
98
|
+
var ranges = oo[1];
|
|
99
|
+
|
|
100
|
+
/* original data */
|
|
101
|
+
var data = oo[0];
|
|
102
|
+
var ws_name = "SheetJS";
|
|
103
|
+
console.log(data);
|
|
104
|
+
|
|
105
|
+
var wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
|
|
106
|
+
|
|
107
|
+
/* add ranges to worksheet */
|
|
108
|
+
// ws['!cols'] = ['apple', 'banan'];
|
|
109
|
+
ws['!merges'] = ranges;
|
|
110
|
+
|
|
111
|
+
/* add worksheet to workbook */
|
|
112
|
+
wb.SheetNames.push(ws_name);
|
|
113
|
+
wb.Sheets[ws_name] = ws;
|
|
114
|
+
|
|
115
|
+
var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
|
|
116
|
+
|
|
117
|
+
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx")
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function formatJson(jsonData) {
|
|
121
|
+
console.log(jsonData)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function exportJson(th, jsonData, defaultTitle) {
|
|
125
|
+
|
|
126
|
+
/* original data */
|
|
127
|
+
|
|
128
|
+
var data = jsonData;
|
|
129
|
+
data.unshift(th);
|
|
130
|
+
var ws_name = "SheetJS";
|
|
131
|
+
|
|
132
|
+
var wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
/* add worksheet to workbook */
|
|
136
|
+
wb.SheetNames.push(ws_name);
|
|
137
|
+
wb.Sheets[ws_name] = ws;
|
|
138
|
+
|
|
139
|
+
var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
|
|
140
|
+
var title = defaultTitle || '列表'
|
|
141
|
+
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), title + ".xlsx")
|
|
142
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import moment from 'moment'
|
|
3
|
+
import 'moment/locale/zh-cn'
|
|
4
|
+
|
|
5
|
+
moment.locale('zh-cn')
|
|
6
|
+
|
|
7
|
+
Vue.filter('NumberFormat', function (value) {
|
|
8
|
+
if (!value) {
|
|
9
|
+
return '0'
|
|
10
|
+
}
|
|
11
|
+
// 将整数部分逢三一断
|
|
12
|
+
return value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
Vue.filter('dayjs', function (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
|
|
16
|
+
return moment(dataStr).format(pattern)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
Vue.filter('moment', function (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
|
|
20
|
+
return moment(dataStr).format(pattern)
|
|
21
|
+
})
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 把对象按照 js配置文件的格式进行格式化
|
|
3
|
+
* @param obj 格式化的对象
|
|
4
|
+
* @param dep 层级,此项无需传值
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
function formatConfig (obj, dep) {
|
|
8
|
+
dep = dep || 1
|
|
9
|
+
const LN = '\n'; const TAB = ' '
|
|
10
|
+
let indent = ''
|
|
11
|
+
for (let i = 0; i < dep; i++) {
|
|
12
|
+
indent += TAB
|
|
13
|
+
}
|
|
14
|
+
let isArray = false; let arrayLastIsObj = false
|
|
15
|
+
let str = ''; let prefix = '{'; let subfix = '}'
|
|
16
|
+
if (Array.isArray(obj)) {
|
|
17
|
+
isArray = true
|
|
18
|
+
prefix = '['
|
|
19
|
+
subfix = ']'
|
|
20
|
+
str = obj.map((item, index) => {
|
|
21
|
+
let format = ''
|
|
22
|
+
if (typeof item == 'function') {
|
|
23
|
+
//
|
|
24
|
+
} else if (typeof item == 'object') {
|
|
25
|
+
arrayLastIsObj = true
|
|
26
|
+
format = `${LN}${indent}${formatConfig(item, dep + 1)},`
|
|
27
|
+
} else if ((typeof item == 'number' && !isNaN(item)) || typeof item == 'boolean') {
|
|
28
|
+
format = `${item},`
|
|
29
|
+
} else if (typeof item == 'string') {
|
|
30
|
+
format = `'${item}',`
|
|
31
|
+
}
|
|
32
|
+
if (index == obj.length - 1) {
|
|
33
|
+
format = format.substring(0, format.length - 1)
|
|
34
|
+
} else {
|
|
35
|
+
arrayLastIsObj = false
|
|
36
|
+
}
|
|
37
|
+
return format
|
|
38
|
+
}).join('')
|
|
39
|
+
} else if (typeof obj != 'function' && typeof obj == 'object') {
|
|
40
|
+
str = Object.keys(obj).map((key, index, keys) => {
|
|
41
|
+
const val = obj[key]
|
|
42
|
+
let format = ''
|
|
43
|
+
if (typeof val == 'function') {
|
|
44
|
+
//
|
|
45
|
+
} else if (typeof val == 'object') {
|
|
46
|
+
format = `${LN}${indent}${key}: ${formatConfig(val, dep + 1)},`
|
|
47
|
+
} else if ((typeof val == 'number' && !isNaN(val)) || typeof val == 'boolean') {
|
|
48
|
+
format = `${LN}${indent}${key}: ${val},`
|
|
49
|
+
} else if (typeof val == 'string') {
|
|
50
|
+
format = `${LN}${indent}${key}: '${val}',`
|
|
51
|
+
}
|
|
52
|
+
if (index == keys.length - 1) {
|
|
53
|
+
format = format.substring(0, format.length - 1)
|
|
54
|
+
}
|
|
55
|
+
return format
|
|
56
|
+
}).join('')
|
|
57
|
+
}
|
|
58
|
+
const len = TAB.length
|
|
59
|
+
if (indent.length >= len) {
|
|
60
|
+
indent = indent.substring(0, indent.length - len)
|
|
61
|
+
}
|
|
62
|
+
if (!isArray || arrayLastIsObj) {
|
|
63
|
+
subfix = LN + indent + subfix
|
|
64
|
+
}
|
|
65
|
+
return `${prefix}${str}${subfix}`
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = { formatConfig }
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import VueI18n from 'vue-i18n'
|
|
3
|
+
import routesI18n from '@vue2-client/router/i18n'
|
|
4
|
+
import './Objects'
|
|
5
|
+
import { getI18nKey } from '@vue2-client/utils/routerUtil'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 创建 i18n 配置
|
|
9
|
+
* @param locale 本地化语言
|
|
10
|
+
* @param fallback 回退语言
|
|
11
|
+
* @returns {VueI18n}
|
|
12
|
+
*/
|
|
13
|
+
function initI18n (locale, fallback) {
|
|
14
|
+
Vue.use(VueI18n)
|
|
15
|
+
const i18nOptions = {
|
|
16
|
+
locale,
|
|
17
|
+
fallbackLocale: fallback,
|
|
18
|
+
silentFallbackWarn: true
|
|
19
|
+
}
|
|
20
|
+
return new VueI18n(i18nOptions)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 根据 router options 配置生成 国际化语言
|
|
25
|
+
* @param lang
|
|
26
|
+
* @param routes
|
|
27
|
+
* @param valueKey
|
|
28
|
+
* @returns {*}
|
|
29
|
+
*/
|
|
30
|
+
function generateI18n (lang, routes, valueKey) {
|
|
31
|
+
routes.forEach(route => {
|
|
32
|
+
const keys = getI18nKey(route.fullPath).split('.')
|
|
33
|
+
const value = valueKey === 'path' ? route[valueKey].split('/').filter(item => !item.startsWith(':') && item != '').join('.') : route[valueKey]
|
|
34
|
+
lang.assignProps(keys, value)
|
|
35
|
+
if (route.children) {
|
|
36
|
+
generateI18n(lang, route.children, valueKey)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
return lang
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 格式化 router.options.routes,生成 fullPath
|
|
44
|
+
* @param routes
|
|
45
|
+
* @param parentPath
|
|
46
|
+
*/
|
|
47
|
+
function formatFullPath (routes, parentPath = '') {
|
|
48
|
+
routes.forEach(route => {
|
|
49
|
+
const isFullPath = route.path.substring(0, 1) === '/'
|
|
50
|
+
route.fullPath = isFullPath ? route.path : (parentPath === '/' ? parentPath + route.path : parentPath + '/' + route.path)
|
|
51
|
+
if (route.children) {
|
|
52
|
+
formatFullPath(route.children, route.fullPath)
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 从路由提取国际化数据
|
|
59
|
+
* @param i18n
|
|
60
|
+
* @param routes
|
|
61
|
+
*/
|
|
62
|
+
function mergeI18nFromRoutes (i18n, routes) {
|
|
63
|
+
formatFullPath(routes)
|
|
64
|
+
// eslint-disable-next-line no-new-object
|
|
65
|
+
const CN = generateI18n(new Object(), routes, 'name')
|
|
66
|
+
// eslint-disable-next-line no-new-object
|
|
67
|
+
const US = generateI18n(new Object(), routes, 'path')
|
|
68
|
+
i18n.mergeLocaleMessage('CN', CN)
|
|
69
|
+
i18n.mergeLocaleMessage('US', US)
|
|
70
|
+
const messages = routesI18n.messages
|
|
71
|
+
Object.keys(messages).forEach(lang => {
|
|
72
|
+
i18n.mergeLocaleMessage(lang, messages[lang])
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
initI18n,
|
|
78
|
+
mergeI18nFromRoutes,
|
|
79
|
+
formatFullPath
|
|
80
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// indexDB 存储
|
|
2
|
+
import { post } from '@vue2-client/services/api/restTools'
|
|
3
|
+
|
|
4
|
+
export const indexedDB = {
|
|
5
|
+
db: undefined,
|
|
6
|
+
indexedDB: window.indexedDB || window.webkitindexedDB,
|
|
7
|
+
IDBKeyRange: window.IDBKeyRange || window.webkitIDBKeyRange, // 键范围
|
|
8
|
+
openDB: function (callback) {
|
|
9
|
+
// 建立或打开数据库,建立对象存储空间(ObjectStore)
|
|
10
|
+
const self = this
|
|
11
|
+
if (self.db) {
|
|
12
|
+
callback(self.db)
|
|
13
|
+
} else {
|
|
14
|
+
const version = 1
|
|
15
|
+
const request = self.indexedDB.open('view', version)
|
|
16
|
+
|
|
17
|
+
request.onerror = function (e) {
|
|
18
|
+
console.error('打开数据库失败:' + e.currentTarget.error.message)
|
|
19
|
+
}
|
|
20
|
+
request.onsuccess = function (e) {
|
|
21
|
+
self.db = e.target.result
|
|
22
|
+
callback(self.db)
|
|
23
|
+
}
|
|
24
|
+
request.onupgradeneeded = function (e) {
|
|
25
|
+
const db = e.target.result
|
|
26
|
+
if (!db.objectStoreNames.contains('metaCache')) {
|
|
27
|
+
// 没有该对象空间时创建该对象空间
|
|
28
|
+
db.createObjectStore('metaCache', {
|
|
29
|
+
keyPath: 'key'
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
deleteDB: function (dbname) {
|
|
36
|
+
// 删除数据库
|
|
37
|
+
const self = this
|
|
38
|
+
self.indexedDB.deleteDatabase(dbname)
|
|
39
|
+
console.log(dbname + '数据库已删除')
|
|
40
|
+
},
|
|
41
|
+
closeDB: function () {
|
|
42
|
+
const self = this
|
|
43
|
+
if (!self.db) {
|
|
44
|
+
self.db.close()
|
|
45
|
+
}
|
|
46
|
+
console.log('数据库已关闭')
|
|
47
|
+
},
|
|
48
|
+
add: function (key, data) {
|
|
49
|
+
const self = this
|
|
50
|
+
self.openDB((res) => {
|
|
51
|
+
const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').add({
|
|
52
|
+
key: key,
|
|
53
|
+
data: data
|
|
54
|
+
})
|
|
55
|
+
request.onerror = function () {
|
|
56
|
+
self.update(data)
|
|
57
|
+
}
|
|
58
|
+
request.onsuccess = function () {
|
|
59
|
+
console.log('数据已存入到数据库')
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
update: function (key, data) {
|
|
64
|
+
const self = this
|
|
65
|
+
self.openDB((res) => {
|
|
66
|
+
const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').put({
|
|
67
|
+
key: key,
|
|
68
|
+
data: data
|
|
69
|
+
})
|
|
70
|
+
request.onerror = function () {
|
|
71
|
+
console.error('数据更新失败')
|
|
72
|
+
}
|
|
73
|
+
request.onsuccess = function () {
|
|
74
|
+
console.log('数据已更新到数据库')
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
},
|
|
78
|
+
get: function (key, callback) {
|
|
79
|
+
const self = this
|
|
80
|
+
self.openDB((res) => {
|
|
81
|
+
// 根据存储空间的键找到对应数据
|
|
82
|
+
const store = res.transaction('metaCache', 'readwrite').objectStore('metaCache')
|
|
83
|
+
const request = store.get(key)
|
|
84
|
+
request.onerror = function () {
|
|
85
|
+
console.log('读取数据失败,键:' + key)
|
|
86
|
+
}
|
|
87
|
+
request.onsuccess = function (e) {
|
|
88
|
+
const result = e.target.result
|
|
89
|
+
if (typeof (callback) === 'function') {
|
|
90
|
+
callback(result.data)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
},
|
|
95
|
+
getByWeb: function (key, url, params, callback) {
|
|
96
|
+
const self = this
|
|
97
|
+
self.openDB((res) => {
|
|
98
|
+
// 根据存储空间的键找到对应数据
|
|
99
|
+
const store = res.transaction('metaCache', 'readwrite').objectStore('metaCache')
|
|
100
|
+
const request = store.get(key)
|
|
101
|
+
request.onerror = function () {
|
|
102
|
+
console.log('读取数据失败,键:' + key)
|
|
103
|
+
}
|
|
104
|
+
request.onsuccess = function (e) {
|
|
105
|
+
const result = e.target.result
|
|
106
|
+
if (!result && url) {
|
|
107
|
+
post(url, params).then((res) => {
|
|
108
|
+
self.add(key, res)
|
|
109
|
+
callback(res)
|
|
110
|
+
})
|
|
111
|
+
} else {
|
|
112
|
+
callback(result.data)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
},
|
|
117
|
+
delete: function (key) {
|
|
118
|
+
const self = this
|
|
119
|
+
self.openDB((res) => {
|
|
120
|
+
// 删除某一条记录
|
|
121
|
+
const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').delete(key)
|
|
122
|
+
|
|
123
|
+
request.onerror = function () {
|
|
124
|
+
console.error('数据删除失败')
|
|
125
|
+
}
|
|
126
|
+
request.onsuccess = function (event) {
|
|
127
|
+
console.log('已删除存储空间' + 'metaCache' + '中' + key + '记录')
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
},
|
|
131
|
+
clear: function (callback) {
|
|
132
|
+
const self = this
|
|
133
|
+
self.openDB((res) => {
|
|
134
|
+
// 删除存储空间全部记录
|
|
135
|
+
const request = res.transaction('metaCache', 'readwrite').objectStore('metaCache').clear()
|
|
136
|
+
|
|
137
|
+
request.onerror = function () {
|
|
138
|
+
console.error('数据删除失败')
|
|
139
|
+
}
|
|
140
|
+
request.onsuccess = function (event) {
|
|
141
|
+
console.log('已删除存储空间' + 'metaCache' + '中所有记录')
|
|
142
|
+
callback()
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
}
|