作者 朱兆平

运单计重提交

... ... @@ -141,6 +141,7 @@
<!-- <el-button type="primary" @click="saveSubmit()" :disabled="disabledStr">保存</el-button>-->
<el-button type="primary" @click="saveSubmit()" :disabledStr="disabledStr" >保存</el-button>
</el-row>
</el-form>
</el-row>
</section>
... ... @@ -183,13 +184,14 @@
commonLoading: false,
textarea: '',
disabledStr: true,
waybilllist:[],
addForm: {
// 备注
remark3: '',
// 业务类型
businesstype: '',
businesstype: '进口提货',
// 车牌号
trailerFrameNo: '',
trailerFrameNo: '苏H63D50',
//备案单位
trailerLicenseNo: '',
// 主单列表
... ... @@ -336,35 +338,34 @@
},
// 添加主单号到主单列表
addWaybill: function(index, row){
this.addForm.masterList += row.waybillnomaster+','
this.addForm.masterList += row.waybillnomaster + ',';
},
addweight(businesstype){
let _this = this;
let addweight = "";
addweight(){
var _this = this;
// 运单重量累加
this.addForm.masterList=this.addForm.masterList.substring(0,this.addForm.masterList.length-1);
var split = this.addForm.masterList.split(",");
let lists =this.addForm.masterList.substring(0,this.addForm.masterList.length-1);
var split = lists.split(",");
split.forEach((item) =>{
var url = "http://tjfx.15miaoo.com:8003/orig/orig";
var xhr = new XMLHttpRequest();
// 访问nginx中的代理服务器
xhr.open('get', url+'?waybill='+item+'&imp='+businesstype, true);
xhr.open('get', url+'?waybill='+item+'&imp='+_this.getBusinesstype(), true);
xhr.send();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
if(xhr.status ==200){
var data = JSON.parse(xhr.responseText);
data.forEach((itmeData => {
addweight += itmeData.manifesttotalweight+",";
_this.addForm.remark += itmeData.manifesttotalweight+",";
}));
}
}
}
});
return addweight;
return _this.addForm.remark;
},
addsubmit(){
let para = Object.assign({}, _this.addForm);
let para = Object.assign({}, this.addForm);
save(para).then((res) => {
if (res.data.code == 200){
this.$message({
... ... @@ -380,27 +381,28 @@
}
}).catch(error => alert(error));
},
getBusinesstype:function(){
let businesstype = this.addForm.businesstype;
if (businesstype == '进口提货'){
businesstype = 'I';
}else if (businesstype == '出口送货'){
businesstype = 'E';
}else if (businesstype == '分拨业务'){
businesstype = 'I';
}else if (businesstype == '调拨业务'){
businesstype = 'E';
}
return businesstype;
},
// 申请添加
saveSubmit (){
let _this = this;
this.$refs.addForm.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
let businesstype = this.addForm.businesstype;
if (businesstype == '进口提货'){
businesstype = 'I';
}else if (businesstype == '出口送货'){
businesstype = 'E';
}else if (businesstype == '分拨业务'){
businesstype = 'I';
}else if (businesstype == '调拨业务'){
businesstype = 'E';
}
let businesstype = _this.getBusinesstype();
if (this.addForm.masterList.indexOf(",") !== -1){
_this.addForm.remark = _this.addweight(businesstype);
_this.nextTick(function(){
_this.addsubmit();
});
}else {
console.log("进入远程调用");
... ... @@ -436,6 +438,18 @@
},
mounted() {
this.getYardList();
},
computed: {
},
watch: {
'addForm.masterList':{
handler: function() {
this.addForm.remark = "";
this.addForm.masterList = this.addForm.masterList.replaceAll(",",",");
console.log("运单列表变了"+this.addForm.masterList);
this.addweight();
},
}
}
}
</script>
... ...