From 7f2b2c4ed647070f48afd09e40800589fc491338 Mon Sep 17 00:00:00 2001 From: air <30444667+sszdot@users.noreply.github.com> Date: Thu, 19 Jun 2025 00:40:40 +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=9A=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91=EF=BC=9A?= =?UTF-8?q?=20=E3=80=90=E8=BF=87=20=20=E7=A8=8B=E3=80=91=EF=BC=9A=20?= =?UTF-8?q?=E3=80=90=E5=BD=B1=20=20=E5=93=8D=E3=80=91=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/components/main/model/add.vue | 101 ++++++++++-------- 1 file changed, 55 insertions(+), 46 deletions(-) diff --git a/src/views/layout/components/main/model/add.vue b/src/views/layout/components/main/model/add.vue index 564fea1..69dd451 100644 --- a/src/views/layout/components/main/model/add.vue +++ b/src/views/layout/components/main/model/add.vue @@ -11,33 +11,48 @@ - + + + - - + + + + - - - - - + + + + + + + + - - + + + + + + + + + + + - - + + + + - - - - + + + 创建 重填 @@ -63,14 +78,16 @@ export default { return { form: { shop_id: '', - name: '', - date: '', - onoff: true, + class_name: '', + category: '四旋翼', + wheelbase: '', weight_max: '', - desc: '' + module: '', + describe: '', + onoff: true }, - airId: this.$route.params.id, // get参数 获取飞机id 没有为添加页面 - pageState: 'add', // 页面状态 + airId: this.$route.params.id, + pageState: 'add', plane: null } }, @@ -78,28 +95,24 @@ export default { SelectionShopId }, computed: { - // 获取飞机列表 airList () { return this.$store.state.airList } }, methods: { - // 设置表单 setForm (data) { - if (data.desc == null) { - data.desc = '' - } this.form.shop_id = data.shop_id - this.form.name = data.name - this.form.date = data.date - this.form.onoff = data.onoff + this.form.class_name = data.class_name + this.form.category = data.category + this.form.wheelbase = data.wheelbase this.form.weight_max = data.weight_max - this.form.desc = data.desc + this.form.module = data.module + this.form.describe = data.describe || '' + this.form.onoff = data.onoff === '1' || data.onoff === true if (Object.keys(data).length === 0) { this.$message.warning('清空表单') } }, - // 初始化页面 添加or编辑 initPage () { if (this.airId === undefined) { this.pageState = 'add' @@ -109,28 +122,24 @@ export default { if (this.plane) { const data = { shop_id: this.plane.shop_id, - name: this.plane.name, - date: this.plane.apply_time + '000', - onoff: this.plane.onoff === '1', + class_name: this.plane.class_name, + category: this.plane.category, + wheelbase: this.plane.wheelbase, weight_max: this.plane.weight_max, - desc: this.plane.describe + module: this.plane.module, + describe: this.plane.describe, + onoff: this.plane.onoff } this.setForm(data) } } }, - /** - * @description: 创建新飞机 - */ async addAir () { const res = await this.$store.dispatch('fetchAddAir', this.form) if (res.data.status === 1) { this.$router.push('/register/index') } }, - /** - * @description: 更新飞机 - */ async saveAir () { this.form.id = this.airId const res = await this.$store.dispatch('fetchSaveAir', this.form) @@ -141,12 +150,12 @@ export default { }, watch: { airList () { - this.initPage()// 初始化页面 + this.initPage() } }, created () { if (this.airList.length > 0) { - this.initPage()// 初始化页面 + this.initPage() } } }