115 lines
3.2 KiB
Vue
115 lines
3.2 KiB
Vue
|
|
<template>
|
||
|
|
<view>
|
||
|
|
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||
|
|
<uni-forms-item label="发货点位:" :labelWidth='100' name="srcLocationCode">
|
||
|
|
<uni-easyinput type="text" v-model="formData.srcLocationCode" />
|
||
|
|
</uni-forms-item>
|
||
|
|
<uni-forms-item label="目的点位:" :labelWidth='100' name="destLocationCode">
|
||
|
|
<uni-easyinput type="text" v-model="formData.destLocationCode" />
|
||
|
|
</uni-forms-item>
|
||
|
|
<uni-forms-item label="机器人类型:" :labelWidth='100' name="RobotType">
|
||
|
|
<uni-data-select placeholder="请选择机器类型" v-model="formData.RobotType" :localdata="RobotData" />
|
||
|
|
</uni-forms-item>
|
||
|
|
<uni-forms-item label="容器类型:" :labelWidth='100' name="ctnrTyp" v-if="formData.RobotType == 2">
|
||
|
|
<uni-easyinput type="text" v-model="formData.ctnrTyp" />
|
||
|
|
</uni-forms-item>
|
||
|
|
</uni-forms>
|
||
|
|
<uni-row :gutter="10">
|
||
|
|
<uni-col :span="12">
|
||
|
|
<u-button type="success" @click="handleDelivery">配送</u-button>
|
||
|
|
</uni-col>
|
||
|
|
<uni-col :span="12">
|
||
|
|
<u-button type="primary" @click="handleCancle">取消</u-button>
|
||
|
|
</uni-col>
|
||
|
|
</uni-row>
|
||
|
|
</view>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import RobotType from "@/utils/enums/RobotType";
|
||
|
|
import { delivery, cancel } from "@/api/les/lesMaterialDelivery.js"
|
||
|
|
export default {
|
||
|
|
onLoad(option) {
|
||
|
|
this.formData = JSON.parse(option.formData);
|
||
|
|
},
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
formData: {},
|
||
|
|
RobotData: [
|
||
|
|
{ value: RobotType.LATENT_MOBILE_ROBOT, text: "潜伏车" },
|
||
|
|
{ value: RobotType.LATENT_FORKLIFT_AGV, text: "潜伏叉车" },
|
||
|
|
],
|
||
|
|
/** 校验规则 */
|
||
|
|
rules: {
|
||
|
|
srcLocationCode: {
|
||
|
|
rules: [{
|
||
|
|
required: true,
|
||
|
|
errorMessage: '请输入发货点位',
|
||
|
|
}, ]
|
||
|
|
},
|
||
|
|
destLocationCode: {
|
||
|
|
rules: [{
|
||
|
|
required: true,
|
||
|
|
errorMessage: '请输入目的货位',
|
||
|
|
}, ]
|
||
|
|
},
|
||
|
|
RobotType: {
|
||
|
|
rules: [{
|
||
|
|
required: true,
|
||
|
|
errorMessage: '请选择机器人类型',
|
||
|
|
}, ]
|
||
|
|
},
|
||
|
|
},
|
||
|
|
}
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
handleDelivery() {
|
||
|
|
const _this = this;
|
||
|
|
this.$refs.form.validate().then(res => {
|
||
|
|
if (_this.formData.srcLocationCode && _this.formData.destLocationCode) {
|
||
|
|
_this.$modal.loading('提交中')
|
||
|
|
delivery(_this.formData).then(res => {
|
||
|
|
_this.$modal.closeLoading();
|
||
|
|
_this.$modal.msgSuccess("提交成功!");
|
||
|
|
_this.reset();
|
||
|
|
setTimeout(() => {
|
||
|
|
this.$tab.switchTab("/pages/les/chooseTask");
|
||
|
|
}, 500);
|
||
|
|
})
|
||
|
|
} else {
|
||
|
|
_this.$modal.msg("请将信息补充完整")
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
handleCancle() {
|
||
|
|
const _this = this;
|
||
|
|
const arr = [];
|
||
|
|
arr.push(_this.formData.id);
|
||
|
|
this.$refs.form.validate().then(res => {
|
||
|
|
uni.showModal({
|
||
|
|
title: '提示',
|
||
|
|
content: '您确定取消该任务吗?',
|
||
|
|
success: function(res) {
|
||
|
|
if (res.confirm) {
|
||
|
|
_this.$modal.loading('取消中')
|
||
|
|
cancel(arr).then(res => {
|
||
|
|
_this.$modal.closeLoading();
|
||
|
|
_this.$modal.msgSuccess("取消成功!");
|
||
|
|
_this.reset();
|
||
|
|
setTimeout(() => {
|
||
|
|
this.$tab.switchTab("/pages/les/chooseTask");
|
||
|
|
}, 500);
|
||
|
|
})
|
||
|
|
} else if (res.cancel) {
|
||
|
|
console.log('用户点击取消');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
})
|
||
|
|
},
|
||
|
|
// reset() {
|
||
|
|
// this.formData = {};
|
||
|
|
// }
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|