<template>
|
<div class="forklifttasksEdit height overflow">
|
<div class="centent-form overflowy-auto">
|
<el-form
|
class="margin-auto width90"
|
ref="registerForm"
|
:model="registerForm"
|
size="mini"
|
:rules="rules"
|
label-position="left"
|
label-width="100px"
|
>
|
<el-form-item label="任务编号:" prop="carTaskName">
|
<el-input disabled v-model="registerForm.carTaskName" clearable></el-input>
|
</el-form-item>
|
<el-form-item label="目的地:" prop="toDestination">
|
<!-- <el-input v-model="registerForm.toDestination" clearable></el-input> -->
|
<el-select v-model="registerForm.toDestination" filterable clearable placeholder="请选择">
|
<el-option
|
v-for="(item, index) in toDestinationList"
|
:key="index + 'toDestination'"
|
:label="item.productionName"
|
:value="item.productionName"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
|
<el-form-item label="取货地:" prop="fromDestination">
|
<!-- <el-input v-model="registerForm.fromDestination" clearable></el-input> -->
|
<el-select v-model="registerForm.fromDestination" filterable clearable placeholder="请选择">
|
<el-option
|
v-for="(item, index) in fromDestinationist"
|
:key="index + 'toDestination'"
|
:label="item.productionName"
|
:value="item.productionName"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
|
<el-form-item label="器具编号:" prop="containerName">
|
<!-- <el-input v-model="registerForm.containerName" clearable></el-input> -->
|
<el-select v-model="registerForm.containerName" filterable clearable placeholder="请选择">
|
<el-option
|
v-for="(item, index) in containerNameList"
|
:key="index + 'containerName'"
|
:label="item.containerName"
|
:value="item.containerName"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
|
<el-form-item label="订单状态:" prop="taskStatus">
|
<!-- <el-input v-model="registerForm.containerName" clearable></el-input> -->
|
<el-select v-model="registerForm.taskStatus" filterable clearable placeholder="请选择">
|
<el-option
|
v-for="(item,index) in orderstatusList"
|
:key="index + 'taskStatus'"
|
:label="item.label"
|
:value="item.label"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div class="forklifttasksEdit-button text-right margin-right15 margin-top2">
|
<el-button
|
type="primary"
|
size="mini"
|
class="form-buttom"
|
:loading="savloading"
|
@click="submitForm('registerForm')"
|
>提交</el-button
|
>
|
<el-button type="primary" size="mini" class="form-buttom" @click="$emit('cancel')">取消</el-button>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { CarTaskAddOrUpdate, CarTaskGetCode } from '@/api/forklifttasks';
|
import { ContainerSearch } from '@/api/palte';
|
import { ProductionLineSearch } from '@/api/cass-line';
|
import { getCache } from '@/utils/sessionStorage';
|
export default {
|
data() {
|
return {
|
registerForm: {
|
carTaskName: '',
|
toDestination: '',
|
fromDestination: '',
|
containerName: ''
|
},
|
toDestinationList: [],
|
fromDestinationist: [],
|
containerNameList: [],
|
disabled: false,
|
orderstatusList: [
|
{
|
label: '新建',
|
value: 0
|
},
|
{
|
label: '任务执行中',
|
value: 1
|
},
|
{
|
label: '完成',
|
value: 2
|
}
|
],
|
statusList: [
|
{
|
label: 0,
|
value: 0
|
},
|
{
|
label: 1,
|
value: 1
|
}
|
],
|
enableList: [
|
{
|
label: '启用',
|
value: 1
|
},
|
{
|
label: '禁用',
|
value: 0
|
}
|
],
|
createLineList: [],
|
|
rules: {
|
carTaskName: { required: true, message: '请输入任务编号', trigger: 'change' },
|
//toDestination: { required: true, message: '请输入目的地', trigger: 'change' },
|
fromDestination: { required: true, message: '请输入取货地', trigger: 'change' },
|
containerName: { required: true, message: '请选择器具编号', trigger: 'change' },
|
taskStatus: { required: true, message: '请选择订单状态', trigger: 'change' },
|
},
|
savloading: false
|
};
|
},
|
props: {
|
rowitem: {
|
type: Object,
|
default: {}
|
}
|
},
|
mounted() {
|
if (JSON.stringify(this.rowitem) != '{}') {
|
this.registerForm = this.rowitem;
|
this.disabled = true;
|
} else {
|
this.disabled = false;
|
this.CarTaskGetCode();
|
}
|
this.ContainerSearch();
|
this.ProductionLineSearch();
|
this.ProductSearch();
|
},
|
methods: {
|
//器具
|
ContainerSearch() {
|
ContainerSearch('1&onePageNum=999').then(res => {
|
if (res.code == 0) {
|
let data = res.data || [];
|
this.containerNameList = data;
|
}
|
});
|
},
|
//目的地
|
ProductionLineSearch() {
|
ProductionLineSearch('1&onePageNum=999', { isDestination: 1 }).then(res => {
|
if (res.code == 0) {
|
this.toDestinationList = res.data || [];
|
}
|
});
|
},
|
//取货地
|
ProductSearch() {
|
ProductionLineSearch('1&onePageNum=999', { isDestination: 0 }).then(res => {
|
if (res.code == 0) {
|
this.fromDestinationist = res.data || [];
|
}
|
});
|
},
|
//叉车任务编号
|
CarTaskGetCode() {
|
CarTaskGetCode().then(res => {
|
this.registerForm.carTaskName = res;
|
});
|
},
|
submitForm(registerForm) {
|
console.log(this.registerForm);
|
this.$refs[registerForm].validate(valid => {
|
if (valid) {
|
this.registerForm.userName = getCache('userInfo').userName;
|
this.savloading = true;
|
CarTaskAddOrUpdate(this.registerForm).then(res => {
|
if (res.code == 0) {
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
});
|
this.$emit('addsubmit');
|
} else {
|
this.$message({
|
type: 'warning',
|
message: '提交失败'
|
});
|
}
|
this.savloading = false;
|
});
|
} else {
|
}
|
});
|
}
|
},
|
watch: {}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.forklifttasksEdit {
|
width: 98%;
|
padding: 1%;
|
.show-pwd {
|
position: absolute;
|
right: 10px;
|
top: 3px;
|
font-size: 16px;
|
color: #889aa4;
|
cursor: pointer;
|
user-select: none;
|
}
|
.centent-form {
|
height: 92%;
|
width: 100%;
|
margin: auto;
|
}
|
.forklifttasksEdit-button {
|
}
|
::v-deep .el-form-item__content {
|
width: 60%;
|
}
|
::v-deep .el-select {
|
width: 100%;
|
}
|
}
|
</style>
|