whycq
2024-10-18 2b5bf2b63f6b8718a396f16f02c682f635744425
pages/phyz/checkLocDetl/checkLocDetl.vue
@@ -1,19 +1,29 @@
<template>
   <view>
      <view style="display: flex;">
         <view class="dropdown">
            <input type="text" style="flex: 1;" v-model="row1"  placeholder="请输入排" @confirm="getLocMastList">
            <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('row1')"></uni-icons>
         </view>
         <view class="dropdown">
            <input type="text" style="flex: 1;" v-model="bay1"   placeholder="请输入列"  @confirm="getLocMastList">
            <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('bay1')"></uni-icons>
         </view>
         <view class="dropdown">
            <input type="text" style="flex: 1;" v-model="lev1"  placeholder="请输入层" @confirm="getLocMastList">
            <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('lev1')"></uni-icons>
      <view class="code">
         <uni-search-bar  v-model="searchValue1"
            maxlength="500" ancel="cancel" @confirm="searchValueInput1()" @clear="clearVal" placeholder="输入 / 扫描 货架码">
         </uni-search-bar>
         <view style="display: flex;padding: 10rpx 20rpx;">
            <view class="dropdown">
               <input type="text" style="flex: 1;" v-model="row1"  placeholder="排" placeholder-style="font-size:10px" @confirm="getLocMastList('')">
               <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('row1')"></uni-icons>
            </view>
            <view class="dropdown">
               <input type="text" style="flex: 1;" v-model="bay1"   placeholder="列" placeholder-style="font-size:10px" @confirm="getLocMastList('')">
               <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('bay1')"></uni-icons>
            </view>
            <view class="dropdown">
               <input type="text" style="flex: 1;" v-model="lev1"  placeholder="层" placeholder-style="font-size:10px" @confirm="getLocMastList('')">
               <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('lev1')"></uni-icons>
            </view>
            <view class="dropdown">
               <input type="text" style="flex: 1;" v-model="floor"  placeholder="楼层" placeholder-style="font-size:10px" @confirm="getLocMastList('')">
               <uni-icons type="close" color="#c1c1c1" style="margin-left: 10rpx;" @click="clear('floor')"></uni-icons>
            </view>
         </view>
      </view>
      
      <view class="list list-font-color" :class="locMast.color" v-for="(locMast,index) in dataList" :key="index">
         <view class="list-left">
@@ -57,6 +67,7 @@
   export default {
      data() {
         return {
            searchValue1: '',
            baseUrl: '',
            token: '',
            barcode: '',
@@ -64,14 +75,22 @@
            row1: '',
            bay1: '',
            lev1: '',
            floor: '',
            dataList: [],
            item: ''
         }
      },
      onLoad() {
      onShow() {
         this.baseUrl = uni.getStorageSync('baseUrl');
         this.token = uni.getStorageSync('token');
         if (uni.getStorageSync('lev1')) {
            // this.lev1 = uni.getStorageSync('lev1');
         } else {
            this.lev1 = ''
         }
         this.getLocMastList()
         this.barcode = ''
      },
      methods: {
         clear(e) {
@@ -79,40 +98,61 @@
               case 'row1':
                  setTimeout(() => {
                     this.row1 = ''
                     this.getLocMastList()
                     this.getLocMastList('')
                  }, 100);
                  break;
               case 'bay1':
                  setTimeout(() => {
                     this.bay1 = ''
                     this.getLocMastList()
                     this.getLocMastList('')
                  }, 100);
                  
                  break;
               case 'lev1':
                  setTimeout(() => {
                     this.lev1 = ''
                     this.getLocMastList()
                     this.getLocMastList('')
                  }, 100);
                  break;
               case 'floor':
                  setTimeout(() => {
                     this.floor = ''
                     this.getLocMastList('')
                  }, 100);
                  break;
            }
         },
         getLocMastList() {
            let _this = this
         clearVal() {
            this.getLocMastList('')
         },
         searchValueInput1() {
            setTimeout(() => {
               this.row1 = ''
               this.bay1 = ''
               this.lev1 = ''
               this.floor = ''
               this.getLocMastList(this.searchValue1)
            }, 100);
         },
         getLocMastList(barcode) {
            let _this = this
            // uni.setStorageSync('lev1', this.lev1);
            this.dataList = []
            uni.request({
               url: `${_this.baseUrl}/agv/locMast/list/auth`,
               header: {'token': uni.getStorageSync('token')},
               data: {
                  curr: 1,
                  limit: 50,
                  limit: 100,
                  row1: _this.row1,
                  bay1: _this.bay1,
                  lev1: _this.lev1,
                  floor: _this.floor,
                  barcode: barcode
               },
               method: 'GET',
               success(res) {
                  res = res.data
                  console.log(res);
                  if (res.code === 200) {
                     for (let k of res.data.records) {
                        if (k.locSts == 'F') {
@@ -129,11 +169,18 @@
                           k['color'] = 'locSts-X' 
                        } else if (k.locSts == 'Q') {
                           k['color'] = 'locSts-Q' 
                        } else if (k.locSts == 'P') {
                           k['color'] = 'locSts-P'
                        } else if (k.locSts == 'X') {
                           k['color'] = 'locSts-X' 
                        }
                     }
                     _this.dataList = res.data.records
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  } 
               }
            })
@@ -141,6 +188,10 @@
         goToLocDetl(e) {
            this.locNo = e.locNo
            this.item = e
            if (e.locSts == 'S' || e.locSts == 'R') {
               uni.showToast({ title: '当前库位在作业', icon: "error", position: 'top' })
               return
            }
            this.$refs.check.open()
         },
         checkClose() {
@@ -156,6 +207,7 @@
            uni.navigateTo({
               url: "./locDetl",
               success: function(res) {
                  _this.$refs.check.close()
                  // 通过eventChannel向被打开页面传送数据   向另外一个页面传递值的
                  res.eventChannel.emit('item', {
                     item: param
@@ -164,7 +216,8 @@
               events: {
                  // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据  另外一个页面传过来的
                  acceptDataFromOpenedPage: function(data) {
                     _this.searchValueFocus = true
                     _this.$refs.check.close()
                     _this.getLocMastList()
                  }
               },
            });
@@ -182,10 +235,11 @@
   }
   .list-font-color {
      color: #fff;
      /* background-color: #33bb44; */
      /* background-color: #2299ff; */
   }
   .dropdown {
      border: 1px solid #a7a7a7;
      border-radius: 8rpx;
      margin: 2px;
      padding: 6px;
   }
@@ -213,6 +267,9 @@
   .locSts-P {
      background-color: #ffaa00;
   }
   .locSts-Q {
      background-color: #47a301;
   }
   .locSts-X {
      background-color: #767676;
   }