Files
hht-oulun-uni/pages/outbound/line-transfer.vue
2026-03-17 10:50:56 +08:00

181 lines
4.6 KiB
Vue

<template>
<view class="zd_container">
<!-- 产线转运 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">载具编码</span>
</view>
<view class="zd-col-17">
<search-box
v-model="val1"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">起点点位</span>
</view>
<view class="zd-col-17">
<search-box
v-model="val3"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">站点类型</span>
</view>
<view class="zd-col-24 filter_select">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
<view class="zd-row border-bottom" v-show="index !== '2'">
<view class="zd-col-7">
<span class="filter_label">终点站点</span>
</view>
<view class="zd-col-17">
<search-box
v-model="val2"
/>
</view>
</view>
<view class="zd-row border-bottom" v-show="index == '2'">
<view class="zd-col-7">
<span class="filter_label">目标区域</span>
</view>
<view class="zd-col-24 filter_select">
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">物料校验</span>
</view>
<view class="relative zd-col-24">
<switch :checked="isChecked" color="#4e6ef2" style="transform:scale(0.8); transform-origin: left;"/>
<text @tap="setWStatus" style="position: absolute;display: inline-block;width: 52px; height: 32px;left: 0;"></text>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
<button class="zd-col-16 button-primary" :class="{'button-info': !val1 || !index}" :disabled="disabled" @tap="_transferConfirm">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {getSect, getRegion, transferConfirm} from '@/utils/getData3.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
val3: '',
val2: '',
options: [{text:'站点', value:'1'},{text:'区域',value: '2'}],
index: '2',
// options2: [{text:'堆叠托盘', value:'11111111'},{text:'料箱',value: '22222222'},{text:'白色EPH',value: '33333333'}],
options2: [],
index2: '',
disabled: false,
currentData: {},
isChecked: true
};
},
onLoad (options) {
this.title = options.title
},
// 使用 onShow 确保每次进入页面(包括从后台切回)都能读取最新的缓存值
onShow() {
this.loadSelectedValue();
},
created () {
this._getRegion()
},
methods: {
async _getRegion () {
try {
let res = await getRegion()
if (res) {
this.options2 = res
} else {
this.options2 =[]
}
} catch (e) {
this.options2 = []
}
},
// 从缓存加载选中的值
loadSelectedValue() {
if (uni.getStorageSync('selectedSiteType')) {
this.index = uni.getStorageSync('selectedSiteType')
}
if (uni.getStorageSync('selectedMbqy')) {
this.index2 = uni.getStorageSync('selectedMbqy')
}
},
selectChange (e) {
this.index = e
uni.setStorageSync('selectedSiteType', e)
},
selectChange2 (e) {
this.index2 = e
uni.setStorageSync('selectedMbqy', e)
},
clearUp () {
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.index2 = ''
this.disabled = false
this.kwData = {}
this.isChecked = true
},
async _transferConfirm () {
this.disabled = true
if (!this.val3 || !this.val1 || !this.index) {
this.disabled = false
return
}
try {
let check = this.isChecked ? '1' : '0'
let res = await transferConfirm(this.val3, this.val1, this.val2, this.index2, check)
if (res.code === '200') {
uni.showToast({
title: res.message,
icon: 'none'
})
this.clearUp()
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
this.disabled = false
}
} catch (e) {
this.disabled = false
}
},
setWStatus () {
this.isChecked = !this.isChecked
}
}
}
</script>
<style lang="stylus">
</style>