正在显示
4 个修改的文件
包含
325 行增加
和
282 行删除
@@ -210,7 +210,7 @@ | @@ -210,7 +210,7 @@ | ||
210 | :visible.sync="viewDialogVisible" | 210 | :visible.sync="viewDialogVisible" |
211 | width="50%" @close="showDialogClosed"> | 211 | width="50%" @close="showDialogClosed"> |
212 | <!-- 表单显示区域 :rules="dispatchFormRules" --> | 212 | <!-- 表单显示区域 :rules="dispatchFormRules" --> |
213 | - <el-form :model="showForm" ref="showFormRef" | 213 | + <el-form :model="showForm" ref="showFormRef" |
214 | style="margin-left:10%;margin-right:10%;background-color: #F5F7FA"> | 214 | style="margin-left:10%;margin-right:10%;background-color: #F5F7FA"> |
215 | 215 | ||
216 | <div style="margin-left: 30px"> | 216 | <div style="margin-left: 30px"> |
@@ -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,105 +567,110 @@ | @@ -567,105 +567,110 @@ | ||
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 => { | 572 | + selectDispatchNoteList(this.queryInfo).then((response) => { |
573 | + let res = response.data; | ||
574 | + if (res.code !== '200') { | ||
575 | + this.listLoading = false; | ||
576 | + return this.$message.error('获取车辆调度列表失败'); | ||
577 | + } | ||
578 | + // 获取车辆调度列表数据 | ||
579 | + this.DispatchNoteList = res.data.list; | ||
580 | + // 获取列表的总记录数 | ||
581 | + this.total = res.data.total; | ||
582 | + this.listLoading = false; | ||
583 | + this.$message.success('获取车辆调度列表,成功!'); | ||
584 | + }).catch(error => { | ||
573 | this.listLoading = false; | 585 | this.listLoading = false; |
574 | this.$message.error(error.toString()); | 586 | this.$message.error(error.toString()); |
575 | }); | 587 | }); |
576 | - if (res.code !== '200') { | ||
577 | - this.listLoading = false; | ||
578 | - return this.$message.error('获取车辆调度列表失败'); | ||
579 | - } | ||
580 | - // 获取车辆调度列表数据 | ||
581 | - this.DispatchNoteList = res.data.list; | ||
582 | - // 获取列表的总记录数 | ||
583 | - this.total = res.data.total; | ||
584 | - this.listLoading = false; | ||
585 | - this.$message.success('获取车辆调度列表,成功!'); | ||
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 => { | 594 | + dispatch(this.dispatchForm).then((response) => { |
595 | + let res = response.data; | ||
596 | + if (res.code !== '200') { | ||
597 | + this.dispatchLoading = false; | ||
598 | + return this.$message.error('车辆繁忙,请稍后重试'); | ||
599 | + } | ||
600 | + //关闭加载 | ||
601 | + this.dispatchLoading = false; | ||
602 | + this.$message.success('调度车辆成功!'); | ||
603 | + //调度成功,隐藏对话框 | ||
604 | + this.dispatchFormVisible = false; | ||
605 | + /* 将调度车辆信息=>查询列表 */ | ||
606 | + // 用户名称 | ||
607 | + this.queryInfo.userName = this.dispatchForm.userName; | ||
608 | + // 联系方式 | ||
609 | + this.queryInfo.userMobile = this.dispatchForm.userMobile; | ||
610 | + // 调度业务类型 | ||
611 | + this.queryInfo.dispatchType = this.dispatchForm.dispatchType; | ||
612 | + // 创建时间为当前时间(需留意) | ||
613 | + this.queryInfo.gmtCreate = new Date(); | ||
614 | + //刷新车辆调度列表 | ||
615 | + this.getDispatchNodeList(); | ||
616 | + }).catch(error => { | ||
593 | this.dispatchLoading = false; | 617 | this.dispatchLoading = false; |
594 | this.$message.error(error.toString()); | 618 | this.$message.error(error.toString()); |
595 | }); | 619 | }); |
596 | - if (res.code !== '200') { | ||
597 | - this.dispatchLoading = false; | ||
598 | - return this.$message.error('车辆繁忙,请稍后重试'); | ||
599 | - } | ||
600 | - //关闭加载 | ||
601 | - this.dispatchLoading = false; | ||
602 | - this.$message.success('调度车辆成功!'); | ||
603 | - //调度成功,隐藏对话框 | ||
604 | - this.dispatchFormVisible = false; | ||
605 | - /* 将调度车辆信息=>查询列表 */ | ||
606 | - // 用户名称 | ||
607 | - this.queryInfo.userName = this.dispatchForm.userName; | ||
608 | - // 联系方式 | ||
609 | - this.queryInfo.userMobile = this.dispatchForm.userMobile; | ||
610 | - // 调度业务类型 | ||
611 | - this.queryInfo.dispatchType = this.dispatchForm.dispatchType; | ||
612 | - // 创建时间为当前时间(需留意) | ||
613 | - this.queryInfo.gmtCreate = new Date(); | ||
614 | - //刷新车辆调度列表 | ||
615 | - this.getDispatchNodeList(); | ||
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 | - } | ||
633 | - //开启加载 | ||
634 | - this.cancelLoading = true; | ||
635 | - const {data: res} = await cancel(row).catch(error => { | ||
636 | - //关闭加载 | ||
637 | - this.cancelLoading = false; | ||
638 | - this.$message.error(error.toString()); | ||
639 | - }); | ||
640 | - if (res.code !== '200') { | ||
641 | - this.cancelLoading = false; | ||
642 | - return this.$message.error('取消车辆调度,失败!请人工介入'); | ||
643 | - } | ||
644 | - //关闭加载 | ||
645 | - this.cancelLoading = false; | ||
646 | - this.$message.success('取消调度车辆,成功!'); | ||
647 | - //刷新车辆调度列表 | ||
648 | - this.getDispatchNodeList(); | 631 | + ).then(() => { |
632 | + //开启加载 | ||
633 | + this.cancelLoading = true; | ||
634 | + cancel(row).then((response) => { | ||
635 | + let res = response.data; | ||
636 | + if (res.code !== '200') { | ||
637 | + this.cancelLoading = false; | ||
638 | + return this.$message.error('取消车辆调度,失败!请人工介入'); | ||
639 | + } | ||
640 | + //关闭加载 | ||
641 | + this.cancelLoading = false; | ||
642 | + this.$message.success('取消调度车辆,成功!'); | ||
643 | + //刷新车辆调度列表 | ||
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 | + getUserInfo(param) { |
656 | + getUser(param).then((response) => { | ||
657 | + let res = response.data; | ||
658 | + if (res.code !== '200') { | ||
659 | + return this.$message.error('请刷新一下界面!'); | ||
660 | + } | ||
661 | + if (res.data.list.length === 0) { | ||
662 | + return this.$message.error('请刷新一下界面!'); | ||
663 | + } | ||
664 | + if (res.data.list[0].mobilephone === null || res.data.list[0].mobilephone === '') { | ||
665 | + return this.$message.error('请填写您的手机号码'); | ||
666 | + } | ||
667 | + this.queryInfo.userMobile = res.data.list[0].mobilephone; | ||
668 | + this.dispatchForm.userMobile = res.data.list[0].mobilephone; | ||
669 | + this.$message.success('欢迎使用,车辆调度系统!'); | ||
670 | + }).catch((error) => { | ||
655 | this.$message.error(error.toString()); | 671 | this.$message.error(error.toString()); |
656 | }); | 672 | }); |
657 | - if (res.code !== '200') { | ||
658 | - return this.$message.error('请刷新一下界面!'); | ||
659 | - } | ||
660 | - if (res.data.list.length === 0) { | ||
661 | - return this.$message.error('请刷新一下界面!'); | ||
662 | - } | ||
663 | - if (res.data.list[0].mobilephone === null || res.data.list[0].mobilephone === '') { | ||
664 | - return this.$message.error('请填写您的手机号码'); | ||
665 | - } | ||
666 | - this.queryInfo.userMobile = res.data.list[0].mobilephone; | ||
667 | - this.dispatchForm.userMobile = res.data.list[0].mobilephone; | ||
668 | - this.$message.success('欢迎使用,车辆调度系统!'); | 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,139 +631,149 @@ | @@ -631,139 +631,149 @@ | ||
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 => { | 637 | + selectDispatchNoteList(this.queryInfo).then((response) => { |
638 | + let res = response.data; | ||
639 | + if (res.code !== '200') return this.$message.error('获取车辆调度列表失败'); | ||
640 | + // 获取车辆调度列表数据 | ||
641 | + this.DispatchNoteList = res.data.list; | ||
642 | + // 获取列表的总记录数 | ||
643 | + this.total = res.data.total; | ||
644 | + //关闭加载 | ||
645 | + this.listLoading = false; | ||
646 | + this.$message.success('获取车辆调度列表,成功'); | ||
647 | + }).catch(error => { | ||
638 | this.listLoading = false; | 648 | this.listLoading = false; |
639 | this.$message.error(error.toString()); | 649 | this.$message.error(error.toString()); |
640 | }); | 650 | }); |
641 | - if (res.code !== '200') return this.$message.error('获取车辆调度列表失败'); | ||
642 | - // 获取车辆调度列表数据 | ||
643 | - this.DispatchNoteList = res.data.list; | ||
644 | - // 获取列表的总记录数 | ||
645 | - this.total = res.data.total; | ||
646 | - //关闭加载 | ||
647 | - this.listLoading = false; | ||
648 | - this.$message.success('获取车辆调度列表,成功'); | ||
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 => { | 662 | + insertDispatchNote(this.addDispatchNodeForm).then((response) => { |
663 | + let res = response.data; | ||
664 | + //添加调度记录信息,失败 | ||
665 | + if (res.code !== '200') return this.$message.error('添加调度记录信息,失败'); | ||
666 | + //添加调度记录信息,成功 | ||
667 | + this.$message.success('添加调度记录信息,成功'); | ||
668 | + //关闭加载 | ||
669 | + this.addLoading = false; | ||
670 | + //隐藏对话框 | ||
671 | + this.addDispatchNodeFormVisible = false; | ||
672 | + //刷新车辆调度记录列表 | ||
673 | + this.getDispatchNodeList(); | ||
674 | + }).catch(error => { | ||
661 | this.addLoading = false; | 675 | this.addLoading = false; |
662 | this.$message.error(error.toString()); | 676 | this.$message.error(error.toString()); |
663 | }); | 677 | }); |
664 | - //添加调度记录信息,失败 | ||
665 | - if (res.code !== '200') return this.$message.error('添加调度记录信息,失败'); | ||
666 | - //添加调度记录信息,成功 | ||
667 | - this.$message.success('添加调度记录信息,成功'); | ||
668 | - //关闭加载 | ||
669 | - this.addLoading = false; | ||
670 | - //隐藏对话框 | ||
671 | - this.addDispatchNodeFormVisible = false; | ||
672 | - //刷新车辆调度记录列表 | ||
673 | - this.getDispatchNodeList(); | ||
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 | - //开启加载 | ||
691 | - this.delLoading = true; | ||
692 | - const {data: res} = await deleteDispatchNote(row).catch(error => { | ||
693 | - this.delLoading = false; | ||
694 | - this.$message.error(error.toString()); | ||
695 | - }); | ||
696 | - if (res.code !== '200') { | ||
697 | - return this.$message.error('删除车辆调度记录,失败'); | ||
698 | - } | ||
699 | - this.$message.success('删除车辆调度记录,成功!'); | ||
700 | - this.delLoading = false; | ||
701 | - //刷新车辆调度记录列表 | ||
702 | - this.getDispatchNodeList(); | 690 | + ).then(() => { |
691 | + //开启加载 | ||
692 | + this.delLoading = true; | ||
693 | + deleteDispatchNote(row).then((response) => { | ||
694 | + let res = response.data; | ||
695 | + if (res.code !== '200') { | ||
696 | + return this.$message.error('删除车辆调度记录,失败'); | ||
697 | + } | ||
698 | + this.$message.success('删除车辆调度记录,成功!'); | ||
699 | + this.delLoading = false; | ||
700 | + //刷新车辆调度记录列表 | ||
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 => { | 718 | + updateDispatchNote(this.editForm).then((response) => { |
719 | + let res = response.data; | ||
720 | + if (res.code !== '200') { | ||
721 | + return this.$message.error('修改车辆调度记录信息,失败'); | ||
722 | + } | ||
723 | + this.$message.success('修改车辆调度记录信息,成功!'); | ||
724 | + //关闭加载 | ||
725 | + this.editLoading = false; | ||
726 | + //关闭编辑车辆调度记录对话框 | ||
727 | + this.viewDialogVisible = false; | ||
728 | + //刷新车辆调度列表 | ||
729 | + this.getDispatchNodeList(); | ||
730 | + }).catch(error => { | ||
715 | this.editLoading = false; | 731 | this.editLoading = false; |
716 | this.$message.error(error.toString()); | 732 | this.$message.error(error.toString()); |
717 | }); | 733 | }); |
718 | - if (res.code !== '200') { | ||
719 | - return this.$message.error('修改车辆调度记录信息,失败'); | ||
720 | - } | ||
721 | - this.$message.success('修改车辆调度记录信息,成功!'); | ||
722 | - //关闭加载 | ||
723 | - this.editLoading = false; | ||
724 | - //关闭编辑车辆调度记录对话框 | ||
725 | - this.viewDialogVisible = false; | ||
726 | - //刷新车辆调度列表 | ||
727 | - this.getDispatchNodeList(); | ||
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 => { | 742 | + startTask(row).then((response) => { |
743 | + let res = response.data; | ||
744 | + if (res.code !== '200') { | ||
745 | + return this.$message.error('手动开始调度任务,失败'); | ||
746 | + } | ||
747 | + //关闭加载 | ||
748 | + this.beginLoading = false; | ||
749 | + this.$message.success('手动开始调度任务,成功!'); | ||
750 | + //刷新车辆调度列表 | ||
751 | + this.getDispatchNodeList(); | ||
752 | + }).catch(error => { | ||
737 | this.beginLoading = false; | 753 | this.beginLoading = false; |
738 | this.$message.error(error.toString()); | 754 | this.$message.error(error.toString()); |
739 | }); | 755 | }); |
740 | - if (res.code !== '200') { | ||
741 | - return this.$message.error('手动开始调度任务,失败'); | ||
742 | - } | ||
743 | - //关闭加载 | ||
744 | - this.beginLoading = false; | ||
745 | - this.$message.success('手动开始调度任务,成功!'); | ||
746 | - //刷新车辆调度列表 | ||
747 | - this.getDispatchNodeList(); | ||
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 => { | 763 | + completeTask(row).then((response) => { |
764 | + let res = response.data; | ||
765 | + if (res.code !== '200') { | ||
766 | + return this.$message.error('手动完成调度任务,失败'); | ||
767 | + } | ||
768 | + //关闭加载 | ||
769 | + this.endLoading = false; | ||
770 | + this.$message.success('手动完成调度任务,成功!'); | ||
771 | + //刷新车辆调度列表 | ||
772 | + this.getDispatchNodeList(); | ||
773 | + }).catch(error => { | ||
756 | this.endLoading = false; | 774 | this.endLoading = false; |
757 | this.$message.error(error.toString()); | 775 | this.$message.error(error.toString()); |
758 | }); | 776 | }); |
759 | - if (res.code !== '200') { | ||
760 | - return this.$message.error('手动完成调度任务,失败'); | ||
761 | - } | ||
762 | - //关闭加载 | ||
763 | - this.endLoading = false; | ||
764 | - this.$message.success('手动完成调度任务,成功!'); | ||
765 | - //刷新车辆调度列表 | ||
766 | - this.getDispatchNodeList(); | ||
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,99 +425,106 @@ | @@ -423,99 +425,106 @@ | ||
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 => { | 431 | + selectDriverInfoList(this.queryInfo).then((response) => { |
432 | + let res = response.data; | ||
433 | + if (res.code !== '200') return this.$message.error('获取驾驶员信息列表,失败'); | ||
434 | + // 获取驾驶员信息列表数据 | ||
435 | + this.driverInfoList = res.data.list; | ||
436 | + // 获取列表的总记录数 | ||
437 | + this.total = res.data.total; | ||
438 | + //关闭加载 | ||
439 | + this.listLoading = false; | ||
440 | + this.$message.success('获取驾驶员信息列表,成功'); | ||
441 | + }).catch(error => { | ||
430 | this.listLoading = false; | 442 | this.listLoading = false; |
431 | this.$message.error(error.toString()); | 443 | this.$message.error(error.toString()); |
432 | }); | 444 | }); |
433 | - if (res.code !== '200') return this.$message.error('获取驾驶员信息列表,失败'); | ||
434 | - // 获取驾驶员信息列表数据 | ||
435 | - this.driverInfoList = res.data.list; | ||
436 | - // 获取列表的总记录数 | ||
437 | - this.total = res.data.total; | ||
438 | - //关闭加载 | ||
439 | - this.listLoading = false; | ||
440 | - this.$message.success('获取驾驶员信息列表,成功'); | 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 => { | 457 | + insertDriverInfo(this.addDriverInfoForm).then((response) => { |
458 | + let res = response.data; | ||
459 | + if (res.code !== '200') return this.$message.error('添加驾驶员信息,失败'); | ||
460 | + //关闭加载 | ||
461 | + this.addLoading = false; | ||
462 | + this.$message.success('添加驾驶员信息,成功'); | ||
463 | + //关闭对话框 | ||
464 | + this.addDriverInfoFormVisible = false; | ||
465 | + //刷新驾驶员信息列表 | ||
466 | + this.getDriverInfoList(); | ||
467 | + }).catch(error => { | ||
453 | this.addLoading = false; | 468 | this.addLoading = false; |
454 | this.$message.error(error.toString()); | 469 | this.$message.error(error.toString()); |
455 | }); | 470 | }); |
456 | - if (res.code !== '200') return this.$message.error('添加驾驶员信息,失败'); | ||
457 | - //关闭加载 | ||
458 | - this.addLoading = false; | ||
459 | - this.$message.success('添加驾驶员信息,成功'); | ||
460 | - //关闭对话框 | ||
461 | - this.addDriverInfoFormVisible = false; | ||
462 | - //刷新驾驶员信息列表 | ||
463 | - this.getDriverInfoList(); | ||
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 | - } | ||
480 | - //开启加载 | ||
481 | - this.delLoading = true; | ||
482 | - const {data: res} = await deleteDriverInfo(row).catch(error => { | ||
483 | - this.delLoading = false; | ||
484 | - this.$message.error(error.toString()); | ||
485 | - }); | ||
486 | - if (res.code !== '200') { | ||
487 | - return this.$message.error('删除驾驶员信息,失败'); | ||
488 | - } | ||
489 | - //关闭加载 | ||
490 | - this.delLoading = false; | ||
491 | - this.$message.success('删除驾驶员信息,成功!'); | ||
492 | - //刷新驾驶员信息列表 | ||
493 | - this.getDriverInfoList(); | 483 | + ).then(() => { |
484 | + //开启加载 | ||
485 | + this.delLoading = true; | ||
486 | + deleteDriverInfo(row).then((response) => { | ||
487 | + let res = response.data; | ||
488 | + if (res.code !== '200') { | ||
489 | + return this.$message.error('删除驾驶员信息,失败'); | ||
490 | + } | ||
491 | + //关闭加载 | ||
492 | + this.delLoading = false; | ||
493 | + this.$message.success('删除驾驶员信息,成功!'); | ||
494 | + //刷新驾驶员信息列表 | ||
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 => { | 512 | + updateDriverInfo(this.editDriverInfoForm).then((response) => { |
513 | + let res = response.data; | ||
514 | + if (res.code !== '200') { | ||
515 | + return this.$message.error('修改驾驶员信息,失败'); | ||
516 | + } | ||
517 | + //关闭加载 | ||
518 | + this.editLoading = false; | ||
519 | + this.$message.success('修改驾驶员信息,成功!'); | ||
520 | + // 关闭,编辑驾驶员信息对话框 | ||
521 | + this.editDialogVisible = false; | ||
522 | + //刷新驾驶员信息列表 | ||
523 | + this.getDriverInfoList(); | ||
524 | + }).catch(error => { | ||
506 | this.editLoading = false; | 525 | this.editLoading = false; |
507 | this.$message.error(error.toString()); | 526 | this.$message.error(error.toString()); |
508 | }); | 527 | }); |
509 | - if (res.code !== '200') { | ||
510 | - return this.$message.error('修改驾驶员信息,失败'); | ||
511 | - } | ||
512 | - //关闭加载 | ||
513 | - this.editLoading = false; | ||
514 | - this.$message.success('修改驾驶员信息,成功!'); | ||
515 | - // 关闭,编辑驾驶员信息对话框 | ||
516 | - this.editDialogVisible = false; | ||
517 | - //刷新驾驶员信息列表 | ||
518 | - this.getDriverInfoList(); | ||
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,77 +466,80 @@ | @@ -452,77 +466,80 @@ | ||
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 => { | 472 | + selectVehicleInfoList(this.queryInfo).then((response) => { |
473 | + let res = response.data; | ||
474 | + if (res.code !== '200') return this.$message.error('获取车辆信息列表失败'); | ||
475 | + // 获取车辆信息列表数据 | ||
476 | + this.vehicleInfoList = res.data.list; | ||
477 | + // 获取列表的总记录数 | ||
478 | + this.total = res.data.total; | ||
479 | + //关闭加载 | ||
480 | + this.listLoading = false; | ||
481 | + this.$message.success('获取车辆信息列表,成功'); | ||
482 | + }).catch(error => { | ||
459 | this.listLoading = false; | 483 | this.listLoading = false; |
460 | this.$message.error(error.toString()); | 484 | this.$message.error(error.toString()); |
461 | }); | 485 | }); |
462 | - if (res.code !== '200') return this.$message.error('获取车辆信息列表失败'); | ||
463 | - // 获取车辆信息列表数据 | ||
464 | - this.vehicleInfoList = res.data.list; | ||
465 | - // 获取列表的总记录数 | ||
466 | - this.total = res.data.total; | ||
467 | - //关闭加载 | ||
468 | - this.listLoading = false; | ||
469 | - this.$message.success('获取车辆信息列表,成功'); | ||
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 => { | 497 | + insertVehicleInfo(this.addVehicleInfoForm).then((response) => { |
498 | + let res = response.data; | ||
499 | + //添加调度记录信息,失败 | ||
500 | + if (res.code !== '200') return this.$message.error('添加车辆信息,失败'); | ||
501 | + //关闭加载 | ||
502 | + this.addLoading = false; | ||
503 | + this.$message.success('添加调度记录信息,成功'); | ||
504 | + //隐藏对话框 | ||
505 | + this.addVehicleInfoFormVisible = false; | ||
506 | + //刷新车辆信息列表 | ||
507 | + this.getVehicleInfoList(); | ||
508 | + }).catch(error => { | ||
482 | this.addLoading = false; | 509 | this.addLoading = false; |
483 | this.$message.error(error.toString()); | 510 | this.$message.error(error.toString()); |
484 | }); | 511 | }); |
485 | - //添加调度记录信息,失败 | ||
486 | - if (res.code !== '200') return this.$message.error('添加车辆信息,失败'); | ||
487 | - //关闭加载 | ||
488 | - this.addLoading = false; | ||
489 | - this.$message.success('添加调度记录信息,成功'); | ||
490 | - //隐藏对话框 | ||
491 | - this.addVehicleInfoFormVisible = false; | ||
492 | - //刷新车辆信息列表 | ||
493 | - this.getVehicleInfoList(); | 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 | - } | ||
512 | - //开启加载 | ||
513 | - this.delLoading = true; | ||
514 | - const {data: res} = await deleteVehicleInfo(row).catch(error => { | ||
515 | - this.delLoading = false; | ||
516 | - this.$message.error(error.toString()); | ||
517 | - }); | ||
518 | - if (res.code !== '200') { | ||
519 | - return this.$message.error('删除车辆信息,失败'); | ||
520 | - } | ||
521 | - //关闭加载 | ||
522 | - this.delLoading = false; | ||
523 | - this.$message.success('删除车辆信息,成功!'); | ||
524 | - //刷新车辆信息列表 | ||
525 | - this.getVehicleInfoList(); | 525 | + ).then(() => { |
526 | + //开启加载 | ||
527 | + this.delLoading = true; | ||
528 | + deleteVehicleInfo(row).then((response) => { | ||
529 | + let res = response.data; | ||
530 | + if (res.code !== '200') { | ||
531 | + return this.$message.error('删除车辆信息,失败'); | ||
532 | + } | ||
533 | + //关闭加载 | ||
534 | + this.delLoading = false; | ||
535 | + this.$message.success('删除车辆信息,成功!'); | ||
536 | + //刷新车辆信息列表 | ||
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,25 +547,27 @@ | @@ -530,25 +547,27 @@ | ||
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 => { | 555 | + updateVehicleInfo(this.editVehicleInfoForm).then((response) => { |
556 | + let res = response.data; | ||
557 | + if (res.code !== '200') { | ||
558 | + return this.$message.error('修改车辆信息,失败'); | ||
559 | + } | ||
560 | + //关闭加载 | ||
561 | + this.editLoading = false; | ||
562 | + this.$message.success('修改车辆信息,成功!'); | ||
563 | + //关闭编辑车辆信息对话框 | ||
564 | + this.editDialogVisible = false; | ||
565 | + //刷新车辆信息列表 | ||
566 | + this.getVehicleInfoList(); | ||
567 | + }).catch(error => { | ||
539 | this.editLoading = false; | 568 | this.editLoading = false; |
540 | this.$message.error(error.toString()); | 569 | this.$message.error(error.toString()); |
541 | }); | 570 | }); |
542 | - if (res.code !== '200') { | ||
543 | - return this.$message.error('修改车辆信息,失败'); | ||
544 | - } | ||
545 | - //关闭加载 | ||
546 | - this.editLoading = false; | ||
547 | - this.$message.success('修改车辆信息,成功!'); | ||
548 | - //关闭编辑车辆信息对话框 | ||
549 | - this.editDialogVisible = false; | ||
550 | - //刷新车辆信息列表 | ||
551 | - this.getVehicleInfoList(); | ||
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 | }, |
-
请 注册 或 登录 后发表评论