Prechádzať zdrojové kódy

修改删除功能提示信息

wangyani 11 mesiacov pred
rodič
commit
d1362b7885

+ 117 - 156
src/views/mes/hw/Keys/index.vue

@@ -9,7 +9,6 @@
       label-width="100px"
     >
       <el-row>
-
         <el-form-item label="锁具编码" prop="locksetCode">
           <el-input
             v-model="queryParams.locksetCode"
@@ -27,7 +26,6 @@
             @keyup.enter.native="handleQuery"
           />
         </el-form-item>
-
       </el-row>
       <el-form-item style="margin-left: 50px">
         <el-button
@@ -35,13 +33,11 @@
           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>
 
@@ -54,9 +50,8 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['mes:hw:information:add']"
-        >新增
-        </el-button
-        >
+          >新增
+        </el-button>
       </el-col>
 
       <el-col :span="1.5">
@@ -68,9 +63,8 @@
           :disabled="multiple"
           @click="handleDelete"
           v-hasPermi="['mes:hw:information:batchremove']"
-        >批量删除
-        </el-button
-        >
+          >批量删除
+        </el-button>
       </el-col>
       <right-toolbar
         :showSearch.sync="showSearch"
@@ -83,7 +77,7 @@
       :data="repairList"
       @selection-change="handleSelectionChange"
     >
-      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column type="selection" width="55" align="center" />
       <el-table-column
         label="钥匙编码"
         width="120px"
@@ -103,17 +97,9 @@
         prop="keyNfc"
         :show-overflow-tooltip="true"
       />
-      <el-table-column
-        label="MAC地址"
-        align="center"
-        prop="macAddress"
-      />
+      <el-table-column label="MAC地址" align="center" prop="macAddress" />
 
-      <el-table-column
-        label="硬件类型Id"
-        align="center"
-        prop="hardwareId"
-      />
+      <el-table-column label="硬件类型Id" align="center" prop="hardwareId" />
       <el-table-column
         label="创建时间"
         align="center"
@@ -138,18 +124,16 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['mes:hw:information:edit']"
-          >编辑
-          </el-button
-          >
+            >编辑
+          </el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['mes:hw:information:remove']"
-          >删除
-          </el-button
-          >
+            >删除
+          </el-button>
           <!--          <el-button size="mini" type="text">预览</el-button>-->
         </template>
       </el-table-column>
@@ -164,12 +148,7 @@
     />
 
     <!-- 添加或修改设备维修单对话框 -->
-    <el-dialog
-      :title="title"
-      :visible.sync="open"
-      width="450px"
-      append-to-body
-    >
+    <el-dialog :title="title" :visible.sync="open" width="450px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-form-item label="硬件类型" prop="hardwareId">
           <treeselect
@@ -203,28 +182,16 @@
         </el-row>
 
         <el-form-item label="钥匙名称" prop="keyName">
-          <el-input
-            v-model="form.keyName"
-            placeholder="请输入钥匙名称"
-          />
+          <el-input v-model="form.keyName" placeholder="请输入钥匙名称" />
         </el-form-item>
         <el-form-item label="钥匙NFC" prop="keyNfc">
-          <el-input
-            v-model="form.keyNfc"
-            placeholder="请输入钥匙Nfc"
-          />
+          <el-input v-model="form.keyNfc" placeholder="请输入钥匙Nfc" />
         </el-form-item>
         <el-form-item label="MAC地址" prop="macAddress">
-          <el-input
-            v-model="form.macAddress"
-            placeholder="请输入Mac地址"
-          />
+          <el-input v-model="form.macAddress" placeholder="请输入Mac地址" />
         </el-form-item>
         <el-form-item label="备注" prop="remark">
-          <el-input
-            v-model="form.remark"
-            placeholder="请输入备注"
-          />
+          <el-input v-model="form.remark" placeholder="请输入备注" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -241,17 +208,16 @@ import {
   addKeyAPI,
   updateKeyAPI,
   delKeyAPI,
-  getKeyInfoAPI
-} from '@/api/mes/Keys/Keys'
-import { genCode } from '@/api/system/autocode/rule'
-import Treeselect from '@riophae/vue-treeselect'
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
-import { listHanrwareType } from '@/api/mes/hw/hadrwareType'
-
+  getKeyInfoAPI,
+} from "@/api/mes/Keys/Keys";
+import { genCode } from "@/api/system/autocode/rule";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { listHanrwareType } from "@/api/mes/hw/hadrwareType";
 
 export default {
-  name: 'lock',
-  dicts: ['hardware_status'],
+  name: "lock",
+  dicts: ["hardware_status"],
   components: { Treeselect },
   data() {
     return {
@@ -273,11 +239,11 @@ export default {
       // 设备维修单表格数据
       repairList: [],
       // 弹出层标题
-      title: '',
+      title: "",
       // 是否显示弹出层
       open: false,
       // 查询参数
-      createTime: '',
+      createTime: "",
       queryParams: {
         current: 1,
         size: 10,
@@ -289,84 +255,83 @@ export default {
 
       // 表单参数
       form: {
-        hardwareId:null
+        hardwareId: null,
       },
       // 表单校验
       rules: {
         keyCode: [
-          { required: true, message: '钥匙编码不能为空', trigger: 'blur' }
+          { required: true, message: "钥匙编码不能为空", trigger: "blur" },
         ],
         keyName: [
-          { required: true, message: '钥匙名称不能为空', trigger: 'blur' }
-        ]
+          { required: true, message: "钥匙名称不能为空", trigger: "blur" },
+        ],
       },
       // 日期选择
       pickerOptions: {
         shortcuts: [
           {
-            text: '最近一周',
+            text: "最近一周",
             onClick(picker) {
-              const end = new Date()
-              const start = new Date()
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
-              picker.$emit('pick', [start, end])
-            }
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+              picker.$emit("pick", [start, end]);
+            },
           },
           {
-            text: '最近一个月',
+            text: "最近一个月",
             onClick(picker) {
-              const end = new Date()
-              const start = new Date()
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
-              picker.$emit('pick', [start, end])
-            }
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+              picker.$emit("pick", [start, end]);
+            },
           },
           {
-            text: '最近三个月',
+            text: "最近三个月",
             onClick(picker) {
-              const end = new Date()
-              const start = new Date()
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
-              picker.$emit('pick', [start, end])
-            }
-          }
-        ]
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+              picker.$emit("pick", [start, end]);
+            },
+          },
+        ],
       },
 
       // 新增状态
 
       EditId: 0, //修改判断
-      machinerytypeOptions:[],//锁具类型
-    }
+      machinerytypeOptions: [], //锁具类型
+    };
   },
   created() {
-    this.getList()
-    this.getTreeselect()
+    this.getList();
+    this.getTreeselect();
   },
   methods: {
     //自动生成编码
     handleAutoGenChange(autoGenFlag) {
       if (autoGenFlag) {
-        genCode('LOCK_CODE').then((response) => {
-          this.form.keyCode = response
-          console.log(response,this.form.keyCode,'KeyCode')
-        })
+        genCode("LOCK_CODE").then((response) => {
+          this.form.keyCode = response;
+          console.log(response, this.form.keyCode, "KeyCode");
+        });
       } else {
-        this.form.keyCode = null
+        this.form.keyCode = null;
       }
     },
     /** 查询设备维修单列表 */
 
     getList() {
-      this.loading = true
+      this.loading = true;
 
       // 锁具数据
       listKeyAPI(this.queryParams).then((response) => {
-        this.repairList = response.data.records
-        this.total = response.data.total
-        this.loading = false
-      })
-
+        this.repairList = response.data.records;
+        this.total = response.data.total;
+        this.loading = false;
+      });
     },
     /** 查询锁具类型下拉树结构 */
     getTreeselect() {
@@ -395,8 +360,8 @@ export default {
     },
     // 取消按钮
     cancel() {
-      this.open = false
-      this.reset()
+      this.open = false;
+      this.reset();
     },
     // 表单重置
     reset() {
@@ -404,93 +369,89 @@ export default {
         keyName: null,
         keyCode: null,
         keyNfc: null,
-        macAddress:null,
+        macAddress: null,
         remark: null,
-      }
+      };
 
-      this.autoGenFlag = false
-      this.resetForm('form')
+      this.autoGenFlag = false;
+      this.resetForm("form");
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.current = 1
-      this.getList()
+      this.queryParams.current = 1;
+      this.getList();
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.queryParams.keyCode = ''
-      this.queryParams.keyName = ''
-      this.queryParams.keyId = ''
-      this.resetForm('queryForm')
-      this.handleQuery()
+      this.queryParams.keyCode = "";
+      this.queryParams.keyName = "";
+      this.queryParams.keyId = "";
+      this.resetForm("queryForm");
+      this.handleQuery();
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.keyId)
-      this.codes = selection.map((item) => item.keyCode)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
+      this.ids = selection.map((item) => item.keyId);
+      this.codes = selection.map((item) => item.keyCode);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset()
-      this.open = true
-      this.EditId = null
-      this.title = '新增钥匙信息'
+      this.reset();
+      this.open = true;
+      this.EditId = null;
+      this.title = "新增钥匙信息";
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset()
-      this.EditId = row.keyId || this.ids
+      this.reset();
+      this.EditId = row.keyId || this.ids;
       getKeyInfoAPI(this.EditId).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.EditId != null) {
             updateKeyAPI(this.form).then((response) => {
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            })
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
           } else {
-            console.log(this.form, 'form')
+            console.log(this.form, "form");
             addKeyAPI(this.form).then((response) => {
-              this.$modal.msgSuccess('新增成功')
-              this.open = false
-              this.EditId = null
-              this.getList()
-            })
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.EditId = null;
+              this.getList();
+            });
           }
         }
-      })
+      });
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const repairIds = row.keyId || this.ids
-      const repairCodes = row.keyCode || this.codes
+      const repairIds = row.keyId || this.ids;
+      const repairCodes = row.keyCode || this.codes;
       this.$modal
-        .confirm('是否确认删除硬件编码为"' + repairCodes + '"的数据项?')
-        .then(function() {
-          return delKeyAPI(repairIds)
+        .confirm('是否确认删除编码为"' + repairCodes + '"的数据项?')
+        .then(function () {
+          return delKeyAPI(repairIds);
         })
         .then(() => {
-          this.getList()
-          this.$modal.msgSuccess('删除成功')
-        })
-        .catch(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
         })
+        .catch(() => {});
     },
-
-
-  }
-}
+  },
+};
 </script>
 <style scoped>
 .imgstatus {

+ 2 - 2
src/views/mes/hw/Lock/index.vue

@@ -120,7 +120,7 @@
         prop="locksetRfid"
       />
       <el-table-column
-        label="物资id"
+        label="物资Id"
         align="center"
         prop="materialsId"
       />
@@ -489,7 +489,7 @@ export default {
       const repairIds = row.locksetId || this.ids
       const repairCodes = row.locksetCode || this.codes
       this.$modal
-        .confirm('是否确认删除硬件编码为"' + repairCodes + '"的数据项?')
+        .confirm('是否确认删除编码为"' + repairCodes + '"的数据项?')
         .then(function() {
           return delLockAPI(repairIds)
         })

+ 1 - 1
src/views/mes/hw/padLocks/index.vue

@@ -479,7 +479,7 @@ export default {
       const repairIds = row.lockId || this.ids
       const repairCodes = row.lockCode || this.codes
       this.$modal
-        .confirm('是否确认删除硬件编码为"' + repairCodes + '"的数据项?')
+        .confirm('是否确认删除编码为"' + repairCodes + '"的数据项?')
         .then(function() {
           return delPadLockAPI(repairIds)
         })

+ 1 - 1
src/views/mes/material/typeofmaterial/index.vue

@@ -124,7 +124,7 @@
             >新增</el-button
           >
           <el-button
-            v-if="scope.row.parentTypeId != 0"
+            v-if="scope.row.parentId != 0"
             size="mini"
             type="text"
             icon="el-icon-delete"

+ 168 - 114
src/views/mes/md/locksettype/index.vue

@@ -1,6 +1,12 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+    >
       <el-form-item label="挂锁类型编码" prop="locksetTypeCode">
         <el-input
           v-model="queryParams.locksetTypeCode"
@@ -18,10 +24,17 @@
         />
       </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-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">
@@ -33,7 +46,7 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['system:dept:add']"
-        >新增
+          >新增
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -43,10 +56,13 @@
           icon="el-icon-sort"
           size="mini"
           @click="toggleExpandAll"
-        >展开/折叠
+          >展开/折叠
         </el-button>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
     </el-row>
 
     <el-table
@@ -55,12 +71,28 @@
       :data="deptList"
       row-key="locksetTypeId"
       :default-expand-all="isExpandAll"
-      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
     >
-      <el-table-column prop="locksetTypeCode" label="挂锁类型编码" width="260"></el-table-column>
-      <el-table-column prop="locksetTypeName" label="挂锁类型名称" width="260"></el-table-column>
-      <el-table-column prop="locksetTypeDescription" label="挂锁类型描述" width="260"></el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column
+        prop="locksetTypeCode"
+        label="挂锁类型编码"
+        width="260"
+      ></el-table-column>
+      <el-table-column
+        prop="locksetTypeName"
+        label="挂锁类型名称"
+        width="260"
+      ></el-table-column>
+      <el-table-column
+        prop="locksetTypeDescription"
+        label="挂锁类型描述"
+        width="260"
+      ></el-table-column>
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -68,7 +100,7 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['mes:md:waa:edit']"
-          >修改
+            >修改
           </el-button>
           <el-button
             size="mini"
@@ -76,7 +108,7 @@
             icon="el-icon-plus"
             @click="handleAdd(scope.row)"
             v-hasPermi="['mes:md:waa:add']"
-          >新增
+            >新增
           </el-button>
 
           <el-button
@@ -86,7 +118,7 @@
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['mes:md:waa:remove']"
-          >删除
+            >删除
           </el-button>
         </template>
       </el-table-column>
@@ -98,8 +130,12 @@
         <el-row>
           <el-col :span="18">
             <el-form-item label="父级" prop="parentTypeId">
-              <treeselect style="width: 318px" v-model="form.parentTypeId" :options="deptOptions" :normalizer="normalizer"
-                          placeholder="选择父级"
+              <treeselect
+                style="width: 318px"
+                v-model="form.parentTypeId"
+                :options="deptOptions"
+                :normalizer="normalizer"
+                placeholder="选择父级"
               />
             </el-form-item>
           </el-col>
@@ -141,7 +177,6 @@
         <el-row>
           <el-col :span="10">
             <el-form-item label="锁具类型图标" prop="lockTypeIcon">
-
             </el-form-item>
           </el-col>
           <el-col :span="10">
@@ -177,14 +212,20 @@
 </template>
 
 <script>
-import {listLockType,getLockTypeInfo,addLockType,updateLockType,delLockType} from "@/api/mes/locktype/locktype"
-import Treeselect from '@riophae/vue-treeselect'
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
-import { genCode } from '@/api/system/autocode/rule'
+import {
+  listLockType,
+  getLockTypeInfo,
+  addLockType,
+  updateLockType,
+  delLockType,
+} from "@/api/mes/locktype/locktype";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { genCode } from "@/api/system/autocode/rule";
 
 export default {
-  name: 'Dept',
-  dicts: ['sys_normal_disable'],
+  name: "Dept",
+  dicts: ["sys_normal_disable"],
   components: { Treeselect },
   data() {
     return {
@@ -209,7 +250,7 @@ export default {
       // 部门树选项
       deptOptions: [],
       // 弹出层标题
-      title: '',
+      title: "",
       // 是否显示弹出层
       open: false,
       // 是否展开,默认全部展开
@@ -222,13 +263,13 @@ export default {
         size: -1,
         locksetTypeCode: null,
         locksetTypeName: null,
-        locksetTypeId: null
+        locksetTypeId: null,
       },
       // 总条数
       total: 0,
       // 表单参数
       form: {
-        parentTypeId:0,
+        parentTypeId: 0,
       },
       WorkShopListOptions: null, //所属车间下拉数据
       EditId: null, //判断是否是编辑弹框的值
@@ -239,62 +280,66 @@ export default {
         // ],
 
         locksetTypeCode: [
-          { required: true, message: '挂锁类型编号不能为空', trigger: 'blur' }
+          { required: true, message: "挂锁类型编号不能为空", trigger: "blur" },
         ],
         locksetTypeName: [
-          { required: true, message: '挂锁类型名称不能为空', trigger: 'blur' }
+          { required: true, message: "挂锁类型名称不能为空", trigger: "blur" },
         ],
-
-      }
-    }
+      },
+    };
   },
   created() {
-    this.getList()
+    this.getList();
   },
   methods: {
     /** 查询部门列表 */
     getList() {
-      this.loading = true
-      listLockType(this.queryParams).then(response => {
+      this.loading = true;
+      listLockType(this.queryParams).then((response) => {
         debugger;
-        var depts = this.handleTree(response.data.records, 'locksetTypeId', 'parentTypeId', 'children')
-        this.deptList = depts
-        this.loading = false
-      })
+        var depts = this.handleTree(
+          response.data.records,
+          "locksetTypeId",
+          "parentTypeId",
+          "children"
+        );
+        this.deptList = depts;
+        this.loading = false;
+      });
     },
     /** 转换部门数据结构 */
     normalizer(node) {
       if (node.children && !node.children.length) {
-        delete node.children
+        delete node.children;
       }
       return {
         id: node.locksetTypeId,
         label: node.locksetTypeName,
-        children: node.children
-      }
+        children: node.children,
+      };
     },
     // 取消按钮
     cancel() {
-      this.open = false
-      this.reset()
+      this.open = false;
+      this.reset();
     },
     // 表单重置
     reset() {
       this.form = {
         parentTypeId: undefined,
-        locksetTypeId:undefined,
-        locksetTypeName:undefined,
-        materialsTypeId:1,
-        locksetTypeDescription:undefined,
-        locksetTypeCode:undefined,
-      }
-      this.autoGenFlag = false
-      this.resetForm('form')
+        locksetTypeId: undefined,
+        locksetTypeName: undefined,
+        materialsTypeId: 1,
+        locksetTypeDescription: undefined,
+        locksetTypeCode: undefined,
+      };
+      this.autoGenFlag = false;
+      this.resetForm("form");
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.current = 1
-      this.getList()
+      this.queryParams.current = 1;
+      this.getList();
     },
     /** 重置按钮操作 */
     resetQuery() {
@@ -303,101 +348,110 @@ export default {
         size: -1,
         locksetTypeCode: null,
         locksetTypeName: null,
-        locksetTypeId: null
-      }
-      this.resetForm('queryForm')
-      this.handleQuery()
+        locksetTypeId: null,
+      };
+      this.resetForm("queryForm");
+      this.handleQuery();
     },
     /** 新增按钮操作 */
     handleAdd(row) {
-      this.reset()
+      this.reset();
       if (row != undefined) {
         this.form.parentTypeId = row.locksetTypeId;
-      }else{
+      } else {
         this.form.parentTypeId = 0;
       }
-      this.open = true
-      this.title = '添加工作区域'
-      listLockType().then(response => {
-        this.deptOptions = this.handleTree(response.data.records, 'locksetTypeId', 'parentTypeId', 'children')
-        console.log(this.deptOptions,'this.deptOptions')
-      })
+      this.open = true;
+      this.title = "添加工作区域";
+      listLockType().then((response) => {
+        this.deptOptions = this.handleTree(
+          response.data.records,
+          "locksetTypeId",
+          "parentTypeId",
+          "children"
+        );
+        console.log(this.deptOptions, "this.deptOptions");
+      });
     },
     /** 展开/折叠操作 */
     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.EditId = row.locksetTypeId || this.ids
-      getLockTypeInfo(row.locksetTypeId).then(response => {
-        this.form = response.data
-        this.open = true
-        this.title = '修改挂锁类型'
-
-      })
-      listLockType().then(response => {
-        this.deptOptions = this.handleTree(response.data.records, 'locksetTypeId', 'parentTypeId', 'children')
-      })
+      this.reset();
+      this.EditId = row.locksetTypeId || this.ids;
+      getLockTypeInfo(row.locksetTypeId).then((response) => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改挂锁类型";
+      });
+      listLockType().then((response) => {
+        this.deptOptions = this.handleTree(
+          response.data.records,
+          "locksetTypeId",
+          "parentTypeId",
+          "children"
+        );
+      });
     },
     //图片上传成功
     handleImgUplaoded(imgUrl) {
-      console.log(imgUrl,'编辑拿到的图片')
-      this.form.mapImg = imgUrl[0].url
+      console.log(imgUrl, "编辑拿到的图片");
+      this.form.mapImg = imgUrl[0].url;
     },
     //图片移除
     handleImgRemoved(imgUrl) {
-      this.form.mapImg = null
+      this.form.mapImg = null;
     },
     /** 提交按钮 */
-    submitForm: function() {
-      this.$refs['form'].validate(valid => {
+    submitForm: function () {
+      this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.locksetTypeId != undefined) {
-            updateLockType(this.form).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            })
+            updateLockType(this.form).then((response) => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
           } else {
-            console.log(this.form,'新增工作区域参数')
-            addLockType(this.form).then(response => {
-              this.$modal.msgSuccess('新增成功')
-              this.open = false
-              this.getList()
-            })
+            console.log(this.form, "新增工作区域参数");
+            addLockType(this.form).then((response) => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
           }
         }
-      })
+      });
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      this.$modal.confirm('是否确认删除名称为"' + row.locksetTypeCode + '"的数据项?').then(function() {
-        return delLockType(row.locksetTypeId)
-      }).then(() => {
-        this.getList()
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
+      this.$modal
+        .confirm('是否确认删除编号为"' + row.locksetTypeCode + '"的数据项?')
+        .then(function () {
+          return delLockType(row.locksetTypeId);
+        })
+        .then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
     },
     //自动生成编码
     handleAutoGenChange(autoGenFlag) {
       if (autoGenFlag) {
-        genCode('LOCK_TYPE_CODE').then((response) => {
-          this.form.locksetTypeCode = response
-        })
+        genCode("LOCK_TYPE_CODE").then((response) => {
+          this.form.locksetTypeCode = response;
+        });
       } else {
-        this.form.locksetTypeCode = null
+        this.form.locksetTypeCode = null;
       }
     },
-
-
-  }
-
-}
+  },
+};
 </script>

+ 200 - 126
src/views/mes/md/locktype/index.vue

@@ -1,6 +1,12 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+    >
       <el-form-item label="挂锁类型编码" prop="lockTypeCode">
         <el-input
           v-model="queryParams.lockTypeCode"
@@ -18,10 +24,17 @@
         />
       </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-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">
@@ -33,7 +46,7 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['system:dept:add']"
-        >新增
+          >新增
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -43,10 +56,13 @@
           icon="el-icon-sort"
           size="mini"
           @click="toggleExpandAll"
-        >展开/折叠
+          >展开/折叠
         </el-button>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar
+        :showSearch.sync="showSearch"
+        @queryTable="getList"
+      ></right-toolbar>
     </el-row>
 
     <el-table
@@ -55,24 +71,50 @@
       :data="deptList"
       row-key="lockTypeId"
       :default-expand-all="isExpandAll"
-      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
     >
-      <el-table-column prop="lockTypeCode" label="挂锁类型编码" width="260"></el-table-column>
-      <el-table-column prop="lockTypeName" label="挂锁类型名称" width="260"></el-table-column>
+      <el-table-column
+        prop="lockTypeCode"
+        label="挂锁类型编码"
+        width="260"
+      ></el-table-column>
+      <el-table-column
+        prop="lockTypeName"
+        label="挂锁类型名称"
+        width="260"
+      ></el-table-column>
       <el-table-column prop="lockTypeIcon" label="挂锁类型图标" width="260">
         <template slot-scope="scope">
-          <img style="width: 50px;height:50px" :src="scope.row.lockTypeIcon" alt="" v-if="scope.row.lockTypeIcon">
+          <img
+            style="width: 50px; height: 50px"
+            :src="scope.row.lockTypeIcon"
+            alt=""
+            v-if="scope.row.lockTypeIcon"
+          />
           <span v-else>-</span>
         </template>
       </el-table-column>
       <el-table-column prop="lockTypeImg" label="挂锁类型图片" width="260">
         <template slot-scope="scope">
-          <img style="width: 50px;height:50px" :src="scope.row.lockTypeImg" alt="" v-if="scope.row.lockTypeImg">
+          <img
+            style="width: 50px; height: 50px"
+            :src="scope.row.lockTypeImg"
+            alt=""
+            v-if="scope.row.lockTypeImg"
+          />
           <span v-else>-</span>
         </template>
       </el-table-column>
-      <el-table-column prop="lockTypeDescription" label="挂锁类型描述" width="260"></el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column
+        prop="lockTypeDescription"
+        label="挂锁类型描述"
+        width="260"
+      ></el-table-column>
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -80,7 +122,7 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['mes:md:waa:edit']"
-          >修改
+            >修改
           </el-button>
           <el-button
             size="mini"
@@ -88,7 +130,7 @@
             icon="el-icon-plus"
             @click="handleAdd(scope.row)"
             v-hasPermi="['mes:md:waa:add']"
-          >新增
+            >新增
           </el-button>
 
           <el-button
@@ -98,20 +140,24 @@
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['mes:md:waa:remove']"
-          >删除
+            >删除
           </el-button>
         </template>
       </el-table-column>
     </el-table>
 
-    <!-- 添加或修改部门对话框 -->
+    <!-- 添加或修改锁具类型对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-row>
           <el-col :span="18">
             <el-form-item label="父级" prop="parentTypeId">
-              <treeselect style="width: 318px" v-model="form.parentTypeId" :options="deptOptions" :normalizer="normalizer"
-                          placeholder="选择父级"
+              <treeselect
+                style="width: 318px"
+                v-model="form.parentTypeId"
+                :options="deptOptions"
+                :normalizer="normalizer"
+                placeholder="选择父级"
               />
             </el-form-item>
           </el-col>
@@ -171,16 +217,23 @@
           </el-col>
         </el-row>
         <el-form-item label="挂锁类型图标" prop="lockTypeIcon">
-          <ImageUpload :limit="1" :value="form.lockTypeIcon" :fileSize="5" @onUploaded="handleImgUplaoded"
-                       @onRemoved="handleImgRemoved"
+          <ImageUpload
+            :limit="1"
+            :value="form.lockTypeIcon"
+            :fileSize="5"
+            @onUploaded="handleImgUplaoded"
+            @onRemoved="handleImgRemoved"
           ></ImageUpload>
         </el-form-item>
         <el-form-item label="挂锁类型图片" prop="lockTypeImg">
-          <ImageUpload :limit="1" :value="form.lockTypeImg" :fileSize="5" @onUploaded="handleImgUplaoded1"
-                       @onRemoved="handleImgRemoved1"
+          <ImageUpload
+            :limit="1"
+            :value="form.lockTypeImg"
+            :fileSize="5"
+            @onUploaded="handleImgUplaoded1"
+            @onRemoved="handleImgRemoved1"
           ></ImageUpload>
         </el-form-item>
-
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -191,15 +244,21 @@
 </template>
 
 <script>
-import {listPadLockTypeAPI,getPadLockTypeInfoAPI,addPadLockTypeAPI,updatePadLockTypeAPI,delPadLockTypeAPI} from "@/api/mes/padLockType/padLockType"
-import Treeselect from '@riophae/vue-treeselect'
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
-import { genCode } from '@/api/system/autocode/rule'
-import { listHanrwareType } from '@/api/mes/hw/hadrwareType'
+import {
+  listPadLockTypeAPI,
+  getPadLockTypeInfoAPI,
+  addPadLockTypeAPI,
+  updatePadLockTypeAPI,
+  delPadLockTypeAPI,
+} from "@/api/mes/padLockType/padLockType";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { genCode } from "@/api/system/autocode/rule";
+import { listHanrwareType } from "@/api/mes/hw/hadrwareType";
 
 export default {
-  name: 'Dept',
-  dicts: ['sys_normal_disable'],
+  name: "Dept",
+  dicts: ["sys_normal_disable"],
   components: { Treeselect },
   data() {
     return {
@@ -224,7 +283,7 @@ export default {
       // 部门树选项
       deptOptions: [],
       // 弹出层标题
-      title: '',
+      title: "",
       // 是否显示弹出层
       open: false,
       // 是否展开,默认全部展开
@@ -237,15 +296,15 @@ export default {
         size: -1,
         lockTypeCode: null,
         lockTypeName: null,
-        lockTypeId: null
+        lockTypeId: null,
       },
       // 总条数
       total: 0,
       // 表单参数
       form: {
-        parentTypeId:0,
+        parentTypeId: 0,
       },
-      machinerytypeOptions:[],//硬件类型
+      machinerytypeOptions: [], //硬件类型
       EditId: null, //判断是否是编辑弹框的值
       // 表单校验
       rules: {
@@ -254,40 +313,44 @@ export default {
         // ],
 
         lockTypeCode: [
-          { required: true, message: '挂锁类型编号不能为空', trigger: 'blur' }
+          { required: true, message: "挂锁类型编号不能为空", trigger: "blur" },
         ],
         lockTypeName: [
-          { required: true, message: '挂锁类型名称不能为空', trigger: 'blur' }
+          { required: true, message: "挂锁类型名称不能为空", trigger: "blur" },
         ],
-
-      }
-    }
+      },
+    };
   },
   created() {
-    this.getList()
-    this.getTreeselect()
+    this.getList();
+    this.getTreeselect();
   },
   methods: {
     /** 查询部门列表 */
     getList() {
-      this.loading = true
-      listPadLockTypeAPI(this.queryParams).then(response => {
+      this.loading = true;
+      listPadLockTypeAPI(this.queryParams).then((response) => {
         debugger;
-        var depts = this.handleTree(response.data.records, 'lockTypeId', 'parentTypeId', 'children')
-        this.deptList = depts
-        this.loading = false
-      })
+        var depts = this.handleTree(
+          response.data.records,
+          "lockTypeId",
+          "parentTypeId",
+          "children"
+        );
+        this.deptList = depts;
+        this.loading = false;
+      });
     },
     /** 转换部门数据结构 */
     normalizer(node) {
       if (node.children && !node.children.length) {
-        delete node.children
+        delete node.children;
       }
       return {
         id: node.lockTypeId,
         label: node.lockTypeName,
-        children: node.children
-      }
+        children: node.children,
+      };
     },
     /** 查询挂锁类型下拉树结构 */
     getTreeselect() {
@@ -316,27 +379,27 @@ export default {
     },
     // 取消按钮
     cancel() {
-      this.open = false
-      this.reset()
+      this.open = false;
+      this.reset();
     },
     // 表单重置
     reset() {
       this.form = {
         parentTypeId: undefined,
-        lockTypeId:undefined,
-        lockTypeName:undefined,
-        lockTypeIcon:undefined,
-        lockTypeImg:undefined,
-        lockTypeDescription:undefined,
-        lockTypeCode:undefined,
-      }
-      this.autoGenFlag = false
-      this.resetForm('form')
+        lockTypeId: undefined,
+        lockTypeName: undefined,
+        lockTypeIcon: undefined,
+        lockTypeImg: undefined,
+        lockTypeDescription: undefined,
+        lockTypeCode: undefined,
+      };
+      this.autoGenFlag = false;
+      this.resetForm("form");
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.current = 1
-      this.getList()
+      this.queryParams.current = 1;
+      this.getList();
     },
     /** 重置按钮操作 */
     resetQuery() {
@@ -345,109 +408,120 @@ export default {
         size: -1,
         lockTypeCode: null,
         lockTypeName: null,
-        lockTypeId: null
-      }
-      this.resetForm('queryForm')
-      this.handleQuery()
+        lockTypeId: null,
+      };
+      this.resetForm("queryForm");
+      this.handleQuery();
     },
     /** 新增按钮操作 */
     handleAdd(row) {
-      this.reset()
+      this.reset();
       if (row != undefined) {
         this.form.parentTypeId = row.lockTypeId;
-      }else{
+      } else {
         this.form.parentTypeId = 0;
       }
-      this.open = true
-      this.title = '添加工作区域'
-      listPadLockTypeAPI().then(response => {
-        this.deptOptions = this.handleTree(response.data.records, 'lockTypeId', 'parentTypeId', 'children')
-        console.log(this.deptOptions,'this.deptOptions')
-      })
+      this.open = true;
+      this.title = "添加工作区域";
+      listPadLockTypeAPI().then((response) => {
+        this.deptOptions = this.handleTree(
+          response.data.records,
+          "lockTypeId",
+          "parentTypeId",
+          "children"
+        );
+        console.log(this.deptOptions, "this.deptOptions");
+      });
     },
     /** 展开/折叠操作 */
     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.EditId = row.lockTypeId || this.ids
-      getPadLockTypeInfoAPI(row.lockTypeId).then(response => {
-        this.form = response.data
-        this.open = true
-        this.title = '修改挂锁类型'
-
-      })
-      listPadLockTypeAPI().then(response => {
-        this.deptOptions = this.handleTree(response.data.records, 'lockTypeId', 'parentTypeId', 'children')
-      })
+      this.reset();
+      this.EditId = row.lockTypeId || this.ids;
+      getPadLockTypeInfoAPI(row.lockTypeId).then((response) => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改挂锁类型";
+      });
+      listPadLockTypeAPI().then((response) => {
+        this.deptOptions = this.handleTree(
+          response.data.records,
+          "lockTypeId",
+          "parentTypeId",
+          "children"
+        );
+      });
     },
 
     /** 提交按钮 */
-    submitForm: function() {
-      this.$refs['form'].validate(valid => {
+    submitForm: function () {
+      this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.lockTypeId != undefined) {
-            updatePadLockTypeAPI(this.form).then(response => {
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            })
+            updatePadLockTypeAPI(this.form).then((response) => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
           } else {
-            console.log(this.form,'新增工作区域参数')
-            addPadLockTypeAPI(this.form).then(response => {
-              this.$modal.msgSuccess('新增成功')
-              this.open = false
-              this.getList()
-            })
+            console.log(this.form, "新增工作区域参数");
+            addPadLockTypeAPI(this.form).then((response) => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
           }
         }
-      })
+      });
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      this.$modal.confirm('是否确认删除名称为"' + row.lockTypeCode + '"的数据项?').then(function() {
-        return delPadLockTypeAPI(row.lockTypeId)
-      }).then(() => {
-        this.getList()
-        this.$modal.msgSuccess('删除成功')
-      }).catch(() => {
-      })
+      this.$modal
+        .confirm('是否确认删除编号为"' + row.lockTypeCode + '"的数据项?')
+        .then(function () {
+          return delPadLockTypeAPI(row.lockTypeId);
+        })
+        .then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
     },
     //自动生成编码
     handleAutoGenChange(autoGenFlag) {
       if (autoGenFlag) {
-        genCode('PAD_LOCK_TYPE_CODE').then((response) => {
-          this.form.lockTypeCode = response
-        })
+        genCode("PAD_LOCK_TYPE_CODE").then((response) => {
+          this.form.lockTypeCode = response;
+        });
       } else {
-        this.form.lockTypeCode = null
+        this.form.lockTypeCode = null;
       }
     },
     //图片上传成功
     handleImgUplaoded(imgUrl) {
-      console.log(imgUrl,'编辑拿到的图片')
-      this.form.lockTypeIcon = imgUrl[0].url
+      console.log(imgUrl, "编辑拿到的图片");
+      this.form.lockTypeIcon = imgUrl[0].url;
     },
     //图片移除
     handleImgRemoved(imgUrl) {
-      this.form.lockTypeIcon = null
+      this.form.lockTypeIcon = null;
     },
     //图片上传成功
     handleImgUplaoded1(imgUrl) {
-      console.log(imgUrl,'编辑拿到的图片')
-      this.form.lockTypeImg = imgUrl[0].url
+      console.log(imgUrl, "编辑拿到的图片");
+      this.form.lockTypeImg = imgUrl[0].url;
     },
     //图片移除
     handleImgRemoved1(imgUrl) {
-      this.form.lockTypeImg = null
+      this.form.lockTypeImg = null;
     },
-  }
-
-}
+  },
+};
 </script>