new file: LICENSE new file: README.md new file: WMS_PDA.code-workspace new file: common/api.js new file: common/config.js new file: common/demo.scss new file: common/mixin.js new file: common/props.js new file: components/BluetoothDeviceSelector/BluetoothDeviceSelector.vue new file: components/BluetoothPrint/BluetoothPrint.vue new file: components/PrintPanel/PrintPanel.vue new file: components/WorkbenchPrint/WorkbenchPrint.vue new file: components/demo-com/demo-com.vue new file: components/inputAndSelect/inputAndSelect.vue new file: components/page-nav/page-nav.vue new file: components/pagination/pagination.vue new file: components/space-list/space-list.vue new file: components/uploadImgCos/uploadImgCos.vue new file: core/index.js new file: core/mixins/index.js new file: core/request/apis.js new file: core/request/index.js new file: core/request/request.js new file: core/router/index.js new file: core/router/uni-simple-router.js new file: core/store/index.js new file: core/store/modules/bluetoothPrint.js new file: core/store/modules/broadcast.js new file: core/store/modules/floatWindowManager.js new file: core/store/modules/print.js new file: core/store/modules/setting.js new file: core/store/modules/user.js new file: core/utils/auth.js new file: core/utils/base64.js new file: core/utils/broadcast.js new file: core/utils/dpi-converter.js new file: core/utils/encoding-indexes.js new file: core/utils/encoding.js new file: core/utils/floatWindowManager.js new file: core/utils/simpleFloat.js new file: core/utils/tool.js new file: core/utils/tsc.js new file: env.js new file: main.js new file: manifest.json new file: package.json new file: pages.json new file: pages/403.vue new file: pages/404.vue new file: pages/componentsA/backtop/backtop.nvue new file: pages/componentsA/button/button.nvue new file: pages/componentsA/cell/cell.nvue new file: pages/componentsA/checkbox/checkbox.nvue new file: pages/componentsA/divider/divider.nvue new file: pages/componentsA/empty/empty.nvue new file: pages/componentsA/gap/gap.nvue new file: pages/componentsA/grid/grid.nvue new file: pages/componentsA/icon/icon.nvue new file: pages/componentsA/image/image.nvue new file: pages/componentsA/line/line.nvue new file: pages/componentsA/link/link.nvue new file: pages/componentsA/loading-icon/loading-icon.nvue new file: pages/componentsA/loading-page/loading-page.nvue new file: pages/componentsA/overlay/overlay.nvue new file: pages/componentsA/popup/popup.nvue new file: pages/componentsA/radio/radio.nvue new file: pages/componentsA/rate/rate.nvue new file: pages/componentsA/sticky/sticky.nvue new file: pages/componentsA/swipeAction/swipeAction.nvue new file: pages/componentsA/test/test.vue new file: pages/componentsA/transition/transition.nvue new file: pages/componentsB/actionSheet/actionSheet.nvue new file: pages/componentsB/alert/alert.nvue new file: pages/componentsB/badge/badge.nvue new file: pages/componentsB/code/code.nvue new file: pages/componentsB/collapse/collapse.nvue new file: pages/componentsB/color/color.nvue new file: pages/componentsB/countDown/countDown.nvue new file: pages/componentsB/countTo/countTo.nvue new file: pages/componentsB/dropdown/dropdown.nvue new file: pages/componentsB/keyboard/keyboard.nvue new file: pages/componentsB/noticeBar/noticeBar.nvue new file: pages/componentsB/notify/notify.nvue new file: pages/componentsB/numberBox/numberBox.nvue new file: pages/componentsB/parse/content.js new file: pages/componentsB/parse/jump.vue new file: pages/componentsB/parse/parse.nvue new file: pages/componentsB/progress/progress.nvue new file: pages/componentsB/search/search.nvue new file: pages/componentsB/slider/slider.nvue new file: pages/componentsB/switch/switch.nvue new file: pages/componentsB/tabbar/tabbar.nvue new file: pages/componentsB/tag/tag.nvue new file: pages/componentsB/toast/toast.nvue new file: pages/componentsB/upload/upload.nvue new file: pages/componentsC/album/album.nvue new file: pages/componentsC/avatar/avatar.nvue new file: pages/componentsC/calendar/calendar.nvue new file: pages/componentsC/codeInput/codeInput.nvue new file: pages/componentsC/datetimePicker/datetimePicker.nvue new file: pages/componentsC/form/form.nvue new file: pages/componentsC/indexList/indexList.nvue new file: pages/componentsC/input/input.nvue new file: pages/componentsC/layout/layout.nvue new file: pages/componentsC/list/list.nvue new file: pages/componentsC/loadmore/loadmore.nvue new file: pages/componentsC/modal/modal.nvue new file: pages/componentsC/navbar/navbar.nvue new file: pages/componentsC/noNetwork/noNetwork.nvue new file: pages/componentsC/picker/picker.nvue new file: pages/componentsC/readMore/readMore.nvue new file: pages/componentsC/scrollList/scrollList.nvue new file: pages/componentsC/skeleton/skeleton.nvue new file: pages/componentsC/steps/steps.vue new file: pages/componentsC/subsection/subsection.nvue new file: pages/componentsC/swiper/swiper.nvue new file: pages/componentsC/table/table.nvue new file: pages/componentsC/tabs/tabs.nvue new file: pages/componentsC/text/text.nvue new file: pages/componentsC/textarea/textarea.nvue new file: pages/componentsC/tooltip/tooltip.vue new file: pages/index/index.vue new file: pages/login/index.vue new file: pages/message/index.vue new file: pages/oa/index.vue new file: pages/settings/broadcastSettings.vue new file: pages/settings/index.vue new file: pages/settings/networkTest.vue new file: pages/user/index.vue new file: pages/work/index.vue new file: pages/work/storage/receiving/components/ProductInfoEditor.vue new file: pages/work/storage/receiving/components/detail-container.vue new file: pages/work/storage/receiving/components/info-container.vue new file: pages/work/storage/receiving/components/stockList.vue new file: pages/work/storage/receiving/receiving.vue new file: pages/work/storage/receiving/receivingCreate.vue new file: pages/work/storage/receiving/receivingDetail.vue new file: pages/work/storage/receiving/receivingList.vue new file: pages/work/storage/relocation.vue new file: static/app-plus/mp-html/js/handler.js new file: static/app-plus/mp-html/js/uni.webview.min.js new file: static/app-plus/mp-html/local.html new file: static/common/js/touch-emulator.js new file: static/icon/index.png new file: static/icon/index_a.png new file: static/icon/mime.png new file: static/icon/mime_a.png new file: static/icon/oa.png new file: static/icon/oa_a.png new file: static/loginbg.jpg new file: template.h5.html new file: tree.md new file: uni.scss new file: uni_modules/uni-read-pages/README.md new file: uni_modules/uni-read-pages/index.js new file: uni_modules/uni-read-pages/package.json new file: uni_modules/uni-simple-router/.eslintignore new file: uni_modules/uni-simple-router/.eslintrc.js new file: uni_modules/uni-simple-router/.github/ISSUE_TEMPLATE/bug_report.md new file: uni_modules/uni-simple-router/.github/ISSUE_TEMPLATE/feature_request.md new file: uni_modules/uni-simple-router/CODE_OF_CONDUCT.md new file: uni_modules/uni-simple-router/LICENSE new file: uni_modules/uni-simple-router/README.md new file: uni_modules/uni-simple-router/RFC.md new file: uni_modules/uni-simple-router/api-extractor.json new file: uni_modules/uni-simple-router/dist/link.vue new file: uni_modules/uni-simple-router/dist/uni-simple-router.d.ts new file: uni_modules/uni-simple-router/dist/uni-simple-router.js new file: uni_modules/uni-simple-router/github.sh new file: uni_modules/uni-simple-router/jest.config.js new file: uni_modules/uni-simple-router/package.json new file: uni_modules/uni-simple-router/progress.md new file: uni_modules/uni-simple-router/src/H5/buildRouter.ts new file: uni_modules/uni-simple-router/src/H5/proxyHook.ts new file: uni_modules/uni-simple-router/src/app/appPatch.ts new file: uni_modules/uni-simple-router/src/applets/appletPatch.ts new file: uni_modules/uni-simple-router/src/component/link.vue new file: uni_modules/uni-simple-router/src/global.d.ts new file: uni_modules/uni-simple-router/src/helpers/config.ts new file: uni_modules/uni-simple-router/src/helpers/createRouteMap.ts new file: uni_modules/uni-simple-router/src/helpers/lifeCycle.ts new file: uni_modules/uni-simple-router/src/helpers/mixins.ts new file: uni_modules/uni-simple-router/src/helpers/utils.ts new file: uni_modules/uni-simple-router/src/helpers/warn.ts new file: uni_modules/uni-simple-router/src/index.ts new file: uni_modules/uni-simple-router/src/options/base.ts new file: uni_modules/uni-simple-router/src/options/config.ts new file: uni_modules/uni-simple-router/src/public/hooks.ts new file: uni_modules/uni-simple-router/src/public/methods.ts new file: uni_modules/uni-simple-router/src/public/page.ts new file: uni_modules/uni-simple-router/src/public/query.ts new file: uni_modules/uni-simple-router/src/public/rewrite.ts new file: uni_modules/uni-simple-router/src/public/router.ts new file: uni_modules/uni-simple-router/src/public/uniOrigin.ts new file: uni_modules/uni-simple-router/test/path-to-regexp.spec.ts new file: uni_modules/uni-simple-router/test/query-toggle.spec.ts new file: uni_modules/uni-simple-router/tsconfig.json new file: uni_modules/uni-simple-router/webpack/webpack.common.js new file: uni_modules/uni-simple-router/webpack/webpack.dev.js new file: uni_modules/uni-simple-router/webpack/webpack.prod.js new file: uni_modules/uview-ui/LICENSE new file: uni_modules/uview-ui/README.md new file: uni_modules/uview-ui/changelog.md new file: uni_modules/uview-ui/components/u--form/u--form.vue new file: uni_modules/uview-ui/components/u--image/u--image.vue new file: uni_modules/uview-ui/components/u--input/u--input.vue new file: uni_modules/uview-ui/components/u--text/u--text.vue new file: uni_modules/uview-ui/components/u--textarea/u--textarea.vue new file: uni_modules/uview-ui/components/u-action-sheet/props.js new file: uni_modules/uview-ui/components/u-action-sheet/u-action-sheet.vue new file: uni_modules/uview-ui/components/u-album/props.js new file: uni_modules/uview-ui/components/u-album/u-album.vue new file: uni_modules/uview-ui/components/u-alert/props.js new file: uni_modules/uview-ui/components/u-alert/u-alert.vue new file: uni_modules/uview-ui/components/u-avatar-group/props.js new file: uni_modules/uview-ui/components/u-avatar-group/u-avatar-group.vue new file: uni_modules/uview-ui/components/u-avatar/props.js new file: uni_modules/uview-ui/components/u-avatar/u-avatar.vue new file: uni_modules/uview-ui/components/u-back-top/props.js new file: uni_modules/uview-ui/components/u-back-top/u-back-top.vue new file: uni_modules/uview-ui/components/u-badge/props.js new file: uni_modules/uview-ui/components/u-badge/u-badge.vue new file: uni_modules/uview-ui/components/u-button/nvue.scss new file: uni_modules/uview-ui/components/u-button/props.js new file: uni_modules/uview-ui/components/u-button/u-button.vue new file: uni_modules/uview-ui/components/u-button/vue.scss new file: uni_modules/uview-ui/components/u-calendar/header.vue new file: uni_modules/uview-ui/components/u-calendar/month.vue new file: uni_modules/uview-ui/components/u-calendar/props.js new file: uni_modules/uview-ui/components/u-calendar/u-calendar.vue new file: uni_modules/uview-ui/components/u-calendar/util.js new file: uni_modules/uview-ui/components/u-car-keyboard/props.js new file: uni_modules/uview-ui/components/u-car-keyboard/u-car-keyboard.vue new file: uni_modules/uview-ui/components/u-cell-group/props.js new file: uni_modules/uview-ui/components/u-cell-group/u-cell-group.vue new file: uni_modules/uview-ui/components/u-cell/props.js new file: uni_modules/uview-ui/components/u-cell/u-cell.vue new file: uni_modules/uview-ui/components/u-checkbox-group/props.js new file: uni_modules/uview-ui/components/u-checkbox-group/u-checkbox-group.vue new file: uni_modules/uview-ui/components/u-checkbox/props.js new file: uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue new file: uni_modules/uview-ui/components/u-circle-progress/props.js new file: uni_modules/uview-ui/components/u-circle-progress/u-circle-progress.vue new file: uni_modules/uview-ui/components/u-code-input/props.js new file: uni_modules/uview-ui/components/u-code-input/u-code-input.vue new file: uni_modules/uview-ui/components/u-code/props.js new file: uni_modules/uview-ui/components/u-code/u-code.vue new file: uni_modules/uview-ui/components/u-col/props.js new file: uni_modules/uview-ui/components/u-col/u-col.vue new file: uni_modules/uview-ui/components/u-collapse-item/props.js new file: uni_modules/uview-ui/components/u-collapse-item/u-collapse-item.vue new file: uni_modules/uview-ui/components/u-collapse/props.js new file: uni_modules/uview-ui/components/u-collapse/u-collapse.vue new file: uni_modules/uview-ui/components/u-column-notice/props.js new file: uni_modules/uview-ui/components/u-column-notice/u-column-notice.vue new file: uni_modules/uview-ui/components/u-count-down/props.js new file: uni_modules/uview-ui/components/u-count-down/u-count-down.vue new file: uni_modules/uview-ui/components/u-count-down/utils.js new file: uni_modules/uview-ui/components/u-count-to/props.js new file: uni_modules/uview-ui/components/u-count-to/u-count-to.vue new file: uni_modules/uview-ui/components/u-datetime-picker/props.js new file: uni_modules/uview-ui/components/u-datetime-picker/u-datetime-picker.vue new file: uni_modules/uview-ui/components/u-divider/props.js new file: uni_modules/uview-ui/components/u-divider/u-divider.vue new file: uni_modules/uview-ui/components/u-dropdown-item/props.js new file: uni_modules/uview-ui/components/u-dropdown-item/u-dropdown-item.vue new file: uni_modules/uview-ui/components/u-dropdown/props.js new file: uni_modules/uview-ui/components/u-dropdown/u-dropdown.vue new file: uni_modules/uview-ui/components/u-empty/props.js new file: uni_modules/uview-ui/components/u-empty/u-empty.vue new file: uni_modules/uview-ui/components/u-form-item/props.js new file: uni_modules/uview-ui/components/u-form-item/u-form-item.vue new file: uni_modules/uview-ui/components/u-form/props.js new file: uni_modules/uview-ui/components/u-form/u-form.vue new file: uni_modules/uview-ui/components/u-gap/props.js new file: uni_modules/uview-ui/components/u-gap/u-gap.vue new file: uni_modules/uview-ui/components/u-grid-item/props.js new file: uni_modules/uview-ui/components/u-grid-item/u-grid-item.vue new file: uni_modules/uview-ui/components/u-grid/props.js new file: uni_modules/uview-ui/components/u-grid/u-grid.vue new file: uni_modules/uview-ui/components/u-icon/icons.js new file: uni_modules/uview-ui/components/u-icon/props.js new file: uni_modules/uview-ui/components/u-icon/u-icon.vue new file: uni_modules/uview-ui/components/u-image/props.js new file: uni_modules/uview-ui/components/u-image/u-image.vue new file: uni_modules/uview-ui/components/u-index-anchor/props.js new file: uni_modules/uview-ui/components/u-index-anchor/u-index-anchor.vue new file: uni_modules/uview-ui/components/u-index-item/props.js new file: uni_modules/uview-ui/components/u-index-item/u-index-item.vue new file: uni_modules/uview-ui/components/u-index-list/props.js new file: uni_modules/uview-ui/components/u-index-list/u-index-list.vue new file: uni_modules/uview-ui/components/u-input/props.js new file: uni_modules/uview-ui/components/u-input/u-input.vue new file: uni_modules/uview-ui/components/u-keyboard/props.js new file: uni_modules/uview-ui/components/u-keyboard/u-keyboard.vue new file: uni_modules/uview-ui/components/u-line-progress/props.js new file: uni_modules/uview-ui/components/u-line-progress/u-line-progress.vue new file: uni_modules/uview-ui/components/u-line/props.js new file: uni_modules/uview-ui/components/u-line/u-line.vue new file: uni_modules/uview-ui/components/u-link/props.js new file: uni_modules/uview-ui/components/u-link/u-link.vue new file: uni_modules/uview-ui/components/u-list-item/props.js new file: uni_modules/uview-ui/components/u-list-item/u-list-item.vue new file: uni_modules/uview-ui/components/u-list/props.js new file: uni_modules/uview-ui/components/u-list/u-list.vue new file: uni_modules/uview-ui/components/u-loading-icon/props.js new file: uni_modules/uview-ui/components/u-loading-icon/u-loading-icon.vue new file: uni_modules/uview-ui/components/u-loading-page/props.js new file: uni_modules/uview-ui/components/u-loading-page/u-loading-page.vue new file: uni_modules/uview-ui/components/u-loadmore/props.js new file: uni_modules/uview-ui/components/u-loadmore/u-loadmore.vue new file: uni_modules/uview-ui/components/u-modal/props.js new file: uni_modules/uview-ui/components/u-modal/u-modal.vue new file: uni_modules/uview-ui/components/u-navbar/props.js new file: uni_modules/uview-ui/components/u-navbar/u-navbar.vue new file: uni_modules/uview-ui/components/u-no-network/props.js new file: uni_modules/uview-ui/components/u-no-network/u-no-network.vue new file: uni_modules/uview-ui/components/u-notice-bar/props.js new file: uni_modules/uview-ui/components/u-notice-bar/u-notice-bar.vue new file: uni_modules/uview-ui/components/u-notify/props.js new file: uni_modules/uview-ui/components/u-notify/u-notify.vue new file: uni_modules/uview-ui/components/u-number-box/props.js new file: uni_modules/uview-ui/components/u-number-box/u-number-box.vue new file: uni_modules/uview-ui/components/u-number-keyboard/props.js new file: uni_modules/uview-ui/components/u-number-keyboard/u-number-keyboard.vue new file: uni_modules/uview-ui/components/u-overlay/props.js new file: uni_modules/uview-ui/components/u-overlay/u-overlay.vue new file: uni_modules/uview-ui/components/u-parse/node/node.vue new file: uni_modules/uview-ui/components/u-parse/parser.js new file: uni_modules/uview-ui/components/u-parse/props.js new file: uni_modules/uview-ui/components/u-parse/u-parse.vue new file: uni_modules/uview-ui/components/u-picker-column/props.js new file: uni_modules/uview-ui/components/u-picker-column/u-picker-column.vue new file: uni_modules/uview-ui/components/u-picker/props.js new file: uni_modules/uview-ui/components/u-picker/u-picker.vue new file: uni_modules/uview-ui/components/u-popup/props.js new file: uni_modules/uview-ui/components/u-popup/u-popup.vue new file: uni_modules/uview-ui/components/u-radio-group/props.js new file: uni_modules/uview-ui/components/u-radio-group/u-radio-group.vue new file: uni_modules/uview-ui/components/u-radio/props.js new file: uni_modules/uview-ui/components/u-radio/u-radio.vue new file: uni_modules/uview-ui/components/u-rate/props.js new file: uni_modules/uview-ui/components/u-rate/u-rate.vue new file: uni_modules/uview-ui/components/u-read-more/props.js new file: uni_modules/uview-ui/components/u-read-more/u-read-more.vue new file: uni_modules/uview-ui/components/u-row-notice/props.js new file: uni_modules/uview-ui/components/u-row-notice/u-row-notice.vue new file: uni_modules/uview-ui/components/u-row/props.js new file: uni_modules/uview-ui/components/u-row/u-row.vue new file: uni_modules/uview-ui/components/u-safe-bottom/props.js new file: uni_modules/uview-ui/components/u-safe-bottom/u-safe-bottom.vue new file: uni_modules/uview-ui/components/u-scroll-list/nvue.js new file: uni_modules/uview-ui/components/u-scroll-list/other.js new file: uni_modules/uview-ui/components/u-scroll-list/props.js new file: uni_modules/uview-ui/components/u-scroll-list/scrollWxs.wxs new file: uni_modules/uview-ui/components/u-scroll-list/u-scroll-list.vue new file: uni_modules/uview-ui/components/u-search/props.js new file: uni_modules/uview-ui/components/u-search/u-search.vue new file: uni_modules/uview-ui/components/u-skeleton/props.js new file: uni_modules/uview-ui/components/u-skeleton/u-skeleton.vue new file: uni_modules/uview-ui/components/u-slider/mpother.js new file: uni_modules/uview-ui/components/u-slider/mpwxs.js new file: uni_modules/uview-ui/components/u-slider/mpwxs.wxs new file: "uni_modules/uview-ui/components/u-slider/nvue - \345\211\257\346\234\254.js" new file: uni_modules/uview-ui/components/u-slider/nvue.js new file: uni_modules/uview-ui/components/u-slider/props.js new file: uni_modules/uview-ui/components/u-slider/u-slider.vue new file: uni_modules/uview-ui/components/u-status-bar/props.js new file: uni_modules/uview-ui/components/u-status-bar/u-status-bar.vue new file: uni_modules/uview-ui/components/u-steps-item/props.js new file: uni_modules/uview-ui/components/u-steps-item/u-steps-item.vue new file: uni_modules/uview-ui/components/u-steps/props.js new file: uni_modules/uview-ui/components/u-steps/u-steps.vue new file: uni_modules/uview-ui/components/u-sticky/props.js new file: uni_modules/uview-ui/components/u-sticky/u-sticky.vue new file: uni_modules/uview-ui/components/u-subsection/props.js new file: uni_modules/uview-ui/components/u-subsection/u-subsection.vue new file: uni_modules/uview-ui/components/u-swipe-action-item/index - backup.wxs new file: uni_modules/uview-ui/components/u-swipe-action-item/index.wxs new file: uni_modules/uview-ui/components/u-swipe-action-item/nvue - backup.js new file: uni_modules/uview-ui/components/u-swipe-action-item/nvue.js new file: uni_modules/uview-ui/components/u-swipe-action-item/props.js new file: uni_modules/uview-ui/components/u-swipe-action-item/u-swipe-action-item.vue new file: uni_modules/uview-ui/components/u-swipe-action-item/wxs.js new file: uni_modules/uview-ui/components/u-swipe-action/props.js new file: uni_modules/uview-ui/components/u-swipe-action/u-swipe-action.vue new file: uni_modules/uview-ui/components/u-swiper-indicator/props.js new file: uni_modules/uview-ui/components/u-swiper-indicator/u-swiper-indicator.vue new file: uni_modules/uview-ui/components/u-swiper/props.js new file: uni_modules/uview-ui/components/u-swiper/u-swiper.vue new file: uni_modules/uview-ui/components/u-switch/props.js new file: uni_modules/uview-ui/components/u-switch/u-switch.vue new file: uni_modules/uview-ui/components/u-tabbar-item/props.js new file: uni_modules/uview-ui/components/u-tabbar-item/u-tabbar-item.vue new file: uni_modules/uview-ui/components/u-tabbar/props.js new file: uni_modules/uview-ui/components/u-tabbar/u-tabbar.vue new file: uni_modules/uview-ui/components/u-table/props.js new file: uni_modules/uview-ui/components/u-table/u-table.vue new file: uni_modules/uview-ui/components/u-tabs-item/props.js new file: uni_modules/uview-ui/components/u-tabs-item/u-tabs-item.vue new file: uni_modules/uview-ui/components/u-tabs/props.js new file: uni_modules/uview-ui/components/u-tabs/u-tabs.vue new file: uni_modules/uview-ui/components/u-tag/props.js new file: uni_modules/uview-ui/components/u-tag/u-tag.vue new file: uni_modules/uview-ui/components/u-td/props.js new file: uni_modules/uview-ui/components/u-td/u-td.vue new file: uni_modules/uview-ui/components/u-text/props.js new file: uni_modules/uview-ui/components/u-text/u-text.vue new file: uni_modules/uview-ui/components/u-text/value.js new file: uni_modules/uview-ui/components/u-textarea/props.js new file: uni_modules/uview-ui/components/u-textarea/u-textarea.vue new file: uni_modules/uview-ui/components/u-toast/u-toast.vue new file: uni_modules/uview-ui/components/u-toolbar/props.js new file: uni_modules/uview-ui/components/u-toolbar/u-toolbar.vue new file: uni_modules/uview-ui/components/u-tooltip/clipboard.min.js new file: uni_modules/uview-ui/components/u-tooltip/props.js new file: uni_modules/uview-ui/components/u-tooltip/u-tooltip.vue new file: uni_modules/uview-ui/components/u-tr/props.js new file: uni_modules/uview-ui/components/u-tr/u-tr.vue new file: uni_modules/uview-ui/components/u-transition/nvue.ani-map.js new file: uni_modules/uview-ui/components/u-transition/props.js new file: uni_modules/uview-ui/components/u-transition/transition.js new file: uni_modules/uview-ui/components/u-transition/u-transition.vue new file: uni_modules/uview-ui/components/u-transition/vue.ani-style.scss new file: uni_modules/uview-ui/components/u-upload/mixin.js new file: uni_modules/uview-ui/components/u-upload/props.js new file: uni_modules/uview-ui/components/u-upload/u-upload.vue new file: uni_modules/uview-ui/components/u-upload/utils.js new file: uni_modules/uview-ui/components/uview-ui/uview-ui.vue new file: uni_modules/uview-ui/index.js new file: uni_modules/uview-ui/index.scss new file: uni_modules/uview-ui/libs/config/color.js new file: uni_modules/uview-ui/libs/config/config.js new file: uni_modules/uview-ui/libs/config/props.js new file: uni_modules/uview-ui/libs/config/props/actionSheet.js new file: uni_modules/uview-ui/libs/config/props/album.js new file: uni_modules/uview-ui/libs/config/props/alert.js new file: uni_modules/uview-ui/libs/config/props/avatar.js new file: uni_modules/uview-ui/libs/config/props/avatarGroup.js new file: uni_modules/uview-ui/libs/config/props/backtop.js new file: uni_modules/uview-ui/libs/config/props/badge.js new file: uni_modules/uview-ui/libs/config/props/button.js new file: uni_modules/uview-ui/libs/config/props/calendar.js new file: uni_modules/uview-ui/libs/config/props/carKeyboard.js new file: uni_modules/uview-ui/libs/config/props/cell.js new file: uni_modules/uview-ui/libs/config/props/cellGroup.js new file: uni_modules/uview-ui/libs/config/props/checkbox.js new file: uni_modules/uview-ui/libs/config/props/checkboxGroup.js new file: uni_modules/uview-ui/libs/config/props/circleProgress.js new file: uni_modules/uview-ui/libs/config/props/code.js new file: uni_modules/uview-ui/libs/config/props/codeInput.js new file: uni_modules/uview-ui/libs/config/props/col.js new file: uni_modules/uview-ui/libs/config/props/collapse.js new file: uni_modules/uview-ui/libs/config/props/collapseItem.js new file: uni_modules/uview-ui/libs/config/props/columnNotice.js new file: uni_modules/uview-ui/libs/config/props/countDown.js new file: uni_modules/uview-ui/libs/config/props/countTo.js new file: uni_modules/uview-ui/libs/config/props/datetimePicker.js new file: uni_modules/uview-ui/libs/config/props/divider.js new file: uni_modules/uview-ui/libs/config/props/empty.js new file: uni_modules/uview-ui/libs/config/props/form.js new file: uni_modules/uview-ui/libs/config/props/formItem.js new file: uni_modules/uview-ui/libs/config/props/gap.js new file: uni_modules/uview-ui/libs/config/props/grid.js new file: uni_modules/uview-ui/libs/config/props/gridItem.js new file: uni_modules/uview-ui/libs/config/props/icon.js new file: uni_modules/uview-ui/libs/config/props/image.js new file: uni_modules/uview-ui/libs/config/props/indexAnchor.js new file: uni_modules/uview-ui/libs/config/props/indexList.js new file: uni_modules/uview-ui/libs/config/props/input.js new file: uni_modules/uview-ui/libs/config/props/keyboard.js new file: uni_modules/uview-ui/libs/config/props/line.js new file: uni_modules/uview-ui/libs/config/props/lineProgress.js new file: uni_modules/uview-ui/libs/config/props/link.js new file: uni_modules/uview-ui/libs/config/props/list.js new file: uni_modules/uview-ui/libs/config/props/listItem.js new file: uni_modules/uview-ui/libs/config/props/loadingIcon.js new file: uni_modules/uview-ui/libs/config/props/loadingPage.js new file: uni_modules/uview-ui/libs/config/props/loadmore.js new file: uni_modules/uview-ui/libs/config/props/modal.js new file: uni_modules/uview-ui/libs/config/props/navbar.js new file: uni_modules/uview-ui/libs/config/props/noNetwork.js new file: uni_modules/uview-ui/libs/config/props/noticeBar.js new file: uni_modules/uview-ui/libs/config/props/notify.js new file: uni_modules/uview-ui/libs/config/props/numberBox.js new file: uni_modules/uview-ui/libs/config/props/numberKeyboard.js new file: uni_modules/uview-ui/libs/config/props/overlay.js new file: uni_modules/uview-ui/libs/config/props/parse.js new file: uni_modules/uview-ui/libs/config/props/picker.js new file: uni_modules/uview-ui/libs/config/props/popup.js new file: uni_modules/uview-ui/libs/config/props/radio.js new file: uni_modules/uview-ui/libs/config/props/radioGroup.js new file: uni_modules/uview-ui/libs/config/props/rate.js new file: uni_modules/uview-ui/libs/config/props/readMore.js new file: uni_modules/uview-ui/libs/config/props/row.js new file: uni_modules/uview-ui/libs/config/props/rowNotice.js new file: uni_modules/uview-ui/libs/config/props/scrollList.js new file: uni_modules/uview-ui/libs/config/props/search.js new file: uni_modules/uview-ui/libs/config/props/section.js new file: uni_modules/uview-ui/libs/config/props/skeleton.js new file: uni_modules/uview-ui/libs/config/props/slider.js new file: uni_modules/uview-ui/libs/config/props/statusBar.js new file: uni_modules/uview-ui/libs/config/props/steps.js new file: uni_modules/uview-ui/libs/config/props/stepsItem.js new file: uni_modules/uview-ui/libs/config/props/sticky.js new file: uni_modules/uview-ui/libs/config/props/subsection.js new file: uni_modules/uview-ui/libs/config/props/swipeAction.js new file: uni_modules/uview-ui/libs/config/props/swipeActionItem.js new file: uni_modules/uview-ui/libs/config/props/swiper.js new file: uni_modules/uview-ui/libs/config/props/swipterIndicator.js new file: uni_modules/uview-ui/libs/config/props/switch.js new file: uni_modules/uview-ui/libs/config/props/tabbar.js new file: uni_modules/uview-ui/libs/config/props/tabbarItem.js new file: uni_modules/uview-ui/libs/config/props/tabs.js new file: uni_modules/uview-ui/libs/config/props/tag.js new file: uni_modules/uview-ui/libs/config/props/text.js new file: uni_modules/uview-ui/libs/config/props/textarea.js new file: uni_modules/uview-ui/libs/config/props/toast.js new file: uni_modules/uview-ui/libs/config/props/toolbar.js new file: uni_modules/uview-ui/libs/config/props/tooltip.js new file: uni_modules/uview-ui/libs/config/props/transition.js new file: uni_modules/uview-ui/libs/config/props/upload.js new file: uni_modules/uview-ui/libs/config/zIndex.js new file: uni_modules/uview-ui/libs/css/color.scss new file: uni_modules/uview-ui/libs/css/common.scss new file: uni_modules/uview-ui/libs/css/components.scss new file: uni_modules/uview-ui/libs/css/flex.scss new file: uni_modules/uview-ui/libs/css/h5.scss new file: uni_modules/uview-ui/libs/css/mixin.scss new file: uni_modules/uview-ui/libs/css/mp.scss new file: uni_modules/uview-ui/libs/css/nvue.scss new file: uni_modules/uview-ui/libs/css/vue.scss new file: uni_modules/uview-ui/libs/function/colorGradient.js new file: uni_modules/uview-ui/libs/function/debounce.js new file: uni_modules/uview-ui/libs/function/digit.js new file: uni_modules/uview-ui/libs/function/index.js new file: uni_modules/uview-ui/libs/function/platform.js new file: uni_modules/uview-ui/libs/function/test.js new file: uni_modules/uview-ui/libs/function/throttle.js new file: uni_modules/uview-ui/libs/luch-request/adapters/index.js new file: uni_modules/uview-ui/libs/luch-request/core/InterceptorManager.js new file: uni_modules/uview-ui/libs/luch-request/core/Request.js new file: uni_modules/uview-ui/libs/luch-request/core/buildFullPath.js new file: uni_modules/uview-ui/libs/luch-request/core/defaults.js new file: uni_modules/uview-ui/libs/luch-request/core/dispatchRequest.js new file: uni_modules/uview-ui/libs/luch-request/core/mergeConfig.js new file: uni_modules/uview-ui/libs/luch-request/core/settle.js new file: uni_modules/uview-ui/libs/luch-request/helpers/buildURL.js new file: uni_modules/uview-ui/libs/luch-request/helpers/combineURLs.js new file: uni_modules/uview-ui/libs/luch-request/helpers/isAbsoluteURL.js new file: uni_modules/uview-ui/libs/luch-request/index.d.ts new file: uni_modules/uview-ui/libs/luch-request/index.js new file: uni_modules/uview-ui/libs/luch-request/utils.js new file: uni_modules/uview-ui/libs/luch-request/utils/clone.js new file: uni_modules/uview-ui/libs/mixin/button.js new file: uni_modules/uview-ui/libs/mixin/mixin.js new file: uni_modules/uview-ui/libs/mixin/mpMixin.js new file: uni_modules/uview-ui/libs/mixin/mpShare.js new file: uni_modules/uview-ui/libs/mixin/openType.js new file: uni_modules/uview-ui/libs/mixin/style.js new file: uni_modules/uview-ui/libs/mixin/touch.js new file: uni_modules/uview-ui/libs/util/async-validator.js new file: uni_modules/uview-ui/libs/util/calendar.js new file: uni_modules/uview-ui/libs/util/dayjs.js new file: uni_modules/uview-ui/libs/util/emitter.js new file: uni_modules/uview-ui/libs/util/route.js new file: uni_modules/uview-ui/package.json new file: uni_modules/uview-ui/theme.scss new file: vue.config.js
873 lines
19 KiB
JavaScript
873 lines
19 KiB
JavaScript
// store/modules/bluetoothPrint.js
|
||
import tscEncoder from '@/core/utils/tsc.js'; // 导入你的TSC指令生成器
|
||
import http from '@/core/request/index'
|
||
|
||
const state = () => ({
|
||
bluetoothAvailable: false,
|
||
// 设备状态
|
||
bluetoothDevices: [],
|
||
currentDevice: null,
|
||
connectionStatus: 'disconnected', // disconnected/scanning/connecting/connected/error
|
||
deviceServices: [],
|
||
template: null,
|
||
discovering: false,
|
||
// TSC打印机状态
|
||
printer: null, // TSC打印机实例
|
||
printerConfig: {
|
||
dpi: 203, // 打印机DPI: 203/300
|
||
width: 40, // 标签宽度(mm)
|
||
height: 30, // 标签高度(mm)
|
||
gap: 2, // 标签间隙(mm)
|
||
direction: 0, // 打印方向
|
||
reference: [0, 0], // 参考坐标原点
|
||
density: 8, // 打印浓度 1-15
|
||
speed: 3, // 打印速度 1-6
|
||
},
|
||
|
||
// 打印控制
|
||
isPrinting: false,
|
||
printQueue: [],
|
||
printHistory: [],
|
||
|
||
// 连接管理
|
||
autoReconnect: true,
|
||
reconnectAttempts: 0,
|
||
maxReconnectAttempts: 3,
|
||
|
||
// 错误与日志
|
||
lastError: null,
|
||
operationLogs: []
|
||
});
|
||
|
||
const getters = {
|
||
// 连接状态
|
||
isConnected: state => state.connectionStatus === 'connected',
|
||
isReadyToPrint: state => state.connectionStatus === 'connected' && !state.isPrinting,
|
||
|
||
// 设备信息
|
||
connectedDeviceInfo: state => ({
|
||
name: state.currentDevice?.name || '未连接',
|
||
id: state.currentDevice?.id ? state.currentDevice.id.substring(0, 8) + '...' : '',
|
||
status: state.connectionStatus
|
||
}),
|
||
|
||
// 打印机配置
|
||
printerDPI: state => state.printerConfig.dpi,
|
||
mmToDot: (state, getters) => (mm) => {
|
||
// 根据DPI将毫米转换为点数
|
||
return Math.floor(mm * (getters.printerDPI / 25.4));
|
||
},
|
||
|
||
// 队列状态
|
||
queueLength: state => state.printQueue.length,
|
||
hasPendingTasks: state => state.printQueue.length > 0
|
||
};
|
||
|
||
const mutations = {
|
||
// 设备管理
|
||
SET_DEVICES(state, devices) {
|
||
state.bluetoothDevices = devices;
|
||
},
|
||
ADD_DEVICE(state, device) {
|
||
if (!state.bluetoothDevices.some(d => d.deviceId === device.deviceId)) {
|
||
state.bluetoothDevices.push({
|
||
...device,
|
||
isTSCPrinter: device.name && (
|
||
device.name.includes('TSC') ||
|
||
device.name.includes('打印机') ||
|
||
device.name.includes('PRT')
|
||
)
|
||
});
|
||
}
|
||
},
|
||
SET_CURRENT_DEVICE(state, device) {
|
||
state.currentDevice = device;
|
||
},
|
||
SET_CONNECTION_STATUS(state, status) {
|
||
state.connectionStatus = status;
|
||
},
|
||
|
||
// 打印机实例
|
||
INIT_PRINTER_INSTANCE(state) {
|
||
if (!state.printer) {
|
||
state.printer = tscEncoder.jpPrinter.createNew();
|
||
}
|
||
},
|
||
UPDATE_PRINTER_CONFIG(state, config) {
|
||
state.printerConfig = {
|
||
...state.printerConfig,
|
||
...config
|
||
};
|
||
},
|
||
|
||
// 打印状态
|
||
SET_PRINTING(state, printing) {
|
||
state.isPrinting = printing;
|
||
},
|
||
|
||
// 队列管理
|
||
ADD_TO_QUEUE(state, task) {
|
||
const taskWithId = {
|
||
...task,
|
||
id: Math.random(),
|
||
createdAt: new Date().toISOString(),
|
||
status: 'pending'
|
||
};
|
||
state.printQueue.push(taskWithId);
|
||
},
|
||
REMOVE_FROM_QUEUE(state, taskId) {
|
||
state.printQueue = state.printQueue.filter(task => task.id !== taskId);
|
||
},
|
||
UPDATE_TASK_STATUS(state, {
|
||
taskId,
|
||
status
|
||
}) {
|
||
const task = state.printQueue.find(t => t.id === taskId);
|
||
if (task) task.status = status;
|
||
},
|
||
|
||
// 历史记录
|
||
ADD_TO_HISTORY(state, task) {
|
||
state.printHistory.unshift({
|
||
...task,
|
||
printedAt: new Date().toISOString()
|
||
});
|
||
// 保持最多50条历史记录
|
||
if (state.printHistory.length > 50) {
|
||
state.printHistory.pop();
|
||
}
|
||
},
|
||
|
||
// 重连管理
|
||
SET_RECONNECT_ATTEMPTS(state, attempts) {
|
||
state.reconnectAttempts = attempts;
|
||
},
|
||
|
||
// 错误与日志
|
||
SET_ERROR(state, error) {
|
||
state.lastError = error;
|
||
if (error) {
|
||
state.operationLogs.unshift({
|
||
type: 'error',
|
||
message: error.message || error.errMsg || String(error),
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
}
|
||
},
|
||
ADD_LOG(state, log) {
|
||
state.operationLogs.unshift({
|
||
...log,
|
||
timestamp: new Date().toISOString()
|
||
});
|
||
if (state.operationLogs.length > 100) {
|
||
state.operationLogs.pop();
|
||
}
|
||
},
|
||
|
||
// 重置状态
|
||
RESET_SCAN(state) {
|
||
state.bluetoothDevices = [];
|
||
},
|
||
RESET_CONNECTION(state) {
|
||
state.currentDevice = null;
|
||
state.connectionStatus = 'disconnected';
|
||
state.deviceServices = [];
|
||
state.reconnectAttempts = 0;
|
||
},
|
||
CLEAR_QUEUE(state) {
|
||
state.printQueue = [];
|
||
},
|
||
AVAILABLE(state, status) {
|
||
state.bluetoothAvailable = status
|
||
},
|
||
DISCOVERING(state, status) {
|
||
state.discovering = status
|
||
}
|
||
};
|
||
|
||
const actions = {
|
||
/**
|
||
* 初始化蓝牙适配器
|
||
*/
|
||
async initializeBluetooth({
|
||
commit,
|
||
dispatch,
|
||
state
|
||
}) {
|
||
try {
|
||
const [fail] = await uni.openBluetoothAdapter();
|
||
if (fail) {
|
||
commit('AVAILABLE', false);
|
||
} else {
|
||
commit('AVAILABLE', true);
|
||
}
|
||
uni.onBluetoothAdapterStateChange(function(res) {
|
||
commit('AVAILABLE', res.available);
|
||
commit('DISCOVERING', res.discovering);
|
||
})
|
||
uni.onBluetoothDeviceFound(async function(devices) {
|
||
console.log("新设备加入列表");
|
||
commit('ADD_DEVICE', devices.devices[0]);
|
||
})
|
||
uni.onBLEConnectionStateChange(async function(res) {
|
||
|
||
})
|
||
} catch (error) {
|
||
commit('AVAILABLE', false);
|
||
}
|
||
},
|
||
async getPrintTemplate({
|
||
commit,
|
||
state
|
||
}, businessType) {
|
||
return new Promise((resolve, reject) => {
|
||
http('common.listTemplatesByType', {
|
||
businessType: businessType
|
||
}).then(res => {
|
||
console.log(res);
|
||
resolve(res);
|
||
}).then(() => {
|
||
})
|
||
.catch(e => {
|
||
reject(e)
|
||
})
|
||
})
|
||
},
|
||
/**
|
||
* 开启或关闭搜索
|
||
*/
|
||
async scanDevices({
|
||
commit,
|
||
state
|
||
}, status) {
|
||
if (status) {
|
||
commit('RESET_SCAN');
|
||
await uni.startBluetoothDevicesDiscovery();
|
||
} else {
|
||
await uni.stopBluetoothDevicesDiscovery();
|
||
}
|
||
},
|
||
/**
|
||
* 连接TSC打印机
|
||
*/
|
||
async connectDevice({
|
||
commit,
|
||
state,
|
||
dispatch
|
||
}, device) {
|
||
commit('SET_CONNECTION_STATUS', 'connecting');
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: `正在连接: ${device.name}`
|
||
});
|
||
console.log(`正在连接: ${device.name}`);
|
||
|
||
try {
|
||
// 1. 创建BLE连接
|
||
const connection = await uni.createBLEConnection({
|
||
deviceId: device.deviceId,
|
||
timeout: 10000
|
||
});
|
||
|
||
console.log('连接建立:', connection);
|
||
|
||
// 2. 获取服务
|
||
const [error, servicesRes] = await uni.getBLEDeviceServices({
|
||
deviceId: device.deviceId
|
||
});
|
||
|
||
if (error || !servicesRes || !servicesRes.services || servicesRes.services.length === 0) {
|
||
throw new Error('未发现设备服务');
|
||
}
|
||
|
||
console.log('发现服务:', servicesRes.services);
|
||
|
||
// 3. 查找TSC打印机服务(参考代码使用 49535343)
|
||
// TSC蓝牙打印机通常使用特定的服务UUID,如:
|
||
// 49535343-FE7D-4AE5-8FA9-9FAFD205E455 或其他类似的
|
||
let targetService = null;
|
||
|
||
// 首先尝试查找包含特定标识的服务
|
||
for (const service of servicesRes.services) {
|
||
// 方法1: 检查是否包含TSC打印机特征标识
|
||
if (service.uuid.includes('49535343')) {
|
||
targetService = service;
|
||
console.log('找到TSC服务 (49535343):', service);
|
||
break;
|
||
}
|
||
|
||
// 方法2: 检查是否为通用打印服务
|
||
if (service.uuid.toLowerCase().includes('fff0') ||
|
||
service.uuid.toLowerCase().includes('ae30')) {
|
||
targetService = service;
|
||
console.log('找到通用打印服务:', service);
|
||
}
|
||
}
|
||
|
||
// 如果没有找到特定服务,使用第一个服务
|
||
if (!targetService && servicesRes.services.length > 0) {
|
||
targetService = servicesRes.services[0];
|
||
console.log('使用第一个服务:', targetService);
|
||
}
|
||
|
||
if (!targetService) {
|
||
throw new Error('未找到可用的打印机服务');
|
||
}
|
||
|
||
// 4. 获取该服务的特征值
|
||
const [charError, characteristicsRes] = await uni.getBLEDeviceCharacteristics({
|
||
deviceId: device.deviceId,
|
||
serviceId: targetService.uuid
|
||
});
|
||
|
||
if (charError || !characteristicsRes || !characteristicsRes.characteristics) {
|
||
throw new Error('未发现特征值');
|
||
}
|
||
|
||
console.log('发现特征值:', characteristicsRes.characteristics);
|
||
|
||
// 5. 查找读写特征
|
||
let writeChar = null;
|
||
let notifyChar = null;
|
||
let readChar = null;
|
||
|
||
for (const char of characteristicsRes.characteristics) {
|
||
console.log(`特征值 ${char.uuid}:`, char.properties);
|
||
|
||
// 查找写入特征(有write属性)
|
||
if (char.properties.write || char.properties.writeWithoutResponse) {
|
||
if (!writeChar) {
|
||
writeChar = char;
|
||
}
|
||
// 优先选择 writeWithoutResponse
|
||
if (char.properties.writeWithoutResponse) {
|
||
writeChar = char;
|
||
}
|
||
}
|
||
|
||
// 查找通知特征
|
||
if (char.properties.notify || char.properties.indicate) {
|
||
if (!notifyChar) {
|
||
notifyChar = char;
|
||
}
|
||
}
|
||
|
||
// 查找读取特征
|
||
if (char.properties.read) {
|
||
if (!readChar) {
|
||
readChar = char;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (!writeChar) {
|
||
throw new Error('未找到可写的特征值');
|
||
}
|
||
|
||
console.log('选择写入特征:', writeChar);
|
||
console.log('选择通知特征:', notifyChar);
|
||
|
||
// 6. 如果需要,开启通知
|
||
if (notifyChar) {
|
||
try {
|
||
await uni.notifyBLECharacteristicValueChange({
|
||
deviceId: device.deviceId,
|
||
serviceId: targetService.uuid,
|
||
characteristicId: notifyChar.uuid,
|
||
state: true
|
||
});
|
||
console.log('已开启通知');
|
||
} catch (notifyError) {
|
||
console.warn('无法开启通知:', notifyError);
|
||
}
|
||
}
|
||
|
||
// 7. 保存设备信息
|
||
commit('SET_CURRENT_DEVICE', {
|
||
id: device.deviceId,
|
||
name: device.name || '未知设备',
|
||
serviceId: targetService.uuid,
|
||
characteristicId: writeChar.uuid,
|
||
notifyId: notifyChar ? notifyChar.uuid : null,
|
||
readId: readChar ? readChar.uuid : null,
|
||
writeType: writeChar.properties.writeWithoutResponse ? 'writeWithoutResponse' : 'write',
|
||
properties: writeChar.properties
|
||
});
|
||
|
||
commit('SET_CONNECTION_STATUS', 'connected');
|
||
commit('ADD_LOG', {
|
||
type: 'success',
|
||
message: `连接成功: ${device.name || device.deviceId}`
|
||
});
|
||
|
||
// 8. 监听连接状态变化
|
||
uni.onBLEConnectionStateChange((changeRes) => {
|
||
console.log('连接状态变化:', changeRes);
|
||
if (!changeRes.connected && state.currentDevice?.id === changeRes.deviceId) {
|
||
commit('ADD_LOG', {
|
||
type: 'warning',
|
||
message: '蓝牙连接已断开'
|
||
});
|
||
commit('SET_CONNECTION_STATUS', 'disconnected');
|
||
|
||
if (state.autoReconnect && state.reconnectAttempts < state.maxReconnectAttempts) {
|
||
dispatch('attemptReconnect');
|
||
}
|
||
}
|
||
});
|
||
|
||
// 9. 监听特征值变化(如果有通知)
|
||
if (notifyChar) {
|
||
uni.onBLECharacteristicValueChange((res) => {
|
||
console.log('收到特征值变化:', res);
|
||
// 这里可以处理打印机返回的数据
|
||
});
|
||
}
|
||
return true;
|
||
|
||
} catch (error) {
|
||
console.error('连接失败:', error);
|
||
commit('SET_CONNECTION_STATUS', 'error');
|
||
commit('SET_ERROR', error);
|
||
commit('ADD_LOG', {
|
||
type: 'error',
|
||
message: `连接失败: ${error.message || error.errMsg || '未知错误'}`
|
||
});
|
||
return false;
|
||
}
|
||
},
|
||
/**
|
||
* 发送打印数据到TSC打印机
|
||
*/
|
||
async sendPrintData({
|
||
commit,
|
||
state,
|
||
dispatch
|
||
}, printTask) {
|
||
|
||
if (state.connectionStatus !== 'connected') {
|
||
throw new Error('打印机未连接');
|
||
}
|
||
if (state.isPrinting) {
|
||
// 加入队列等待
|
||
commit('ADD_TO_QUEUE', printTask);
|
||
return {
|
||
queued: true,
|
||
taskId: state.printQueue[state.printQueue.length - 1].id
|
||
};
|
||
}
|
||
commit('INIT_PRINTER_INSTANCE');
|
||
|
||
commit('SET_PRINTING', true);
|
||
const taskId = printTask.id || Math.random();
|
||
|
||
try {
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: `开始打印任务: ${printTask.title || '未命名'}`
|
||
});
|
||
|
||
// 1. 准备TSC指令
|
||
const printer = state.printer;
|
||
printer.clear(); // 清空缓冲区
|
||
|
||
if (printTask.size) {
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: `重设大小${printTask.size.width} * ${printTask.size.height}`
|
||
});
|
||
console.log(`重设大小${printTask.size.width} * ${printTask.size.height}`);
|
||
printer.setSize(printTask.size.width,printTask.size.height);
|
||
}
|
||
console.log("printTask",printTask);
|
||
|
||
printer.setBitmap(0, 0, 0, printTask);
|
||
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: `生成打印任务内容: ${printTask.title || '未命名'}`
|
||
});
|
||
|
||
// 3. 添加打印指令
|
||
printer.setPrint(printTask.copies || 1);
|
||
// 4. 获取二进制数据
|
||
const commandData = printer.getData();
|
||
// 5. 分片发送(BLE限制)
|
||
const chunkSize = 20; // BLE MTU通常为20字节
|
||
const chunks = [];
|
||
|
||
// 确保 commandData 是 Uint8Array 或 ArrayBuffer
|
||
let dataArray;
|
||
if (typeof commandData === 'string') {
|
||
// 如果是字符串,转换为 Uint8Array
|
||
const encoder = new TextEncoder();
|
||
dataArray = encoder.encode(commandData);
|
||
} else if (commandData instanceof ArrayBuffer) {
|
||
dataArray = new Uint8Array(commandData);
|
||
} else if (commandData instanceof Uint8Array) {
|
||
dataArray = commandData;
|
||
} else {
|
||
// 尝试其他类型转换
|
||
dataArray = new Uint8Array(commandData);
|
||
}
|
||
|
||
for (let i = 0; i < dataArray.length; i += chunkSize) {
|
||
const chunk = dataArray.slice(i, Math.min(i + chunkSize, dataArray.length));
|
||
chunks.push(chunk);
|
||
}
|
||
|
||
// 6. 发送数据
|
||
for (let i = 0; i < chunks.length; i++) {
|
||
const chunk = chunks[i];
|
||
await uni.writeBLECharacteristicValue({
|
||
deviceId: state.currentDevice.id,
|
||
serviceId: state.currentDevice.serviceId,
|
||
characteristicId: state.currentDevice.characteristicId,
|
||
value: chunk.buffer, // 直接传递 ArrayBuffer
|
||
writeType: state.currentDevice.writeType
|
||
});
|
||
|
||
// 添加延迟,避免发送过快
|
||
if (i < chunks.length - 1) {
|
||
await delay(20);
|
||
}
|
||
}
|
||
|
||
// 7. 记录成功
|
||
commit('ADD_TO_HISTORY', {
|
||
...printTask,
|
||
id: taskId,
|
||
success: true
|
||
});
|
||
|
||
commit('ADD_LOG', {
|
||
type: 'success',
|
||
message: `打印完成: ${printTask.title || '任务'}`
|
||
});
|
||
|
||
return {
|
||
success: true,
|
||
taskId
|
||
};
|
||
|
||
} catch (error) {
|
||
commit('SET_ERROR', error);
|
||
commit('ADD_LOG', {
|
||
type: 'error',
|
||
message: `打印失败: ${error.errMsg || error.message}`
|
||
});
|
||
|
||
// 记录失败历史
|
||
commit('ADD_TO_HISTORY', {
|
||
...printTask,
|
||
id: taskId,
|
||
success: false,
|
||
error: error.message
|
||
});
|
||
|
||
throw error;
|
||
|
||
} finally {
|
||
commit('SET_PRINTING', false);
|
||
|
||
// 检查并处理下一个队列任务
|
||
if (state.printQueue.length > 0) {
|
||
const nextTask = state.printQueue[0];
|
||
commit('REMOVE_FROM_QUEUE', nextTask.id);
|
||
setTimeout(() => {
|
||
dispatch('sendPrintData', nextTask);
|
||
}, 500);
|
||
}
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 生成标签内容
|
||
*/
|
||
async generateLabelContent({
|
||
getters,
|
||
commit,
|
||
state
|
||
}, {
|
||
printer,
|
||
data,
|
||
size
|
||
}) {
|
||
|
||
|
||
printer.setCls();
|
||
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: `开始生成标签`
|
||
});
|
||
|
||
const mmToDot = getters.mmToDot;
|
||
|
||
|
||
// 设置标签尺寸
|
||
printer.setSize(size.width, size.height);
|
||
|
||
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: `设置标签大小完成${size.width}, ${size.height}`
|
||
});
|
||
// 添加文本
|
||
if (data.texts) {
|
||
data.texts.forEach(text => {
|
||
printer.setText(
|
||
mmToDot(text.x || 10),
|
||
mmToDot(text.y || 10),
|
||
text.font || 'TSS24.BF2',
|
||
text.rotation || 0,
|
||
text.xScale || 1,
|
||
text.yScale || 1,
|
||
text.content
|
||
);
|
||
});
|
||
}
|
||
|
||
// 添加条形码
|
||
if (data.barcodes) {
|
||
data.barcodes.forEach(barcode => {
|
||
printer.setBarCode(
|
||
mmToDot(barcode.x || 10),
|
||
mmToDot(barcode.y || 40),
|
||
barcode.type || '128',
|
||
mmToDot(barcode.height || 20),
|
||
barcode.readable ? 1 : 0,
|
||
barcode.rotation || 0,
|
||
barcode.narrow || 2,
|
||
barcode.wide || 4,
|
||
barcode.content
|
||
);
|
||
});
|
||
}
|
||
|
||
// 添加二维码
|
||
if (data.qrcodes) {
|
||
data.qrcodes.forEach(qrcode => {
|
||
printer.setQrcode(
|
||
mmToDot(qrcode.x || 10),
|
||
mmToDot(qrcode.y || 70),
|
||
qrcode.level || 'M',
|
||
qrcode.width || 4,
|
||
qrcode.mode || 'A',
|
||
qrcode.rotation || 0,
|
||
qrcode.model || "M1",
|
||
qrcode.mask || "S7",
|
||
qrcode.content
|
||
|
||
);
|
||
});
|
||
}
|
||
|
||
// 添加线条
|
||
if (data.bars) {
|
||
data.bars.forEach(bar => {
|
||
printer.setBar(
|
||
mmToDot(bar.x || 10),
|
||
mmToDot(bar.y || 10),
|
||
mmToDot(bar.width || 50),
|
||
mmToDot(bar.height || 2)
|
||
);
|
||
});
|
||
}
|
||
|
||
// 添加方框
|
||
if (data.boxes) {
|
||
data.boxes.forEach(box => {
|
||
printer.setBox(
|
||
mmToDot(box.x1 || 10),
|
||
mmToDot(box.y1 || 10),
|
||
mmToDot(box.x2 || 60),
|
||
mmToDot(box.y2 || 40),
|
||
mmToDot(box.thickness || 1)
|
||
);
|
||
});
|
||
}
|
||
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: `开始生成标签完成`
|
||
});
|
||
},
|
||
|
||
/**
|
||
* 打印商品标签(示例)
|
||
*/
|
||
async printProductLabel({
|
||
dispatch
|
||
}, productData) {
|
||
const task = {
|
||
type: 'label',
|
||
title: `商品标签-${productData.code}`,
|
||
copies: productData.copies || 1,
|
||
size: {
|
||
width: 70,
|
||
height: 20
|
||
},
|
||
data: {
|
||
texts: [{
|
||
x: 25,
|
||
y: 2,
|
||
font: 'TSS24.BF2',
|
||
content: productData.name,
|
||
rotation: 0
|
||
},
|
||
{
|
||
x: 25,
|
||
y: 5,
|
||
font: 'TSS24.BF2',
|
||
content: `型号:${productData.model}`,
|
||
rotation: 0
|
||
},
|
||
{
|
||
x: 25,
|
||
y: 8,
|
||
font: 'TSS24.BF2',
|
||
content: `价格¥${productData.price}`,
|
||
xScale: 2,
|
||
yScale: 2,
|
||
rotation: 0
|
||
},
|
||
|
||
],
|
||
qrcodes: [{
|
||
x: 2,
|
||
y: 2,
|
||
width: 7,
|
||
|
||
content: productData.code,
|
||
readable: true,
|
||
|
||
}],
|
||
}
|
||
};
|
||
|
||
return dispatch('sendPrintData', task);
|
||
},
|
||
/**
|
||
* 打印canvas
|
||
*/
|
||
async printCanvas({
|
||
dispatch
|
||
}, canvasData) {
|
||
return dispatch('sendPrintData', canvasData);
|
||
console.log("canvasData",canvasData);
|
||
|
||
},
|
||
/**
|
||
* 断开连接
|
||
*/
|
||
async disconnectDevice({
|
||
commit,
|
||
state
|
||
}) {
|
||
if (!state.currentDevice) return;
|
||
|
||
try {
|
||
await uni.closeBLEConnection({
|
||
deviceId: state.currentDevice.id
|
||
});
|
||
|
||
commit('RESET_CONNECTION');
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: '已断开连接'
|
||
});
|
||
return true;
|
||
} catch (error) {
|
||
commit('SET_ERROR', error);
|
||
return false;
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 尝试重连
|
||
*/
|
||
async attemptReconnect({
|
||
commit,
|
||
state,
|
||
dispatch
|
||
}) {
|
||
if (!state.autoReconnect ||
|
||
!state.currentDevice ||
|
||
state.reconnectAttempts >= state.maxReconnectAttempts) {
|
||
return;
|
||
}
|
||
|
||
commit('SET_RECONNECT_ATTEMPTS', state.reconnectAttempts + 1);
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: `重连尝试 (${state.reconnectAttempts}/${state.maxReconnectAttempts})`
|
||
});
|
||
|
||
setTimeout(async () => {
|
||
const success = await dispatch('connectDevice', state.currentDevice);
|
||
if (!success) {
|
||
dispatch('attemptReconnect');
|
||
} else {
|
||
commit('SET_RECONNECT_ATTEMPTS', 0);
|
||
}
|
||
}, 2000);
|
||
|
||
},
|
||
|
||
|
||
/**
|
||
* 清空打印队列
|
||
*/
|
||
clearPrintQueue({
|
||
commit
|
||
}) {
|
||
commit('CLEAR_QUEUE');
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: '打印队列已清空'
|
||
});
|
||
},
|
||
|
||
/**
|
||
* 重置模块状态
|
||
*/
|
||
resetModule({
|
||
commit
|
||
}) {
|
||
commit('RESET_CONNECTION');
|
||
commit('RESET_SCAN');
|
||
commit('CLEAR_QUEUE');
|
||
commit('SET_PRINTING', false);
|
||
commit('SET_ERROR', null);
|
||
commit('SET_RECONNECT_ATTEMPTS', 0);
|
||
commit('ADD_LOG', {
|
||
type: 'info',
|
||
message: '模块状态已重置'
|
||
});
|
||
}
|
||
};
|
||
|
||
// 工具函数
|
||
function arrayBufferToBase64(buffer) {
|
||
let binary = '';
|
||
const bytes = new Uint8Array(buffer);
|
||
for (let i = 0; i < bytes.length; i++) {
|
||
binary += String.fromCharCode(bytes[i]);
|
||
}
|
||
return uni.arrayBufferToBase64 ?
|
||
uni.arrayBufferToBase64(binary) :
|
||
btoa(binary);
|
||
}
|
||
|
||
function delay(ms) {
|
||
return new Promise(resolve => setTimeout(resolve, ms));
|
||
}
|
||
|
||
export default {
|
||
namespaced: true,
|
||
state,
|
||
getters,
|
||
mutations,
|
||
actions
|
||
}; |