【类 型】:refactor

【主	题】:提交任务
【描	述】:
	[原因]:重置多航线绑定
	[过程]:提交任务 从runing字段判断 是否有注册空位 有的话注册 并且找出对应航线的索引 (用于向飞机提交航点)
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-07-09 21:55:00 +08:00
parent d65d94c68c
commit 86cecc9e34
3 changed files with 42 additions and 63 deletions

View File

@ -466,11 +466,33 @@ export default {
return
}
let routeData
let newRuning // running
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(',')
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)//
/* 处理声音航点 航点里面的表达式 如$food_sn$ 正则替换成订单对应的字段 */
// $food_sn$
this.currentOrder.telTail = this.currentOrder.tel.substr(-4)// telTail tel
routeData.tasks.forEach((x, index) => {
if (x.sound) {
@ -484,46 +506,11 @@ export default {
}
this.publishFun(`{"questAss":${routeData}}`)//
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('提交任务,锁定航线。')
} else {
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匹配成 送餐订单里面的对应字段
@ -615,13 +602,17 @@ export default {
})
},
/**
* @description: 在地图上绘制航线
*/
* @description: 在地图上绘制航线
*/
makeRouteForMap () {
let bindRoute
let routeData
this.siteList.forEach(item => {
if (item.runing === this.planesId) {
let found = false
this.siteList.some(item => {
const runing = item.runing.split(',')
if (runing.includes(this.planesId.toString())) {
found = true
//
if (item.bind_route !== null) { //
bindRoute = item.bind_route.split(',')
@ -632,8 +623,14 @@ export default {
} else {
this.$message.error('此站点,未绑定任务航点')
}
return true // 退
}
return false //
})
if (!found) {
this.$message.error('未找到匹配的站点')
}
},
/**
* @description: 判断 已接订单下拉框 的任务 有疑问的 坐标集 class样式显示成红色

View File

@ -1,5 +1,6 @@
import Vue from 'vue'
import Vuex from 'vuex'
// import router from '@/router'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'
@ -453,25 +454,6 @@ const store = new Vuex.Store({
} else {
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
},
/**

View File

@ -16,7 +16,7 @@ async function get (controller, prefix = 'Plane') {
const path = init(prefix)
try {
const res = await axios.get(path + controller)
if (res.data.status === -1) { // 权限过期
if (res.data.status === 'noPermission') { // 权限过期
localStorage.removeItem('token')
router.go(0)
}
@ -37,7 +37,7 @@ async function post (controller, params, prefix = 'Plane') {
const path = init(prefix)
try {
const res = await axios.post(path + controller, params)
if (res.data.status === -1) { // 权限过期
if (res.data.status === 'noPermission') { // 权限过期
localStorage.removeItem('token')
router.go(0)
}