96 lines
2.4 KiB
Vue
96 lines
2.4 KiB
Vue
<template>
|
|
<view>
|
|
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
|
<uni-forms-item label="发货点位:" :labelWidth='90' name="srcLocationCode">
|
|
<uni-easyinput type="text" v-model="formData.srcLocationCode" />
|
|
</uni-forms-item>
|
|
<uni-forms-item label="目的货位:" :labelWidth='90' name="destLocationCode">
|
|
<uni-easyinput suffixIcon="scan" @iconClick="scanDestLocationUuid" type="text" @blur="searchSrcLocation"
|
|
v-model="formData.destLocationCode" />
|
|
</uni-forms-item>
|
|
</uni-forms>
|
|
<uni-row :gutter="10">
|
|
<uni-col>
|
|
<u-button type="success" @click="handleCall">呼叫</u-button>
|
|
</uni-col>
|
|
</uni-row>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { addDeliveryTask, findPreparation } from "@/api/les/lesMaterialCall.js";
|
|
import LesDeliveryTaskType from "@/utils/enums/LesDeliveryTaskType";
|
|
export default {
|
|
data() {
|
|
return {
|
|
formData: {
|
|
taskType: LesDeliveryTaskType.PRODUCTION
|
|
},
|
|
/** 校验规则 */
|
|
rules: {
|
|
srcLocationCode: {
|
|
rules: [{
|
|
required: true,
|
|
errorMessage: '请输入发货点位',
|
|
}, ]
|
|
},
|
|
destLocationCode: {
|
|
rules: [{
|
|
required: true,
|
|
errorMessage: '请选择目的货位',
|
|
}, ]
|
|
},
|
|
},
|
|
}
|
|
},
|
|
methods: {
|
|
searchSrcLocation() {
|
|
const _this = this;
|
|
if (_this.formData.destLocationCode == '') {
|
|
return;
|
|
}
|
|
findPreparation(_this.formData.destLocationCode).then(res => {
|
|
if (res.code == 200) {
|
|
this.$set(this.formData, "srcLocationCode", res.data);
|
|
} else {
|
|
this.$modal.showToast("未找到对应发货点位")
|
|
}
|
|
})
|
|
},
|
|
|
|
scanDestLocationUuid() {
|
|
const _this = this;
|
|
uni.scanCode({
|
|
scanType: ['qrCode', 'barCode'],
|
|
success: function(res) {
|
|
_this.formData.destLocationCode = res.result;
|
|
_this.searchSrcLocation();
|
|
}
|
|
});
|
|
},
|
|
handleCall() {
|
|
const _this = this;
|
|
this.$refs.form.validate().then(res => {
|
|
if (_this.formData.srcLocationCode && _this.formData.destLocationCode) {
|
|
_this.$modal.loading('提交中')
|
|
addDeliveryTask(_this.formData).then(res => {
|
|
_this.$modal.closeLoading();
|
|
_this.$modal.msgSuccess("提交成功!");
|
|
setTimeout(() => {
|
|
_this.$tab.switchTab("/pages/work/index");
|
|
}, 500);
|
|
})
|
|
} else {
|
|
_this.$modal.msg("请将信息补充完整")
|
|
}
|
|
})
|
|
},
|
|
|
|
// reset() {
|
|
// const _this = this;
|
|
// this.formData.srcLocationCode = '';
|
|
// this.formData.destLocationCode = '';
|
|
// }
|
|
}
|
|
}
|
|
</script> |