Page6.vue 27.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908
<template>
	<section>
<!--		工具条-->
		<el-row class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true"  ref="form" :model="filters">
				<el-row>
					<el-col :span="5">
						<el-form-item label="车牌号:">
							<el-input v-model="filters.trailerFrameNo" placeholder=""></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="5">
						<el-form-item label="挂靠名称:">
							<el-input v-model="filters.agentname" placeholder=""></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="5">
						<el-form-item label="目的场站:">
							<el-select v-model="filters.endstation" @change="aisleOption(filters.endstation)" clearable placeholder="请选择">
								<el-option
										v-for="item in options"
										:key="item.stationId"
										:label="item.name"
										:value="item.stationId">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="5">
						<el-form-item label="卡口:" style="margin-left: 10px">
							<el-select v-model="filters.aisle" :disabled="disabled" placeholder="先选择目的场站">
								<el-option
										v-for="item in aisleOptions"
										:key="item.channel"
										:label="item.name"
										:value="item.channel">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="5">
						<el-form-item label="失效状态" style="margin-left: 10px">
							<el-select v-model="filters.isValid">
								<el-option
										v-for="item in isValidOptions"
										:key="item.value"
										:label="item.label"
										:value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="2">
						<el-form-item>
							<el-button type="warning" style="width:150px" size="medium" icon="el-icon-plus" @click="getList(1)">查询</el-button>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
		</el-row>
<!--		列表-->
		<el-row>
			<el-table
					:data="businesstypeList"
					border
					v-loading="businesstypeListLoading"
					:header-cell-style="{background:'#6F8294',color:'#FFFFFF'}"
					style="border-radius: 10px 10px 0px 0px;line-height: 25px;" size="small">
				<el-table-column fixed prop="date" label="操作">
					<template slot-scope="scope">
						<el-button @click="selectOne(scope.$index, scope.row)" type="warning" size="small">查看</el-button>
					</template>
				</el-table-column>
				<el-table-column prop="isvalid" :formatter="isvalidFormatter" label="是否失效">
				</el-table-column>
				<el-table-column prop="trailerFrameNo" label="车牌号" width="90">
				</el-table-column>
				<el-table-column prop="agentname" label="挂靠单位">
				</el-table-column>
				<el-table-column prop="endstation" :formatter="endstationName" label="目的场站" width="90">
				</el-table-column>
				<el-table-column prop="aisle" :formatter="aisleName" label="卡口" width="100">
				</el-table-column>
				<el-table-column prop="aislewt" label="地磅称重">
				</el-table-column>
				<el-table-column prop="remark" label="总货重">
				</el-table-column>
				<el-table-column prop="remark1" label="进出差值">
				</el-table-column>
				<el-table-column prop="remark2" label="备案车重">
				</el-table-column>
				<el-table-column prop="businesstype" label="业务类型">
				</el-table-column>
				<el-table-column prop="cocode" label="货物类型">
				</el-table-column>
				<el-table-column prop="barcode" label="二维码编号" width="100">
				</el-table-column>
				<el-table-column prop="turnoverflag" :formatter="turnoverflagFormatter" label="进出场站">
				</el-table-column>
				<el-table-column prop="contrastflag" label="已进已出">
				</el-table-column>
				<el-table-column prop="updateDate" label="更新时间" width="155">
				</el-table-column>
				<el-table-column fixed="right" label="操作" width="245">
					<template slot-scope="scope">
						<el-button type="primary" @click="opneEdit(scope.$index, scope.row)" size="mini">修改</el-button>
<!--						<el-button type="danger" @click="deleteClick(scope.$index, scope.row)" size="mini">删除</el-button>-->
<!--						<el-button type="warning" disabled size="mini" style="margin-top: 2px;margin-left: 0px">审核</el-button>-->
						<el-button type="danger" @click="barCodeDelete(scope.$index, scope.row)"  size="mini">异常</el-button>
						<el-button type="info" @click="forwarderDelete(scope.$index, scope.row)"  size="mini">取消申请</el-button>
					</template>
				</el-table-column>
			</el-table>
		</el-row>
		<!--		分页-->
		<div class="block">
			<el-pagination
					@size-change="handleSizeChange"
					@current-change="handleCurrentChange"
					:current-page="pageSize"
					:page-sizes="[10, 100, 200, 300]"
					:page-size="10"
					layout="total, sizes, prev, pager, next, jumper"
					:total="this.total">
			</el-pagination>
		</div>
		<!--        编辑表单信息-->
		<el-dialog title="编辑" :visible.sync="editFormVisible" width="80%"  height="80%"   :close-on-click-modal="false">
			<!--        工具条-->
			<el-row class="toolbar" style="padding-bottom: 0px;">
				<el-form :inline="true" ref="filtersForm" :model="filtersForm" :rules="rules" >
					<el-row>
						<el-col :span="8">
							<el-form-item label="主单号:" prop="waybill">
								<el-input v-model="filtersForm.waybill" placeholder="" size="small" style="width: 240px"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item>
								<el-button type="warning" style="width:150px" size="medium" icon="el-icon-plus" @click="getWaybillList()">查询</el-button>
								<span style="color: red;margin-left: 10px">查询单号前请先选定业务类型</span>
							</el-form-item>
						</el-col>
					</el-row>
				</el-form>
			</el-row>
			<!--        列表-->
			<el-row>
				<el-table :data="awbaList" v-loading="commonLoading"
						  :header-cell-style="{background:'#6F8294',color:'#FFFFFF'}"
						  style="border-radius: 10px 10px 0px 0px;line-height: 25px;" size="small">
					<el-table-column fixed  label="操作">
						<template slot-scope="scope">
							<el-button @click="addWaybill(scope.$index, scope.row)" type="primary" size="small">添加</el-button>
						</template>
					</el-table-column>
					<el-table-column prop="flightno"  label="航班号">
						<template slot-scope="scope">
							<span v-if="scope.row.flightno.length > 4" >{{scope.row.flightno}}</span>
							<span v-else>{{scope.row.carrier}}{{scope.row.flightno}}</span>
						</template>
					</el-table-column>
					<el-table-column prop="flightDate"  label="航班日期">
						<template slot-scope="scope">
							<span v-if="scope.row.flightDate !=null">{{scope.row.flightDate | formatDate}}</span>
							<span v-else>{{scope.row.flightdate | formatDate}}</span>
						</template>
					</el-table-column>
					<el-table-column prop="segment" label="航段">
						<template slot-scope="scope">
							<span v-if="scope.row.segment != null" >{{scope.row.segment}}</span>
							<span v-else>{{scope.row.originatingstation}}-{{scope.row.destinationstation}}</span>
						</template>
					</el-table-column>
					<el-table-column prop="waybillnomaster" label="主单号">
					</el-table-column>
					<el-table-column prop="totalpiece" label="件数">
					</el-table-column>
					<el-table-column prop="totalweight" label="重量">
					</el-table-column>
					<el-table-column prop="customscode" label="关区">
					</el-table-column>
					<el-table-column prop="createdate" :formatter="formatDate" label="时间">
					</el-table-column>
					<el-table-column prop="receiptinformation" label="回执内容" width="280px">
					</el-table-column>
				</el-table>
			</el-row>
			<el-form ref="editForm" :model="editForm" label-width="50%" style="margin-top: 20px">
				<el-row>
					<el-col :span="10">
						<el-row>
							<el-form-item label="输入备注:">
								<el-input
										type="text"
										v-model="editForm.remark3"
										maxlength="10"
										show-word-limit>
								</el-input>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="车牌号码:" prop="trailerFrameNo">
								<el-input v-model="editForm.trailerFrameNo" disabled placeholder="请输入车牌号"></el-input>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="货物类型:" prop="cocode">
								<el-select v-model="editForm.cocode" placeholder="请选择">
									<el-option label="转关货" value="转关货"></el-option>
									<el-option label="换单货" value="换单货"></el-option>
									<el-option label="普通货" value="普通货"></el-option>
									<el-option label="退库货" value="退库货"></el-option>
									<el-option label="查验货" value="查验货"></el-option>
								</el-select>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="场站选择:" prop="endstation">
								<el-select v-model="editForm.endstation" disabled   placeholder="请选择">
									<el-option
											v-for="item in options"
											:key="item.stationId"
											:label="item.name"
											:value="item.stationId">
									</el-option>
								</el-select>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="运输公司:">
								<el-input v-model="editForm.agentno" placeholder=""></el-input>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="挂靠单位:">
								<el-input v-model="editForm.agentname" placeholder=""></el-input>
							</el-form-item>
						</el-row>
					</el-col>
					<el-col :span="10">
						<el-row>
							<el-form-item label="业务类型:" prop="businesstype">
								<el-select v-model="editForm.businesstype" clearable placeholder="请选择">
									<el-option label="进口提货" value="进口提货"></el-option>
									<el-option label="出口送货" value="出口送货"></el-option>
									<el-option label="分拨业务" value="分拨业务"></el-option>
									<el-option label="调拨业务" value="调拨业务"></el-option>
								</el-select>
							</el-form-item>

						</el-row>
						<el-row>
							<el-form-item label="申请单位:">
								<el-input v-model="editForm.veProperty" disabled></el-input>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="备案单位:">
								<el-input v-model="editForm.trailerLicenseNo" disabled></el-input>
							</el-form-item>

						</el-row>
						<el-row>
							<el-form-item label="主单列表:">
								<el-input
										type="textarea"
										:rows="4"
										placeholder="请输入主单号,例如17212341234,多个单号以‘,’(英文)分割"
										v-model="editForm.masterList">
								</el-input>
							</el-form-item>
						</el-row>
					</el-col>
				</el-row>
				<el-row style="text-align: center;margin-top: 20px">
					<el-button type="primary"  style="width:150px" size="medium"  @click="editSubmit()"  >保存</el-button>
				</el-row>
			</el-form>
		</el-dialog>
		<!--        查看表单信息-->
		<el-dialog title="查看" :visible.sync="selectOneVisible" width="60%"   :close-on-click-modal="false">
			<el-form ref="editForm" :model="editForm" label-width="50%" style="margin-top: 20px">
				<el-row>
					<el-col :span="10">
						<el-row>
							<el-form-item label="输入备注:">
								<el-input
										type="text"
										v-model="editForm.remark3"
										maxlength="10"
										show-word-limit>
								</el-input>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="车牌号码:" prop="trailerFrameNo">
								<el-input v-model="editForm.trailerFrameNo" disabled placeholder="请输入车牌号"></el-input>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="货物类型:" prop="cocode">
								<el-select v-model="editForm.cocode" placeholder="请选择">
									<el-option label="转关货" value="转关货"></el-option>
									<el-option label="换单货" value="换单货"></el-option>
									<el-option label="普通货" value="普通货"></el-option>
									<el-option label="退库货" value="退库货"></el-option>
									<el-option label="查验货" value="查验货"></el-option>
								</el-select>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="场站选择:" prop="endstation">
								<el-select v-model="editForm.endstation" disabled   placeholder="请选择">
									<el-option
											v-for="item in options"
											:key="item.stationId"
											:label="item.name"
											:value="item.stationId">
									</el-option>
								</el-select>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="运输公司:">
								<el-input v-model="editForm.agentno" placeholder=""></el-input>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="挂靠单位:">
								<el-input v-model="editForm.agentname" placeholder=""></el-input>
							</el-form-item>
						</el-row>
					</el-col>
					<el-col :span="10">
						<el-row>
							<el-form-item label="业务类型:" prop="businesstype">
								<el-select v-model="editForm.businesstype" clearable placeholder="请选择">
									<el-option label="进口提货" value="进口提货"></el-option>
									<el-option label="出口送货" value="出口送货"></el-option>
									<el-option label="分拨业务" value="分拨业务"></el-option>
									<el-option label="调拨业务" value="调拨业务"></el-option>
								</el-select>
							</el-form-item>

						</el-row>
						<el-row>
							<el-form-item label="申请单位:">
								<el-input v-model="editForm.veProperty" disabled size="small"></el-input>
							</el-form-item>
						</el-row>
						<el-row>
							<el-form-item label="备案单位:">
								<el-input v-model="editForm.trailerLicenseNo" disabled></el-input>
							</el-form-item>

						</el-row>
						<el-row>
							<el-form-item label="主单列表:">
								<el-input
										type="textarea"
										:rows="4"
										placeholder="请输入主单号,例如17212341234,多个单号以‘,’(英文)分割"
										v-model="editForm.masterList">
								</el-input>
							</el-form-item>
						</el-row>
					</el-col>
				</el-row>
			</el-form>
		</el-dialog>
	</section>
</template>
<script>
	import {list, aisleList, barCodeDel, remove, edit, forwarderBarCodeDel} from '../../api/remote_interface/byont_import';
	import {getYardList as yartList} from "../../api/station_dispatch";
	export default {
		filters: {
			formatDate(value) {
				if(value == null) {
					return null
				}
				let dt = new Date(value)
				return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate();
			}
		},
		data() {
			return {
				businesstypeList: [],
				pageSize: 1,
				limitSize: 10,
				total: 1,
				options: [],
				awbaList:[],
				aisleOptions: [],
				filtersForm: {
					waybill: ''
				},
				isValidOptions:[
					{
						value: '0',
						label: '未失效'
					}, {
						value: '1',
						label: '失效'
					}, {
						value: '',
						label: '全部'
					}
				],
				disabled: true,
				commonLoading: false,
				editFormVisible: false,
				selectOneVisible: false,
				filters: {
					trailerFrameNo: '',
					agentname: '',
					endstation: '',
					aisle: '',
					isValid:'0'
				},
				businesstypeListLoading: false,
				editForm: {
					// 备注
					remark3: '',
					// 业务类型
					businesstype: '',
					// 车牌号
					trailerFrameNo: '',
					//备案单位
					trailerLicenseNo: '',
					// 主单列表
					masterList: '',
					// 场站编号
					endstation: '',
					endstationList: '',
					stationId: '',
					// 运输公司
					agentno: '',
					// 挂靠单位
					agentname: '',
					//申请单位
					veProperty: '',
					// 货物类型
					cocode:'',
					// 货物重量
					remark: ''
				},
				weightFloat: 0,
				rules:{
					waybill: [
						{ required: true, message: '请输入运单号', trigger: 'change' }
					]
				},
			}
		},
		methods: {

			isvalidFormatter: function(row, column){
				if (row.isvalid == '0'){
					return "未失效"
				}else {
					return "失效"
				}
			},

			aisleName: function(row, cloumn){
				if (row.aisle=="4600010005"){
					return "5号卡口-出"
				}else if (row.aisle=="4600011005"){
					return "5号卡口-进"
				}else if (row.aisle=="4604333311"){
					return "1号卡口-进"
				}else if (row.aisle=="4604333312"){
					return "1号卡口-出"
				}else if (row.aisle=="4604444412"){
					return "1号卡口-出"
				}else if (row.aisle=="4600011006"){
					return "6号卡口-进"
				}else if (row.aisle=="4604110112"){
					return "1号卡口-出"
				}else if (row.aisle=="4612031001"){
					return "内三卡口-进"
				}else if (row.aisle=="4600010006"){
					return "6号卡口-出"
				}else if (row.aisle=="4604111111"){
					return "1号卡口-进"
				}else if (row.aisle=="4612030001"){
					return "内三卡口-出"
				}else if (row.aisle=="4604444411"){
					return "1号卡口-进"
				}else if (row.aisle=="4604333321"){
					return "2号卡口-进"
				}else if (row.aisle=="4604333322"){
					return "2号卡口-出"
				}else if (row.aisle=="4600011001"){
					return "卡口-进"
				}else if (row.aisle=="4600010001"){
					return "卡口-出"
				}

			},
			endstationName: function(row, cloumn){
				if (row.endstation == "4604511001"){
					return "快邮货站"
				}else if (row.endstation == "4600329012"){
					return "综保区货站"
				}else if (row.endstation == "4604000000"){
					return "西货站"
				}else if (row.endstation == "4604000006"){
					return "冷链货站"
				}else if (row.endstation == "4604499001"){
					return "三号货站"
				}else if (row.endstation == "4600541001"){
					return "顺丰货站"
				}
			},
			turnoverflagFormatter: function(row, column){
				if (row.turnoverflag == 'I'){
					return "进场站"
				}else {
					return "出场站"
				}
			},
			// 获取列表
			getList(val) {
				let pageSize = this.pageSize;
				if (val != undefined){
					pageSize = val;
				}
				let para = {
					pageSize: pageSize,
					limitSize: this.limitSize,
					trailerFrameNo: this.filters.trailerFrameNo,
					agentname: this.filters.agentname,
					endstation: this.filters.endstation,
					aisle: this.filters.aisle,
					userId: this.userid = JSON.parse(sessionStorage.getItem('user')).id
				};
				if(JSON.parse(sessionStorage.getItem('user')).roles[0].roleName == "ROLE_admin"){
					para.userId = '';
				}
				this.businesstypeListLoading = true;
				list(para).then((res) => {
					this.total = res.data.data.total;
					this.businesstypeList = res.data.data.list;
					this.businesstypeListLoading = false;
				}).catch((error) => {
					this.businesstypeListLoading = false;
					if(null!= error.response && error.response!==undefined){
						let status= error.response.status;
						let msg = error.response.statusText;
						alert(status+msg);
					}else {
						alert(error);
					}

				});

			},
			// 获取场站
			getYardList(){
				yartList().then((res) =>{
					this.options = res.data.data;
				}).catch((error) => {
					if(null!= error.response && error.response!==undefined){
						let status= error.response.status;
						let msg = error.response.statusText;
						alert(status+msg);
					}else {
						alert(error);
					}

				});
			},
			// 获取卡口名称
			aisleOption(value){
				let para = {
					yardId: value
				}
				this.filters.aisle = '';
				aisleList(para).then((res) =>{
					this.aisleOptions = res.data.data;
					this.disabled = false;
				}).catch((error) => {
					if(null!= error.response && error.response!==undefined){
						let status= error.response.status;
						let msg = error.response.statusText;
						alert(status+msg);
					}else {
						alert(error);
					}

				});
			},
			// 二维码异常处理
			barCodeDelete(index, row) {
				this.$confirm('确认处理吗?', '提示', {}).then(() => {
					let para = {
						trailerFrameNo: row.trailerFrameNo,
						barCode: row.barcode
					}
					if (JSON.parse(sessionStorage.getItem('user')).loginName == 'admin'){
						barCodeDel(para).then((res) =>{
							this.$message({
								message: res.data.msg,
								type: 'success'

							});
							this.getList();
						}).catch((error)=>{
							this.$message({
								message: error,
								type: 'error'

							});
						});
					}else {
						this.$message({
							message: '异常处理请联系管理员',
							type: 'error'

						});
					}

				}).catch(() =>{

				});
			},
			// 取消申请
			forwarderDelete(index, row) {
				this.$confirm('确认取消吗?', '提示', {}).then(() => {
					let para = {
						trailerFrameNo: row.trailerFrameNo,
						barCode: row.barcode
					}
					forwarderBarCodeDel(para).then((res) =>{
						if (res.data.code == 200){
							this.$message({
								message: res.data.msg,
								type: 'success'
							});
							this.getList();
						}else if (res.data.code == 201){
							this.$message({
								message: res.data.msg,
								type: 'error'

							});
						}else if (res.data.code == 202){
							this.$message({
								message: res.data.msg,
								type: 'error'

							});
						}
					}).catch((error)=>{
						this.$message({
							message: error,
							type: 'error'
						});
					});

				}).catch(() =>{

				});
			},
			// 删除
			deleteClick(index, row){
				this.$confirm('确认删除吗?', '提示', {}).then(() => {
					let para = {
						id: row.id,
					}
					if (JSON.parse(sessionStorage.getItem('user')).loginName == 'admin'){
						remove(para).then((res) =>{
							this.$message({
								message: res.data.msg,
								type: 'success'

							});
							this.getList();
						}).catch((error)=>{
							this.$message({
								message: error,
								type: 'error'

							});
						});
					}else {
						this.$message({
							message: '如需删除请联系管理员',
							type: 'error'

						});
					}

				}).catch(() =>{

				});
			},
			// 修改
			opneEdit(index, row){
				this.editFormVisible = true;

				if (this.$refs.filtersForm !== undefined) {
					this.$refs.filtersForm.resetFields();
				}
				this.editForm = Object.assign({}, row);
			},
			// 查看
			selectOne(index, row){
				this.selectOneVisible = true;
				this.editForm = Object.assign({}, row);
			},
			// 运单列表赋值
			addWaybill: function(index, row){
				this.editForm.masterList += row.waybillnomaster + ',';
			},
			// 运单查询
			getWaybillList(){
				let businesstype = this.editForm.businesstype;
				if (businesstype != undefined && businesstype != null && businesstype != ''){
					this.$refs.filtersForm.validate((valid) => {
						if (valid) {
							this.commonLoading = true;
							let _this = this;
							var url = "http://tjfx.15miaoo.com:8003/orig/orig";
							var xhr = new XMLHttpRequest();
							// 访问nginx中的代理服务器
							xhr.open('get', url+'?waybill='+this.filtersForm.waybill+'&imp='+this.getBusinesstype(), true);
							xhr.send();
							xhr.onreadystatechange = function(){
								if(xhr.readyState == 4){
									if(xhr.status ==200){
										var data = JSON.parse(xhr.responseText);
										_this.awbaList=data;
										//console.log(data);
										_this.commonLoading = false;
									}
								}
							}
						} else {
							console.log('error submit!!');
							return false;
						}
					});
				}else {
					this.$message({
						message: '请在下列选择业务类型',
						type: "error"
					})
				}
			},
			// 分页
			handleSizeChange(val) {
				this.limitSize = val;
				this.getList();
			},
			handleCurrentChange(val) {
				this.pageSize = val;
				this.getList();

			},
			// 日期格式转换
			flightDate: function (row, column) {
				// 获取单元格数据
				let data = row.flightDate
				if(data == null) {
					return null
				}
				let dt = new Date(data)
				return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate();
			},
			formatDate: function (row, column) {
				// 获取单元格数据
				let data = row.createdate;
				if(data == null) {
					return null
				}
				let dt = new Date(data)
				return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate()+ ' ' + dt.getHours() + ':' + dt.getMinutes() + ':' + dt.getSeconds();
			},
			editweight(){
				var _this = this;
				// 运单重量累加
				let lists = _this.wayBillList();
				var split = lists.split(",");
				_this.weightFloat = 0;
				// 判断进出港  进出港返回字段不一样
				if(_this.getBusinesstype() == "I"){
					split.forEach((item) =>{
						var url = "http://tjfx.15miaoo.com:8003/orig/orig";
						var xhr = new XMLHttpRequest();
						// 访问nginx中的代理服务器
						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 => {
										if (itmeData != null){
											_this.weightFloat += parseFloat(itmeData.manifesttotalweight);
										}
									}));
								}
							}
						}
					});
				}else {
					split.forEach((item) =>{
						var url = "http://tjfx.15miaoo.com:8003/orig/orig";
						var xhr = new XMLHttpRequest();
						// 访问nginx中的代理服务器
						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 => {
										if (itmeData != null){
											_this.weightFloat += parseFloat(itmeData.preparetotalweight);
										}
									}));
								}
							}
						}
					});
				}
				return _this.weightFloat;
			},
			editsubmit(){
				this.editForm.masterList = this.wayBillList();
				this.editForm.remark = this.weightFloat.toString();
				let para = Object.assign({}, this.editForm);
				edit(para).then((res) => {
					if (res.data.code == 200){
						this.$message({
							message: '提交成功',
							type: 'success'
						});
						this.editFormVisible = false;
						this.getList();
					}else {
						this.$message({
							message: '提交失败',
							type: 'error'
						});
					}
				}).catch(error => alert(error));
			},
			getBusinesstype:function(){
				let businesstype = this.editForm.businesstype;
				if (businesstype == '进口提货'){
					businesstype = 'I';
				}else if (businesstype == '出口送货'){
					businesstype = 'E';
				}else if (businesstype == '分拨业务'){
					businesstype = 'I';
				}else if (businesstype == '调拨业务'){
					businesstype = 'E';
				}
				return businesstype;
			},
			// 添加页面主单列表 结尾逗号处理
			wayBillList:function () {
				if (this.editForm.masterList.endsWith(",")){
					return this.editForm.masterList.substring(0,this.editForm.masterList.length-1);
				}else {
					return this.editForm.masterList
				}
			},
			// 申请添加
			editSubmit (){
				let _this = this;
				this.$refs.editForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗?', '提示', {}).then(() => {
							_this.editsubmit();
						}).catch(() =>{

						});
					} else {
						return false;
					}
				});
			}
		},
		mounted() {
			this.getYardList();
		},
		watch: {
			'editForm.masterList':{
				handler: function() {
					this.editForm.remark = "";
					this.editForm.masterList = this.editForm.masterList.replaceAll(",",",");
					this.editweight();
				},
			}
		}
	}
</script>

<style scoped>


</style>