【类 型】:fix
【主 题】:提交订单是 检测订单重量 【描 述】: [原因]:检测订单重量超过飞机承载重量上限 给提示 增加安全保障 [过程]: [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
e44d78cded
commit
136ee3ca0f
@ -61,7 +61,8 @@
|
||||
<el-form label-position="left" ref="questForm" :model="questForm" label-width="80px">
|
||||
<el-form-item label="订单任务">
|
||||
<el-select v-model="questForm.id" :filterable="isMobile" placeholder="请选择,也可输入搜索" :disabled="airLock">
|
||||
<el-option v-for="item in questList" :key="item.id" :label="item.id" :value="item.id">
|
||||
<el-option v-for="item in questList" :key="item.id" :label="item.id" :value="item.id"
|
||||
:class="Number(item.total_weight) >= Number(plane.weight_max) ? 'danger-color' : ''">
|
||||
<span class="l">{{ item.id }}</span>
|
||||
<span class="l m-l-5">{{ item.receiver }}</span>
|
||||
<span class="l m-l-5">{{ item.receive_site_name }}</span>
|
||||
@ -75,7 +76,7 @@
|
||||
<font class="m-l-5">航线锁定</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14" v-if="planeState & 1 && !airLock" type="primary"
|
||||
icon="f-s-14 iconfont icon-chakanzhihangrizhi" @click="runQuest">
|
||||
icon="f-s-14 iconfont icon-chakanzhihangrizhi" @click="checkQuest">
|
||||
<font class="m-l-5">提交任务</font>
|
||||
</el-button>
|
||||
<el-button size="mini" class="f-s-14" v-if="planeState & 2" key="wirteBut" type="info"
|
||||
@ -312,6 +313,15 @@ export default {
|
||||
overQuestList () {
|
||||
return this.$store.state.orderList.filter((item) => item.status === 'shipped')
|
||||
},
|
||||
/**
|
||||
* @description: 当前选中的订单
|
||||
*/
|
||||
currentOrder () {
|
||||
if (this.questForm && this.questForm.id !== undefined) {
|
||||
return this.questList.find((item) => item.id === this.questForm.id) || null
|
||||
}
|
||||
return null
|
||||
},
|
||||
/**
|
||||
* @description: 航线列表
|
||||
*/
|
||||
@ -395,6 +405,35 @@ export default {
|
||||
this.$message.warning('与飞机通信未接通,请稍后')
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description: 执行任务前 先检测订单是否 合法 例如:订单重量会不会超出飞机载重上限
|
||||
*/
|
||||
checkQuest () {
|
||||
// 检查重量
|
||||
if (Number(this.currentOrder.total_weight) >= Number(this.plane.weight_max)) {
|
||||
this.$confirm('此订单总重超出本飞机的载重上限', '检测订单', {
|
||||
confirmButtonText: '仍然提交',
|
||||
cancelButtonText: '放弃提交',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '存在超重风险,仍然提交订单'
|
||||
})
|
||||
this.runQuest()// 提交订单
|
||||
})
|
||||
.catch(action => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '取消提交订单'
|
||||
})
|
||||
})
|
||||
} else {
|
||||
// 合法 直接提交订单
|
||||
this.runQuest()
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @description: 执行订单任务
|
||||
*/
|
||||
@ -403,27 +442,24 @@ export default {
|
||||
this.$message.error('未选择订单任务!')
|
||||
return
|
||||
}
|
||||
let i
|
||||
this.questList.map((item) => {
|
||||
if (this.questForm.id === item.id) {
|
||||
i = true
|
||||
if (this.currentOrder) {
|
||||
/* 插入日志 */
|
||||
this.$store.dispatch('fetchLog', { content: `${this.plane.name} 开始执行 订单ID:${item.id}、叫餐号:${item.food_sn}号。` })
|
||||
this.$store.dispatch('fetchLog', { content: `${this.plane.name} 开始执行 订单ID:${this.currentOrder.id}、叫餐号:${this.currentOrder.food_sn}号。` })
|
||||
/* 执行写在这里 */
|
||||
if (item.bind_route === null) { // 判断站点是否已经绑定站点 未绑定 中断操作
|
||||
if (this.currentOrder.bind_route === null) { // 判断站点是否已经绑定站点 未绑定 中断操作
|
||||
this.$message.error('此站点,未绑定任务航点')
|
||||
return
|
||||
}
|
||||
let routeData
|
||||
try {
|
||||
const bindRoute = item.bind_route.split(',')
|
||||
const bindRoute = this.currentOrder.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字段截取后四位
|
||||
this.currentOrder.telTail = this.currentOrder.tel.substr(-4)// 手动加一个手机尾号telTail字段 从 tel字段截取后四位
|
||||
routeData.tasks.forEach((x, index) => {
|
||||
if (x.sound) {
|
||||
const str = this.voiceRouteParse(item, x.sound)
|
||||
const str = this.voiceRouteParse(this.currentOrder, x.sound)
|
||||
routeData.tasks[index].sound = str// 重新写入声音航点
|
||||
}
|
||||
})
|
||||
@ -432,13 +468,47 @@ export default {
|
||||
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.questAss(this.currentOrder.id, 'status', 'shipped')// 订单改为发货状态 并更新订单列表
|
||||
this.$store.dispatch('fetchLockSite', { id: this.currentOrder.receive_site_id, runing: this.plane.id })// 航线注册飞机 锁定送餐点
|
||||
this.speakText('提交任务,锁定航线。')
|
||||
}
|
||||
})
|
||||
if (i) { return }
|
||||
} 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匹配成 送餐订单里面的对应字段
|
||||
@ -577,6 +647,11 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
@import "@/styles/theme.scss";
|
||||
|
||||
.danger-color {
|
||||
color: $danger-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.tab-container {
|
||||
height: 365px;
|
||||
width: 80px;
|
||||
|
Loading…
Reference in New Issue
Block a user