【类 型】:refactor
【主 题】:提交任务 【描 述】: [原因]:重置多航线绑定 [过程]:提交任务 从runing字段判断 是否有注册空位 有的话注册 并且找出对应航线的索引 (用于向飞机提交航点) [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
d65d94c68c
commit
86cecc9e34
@ -466,11 +466,33 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
let routeData
|
let routeData
|
||||||
|
let newRuning // 执行飞机注册后的 running字段信息
|
||||||
try {
|
try {
|
||||||
|
/* 站点正在执行任务runing 注册 */
|
||||||
|
const runing = this.currentOrder.runing.split(',')
|
||||||
|
let foundEmpty = false
|
||||||
|
let selIndex // 记录执行飞机注册的索引 此索引对应 要使用的航线的索引
|
||||||
|
runing.some((item, index, arr) => {
|
||||||
|
if (item === '') {
|
||||||
|
arr[index] = this.planesId
|
||||||
|
foundEmpty = true
|
||||||
|
selIndex = index
|
||||||
|
return true // 找到空位后退出循环
|
||||||
|
}
|
||||||
|
})
|
||||||
|
newRuning = runing.join(',')
|
||||||
|
if (!foundEmpty) {
|
||||||
|
this.$message({
|
||||||
|
type: 'warning',
|
||||||
|
message: '此站点执行飞机已达上线,如果想执行请为该站点绑定更多航线'
|
||||||
|
})
|
||||||
|
return // 退出外层函数
|
||||||
|
}
|
||||||
|
/* 航线选择 */
|
||||||
const bindRoute = this.currentOrder.bind_route.split(',')
|
const bindRoute = this.currentOrder.bind_route.split(',')
|
||||||
routeData = this.routeList.find(element => element.id === bindRoute[0]).route_data
|
routeData = this.routeList.find(element => element.id === bindRoute[selIndex]).route_data
|
||||||
routeData = JSON.parse(routeData)// 反序列化
|
routeData = JSON.parse(routeData)// 反序列化
|
||||||
/* 处理声音航点 航点里面的表达式 如$food_sn$ 正则替换成订单对应的字段 */
|
// 处理声音航点 航点里面的表达式 如$food_sn$ 正则替换成订单对应的字段
|
||||||
this.currentOrder.telTail = this.currentOrder.tel.substr(-4)// 手动加一个手机尾号telTail字段 从 tel字段截取后四位
|
this.currentOrder.telTail = this.currentOrder.tel.substr(-4)// 手动加一个手机尾号telTail字段 从 tel字段截取后四位
|
||||||
routeData.tasks.forEach((x, index) => {
|
routeData.tasks.forEach((x, index) => {
|
||||||
if (x.sound) {
|
if (x.sound) {
|
||||||
@ -484,46 +506,11 @@ export default {
|
|||||||
}
|
}
|
||||||
this.publishFun(`{"questAss":${routeData}}`)// 发送航点信息主题
|
this.publishFun(`{"questAss":${routeData}}`)// 发送航点信息主题
|
||||||
this.questAss(this.currentOrder.id, 'shipment_status', '已发货')// 订单改为发货状态 并更新订单列表
|
this.questAss(this.currentOrder.id, 'shipment_status', '已发货')// 订单改为发货状态 并更新订单列表
|
||||||
this.$store.dispatch('fetchLockSite', { id: this.currentOrder.receive_site_id, runing: this.plane.id })// 航线注册飞机 锁定送餐点
|
this.$store.dispatch('fetchLockSite', { id: this.currentOrder.receive_site_id, runing: newRuning })// 航线注册飞机 锁定送餐点
|
||||||
this.speakText('提交任务,锁定航线。')
|
this.speakText('提交任务,锁定航线。')
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('此订单已被申请退款或者订单已经被取消!')
|
this.$message.error('此订单已被申请退款或者订单已经被取消!')
|
||||||
}
|
}
|
||||||
// let i
|
|
||||||
// this.questList.map((item) => {
|
|
||||||
// if (this.questForm.id === item.id) {
|
|
||||||
// i = true
|
|
||||||
// /* 插入日志 */
|
|
||||||
// this.$store.dispatch('fetchLog', { content: `${this.plane.name} 开始执行 订单ID:${item.id}、叫餐号:${item.food_sn}号。` })
|
|
||||||
// /* 执行写在这里 */
|
|
||||||
// if (item.bind_route === null) { // 判断站点是否已经绑定站点 未绑定 中断操作
|
|
||||||
// this.$message.error('此站点,未绑定任务航点')
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// let routeData
|
|
||||||
// try {
|
|
||||||
// const bindRoute = item.bind_route.split(',')
|
|
||||||
// routeData = this.routeList.find(element => element.id === bindRoute[0]).route_data
|
|
||||||
// routeData = JSON.parse(routeData)// 反序列化
|
|
||||||
// /* 处理声音航点 航点里面的表达式 如$food_sn$ 正则替换成订单对应的字段 */
|
|
||||||
// item.telTail = item.tel.substr(-4)// 手动加一个手机尾号telTail字段 从 tel字段截取后四位
|
|
||||||
// routeData.tasks.forEach((x, index) => {
|
|
||||||
// if (x.sound) {
|
|
||||||
// const str = this.voiceRouteParse(item, x.sound)
|
|
||||||
// routeData.tasks[index].sound = str// 重新写入声音航点
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// routeData = JSON.stringify(routeData)// 重新序列化
|
|
||||||
// } catch (error) {
|
|
||||||
// this.$message.error('操作失败,请重新尝试')
|
|
||||||
// }
|
|
||||||
// this.publishFun(`{"questAss":${routeData}}`)// 发送航点信息主题
|
|
||||||
// this.questAss(item.id, 'status', 'shipped')// 订单改为发货状态 并更新订单列表
|
|
||||||
// this.$store.dispatch('fetchLockSite', { id: item.receive_site_id, runing: this.plane.id })// 航线注册飞机 锁定送餐点
|
|
||||||
// this.speakText('提交任务,锁定航线。')
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// if (i) { return }
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @description: 匹配声音航点字符串 比如$food_sn$ food_sn匹配成 送餐订单里面的对应字段
|
* @description: 匹配声音航点字符串 比如$food_sn$ food_sn匹配成 送餐订单里面的对应字段
|
||||||
@ -620,8 +607,12 @@ export default {
|
|||||||
makeRouteForMap () {
|
makeRouteForMap () {
|
||||||
let bindRoute
|
let bindRoute
|
||||||
let routeData
|
let routeData
|
||||||
this.siteList.forEach(item => {
|
let found = false
|
||||||
if (item.runing === this.planesId) {
|
|
||||||
|
this.siteList.some(item => {
|
||||||
|
const runing = item.runing.split(',')
|
||||||
|
if (runing.includes(this.planesId.toString())) {
|
||||||
|
found = true
|
||||||
// 获取航点信息
|
// 获取航点信息
|
||||||
if (item.bind_route !== null) { // 判断站点是否已经绑定站点
|
if (item.bind_route !== null) { // 判断站点是否已经绑定站点
|
||||||
bindRoute = item.bind_route.split(',')
|
bindRoute = item.bind_route.split(',')
|
||||||
@ -632,8 +623,14 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.$message.error('此站点,未绑定任务航点')
|
this.$message.error('此站点,未绑定任务航点')
|
||||||
}
|
}
|
||||||
|
return true // 找到匹配项后退出循环
|
||||||
}
|
}
|
||||||
|
return false // 继续循环
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
this.$message.error('未找到匹配的站点')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @description: 判断 已接订单下拉框 的任务 有疑问的 坐标集 class样式显示成红色
|
* @description: 判断 已接订单下拉框 的任务 有疑问的 坐标集 class样式显示成红色
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
// import router from '@/router'
|
||||||
import app from './modules/app'
|
import app from './modules/app'
|
||||||
import settings from './modules/settings'
|
import settings from './modules/settings'
|
||||||
import user from './modules/user'
|
import user from './modules/user'
|
||||||
@ -453,25 +454,6 @@ const store = new Vuex.Store({
|
|||||||
} else {
|
} else {
|
||||||
Message.error(res.data.msg)
|
Message.error(res.data.msg)
|
||||||
}
|
}
|
||||||
// else if (res.data.status === -1) { // -1状态 服务器判断runing字段 正在有飞机正在执行
|
|
||||||
// MessageBox.confirm(res.data.msg, '提示', {
|
|
||||||
// confirmButtonText: '强制更新',
|
|
||||||
// cancelButtonText: '取消',
|
|
||||||
// type: 'warning'
|
|
||||||
// }).then(() => {
|
|
||||||
// params.append('isCoerce', 1)
|
|
||||||
// api.post('saveSite', params).then(res => {
|
|
||||||
// if (res.data.status === 1) {
|
|
||||||
// Message.success(res.data.msg)
|
|
||||||
// dispatch('fetchSiteList')// 刷新站点列表
|
|
||||||
// } else {
|
|
||||||
// Message.error(res.data.msg)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }).catch(() => {
|
|
||||||
// Message.info('取消操作')
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +16,7 @@ async function get (controller, prefix = 'Plane') {
|
|||||||
const path = init(prefix)
|
const path = init(prefix)
|
||||||
try {
|
try {
|
||||||
const res = await axios.get(path + controller)
|
const res = await axios.get(path + controller)
|
||||||
if (res.data.status === -1) { // 权限过期
|
if (res.data.status === 'noPermission') { // 权限过期
|
||||||
localStorage.removeItem('token')
|
localStorage.removeItem('token')
|
||||||
router.go(0)
|
router.go(0)
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ async function post (controller, params, prefix = 'Plane') {
|
|||||||
const path = init(prefix)
|
const path = init(prefix)
|
||||||
try {
|
try {
|
||||||
const res = await axios.post(path + controller, params)
|
const res = await axios.post(path + controller, params)
|
||||||
if (res.data.status === -1) { // 权限过期
|
if (res.data.status === 'noPermission') { // 权限过期
|
||||||
localStorage.removeItem('token')
|
localStorage.removeItem('token')
|
||||||
router.go(0)
|
router.go(0)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user