diff --git a/src/components/ControllerTabs.vue b/src/components/ControllerTabs.vue index bc14c75..320ef09 100644 --- a/src/components/ControllerTabs.vue +++ b/src/components/ControllerTabs.vue @@ -976,6 +976,8 @@ export default { * @param {*} item 对应下拉框的任务 */ isWaring (item) { + console.error('当前飞机ID:', item.total_weight) + const isOverWaight = Number(item.total_weight) >= Number(this.plane.weight_max)// 是否超重 const isQuestIng = (item.runing ?? '').split(',').some(i => i !== '') // 是否有飞机正在执行 return isOverWaight || isQuestIng diff --git a/src/store/index.js b/src/store/index.js index 429dc06..55cee03 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -367,16 +367,13 @@ const store = new Vuex.Store({ params.append('shop_id', form.shop_id) params.append('name', form.name) params.append('date', form.date) - if (form.onoff) { - params.append('onoff', '1') - } else { - params.append('onoff', '0') - } - params.append('weight_max', form.weight_max) + params.append('onoff', form.onoff ? '1' : '0') params.append('desc', form.desc) + params.append('bind_class_id', form.bind_class_id) // ✅ 添加机型绑定字段 + const res = await api.post('addAir', params) if (res.data.status === 1) { - await dispatch('fetchAirList')// 刷新飞机列表 + await dispatch('fetchAirList') Message.success(res.data.msg) } else { Message.error(res.data.msg) @@ -393,17 +390,14 @@ const store = new Vuex.Store({ params.append('shop_id', form.shop_id) params.append('name', form.name) params.append('date', form.date) - if (form.onoff) { - params.append('onoff', '1') - } else { - params.append('onoff', '0') - } - params.append('weight_max', form.weight_max) + params.append('onoff', form.onoff ? '1' : '0') params.append('desc', form.desc) params.append('id', form.id) + params.append('bind_class_id', form.bind_class_id) // ✅ 添加机型绑定字段 + const res = await api.post('saveAir', params) if (res.data.status === 1) { - await dispatch('fetchAirList')// 刷新飞机列表 + await dispatch('fetchAirList') Message.success(res.data.msg) } else { Message.error(res.data.msg) @@ -467,6 +461,7 @@ const store = new Vuex.Store({ const res = await api.post('addPlaneClass', params) if (res.data.status === 1) { await dispatch('fetchPlaneClassList')// 刷新 机型列表 + await dispatch('fetchAirList')// 刷新飞机列表 Message.success(res.data.msg) } else { Message.error(res.data.msg) @@ -485,17 +480,45 @@ const store = new Vuex.Store({ params.append('class_name', form.class_name) params.append('wheelbase', form.wheelbase) params.append('category', form.category) - params.append('weight_max', form.weight_max) params.append('describe', form.describe) const res = await api.post('savePlaneClass', params) if (res.data.status === 1) { await dispatch('fetchPlaneClassList')// 刷新 机型列表 + await dispatch('fetchAirList')// 刷新飞机列表 Message.success(res.data.msg) } else { Message.error(res.data.msg) } return res }, + /** + * @description: 删除指定序号 机型 + * @param {*} idArray 机型序号数组 + */ + fetchDelPlaneClass ({ dispatch }, idArr) { + if (idArr.length === 0) { + Message.error('未勾选记录') + } else { + MessageBox.confirm('请谨慎操作 确认删除?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const params = new URLSearchParams() + params.append('idArr', idArr) + api.post('deletePlaneClass', params).then(res => { + if (res.data.status === 1) { + Message.success(res.data.msg) + dispatch('fetchPlaneClassList')// 刷新 机型列表 + } else { + Message.error(res.data.msg) + } + }) + }).catch(() => { + Message.info('取消操作') + }) + } + }, /** * @description: 获取站点列表 */ diff --git a/src/views/layout/components/main/model/add.vue b/src/views/layout/components/main/model/add.vue index 7ff17ef..55384fd 100644 --- a/src/views/layout/components/main/model/add.vue +++ b/src/views/layout/components/main/model/add.vue @@ -97,6 +97,7 @@ export default { } }, computed: { + // 机型列表 planeClassList () { return this.$store.state.planeClassList || [] } @@ -122,7 +123,7 @@ export default { if (this.planeClass) { this.setForm({ ...this.planeClass }) } else { - this.$message.error('找不到对应机型信息') + this.$message.warning('找不到对应机型信息') } } }, diff --git a/src/views/layout/components/main/model/index.vue b/src/views/layout/components/main/model/index.vue index 4924826..395db0e 100644 --- a/src/views/layout/components/main/model/index.vue +++ b/src/views/layout/components/main/model/index.vue @@ -1,75 +1,54 @@