浏览代码

取消旧的锁具类型

pm 11 月之前
父节点
当前提交
2e79898337
共有 1 个文件被更改,包括 195 次插入207 次删除
  1. 195 207
      src/views/mes/md/segregationpoint/index.vue

+ 195 - 207
src/views/mes/md/segregationpoint/index.vue

@@ -1,4 +1,4 @@
-    <template>
+<template>
   <div class="app-container">
     <el-form
       :model="queryParams"
@@ -78,14 +78,16 @@
           icon="el-icon-search"
           size="mini"
           @click="handleQuery"
-          >搜索</el-button
+        >搜索
+        </el-button
         >
         <el-button
           v-no-more-click
           icon="el-icon-refresh"
           size="mini"
           @click="resetQuery"
-          >重置</el-button
+        >重置
+        </el-button
         >
       </el-form-item>
     </el-form>
@@ -100,7 +102,7 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['mes:md:seg:add']"
-          >新增
+        >新增
         </el-button>
       </el-col>
       <el-col :span="1.5">
@@ -113,7 +115,7 @@
           :disabled="multiple"
           @click="handleDelete"
           v-hasPermi="['mes:md:seg:batchremove']"
-          >批量删除
+        >批量删除
         </el-button>
       </el-col>
       <!--      <el-col :span="1.5">-->
@@ -137,7 +139,7 @@
       :data="isolationList"
       @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="隔离点ID" align="center" prop="pointId">
         <template slot-scope="scope">
           <el-button v-no-more-click
@@ -155,11 +157,11 @@
             type="text"
             @click="handleView(scope.row)"
             v-hasPermi="['mes:md:seg:query']"
-            >{{ scope.row.pointCode }}
+          >{{ scope.row.pointCode }}
           </el-button>
         </template>
       </el-table-column>
-      <el-table-column label="隔离点名称" align="center" prop="pointName" />
+      <el-table-column label="隔离点名称" align="center" prop="pointName"/>
       <!-- <el-table-column label="状态" align="center" prop="calendarType">
         <template slot-scope="scope">
           <dict-tag
@@ -233,7 +235,7 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['mes:md:seg:edit']"
-            >编辑
+          >编辑
           </el-button>
           <el-button
             v-no-more-click
@@ -242,7 +244,7 @@
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['mes:md:seg:remove']"
-            >删除
+          >删除
           </el-button>
         </template>
       </el-table-column>
@@ -295,7 +297,7 @@
           </el-col>
         </el-row>
         <el-row>
-          <el-col :span="12">
+          <el-col :span="11">
             <el-form-item label="隔离点名称" prop="pointName">
               <el-input
                 style="width: 300px"
@@ -305,24 +307,6 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label-width="80" label="锁具类型" prop="lockTypeCode">
-              <el-select
-                style="width: 300px"
-                v-model="form.lockTypeCode"
-                placeholder="请选择锁具类型"
-              >
-                <el-option
-                  v-for="dict in dict.type.lock_type"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                />
-              </el-select>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="11">
             <el-form-item label="隔离点类型" prop="pointType">
               <el-select
                 style="width: 300px"
@@ -338,6 +322,9 @@
               </el-select>
             </el-form-item>
           </el-col>
+        </el-row>
+        <el-row>
+
           <el-col :span="11">
             <el-form-item label="危险能量类型" prop="powerType">
               <el-select
@@ -354,8 +341,6 @@
               </el-select>
             </el-form-item>
           </el-col>
-        </el-row>
-        <el-row>
           <el-col :span="11">
             <el-form-item label="作业区域" prop="workareaId">
               <treeselect
@@ -367,7 +352,9 @@
               />
             </el-form-item>
           </el-col>
-          <el-col :span="12">
+        </el-row>
+        <el-row>
+          <el-col :span="11">
             <el-form-item label="锁具类型" prop="locksetTypeId">
               <treeselect
                 style="width: 300px"
@@ -378,20 +365,19 @@
               />
             </el-form-item>
           </el-col>
+          <el-col :span="12">
+            <el-form-item label="挂锁类型" prop="lockTypeId">
+              <treeselect
+                style="width: 300px"
+                v-model="form.lockTypeId"
+                :options="padLockTypeOptions"
+                :normalizer="normalizerpadLock"
+                placeholder="选择作业区域"
+              />
+            </el-form-item>
+          </el-col>
         </el-row>
-      <el-row>
-        <el-col :span="12">
-          <el-form-item label="挂锁类型" prop="lockTypeId">
-            <treeselect
-              style="width: 300px"
-              v-model="form.lockTypeId"
-              :options="padLockTypeOptions"
-              :normalizer="normalizerpadLock"
-              placeholder="选择作业区域"
-            />
-          </el-form-item>
-        </el-col>
-      </el-row>
+
         <el-row>
           <el-col :span="8">
             <el-form-item label="隔离点图标" prop="pointIcon">
@@ -422,7 +408,8 @@
 
       <div slot="footer" class="dialog-footer">
         <el-button v-no-more-click type="primary" @click="submitForm"
-          >确 定</el-button
+        >确 定
+        </el-button
         >
         <el-button v-no-more-click @click="cancel">取 消</el-button>
       </div>
@@ -438,19 +425,19 @@ import {
   workshoplistAll,
   getIsWorkareaList,
   selectIsIsolationPointById,
-  deleteIsIsolationPointByPointIds,
-} from "@/api/mes/spm/segregationPoint";
-import { genCode } from "@/api/system/autocode/rule";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import { listWorkarea } from "@/api/mes/wa/workarea";
+  deleteIsIsolationPointByPointIds
+} from '@/api/mes/spm/segregationPoint'
+import { genCode } from '@/api/system/autocode/rule'
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import { listWorkarea } from '@/api/mes/wa/workarea'
 import { listLockType } from '@/api/mes/locktype/locktype'
 import { listPadLockTypeAPI } from '@/api/mes/padLockType/padLockType'
 
 export default {
-  name: "Team",
+  name: 'Team',
   components: { Treeselect },
-  dicts: ["power_type", "point_type", "lock_type"],
+  dicts: ['power_type', 'point_type', 'lock_type'],
   data() {
     return {
       //自动生成编码
@@ -474,7 +461,7 @@ export default {
       // 班组表格数据
       isolationList: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
       // 车间数据
@@ -484,77 +471,77 @@ export default {
       // 新增或修改
       pointId: null,
       // 查询参数
-      createTime: "",
+      createTime: '',
       queryParams: {
         current: 1,
         size: 10,
-        pointCode: "",
-        pointName: "",
-        delFlag: "",
-        pointType: "",
-        powerType: "",
-        startTime: "",
-        endTime: "",
+        pointCode: '',
+        pointName: '',
+        delFlag: '',
+        pointType: '',
+        powerType: '',
+        startTime: '',
+        endTime: ''
       },
       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])
+            }
+          }
+        ]
       },
       // 表单参数
       form: {},
-      LockTypeOptions:[],//锁具类型下拉
-      padLockTypeOptions:[],//挂锁类型下拉
+      LockTypeOptions: [],//锁具类型下拉
+      padLockTypeOptions: [],//挂锁类型下拉
       // 表单校验
       rules: {
         pointCode: [
-          { required: true, message: "隔离点编号不能为空", trigger: "blur" },
+          { required: true, message: '隔离点编号不能为空', trigger: 'blur' }
         ],
         pointName: [
-          { required: true, message: "隔离点名称不能为空", trigger: "blur" },
+          { required: true, message: '隔离点名称不能为空', trigger: 'blur' }
         ],
         workshopId: [
-          { required: true, message: "所属车间不能为空", trigger: "blur" },
+          { required: true, message: '所属车间不能为空', trigger: 'blur' }
         ],
         workareaId: [
-          { required: true, message: "作业区域不能为空", trigger: "blur" },
+          { required: true, message: '作业区域不能为空', trigger: 'blur' }
         ],
         pointType: [
-          { required: true, message: "隔离点类型不能为空", trigger: "blur" },
-        ],
-      },
-    };
+          { required: true, message: '隔离点类型不能为空', trigger: 'blur' }
+        ]
+      }
+    }
   },
   created() {
-    this.getList();
-    this.getworkShop();
-    this.getworkArea();
+    this.getList()
+    this.getworkShop()
+    this.getworkArea()
   },
   methods: {
     // 格式化日期查询数据
@@ -563,99 +550,99 @@ export default {
         // 使用本地时间
         return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
           2,
-          "0"
-        )}-${String(date.getDate()).padStart(2, "0")}`;
+          '0'
+        )}-${String(date.getDate()).padStart(2, '0')}`
       }
-      return null;
+      return null
     },
     /** 查询隔离点信息列表 */
     getList() {
-      this.loading = true;
+      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]);
+        this.queryParams.startTime = this.formatDate(this.createTime[0])
+        this.queryParams.endTime = this.formatDate(this.createTime[1])
       }
       getIsIsolationPointPage(this.queryParams).then((response) => {
         // console.log(response, "接口返回结果");
-        this.isolationList = response.data.records;
-        this.total = response.data.total;
-        this.loading = false;
-      });
+        this.isolationList = response.data.records
+        this.total = response.data.total
+        this.loading = false
+      })
       // 获取作业区域数据
-      const data={
-        current:1,
-        size:-1
+      const data = {
+        current: 1,
+        size: -1
       }
       listWorkarea(data).then((response) => {
         this.deptOptions = this.handleTree(
           response.data.records,
-          "workareaId",
-          "parentId",
-          "children"
-        );
-      });
+          'workareaId',
+          'parentId',
+          'children'
+        )
+      })
       // 锁具类型
-      listLockType(data).then((response)=>{
-        this.LockTypeOptions=this.handleTree(response.data.records,'locksetTypeId')
+      listLockType(data).then((response) => {
+        this.LockTypeOptions = this.handleTree(response.data.records, 'locksetTypeId')
       })
-    //   挂锁类型
-      listPadLockTypeAPI(data).then((response)=>{
-        this.padLockTypeOptions=this.handleTree(response.data.records,'lockTypeId')
+      //   挂锁类型
+      listPadLockTypeAPI(data).then((response) => {
+        this.padLockTypeOptions = this.handleTree(response.data.records, 'lockTypeId')
       })
     },
     /** 转换部门数据结构 */
     normalizer(node) {
       if (node.children && !node.children.length) {
-        delete node.children;
+        delete node.children
       }
       return {
         id: node.workareaId,
         label: node.workareaName,
-        children: node.children,
-      };
+        children: node.children
+      }
     },
-    normalizerLockset(node){
+    normalizerLockset(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
+      }
     },
-    normalizerpadLock(node){
+    normalizerpadLock(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
+      }
     },
     //图片上传成功
     handleImgUplaoded(imgUrl) {
-      this.form.pointPicture = imgUrl[0].url;
+      this.form.pointPicture = imgUrl[0].url
     },
     //图标上传成功
     handleIconUplaoded(imgUrl) {
-      this.form.pointIcon = imgUrl[0].url;
+      this.form.pointIcon = imgUrl[0].url
     },
     // 图标移除
     handleIconRemoved(imgUrl) {
-      this.form.pointIcon = null;
+      this.form.pointIcon = null
     },
 
     //图片移除
     handleImgRemoved(imgUrl) {
-      this.form.pointPicture = null;
+      this.form.pointPicture = null
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
@@ -666,40 +653,40 @@ export default {
         pointPicture: null,
         pointType: null,
         powerType: null,
-        createTime: null,
-      };
-      this.autoGenFlag = false;
-      this.resetForm("form");
+        createTime: null
+      }
+      this.autoGenFlag = false
+      this.resetForm('form')
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.current = 1;
-      this.getList();
+      this.queryParams.current = 1
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.createTime = "";
-      (this.queryParams.startTime = ""),
-        (this.queryParams.endTime = ""),
-        this.resetForm("queryForm");
-      this.handleQuery();
+      this.createTime = '';
+      (this.queryParams.startTime = ''),
+        (this.queryParams.endTime = ''),
+        this.resetForm('queryForm')
+      this.handleQuery()
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.pointId);
-      this.codes = selection.map((item) => item.pointCode);
-      this.single = selection.length !== 1;
-      this.multiple = !selection.length;
+      this.ids = selection.map((item) => item.pointId)
+      this.codes = selection.map((item) => item.pointCode)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加隔离点";
-      this.optType = "add";
-      this.pointId = null;
-      this.form.workshopId = 0;
-      this.getworkShop();
+      this.reset()
+      this.open = true
+      this.title = '添加隔离点'
+      this.optType = 'add'
+      this.pointId = null
+      this.form.workshopId = 0
+      this.getworkShop()
     },
     // 查询明细按钮操作
     // handleView(row) {
@@ -714,72 +701,73 @@ export default {
     // },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
-      this.pointId = row.pointId || this.ids;
+      this.reset()
+      this.pointId = row.pointId || this.ids
       selectIsIsolationPointById(this.pointId).then((response) => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改隔离点信息";
-        this.optType = "edit";
-      });
+        this.form = response.data
+        this.open = true
+        this.title = '修改隔离点信息'
+        this.optType = 'edit'
+      })
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate((valid) => {
+      this.$refs['form'].validate((valid) => {
         if (valid) {
-          console.log(this.pointId, "this.pointId");
+          console.log(this.pointId, 'this.pointId')
           if (this.pointId != null) {
-            console.log(this.form, "隔离点编辑form");
+            console.log(this.form, '隔离点编辑form')
             updateIsIsolationPoint(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, "新增参数");
+            console.log(this.form, '新增参数')
             addinsertIsIsolationPoint(this.form).then((response) => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-              this.pointId = null;
-            });
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+              this.pointId = null
+            })
           }
         }
-      });
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const teamIds = row.pointId || this.ids;
-      const pointcodes = row.pointCode || this.codes;
+      const teamIds = row.pointId || this.ids
+      const pointcodes = row.pointCode || this.codes
       this.$modal
         .confirm('是否确认删除隔离点编号为"' + pointcodes + '"的数据项?')
-        .then(function () {
-          return deleteIsIsolationPointByPointIds(teamIds);
+        .then(function() {
+          return deleteIsIsolationPointByPointIds(teamIds)
         })
         .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
+          this.getList()
+          this.$modal.msgSuccess('删除成功')
+        })
+        .catch(() => {
         })
-        .catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
       this.download(
-        "cal/team/export",
+        'cal/team/export',
         {
-          ...this.queryParams,
+          ...this.queryParams
         },
         `team_${new Date().getTime()}.xlsx`
-      );
+      )
     },
     //自动生成编码
     handleAutoGenChange(autoGenFlag) {
       if (autoGenFlag) {
-        genCode("ISOLATION_POINT_CODE").then((response) => {
-          this.form.pointCode = response;
-        });
+        genCode('ISOLATION_POINT_CODE').then((response) => {
+          this.form.pointCode = response
+        })
       } else {
-        this.form.pointCode = null;
+        this.form.pointCode = null
       }
     },
     // 获取车间数据
@@ -790,34 +778,34 @@ export default {
           return {
             label: item.workshopName,
             value: item.workshopId,
-            key: item.workshopCode,
-          };
-        });
-      });
+            key: item.workshopCode
+          }
+        })
+      })
     },
     // 所属车间下拉改变作业区域内容
     workShopChange() {
-      this.getworkArea();
+      this.getworkArea()
     },
     // 获取作业区域数据
     getworkArea() {
-      const workshopId = this.form.workshopId;
+      const workshopId = this.form.workshopId
 
       if (workshopId) {
         getIsWorkareaList(workshopId).then((response) => {
-          console.log(response, "获取作业区域数据");
+          console.log(response, '获取作业区域数据')
           this.workareaList = response.data.map((item) => {
             return {
               label: item.workareaName,
               value: item.workareaId,
-              key: item.workareaCode,
-            };
-          });
-        });
+              key: item.workareaCode
+            }
+          })
+        })
       }
-    },
-  },
-};
+    }
+  }
+}
 </script>
 <style lang="scss" src="@/assets/styles/dialog-title.scss" scoped>
 .el-input-width {