#
zhou zhou
2026-01-24 060a2abc3364b6a98e41f3bd6fdf2e2a7789db89
pages/AGV/StartInTask.vue
@@ -1,17 +1,27 @@
<template>
   <view class="has-foot">
      <form>
         <view class="cu-form-group ">
            <view class="title">接驳站</view>
            <input placeholder="请扫描接驳站条码" v-model="barcode" ></input>
            <text class='cuIcon-search text-blue' @click="search"></text>
         </view>
         <view class="cu-form-group margin-top">
            <view class="title">接驳站点</view>
            <input placeholder="请扫描接驳站点条码" v-model="agvStation" ></input>
            <!-- <text class='cuIcon-search text-blue' @click="search"></text> -->
         </view>
         <view class="cu-form-group">
            <view class="title">容器号</view>
            <input placeholder="请扫描容器编码" v-model="barcode" @input="search"></input>
            <!-- <text class='cuIcon-search text-blue' @click="search"></text> -->
         </view>
<!--          <view class="flex solid-bottom padding-sm justify-between">
            <view class="text-blue margin-left">容器码:{{container}}</view>
         </view> -->
         <view class="cu-form-group">
            <view class="title">目标库区</view>
            <view style="width: 75%;">
               <uni-data-select style="min-width: 50%; max-width: 100%;" v-model="whAreaId" :localdata="range"
                  placement="bottom" @change="selChange"></uni-data-select>
            </view>
         </view>
      </form>
      <view class="flex solid-bottom padding-sm justify-between">
         <view class="text-blue">容器码:{{container}}</view>
      </view>
      <view class="cu-list det menu sm-border  padding">
@@ -38,19 +48,9 @@
                  <text class="text-grey ">{{item.asnCode}}</text>
               </view>
            </view>
            <view class="cu-item">
               <view class="content">
                  <text class="text-black">供应商批次:</text>
               </view>
               <view class="action">
                  <text class="text-grey">{{item.splrBatch}}</text>
               </view>
            </view>
            <view class="cu-item">
               <view class="content">
                  <text class="text-black">库存批次:</text>
                  <text class="text-black">批次:</text>
               </view>
               <view class="action">
                  <text class="text-grey ">{{item.batch}}</text>
@@ -72,31 +72,11 @@
      <view class="cu-bar btn-group foot">
         <button class="cu-btn text-blue line-blue shadow" @click="clear">清空</button>
         <button class="cu-btn bg-blue shadow-blur" @click="confirm">解绑</button>
         <button v-if="hasButtonPermission('reset')" class="cu-btn text-blue line-blue shadow" @click="clear">清空</button>
         <button v-if="hasButtonPermission('submit')" class="cu-btn bg-blue shadow-blur" :disabled="repeatClick" @click="confirm">入库</button>
      </view>
      <uni-popup ref="popup" class="cu-popup">
         <view class="popup-content">
            <view class="head">
               <text>推荐</text>
               <text class='cuIcon-close text-red close' @click="close"></text>
            </view>
            <div class="body">
               <view class="cu-list grid col-3 no-border">
                  <view class="item" v-for="el in range">
                     <view class="cu-btn round  sm" :class="[el===curCode?'bg-blue':'line-blue']"
                        @click="itemChange(el)">{{el}}</view>
                  </view>
               </view>
            </div>
            <view class="cu-bar btn-group ">
               <button class="cu-btn bg-blue shadow-blur" @click="popupSubmit">提交</button>
            </view>
         </view>
      </uni-popup>
   </view>
</template>
@@ -120,32 +100,59 @@
            container: '',
            list: [],
            range: [],
            curCode: ''
            curCode: '',
            whAreaId:'',
            repeatClick: false,
            buttonPermissions: [] ,// 按钮权限列表
            agvStation:''
         }
      },
      computed: {
         ...mapState('user', ['dynamicFields']),
      },
      mounted() {},
      methods: {
      mounted() {
         // this.getRece()
         // this.whAreaId = uni.getStorageSync('whAreaId')
         // 获取按钮权限
         this.buttonPermissions = uni.getStorageSync('buttonPermissions') || [];
         console.log('当前页面按钮权限:', this.buttonPermissions);
      },
      methods: {
         hasButtonPermission(route) {
            return this.buttonPermissions.includes(route);
         },
         selChange(val) {
            uni.setStorageSync('whAreaId', val)
         },
         async search() {
            let that = this
            const {
               code,
               data,
               msg
            } = await request('/staBind/list', {
               sta: this.barcode
            })
            if (code === 200) {
               if(data.list.length >0){
                  that.container = data.barcode
                  that.list = data.list
               }
            if (this.barcode === '' || this.barcode === null) {
               uni.showToast({
                  title: '容器码为空',
                  icon: 'none',
                  position: 'top'
               })
               return
            }
            const { code, data, msg } = await request(
               '/asnOrderItem/container',
               {
                  barcode: this.barcode
               }
            )
            if (code === 200) {
               this.range = data.map((item) => ({
                  value: item.id,
                  text: item.name
               }))
               this.whAreaId = this.range[0].value
            } else {
               uni.showToast({
                  title: msg,
                  icon: "none",
                  icon: 'none',
                  position: 'top'
               })
            }
         },
@@ -176,24 +183,41 @@
         },
         async confirm() {            
            if(this.barcode === '' || this.barcode ===null){
            if(this.agvStation === '' || this.agvStation ===null){
               uni.showToast({
                  title: "接驳站码不能为空",
                  title: "接驳站点不能为空",
                  icon: "none",
               })
               return ;
            }
            if(this.barcode === '' || this.barcode ===null){
               uni.showToast({
                  title: "容器号不能为空",
                  icon: "none",
               })
               return ;
            }
            if(this.whAreaId === '' || this.whAreaId ===null){
               uni.showToast({
                  title: "目标库区不能为空",
                  icon: "none",
               })
               return ;
            }
            this.repeatClick = true
            const {
               code,
               data,
               msg
            } = await request('/AGV/staUnBind',{
                  sta: this.barcode
            } = await request('/AGV/task/start',{
                  staNo: this.agvStation,
                  area: this.whAreaId,
                  barcode:this.barcode
               }
            )
            if (code === 200) {
               uni.showToast({
                  title: '解绑成功'
                  title: '启动成功'
               })
               this.clear()
            } else {
@@ -202,11 +226,22 @@
                  icon: "none",
               })
            }
            this.repeatClick = false
         },
         async getRece() {
            const {
               code,
               data,
               msg
            } = await request('/areas/user/all', {}, 'get')
            if (code === 200) {
               this.range = data.map(item => ({
                  value: item.id,
                  text: item.warehouseId$ + "-- " + item.name
               }));
            }
         },
      }
   }
</script>