<template>
|
<view class="example">
|
<u-tabs :list="list" :is-Scroll="false" :current="current2"></u-tabs>
|
<view v-show="current2===0">
|
<uni-section title="上料任务添加" type="line" padding style="height: calc(100vh - 100px);">
|
<uni-forms ref="form" :modelValue="baseFormData" :rules="formRules">
|
<uni-forms-item label="提升机下料口" label-width="120" required name="classes">
|
<uni-data-picker placeholder="请选择正负极箔材提升机下料口" popup-title="请选择正负极提升机下料口" :localdata="dataTree"
|
v-model="baseFormData.classes" @change="onchange">
|
</uni-data-picker>
|
</uni-forms-item>
|
<uni-forms-item label-width="120" label="物流线" name="sexs2" required>
|
<uni-data-checkbox v-model="baseFormData.sex2" :localdata="sexs2" @change="onchange" />
|
</uni-forms-item>
|
|
<uni-forms-item label="涂布上料缓存架条码" label-width="120" required name="HCJInput">
|
<uni-data-picker placeholder="请选择涂布上料缓存架条码" popup-title="请选择涂布上料缓存架条码" :localdata="HCJInputTree"
|
v-model="baseFormData.HCJInput">
|
</uni-data-picker>
|
</uni-forms-item>
|
|
</uni-forms>
|
<u-button type="success" size="default" shape="circle" :ripple="true" ripple-bg-color="#909399"
|
@click="submit()">
|
添加任务
|
</u-button>
|
</uni-section>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
baseFormData: {
|
HCJInput: '',
|
classes: '',
|
sex2: '1'
|
},
|
list: [{
|
name: '拆包间去涂布任务添加'
|
}],
|
sexs2: [{
|
text: '一线',
|
value: '1'
|
}, {
|
text: '二线',
|
value: '2'
|
}],
|
HCJInputTree: [],
|
dataTree: [{
|
text: '正极提升机下料口',
|
value: 'ZJSL-BCTSJSB001'
|
}, {
|
text: '负极提升机下料口',
|
value: 'FJSL-BCTSJSB001'
|
}],
|
formRules: {
|
classes: {
|
rules: [{
|
required: true,
|
errorMessage: ' 提升机下料口不能为空'
|
}]
|
},
|
HCJInput: {
|
rules: [{
|
required: true,
|
errorMessage: '涂布上料缓存架不能为空'
|
}]
|
}
|
},
|
current2: 0,
|
}
|
},
|
methods: {
|
onchange(){
|
let upcode = '';
|
if (this.baseFormData.classes.includes('ZJ') )
|
{
|
upcode = 'ZJSL-TBHCJ001';
|
|
}
|
else if(this.baseFormData.classes.includes('FJ') ){
|
upcode = 'FJSL-TBHCJ001'
|
|
}
|
let formDataParam = {
|
UpperCode: upcode,
|
Type: "TBHCJ",
|
LocationState: "LocationState_Empty",
|
RunLine:this.baseFormData.sex2
|
}
|
this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
|
|
if (res != undefined) {
|
this.HCJInputTree = res;
|
} else {
|
this.HCJInputTree=[];
|
this.$t.message.toast("暂无有货缓存架")
|
}
|
})
|
},
|
input(e) {
|
if (e.length === 13 && e.includes('TBHCJ')) {
|
let formDataParam = {
|
UpperCode: e,
|
Type:"TBHCJ",
|
LocationState: "LocationState_Empty",
|
RunLine:this.baseFormData.sex2
|
}
|
this.$u.post('/api/PDA/GetDynamicAsync', formDataParam).then(res => {
|
if (res != undefined) {
|
this.dataTree = res;
|
}else{
|
|
this.$t.message.toast("暂无有货缓存架")
|
}
|
})
|
}
|
},
|
submit() {
|
this.$refs.form.validate().then((res) => {
|
this.$t.message.loading()
|
let bz = this.baseFormData.HCJInput.split('-')[0];
|
let AgvCode = bz == "ZJSL" ? "正极1号AGV" : "负极1号AGV"
|
let formDataParam = {}
|
formDataParam = {
|
AgvCode: AgvCode,
|
AgvFromAddress:this.baseFormData.classes ,
|
AgvToAddress: this.baseFormData.HCJInput,
|
AgvBarcode: '',
|
AgvGrade: "1",
|
AgvTaskQty: '1',
|
AgvTaskState: "Create",
|
AgvTaskType: 'TaskType_Outbound',
|
AgvWorkType: '1',
|
AgvLine:this.baseFormData.sex2
|
}
|
this.$u.post('/api/PDA/CreatePDATask', formDataParam).then(res => {
|
this.$t.message.closeLoading()
|
console.log(res);
|
if (res.status) {
|
this.baseFormData.HCJInput = '';
|
this.baseFormData.classes= '';
|
|
this.baseFormData.sexQ2= '1';
|
this.$t.message.toast(res.message);
|
this.HCJInputTree=[];
|
// setTimeout(() => {
|
console.log(this.HCJInputTree)
|
// }, 100);
|
|
} else{this.baseFormData.HCJInput = '';
|
this.baseFormData.classes= '';
|
this.baseFormData.classesType='';
|
this.baseFormData.sexQ='ZJ';
|
this.baseFormData.sexQ2= '1';
|
this.HCJInputTree=[];
|
this.$t.message.toast(res.message)}
|
|
|
}).catch((err) => {
|
this.$t.message.toast(res.msg)
|
})
|
})
|
}
|
}
|
}
|
</script>
|
|
<style>
|
.example {
|
padding: 15px;
|
background-color: #fff;
|
}
|
</style>
|