瀏覽代碼

硬件类型接口修改

pm 1 年之前
父節點
當前提交
5b1691b453
共有 4 個文件被更改,包括 571 次插入171 次删除
  1. 2 2
      src/api/mes/hw/hadrwareType.js
  2. 1 1
      src/router/index.js
  3. 144 168
      src/views/mes/hw/type/index.vue
  4. 424 0
      src/views/mes/hw/type/index1.vue

+ 2 - 2
src/api/mes/hw/hadrwareType.js

@@ -28,7 +28,7 @@ export function addHardwareType(query) {
 }
 
 // 修改设备维修单
-export function updateHardware(data) {
+export function updateHardwareType(data) {
   return request({
     url: '/iscs/type/updateIsHardwareType',
     method: 'post',
@@ -37,7 +37,7 @@ export function updateHardware(data) {
 }
 
 // 删除设备维修单
-export function delHardware(repairId) {
+export function delHardwareType(repairId) {
   return request({
     url: '/iscs/type/deleteIsHardwareTypeByIds?ids='+ repairId,
     method: 'post'

+ 1 - 1
src/router/index.js

@@ -168,7 +168,7 @@ export const dynamicRoutes = [
     path: '/mes/md/workarea/index',
     component: Layout,
     hidden: true,
-    permissions: ['mes:md:workarea:add'],
+    permissions: ['mes:md:waa:add'],
     children: [
       {
         path: 'MapData',

+ 144 - 168
src/views/mes/hw/type/index.vue

@@ -48,52 +48,23 @@
           icon="el-icon-search"
           size="mini"
           @click="handleQuery"
-          >搜索</el-button
+        >搜索</el-button
         >
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
-          >重置</el-button
+        >重置</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="['mes:hw:type:add']"
-          >新增</el-button
-        >
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          @click="handleDelete"
-          v-hasPermi="['mes:hw:type:batchremove']"
-          >批量删除</el-button
-        >
-      </el-col>
-      <right-toolbar
-        :showSearch.sync="showSearch"
-        @queryTable="getList"
-      ></right-toolbar>
-    </el-row>
-
     <el-table
       v-loading="loading"
-      :data="repairList"
-      @selection-change="handleSelectionChange"
+      :data="machinerytypeList"
+      row-key="id"
+      default-expand-all
+      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
     >
-      <el-table-column type="selection" width="55" align="center" />
       <el-table-column
         label="硬件编号"
-        width="120px"
+        width="170px"
         align="center"
         prop="hardwareTypeCode"
       />
@@ -115,19 +86,19 @@
           <!--          />-->
         </template>
       </el-table-column>
-      <el-table-column label="硬件层级" align="center" prop="level">
-        <template slot-scope="scope">
-          {{
-            scope.row.level == "1"
-              ? "一"
-              : scope.row.level == "2"
-              ? "二"
-              : scope.row.level == "3"
-              ? "三"
-              : scope.row.level
-          }}级
-        </template>
-      </el-table-column>
+<!--      <el-table-column label="硬件层级" align="center" prop="level">-->
+<!--        <template slot-scope="scope">-->
+<!--          {{-->
+<!--            scope.row.level == "1"-->
+<!--              ? "一"-->
+<!--              : scope.row.level == "2"-->
+<!--                ? "二"-->
+<!--                : scope.row.level == "3"-->
+<!--                  ? "三"-->
+<!--                  : scope.row.level-->
+<!--          }}级-->
+<!--        </template>-->
+<!--      </el-table-column>-->
       <el-table-column label="备注" align="center" prop="remark" />
       <el-table-column
         label="操作"
@@ -141,35 +112,38 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['mes:hw:type:edit']"
-            >编辑</el-button
+          >编辑</el-button
           >
           <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-plus"
+            @click="handleAdd(scope.row)"
+            v-hasPermi="['mes:hw:type:add']"
+          >新增</el-button>
+          <el-button
+            v-if="scope.row.parentTypeId != 0"
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['mes:hw:type:remove']"
-            >删除</el-button
+          >删除</el-button
           >
         </template>
       </el-table-column>
     </el-table>
 
-    <pagination
-      v-show="total > 0"
-      :total="total"
-      :page.sync="queryParams.current"
-      :limit.sync="queryParams.size"
-      @pagination="getList"
-    />
-
-    <!-- 添加或修改设备维修单对话框 -->
-    <el-dialog :visible.sync="open" width="500px" append-to-body>
-      <div slot="title" class="dialog-title">
-        <i></i>
-        <span class="title">{{ title }}</span>
-      </div>
+    <!-- 添加或修改设备类型对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        <el-row>
+          <el-col :span="24" v-if="form.parentTypeId !== 0">
+            <el-form-item label="父类型" prop="parentTypeId">
+              <treeselect v-model="form.parentTypeId" :options="machinerytypeOptions" :normalizer="normalizer" placeholder="请选择父类型" />
+            </el-form-item>
+          </el-col>
+        </el-row>
         <el-row>
           <el-col :span="18">
             <el-form-item label="硬件编号" prop="hardwareTypeCode">
@@ -192,35 +166,29 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <el-form-item label="硬件名称" prop="hardwareTypeName">
-          <el-input
-            v-model="form.hardwareTypeName"
-            placeholder="请输入硬件名称"
-          />
-        </el-form-item>
-        <el-form-item label="硬件层级" prop="level">
-          <el-input-number
-            v-model="form.level"
-            controls-position="right"
-            @change="handleChange"
-            :min="1"
-            :max="10"
-          ></el-input-number>
-        </el-form-item>
-        <el-form-item label="状态" prop="enableFlag">
-          <el-radio v-model="form.enableFlag" label="y">启用</el-radio>
-          <el-radio v-model="form.enableFlag" label="n">禁用</el-radio>
-        </el-form-item>
-        <el-form-item label="备注" prop="remark">
-          <el-input
-            v-model="form.remark"
-            type="textarea"
-            placeholder="请输入内容"
-          />
-        </el-form-item>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="硬件名称" prop="machineryTypeName">
+              <el-input v-model="form.hardwareTypeName" placeholder="请输入设备类型名称" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="状态" prop="enableFlag">
+              <el-radio v-model="form.enableFlag" label="y">启用</el-radio>
+              <el-radio v-model="form.enableFlag" label="n">禁用</el-radio>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="备注" prop="remark">
+              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
+            </el-form-item>
+          </el-col>
+        </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">提 交</el-button>
+        <el-button type="primary" @click="submitForm">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
@@ -231,16 +199,19 @@
 import {
   listHanrware,
   getHardwareTypeInfo,
-  delHardware,
+  delHardwareType,
   addHardwareType,
-  updateHardware,
-} from "@/api/mes/hw/hadrwareType";
-
+  updateHardwareType, delHardware
+} from '@/api/mes/hw/hadrwareType'
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import { genCode } from "@/api/system/autocode/rule";
 export default {
-  name: "Repair",
-  dicts: ["mes_repair_result", "mes_order_status"],
-
+  name: "hardwareType",
+  dicts: ['sys_yes_no'],
+  components: {
+    Treeselect
+  },
   data() {
     return {
       //自动生成编码
@@ -248,28 +219,22 @@ export default {
       optType: undefined,
       // 遮罩层
       loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
       // 显示搜索条件
       showSearch: true,
-      // 总条数
-      total: 0,
-      // 设备维修单表格数据
-      repairList: [],
+      // 设备类型表格数据
+      machinerytypeList: [],
+      // 设备类型树选项
+      machinerytypeOptions: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
       open: false,
-      // 硬件状态
-      radio: "1",
-      // 硬件层级
-      num: 1,
+      // 总条数
+      total: 0,
       // 查询参数
       queryParams: {
+        parentTypeId: null,
+        ancestors: null,
         current: 1,
         size: 10,
         hardwareTypeCode: "",
@@ -289,20 +254,41 @@ export default {
         hardwareTypeName: [
           { required: true, message: "硬件名称不能为空", trigger: "blur" },
         ],
-      },
+      }
     };
   },
   created() {
     this.getList();
   },
   methods: {
-    /** 查询硬件类型列表 */
+    /** 查询设备类型列表 */
     getList() {
       this.loading = true;
-      listHanrware(this.queryParams).then((response) => {
-        this.repairList = response.data.records;
-        this.total = response.data.total;
+      listHanrware(this.queryParams).then(response => {
+        this.machinerytypeList = this.handleTree(response.data.records, "id", "parentTypeId");
         this.loading = false;
+        console.log(this.machinerytypeList,'machinerytypeList')
+      });
+    },
+    /** 转换设备类型数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.id,
+        label: node.hardwareTypeName,
+        children: node.children
+      };
+    },
+    /** 查询设备类型下拉树结构 */
+    getTreeselect() {
+      listHanrware().then(response => {
+        debugger;
+        this.machinerytypeOptions = [];
+        const data = this.handleTree(response.data.records, "id", "parentTypeId")[0];
+        console.log(data,'父类型回显')
+        this.machinerytypeOptions.push(data);
       });
     },
     // 取消按钮
@@ -310,25 +296,25 @@ export default {
       this.open = false;
       this.reset();
     },
-    // 层级计数器函数
-    handleChange(value) {
-      console.log(value);
-    },
     // 表单重置
     reset() {
       this.form = {
-        hardwareTypeCode: "",
-        hardwareTypeName: "",
         level: "",
+        parentTypeId: 1,
+        ancestors: null,
         enableFlag: "",
-        remark: "",
+        remark: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        hardwareTypeCode: "",
+        hardwareTypeName: "",
       };
-      this.autoGenFlag = false;
       this.resetForm("form");
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.current = 1;
       this.getList();
     },
     /** 重置按钮操作 */
@@ -336,25 +322,30 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.id);
-      this.single = selection.length !== 1;
-      this.multiple = !selection.length;
+    // 层级计数器函数
+    handleChange(value) {
+      console.log(value);
     },
     /** 新增按钮操作 */
-    handleAdd() {
-      console.log(this.form, "新增");
+    handleAdd(row) {
       this.reset();
+      this.getTreeselect();
+      if (row != null && row.id) {
+        this.form.parentTypeId = row.id;
+      } else {
+        this.form.parentTypeId = 0;
+      }
       this.open = true;
-      this.EditId = null;
       this.title = "新增硬件类型";
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      this.EditId = row.id || this.ids;
-      getHardwareTypeInfo(this.EditId).then((response) => {
+      this.getTreeselect();
+      if (row != null) {
+        this.form.parentTypeId = row.id;
+      }
+      getHardwareTypeInfo(row.id).then(response => {
         this.form = response.data;
         this.open = true;
         this.title = "编辑硬件类型";
@@ -362,33 +353,41 @@ export default {
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate((valid) => {
+      this.$refs["form"].validate(valid => {
         if (valid) {
-          if (this.EditId != null) {
-            updateHardware(this.form).then((response) => {
+          if (this.form.id != null) {
+            updateHardwareType(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
             });
           } else {
-            this.form.parentTypeId = 0;
-            addHardwareType(this.form).then((response) => {
+            addHardwareType(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
-              this.EditId = null;
               this.getList();
             });
           }
         }
       });
     },
+    //自动生成编码
+    handleAutoGenChange(autoGenFlag) {
+      if (autoGenFlag) {
+        genCode("HARDWARE_TYPE_CODE").then((response) => {
+          this.form.hardwareTypeCode = response;
+        });
+      } else {
+        this.form.hardwareTypeCode = null;
+      }
+    },
     /** 删除按钮操作 */
     handleDelete(row) {
       const repairIds = row.id || this.ids;
       this.$modal
         .confirm('是否删除硬件编号为"' + repairIds + '"的硬件类型?')
         .then(function () {
-          return delHardware(repairIds);
+          return delHardwareType(repairIds);
         })
         .then(() => {
           this.getList();
@@ -396,29 +395,6 @@ export default {
         })
         .catch(() => {});
     },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download(
-        "dv/repair/export",
-        {
-          ...this.queryParams,
-        },
-        `repair_${new Date().getTime()}.xlsx`
-      );
-    },
-
-    //自动生成编码
-    handleAutoGenChange(autoGenFlag) {
-      if (autoGenFlag) {
-        genCode("HARDWARE_TYPE_CODE").then((response) => {
-          this.form.hardwareTypeCode = response;
-        });
-      } else {
-        this.form.hardwareTypeCode = null;
-      }
-    },
-  },
+  }
 };
 </script>
-<style scoped lang="scss" src="@/assets/styles/dialog-title.scss">
-</style>

+ 424 - 0
src/views/mes/hw/type/index1.vue

@@ -0,0 +1,424 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="100px"
+    >
+      <el-form-item label="硬件编号" prop="hardwareTypeCode">
+        <el-input
+          v-model="queryParams.hardwareTypeCode"
+          placeholder="请输入硬件编号"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="类型名称" prop="hardwareTypeName">
+        <el-input
+          v-model="queryParams.hardwareTypeName"
+          placeholder="请输入类型名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="状态" prop="enableFlag">
+        <el-select
+          v-model="queryParams.enableFlag"
+          placeholder="请选择状态"
+          clearable
+        >
+          <el-option label="启用" value="y"></el-option>
+          <el-option label="禁用" value="n"></el-option>
+
+          <!--          <el-option-->
+          <!--            v-for="dict in dict.type.mes_order_status"-->
+          <!--            :key="dict.value"-->
+          <!--            :label="dict.label"-->
+          <!--            :value="dict.value"-->
+          <!--          />-->
+        </el-select>
+      </el-form-item>
+      <el-form-item style="margin-left: 50px">
+        <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="['mes:hw:type:add']"
+          >新增</el-button
+        >
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          @click="handleDelete"
+          v-hasPermi="['mes:hw:type:batchremove']"
+          >批量删除</el-button
+        >
+      </el-col>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
+    </el-row>
+
+    <el-table
+      v-loading="loading"
+      :data="repairList"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column
+        label="硬件编号"
+        width="120px"
+        align="center"
+        prop="hardwareTypeCode"
+      />
+      <el-table-column
+        label="类型名称"
+        width="150px"
+        align="center"
+        prop="hardwareTypeName"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column label="状态" align="center" prop="enableFlag">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.enableFlag == 'y'">启用</el-tag>
+          <el-tag v-else type="danger">禁用</el-tag>
+
+          <!--          <dict-tag-->
+          <!--            :options="dict.type.mes_order_status"-->
+          <!--            :value="scope.row.enableFlag"-->
+          <!--          />-->
+        </template>
+      </el-table-column>
+      <el-table-column label="硬件层级" align="center" prop="level">
+        <template slot-scope="scope">
+          {{
+            scope.row.level == "1"
+              ? "一"
+              : scope.row.level == "2"
+              ? "二"
+              : scope.row.level == "3"
+              ? "三"
+              : scope.row.level
+          }}级
+        </template>
+      </el-table-column>
+      <el-table-column label="备注" align="center" prop="remark" />
+      <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="['mes:hw:type:edit']"
+            >编辑</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['mes:hw:type:remove']"
+            >删除</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.current"
+      :limit.sync="queryParams.size"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改设备维修单对话框 -->
+    <el-dialog :visible.sync="open" width="500px" append-to-body>
+      <div slot="title" class="dialog-title">
+        <i></i>
+        <span class="title">{{ title }}</span>
+      </div>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        <el-row>
+          <el-col :span="18">
+            <el-form-item label="硬件编号" prop="hardwareTypeCode">
+              <el-input
+                v-model="form.hardwareTypeCode"
+                placeholder="请输入硬件编号"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label-width="30">
+              <el-switch
+                v-model="autoGenFlag"
+                active-color="#13ce66"
+                active-text="自动生成"
+                @change="handleAutoGenChange(autoGenFlag)"
+                v-if="optType != 'view'"
+              >
+              </el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="硬件名称" prop="hardwareTypeName">
+          <el-input
+            v-model="form.hardwareTypeName"
+            placeholder="请输入硬件名称"
+          />
+        </el-form-item>
+        <el-form-item label="硬件层级" prop="level">
+          <el-input-number
+            v-model="form.level"
+            controls-position="right"
+            @change="handleChange"
+            :min="1"
+            :max="10"
+          ></el-input-number>
+        </el-form-item>
+        <el-form-item label="状态" prop="enableFlag">
+          <el-radio v-model="form.enableFlag" label="y">启用</el-radio>
+          <el-radio v-model="form.enableFlag" label="n">禁用</el-radio>
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input
+            v-model="form.remark"
+            type="textarea"
+            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 {
+  listHanrware,
+  getHardwareTypeInfo,
+  delHardware,
+  addHardwareType,
+  updateHardware,
+} from "@/api/mes/hw/hadrwareType";
+
+import { genCode } from "@/api/system/autocode/rule";
+export default {
+  name: "Repair",
+  dicts: ["mes_repair_result", "mes_order_status"],
+
+  data() {
+    return {
+      //自动生成编码
+      autoGenFlag: false,
+      optType: undefined,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 设备维修单表格数据
+      repairList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 硬件状态
+      radio: "1",
+      // 硬件层级
+      num: 1,
+      // 查询参数
+      queryParams: {
+        current: 1,
+        size: 10,
+        hardwareTypeCode: "",
+        hardwareTypeName: "",
+        enableFlag: "",
+      },
+      // 表单参数
+      form: {
+        parentTypeId: 0,
+      },
+      EditId: null, //编辑传递id
+      // 表单校验
+      rules: {
+        hardwareTypeCode: [
+          { required: true, message: "硬件编号不能为空", trigger: "blur" },
+        ],
+        hardwareTypeName: [
+          { required: true, message: "硬件名称不能为空", trigger: "blur" },
+        ],
+      },
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询硬件类型列表 */
+    getList() {
+      this.loading = true;
+      listHanrware(this.queryParams).then((response) => {
+        this.repairList = response.data.records;
+        this.total = response.data.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 层级计数器函数
+    handleChange(value) {
+      console.log(value);
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        hardwareTypeCode: "",
+        hardwareTypeName: "",
+        level: "",
+        enableFlag: "",
+        remark: "",
+      };
+      this.autoGenFlag = false;
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.current = 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() {
+      console.log(this.form, "新增");
+      this.reset();
+      this.open = true;
+      this.EditId = null;
+      this.title = "新增硬件类型";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      this.EditId = row.id || this.ids;
+      getHardwareTypeInfo(this.EditId).then((response) => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "编辑硬件类型";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.EditId != null) {
+            updateHardware(this.form).then((response) => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            this.form.parentTypeId = 0;
+            addHardwareType(this.form).then((response) => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.EditId = null;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const repairIds = row.id || this.ids;
+      this.$modal
+        .confirm('是否删除硬件编号为"' + repairIds + '"的硬件类型?')
+        .then(function () {
+          return delHardware(repairIds);
+        })
+        .then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download(
+        "dv/repair/export",
+        {
+          ...this.queryParams,
+        },
+        `repair_${new Date().getTime()}.xlsx`
+      );
+    },
+
+    //自动生成编码
+    handleAutoGenChange(autoGenFlag) {
+      if (autoGenFlag) {
+        genCode("HARDWARE_TYPE_CODE").then((response) => {
+          this.form.hardwareTypeCode = response;
+        });
+      } else {
+        this.form.hardwareTypeCode = null;
+      }
+    },
+  },
+};
+</script>
+<style scoped lang="scss" src="@/assets/styles/dialog-title.scss">
+</style>