Files
hht-ftdl-uni/pages/ftdl/line-call-mater.vue

153 lines
3.5 KiB
Vue
Raw Normal View History

2025-08-07 09:18:45 +08:00
<template>
<view class="zd_container">
2025-08-08 10:03:19 +08:00
<!-- 产线叫料 -->
2025-08-07 09:18:45 +08:00
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
2025-08-08 10:03:19 +08:00
<view class="zd-col-8">
<span class="filter_label">区域</span>
2025-08-07 09:18:45 +08:00
</view>
2025-08-08 10:03:19 +08:00
<view class="zd-col-16">
<search-box
v-model="val1"
@handleChange="handleChange1"
/>
2025-08-07 09:18:45 +08:00
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
2025-08-08 10:03:19 +08:00
<span class="filter_label">物料</span>
2025-08-07 09:18:45 +08:00
</view>
2025-09-03 14:30:22 +08:00
<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">
<view class="zd-col-7">
<span class="filter_label">用料数量</span>
</view>
2025-08-08 10:03:19 +08:00
<view class="zd-col-17">
2025-09-03 14:30:22 +08:00
<input type="number" class="filter_input" v-model="val3" disabled>
2025-08-07 09:18:45 +08:00
</view>
</view>
2025-08-08 10:03:19 +08:00
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">托盘数</span>
</view>
<view class="zd-col-17">
<input type="number" class="filter_input" v-model="val2">
</view>
2025-08-07 09:18:45 +08:00
</view>
</view>
</view>
<view class="zd-row submit-bar">
2025-08-08 10:03:19 +08:00
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
2025-09-03 14:30:22 +08:00
<button class="zd-col-16 button-primary" :class="{'button-info': !val1 || !val2 || !index}" :disabled="disabled" @tap="_loading">确认</button>
2025-08-07 09:18:45 +08:00
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
2025-09-03 14:30:22 +08:00
import {getRegionByPoint, selectMaterialByRegion, loading} from '@/utils/getData4.js'
2025-08-07 09:18:45 +08:00
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
2025-08-08 10:03:19 +08:00
val2: '1',
2025-09-03 14:30:22 +08:00
val3: '',
options: [],
index: '',
2025-08-22 14:05:56 +08:00
pointCode: '',
2025-08-07 09:18:45 +08:00
disabled: false
};
},
onLoad (options) {
this.title = options.title
2025-08-08 10:03:19 +08:00
},
created () {
},
onShow() {
2025-08-07 09:18:45 +08:00
},
methods: {
2025-09-03 14:30:22 +08:00
async _selectMaterialByRegion () {
try {
let res = await selectMaterialByRegion(this.val1)
if (res) {
this.options = res.data
} else {
this.options =[]
}
} catch (e) {
this.options = []
}
},
selectChange (e) {
this.index = e
let selobj = this.options.find(item => item.value === this.index)
this.val3 = selobj.qty
},
2025-08-08 10:03:19 +08:00
handleChange1 (e) {
2025-09-03 14:30:22 +08:00
if (e) {
this._getRegionByPoint(e)
}
2025-08-07 09:18:45 +08:00
},
2025-08-08 10:03:19 +08:00
async _getRegionByPoint (e) {
try {
let res = await getRegionByPoint(e)
if (res) {
2025-08-22 14:05:56 +08:00
this.pointCode = this.val1
2025-08-13 09:07:11 +08:00
this.val1 = res.region_code
2025-09-04 13:49:22 +08:00
this._selectMaterialByRegion()
2025-08-07 09:18:45 +08:00
}
2025-08-08 10:03:19 +08:00
} catch (e) {
this.val1 = ''
2025-08-07 09:18:45 +08:00
}
},
2025-08-08 10:03:19 +08:00
clearUp () {
this.val1 = ''
this.val2 = ''
2025-08-22 14:05:56 +08:00
this.pointCode = ''
2025-09-03 14:30:22 +08:00
this.index = ''
2025-08-08 10:03:19 +08:00
this.disabled = false
2025-08-07 09:18:45 +08:00
},
2025-08-22 14:05:56 +08:00
async _loading () {
2025-08-07 09:18:45 +08:00
this.disabled = true
2025-09-03 14:30:22 +08:00
if (!this.val1 || !this.val2 || !this.index) {
2025-08-07 09:18:45 +08:00
this.disabled = false
return
}
try {
2025-09-03 14:30:22 +08:00
let res = await loading(this.pointCode, this.val1, this.index, this.val2)
2025-08-07 09:18:45 +08:00
if (res.code === '200') {
uni.showToast({
2025-08-08 10:03:19 +08:00
title: res.message,
2025-08-07 09:18:45 +08:00
icon: 'none'
})
2025-08-08 10:03:19 +08:00
this.clearUp()
2025-08-07 09:18:45 +08:00
} else {
uni.showToast({
2025-08-08 10:03:19 +08:00
title: res.message,
2025-08-07 09:18:45 +08:00
icon: 'none'
})
2025-08-08 10:03:19 +08:00
this.disabled = false
2025-08-07 09:18:45 +08:00
}
} catch (e) {
this.disabled = false
}
}
}
}
2025-08-08 10:03:19 +08:00
</script>
<style lang="stylus">
</style>