【类 型】:
【原 因】: 【过 程】: 【影 响】:
This commit is contained in:
parent
7a3a80f2b9
commit
7f2b2c4ed6
@ -11,33 +11,48 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="border p-20 m-b-20">
|
<el-main class="border p-20 m-b-20">
|
||||||
<el-form ref="form" :model="form" label-width="120px" :label-position="$store.state.app.isWideScreen?'top':'right'">
|
<el-form ref="form" :model="form" label-width="120px" :label-position="$store.state.app.isWideScreen ? 'top' : 'right'">
|
||||||
|
|
||||||
|
<!-- 商铺选择 -->
|
||||||
<el-form-item v-if="pageState === 'add'" label="所属商铺">
|
<el-form-item v-if="pageState === 'add'" label="所属商铺">
|
||||||
<SelectionShopId v-model="form.shop_id" />
|
<SelectionShopId v-model="form.shop_id" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="飞机名称">
|
|
||||||
<el-input v-model="form.name" placeholder="起名可以是中文" />
|
<!-- 类别名称 -->
|
||||||
|
<el-form-item label="机型名称">
|
||||||
|
<el-input v-model="form.class_name" placeholder="例如:运输型无人机" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="购买日期">
|
|
||||||
<el-date-picker v-if="pageState == 'add' ? true : false" v-model="form.date" type="date"
|
<!-- 飞机类型 -->
|
||||||
placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="timestamp">
|
<el-form-item label="机型类型">
|
||||||
</el-date-picker>
|
<el-select v-model="form.category" placeholder="请选择类型">
|
||||||
<el-date-picker v-else v-model="form.date" type="date" placeholder="选择日期" format="yyyy 年 MM 月 dd 日"
|
<el-option label="四旋翼" value="四旋翼" />
|
||||||
value-format="timestamp" disabled>
|
<el-option label="固定翼" value="固定翼" />
|
||||||
</el-date-picker>
|
<el-option label="垂直起降" value="垂直起降" />
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="运载极限重量">
|
|
||||||
<el-input v-model="form.weight_max" placeholder="运载的重量上限">
|
<!-- 轴距 -->
|
||||||
|
<el-form-item label="轴距">
|
||||||
|
<el-input v-model="form.wheelbase" placeholder="单位:厘米">
|
||||||
|
<template slot="append">cm</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- 最大载重 -->
|
||||||
|
<el-form-item label="最大载重">
|
||||||
|
<el-input v-model="form.weight_max" placeholder="单位:克">
|
||||||
<template slot="append">克</template>
|
<template slot="append">克</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="form.onoff === true ? '启用' : '停用'">
|
|
||||||
<el-switch v-model="form.onoff" />
|
<!-- 描述 -->
|
||||||
|
<el-form-item label="机型描述">
|
||||||
|
<el-input v-model="form.describe" type="textarea" placeholder="描述备注,非必填" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="飞机描述">
|
|
||||||
<el-input v-model="form.desc" type="textarea" placeholder="描述备注,非必填" />
|
<!-- 提交按钮 -->
|
||||||
</el-form-item>
|
<el-form-item v-if="pageState === 'add'">
|
||||||
<el-form-item v-if="pageState == 'add' ? true : false">
|
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="addAir">创建</el-button>
|
<el-button type="primary" icon="el-icon-plus" @click="addAir">创建</el-button>
|
||||||
<el-button @click="setForm({ shop_id: form.shop_id })" class="iconfont icon-qingchu">
|
<el-button @click="setForm({ shop_id: form.shop_id })" class="iconfont icon-qingchu">
|
||||||
<font class="m-l-5">重填</font>
|
<font class="m-l-5">重填</font>
|
||||||
@ -63,14 +78,16 @@ export default {
|
|||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
shop_id: '',
|
shop_id: '',
|
||||||
name: '',
|
class_name: '',
|
||||||
date: '',
|
category: '四旋翼',
|
||||||
onoff: true,
|
wheelbase: '',
|
||||||
weight_max: '',
|
weight_max: '',
|
||||||
desc: ''
|
module: '',
|
||||||
|
describe: '',
|
||||||
|
onoff: true
|
||||||
},
|
},
|
||||||
airId: this.$route.params.id, // get参数 获取飞机id 没有为添加页面
|
airId: this.$route.params.id,
|
||||||
pageState: 'add', // 页面状态
|
pageState: 'add',
|
||||||
plane: null
|
plane: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -78,28 +95,24 @@ export default {
|
|||||||
SelectionShopId
|
SelectionShopId
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// 获取飞机列表
|
|
||||||
airList () {
|
airList () {
|
||||||
return this.$store.state.airList
|
return this.$store.state.airList
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 设置表单
|
|
||||||
setForm (data) {
|
setForm (data) {
|
||||||
if (data.desc == null) {
|
|
||||||
data.desc = ''
|
|
||||||
}
|
|
||||||
this.form.shop_id = data.shop_id
|
this.form.shop_id = data.shop_id
|
||||||
this.form.name = data.name
|
this.form.class_name = data.class_name
|
||||||
this.form.date = data.date
|
this.form.category = data.category
|
||||||
this.form.onoff = data.onoff
|
this.form.wheelbase = data.wheelbase
|
||||||
this.form.weight_max = data.weight_max
|
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) {
|
if (Object.keys(data).length === 0) {
|
||||||
this.$message.warning('清空表单')
|
this.$message.warning('清空表单')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 初始化页面 添加or编辑
|
|
||||||
initPage () {
|
initPage () {
|
||||||
if (this.airId === undefined) {
|
if (this.airId === undefined) {
|
||||||
this.pageState = 'add'
|
this.pageState = 'add'
|
||||||
@ -109,28 +122,24 @@ export default {
|
|||||||
if (this.plane) {
|
if (this.plane) {
|
||||||
const data = {
|
const data = {
|
||||||
shop_id: this.plane.shop_id,
|
shop_id: this.plane.shop_id,
|
||||||
name: this.plane.name,
|
class_name: this.plane.class_name,
|
||||||
date: this.plane.apply_time + '000',
|
category: this.plane.category,
|
||||||
onoff: this.plane.onoff === '1',
|
wheelbase: this.plane.wheelbase,
|
||||||
weight_max: this.plane.weight_max,
|
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)
|
this.setForm(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* @description: 创建新飞机
|
|
||||||
*/
|
|
||||||
async addAir () {
|
async addAir () {
|
||||||
const res = await this.$store.dispatch('fetchAddAir', this.form)
|
const res = await this.$store.dispatch('fetchAddAir', this.form)
|
||||||
if (res.data.status === 1) {
|
if (res.data.status === 1) {
|
||||||
this.$router.push('/register/index')
|
this.$router.push('/register/index')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* @description: 更新飞机
|
|
||||||
*/
|
|
||||||
async saveAir () {
|
async saveAir () {
|
||||||
this.form.id = this.airId
|
this.form.id = this.airId
|
||||||
const res = await this.$store.dispatch('fetchSaveAir', this.form)
|
const res = await this.$store.dispatch('fetchSaveAir', this.form)
|
||||||
@ -141,12 +150,12 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
airList () {
|
airList () {
|
||||||
this.initPage()// 初始化页面
|
this.initPage()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
if (this.airList.length > 0) {
|
if (this.airList.length > 0) {
|
||||||
this.initPage()// 初始化页面
|
this.initPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user