Browse Source

feat: add 数量验证,接口返回判断

master
TengXF 7 months ago
parent
commit
735a1ea33c
  1. 2
      src/api/mes/workScheduling/index.ts
  2. 20
      src/pages/mes/workScheduling/addBasicItem/index.vue
  3. 3
      src/pages/mes/workScheduling/workScheduling.vue

2
src/api/mes/workScheduling/index.ts

@ -105,7 +105,7 @@ export function callBasicItemForm(params) {
//领料 //领料
export function receiveBasicItem(data) { export function receiveBasicItem(data) {
return http.post('/mes/', data) return http.post('/mes/item-request-main/receiveBasicItem', data)
} }
//补料 //补料

20
src/pages/mes/workScheduling/addBasicItem/index.vue

@ -32,7 +32,7 @@
</view> </view>
<view class="dec" style="font-weight: bold;"> <view class="dec" style="font-weight: bold;">
<view >补料数量</view> <view >补料数量</view>
<view > <u-input v-model="item.srcMaterialCounts" type="number" placeholder="补料数量" border="true" clearable="true" style="width: 100px;" /> <view > <u-input v-model="item.srcMaterialCounts" type="number" placeholder="补料数量" border="true" clearable="true" style="width: 100px;" @update:modelValue="calculatePass(item,queryForm.planCount)" />
</view> </view>
</view> </view>
<view class="dec"> <view class="dec">
@ -112,6 +112,24 @@
} }
} }
function calculatePass(item,planCount){
const count = item.repMaterialCounts * planCount
if(item.srcMaterialCounts > count){
proxy.$modal.showToast('数量不能超过最大物料数')
setTimeout(() => {
item.srcMaterialCounts=count
proxy.$modal.closeLoading()
}, 500)
}
if(item.srcMaterialCounts <= 0 ){
proxy.$modal.showToast('数量必须大于0')
setTimeout(() => {
item.srcMaterialCounts=1
proxy.$modal.closeLoading()
}, 500)
}
}
// //
function handleSubmit(){ function handleSubmit(){
saveData.value.planDayCode = queryForm.value.planNoDay saveData.value.planDayCode = queryForm.value.planNoDay

3
src/pages/mes/workScheduling/workScheduling.vue

@ -409,12 +409,13 @@ function finished(item) {
function submitFinish(item){ function submitFinish(item){
workSchedulingListApi.completeHandle(item).then((res) => { workSchedulingListApi.completeHandle(item).then((res) => {
proxy.$modal.closeLoading() proxy.$modal.closeLoading()
if (res.data) { if (res.code == 0) {
proxy.$modal.showToast('成功') proxy.$modal.showToast('成功')
list.value = [] list.value = []
status.value = 'loadmore' status.value = 'loadmore'
tabParams.value.pageNo = 1 tabParams.value.pageNo = 1
getTabsList() getTabsList()
} else { } else {
proxy.$modal.showToast('失败') proxy.$modal.showToast('失败')
} }

Loading…
Cancel
Save