wanggaokun 1 жил өмнө
parent
commit
22797a1bb6

+ 0 - 44
PHM-web/src/api/manage/aeroplane.js

@@ -1,44 +0,0 @@
-import request from '@/utils/request'
-
-// 查询单机信息列表
-export function listAeroplane(query) {
-  return request({
-    url: '/manage/aeroplane/list',
-    method: 'get',
-    params: query
-  })
-}
-
-// 查询单机信息详细
-export function getAeroplane(id) {
-  return request({
-    url: '/manage/aeroplane/' + id,
-    method: 'get'
-  })
-}
-
-// 新增单机信息
-export function addAeroplane(data) {
-  return request({
-    url: '/manage/aeroplane',
-    method: 'post',
-    data: data
-  })
-}
-
-// 修改单机信息
-export function updateAeroplane(data) {
-  return request({
-    url: '/manage/aeroplane',
-    method: 'put',
-    data: data
-  })
-}
-
-// 删除单机信息
-export function delAeroplane(id) {
-  return request({
-    url: '/manage/aeroplane/' + id,
-    method: 'delete'
-  })
-}

+ 52 - 0
PHM-web/src/api/manage/aircraft.js

@@ -0,0 +1,52 @@
+import request from '@/utils/request'
+
+// 查询单机信息列表
+export function listAircraft(query) {
+  return request({
+    url: '/manage/aircraft/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询单机信息详细
+export function getAircraft(id) {
+  return request({
+    url: '/manage/aircraft/' + id,
+    method: 'get'
+  })
+}
+
+// 新增单机信息
+export function addAircraft(data) {
+  return request({
+    url: '/manage/aircraft',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改单机信息
+export function updateAircraft(data) {
+  return request({
+    url: '/manage/aircraft',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除单机信息
+export function delAircraft(id) {
+  return request({
+    url: '/manage/aircraft/' + id,
+    method: 'delete'
+  })
+}
+
+// 查询机队信息列表
+export function fleetListSelect() {
+  return request({
+    url: '/manage/aircraft/fleetList',
+    method: 'get'
+  })
+}

+ 8 - 0
PHM-web/src/api/manage/product.js

@@ -42,3 +42,11 @@ export function delProduct(id) {
     method: 'delete'
   })
 }
+
+// 查询单机信息列表
+export function aircraftListSelect() {
+  return request({
+    url: '/manage/product/aircraftList',
+    method: 'get'
+  })
+}

+ 0 - 259
PHM-web/src/views/manage/aeroplane/index.vue

@@ -1,259 +0,0 @@
-<template>
-  <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="名称" prop="name">
-        <el-input
-          v-model="queryParams.name"
-          placeholder="请输入名称"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="型号" prop="modelNumber">
-        <el-input
-          v-model="queryParams.modelNumber"
-          placeholder="请输入型号"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-      </el-form-item>
-    </el-form>
-
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['manage:aeroplane:add']"
-        >新增</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['manage:aeroplane:edit']"
-        >修改</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['manage:aeroplane:remove']"
-        >删除</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          v-hasPermi="['manage:aeroplane:export']"
-        >导出</el-button>
-      </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
-
-    <el-table v-loading="loading" :data="aeroplaneList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      
-      <el-table-column label="名称" align="center" prop="name" />
-      <el-table-column label="型号" align="center" prop="modelNumber" />
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['manage:aeroplane:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['manage:aeroplane:remove']"
-          >删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
-
-    <!-- 添加或修改单机信息对话框 -->
-    <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="name">
-          <el-input v-model="form.name" placeholder="请输入名称" />
-        </el-form-item>
-        <el-form-item label="型号" prop="modelNumber">
-          <el-input v-model="form.modelNumber" placeholder="请输入型号" />
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
-  </div>
-</template>
-
-<script>
-import { listAeroplane, getAeroplane, delAeroplane, addAeroplane, updateAeroplane } from "@/api/manage/aeroplane";
-
-export default {
-  name: "Aeroplane",
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 单机信息表格数据
-      aeroplaneList: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        name: null,
-        modelNumber: null,
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-      }
-    };
-  },
-  created() {
-    this.getList();
-  },
-  methods: {
-    /** 查询单机信息列表 */
-    getList() {
-      this.loading = true;
-      listAeroplane(this.queryParams).then(response => {
-        this.aeroplaneList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        name: null,
-        modelNumber: null,
-      };
-      this.resetForm("form");
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加单机信息";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const id = row.id || this.ids
-      getAeroplane(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改单机信息";
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateAeroplane(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addAeroplane(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除单机信息编号为"' + ids + '"的数据项?').then(function() {
-        return delAeroplane(ids);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('manage/aeroplane/export', {
-        ...this.queryParams
-      }, `aeroplane_${new Date().getTime()}.xlsx`)
-    }
-  }
-};
-</script>

+ 249 - 0
PHM-web/src/views/manage/aircraft/index.vue

@@ -0,0 +1,249 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="名称" prop="name">
+        <el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="机号" prop="number">
+        <el-input v-model="queryParams.number" placeholder="请输入机号" clearable @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="归属机队" prop="fleetId">
+        <el-input v-model="queryParams.fleetId" placeholder="请输入归属机队" clearable @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+          v-hasPermi="['manage:aircraft:add']">新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
+          v-hasPermi="['manage:aircraft:edit']">修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
+          v-hasPermi="['manage:aircraft:remove']">删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
+          v-hasPermi="['manage:aircraft:export']">导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="aircraftList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="名称" align="center" prop="name" />
+      <el-table-column label="机号" align="center" prop="number" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+            v-hasPermi="['manage:aircraft:edit']">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+            v-hasPermi="['manage:aircraft:remove']">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+      @pagination="getList" />
+
+    <!-- 添加或修改单机信息对话框 -->
+    <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="name">
+          <el-input v-model="form.name" placeholder="请输入名称" />
+        </el-form-item>
+        <el-form-item label="机号" prop="number">
+          <el-input v-model="form.number" placeholder="请输入机号" />
+        </el-form-item>
+        <el-form-item label="归属机队" prop="fleetId">
+          <el-select v-model="form.fleetId" placeholder="请选择机队信息" style="width:100%">
+            <el-option v-for="item in fleetOptions" :key="item.fleetCode" :label="item.fleetName"
+              :value="item.fleetCode">
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  listAircraft,
+  getAircraft,
+  delAircraft,
+  addAircraft,
+  updateAircraft,
+  fleetListSelect,
+} from '@/api/manage/aircraft'
+
+export default {
+  name: 'Aircraft',
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 单机信息表格数据
+      aircraftList: [],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      // 机队信息下拉框
+      fleetOptions: undefined,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+        number: null,
+        fleetId: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {},
+    }
+  },
+  created() {
+    this.getList()
+    this.fleetList()
+  },
+  methods: {
+    /** 查询单机信息列表 */
+    getList() {
+      this.loading = true
+      listAircraft(this.queryParams).then(response => {
+        this.aircraftList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
+    },
+    /** 查询机队信息列表 */
+    fleetList() {
+      this.loading = true
+      fleetListSelect().then(response => {
+        console.log(response)
+        this.fleetOptions = response.data
+      })
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false
+      this.reset()
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        name: null,
+        number: null,
+        fleetId: null,
+        isDelete: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+      }
+      this.resetForm('form')
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset()
+      this.open = true
+      this.title = '添加单机信息'
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset()
+      const id = row.id || this.ids
+      getAircraft(id).then(response => {
+        this.form = response.data
+        this.open = true
+        this.title = '修改单机信息'
+      })
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs['form'].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateAircraft(this.form).then(response => {
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
+          } else {
+            addAircraft(this.form).then(response => {
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+            })
+          }
+        }
+      })
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids
+      this.$modal
+        .confirm('是否确认删除单机信息编号为"' + ids + '"的数据项?')
+        .then(function () {
+          return delAircraft(ids)
+        })
+        .then(() => {
+          this.getList()
+          this.$modal.msgSuccess('删除成功')
+        })
+        .catch(() => {})
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download(
+        'manage/aircraft/export',
+        {
+          ...this.queryParams,
+        },
+        `aircraft_${new Date().getTime()}.xlsx`
+      )
+    },
+  },
+}
+</script>

+ 114 - 130
PHM-web/src/views/manage/product/index.vue

@@ -2,83 +2,41 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="名称" prop="name">
-        <el-input
-          v-model="queryParams.name"
-          placeholder="名称"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.name" placeholder="名称" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="SNS编号" title="SNS编号" prop="snsId">
-        <el-input
-          v-model="queryParams.snsId"
-          placeholder="请输入SNS编号"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.snsId" placeholder="请输入SNS编号" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item>
-	    <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['manage:product:add']"
-        >新增</el-button>
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+          v-hasPermi="['manage:product:add']">新增</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="info"
-          plain
-          icon="el-icon-sort"
-          size="mini"
-          @click="toggleExpandAll"
-        >展开/折叠</el-button>
+        <el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">展开/折叠</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table
-      v-if="refreshTable"
-      v-loading="loading"
-      :data="productList"
-      row-key="id"
-      :default-expand-all="isExpandAll"
-      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
-    >
+    <el-table v-if="refreshTable" v-loading="loading" :data="productList" row-key="id" :default-expand-all="isExpandAll"
+      :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
       <el-table-column label="名称" align="center" prop="name" />
       <el-table-column label="SNS编号" align="center" prop="snsId" />
+      <el-table-column label="归属" align="center" prop="parentName" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['manage:product:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-plus"
-            @click="handleAdd(scope.row)"
-            v-hasPermi="['manage:product:add']"
-          >新增</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['manage:product:remove']"
-          >删除</el-button>
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+            v-hasPermi="['manage:product:edit']">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)"
+            v-hasPermi="['manage:product:add']">新增</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+            v-hasPermi="['manage:product:remove']">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -86,7 +44,14 @@
     <!-- 添加或修改产品树信息对话框 -->
     <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">
+        <el-form-item label="归属" prop="parentId" v-if="isAdd">
+          <el-select v-model="form.parentId" placeholder="请选择机号信息" style="width:100%">
+            <el-option v-for="item in aircraftOptions" :key="item.id" :label="item.number"
+              :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="归属" prop="parentId" v-else>
           <treeselect v-model="form.parentId" :options="productOptions" :normalizer="normalizer" placeholder="请选择父ID" />
         </el-form-item>
         <el-form-item label="名称" prop="name">
@@ -105,14 +70,21 @@
 </template>
 
 <script>
-import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/manage/product";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {
+  listProduct,
+  getProduct,
+  delProduct,
+  addProduct,
+  updateProduct,
+  aircraftListSelect,
+} from '@/api/manage/product'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
 
 export default {
-  name: "Product",
+  name: 'Product',
   components: {
-    Treeselect
+    Treeselect,
   },
   data() {
     return {
@@ -125,11 +97,15 @@ export default {
       // 产品树信息树选项
       productOptions: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
+      // 是否新增
+      isAdd: true,
       // 是否展开,默认全部展开
       isExpandAll: true,
+      // 单机列表
+      aircraftOptions: undefined,
       // 重新渲染表格状态
       refreshTable: true,
       // 查询参数
@@ -143,134 +119,142 @@ export default {
       // 表单校验
       rules: {
         parentId: [
-          { required: true, message: "归属不能为空", trigger: "blur" }
+          { required: true, message: '归属不能为空', trigger: 'blur' },
         ],
-      }
-    };
+      },
+    }
   },
   created() {
-    this.getList();
+    this.getList()
   },
   methods: {
     /** 查询产品树信息列表 */
     getList() {
-      this.loading = true;
+      this.loading = true
       listProduct(this.queryParams).then(response => {
-        this.productList = this.handleTree(response.data, "id", "parentId");
-        this.loading = false;
-      });
+        this.productList = this.handleTree(response.data, 'id', 'parentId')
+        this.loading = false
+      })
+    },
+    /** 查询单机信息列表 */
+    getAircraftList() {
+      aircraftListSelect(this.queryParams).then(response => {
+        this.aircraftOptions = response.data
+      })
     },
     /** 转换产品树信息数据结构 */
     normalizer(node) {
       if (node.children && !node.children.length) {
-        delete node.children;
+        delete node.children
       }
       return {
         id: node.id,
         label: node.name,
-        children: node.children
-      };
+        children: node.children,
+      }
     },
-	/** 查询产品树信息下拉树结构 */
+    /** 查询产品树信息下拉树结构 */
     getTreeselect() {
       listProduct().then(response => {
-        this.productOptions = [];
-        const data = { id: 0, name: '顶级节点', children: [] };
-        data.children = this.handleTree(response.data, "id", "parentId");
-        this.productOptions.push(data);
-      });
+        this.productOptions = []
+        const data = { id: 0, name: '顶级节点', children: [] }
+        data.children = this.handleTree(response.data, 'id', 'parentId')
+        this.productOptions.push(data)
+      })
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
       this.form = {
         id: null,
         parentId: null,
+        parentName: null,
         name: null,
-        snsId: null,
-        isDelete: null,
-        createBy: null,
-        createTime: null,
-        updateBy: null,
-        updateTime: null
-      };
-      this.resetForm("form");
+        snsId: null
+      }
+      this.resetForm('form')
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.getList();
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
+      this.resetForm('queryForm')
+      this.handleQuery()
     },
     /** 新增按钮操作 */
     handleAdd(row) {
-      this.reset();
-      this.getTreeselect();
+      this.isAdd = true
+      this.reset()
+      this.getAircraftList()
       if (row != null && row.id) {
-        this.form.parentId = row.id;
+        this.form.parentId = row.id
       } else {
-        this.form.parentId = 0;
+        this.form.parentId = this.aircraftOptions[0].id
       }
-      this.open = true;
-      this.title = "添加产品树信息";
+      this.open = true
+      this.title = '添加产品树信息'
     },
     /** 展开/折叠操作 */
     toggleExpandAll() {
-      this.refreshTable = false;
-      this.isExpandAll = !this.isExpandAll;
+      this.refreshTable = false
+      this.isExpandAll = !this.isExpandAll
       this.$nextTick(() => {
-        this.refreshTable = true;
-      });
+        this.refreshTable = true
+      })
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
-      this.getTreeselect();
+      this.reset()
+      this.isAdd = false
+      this.getTreeselect()
       if (row != null) {
-        this.form.parentId = row.id;
+        this.form.parentId = row.id
       }
       getProduct(row.id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改产品树信息";
-      });
+        this.form = response.data
+        this.open = true
+        this.title = '修改产品树信息'
+      })
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
+      this.$refs['form'].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
             updateProduct(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
           } else {
             addProduct(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+            })
           }
         }
-      });
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      this.$modal.confirm('是否确认删除产品树信息编号为"' + row.id + '"的数据项?').then(function() {
-        return delProduct(row.id);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
-    }
-  }
-};
+      this.$modal
+        .confirm('是否确认删除产品树信息编号为"' + row.id + '"的数据项?')
+        .then(function () {
+          return delProduct(row.id)
+        })
+        .then(() => {
+          this.getList()
+          this.$modal.msgSuccess('删除成功')
+        })
+        .catch(() => {})
+    },
+  },
+}
 </script>