正在显示
4 个修改的文件
包含
186 行增加
和
143 行删除
| @@ -221,10 +221,10 @@ | @@ -221,10 +221,10 @@ | ||
| 221 | <el-form-item label="联系方式:" prop="userMobile"> | 221 | <el-form-item label="联系方式:" prop="userMobile"> |
| 222 | <el-input v-model="showForm.userMobile" style="width: 300px;" readonly></el-input> | 222 | <el-input v-model="showForm.userMobile" style="width: 300px;" readonly></el-input> |
| 223 | </el-form-item> | 223 | </el-form-item> |
| 224 | -<!-- <el-form-item label="车辆类型:" prop="vehicleType">--> | ||
| 225 | -<!-- <el-input v-model="showForm.vehicleType" style="width: 300px;" readonly>--> | ||
| 226 | -<!-- </el-input>--> | ||
| 227 | -<!-- </el-form-item>--> | 224 | + <!-- <el-form-item label="车辆类型:" prop="vehicleType">--> |
| 225 | + <!-- <el-input v-model="showForm.vehicleType" style="width: 300px;" readonly>--> | ||
| 226 | + <!-- </el-input>--> | ||
| 227 | + <!-- </el-form-item>--> | ||
| 228 | <el-form-item label="车辆类型:" prop="vehicleType"> | 228 | <el-form-item label="车辆类型:" prop="vehicleType"> |
| 229 | <el-select v-model="showForm.vehicleType" style="width:300px" readonly | 229 | <el-select v-model="showForm.vehicleType" style="width:300px" readonly |
| 230 | placeholder="请选择车辆类型"> | 230 | placeholder="请选择车辆类型"> |
| @@ -567,12 +567,10 @@ | @@ -567,12 +567,10 @@ | ||
| 567 | /** | 567 | /** |
| 568 | * 用户端,获取车辆调度记录 | 568 | * 用户端,获取车辆调度记录 |
| 569 | */ | 569 | */ |
| 570 | - async getDispatchNodeList() { | 570 | + getDispatchNodeList() { |
| 571 | this.listLoading = true; | 571 | this.listLoading = true; |
| 572 | - const {data: res} = await selectDispatchNoteList(this.queryInfo).catch(error => { | ||
| 573 | - this.listLoading = false; | ||
| 574 | - this.$message.error(error.toString()); | ||
| 575 | - }); | 572 | + selectDispatchNoteList(this.queryInfo).then((response) => { |
| 573 | + let res = response.data; | ||
| 576 | if (res.code !== '200') { | 574 | if (res.code !== '200') { |
| 577 | this.listLoading = false; | 575 | this.listLoading = false; |
| 578 | return this.$message.error('获取车辆调度列表失败'); | 576 | return this.$message.error('获取车辆调度列表失败'); |
| @@ -583,16 +581,18 @@ | @@ -583,16 +581,18 @@ | ||
| 583 | this.total = res.data.total; | 581 | this.total = res.data.total; |
| 584 | this.listLoading = false; | 582 | this.listLoading = false; |
| 585 | this.$message.success('获取车辆调度列表,成功!'); | 583 | this.$message.success('获取车辆调度列表,成功!'); |
| 584 | + }).catch(error => { | ||
| 585 | + this.listLoading = false; | ||
| 586 | + this.$message.error(error.toString()); | ||
| 587 | + }); | ||
| 586 | }, | 588 | }, |
| 587 | /** | 589 | /** |
| 588 | * 用户端,我要调度车辆,方法 | 590 | * 用户端,我要调度车辆,方法 |
| 589 | */ | 591 | */ |
| 590 | - async dispatchVehicle() { | 592 | + dispatchVehicle() { |
| 591 | this.dispatchLoading = true; | 593 | this.dispatchLoading = true; |
| 592 | - const {data: res} = await dispatch(this.dispatchForm).catch(error => { | ||
| 593 | - this.dispatchLoading = false; | ||
| 594 | - this.$message.error(error.toString()); | ||
| 595 | - }); | 594 | + dispatch(this.dispatchForm).then((response) => { |
| 595 | + let res = response.data; | ||
| 596 | if (res.code !== '200') { | 596 | if (res.code !== '200') { |
| 597 | this.dispatchLoading = false; | 597 | this.dispatchLoading = false; |
| 598 | return this.$message.error('车辆繁忙,请稍后重试'); | 598 | return this.$message.error('车辆繁忙,请稍后重试'); |
| @@ -613,30 +613,26 @@ | @@ -613,30 +613,26 @@ | ||
| 613 | this.queryInfo.gmtCreate = new Date(); | 613 | this.queryInfo.gmtCreate = new Date(); |
| 614 | //刷新车辆调度列表 | 614 | //刷新车辆调度列表 |
| 615 | this.getDispatchNodeList(); | 615 | this.getDispatchNodeList(); |
| 616 | + }).catch(error => { | ||
| 617 | + this.dispatchLoading = false; | ||
| 618 | + this.$message.error(error.toString()); | ||
| 619 | + }); | ||
| 616 | }, | 620 | }, |
| 617 | /** | 621 | /** |
| 618 | * 用户端,取消调度车辆,方法 | 622 | * 用户端,取消调度车辆,方法 |
| 619 | */ | 623 | */ |
| 620 | - async cancelDispatch(row) { | 624 | + cancelDispatch(row) { |
| 621 | //弹框询问是否取消车辆调度 | 625 | //弹框询问是否取消车辆调度 |
| 622 | - const confirmResult = await this.$confirm('此操作将取消该车辆的调度, 是否继续?', '警告', { | 626 | + this.$confirm('此操作将取消该车辆的调度, 是否继续?', '警告', { |
| 623 | confirmButtonText: '确定取消调度', | 627 | confirmButtonText: '确定取消调度', |
| 624 | cancelButtonText: '取消', | 628 | cancelButtonText: '取消', |
| 625 | type: 'warning' | 629 | type: 'warning' |
| 626 | } | 630 | } |
| 627 | - ); | ||
| 628 | - //如果点击确定,返回值是字符串confirm | ||
| 629 | - //如果点击取消删除,返回值是字符串cancel | ||
| 630 | - if (confirmResult !== 'confirm') { | ||
| 631 | - return this.$message.info('已放弃,取消车辆调度'); | ||
| 632 | - } | 631 | + ).then(() => { |
| 633 | //开启加载 | 632 | //开启加载 |
| 634 | this.cancelLoading = true; | 633 | this.cancelLoading = true; |
| 635 | - const {data: res} = await cancel(row).catch(error => { | ||
| 636 | - //关闭加载 | ||
| 637 | - this.cancelLoading = false; | ||
| 638 | - this.$message.error(error.toString()); | ||
| 639 | - }); | 634 | + cancel(row).then((response) => { |
| 635 | + let res = response.data; | ||
| 640 | if (res.code !== '200') { | 636 | if (res.code !== '200') { |
| 641 | this.cancelLoading = false; | 637 | this.cancelLoading = false; |
| 642 | return this.$message.error('取消车辆调度,失败!请人工介入'); | 638 | return this.$message.error('取消车辆调度,失败!请人工介入'); |
| @@ -646,14 +642,19 @@ | @@ -646,14 +642,19 @@ | ||
| 646 | this.$message.success('取消调度车辆,成功!'); | 642 | this.$message.success('取消调度车辆,成功!'); |
| 647 | //刷新车辆调度列表 | 643 | //刷新车辆调度列表 |
| 648 | this.getDispatchNodeList(); | 644 | this.getDispatchNodeList(); |
| 645 | + }).catch(error => { | ||
| 646 | + //关闭加载 | ||
| 647 | + this.cancelLoading = false; | ||
| 648 | + this.$message.error(error.toString()); | ||
| 649 | + }); | ||
| 650 | + }).catch(); | ||
| 649 | }, | 651 | }, |
| 650 | /** | 652 | /** |
| 651 | * 获取用户信息 | 653 | * 获取用户信息 |
| 652 | */ | 654 | */ |
| 653 | - async getUserInfo(param) { | ||
| 654 | - const {data: res} = await getUser(param).catch((error) => { | ||
| 655 | - this.$message.error(error.toString()); | ||
| 656 | - }); | 655 | + getUserInfo(param) { |
| 656 | + getUser(param).then((response) => { | ||
| 657 | + let res = response.data; | ||
| 657 | if (res.code !== '200') { | 658 | if (res.code !== '200') { |
| 658 | return this.$message.error('请刷新一下界面!'); | 659 | return this.$message.error('请刷新一下界面!'); |
| 659 | } | 660 | } |
| @@ -666,6 +667,10 @@ | @@ -666,6 +667,10 @@ | ||
| 666 | this.queryInfo.userMobile = res.data.list[0].mobilephone; | 667 | this.queryInfo.userMobile = res.data.list[0].mobilephone; |
| 667 | this.dispatchForm.userMobile = res.data.list[0].mobilephone; | 668 | this.dispatchForm.userMobile = res.data.list[0].mobilephone; |
| 668 | this.$message.success('欢迎使用,车辆调度系统!'); | 669 | this.$message.success('欢迎使用,车辆调度系统!'); |
| 670 | + }).catch((error) => { | ||
| 671 | + this.$message.error(error.toString()); | ||
| 672 | + }); | ||
| 673 | + | ||
| 669 | }, | 674 | }, |
| 670 | }, | 675 | }, |
| 671 | mounted() { | 676 | mounted() { |
| @@ -127,7 +127,7 @@ | @@ -127,7 +127,7 @@ | ||
| 127 | style="margin-left: 1px;"> | 127 | style="margin-left: 1px;"> |
| 128 | <el-button type="warning" icon="el-icon-star-off" size="mini" | 128 | <el-button type="warning" icon="el-icon-star-off" size="mini" |
| 129 | style="margin-top: 3px;" | 129 | style="margin-top: 3px;" |
| 130 | - :disabled="scope.row.status!=='4'" | 130 | + :disabled="scope.row.status!=='4' || scope.row.beginTime !==null" |
| 131 | :loading="beginLoading" | 131 | :loading="beginLoading" |
| 132 | @click="startDispatch(scope.$index,scope.row)">开始任务 | 132 | @click="startDispatch(scope.$index,scope.row)">开始任务 |
| 133 | </el-button> | 133 | </el-button> |
| @@ -631,13 +631,11 @@ | @@ -631,13 +631,11 @@ | ||
| 631 | /** | 631 | /** |
| 632 | * 管理员端,获取车辆调度记录列表 | 632 | * 管理员端,获取车辆调度记录列表 |
| 633 | */ | 633 | */ |
| 634 | - async getDispatchNodeList() { | 634 | + getDispatchNodeList() { |
| 635 | //开启加载 | 635 | //开启加载 |
| 636 | this.listLoading = true; | 636 | this.listLoading = true; |
| 637 | - const {data: res} = await selectDispatchNoteList(this.queryInfo).catch(error => { | ||
| 638 | - this.listLoading = false; | ||
| 639 | - this.$message.error(error.toString()); | ||
| 640 | - }); | 637 | + selectDispatchNoteList(this.queryInfo).then((response) => { |
| 638 | + let res = response.data; | ||
| 641 | if (res.code !== '200') return this.$message.error('获取车辆调度列表失败'); | 639 | if (res.code !== '200') return this.$message.error('获取车辆调度列表失败'); |
| 642 | // 获取车辆调度列表数据 | 640 | // 获取车辆调度列表数据 |
| 643 | this.DispatchNoteList = res.data.list; | 641 | this.DispatchNoteList = res.data.list; |
| @@ -646,21 +644,23 @@ | @@ -646,21 +644,23 @@ | ||
| 646 | //关闭加载 | 644 | //关闭加载 |
| 647 | this.listLoading = false; | 645 | this.listLoading = false; |
| 648 | this.$message.success('获取车辆调度列表,成功'); | 646 | this.$message.success('获取车辆调度列表,成功'); |
| 647 | + }).catch(error => { | ||
| 648 | + this.listLoading = false; | ||
| 649 | + this.$message.error(error.toString()); | ||
| 650 | + }); | ||
| 649 | }, | 651 | }, |
| 650 | /** | 652 | /** |
| 651 | * 管理员端,添加车辆调度记录 | 653 | * 管理员端,添加车辆调度记录 |
| 652 | */ | 654 | */ |
| 653 | addDispatchNote() { | 655 | addDispatchNote() { |
| 654 | /*进行表单的预验证*/ | 656 | /*进行表单的预验证*/ |
| 655 | - this.$refs.addDispatchNodeFormRef.validate(async valid => { | 657 | + this.$refs.addDispatchNodeFormRef.validate(valid => { |
| 656 | // 未通过,表单预校验 | 658 | // 未通过,表单预校验 |
| 657 | if (!valid) return; | 659 | if (!valid) return; |
| 658 | // 通过,表单预检验,发起添加车辆调度记录的网络请求 | 660 | // 通过,表单预检验,发起添加车辆调度记录的网络请求 |
| 659 | this.addLoading = true; | 661 | this.addLoading = true; |
| 660 | - const {data: res} = await insertDispatchNote(this.addDispatchNodeForm).catch(error => { | ||
| 661 | - this.addLoading = false; | ||
| 662 | - this.$message.error(error.toString()); | ||
| 663 | - }); | 662 | + insertDispatchNote(this.addDispatchNodeForm).then((response) => { |
| 663 | + let res = response.data; | ||
| 664 | //添加调度记录信息,失败 | 664 | //添加调度记录信息,失败 |
| 665 | if (res.code !== '200') return this.$message.error('添加调度记录信息,失败'); | 665 | if (res.code !== '200') return this.$message.error('添加调度记录信息,失败'); |
| 666 | //添加调度记录信息,成功 | 666 | //添加调度记录信息,成功 |
| @@ -671,28 +671,27 @@ | @@ -671,28 +671,27 @@ | ||
| 671 | this.addDispatchNodeFormVisible = false; | 671 | this.addDispatchNodeFormVisible = false; |
| 672 | //刷新车辆调度记录列表 | 672 | //刷新车辆调度记录列表 |
| 673 | this.getDispatchNodeList(); | 673 | this.getDispatchNodeList(); |
| 674 | + }).catch(error => { | ||
| 675 | + this.addLoading = false; | ||
| 676 | + this.$message.error(error.toString()); | ||
| 677 | + }); | ||
| 674 | }) | 678 | }) |
| 675 | }, | 679 | }, |
| 676 | /** | 680 | /** |
| 677 | * 管理员端,删除车辆调度记录 | 681 | * 管理员端,删除车辆调度记录 |
| 678 | */ | 682 | */ |
| 679 | - async removeDispatchNode(index, row) { | 683 | + removeDispatchNode(index, row) { |
| 680 | //弹框询问是否取消车辆调度 | 684 | //弹框询问是否取消车辆调度 |
| 681 | - const confirmResult = await this.$confirm('此操作永久删除该车辆调度记录, 是否继续?', '警告', { | 685 | + this.$confirm('此操作永久删除该车辆调度记录, 是否继续?', '警告', { |
| 682 | confirmButtonText: '确定删除', | 686 | confirmButtonText: '确定删除', |
| 683 | cancelButtonText: '取消', | 687 | cancelButtonText: '取消', |
| 684 | type: 'warning' | 688 | type: 'warning' |
| 685 | } | 689 | } |
| 686 | - ); | ||
| 687 | - if (confirmResult !== 'confirm') { | ||
| 688 | - return this.$message.info('已取消删除'); | ||
| 689 | - } | 690 | + ).then(() => { |
| 690 | //开启加载 | 691 | //开启加载 |
| 691 | this.delLoading = true; | 692 | this.delLoading = true; |
| 692 | - const {data: res} = await deleteDispatchNote(row).catch(error => { | ||
| 693 | - this.delLoading = false; | ||
| 694 | - this.$message.error(error.toString()); | ||
| 695 | - }); | 693 | + deleteDispatchNote(row).then((response) => { |
| 694 | + let res = response.data; | ||
| 696 | if (res.code !== '200') { | 695 | if (res.code !== '200') { |
| 697 | return this.$message.error('删除车辆调度记录,失败'); | 696 | return this.$message.error('删除车辆调度记录,失败'); |
| 698 | } | 697 | } |
| @@ -700,21 +699,24 @@ | @@ -700,21 +699,24 @@ | ||
| 700 | this.delLoading = false; | 699 | this.delLoading = false; |
| 701 | //刷新车辆调度记录列表 | 700 | //刷新车辆调度记录列表 |
| 702 | this.getDispatchNodeList(); | 701 | this.getDispatchNodeList(); |
| 702 | + }).catch(error => { | ||
| 703 | + this.delLoading = false; | ||
| 704 | + this.$message.error(error.toString()); | ||
| 705 | + }); | ||
| 706 | + }).catch(); | ||
| 703 | }, | 707 | }, |
| 704 | /** | 708 | /** |
| 705 | * 管理员端,编辑车辆调度记录 | 709 | * 管理员端,编辑车辆调度记录 |
| 706 | */ | 710 | */ |
| 707 | editDispatchNote() { | 711 | editDispatchNote() { |
| 708 | /*进行表单的预验证*/ | 712 | /*进行表单的预验证*/ |
| 709 | - this.$refs.editFormRef.validate(async valid => { | 713 | + this.$refs.editFormRef.validate(valid => { |
| 710 | // 未通过,表单预校验 | 714 | // 未通过,表单预校验 |
| 711 | if (!valid) return; | 715 | if (!valid) return; |
| 712 | // 通过,表单预检验,开启加载 | 716 | // 通过,表单预检验,开启加载 |
| 713 | this.editLoading = true; | 717 | this.editLoading = true; |
| 714 | - const {data: res} = await updateDispatchNote(this.editForm).catch(error => { | ||
| 715 | - this.editLoading = false; | ||
| 716 | - this.$message.error(error.toString()); | ||
| 717 | - }); | 718 | + updateDispatchNote(this.editForm).then((response) => { |
| 719 | + let res = response.data; | ||
| 718 | if (res.code !== '200') { | 720 | if (res.code !== '200') { |
| 719 | return this.$message.error('修改车辆调度记录信息,失败'); | 721 | return this.$message.error('修改车辆调度记录信息,失败'); |
| 720 | } | 722 | } |
| @@ -725,18 +727,20 @@ | @@ -725,18 +727,20 @@ | ||
| 725 | this.viewDialogVisible = false; | 727 | this.viewDialogVisible = false; |
| 726 | //刷新车辆调度列表 | 728 | //刷新车辆调度列表 |
| 727 | this.getDispatchNodeList(); | 729 | this.getDispatchNodeList(); |
| 730 | + }).catch(error => { | ||
| 731 | + this.editLoading = false; | ||
| 732 | + this.$message.error(error.toString()); | ||
| 733 | + }); | ||
| 728 | }); | 734 | }); |
| 729 | }, | 735 | }, |
| 730 | /** | 736 | /** |
| 731 | * 管理员端,手动,开始调度任务 | 737 | * 管理员端,手动,开始调度任务 |
| 732 | */ | 738 | */ |
| 733 | - async startDispatch(index, row) { | 739 | + startDispatch(index, row) { |
| 734 | //开启加载 | 740 | //开启加载 |
| 735 | this.beginLoading = true; | 741 | this.beginLoading = true; |
| 736 | - const {data: res} = await startTask(row).catch(error => { | ||
| 737 | - this.beginLoading = false; | ||
| 738 | - this.$message.error(error.toString()); | ||
| 739 | - }); | 742 | + startTask(row).then((response) => { |
| 743 | + let res = response.data; | ||
| 740 | if (res.code !== '200') { | 744 | if (res.code !== '200') { |
| 741 | return this.$message.error('手动开始调度任务,失败'); | 745 | return this.$message.error('手动开始调度任务,失败'); |
| 742 | } | 746 | } |
| @@ -745,17 +749,19 @@ | @@ -745,17 +749,19 @@ | ||
| 745 | this.$message.success('手动开始调度任务,成功!'); | 749 | this.$message.success('手动开始调度任务,成功!'); |
| 746 | //刷新车辆调度列表 | 750 | //刷新车辆调度列表 |
| 747 | this.getDispatchNodeList(); | 751 | this.getDispatchNodeList(); |
| 752 | + }).catch(error => { | ||
| 753 | + this.beginLoading = false; | ||
| 754 | + this.$message.error(error.toString()); | ||
| 755 | + }); | ||
| 748 | }, | 756 | }, |
| 749 | /** | 757 | /** |
| 750 | * 管理员端,手动,完成调度任务 | 758 | * 管理员端,手动,完成调度任务 |
| 751 | */ | 759 | */ |
| 752 | - async completeDispatch(index, row) { | 760 | + completeDispatch(index, row) { |
| 753 | //开启加载 | 761 | //开启加载 |
| 754 | this.endLoading = true; | 762 | this.endLoading = true; |
| 755 | - const {data: res} = await completeTask(row).catch(error => { | ||
| 756 | - this.endLoading = false; | ||
| 757 | - this.$message.error(error.toString()); | ||
| 758 | - }); | 763 | + completeTask(row).then((response) => { |
| 764 | + let res = response.data; | ||
| 759 | if (res.code !== '200') { | 765 | if (res.code !== '200') { |
| 760 | return this.$message.error('手动完成调度任务,失败'); | 766 | return this.$message.error('手动完成调度任务,失败'); |
| 761 | } | 767 | } |
| @@ -764,6 +770,10 @@ | @@ -764,6 +770,10 @@ | ||
| 764 | this.$message.success('手动完成调度任务,成功!'); | 770 | this.$message.success('手动完成调度任务,成功!'); |
| 765 | //刷新车辆调度列表 | 771 | //刷新车辆调度列表 |
| 766 | this.getDispatchNodeList(); | 772 | this.getDispatchNodeList(); |
| 773 | + }).catch(error => { | ||
| 774 | + this.endLoading = false; | ||
| 775 | + this.$message.error(error.toString()); | ||
| 776 | + }); | ||
| 767 | }, | 777 | }, |
| 768 | //监听,我要调度车辆,对话框的关闭事件 | 778 | //监听,我要调度车辆,对话框的关闭事件 |
| 769 | dispatchDialogClosed() { | 779 | dispatchDialogClosed() { |
| @@ -43,11 +43,13 @@ | @@ -43,11 +43,13 @@ | ||
| 43 | </div> | 43 | </div> |
| 44 | <!--驾驶员信息列表区域--> | 44 | <!--驾驶员信息列表区域--> |
| 45 | <div style="margin-top: 20px;"> | 45 | <div style="margin-top: 20px;"> |
| 46 | - <el-table :data="driverInfoList" border stripe highlight-current-row v-loading="listLoading" element-loading-text="拼命加载中"> | 46 | + <el-table :data="driverInfoList" border stripe highlight-current-row v-loading="listLoading" |
| 47 | + element-loading-text="拼命加载中"> | ||
| 47 | <el-table-column type="index" align="center"></el-table-column> | 48 | <el-table-column type="index" align="center"></el-table-column> |
| 48 | <el-table-column label="姓名" prop="driverName" align="center" width="100"></el-table-column> | 49 | <el-table-column label="姓名" prop="driverName" align="center" width="100"></el-table-column> |
| 49 | <el-table-column label="联系方式" prop="driverMobile" align="center" width="130"></el-table-column> | 50 | <el-table-column label="联系方式" prop="driverMobile" align="center" width="130"></el-table-column> |
| 50 | - <el-table-column label="驾驶证" prop="driverLicenseNumber" align="center" width="150"></el-table-column> | 51 | + <el-table-column label="驾驶证" prop="driverLicenseNumber" align="center" |
| 52 | + width="150"></el-table-column> | ||
| 51 | <el-table-column label="工号" prop="jobNumber" align="center" width="120"></el-table-column> | 53 | <el-table-column label="工号" prop="jobNumber" align="center" width="120"></el-table-column> |
| 52 | <el-table-column label="职位" prop="driverPosition" align="center" width="100"> | 54 | <el-table-column label="职位" prop="driverPosition" align="center" width="100"> |
| 53 | <template slot-scope="scope"> | 55 | <template slot-scope="scope"> |
| @@ -423,13 +425,11 @@ | @@ -423,13 +425,11 @@ | ||
| 423 | /** | 425 | /** |
| 424 | * 获取驾驶员信息列表 | 426 | * 获取驾驶员信息列表 |
| 425 | */ | 427 | */ |
| 426 | - async getDriverInfoList() { | 428 | + getDriverInfoList() { |
| 427 | //开启加载 | 429 | //开启加载 |
| 428 | this.listLoading = true; | 430 | this.listLoading = true; |
| 429 | - const {data: res} = await selectDriverInfoList(this.queryInfo).catch(error => { | ||
| 430 | - this.listLoading = false; | ||
| 431 | - this.$message.error(error.toString()); | ||
| 432 | - }); | 431 | + selectDriverInfoList(this.queryInfo).then((response) => { |
| 432 | + let res = response.data; | ||
| 433 | if (res.code !== '200') return this.$message.error('获取驾驶员信息列表,失败'); | 433 | if (res.code !== '200') return this.$message.error('获取驾驶员信息列表,失败'); |
| 434 | // 获取驾驶员信息列表数据 | 434 | // 获取驾驶员信息列表数据 |
| 435 | this.driverInfoList = res.data.list; | 435 | this.driverInfoList = res.data.list; |
| @@ -438,21 +438,24 @@ | @@ -438,21 +438,24 @@ | ||
| 438 | //关闭加载 | 438 | //关闭加载 |
| 439 | this.listLoading = false; | 439 | this.listLoading = false; |
| 440 | this.$message.success('获取驾驶员信息列表,成功'); | 440 | this.$message.success('获取驾驶员信息列表,成功'); |
| 441 | + }).catch(error => { | ||
| 442 | + this.listLoading = false; | ||
| 443 | + this.$message.error(error.toString()); | ||
| 444 | + }); | ||
| 445 | + | ||
| 441 | }, | 446 | }, |
| 442 | /** | 447 | /** |
| 443 | * 增加驾驶员信息 | 448 | * 增加驾驶员信息 |
| 444 | */ | 449 | */ |
| 445 | addDriverInfo() { | 450 | addDriverInfo() { |
| 446 | /*进行表单的预验证*/ | 451 | /*进行表单的预验证*/ |
| 447 | - this.$refs.addDriverInfoFormRef.validate(async valid => { | 452 | + this.$refs.addDriverInfoFormRef.validate(valid => { |
| 448 | // 未通过,表单预校验 | 453 | // 未通过,表单预校验 |
| 449 | if (!valid) return; | 454 | if (!valid) return; |
| 450 | // 通过,表单预检验,开启加载 | 455 | // 通过,表单预检验,开启加载 |
| 451 | this.addLoading = true; | 456 | this.addLoading = true; |
| 452 | - const {data: res} = await insertDriverInfo(this.addDriverInfoForm).catch(error => { | ||
| 453 | - this.addLoading = false; | ||
| 454 | - this.$message.error(error.toString()); | ||
| 455 | - }); | 457 | + insertDriverInfo(this.addDriverInfoForm).then((response) => { |
| 458 | + let res = response.data; | ||
| 456 | if (res.code !== '200') return this.$message.error('添加驾驶员信息,失败'); | 459 | if (res.code !== '200') return this.$message.error('添加驾驶员信息,失败'); |
| 457 | //关闭加载 | 460 | //关闭加载 |
| 458 | this.addLoading = false; | 461 | this.addLoading = false; |
| @@ -461,28 +464,27 @@ | @@ -461,28 +464,27 @@ | ||
| 461 | this.addDriverInfoFormVisible = false; | 464 | this.addDriverInfoFormVisible = false; |
| 462 | //刷新驾驶员信息列表 | 465 | //刷新驾驶员信息列表 |
| 463 | this.getDriverInfoList(); | 466 | this.getDriverInfoList(); |
| 467 | + }).catch(error => { | ||
| 468 | + this.addLoading = false; | ||
| 469 | + this.$message.error(error.toString()); | ||
| 470 | + }); | ||
| 464 | }) | 471 | }) |
| 465 | }, | 472 | }, |
| 466 | /** | 473 | /** |
| 467 | * 删除驾驶员信息 | 474 | * 删除驾驶员信息 |
| 468 | */ | 475 | */ |
| 469 | - async removeDriverInfo(index, row) { | 476 | + removeDriverInfo(index, row) { |
| 470 | //弹框询问是否删除驾驶员信息 | 477 | //弹框询问是否删除驾驶员信息 |
| 471 | - const confirmResult = await this.$confirm('此操作永久删除该驾驶员信息, 是否继续?', '警告', { | 478 | + this.$confirm('此操作永久删除该驾驶员信息, 是否继续?', '警告', { |
| 472 | confirmButtonText: '确定删除', | 479 | confirmButtonText: '确定删除', |
| 473 | cancelButtonText: '取消', | 480 | cancelButtonText: '取消', |
| 474 | type: 'warning' | 481 | type: 'warning' |
| 475 | } | 482 | } |
| 476 | - ); | ||
| 477 | - if (confirmResult !== 'confirm') { | ||
| 478 | - return this.$message.info('已取消删除'); | ||
| 479 | - } | 483 | + ).then(() => { |
| 480 | //开启加载 | 484 | //开启加载 |
| 481 | this.delLoading = true; | 485 | this.delLoading = true; |
| 482 | - const {data: res} = await deleteDriverInfo(row).catch(error => { | ||
| 483 | - this.delLoading = false; | ||
| 484 | - this.$message.error(error.toString()); | ||
| 485 | - }); | 486 | + deleteDriverInfo(row).then((response) => { |
| 487 | + let res = response.data; | ||
| 486 | if (res.code !== '200') { | 488 | if (res.code !== '200') { |
| 487 | return this.$message.error('删除驾驶员信息,失败'); | 489 | return this.$message.error('删除驾驶员信息,失败'); |
| 488 | } | 490 | } |
| @@ -491,21 +493,24 @@ | @@ -491,21 +493,24 @@ | ||
| 491 | this.$message.success('删除驾驶员信息,成功!'); | 493 | this.$message.success('删除驾驶员信息,成功!'); |
| 492 | //刷新驾驶员信息列表 | 494 | //刷新驾驶员信息列表 |
| 493 | this.getDriverInfoList(); | 495 | this.getDriverInfoList(); |
| 496 | + }).catch(error => { | ||
| 497 | + this.delLoading = false; | ||
| 498 | + this.$message.error(error.toString()); | ||
| 499 | + }); | ||
| 500 | + }).catch(); | ||
| 494 | }, | 501 | }, |
| 495 | /** | 502 | /** |
| 496 | * 编辑驾驶员信息 | 503 | * 编辑驾驶员信息 |
| 497 | */ | 504 | */ |
| 498 | editDriverInfo() { | 505 | editDriverInfo() { |
| 499 | /*进行表单的预验证*/ | 506 | /*进行表单的预验证*/ |
| 500 | - this.$refs.editDriverInfoFormRef.validate(async valid => { | 507 | + this.$refs.editDriverInfoFormRef.validate(valid => { |
| 501 | // 未通过,表单预校验 | 508 | // 未通过,表单预校验 |
| 502 | if (!valid) return; | 509 | if (!valid) return; |
| 503 | // 通过,表单预检验,开启加载 | 510 | // 通过,表单预检验,开启加载 |
| 504 | this.editLoading = true; | 511 | this.editLoading = true; |
| 505 | - const {data: res} = await updateDriverInfo(this.editDriverInfoForm).catch(error => { | ||
| 506 | - this.editLoading = false; | ||
| 507 | - this.$message.error(error.toString()); | ||
| 508 | - }); | 512 | + updateDriverInfo(this.editDriverInfoForm).then((response) => { |
| 513 | + let res = response.data; | ||
| 509 | if (res.code !== '200') { | 514 | if (res.code !== '200') { |
| 510 | return this.$message.error('修改驾驶员信息,失败'); | 515 | return this.$message.error('修改驾驶员信息,失败'); |
| 511 | } | 516 | } |
| @@ -516,6 +521,10 @@ | @@ -516,6 +521,10 @@ | ||
| 516 | this.editDialogVisible = false; | 521 | this.editDialogVisible = false; |
| 517 | //刷新驾驶员信息列表 | 522 | //刷新驾驶员信息列表 |
| 518 | this.getDriverInfoList(); | 523 | this.getDriverInfoList(); |
| 524 | + }).catch(error => { | ||
| 525 | + this.editLoading = false; | ||
| 526 | + this.$message.error(error.toString()); | ||
| 527 | + }); | ||
| 519 | }) | 528 | }) |
| 520 | }, | 529 | }, |
| 521 | /** | 530 | /** |
| @@ -2,13 +2,13 @@ | @@ -2,13 +2,13 @@ | ||
| 2 | <el-container> | 2 | <el-container> |
| 3 | <el-main> | 3 | <el-main> |
| 4 | <!--面包屑导航区域--> | 4 | <!--面包屑导航区域--> |
| 5 | -<!-- <div>--> | ||
| 6 | -<!-- <el-breadcrumb separator-class="el-icon-arrow-right">--> | ||
| 7 | -<!-- <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>--> | ||
| 8 | -<!-- <el-breadcrumb-item>车辆调度</el-breadcrumb-item>--> | ||
| 9 | -<!-- <el-breadcrumb-item>车辆信息</el-breadcrumb-item>--> | ||
| 10 | -<!-- </el-breadcrumb>--> | ||
| 11 | -<!-- </div>--> | 5 | + <!-- <div>--> |
| 6 | + <!-- <el-breadcrumb separator-class="el-icon-arrow-right">--> | ||
| 7 | + <!-- <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>--> | ||
| 8 | + <!-- <el-breadcrumb-item>车辆调度</el-breadcrumb-item>--> | ||
| 9 | + <!-- <el-breadcrumb-item>车辆信息</el-breadcrumb-item>--> | ||
| 10 | + <!-- </el-breadcrumb>--> | ||
| 11 | + <!-- </div>--> | ||
| 12 | <el-card style="background-color: #F5F7FA"> | 12 | <el-card style="background-color: #F5F7FA"> |
| 13 | <!--搜索区域--> | 13 | <!--搜索区域--> |
| 14 | <div> | 14 | <div> |
| @@ -45,11 +45,13 @@ | @@ -45,11 +45,13 @@ | ||
| 45 | <el-row style="margin-top: 20px;"> | 45 | <el-row style="margin-top: 20px;"> |
| 46 | <el-button type="primary" @click="getVehicleInfoList">查询车辆信息</el-button> | 46 | <el-button type="primary" @click="getVehicleInfoList">查询车辆信息</el-button> |
| 47 | <el-button type="success" @click="addVehicleInfoFormVisible = true">增加车辆信息</el-button> | 47 | <el-button type="success" @click="addVehicleInfoFormVisible = true">增加车辆信息</el-button> |
| 48 | + | ||
| 48 | </el-row> | 49 | </el-row> |
| 49 | </div> | 50 | </div> |
| 50 | <!--车辆信息列表区域--> | 51 | <!--车辆信息列表区域--> |
| 51 | <div style="margin-top: 20px;"> | 52 | <div style="margin-top: 20px;"> |
| 52 | - <el-table :data="vehicleInfoList" border stripe highlight-current-row v-loading="listLoading" element-loading-text="拼命加载中"> | 53 | + <el-table :data="vehicleInfoList" border stripe highlight-current-row v-loading="listLoading" |
| 54 | + element-loading-text="拼命加载中"> | ||
| 53 | <el-table-column type="index" align="center"></el-table-column> | 55 | <el-table-column type="index" align="center"></el-table-column> |
| 54 | <el-table-column label="车辆类型" prop="vehicleType" align="center" width="120"> | 56 | <el-table-column label="车辆类型" prop="vehicleType" align="center" width="120"> |
| 55 | <template slot-scope="scope"> | 57 | <template slot-scope="scope"> |
| @@ -61,8 +63,10 @@ | @@ -61,8 +63,10 @@ | ||
| 61 | <span v-if="scope.row.vehicleType ==='6'">叉车</span> | 63 | <span v-if="scope.row.vehicleType ==='6'">叉车</span> |
| 62 | </template> | 64 | </template> |
| 63 | </el-table-column> | 65 | </el-table-column> |
| 64 | - <el-table-column label="车牌号码" prop="licensePlateNumber" align="center" width="130"></el-table-column> | ||
| 65 | - <el-table-column label="车辆载重/Kg" prop="vehicleLoad" align="center" width="110"></el-table-column> | 66 | + <el-table-column label="车牌号码" prop="licensePlateNumber" align="center" |
| 67 | + width="130"></el-table-column> | ||
| 68 | + <el-table-column label="车辆载重/Kg" prop="vehicleLoad" align="center" | ||
| 69 | + width="110"></el-table-column> | ||
| 66 | <el-table-column label="挂车与否" prop="isTrailer" align="center" width="110"> | 70 | <el-table-column label="挂车与否" prop="isTrailer" align="center" width="110"> |
| 67 | <template slot-scope="scope"> | 71 | <template slot-scope="scope"> |
| 68 | <span v-if="scope.row.isTrailer ==='1'">有挂车</span> | 72 | <span v-if="scope.row.isTrailer ==='1'">有挂车</span> |
| @@ -79,8 +83,10 @@ | @@ -79,8 +83,10 @@ | ||
| 79 | <span v-if="scope.row.vehicleStatus ==='5'">保养状态</span> | 83 | <span v-if="scope.row.vehicleStatus ==='5'">保养状态</span> |
| 80 | </template> | 84 | </template> |
| 81 | </el-table-column> | 85 | </el-table-column> |
| 82 | - <el-table-column label="车辆公司" prop="vehicleCompany" align="center" width="200"></el-table-column> | ||
| 83 | - <el-table-column label="行驶证号" prop="drivingLicenseNumber" align="center" width="160"></el-table-column> | 86 | + <el-table-column label="车辆公司" prop="vehicleCompany" align="center" |
| 87 | + width="200"></el-table-column> | ||
| 88 | + <el-table-column label="行驶证号" prop="drivingLicenseNumber" align="center" | ||
| 89 | + width="160"></el-table-column> | ||
| 84 | <el-table-column label="操作" width="200px" align="center" fixed="right"> | 90 | <el-table-column label="操作" width="200px" align="center" fixed="right"> |
| 85 | <template slot-scope="scope"> | 91 | <template slot-scope="scope"> |
| 86 | <!--查看按钮--> | 92 | <!--查看按钮--> |
| @@ -126,11 +132,13 @@ | @@ -126,11 +132,13 @@ | ||
| 126 | <div style="margin-left: 30px"> | 132 | <div style="margin-left: 30px"> |
| 127 | <br> | 133 | <br> |
| 128 | <el-form-item label="车牌号码:" prop="licensePlateNumber"> | 134 | <el-form-item label="车牌号码:" prop="licensePlateNumber"> |
| 129 | - <el-input v-model="addVehicleInfoForm.licensePlateNumber" clearable style="width: 300px;" | 135 | + <el-input v-model="addVehicleInfoForm.licensePlateNumber" clearable |
| 136 | + style="width: 300px;" | ||
| 130 | placeholder="请输入车牌号码"></el-input> | 137 | placeholder="请输入车牌号码"></el-input> |
| 131 | </el-form-item> | 138 | </el-form-item> |
| 132 | <el-form-item label="行驶证号:" prop="drivingLicenseNumber"> | 139 | <el-form-item label="行驶证号:" prop="drivingLicenseNumber"> |
| 133 | - <el-input v-model="addVehicleInfoForm.drivingLicenseNumber" clearable style="width: 300px;" | 140 | + <el-input v-model="addVehicleInfoForm.drivingLicenseNumber" clearable |
| 141 | + style="width: 300px;" | ||
| 134 | placeholder="请输入车辆行驶证号"></el-input> | 142 | placeholder="请输入车辆行驶证号"></el-input> |
| 135 | </el-form-item> | 143 | </el-form-item> |
| 136 | <el-form-item label="车辆类型:" prop="vehicleType"> | 144 | <el-form-item label="车辆类型:" prop="vehicleType"> |
| @@ -188,11 +196,13 @@ | @@ -188,11 +196,13 @@ | ||
| 188 | <div style="margin-left: 30px"> | 196 | <div style="margin-left: 30px"> |
| 189 | <br> | 197 | <br> |
| 190 | <el-form-item label="车牌号码:" prop="licensePlateNumber"> | 198 | <el-form-item label="车牌号码:" prop="licensePlateNumber"> |
| 191 | - <el-input v-model="editVehicleInfoForm.licensePlateNumber" clearable style="width: 300px;" | 199 | + <el-input v-model="editVehicleInfoForm.licensePlateNumber" clearable |
| 200 | + style="width: 300px;" | ||
| 192 | placeholder="请输入车牌号码"></el-input> | 201 | placeholder="请输入车牌号码"></el-input> |
| 193 | </el-form-item> | 202 | </el-form-item> |
| 194 | <el-form-item label="行驶证号:" prop="drivingLicenseNumber"> | 203 | <el-form-item label="行驶证号:" prop="drivingLicenseNumber"> |
| 195 | - <el-input v-model="editVehicleInfoForm.drivingLicenseNumber" clearable style="width: 300px;" | 204 | + <el-input v-model="editVehicleInfoForm.drivingLicenseNumber" clearable |
| 205 | + style="width: 300px;" | ||
| 196 | placeholder="请输入车辆行驶证号"></el-input> | 206 | placeholder="请输入车辆行驶证号"></el-input> |
| 197 | </el-form-item> | 207 | </el-form-item> |
| 198 | <el-form-item label="车辆类型:" prop="vehicleType"> | 208 | <el-form-item label="车辆类型:" prop="vehicleType"> |
| @@ -207,13 +217,15 @@ | @@ -207,13 +217,15 @@ | ||
| 207 | </el-select> | 217 | </el-select> |
| 208 | </el-form-item> | 218 | </el-form-item> |
| 209 | <el-form-item label="车辆载重:" prop="vehicleLoad"> | 219 | <el-form-item label="车辆载重:" prop="vehicleLoad"> |
| 210 | - <el-input-number style="width: 200px" v-model="editVehicleInfoForm.vehicleLoad" clearable | 220 | + <el-input-number style="width: 200px" v-model="editVehicleInfoForm.vehicleLoad" |
| 221 | + clearable | ||
| 211 | :min="10" :max="10000" controls-position="right"> | 222 | :min="10" :max="10000" controls-position="right"> |
| 212 | </el-input-number> | 223 | </el-input-number> |
| 213 | <span style="margin-left:5px;font-size: 18px">Kg</span> | 224 | <span style="margin-left:5px;font-size: 18px">Kg</span> |
| 214 | </el-form-item> | 225 | </el-form-item> |
| 215 | <el-form-item label="车辆状态:" prop="vehicleStatus"> | 226 | <el-form-item label="车辆状态:" prop="vehicleStatus"> |
| 216 | - <el-select v-model="editVehicleInfoForm.vehicleStatus" clearable style="width: 300px" clearable placeholder="请选择车辆状态"> | 227 | + <el-select v-model="editVehicleInfoForm.vehicleStatus" clearable style="width: 300px" |
| 228 | + clearable placeholder="请选择车辆状态"> | ||
| 217 | <el-option | 229 | <el-option |
| 218 | v-for="item in vehicleStatusList" | 230 | v-for="item in vehicleStatusList" |
| 219 | :key="item.value" | 231 | :key="item.value" |
| @@ -223,7 +235,8 @@ | @@ -223,7 +235,8 @@ | ||
| 223 | </el-select> | 235 | </el-select> |
| 224 | </el-form-item> | 236 | </el-form-item> |
| 225 | <el-form-item label="有无挂车:" prop="vehicleType"> | 237 | <el-form-item label="有无挂车:" prop="vehicleType"> |
| 226 | - <el-select v-model="editVehicleInfoForm.isTrailer" clearable style="width: 300px" clearable | 238 | + <el-select v-model="editVehicleInfoForm.isTrailer" clearable style="width: 300px" |
| 239 | + clearable | ||
| 227 | placeholder="请选择有无挂车"> | 240 | placeholder="请选择有无挂车"> |
| 228 | <el-option | 241 | <el-option |
| 229 | v-for="item in isTrailerList" | 242 | v-for="item in isTrailerList" |
| @@ -237,8 +250,9 @@ | @@ -237,8 +250,9 @@ | ||
| 237 | <el-input v-model="editVehicleInfoForm.vehicleCompany" clearable style="width: 300px;" | 250 | <el-input v-model="editVehicleInfoForm.vehicleCompany" clearable style="width: 300px;" |
| 238 | placeholder="请输入车辆公司"></el-input> | 251 | placeholder="请输入车辆公司"></el-input> |
| 239 | </el-form-item> | 252 | </el-form-item> |
| 240 | - <el-form-item label="空闲时间:" prop="freetime" > | ||
| 241 | - <el-date-picker v-model="editVehicleInfoForm.freetime" type="datetime" style="width: 300px;" | 253 | + <el-form-item label="空闲时间:" prop="freetime"> |
| 254 | + <el-date-picker v-model="editVehicleInfoForm.freetime" type="datetime" | ||
| 255 | + style="width: 300px;" | ||
| 242 | placeholder="选择调度时间"></el-date-picker> | 256 | placeholder="选择调度时间"></el-date-picker> |
| 243 | </el-form-item> | 257 | </el-form-item> |
| 244 | <br> | 258 | <br> |
| @@ -452,13 +466,11 @@ | @@ -452,13 +466,11 @@ | ||
| 452 | /** | 466 | /** |
| 453 | * 管理员端,获取车辆信息列表 | 467 | * 管理员端,获取车辆信息列表 |
| 454 | */ | 468 | */ |
| 455 | - async getVehicleInfoList() { | 469 | + getVehicleInfoList() { |
| 456 | //开启加载 | 470 | //开启加载 |
| 457 | this.listLoading = true; | 471 | this.listLoading = true; |
| 458 | - const {data: res} = await selectVehicleInfoList(this.queryInfo).catch(error => { | ||
| 459 | - this.listLoading = false; | ||
| 460 | - this.$message.error(error.toString()); | ||
| 461 | - }); | 472 | + selectVehicleInfoList(this.queryInfo).then((response) => { |
| 473 | + let res = response.data; | ||
| 462 | if (res.code !== '200') return this.$message.error('获取车辆信息列表失败'); | 474 | if (res.code !== '200') return this.$message.error('获取车辆信息列表失败'); |
| 463 | // 获取车辆信息列表数据 | 475 | // 获取车辆信息列表数据 |
| 464 | this.vehicleInfoList = res.data.list; | 476 | this.vehicleInfoList = res.data.list; |
| @@ -467,21 +479,23 @@ | @@ -467,21 +479,23 @@ | ||
| 467 | //关闭加载 | 479 | //关闭加载 |
| 468 | this.listLoading = false; | 480 | this.listLoading = false; |
| 469 | this.$message.success('获取车辆信息列表,成功'); | 481 | this.$message.success('获取车辆信息列表,成功'); |
| 482 | + }).catch(error => { | ||
| 483 | + this.listLoading = false; | ||
| 484 | + this.$message.error(error.toString()); | ||
| 485 | + }); | ||
| 470 | }, | 486 | }, |
| 471 | /** | 487 | /** |
| 472 | * 管理员端,增加车辆信息 | 488 | * 管理员端,增加车辆信息 |
| 473 | */ | 489 | */ |
| 474 | addVehicleInfo() { | 490 | addVehicleInfo() { |
| 475 | /*进行表单的预验证*/ | 491 | /*进行表单的预验证*/ |
| 476 | - this.$refs.addVehicleInfoFormRef.validate(async valid => { | 492 | + this.$refs.addVehicleInfoFormRef.validate(valid => { |
| 477 | // 未通过,表单预校验 | 493 | // 未通过,表单预校验 |
| 478 | if (!valid) return; | 494 | if (!valid) return; |
| 479 | // 通过,表单预检验,发起添加车辆信息的网络请求,开启加载 | 495 | // 通过,表单预检验,发起添加车辆信息的网络请求,开启加载 |
| 480 | this.addLoading = true; | 496 | this.addLoading = true; |
| 481 | - const {data: res} = await insertVehicleInfo(this.addVehicleInfoForm).catch(error => { | ||
| 482 | - this.addLoading = false; | ||
| 483 | - this.$message.error(error.toString()); | ||
| 484 | - }); | 497 | + insertVehicleInfo(this.addVehicleInfoForm).then((response) => { |
| 498 | + let res = response.data; | ||
| 485 | //添加调度记录信息,失败 | 499 | //添加调度记录信息,失败 |
| 486 | if (res.code !== '200') return this.$message.error('添加车辆信息,失败'); | 500 | if (res.code !== '200') return this.$message.error('添加车辆信息,失败'); |
| 487 | //关闭加载 | 501 | //关闭加载 |
| @@ -491,30 +505,28 @@ | @@ -491,30 +505,28 @@ | ||
| 491 | this.addVehicleInfoFormVisible = false; | 505 | this.addVehicleInfoFormVisible = false; |
| 492 | //刷新车辆信息列表 | 506 | //刷新车辆信息列表 |
| 493 | this.getVehicleInfoList(); | 507 | this.getVehicleInfoList(); |
| 508 | + }).catch(error => { | ||
| 509 | + this.addLoading = false; | ||
| 510 | + this.$message.error(error.toString()); | ||
| 511 | + }); | ||
| 512 | + | ||
| 494 | }) | 513 | }) |
| 495 | }, | 514 | }, |
| 496 | /** | 515 | /** |
| 497 | * 管理员端,删除车辆信息 | 516 | * 管理员端,删除车辆信息 |
| 498 | */ | 517 | */ |
| 499 | - async removeVehicleInfo(index,row) { | 518 | + removeVehicleInfo(index, row) { |
| 500 | //弹框询问是否删除车辆信息 | 519 | //弹框询问是否删除车辆信息 |
| 501 | - const confirmResult = await this.$confirm('此操作永久删除该车辆信息, 是否继续?', '警告', { | 520 | + this.$confirm('此操作永久删除该车辆信息, 是否继续?', '警告', { |
| 502 | confirmButtonText: '确定删除', | 521 | confirmButtonText: '确定删除', |
| 503 | cancelButtonText: '取消', | 522 | cancelButtonText: '取消', |
| 504 | type: 'warning' | 523 | type: 'warning' |
| 505 | } | 524 | } |
| 506 | - ).catch(error => { | ||
| 507 | - return error; | ||
| 508 | - }); | ||
| 509 | - if (confirmResult !== 'confirm') { | ||
| 510 | - return this.$message.info('已取消删除'); | ||
| 511 | - } | 525 | + ).then(() => { |
| 512 | //开启加载 | 526 | //开启加载 |
| 513 | this.delLoading = true; | 527 | this.delLoading = true; |
| 514 | - const {data: res} = await deleteVehicleInfo(row).catch(error => { | ||
| 515 | - this.delLoading = false; | ||
| 516 | - this.$message.error(error.toString()); | ||
| 517 | - }); | 528 | + deleteVehicleInfo(row).then((response) => { |
| 529 | + let res = response.data; | ||
| 518 | if (res.code !== '200') { | 530 | if (res.code !== '200') { |
| 519 | return this.$message.error('删除车辆信息,失败'); | 531 | return this.$message.error('删除车辆信息,失败'); |
| 520 | } | 532 | } |
| @@ -523,6 +535,11 @@ | @@ -523,6 +535,11 @@ | ||
| 523 | this.$message.success('删除车辆信息,成功!'); | 535 | this.$message.success('删除车辆信息,成功!'); |
| 524 | //刷新车辆信息列表 | 536 | //刷新车辆信息列表 |
| 525 | this.getVehicleInfoList(); | 537 | this.getVehicleInfoList(); |
| 538 | + }).catch(error => { | ||
| 539 | + this.delLoading = false; | ||
| 540 | + this.$message.error(error.toString()); | ||
| 541 | + }); | ||
| 542 | + }).catch(); | ||
| 526 | }, | 543 | }, |
| 527 | 544 | ||
| 528 | /** | 545 | /** |
| @@ -530,15 +547,13 @@ | @@ -530,15 +547,13 @@ | ||
| 530 | */ | 547 | */ |
| 531 | editVehicleInfo() { | 548 | editVehicleInfo() { |
| 532 | /*进行表单的预验证*/ | 549 | /*进行表单的预验证*/ |
| 533 | - this.$refs.editVehicleInfoFormRef.validate(async valid => { | 550 | + this.$refs.editVehicleInfoFormRef.validate(valid => { |
| 534 | // 未通过,表单预校验 | 551 | // 未通过,表单预校验 |
| 535 | if (!valid) return; | 552 | if (!valid) return; |
| 536 | // 通过,表单预校验,开启加载 | 553 | // 通过,表单预校验,开启加载 |
| 537 | this.editLoading = true; | 554 | this.editLoading = true; |
| 538 | - const {data: res} = await updateVehicleInfo(this.editVehicleInfoForm).catch(error => { | ||
| 539 | - this.editLoading = false; | ||
| 540 | - this.$message.error(error.toString()); | ||
| 541 | - }); | 555 | + updateVehicleInfo(this.editVehicleInfoForm).then((response) => { |
| 556 | + let res = response.data; | ||
| 542 | if (res.code !== '200') { | 557 | if (res.code !== '200') { |
| 543 | return this.$message.error('修改车辆信息,失败'); | 558 | return this.$message.error('修改车辆信息,失败'); |
| 544 | } | 559 | } |
| @@ -549,6 +564,10 @@ | @@ -549,6 +564,10 @@ | ||
| 549 | this.editDialogVisible = false; | 564 | this.editDialogVisible = false; |
| 550 | //刷新车辆信息列表 | 565 | //刷新车辆信息列表 |
| 551 | this.getVehicleInfoList(); | 566 | this.getVehicleInfoList(); |
| 567 | + }).catch(error => { | ||
| 568 | + this.editLoading = false; | ||
| 569 | + this.$message.error(error.toString()); | ||
| 570 | + }); | ||
| 552 | }) | 571 | }) |
| 553 | }, | 572 | }, |
| 554 | 573 | ||
| @@ -567,7 +586,7 @@ | @@ -567,7 +586,7 @@ | ||
| 567 | /** | 586 | /** |
| 568 | * 打开编辑车辆信息对话框 | 587 | * 打开编辑车辆信息对话框 |
| 569 | */ | 588 | */ |
| 570 | - showEditDialogVisible(index,row) { | 589 | + showEditDialogVisible(index, row) { |
| 571 | this.editVehicleInfoForm = Object.assign({}, row); | 590 | this.editVehicleInfoForm = Object.assign({}, row); |
| 572 | this.editDialogVisible = true; | 591 | this.editDialogVisible = true; |
| 573 | }, | 592 | }, |
-
请 注册 或 登录 后发表评论