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

175 lines
4.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">
2025-09-26 15:22:04 +08:00
<!-- <span class="filter_label">区域</span> -->
<span class="filter_label">{{$t('filter.area')}}</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-09-26 15:22:04 +08:00
<!-- <span class="filter_label">物料</span> -->
<span class="filter_label">{{$t('filter.material')}}</span>
2025-08-07 09:18:45 +08:00
</view>
2025-10-13 14:15:47 +08:00
<view class="zd-col-17">
<input type="text" class="filter_input" v-model="currentData.material_name" @tap="toJump">
2025-09-03 14:30:22 +08:00
</view>
</view>
<view class="zd-row border-bottom">
2025-10-13 14:15:47 +08:00
<view class="zd-col-10">
2025-09-26 15:22:04 +08:00
<!-- <span class="filter_label">用料数量</span> -->
<span class="filter_label">{{$t('filter.material-use-number')}}</span>
2025-09-03 14:30:22 +08:00
</view>
2025-10-13 14:15:47 +08:00
<view class="zd-col-14">
2025-09-15 08:50:44 +08:00
<input type="number" v-model="val3" class="filter_input">
2025-08-07 09:18:45 +08:00
</view>
2025-09-15 08:50:44 +08:00
<view class="zd-col-2"><span class="filter_unit">{{unit}}</span></view>
2025-08-07 09:18:45 +08:00
</view>
2025-08-08 10:03:19 +08:00
<view class="zd-row border-bottom">
2025-09-26 15:22:04 +08:00
<view class="zd-col-10">
<!-- <span class="filter_label">叫料托盘数</span> -->
<span class="filter_label">{{$t('filter.callmater-pallet-number')}}</span>
2025-08-08 10:03:19 +08:00
</view>
2025-09-26 15:22:04 +08:00
<view class="zd-col-14">
2025-08-08 10:03:19 +08:00
<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-09-26 15:22:04 +08:00
<!-- <button class="zd-col-6 button-default" @tap="clearUp">清空</button>
2025-10-13 14:15:47 +08:00
<button class="zd-col-16 button-primary" :class="{'button-info': !val1 || !val2}" :disabled="disabled" @tap="_loading">确认</button> -->
2025-09-26 15:22:04 +08:00
<button class="zd-col-8 button-default" @tap="clearUp">{{$t('button.clear')}}</button>
2025-10-13 14:15:47 +08:00
<button class="zd-col-14 button-primary" :class="{'button-info': !val1 || !val2}" :disabled="disabled" @tap="_loading">{{$t('button.confirm')}}</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: '',
2025-09-15 08:50:44 +08:00
unit: '',
2025-10-13 14:15:47 +08:00
currentData: {},
2025-09-03 14:30:22 +08:00
options: [],
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-10-13 14:15:47 +08:00
if (this.$store.getters.publicObj !== '') {
this.currentData = this.$store.getters.publicObj
this.$store.dispatch('setPublicObj', '')
}
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 = []
}
},
2025-10-13 14:15:47 +08:00
toJump () {
uni.navigateTo({
url: '/pages/ftdl/mater-list-cxjl?title=查询物料'
})
2025-09-03 14:30:22 +08:00
},
2025-10-13 14:15:47 +08:00
// selectChange (e) {
// this.index = e
// let selobj = this.options.find(item => item.value === this.index)
// this.val3 = selobj.qty
// this.unit = selobj.measure_unit_id
// },
2025-08-08 10:03:19 +08:00
handleChange1 (e) {
2025-09-03 14:30:22 +08:00
if (e) {
this._getRegionByPoint(e)
2025-09-17 13:18:40 +08:00
} else {
uni.showToast({
title: 'scan',
icon: 'none'
})
2025-09-03 14:30:22 +08:00
}
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-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-10-13 14:15:47 +08:00
if (!this.val1 || !this.val2) {
2025-08-07 09:18:45 +08:00
this.disabled = false
return
}
try {
2025-10-13 14:15:47 +08:00
let res = await loading(this.pointCode, this.val1, this.currentData.material_code, 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>