Browse Source

扫码功能

master
zhang_li 8 months ago
parent
commit
4b66ec8a59
  1. 4
      src/api/location.js
  2. 7
      src/pages.json
  3. 5
      src/pages/index.vue
  4. 188
      src/pages/scanCode/scanCode.vue
  5. BIN
      src/static/images/icon8.png

4
src/api/location.js

@ -8,3 +8,7 @@ export function getLocation(number) {
export function getOutLocation(params) {
return http.get('/eam/location/outScanCodeByNumber',{params})
}
// 首页扫码获取详情
export function pdaItemAndLocation(number) {
return http.get('/eam/location/pdaItemAndLocation?number='+number)
}

7
src/pages.json

@ -45,6 +45,13 @@
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/scanCode/scanCode",
"style": {
"navigationBarTitleText": "扫码详情",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}],
"globalStyle": {

5
src/pages/index.vue

@ -38,8 +38,8 @@
<view class="title">扫码</view>
<u-row gutter="16" style="padding:0px 20rpx ;">
<u-col span="3">
<view class="icon-item" @click="open('/pages/inLocation/index')">
<image src="../static/images/icon1.png" mode=""></image>
<view class="icon-item" @click="open('/pages/scanCode/scanCode')">
<image src="../static/images/icon8.png" mode=""></image>
<view>扫码</view>
</view>
</u-col>
@ -142,6 +142,7 @@
.index-content {
background-color: white;
min-height: 100vh;
padding-bottom: 20rpx;
}
.bg {

188
src/pages/scanCode/scanCode.vue

@ -0,0 +1,188 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<view class="screen-input">
<u-search v-model='number' :show-action='false' :bg-color="'white'" :border-color="'#E4E4E4'"
:shape="'square'" :height="80" :placeholder="'请扫描设备或者库位'" :clearabled="true" @blur="blur()"
@confirm="handelScanMsg">
</u-search>
</view>
<view class="title">
<view class="">
详细信息
</view>
</view>
<view class="list">
<view class="item " v-for="(item,index) in list" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
库位名称:{{item.name}}
</view>
</view>
<view class="dec">
<view>库位编码</view>
<view>{{item.locationNumber}}</view>
</view>
<view class="dec">
<view>库位名称</view>
<view>{{item.name}}</view>
</view>
<view class="dec">
<view>库区编码</view>
<view>{{item.areaNumber}}</view>
</view>
<view class="dec">
<view>库区名称</view>
<view>{{item.areaName}}</view>
</view>
<view class="dec">
<view>库位类型</view>
<view>{{item.isInAccount == 'TRUE'?'帐内库' :'帐外库'}}</view>
</view>
<view class="dec">
<view>设备编码</view>
<view>{{item.itemNumber}}</view>
</view>
<view class="dec">
<view>设备名称</view>
<view>{{item.itemName}}</view>
</view>
<view class="dec">
<view>库存</view>
<view>{{item.qty}}</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as locationApi from "@/api/location.js"
const { proxy } = getCurrentInstance()
const number = ref('LN0000000001')
const list = ref([])
function getPdaItemAndLocation() {
locationApi.pdaItemAndLocation(number.value).then((res) => {
if(!res.data||res.data.length==0){
list.value = []
if(res.msg){
proxy.$modal.showToast(res.msg)
}
return;
}
list.value = res.data
}).catch((err)=>{
list.value = []
proxy.$modal.showToast(err.msg)
})
}
function blur() {
if (number.value) {
getPdaItemAndLocation()
}
}
//
function handelScanMsg() {
getPdaItemAndLocation()
}
onLoad(async (option) => {
getPdaItemAndLocation()
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: 100vh;
background: white;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.screen-input {
margin: 30rpx;
}
.title {
display: flex;
align-items: center;
padding: 0px 30rpx;
// background: #f5f5f5;
margin-top: 10px;
font-weight: bold;
font-size: 32rpx;
view {
&:nth-child(1) {
flex: 1;
border-left: 10rpx solid #409eff;
padding-left: 20rpx;
font-weight: bold;
color: #409eff;
}
}
}
.list {
padding: 30rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
display: flex;
view {
&:nth-child(1) {
width: 150rpx;
}
&:nth-child(2) {
flex: 1;
word-wrap: break-word;
width: 0px;
}
}
}
}
}
</style>

BIN
src/static/images/icon8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Loading…
Cancel
Save