作者 朱兆平

运单计重提交

@@ -141,6 +141,7 @@ @@ -141,6 +141,7 @@
141 <!-- <el-button type="primary" @click="saveSubmit()" :disabled="disabledStr">保存</el-button>--> 141 <!-- <el-button type="primary" @click="saveSubmit()" :disabled="disabledStr">保存</el-button>-->
142 <el-button type="primary" @click="saveSubmit()" :disabledStr="disabledStr" >保存</el-button> 142 <el-button type="primary" @click="saveSubmit()" :disabledStr="disabledStr" >保存</el-button>
143 </el-row> 143 </el-row>
  144 +
144 </el-form> 145 </el-form>
145 </el-row> 146 </el-row>
146 </section> 147 </section>
@@ -183,13 +184,14 @@ @@ -183,13 +184,14 @@
183 commonLoading: false, 184 commonLoading: false,
184 textarea: '', 185 textarea: '',
185 disabledStr: true, 186 disabledStr: true,
  187 + waybilllist:[],
186 addForm: { 188 addForm: {
187 // 备注 189 // 备注
188 remark3: '', 190 remark3: '',
189 // 业务类型 191 // 业务类型
190 - businesstype: '', 192 + businesstype: '进口提货',
191 // 车牌号 193 // 车牌号
192 - trailerFrameNo: '', 194 + trailerFrameNo: '苏H63D50',
193 //备案单位 195 //备案单位
194 trailerLicenseNo: '', 196 trailerLicenseNo: '',
195 // 主单列表 197 // 主单列表
@@ -336,35 +338,34 @@ @@ -336,35 +338,34 @@
336 }, 338 },
337 // 添加主单号到主单列表 339 // 添加主单号到主单列表
338 addWaybill: function(index, row){ 340 addWaybill: function(index, row){
339 - this.addForm.masterList += row.waybillnomaster+',' 341 + this.addForm.masterList += row.waybillnomaster + ',';
340 }, 342 },
341 - addweight(businesstype){  
342 - let _this = this;  
343 - let addweight = ""; 343 + addweight(){
  344 + var _this = this;
344 // 运单重量累加 345 // 运单重量累加
345 - this.addForm.masterList=this.addForm.masterList.substring(0,this.addForm.masterList.length-1);  
346 - var split = this.addForm.masterList.split(","); 346 + let lists =this.addForm.masterList.substring(0,this.addForm.masterList.length-1);
  347 + var split = lists.split(",");
347 split.forEach((item) =>{ 348 split.forEach((item) =>{
348 var url = "http://tjfx.15miaoo.com:8003/orig/orig"; 349 var url = "http://tjfx.15miaoo.com:8003/orig/orig";
349 var xhr = new XMLHttpRequest(); 350 var xhr = new XMLHttpRequest();
350 // 访问nginx中的代理服务器 351 // 访问nginx中的代理服务器
351 - xhr.open('get', url+'?waybill='+item+'&imp='+businesstype, true); 352 + xhr.open('get', url+'?waybill='+item+'&imp='+_this.getBusinesstype(), true);
352 xhr.send(); 353 xhr.send();
353 xhr.onreadystatechange = function(){ 354 xhr.onreadystatechange = function(){
354 if(xhr.readyState == 4){ 355 if(xhr.readyState == 4){
355 if(xhr.status ==200){ 356 if(xhr.status ==200){
356 var data = JSON.parse(xhr.responseText); 357 var data = JSON.parse(xhr.responseText);
357 data.forEach((itmeData => { 358 data.forEach((itmeData => {
358 - addweight += itmeData.manifesttotalweight+","; 359 + _this.addForm.remark += itmeData.manifesttotalweight+",";
359 })); 360 }));
360 } 361 }
361 } 362 }
362 } 363 }
363 }); 364 });
364 - return addweight; 365 + return _this.addForm.remark;
365 }, 366 },
366 addsubmit(){ 367 addsubmit(){
367 - let para = Object.assign({}, _this.addForm); 368 + let para = Object.assign({}, this.addForm);
368 save(para).then((res) => { 369 save(para).then((res) => {
369 if (res.data.code == 200){ 370 if (res.data.code == 200){
370 this.$message({ 371 this.$message({
@@ -380,27 +381,28 @@ @@ -380,27 +381,28 @@
380 } 381 }
381 }).catch(error => alert(error)); 382 }).catch(error => alert(error));
382 }, 383 },
  384 + getBusinesstype:function(){
  385 + let businesstype = this.addForm.businesstype;
  386 + if (businesstype == '进口提货'){
  387 + businesstype = 'I';
  388 + }else if (businesstype == '出口送货'){
  389 + businesstype = 'E';
  390 + }else if (businesstype == '分拨业务'){
  391 + businesstype = 'I';
  392 + }else if (businesstype == '调拨业务'){
  393 + businesstype = 'E';
  394 + }
  395 + return businesstype;
  396 + },
383 // 申请添加 397 // 申请添加
384 saveSubmit (){ 398 saveSubmit (){
385 let _this = this; 399 let _this = this;
386 this.$refs.addForm.validate((valid) => { 400 this.$refs.addForm.validate((valid) => {
387 if (valid) { 401 if (valid) {
388 this.$confirm('确认提交吗?', '提示', {}).then(() => { 402 this.$confirm('确认提交吗?', '提示', {}).then(() => {
389 - let businesstype = this.addForm.businesstype;  
390 - if (businesstype == '进口提货'){  
391 - businesstype = 'I';  
392 - }else if (businesstype == '出口送货'){  
393 - businesstype = 'E';  
394 - }else if (businesstype == '分拨业务'){  
395 - businesstype = 'I';  
396 - }else if (businesstype == '调拨业务'){  
397 - businesstype = 'E';  
398 - } 403 + let businesstype = _this.getBusinesstype();
399 if (this.addForm.masterList.indexOf(",") !== -1){ 404 if (this.addForm.masterList.indexOf(",") !== -1){
400 - _this.addForm.remark = _this.addweight(businesstype);  
401 - _this.nextTick(function(){  
402 _this.addsubmit(); 405 _this.addsubmit();
403 - });  
404 406
405 }else { 407 }else {
406 console.log("进入远程调用"); 408 console.log("进入远程调用");
@@ -436,6 +438,18 @@ @@ -436,6 +438,18 @@
436 }, 438 },
437 mounted() { 439 mounted() {
438 this.getYardList(); 440 this.getYardList();
  441 + },
  442 + computed: {
  443 + },
  444 + watch: {
  445 + 'addForm.masterList':{
  446 + handler: function() {
  447 + this.addForm.remark = "";
  448 + this.addForm.masterList = this.addForm.masterList.replaceAll(",",",");
  449 + console.log("运单列表变了"+this.addForm.masterList);
  450 + this.addweight();
  451 + },
  452 + }
439 } 453 }
440 } 454 }
441 </script> 455 </script>