From 2f26ba8f2c8f5c67e5ed16f4e89baaef82d70a3b Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期五, 30 五月 2025 13:29:49 +0800 Subject: [PATCH] 联调pda扫码功能,解决pda上面样式问题 --- pages/product/feed/locationList.vue | 267 ++++++++++++++++++++++++++-------------------------- 1 files changed, 134 insertions(+), 133 deletions(-) diff --git a/pages/product/feed/locationList.vue b/pages/product/feed/locationList.vue index 3ca8fde..6d95475 100644 --- a/pages/product/feed/locationList.vue +++ b/pages/product/feed/locationList.vue @@ -4,9 +4,9 @@ <u-search v-model="keywords" placeholder="璇疯緭鍏ュ簱浣嶅悕绉�" @clear="search" @custom="search" @search="search"> </u-search> </view> - <scroll-view class="scroll-list" scroll-y="true" > + <scroll-view class="scroll-list" scroll-y="true"> <u-cell-group class="list" :border="false"> - <view v-if="locationList==0" class="nodata"> + <view v-if="locationList == 0" class="nodata"> <view>鏈煡鍒版暟鎹�</view> </view> <view v-else class="content" v-for="(item, index) in locationList" :key="item.locNo" :index="index" @@ -32,15 +32,15 @@ 搴撲綅绫诲瀷: </view> <view class="_content"> - {{ getLocTypeName(item.locType)}} + {{ getLocTypeName(item.locType) }} </view> </view> <view class="row-list"> <view class="_label"> 搴撲綅鐘舵��: </view> - <view class="_content"> - {{getLocStatus(item.locStatus)}} + <view class="_content"> + {{ getLocStatus(item.locStatus) }} </view> </view> </view> @@ -50,147 +50,148 @@ </view> </template> <script> - import scan from "@/components/scan/scan.vue"; - export default { - components: { - scan +import scan from "@/components/scan/scan.vue"; +export default { + components: { + scan + }, + data() { + return { + originList: [], + locationList: [], + keywords: "", + dictType: "warehouse_type", + listLocType: [] + }; + }, + onLoad(params) { + + //鑾峰彇鏁� 搴撲綅鐘舵�� + this.$u.api.dictData({ + dictType: this.dictType + }).then(res => { + this.listLocType = res.data; + + }); + + if (params && params.workstationNo !== "undefined") { + this.loadList(params.workstationNo); + } + + }, + onShow() { + let that = this + uni.$off('scan') // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒 + uni.$on('scan', function (data) { + console.log('onscan'); + //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲� + console.log('鎵爜缁撴灉锛�', data.code); + that.search(data.code); + }) + }, + onNavigationBarButtonTap(e) { + uni.scanCode({ + success: res => { + try { + const result = JSON.parse(res.result) + + } catch (e) { } + } + }); + }, + methods: { + getLocTypeName(locType) { + let reDate = "" + let that = this + //鍒ゆ柇鏁扮粍涓槸鍚﹀瓨鍦� + let list = that.listLocType.filter(item => item.value == locType) + if (list.length > 0) { + reDate = list[0].label + } + return reDate }, - data() { - return { - originList: [], - locationList: [], - keywords: "", - dictType: "warehouse_type", - listLocType: [] - }; - }, - onLoad(params) { - - //鑾峰彇鏁� 搴撲綅鐘舵�� - this.$u.api.dictData({ - dictType: this.dictType - }).then(res => { - this.listLocType = res.data; - - }); - - if (params && params.workstationNo !== "undefined") { - this.loadList(params.workstationNo); + getLocStatus(locStatus) { + let reDate = "" + switch (locStatus) { + case 1: + reDate = "浣跨敤"; + break; + case 0: + reDate = "鍋滅敤"; + break; } + return reDate; }, - onShow() { + selectLocation(location) { + this.refreshLastPage(location) + }, + //鍒锋柊涓婁竴涓〉闈� + refreshLastPage(location) { + // 鍛婄煡 A.vue 鏇存柊鏁版嵁 + // 鑾峰彇椤甸潰鏍� + let pages = getCurrentPages() - let that = this + // 鑾峰彇涓婁竴椤垫爤 + let prevPage = pages[pages.length - 2] - uni.$off('scan') // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒 - uni.$on('scan', function(data) { - console.log('onscan'); - //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲� - console.log('鎵爜缁撴灉锛�', data.code); - that.search(data.code); + // 瑙﹀彂涓婁竴椤� upData 鍑芥暟(骞舵惡甯﹀弬鏁�) + prevPage.$vm.setLocation(location) + + // 杩斿洖涓婁竴椤� + uni.navigateBack({ + delta: 1 }) }, - onNavigationBarButtonTap(e) { - uni.scanCode({ - success: res => { - try { - const result = JSON.parse(res.result) - - } catch (e) {} - } + search(value) { + let that = this + if (value) { + that.locationList = that.originList.filter(item => item.locName.includes(value)) + } else { + that.locationList = that.originList + } + }, + loadList(workstationNo) { + let params = { + workstationNo: workstationNo + } + //鏍规嵁宸ヤ綔绔欑紪鍙疯幏鍙栬繘琛屼腑鐨勫伐鍗�&&瀵瑰簲鐨勭嚎杈逛粨 + this.$u.api.pigxFeed.getBasicInfoForPdaFeedByWorkstationNo(params).then(res => { + this.originList = res.data.locationList + this.locationList = this.originList }); }, - methods: { - getLocTypeName(locType) { - let reDate = "" - let that = this - //鍒ゆ柇鏁扮粍涓槸鍚﹀瓨鍦� - let list = that.listLocType.filter(item => item.value == locType) - if (list.length > 0) { - reDate = list[0].label - } - return reDate - }, - getLocStatus(locStatus) { - let reDate = "" - switch (locStatus) { - case 1: - reDate = "浣跨敤"; - break; - case 0: - reDate = "鍋滅敤"; - break; - } - - return reDate; - }, - selectLocation(location) { - this.refreshLastPage(location) - }, - //鍒锋柊涓婁竴涓〉闈� - refreshLastPage(location) { - // 鍛婄煡 A.vue 鏇存柊鏁版嵁 - // 鑾峰彇椤甸潰鏍� - let pages = getCurrentPages() - - // 鑾峰彇涓婁竴椤垫爤 - let prevPage = pages[pages.length - 2] - - // 瑙﹀彂涓婁竴椤� upData 鍑芥暟(骞舵惡甯﹀弬鏁�) - prevPage.$vm.setLocation(location) - - // 杩斿洖涓婁竴椤� - uni.navigateBack({ - delta: 1 - }) - }, - search(value) { - let that = this - if (value) { - that.locationList = that.originList.filter(item => item.locName.includes(value)) - } else { - that.locationList = that.originList - } - }, - loadList(workstationNo) { - let params = { - workstationNo: workstationNo - } - //鏍规嵁宸ヤ綔绔欑紪鍙疯幏鍙栬繘琛屼腑鐨勫伐鍗�&&瀵瑰簲鐨勭嚎杈逛粨 - this.$u.api.pigxFeed.getBasicInfoForPdaFeedByWorkstationNo(params).then(res => { - this.originList = res.data.locationList - this.locationList = this.originList - }); - }, - } - }; + } +}; </script> <style lang="scss"> - .list .content { - font-size: 12px; - background-color: #efefef; - box-sizing: border-box; - border-radius: 14rpx; - margin: 8px; - padding: 5px 10px; - box-shadow: none; - } +.list .content { + font-size: 12px; + background-color: #efefef; + box-sizing: border-box; + border-radius: 14rpx; + margin: 8px; + padding: 5px 10px; + box-shadow: none; +} - .row-list { - display: flex; - flex-direction: row; - } +.row-list { + display: flex; + flex-direction: row; +} - .row-list ._label { - flex: 0.8; - color: #909399; - } +.row-list ._label { + flex: 0.8; + color: #909399; +} - .row-list ._content { - flex: 1.5; - text-align: right; - } - - .nodata{width: 20%;margin: auto;} +.row-list ._content { + flex: 1.5; + text-align: right; +} + +.nodata { + width: 20%; + margin: auto; +} </style> -- Gitblit v1.9.3