|
@@ -44,10 +44,9 @@
|
|
|
<!-- 添加或修改产品树信息对话框 -->
|
|
|
<el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
- <el-form-item label="归属" prop="parentId" v-if="form.parentId == 0">
|
|
|
+ <el-form-item label="归属" prop="parentId" v-if="isAdd">
|
|
|
<el-select v-model="form.aircraftId" placeholder="请选择机号信息" style="width:100%">
|
|
|
- <el-option v-for="item in aircraftOptions" :key="item.id" :label="item.number"
|
|
|
- :value="item.id">
|
|
|
+ <el-option v-for="item in aircraftOptions" :key="item.id" :label="item.number" :value="item.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -100,6 +99,8 @@ export default {
|
|
|
title: '',
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
+ // 是否新增
|
|
|
+ isAdd: true,
|
|
|
// 是否展开,默认全部展开
|
|
|
isExpandAll: true,
|
|
|
// 单机列表
|
|
@@ -156,8 +157,10 @@ export default {
|
|
|
getTreeselect() {
|
|
|
listProduct().then(response => {
|
|
|
this.productOptions = []
|
|
|
- const data = { id: 0, name: '顶级节点', children: [], isDisabled: true }
|
|
|
+ let data = { id: 0, name: '顶级节点', children: [], isDisabled: true }
|
|
|
data.children = this.handleTree(response.data, 'id', 'parentId')
|
|
|
+ console.log('sdfg', data)
|
|
|
+ data.children[0].isDisabled = false
|
|
|
this.productOptions.push(data)
|
|
|
})
|
|
|
},
|
|
@@ -174,7 +177,7 @@ export default {
|
|
|
parentName: null,
|
|
|
aircraftId: null,
|
|
|
name: null,
|
|
|
- snsId: null
|
|
|
+ snsId: null,
|
|
|
}
|
|
|
this.resetForm('form')
|
|
|
},
|
|
@@ -192,8 +195,12 @@ export default {
|
|
|
this.reset()
|
|
|
if (row != null && row.id) {
|
|
|
this.getTreeselect()
|
|
|
+ this.isAdd = false
|
|
|
this.form.parentId = row.id
|
|
|
+ this.form.name = row.name
|
|
|
+ this.form.snsId = row.snsId
|
|
|
} else {
|
|
|
+ this.isAdd = true
|
|
|
this.form.parentId = 0
|
|
|
}
|
|
|
this.open = true
|
|
@@ -210,12 +217,20 @@ export default {
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
this.reset()
|
|
|
+ console.log(row)
|
|
|
+ if (row.parentId == 0) {
|
|
|
+ this.form.aircraftId = row.aircraftId
|
|
|
+ this.isAdd = true
|
|
|
+ this.open = true
|
|
|
+ return
|
|
|
+ }
|
|
|
this.getTreeselect()
|
|
|
if (row != null) {
|
|
|
this.form.parentId = row.id
|
|
|
}
|
|
|
getProduct(row.id).then(response => {
|
|
|
this.form = response.data
|
|
|
+ this.isAdd = false
|
|
|
this.open = true
|
|
|
this.title = '修改产品树信息'
|
|
|
})
|