2025-12-19 16:40:25 +08:00
|
|
|
<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">
|
2025-12-22 09:48:01 +08:00
|
|
|
<uni-easyinput type="text" v-model="destLocationCode" />
|
2025-12-19 16:40:25 +08:00
|
|
|
</uni-forms-item>
|
2025-12-22 09:48:01 +08:00
|
|
|
<uni-forms-item label="机器人类型:" :labelWidth='100' name="robotType">
|
|
|
|
|
<uni-data-select placeholder="请选择机器类型" v-model="formData.robotType" :localdata="RobotData" />
|
2025-12-19 16:40:25 +08:00
|
|
|
</uni-forms-item>
|
2025-12-22 09:48:01 +08:00
|
|
|
<uni-forms-item label="容器类型:" :labelWidth='100' name="ctnrTyp" v-if="formData.robotType == 2">
|
2025-12-19 16:40:25 +08:00
|
|
|
<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) {
|
2025-12-22 09:48:01 +08:00
|
|
|
const form = JSON.parse(option.formData);
|
|
|
|
|
this.formData.taskTyp = form.taskType;
|
|
|
|
|
this.formData.id = form.id;
|
|
|
|
|
this.formData.srcLocationCode = form.srcLocationCode;
|
|
|
|
|
this.destLocationCode = form.destLocationCode;
|
2025-12-19 16:40:25 +08:00
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2025-12-22 09:48:01 +08:00
|
|
|
formData: {
|
|
|
|
|
id: null,
|
|
|
|
|
srcLocationCode: null,
|
|
|
|
|
taskTyp: null,
|
|
|
|
|
robotType: null,
|
|
|
|
|
ctnrTyp: null,
|
|
|
|
|
},
|
|
|
|
|
destLocationCode: null,
|
2025-12-19 16:40:25 +08:00
|
|
|
RobotData: [
|
|
|
|
|
{ value: RobotType.LATENT_MOBILE_ROBOT, text: "潜伏车" },
|
|
|
|
|
{ value: RobotType.LATENT_FORKLIFT_AGV, text: "潜伏叉车" },
|
|
|
|
|
],
|
|
|
|
|
/** 校验规则 */
|
|
|
|
|
rules: {
|
|
|
|
|
srcLocationCode: {
|
|
|
|
|
rules: [{
|
|
|
|
|
required: true,
|
|
|
|
|
errorMessage: '请输入发货点位',
|
|
|
|
|
}, ]
|
|
|
|
|
},
|
|
|
|
|
RobotType: {
|
|
|
|
|
rules: [{
|
|
|
|
|
required: true,
|
|
|
|
|
errorMessage: '请选择机器人类型',
|
|
|
|
|
}, ]
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleDelivery() {
|
|
|
|
|
const _this = this;
|
|
|
|
|
this.$refs.form.validate().then(res => {
|
2025-12-22 09:48:01 +08:00
|
|
|
if (_this.formData.srcLocationCode && this.formData.robotType) {
|
2025-12-19 16:40:25 +08:00
|
|
|
_this.$modal.loading('提交中')
|
|
|
|
|
delivery(_this.formData).then(res => {
|
|
|
|
|
_this.$modal.closeLoading();
|
|
|
|
|
_this.$modal.msgSuccess("提交成功!");
|
|
|
|
|
_this.reset();
|
|
|
|
|
setTimeout(() => {
|
2025-12-22 09:48:01 +08:00
|
|
|
this.$tab.switchTab("/pages/work/index");
|
2025-12-19 16:40:25 +08:00
|
|
|
}, 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(() => {
|
2025-12-22 09:48:01 +08:00
|
|
|
this.$tab.switchTab("/pages/work/index");
|
2025-12-19 16:40:25 +08:00
|
|
|
}, 500);
|
|
|
|
|
})
|
|
|
|
|
} else if (res.cancel) {
|
|
|
|
|
console.log('用户点击取消');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
},
|
2025-12-22 09:48:01 +08:00
|
|
|
reset() {
|
|
|
|
|
this.formData = {
|
|
|
|
|
id: null,
|
|
|
|
|
srcLocationCode: null,
|
|
|
|
|
taskTyp: null,
|
|
|
|
|
robotType: null,
|
|
|
|
|
ctnrTyp: null,
|
|
|
|
|
};
|
|
|
|
|
this.destLocationCode = null;
|
|
|
|
|
}
|
2025-12-19 16:40:25 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|