wanggaokun 1 год назад
Родитель
Сommit
4e4b5d7743
1 измененных файлов с 7 добавлено и 9 удалено
  1. 7 9
      PHM-web/src/views/manage/product/index.vue

+ 7 - 9
PHM-web/src/views/manage/product/index.vue

@@ -44,8 +44,8 @@
     <!-- 添加或修改产品树信息对话框 -->
     <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="isAdd">
-          <el-select v-model="form.parentId" placeholder="请选择机号信息" style="width:100%">
+        <el-form-item label="归属" prop="parentId" v-if="form.parentId == 0">
+          <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>
@@ -100,8 +100,6 @@ export default {
       title: '',
       // 是否显示弹出层
       open: false,
-      // 是否新增
-      isAdd: true,
       // 是否展开,默认全部展开
       isExpandAll: true,
       // 单机列表
@@ -126,6 +124,7 @@ export default {
   },
   created() {
     this.getList()
+    this.getAircraftList()
   },
   methods: {
     /** 查询产品树信息列表 */
@@ -157,7 +156,7 @@ export default {
     getTreeselect() {
       listProduct().then(response => {
         this.productOptions = []
-        const data = { id: 0, name: '顶级节点', children: [] }
+        const data = { id: 0, name: '顶级节点', children: [], isDisabled: true }
         data.children = this.handleTree(response.data, 'id', 'parentId')
         this.productOptions.push(data)
       })
@@ -173,6 +172,7 @@ export default {
         id: null,
         parentId: null,
         parentName: null,
+        aircraftId: null,
         name: null,
         snsId: null
       }
@@ -189,13 +189,12 @@ export default {
     },
     /** 新增按钮操作 */
     handleAdd(row) {
-      this.isAdd = true
       this.reset()
-      this.getAircraftList()
       if (row != null && row.id) {
+        this.getTreeselect()
         this.form.parentId = row.id
       } else {
-        this.form.parentId = this.aircraftOptions[0].id
+        this.form.parentId = 0
       }
       this.open = true
       this.title = '添加产品树信息'
@@ -211,7 +210,6 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset()
-      this.isAdd = false
       this.getTreeselect()
       if (row != null) {
         this.form.parentId = row.id