diff --git a/src/components/ControllerTabs.vue b/src/components/ControllerTabs.vue index 226f663..3f7d218 100644 --- a/src/components/ControllerTabs.vue +++ b/src/components/ControllerTabs.vue @@ -59,7 +59,7 @@ + :class="isWaring(item) ? 'danger-color' : ''"> {{ item.id }} {{ item.receiver }} {{ item.receive_site_name }} @@ -298,11 +298,11 @@ export default { return plane ? plane.planeState.state : null }, /** - * @description: 已付款 未送达 未发起退款 订单列表 + * @description: 已付款 已接单 未发起退款 订单列表 */ questList () { const plane = this.plane - return plane ? this.$store.state.paidOrderList.filter((item) => item.shop_id === plane.shop_id && item.refund_status !== '申请中') : [] + return plane ? this.$store.state.paidOrderList.filter((item) => item.shop_id === plane.shop_id && item.shipment_status === '已接单' && item.refund_status !== '申请中') : [] }, /** * @description: 已发货 订单列表 @@ -406,8 +406,7 @@ export default { * @description: 执行任务前 先检测订单是否 合法 例如:订单重量会不会超出飞机载重上限 */ checkQuest () { - // 检查重量 - if (Number(this.currentOrder.total_weight) >= Number(this.plane.weight_max)) { + if (Number(this.currentOrder.total_weight) >= Number(this.plane.weight_max)) { // 检查重量 this.$confirm('此订单总重超出本飞机的载重上限', '检测订单', { confirmButtonText: '仍然提交', cancelButtonText: '放弃提交', @@ -426,6 +425,25 @@ export default { message: '取消提交订单' }) }) + } else if (this.currentOrder.runing.split(',').some(item => item !== '')) { // 检查 此站点上有否有飞机正在执行任务 + this.$confirm('此订单的目标站点,已经有飞机正在执行任务。请注意安全!', '检测订单', { + confirmButtonText: '仍然提交', + cancelButtonText: '放弃提交', + type: 'warning' + }) + .then(() => { + this.$message({ + type: 'warning', + message: '存在风险,仍然提交订单' + }) + this.runQuest()// 提交订单 + }) + .catch(action => { + this.$message({ + type: 'info', + message: '取消提交订单' + }) + }) } else { // 合法 直接提交订单 this.runQuest() @@ -616,11 +634,26 @@ export default { } } }) + }, + /** + * @description: 判断 已接订单下拉框 的任务 有疑问的 坐标集 class样式显示成红色 + * @param {*} item 对应下拉框的任务 + */ + isWaring (item) { + const isOverWaight = Number(item.total_weight) >= Number(this.plane.weight_max)// 是否超重 + const isQuestIng = item.runing.split(',').some(i => i !== '')// 是否有飞机正在执行 + return isOverWaight || isQuestIng } }, created () { if (this.siteList && this.routeList) { - this.airLock = this.siteList.some(item => item.runing === this.planesId) + this.airLock = this.siteList.some(item => { + if (item.runing) { + const runingArray = item.runing.split(',').map(str => str.trim()) // 将 item.runing 分割成数组并去除空格 + return runingArray.includes(this.planesId.toString()) // 比较数组中的元素和 this.planesId + } + return false + }) } }, watch: { @@ -630,11 +663,17 @@ export default { } else { // 如果没有执行任务 把地图上航线清除 this.$emit('clearRoute') } - this.$store.dispatch('fetchPaiOrderList')// 刷新订单列表 + this.$store.dispatch('fetchPaidOrderList')// 刷新订单列表 this.$store.dispatch('fetchSiteList')// 刷新站点列表 }, siteList (val) { - this.airLock = val.some(item => item.runing === this.planesId) + this.airLock = this.siteList.some(item => { + if (item.runing) { + const runingArray = item.runing.split(',').map(str => str.trim()) // 将 item.runing 分割成数组并去除空格 + return runingArray.includes(this.planesId.toString()) // 比较数组中的元素和 this.planesId + } + return false + }) } }