Browse Source

新增锁具类型,挂锁类型,锁具,钥匙,挂锁

pm 11 tháng trước cách đây
mục cha
commit
0127da98b5

+ 46 - 0
src/api/mes/Keys/Keys.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+
+
+// 查询锁具-列表
+export function listKeyAPI(query) {
+  return request({
+    url: '/iscs/key/getIsKeyPage',
+    method: 'get',
+    params: query
+  })
+}
+
+// 获取锁具详细信息
+export function getKeyInfoAPI(repairId) {
+  return request({
+    url: '/iscs/key/selectIsKeyById?keyId=' + repairId,
+    method: 'get'
+  })
+}
+
+//新增锁具
+export function addKeyAPI(query) {
+  return request({
+    url: '/iscs/key/insertIsKey',
+    method: 'post',
+    data: query
+  })
+}
+
+// 修改锁具信息
+export function updateKeyAPI(data) {
+  return request({
+    url: '/iscs/key/updateIsKey',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除锁具信息
+export function delKeyAPI(repairId) {
+  return request({
+    url: '/iscs/key/deleteIsKeyByKeyIds?keyIds='+ repairId,
+    method: 'post'
+
+  })
+}

+ 46 - 0
src/api/mes/Lock/Lock.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+
+
+// 查询锁具-列表
+export function listLockAPI(query) {
+  return request({
+    url: '/iscs/lockset/getIsLocksetPage',
+    method: 'get',
+    params: query
+  })
+}
+
+// 获取锁具详细信息
+export function getLockInfoAPI(repairId) {
+  return request({
+    url: '/iscs/lockset/selectIsLocksetById?locksetId=' + repairId,
+    method: 'get'
+  })
+}
+
+//新增锁具
+export function addLockAPI(query) {
+  return request({
+    url: '/iscs/lockset/insertIsLockset',
+    method: 'post',
+    data: query
+  })
+}
+
+// 修改锁具信息
+export function updateLockAPI(data) {
+  return request({
+    url: '/iscs/lockset/updateIsLockset',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除锁具信息
+export function delLockAPI(repairId) {
+  return request({
+    url: '/iscs/lockset/deleteIsLocksetByLocksetIds?locksetIds='+ repairId,
+    method: 'post'
+
+  })
+}

+ 10 - 10
src/api/mes/locktype/locktype.js

@@ -1,45 +1,45 @@
 import request from '@/utils/request'
 
 
-// 查询锁具类型-列表
+// 查询锁具-列表
 export function listLockType(query) {
   return request({
-    url: '/iscs/lockType/getIsLockTypePage',
+    url: '/iscs/type/getIsLocksetTypePage',
     method: 'get',
     params: query
   })
 }
 
-// 获取锁具类型详细信息
+// 获取锁具详细信息
 export function getLockTypeInfo(repairId) {
   return request({
-    url: '/dev-api/iscs/lockType/selectIsLockTypeById?id=' + repairId,
+    url: '/iscs/type/selectIsLocksetTypeById?locksetTypeId=' + repairId,
     method: 'get'
   })
 }
 
-//新增锁具类型
+//新增锁具
 export function addLockType(query) {
   return request({
-    url: '/iscs/lockType/insertIsLockType',
+    url: '/iscs/type/insertIsLocksetType',
     method: 'post',
     data: query
   })
 }
 
-// 修改设备维修单
+// 修改锁具信息
 export function updateLockType(data) {
   return request({
-    url: '/iscs/lockType/updateIsLockType',
+    url: '/iscs/type/updateIsLocksetType',
     method: 'post',
     data: data
   })
 }
 
-// 删除设备维修单
+// 删除锁具信息
 export function delLockType(repairId) {
   return request({
-    url: '/iscs/lockType/deleteIsLockTypeByLockTypeIds?ids='+ repairId,
+    url: '/iscs/type/deleteIsLocksetTypeByLocksetTypeIds?locksetTypeIds='+ repairId,
     method: 'post'
 
   })

+ 46 - 0
src/api/mes/padLockType/padLockType.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+
+
+// 查询挂锁类型-列表
+export function listPadLockTypeAPI(query) {
+  return request({
+    url: '/iscs/lockType/getIsLockTypePage',
+    method: 'get',
+    params: query
+  })
+}
+
+// 获取挂锁类型详细信息
+export function getPadLockTypeInfoAPI(repairId) {
+  return request({
+    url: '/iscs/lockType/selectIsLockTypeById?lockTypeId=' + repairId,
+    method: 'get'
+  })
+}
+
+//新增挂锁类型
+export function addPadLockTypeAPI(query) {
+  return request({
+    url: '/iscs/lockType/insertIsLockType',
+    method: 'post',
+    data: query
+  })
+}
+
+// 修改挂锁类型信息
+export function updatePadLockTypeAPI(data) {
+  return request({
+    url: '/iscs/lockType/updateIsLockType',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除挂锁类型信息
+export function delPadLockTypeAPI(repairId) {
+  return request({
+    url: '/iscs/lockType/deleteIsLockTypeByLockTypeIds?lockTypeIds='+ repairId,
+    method: 'post'
+
+  })
+}

+ 46 - 0
src/api/mes/padLocks/padLocks.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+
+
+// 查询挂锁-列表
+export function listPadLockAPI(query) {
+  return request({
+    url: '/iscs/lock/getIsLockPage',
+    method: 'get',
+    params: query
+  })
+}
+
+// 获取挂锁详细信息
+export function getPadLockInfoAPI(repairId) {
+  return request({
+    url: '/iscs/lock/selectIsLockById?lockId=' + repairId,
+    method: 'get'
+  })
+}
+
+//新增挂锁
+export function addPadLockAPI(query) {
+  return request({
+    url: '/iscs/lock/insertIsLock',
+    method: 'post',
+    data: query
+  })
+}
+
+// 修改挂锁信息
+export function updatePadLockAPI(data) {
+  return request({
+    url: '/iscs/lock/updateIsLock',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除挂锁信息
+export function delPadLockAPI(repairId) {
+  return request({
+    url: '/iscs/lock/deleteIsLockByLockIds?lockIds='+ repairId,
+    method: 'post'
+
+  })
+}

+ 522 - 0
src/views/mes/hw/Keys/index.vue

@@ -0,0 +1,522 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="100px"
+    >
+      <el-row>
+
+        <el-form-item label="锁具编码" prop="locksetCode">
+          <el-input
+            v-model="queryParams.locksetCode"
+            placeholder="请输入锁具编码"
+            clearable
+            @keyup.enter.native="handleQuery"
+          />
+        </el-form-item>
+
+        <el-form-item label="锁具名称" prop="locksetName">
+          <el-input
+            v-model="queryParams.locksetName"
+            placeholder="请输入锁具名称"
+            clearable
+            @keyup.enter.native="handleQuery"
+          />
+        </el-form-item>
+
+      </el-row>
+      <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:information:add']"
+        >新增
+        </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="['mes:hw:information: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="keyCode"
+      />
+      <el-table-column
+        label="钥匙名称"
+        width="120px"
+        align="center"
+        prop="keyName"
+      />
+      <el-table-column
+        label="钥匙NFC"
+        width="150px"
+        align="center"
+        prop="keyNfc"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column
+        label="MAC地址"
+        align="center"
+        prop="macAddress"
+      />
+
+      <el-table-column
+        label="硬件类型Id"
+        align="center"
+        prop="hardwareId"
+      />
+      <el-table-column
+        label="创建时间"
+        align="center"
+        prop="createTime"
+        width="180"
+      >
+        <template slot-scope="scope">
+          <span>{{ scope.row.createTime }}</span>
+        </template>
+      </el-table-column>
+
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['mes:hw:information:edit']"
+          >编辑
+          </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 size="mini" type="text">预览</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
+      :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
+            v-model="form.hardwareId"
+            :options="machinerytypeOptions"
+            :normalizer="normalizer"
+            placeholder="请选择父类型"
+          />
+        </el-form-item>
+        <el-row>
+          <el-col :span="15">
+            <el-form-item label="钥匙编码" prop="keyCode">
+              <el-input
+                v-model="form.keyCode"
+                placeholder="请输入钥匙编码"
+                style="width: 100%"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label-width="80">
+              <el-switch
+                v-model="autoGenFlag"
+                active-color="#13ce66"
+                active-text="自动生成"
+                @change="handleAutoGenChange(autoGenFlag)"
+              >
+              </el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-form-item label="钥匙名称" prop="keyName">
+          <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-form-item>
+        <el-form-item label="MAC地址" prop="macAddress">
+          <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-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 {
+  listKeyAPI,
+  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'
+
+
+export default {
+  name: 'lock',
+  dicts: ['hardware_status'],
+  components: { Treeselect },
+  data() {
+    return {
+      autoGenFlag: false,
+      optType: undefined,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      codes: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 设备维修单表格数据
+      repairList: [],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      createTime: '',
+      queryParams: {
+        current: 1,
+        size: 10,
+        keyCode: null,
+        keyName: null,
+        keyNfc: null,
+        macAddress: null,
+      },
+
+      // 表单参数
+      form: {
+        hardwareId:null
+      },
+      // 表单校验
+      rules: {
+        keyCode: [
+          { required: true, message: '钥匙编码不能为空', trigger: 'blur' }
+        ],
+        keyName: [
+          { required: true, message: '钥匙名称不能为空', trigger: 'blur' }
+        ]
+      },
+      // 日期选择
+      pickerOptions: {
+        shortcuts: [
+          {
+            text: '最近一周',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
+              picker.$emit('pick', [start, end])
+            }
+          },
+          {
+            text: '最近一个月',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
+              picker.$emit('pick', [start, end])
+            }
+          },
+          {
+            text: '最近三个月',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
+              picker.$emit('pick', [start, end])
+            }
+          }
+        ]
+      },
+
+      // 新增状态
+
+      EditId: 0, //修改判断
+      machinerytypeOptions:[],//锁具类型
+    }
+  },
+  created() {
+    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')
+        })
+      } else {
+        this.form.keyCode = null
+      }
+    },
+    /** 查询设备维修单列表 */
+
+    getList() {
+      this.loading = true
+
+      // 锁具数据
+      listKeyAPI(this.queryParams).then((response) => {
+        this.repairList = response.data.records
+        this.total = response.data.total
+        this.loading = false
+      })
+
+    },
+    /** 查询锁具类型下拉树结构 */
+    getTreeselect() {
+      listHanrwareType().then((response) => {
+        debugger;
+        this.machinerytypeOptions = [];
+        const data = this.handleTree(
+          response.data.records,
+          "id",
+          "parentTypeId"
+        )[0];
+        // console.log(data, "父类型回显");
+        this.machinerytypeOptions.push(data);
+      });
+    },
+    /** 转换设备类型数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.id,
+        label: node.hardwareTypeName,
+        children: node.children,
+      };
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false
+      this.reset()
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        keyName: null,
+        keyCode: null,
+        keyNfc: null,
+        macAddress:null,
+        remark: null,
+      }
+
+      this.autoGenFlag = false
+      this.resetForm('form')
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.current = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      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
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset()
+      this.open = true
+      this.EditId = null
+      this.title = '新增钥匙信息'
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset()
+      this.EditId = row.keyId || this.ids
+      getKeyInfoAPI(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) {
+            updateKeyAPI(this.form).then((response) => {
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
+          } else {
+            console.log(this.form, 'form')
+            addKeyAPI(this.form).then((response) => {
+              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
+      this.$modal
+        .confirm('是否确认删除硬件编码为"' + repairCodes + '"的数据项?')
+        .then(function() {
+          return delKeyAPI(repairIds)
+        })
+        .then(() => {
+          this.getList()
+          this.$modal.msgSuccess('删除成功')
+        })
+        .catch(() => {
+        })
+    },
+
+
+  }
+}
+</script>
+<style scoped>
+.imgstatus {
+  position: relative;
+  top: 1px;
+  left: 0px;
+}
+
+/deep/ .el-radio__inner {
+  border-radius: 2px;
+}
+
+/deep/ .el-radio__input.is-checked .el-radio__inner::after {
+  content: "";
+  width: 8px;
+  height: 3px;
+  border: 1px solid white;
+  border-top: transparent;
+  border-right: transparent;
+  text-align: center;
+  display: block;
+  position: absolute;
+  top: 3px;
+  left: 2px;
+  transform: rotate(-45deg);
+  border-radius: 0pc;
+  background: none;
+}
+</style>

+ 544 - 0
src/views/mes/hw/Lock/index.vue

@@ -0,0 +1,544 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="100px"
+    >
+      <el-row>
+
+          <el-form-item label="锁具编码" prop="locksetCode">
+            <el-input
+              v-model="queryParams.locksetCode"
+              placeholder="请输入锁具编码"
+              clearable
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+
+          <el-form-item label="锁具名称" prop="locksetName">
+            <el-input
+              v-model="queryParams.locksetName"
+              placeholder="请输入锁具名称"
+              clearable
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+
+
+          <el-form-item label="锁具类型" prop="locksetTypeId">
+            <treeselect style="width: 218px" v-model="form.locksetTypeId" :options="locksetTypeOption" :normalizer="normalizer"
+                        placeholder="选择锁具类型"
+            />
+          </el-form-item>
+
+      </el-row>
+      <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:information:add']"
+        >新增
+        </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="['mes:hw:information: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="locksetCode"
+      />
+      <el-table-column
+        label="锁具名称"
+        width="150px"
+        align="center"
+        prop="locksetName"
+        :show-overflow-tooltip="true"
+      />
+      <el-table-column
+        label="锁具类型"
+        align="center"
+        prop="locksetTypeId"
+      />
+      <el-table-column
+        label="锁具NFC"
+        align="center"
+        prop="locksetNfc"
+      />
+      <el-table-column
+        label="锁具RFID"
+        align="center"
+        prop="locksetRfid"
+      />
+      <el-table-column
+        label="物资id"
+        align="center"
+        prop="materialsId"
+      />
+      <el-table-column
+        label="创建时间"
+        align="center"
+        prop="createTime"
+        width="180"
+      >
+        <template slot-scope="scope">
+          <span>{{ scope.row.createTime }}</span>
+        </template>
+      </el-table-column>
+
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['mes:hw:information:edit']"
+          >编辑
+          </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 size="mini" type="text">预览</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
+      :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="locksetTypeId">
+          <treeselect v-model="form.locksetTypeId" :options="locksetTypeOption" :normalizer="normalizer"
+                      placeholder="选择锁具类型"
+          />
+        </el-form-item>
+        <el-row>
+          <el-col :span="15">
+            <el-form-item label="锁具编码" prop="locksetCode">
+              <el-input
+                v-model="form.locksetCode"
+                placeholder="请输入锁具编码"
+                style="width: 100%"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label-width="80">
+              <el-switch
+                v-model="autoGenFlag"
+                active-color="#13ce66"
+                active-text="自动生成"
+                @change="handleAutoGenChange(autoGenFlag)"
+              >
+              </el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-form-item label="锁具名称" prop="locksetName">
+          <el-input
+            v-model="form.locksetName"
+            placeholder="请输入锁具名称"
+          />
+        </el-form-item>
+        <el-form-item label="锁具NFC" prop="locksetNfc">
+          <el-input
+            v-model="form.locksetNfc"
+            placeholder="请输入锁具Nfc"
+          />
+        </el-form-item>
+        <el-form-item label="锁具RFID" prop="locksetRfid">
+          <el-input
+            v-model="form.locksetRfid"
+            placeholder="请输入锁具RFID"
+          />
+        </el-form-item>
+        <el-form-item label="物资Id" prop="materialsId">
+          <el-input
+            v-model="form.materialsId"
+            placeholder="请输入物资Id"
+          />
+        </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 {
+  listLockAPI,
+  addLockAPI,
+  updateLockAPI,
+  delLockAPI,
+  getLockInfoAPI
+
+} from '@/api/mes/Lock/Lock'
+import { genCode } from '@/api/system/autocode/rule'
+import { listLockType } from '@/api/mes/locktype/locktype'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+
+export default {
+  name: 'lock',
+  dicts: ['hardware_status'],
+  components: { Treeselect },
+  data() {
+    return {
+      autoGenFlag: false,
+      optType: undefined,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      codes: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 设备维修单表格数据
+      repairList: [],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      createTime: '',
+      queryParams: {
+        current: 1,
+        size: 10,
+       locksetCode: null,
+        locksetName: null,
+        locksetNfc: null,
+        locksetRfid: null,
+        locksetTypeId: null,
+        materialsId: null,
+      },
+
+      locksetTypeOption: [],
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        locksetCode: [
+          { required: true, message: '锁具编码不能为空', trigger: 'blur' }
+        ],
+        locksetName: [
+          { required: true, message: '锁具名称不能为空', trigger: 'blur' }
+        ]
+      },
+      // 日期选择
+      pickerOptions: {
+        shortcuts: [
+          {
+            text: '最近一周',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
+              picker.$emit('pick', [start, end])
+            }
+          },
+          {
+            text: '最近一个月',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
+              picker.$emit('pick', [start, end])
+            }
+          },
+          {
+            text: '最近三个月',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
+              picker.$emit('pick', [start, end])
+            }
+          }
+        ]
+      },
+      value2: '',
+      // 新增状态
+
+      EditId: 0, //修改判断
+      cascaderOptions: [],// 转换后的数据
+      flatHardwareTypeOption: [] // 用于快速查找
+    }
+  },
+  created() {
+    this.getList()
+    this.getLockTypeList()
+
+  },
+  methods: {
+    // 格式化日期查询数据
+    formatDate(date) {
+      if (date && date instanceof Date && !isNaN(date)) {
+        // 使用本地时间
+        return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
+          2,
+          '0'
+        )}-${String(date.getDate()).padStart(2, '0')}`
+      }
+      return null
+    },
+    /** 查询设备维修单列表 */
+
+    getList() {
+      this.loading = true
+      // 格式化日期并更新 queryParams
+      if (Array.isArray(this.createTime) && this.createTime.length === 2) {
+        this.queryParams.startTime = this.formatDate(this.createTime[0])
+        this.queryParams.endTime = this.formatDate(this.createTime[1])
+      }
+      // 锁具数据
+      listLockAPI(this.queryParams).then((response) => {
+        this.repairList = response.data.records
+        this.total = response.data.total
+        this.loading = false
+      })
+
+    },
+    // 获取锁具类型-所有
+    getLockTypeList() {
+      const data = {
+        current: 1,
+        size: -1
+      }
+      listLockType(data).then(response => {
+        this.locksetTypeOption = this.handleTree(response.data.records, 'locksetTypeId', 'parentTypeId', 'children')
+        console.log(this.locksetTypeOption, 'this.locksetTypeOption')
+      })
+    },
+    /** 转换部门数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.locksetTypeId,
+        label: node.locksetTypeName,
+        children: node.children
+      }
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false
+      this.reset()
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        locksetTypeId: null,
+        locksetName: null,
+        locksetCode: null,
+        locksetNfc: null,
+        locksetRfid: null,
+        materialsId: null
+      }
+
+      this.autoGenFlag = false
+      this.resetForm('form')
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.current = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams.locksetCode = ''
+      this.queryParams.locksetName = ''
+      this.queryParams.locksetTypeId = ''
+
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map((item) => item.locksetId)
+      this.codes = selection.map((item) => item.locksetCode)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset()
+      this.open = true
+      this.EditId = null
+      this.title = '新增锁具信息'
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset()
+      this.EditId = row.locksetId || this.ids
+      getLockInfoAPI(this.EditId).then((response) => {
+        console.log(response,'编辑拿到单挑数')
+        this.form = response.data
+        this.open = true
+        this.title = '编辑锁具信息'
+      })
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs['form'].validate((valid) => {
+        if (valid) {
+          if (this.EditId != null) {
+            updateLockAPI(this.form).then((response) => {
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
+          } else {
+            console.log(this.form, 'form')
+            addLockAPI(this.form).then((response) => {
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.EditId = null
+              this.getList()
+            })
+          }
+        }
+      })
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const repairIds = row.locksetId || this.ids
+      const repairCodes = row.locksetCode || this.codes
+      this.$modal
+        .confirm('是否确认删除硬件编码为"' + repairCodes + '"的数据项?')
+        .then(function() {
+          return delLockAPI(repairIds)
+        })
+        .then(() => {
+          this.getList()
+          this.$modal.msgSuccess('删除成功')
+        })
+        .catch(() => {
+        })
+    },
+
+    //自动生成编码
+    handleAutoGenChange(autoGenFlag) {
+      if (autoGenFlag) {
+        genCode('LOCK_CODE').then((response) => {
+          this.form.locksetCode = response
+        })
+      } else {
+        this.form.locksetCode = null
+      }
+    }
+  }
+}
+</script>
+<style scoped>
+.imgstatus {
+  position: relative;
+  top: 1px;
+  left: 0px;
+}
+
+/deep/ .el-radio__inner {
+  border-radius: 2px;
+}
+
+/deep/ .el-radio__input.is-checked .el-radio__inner::after {
+  content: "";
+  width: 8px;
+  height: 3px;
+  border: 1px solid white;
+  border-top: transparent;
+  border-right: transparent;
+  text-align: center;
+  display: block;
+  position: absolute;
+  top: 3px;
+  left: 2px;
+  transform: rotate(-45deg);
+  border-radius: 0pc;
+  background: none;
+}
+</style>

+ 525 - 0
src/views/mes/hw/padLocks/index.vue

@@ -0,0 +1,525 @@
+<template>
+  <div class="app-container">
+    <el-form
+      :model="queryParams"
+      ref="queryForm"
+      size="small"
+      :inline="true"
+      v-show="showSearch"
+      label-width="100px"
+    >
+      <el-row>
+
+        <el-form-item label="锁具编码" prop="locksetCode">
+          <el-input
+            v-model="queryParams.locksetCode"
+            placeholder="请输入锁具编码"
+            clearable
+            @keyup.enter.native="handleQuery"
+          />
+        </el-form-item>
+
+        <el-form-item label="锁具名称" prop="locksetName">
+          <el-input
+            v-model="queryParams.locksetName"
+            placeholder="请输入锁具名称"
+            clearable
+            @keyup.enter.native="handleQuery"
+          />
+        </el-form-item>
+
+      </el-row>
+      <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:information:add']"
+        >新增
+        </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="['mes:hw:information: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="lockCode"
+      />
+      <el-table-column
+        label="挂锁名称"
+        width="120px"
+        align="center"
+        prop="lockName"
+      />
+      <el-table-column
+        label="挂锁NFC"
+        width="150px"
+        align="center"
+        prop="lockNfc"
+        :show-overflow-tooltip="true"
+      />
+
+
+      <el-table-column
+        label="硬件类型Id"
+        align="center"
+        prop="hardwareId"
+      />
+      <el-table-column
+        label="挂锁类型Id"
+        align="center"
+        prop="lockTypeId"
+      />
+      <el-table-column
+        label="创建时间"
+        align="center"
+        prop="createTime"
+        width="180"
+      >
+        <template slot-scope="scope">
+          <span>{{ scope.row.createTime }}</span>
+        </template>
+      </el-table-column>
+
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['mes:hw:information:edit']"
+          >编辑
+          </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 size="mini" type="text">预览</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
+      :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
+            v-model="form.hardwareId"
+            :options="machinerytypeOptions"
+            :normalizer="normalizer"
+            placeholder="请选择硬件类型"
+          />
+        </el-form-item>
+
+        <el-row>
+          <el-col :span="15">
+            <el-form-item label="挂锁编码" prop="lockCode">
+              <el-input
+                v-model="form.lockCode"
+                placeholder="请输入挂锁编码"
+                style="width: 100%"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label-width="80">
+              <el-switch
+                v-model="autoGenFlag"
+                active-color="#13ce66"
+                active-text="自动生成"
+                @change="handleAutoGenChange(autoGenFlag)"
+              >
+              </el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-form-item label="挂锁名称" prop="lockName">
+          <el-input
+            v-model="form.lockName"
+            placeholder="请输入挂锁名称"
+          />
+        </el-form-item>
+        <el-form-item label="挂锁NFC" prop="lockNfc">
+          <el-input
+            v-model="form.lockNfc"
+            placeholder="请输入挂锁Nfc"
+          />
+        </el-form-item>
+        <el-form-item label="挂锁类型Id" prop="lockTypeId">
+          <el-input
+            v-model="form.lockTypeId"
+            placeholder="请输入挂锁类型Id"
+          />
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input
+            v-model="form.remark"
+            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 {
+  listPadLockAPI,
+  addPadLockAPI,
+  updatePadLockAPI,
+  delPadLockAPI,
+  getPadLockInfoAPI
+} from '@/api/mes/padLocks/padLocks'
+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'],
+  components: { Treeselect },
+  data() {
+    return {
+      autoGenFlag: false,
+      optType: undefined,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      codes: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 设备维修单表格数据
+      repairList: [],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      createTime: '',
+      queryParams: {
+        current: 1,
+        size: 10,
+        lockCode: null,
+        lockName: null,
+        lockNfc: null,
+        lockTypeId:null
+      },
+
+      // 表单参数
+      form: {
+        hardwareId:null,
+        lockTypeId:null,
+        lockCode:null
+      },
+      // 表单校验
+      rules: {
+        lockCode: [
+          { required: true, message: '挂锁编码不能为空', trigger: 'blur' }
+        ],
+        lockName: [
+          { required: true, message: '挂锁名称不能为空', trigger: 'blur' }
+        ]
+      },
+      // 日期选择
+      pickerOptions: {
+        shortcuts: [
+          {
+            text: '最近一周',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
+              picker.$emit('pick', [start, end])
+            }
+          },
+          {
+            text: '最近一个月',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
+              picker.$emit('pick', [start, end])
+            }
+          },
+          {
+            text: '最近三个月',
+            onClick(picker) {
+              const end = new Date()
+              const start = new Date()
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
+              picker.$emit('pick', [start, end])
+            }
+          }
+        ]
+      },
+
+      // 新增状态
+
+      EditId: 0, //修改判断
+      machinerytypeOptions:[],//锁具类型
+    }
+  },
+  created() {
+    this.getList()
+    this.getTreeselect()
+  },
+  methods: {
+    //自动生成编码
+    handleAutoGenChange(autoGenFlag) {
+      if (autoGenFlag) {
+        genCode('PAD_LOCK_CODE').then((response) => {
+          this.form.lockCode = response
+          console.log(response,this.form.lockCode,'lockCode')
+        })
+      } else {
+        this.form.lockCode = null
+      }
+    },
+    /** 查询设备维修单列表 */
+
+    getList() {
+      this.loading = true
+
+      // 锁具数据
+      listPadLockAPI(this.queryParams).then((response) => {
+        this.repairList = response.data.records
+        this.total = response.data.total
+        this.loading = false
+      })
+
+    },
+    /** 查询锁具类型下拉树结构 */
+    getTreeselect() {
+      listHanrwareType().then((response) => {
+        debugger;
+        this.machinerytypeOptions = [];
+        const data = this.handleTree(
+          response.data.records,
+          "id",
+          "parentTypeId"
+        )[0];
+        // console.log(data, "父类型回显");
+        this.machinerytypeOptions.push(data);
+      });
+    },
+    /** 转换设备类型数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.id,
+        label: node.hardwareTypeName,
+        children: node.children,
+      };
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false
+      this.reset()
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        keyName: null,
+        keyCode: null,
+        keyNfc: null,
+        macAddress:null,
+        remark: null,
+      }
+
+      this.autoGenFlag = false
+      this.resetForm('form')
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.current = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams.lockCode = ''
+      this.queryParams.lockName = ''
+      this.queryParams.lockId = ''
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map((item) => item.lockId)
+      this.codes = selection.map((item) => item.lockCode)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset()
+      this.open = true
+      this.EditId = null
+      this.title = '新增挂锁信息'
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset()
+      this.EditId = row.lockId || this.ids
+      getPadLockInfoAPI(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) {
+            updatePadLockAPI(this.form).then((response) => {
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
+          } else {
+            console.log(this.form, 'form')
+            addPadLockAPI(this.form).then((response) => {
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.EditId = null
+              this.getList()
+            })
+          }
+        }
+      })
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const repairIds = row.lockId || this.ids
+      const repairCodes = row.lockCode || this.codes
+      this.$modal
+        .confirm('是否确认删除硬件编码为"' + repairCodes + '"的数据项?')
+        .then(function() {
+          return delPadLockAPI(repairIds)
+        })
+        .then(() => {
+          this.getList()
+          this.$modal.msgSuccess('删除成功')
+        })
+        .catch(() => {
+        })
+    },
+
+
+  }
+}
+</script>
+<style scoped>
+.imgstatus {
+  position: relative;
+  top: 1px;
+  left: 0px;
+}
+
+/deep/ .el-radio__inner {
+  border-radius: 2px;
+}
+
+/deep/ .el-radio__input.is-checked .el-radio__inner::after {
+  content: "";
+  width: 8px;
+  height: 3px;
+  border: 1px solid white;
+  border-top: transparent;
+  border-right: transparent;
+  text-align: center;
+  display: block;
+  position: absolute;
+  top: 3px;
+  left: 2px;
+  transform: rotate(-45deg);
+  border-radius: 0pc;
+  background: none;
+}
+</style>

+ 403 - 0
src/views/mes/md/locksettype/index.vue

@@ -0,0 +1,403 @@
+<template>
+  <div class="app-container">
+    <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"
+          placeholder="请输入挂锁类型编码"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="挂锁类型名称" prop="locksetTypeName">
+        <el-input
+          v-model="queryParams.locksetTypeName"
+          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="['system:dept: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-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table
+      v-if="refreshTable"
+      v-loading="loading"
+      :data="deptList"
+      row-key="locksetTypeId"
+      :default-expand-all="isExpandAll"
+      :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">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['mes:md:waa:edit']"
+          >修改
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-plus"
+            @click="handleAdd(scope.row)"
+            v-hasPermi="['mes:md:waa: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: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="选择父级"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="18">
+            <el-form-item label="挂锁类型名称" prop="lockTypeName">
+              <el-input
+                style="width: 318px"
+                v-model="form.lockTypeName"
+                placeholder="请输入挂锁类型名称"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="19">
+            <el-form-item label="挂锁类型编码" prop="lockTypeCode">
+              <el-input
+                style="width: 318px"
+                v-model="form.lockTypeCode"
+                placeholder="请输入挂锁类型编码"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="3">
+            <el-form-item label-width="80">
+              <el-switch
+                style="width: 170px"
+                v-model="autoGenFlag"
+                active-color="#13ce66"
+                active-text="自动生成"
+                @change="handleAutoGenChange(autoGenFlag)"
+              >
+              </el-switch>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="10">
+            <el-form-item label="锁具类型图标" prop="lockTypeIcon">
+
+            </el-form-item>
+          </el-col>
+          <el-col :span="10">
+            <el-form-item label="挂锁类型描述" prop="lockTypeDescription">
+              <el-input
+                type="textarea"
+                style="width: 318px"
+                v-model="form.lockTypeDescription"
+                placeholder="请输入挂锁类型描述"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="10">
+            <el-form-item label="挂锁类型描述" prop="lockTypeDescription">
+              <el-input
+                type="textarea"
+                style="width: 318px"
+                v-model="form.lockTypeDescription"
+                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 @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</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'
+
+export default {
+  name: 'Dept',
+  dicts: ['sys_normal_disable'],
+  components: { Treeselect },
+  data() {
+    return {
+      //自动生成编码
+      autoGenFlag: false,
+      optType: undefined,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      codes: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 地图预览弹框
+      dialogVisibleMap: false,
+      // 显示搜索条件
+      showSearch: true,
+      // 表格树数据
+      deptList: [],
+      // 部门树选项
+      deptOptions: [],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      // 是否展开,默认全部展开
+      isExpandAll: true,
+      // 重新渲染表格状态
+      refreshTable: true,
+      // 查询参数
+      queryParams: {
+        current: 1,
+        size: -1,
+        locksetTypeCode: null,
+        locksetTypeName: null,
+        locksetTypeId: null
+      },
+      // 总条数
+      total: 0,
+      // 表单参数
+      form: {
+        parentTypeId:0,
+      },
+      WorkShopListOptions: null, //所属车间下拉数据
+      EditId: null, //判断是否是编辑弹框的值
+      // 表单校验
+      rules: {
+        // parentId: [
+        //   { required: true, message: '父级不能为空', trigger: 'blur' }
+        // ],
+
+        locksetTypeCode: [
+          { required: true, message: '挂锁类型编号不能为空', trigger: 'blur' }
+        ],
+        locksetTypeName: [
+          { required: true, message: '挂锁类型名称不能为空', trigger: 'blur' }
+        ],
+
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    /** 查询部门列表 */
+    getList() {
+      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
+      })
+    },
+    /** 转换部门数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.locksetTypeId,
+        label: node.locksetTypeName,
+        children: node.children
+      }
+    },
+    // 取消按钮
+    cancel() {
+      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')
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.current = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams = {
+        current: 1,
+        size: -1,
+        locksetTypeCode: null,
+        locksetTypeName: null,
+        locksetTypeId: null
+      }
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    /** 新增按钮操作 */
+    handleAdd(row) {
+      this.reset()
+      if (row != undefined) {
+        this.form.parentTypeId = row.locksetTypeId;
+      }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')
+      })
+    },
+    /** 展开/折叠操作 */
+    toggleExpandAll() {
+      this.refreshTable = false
+      this.isExpandAll = !this.isExpandAll
+      this.$nextTick(() => {
+        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')
+      })
+    },
+    //图片上传成功
+    handleImgUplaoded(imgUrl) {
+      console.log(imgUrl,'编辑拿到的图片')
+      this.form.mapImg = imgUrl[0].url
+    },
+    //图片移除
+    handleImgRemoved(imgUrl) {
+      this.form.mapImg = null
+    },
+    /** 提交按钮 */
+    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()
+            })
+          } else {
+            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(() => {
+      })
+    },
+    //自动生成编码
+    handleAutoGenChange(autoGenFlag) {
+      if (autoGenFlag) {
+        genCode('LOCK_TYPE_CODE').then((response) => {
+          this.form.locksetTypeCode = response
+        })
+      } else {
+        this.form.locksetTypeCode = null
+      }
+    },
+
+
+  }
+
+}
+</script>

+ 285 - 287
src/views/mes/md/locktype/index.vue

@@ -1,229 +1,186 @@
 <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-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
+      <el-form-item label="挂锁类型编码" prop="lockTypeCode">
         <el-input
-          v-model="queryParams.hardwareTypeCode"
-          placeholder="请输入硬件编号"
+          v-model="queryParams.lockTypeCode"
+          placeholder="请输入挂锁类型编码"
           clearable
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="类型名称" prop="hardwareTypeName">
+      <el-form-item label="挂锁类型名称" prop="lockTypeName">
         <el-input
-          v-model="queryParams.hardwareTypeName"
-          placeholder="请输入类型名称"
+          v-model="queryParams.lockTypeName"
+          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-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-item style="margin-left: 50px">
+    </el-form>
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
         <el-button
           type="primary"
-          icon="el-icon-search"
+          plain
+          icon="el-icon-plus"
           size="mini"
-          @click="handleQuery"
-        >搜索</el-button
-        >
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
-        >重置</el-button
-        >
-      </el-form-item>
-    </el-form>
+          @click="handleAdd"
+          v-hasPermi="['system:dept: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-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
     <el-table
+      v-if="refreshTable"
       v-loading="loading"
-      :data="machinerytypeList"
-      row-key="id"
-      default-expand-all
-      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
+      :data="deptList"
+      row-key="lockTypeId"
+      :default-expand-all="isExpandAll"
+      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
     >
-      <el-table-column
-        label="硬件编号"
-        width="170px"
-        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">
+      <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">
-          <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"-->
-          <!--          />-->
+          <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">
+          <span v-else>-</span>
         </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"
-      >
+      <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"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['mes:hw:type:edit']"
-          >编辑</el-button
-          >
+            v-hasPermi="['mes:md:waa:edit']"
+          >修改
+          </el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-plus"
             @click="handleAdd(scope.row)"
-            v-hasPermi="['mes:hw:type:add']"
-          >新增</el-button
-          >
+            v-hasPermi="['mes:md:waa: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
-          >
+            v-hasPermi="['mes:md:waa:remove']"
+          >删除
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
 
-    <!-- 添加或修改设备类型对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
+    <!-- 添加或修改部门对话框 -->
+    <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="24" v-if="form.parentTypeId !== 0">
-            <el-form-item label="父类型" prop="parentTypeId">
-              <treeselect
-                v-model="form.parentTypeId"
-                :options="machinerytypeOptions"
-                :normalizer="normalizer"
-                placeholder="请选择父类型"
+          <el-col :span="18">
+            <el-form-item label="父级" prop="parentTypeId">
+              <treeselect style="width: 318px" v-model="form.parentTypeId" :options="deptOptions" :normalizer="normalizer"
+                          placeholder="选择父级"
               />
             </el-form-item>
           </el-col>
         </el-row>
+        <el-form-item label="硬件类型" prop="hardwareTypeId">
+          <treeselect
+            v-model="form.hardwareTypeId"
+            :options="machinerytypeOptions"
+            :normalizer="normalizer1"
+            placeholder="请选择硬件类型"
+          />
+        </el-form-item>
         <el-row>
           <el-col :span="18">
-            <el-form-item label="锁具编号" prop="lockTypeCode">
+            <el-form-item label="挂锁类型名称" prop="lockTypeName">
+              <el-input
+                style="width: 318px"
+                v-model="form.lockTypeName"
+                placeholder="请输入挂锁类型名称"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="19">
+            <el-form-item label="挂锁类型编码" prop="lockTypeCode">
               <el-input
+                style="width: 318px"
                 v-model="form.lockTypeCode"
-                placeholder="请输入锁具编号"
+                placeholder="请输入挂锁类型编码"
               />
             </el-form-item>
           </el-col>
-          <el-col :span="6">
-            <el-form-item label-width="30">
+          <el-col :span="3">
+            <el-form-item label-width="80">
               <el-switch
+                style="width: 170px"
                 v-model="autoGenFlag"
                 active-color="#13ce66"
                 active-text="自动生成"
                 @change="handleAutoGenChange(autoGenFlag)"
-
               >
               </el-switch>
             </el-form-item>
           </el-col>
         </el-row>
-
         <el-row>
-          <el-col :span="12">
-            <el-form-item label="锁具类型名称" prop="lockTypeName">
+          <el-col :span="10">
+            <el-form-item label="挂锁类型描述" prop="lockTypeDescription">
               <el-input
-                v-model="form.lockTypeName"
-                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="12">
-            <el-form-item label="锁具类型图标" prop="lockTypeIcon">
-              <ImageUpload
-                :limit="1"
-                :value="form.lockTypeIcon"
-                :fileSize="5"
-                @onUploaded="handleIconUplaoded('lockTypeIcon')"
-                @onRemoved="handleIconRemoved('lockTypeIcon')"
-              ></ImageUpload>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="锁具类型图片" prop="lockTypeImg">
-              <ImageUpload
-                :limit="1"
-                :value="form.lockTypeImg"
-                :fileSize="5"
-                @onUploaded="handleIconUplaoded('lockTypeImg')"
-                @onRemoved="handleIconRemoved('lockTypeImg')"
-              ></ImageUpload>
-            </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="请输入内容"
+                style="width: 318px"
+                v-model="form.lockTypeDescription"
+                placeholder="请输入挂锁类型描述"
               />
             </el-form-item>
           </el-col>
         </el-row>
+        <el-form-item label="挂锁类型图标" prop="lockTypeIcon">
+          <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>
+        </el-form-item>
+
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -234,22 +191,16 @@
 </template>
 
 <script>
-import {
-  listLockType,
-  addLockType,
-  getLockTypeInfo,
-  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 {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: "hardwareType",
-  dicts: ["sys_yes_no"],
-  components: {
-    Treeselect,
-  },
+  name: 'Dept',
+  dicts: ['sys_normal_disable'],
+  components: { Treeselect },
   data() {
     return {
       //自动生成编码
@@ -257,75 +208,90 @@ export default {
       optType: undefined,
       // 遮罩层
       loading: true,
+      // 选中数组
+      ids: [],
+      codes: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 地图预览弹框
+      dialogVisibleMap: false,
       // 显示搜索条件
       showSearch: true,
-      // 设备类型表格数据
-      machinerytypeList: [],
-      // 设备类型树选项
-      machinerytypeOptions: [],
+      // 表格数据
+      deptList: [],
+      // 部门树选项
+      deptOptions: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
-      // 总条数
-      total: 0,
+      // 是否展开,默认全部展开
+      isExpandAll: true,
+      // 重新渲染表格状态
+      refreshTable: true,
       // 查询参数
       queryParams: {
-        parentTypeId: null,
-        ancestors: null,
         current: 1,
-        size: 10,
-        hardwareTypeCode: "",
-        hardwareTypeName: "",
-        enableFlag: "",
+        size: -1,
+        lockTypeCode: null,
+        lockTypeName: null,
+        lockTypeId: null
       },
+      // 总条数
+      total: 0,
       // 表单参数
       form: {
-        parentTypeId: 0,
+        parentTypeId:0,
       },
-      EditId: null, //编辑传递id
+      machinerytypeOptions:[],//硬件类型
+      EditId: null, //判断是否是编辑弹框的值
       // 表单校验
       rules: {
-        hardwareTypeCode: [
-          { required: true, message: "硬件编号不能为空", trigger: "blur" },
+        // parentId: [
+        //   { required: true, message: '父级不能为空', trigger: 'blur' }
+        // ],
+
+        lockTypeCode: [
+          { required: true, message: '挂锁类型编号不能为空', trigger: 'blur' }
         ],
-        hardwareTypeName: [
-          { required: true, message: "硬件名称不能为空", trigger: "blur" },
+        lockTypeName: [
+          { required: true, message: '挂锁类型名称不能为空', trigger: 'blur' }
         ],
-      },
-    };
+
+      }
+    }
   },
   created() {
-    this.getList();
+    this.getList()
+    this.getTreeselect()
   },
   methods: {
-    /** 查询设备类型列表 */
+    /** 查询部门列表 */
     getList() {
-      this.loading = true;
-      listLockType(this.queryParams).then((response) => {
-        this.machinerytypeList = this.handleTree(
-          response.data.records,
-          "id",
-          "parentTypeId"
-        );
-        this.loading = false;
-        console.log(this.machinerytypeList, "machinerytypeList");
-      });
+      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
+      })
     },
-    /** 转换设备类型数据结构 */
+    /** 转换部门数据结构 */
     normalizer(node) {
       if (node.children && !node.children.length) {
-        delete node.children;
+        delete node.children
       }
       return {
-        id: node.id,
-        label: node.hardwareTypeName,
-        children: node.children,
-      };
+        id: node.lockTypeId,
+        label: node.lockTypeName,
+        children: node.children
+      }
     },
-    /** 查询设备类型下拉树结构 */
+    /** 查询挂锁类型下拉树结构 */
     getTreeselect() {
-      listLockType().then((response) => {
+      listHanrwareType().then((response) => {
         debugger;
         this.machinerytypeOptions = [];
         const data = this.handleTree(
@@ -333,123 +299,155 @@ export default {
           "id",
           "parentTypeId"
         )[0];
-        console.log(data, "父类型回显");
+        // console.log(data, "父类型回显");
         this.machinerytypeOptions.push(data);
       });
     },
+    /** 转换设备类型数据结构 */
+    normalizer1(node) {
+      if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.id,
+        label: node.hardwareTypeName,
+        children: node.children,
+      };
+    },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
       this.form = {
-        level: "",
-        parentTypeId: 1,
-        ancestors: null,
-        enableFlag: "",
-        remark: null,
-        createBy: null,
-        createTime: null,
-        updateBy: null,
-        updateTime: null,
-        hardwareTypeCode: "",
-        hardwareTypeName: "",
-      };
-      this.resetForm("form");
+        parentTypeId: undefined,
+        lockTypeId:undefined,
+        lockTypeName:undefined,
+        lockTypeIcon:undefined,
+        lockTypeImg:undefined,
+        lockTypeDescription:undefined,
+        lockTypeCode:undefined,
+      }
+      this.autoGenFlag = false
+      this.resetForm('form')
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.getList();
+      this.queryParams.current = 1
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 层级计数器函数
-    handleChange(value) {
-      console.log(value);
+      this.queryParams = {
+        current: 1,
+        size: -1,
+        lockTypeCode: null,
+        lockTypeName: null,
+        lockTypeId: null
+      }
+      this.resetForm('queryForm')
+      this.handleQuery()
     },
     /** 新增按钮操作 */
     handleAdd(row) {
-      this.reset();
-      this.getTreeselect();
-      if (row != null && row.id) {
-        this.form.parentTypeId = row.id;
-      } else {
+      this.reset()
+      if (row != undefined) {
+        this.form.parentTypeId = row.lockTypeId;
+      }else{
         this.form.parentTypeId = 0;
       }
-      this.open = true;
-      this.title = "新增硬件类型";
+      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.$nextTick(() => {
+        this.refreshTable = true
+      })
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
-      this.getTreeselect();
-      if (row != null) {
-        this.form.parentTypeId = row.id;
-      }
-      getLockTypeInfo(row.id).then((response) => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "编辑硬件类型";
-      });
+      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() {
-      this.$refs["form"].validate((valid) => {
+    submitForm: function() {
+      this.$refs['form'].validate(valid => {
         if (valid) {
-          if (this.form.id != null) {
-            updateLockType(this.form).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+          if (this.form.lockTypeId != undefined) {
+            updatePadLockTypeAPI(this.form).then(response => {
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
           } else {
-            addLockType(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(() => {
+      })
     },
     //自动生成编码
     handleAutoGenChange(autoGenFlag) {
       if (autoGenFlag) {
-        genCode("HARDWARE_TYPE_CODE").then((response) => {
-          this.form.hardwareTypeCode = response;
-        });
+        genCode('PAD_LOCK_TYPE_CODE').then((response) => {
+          this.form.lockTypeCode = response
+        })
       } else {
-        this.form.hardwareTypeCode = null;
+        this.form.lockTypeCode = null
       }
     },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const repairIds = row.id || this.ids;
-      const repairCodes = row.hardwareTypeCode;
-      this.$modal
-        .confirm('是否删除硬件编号为"' + repairCodes + '"的硬件类型?')
-        .then(function () {
-          return delHardwareType(repairIds);
-        })
-        .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
-        })
-        .catch(() => {});
+    //图片上传成功
+    handleImgUplaoded(imgUrl) {
+      console.log(imgUrl,'编辑拿到的图片')
+      this.form.lockTypeIcon = imgUrl[0].url
     },
-    //图标上传成功
-    handleIconUplaoded(fieldName, imgUrl) {
-      this.form[fieldName] = imgUrl[0].url;
+    //图片移除
+    handleImgRemoved(imgUrl) {
+      this.form.lockTypeIcon = null
     },
-    // 图标移除
-    handleIconRemoved(fieldName) {
-      this.form[fieldName] = null;
+    //图片上传成功
+    handleImgUplaoded1(imgUrl) {
+      console.log(imgUrl,'编辑拿到的图片')
+      this.form.lockTypeImg = imgUrl[0].url
     },
-  },
-};
+    //图片移除
+    handleImgRemoved1(imgUrl) {
+      this.form.lockTypeImg = null
+    },
+  }
+
+}
 </script>