From cf7a44ba583f045bab3a642c60b66b214bc1ef7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=8C=E6=B5=B7?= <963808678@qq.com> Date: Mon, 24 Apr 2023 09:43:11 +0800 Subject: [PATCH] 4/24 --- src/api/modular/main/SendCar.js | 20 ++++ src/views/main/SendCar/addForm.vue | 3 +- .../main/Taskmanage/TaskmanageList/index.vue | 109 ++++++++++-------- 3 files changed, 83 insertions(+), 49 deletions(-) diff --git a/src/api/modular/main/SendCar.js b/src/api/modular/main/SendCar.js index 3acd314..ba347bc 100644 --- a/src/api/modular/main/SendCar.js +++ b/src/api/modular/main/SendCar.js @@ -212,6 +212,16 @@ export function TaskManageTruckCancelDispatchBatch(parameter) { data: parameter }) } +/** + * 批量派车通过任务ID + */ +export function TaskManageTruckCancelDispatchBatchByTask(parameter) { + return axios({ + url: '/TaskManageTruck/CancelDispatchBatchByTask', + method: 'post', + data: parameter + }) +} /** * 批量派车 */ @@ -222,6 +232,16 @@ export function TaskManageTruckSendDispatchBatch(parameter) { data: parameter }) } +/** + * 批量派车通过任务ID + */ +export function TaskManageTruckSendDispatchBatchByTask(parameter) { + return axios({ + url: '/TaskManageTruck/SendDispatchBatchByTask', + method: 'post', + data: parameter + }) +} /** * 派车 */ diff --git a/src/views/main/SendCar/addForm.vue b/src/views/main/SendCar/addForm.vue index b958b6a..9ed7b6b 100644 --- a/src/views/main/SendCar/addForm.vue +++ b/src/views/main/SendCar/addForm.vue @@ -132,7 +132,7 @@ - + @@ -1038,6 +1038,7 @@ export default { }) sysUserQueryUserByPos({ pos: 'PCDD' }).then(res => { this.dispatcherIdData = res.data + console.log(this.dispatcherIdData) }) GetCtn({ KeyWord: '' }).then(res => { this.ctnList = res.data diff --git a/src/views/main/Taskmanage/TaskmanageList/index.vue b/src/views/main/Taskmanage/TaskmanageList/index.vue index ac703c9..b44ba4f 100644 --- a/src/views/main/Taskmanage/TaskmanageList/index.vue +++ b/src/views/main/Taskmanage/TaskmanageList/index.vue @@ -483,8 +483,8 @@ import { TaskManageTruckGetInfoByTaskId, TaskManageTruckPrintTemplateWithHistoryList, TaskManageTruckPrint, - TaskManageTruckSendDispatchBatch, - TaskManageTruckCancelDispatchBatch + TaskManageTruckSendDispatchBatchByTask, + TaskManageTruckCancelDispatchBatchByTask } from '@/api/modular/main/SendCar' export default { name: 'TaskmanageList', @@ -687,30 +687,37 @@ export default { this.$message.error('请选择数据') return false } - let ApiArr = [] - pkIdArr.forEach((item, index) => { - TaskManageTruckGetInfoByTaskId({ taskPkId: item }) - .then(res => { - if (res.data.succ) { - ApiArr.push(res.data.ext.pK_ID) - if (index + 1 == pkIdArr.length) { - TaskManageTruckSendDispatchBatch(ApiArr).then(res => { - if (res.data.succ) { - this.$message.success('派车成功') - } else { - this.$message.error(`派车失败,${res.data.msg}`) - } - }) - } - } else { - this.$message.error(`${res.data.msg}`) - } - this.confirmLoading = false - }) - .catch(() => { - this.confirmLoading = false - }) + TaskManageTruckSendDispatchBatchByTask(pkIdArr).then(res => { + if (res.data.succ) { + this.$message.success('派车成功') + } else { + this.$message.error(`派车失败,${res.data.msg}`) + } }) + // let ApiArr = [] + // pkIdArr.forEach((item, index) => { + // TaskManageTruckGetInfoByTaskId({ taskPkId: item }) + // .then(res => { + // if (res.data.succ) { + // ApiArr.push(res.data.ext.pK_ID) + // if (index + 1 == pkIdArr.length) { + // TaskManageTruckSendDispatchBatch(ApiArr).then(res => { + // if (res.data.succ) { + // this.$message.success('派车成功') + // } else { + // this.$message.error(`派车失败,${res.data.msg}`) + // } + // }) + // } + // } else { + // this.$message.error(`${res.data.msg}`) + // } + // this.confirmLoading = false + // }) + // .catch(() => { + // this.confirmLoading = false + // }) + // }) }, CancelSendCar() { const select = this.$refs.xGrid.getCheckboxRecords() @@ -721,30 +728,36 @@ export default { this.$message.error('请选择数据') return false } - let ApiArr = [] - pkIdArr.forEach((item, index) => { - TaskManageTruckGetInfoByTaskId({ taskPkId: item }) - .then(res => { - if (res.data.succ) { - ApiArr.push(res.data.ext.pK_ID) - if (index + 1 == pkIdArr.length) { - TaskManageTruckCancelDispatchBatch(ApiArr).then(res => { - if (res.data.succ) { - this.$message.success('派车成功') - } else { - this.$message.error(`派车失败,${res.data.msg}`) - } - }) - } - } else { - this.$message.error(`${res.data.msg}`) - } - this.confirmLoading = false - }) - .catch(() => { - this.confirmLoading = false - }) + TaskManageTruckCancelDispatchBatchByTask(pkIdArr).then(res => { + if (res.data.succ) { + this.$message.success('取消派车成功') + } else { + this.$message.error(`取消派车失败,${res.data.msg}`) + } }) + // pkIdArr.forEach((item, index) => { + // TaskManageTruckGetInfoByTaskId({ taskPkId: item }) + // .then(res => { + // if (res.data.succ) { + // ApiArr.push(res.data.ext.pK_ID) + // if (index + 1 == pkIdArr.length) { + // TaskManageTruckCancelDispatchBatch(ApiArr).then(res => { + // if (res.data.succ) { + // this.$message.success('派车成功') + // } else { + // this.$message.error(`派车失败,${res.data.msg}`) + // } + // }) + // } + // } else { + // this.$message.error(`${res.data.msg}`) + // } + // this.confirmLoading = false + // }) + // .catch(() => { + // this.confirmLoading = false + // }) + // }) }, onSelect(selectedKeys, info) { console.log('selected', selectedKeys, info)