From c8da790f647128808aa06b3dc993f31b1e8a4ff5 Mon Sep 17 00:00:00 2001 From: air <30444667+sszdot@users.noreply.github.com> Date: Thu, 19 Jun 2025 15:14:48 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=20=20=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afeat=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91?= =?UTF-8?q?=EF=BC=9A1.=E9=9C=80=E8=A6=81=E6=96=B0=E5=A2=9E=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E9=A1=B5=E9=9D=A2=E6=9D=A5=E6=B7=BB=E5=8A=A0=E5=92=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=97=A0=E4=BA=BA=E6=9C=BA=E6=9C=BA=E5=9E=8B?= =?UTF-8?q?=20=202.=E9=A3=9E=E6=9C=BA=E5=A2=9E=E5=88=A0=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BA=86bind=5Fclass=5Fid=E5=85=B3=E8=81=94=E6=9C=BA?= =?UTF-8?q?=E5=9E=8B=E5=AD=97=E6=AE=B5=20=E3=80=90=E8=BF=87=20=20=E7=A8=8B?= =?UTF-8?q?=E3=80=91=EF=BC=9A1=E3=80=82=E6=96=B0=E5=BB=BA=E4=BA=86=20Plane?= =?UTF-8?q?ClassAdd.vue=20=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=B7=AF=E7=94=B1=E5=8F=82=E6=95=B0=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=98=AF=E6=B7=BB=E5=8A=A0=E8=BF=98=E6=98=AF=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=A8=A1=E5=BC=8F=EF=BC=9B=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E9=A1=B9=E3=80=81=E6=8C=89=E9=92=AE=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E3=80=81=E5=88=9D=E5=A7=8B=E5=8C=96=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E7=AD=89=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=B9=B6=E6=8E=A5=E5=85=A5?= =?UTF-8?q?=20Vuex=20=E7=9A=84=20planeClassList=20=E5=92=8C=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=8E=A5=E5=8F=A3=202.=E9=A3=9E=E6=9C=BA=E5=A2=9E?= =?UTF-8?q?=E5=88=A0=20=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=96=B0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=20=E5=81=9A=E7=9B=B8=E5=BA=94=E5=A4=84=E7=90=86=20?= =?UTF-8?q?=E3=80=90=E5=BD=B1=20=20=E5=93=8D=E3=80=91=EF=BC=9A=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=80=9A=E8=BF=87=E8=A1=A8=E5=8D=95=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=88=96=E4=BF=AE=E6=94=B9=E6=97=A0=E4=BA=BA=E6=9C=BA=E6=9C=BA?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- src/components/ControllerTabs.vue | 2 + src/store/index.js | 53 ++++-- .../layout/components/main/model/add.vue | 3 +- .../layout/components/main/model/index.vue | 105 ++++-------- .../layout/components/main/register/add.vue | 162 +++++++++++------- 5 files changed, 180 insertions(+), 145 deletions(-) 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 @@