This commit is contained in:
2025-09-03 14:30:22 +08:00
parent d9c3e9513e
commit b35a0da6d5
2 changed files with 41 additions and 18 deletions

View File

@@ -19,8 +19,16 @@
<view class="zd-col-7"> <view class="zd-col-7">
<span class="filter_label">物料</span> <span class="filter_label">物料</span>
</view> </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">
<view class="zd-col-7">
<span class="filter_label">用料数量</span>
</view>
<view class="zd-col-17"> <view class="zd-col-17">
<input type="text" class="filter_input" v-model="currentData.material_name" @tap="toJump"> <input type="number" class="filter_input" v-model="val3" disabled>
</view> </view>
</view> </view>
<view class="zd-row border-bottom"> <view class="zd-row border-bottom">
@@ -35,7 +43,7 @@
</view> </view>
<view class="zd-row submit-bar"> <view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="clearUp">清空</button> <button class="zd-col-6 button-default" @tap="clearUp">清空</button>
<button class="zd-col-16 button-primary" :class="{'button-info': !val1 || !val2}" :disabled="disabled" @tap="_loading">确认</button> <button class="zd-col-16 button-primary" :class="{'button-info': !val1 || !val2 || !index}" :disabled="disabled" @tap="_loading">确认</button>
</view> </view>
</view> </view>
</template> </template>
@@ -43,7 +51,7 @@
<script> <script>
import NavBar from '@/components/NavBar.vue' import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue' import SearchBox from '@/components/SearchBox.vue'
import {getRegionByPoint, loading} from '@/utils/getData4.js' import {getRegionByPoint, selectMaterialByRegion, loading} from '@/utils/getData4.js'
export default { export default {
components: { components: {
NavBar, NavBar,
@@ -54,8 +62,10 @@
title: '', title: '',
val1: '', val1: '',
val2: '1', val2: '1',
val3: '',
options: [],
index: '',
pointCode: '', pointCode: '',
currentData: {},
disabled: false disabled: false
}; };
}, },
@@ -65,13 +75,30 @@
created () { created () {
}, },
onShow() { onShow() {
if (this.$store.getters.publicObj !== '') {
this.currentData = this.$store.getters.publicObj
}
}, },
methods: { methods: {
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
},
handleChange1 (e) { handleChange1 (e) {
this._getRegionByPoint(e) if (e) {
this._getRegionByPoint(e)
this._selectMaterialByRegion()
}
}, },
async _getRegionByPoint (e) { async _getRegionByPoint (e) {
try { try {
@@ -84,25 +111,21 @@
this.val1 = '' this.val1 = ''
} }
}, },
toJump () {
uni.navigateTo({
url: '/pages/ftdl/mater-list0?title=查询物料'
})
},
clearUp () { clearUp () {
this.val1 = '' this.val1 = ''
this.val2 = '' this.val2 = ''
this.pointCode = '' this.pointCode = ''
this.index = ''
this.disabled = false this.disabled = false
}, },
async _loading () { async _loading () {
this.disabled = true this.disabled = true
if (!this.val1 || !this.val2) { if (!this.val1 || !this.val2 || !this.index) {
this.disabled = false this.disabled = false
return return
} }
try { try {
let res = await loading(this.pointCode, this.val1, this.currentData.material_code, this.val2) let res = await loading(this.pointCode, this.val1, this.index, this.val2)
if (res.code === '200') { if (res.code === '200') {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,

View File

@@ -30,9 +30,9 @@ export const getRegionByPoint = (pcode) => request({
data: {point_code: pcode} data: {point_code: pcode}
}) })
// 1.2查询物料信息 // 1.2查询物料信息
export const selectMaterials = (blurry) => request({ export const selectMaterialByRegion = (rcode) => request({
url:'api/hand/selectMaterials', url:'api/hand/selectMaterialByRegion',
data: {blurry: blurry} data: {region_code: rcode}
}) })
// 1.3叫料 // 1.3叫料
export const loading = (pcode, rcode, mcode, num) => request({ export const loading = (pcode, rcode, mcode, num) => request({