Pārlūkot izejas kodu

物资柜列表和详情内容界面

wangyani 9 mēneši atpakaļ
vecāks
revīzija
49e00ab11c

+ 15 - 0
src/router/index.js

@@ -260,6 +260,21 @@ export const dynamicRoutes = [
       }
     ]
   },
+  // 物资柜详情
+  {
+    path: '/mes/material/lockers',
+    component: Layout,
+    hidden: true,
+    permissions: ['iscs:cabinet:list'],
+    children: [
+      {
+        path: 'DetailsIndex',
+        component: () => import('@/views/mes/material/lockers/DetailsIndex'),
+        name: 'DetailsIndex',
+        meta: { title: '物资柜详情' }
+      }
+    ]
+  },
   {
     path: '/system/role-auth',
     component: Layout,

+ 58 - 0
src/views/mes/material/lockers/DetailsIndex.vue

@@ -0,0 +1,58 @@
+<template>
+  <div class="app-container">
+    <el-radio-group v-model="tabPosition" style="margin: 5px">
+      <el-radio-button label="first">物资清单</el-radio-button>
+      <el-radio-button label="second">领取记录</el-radio-button>
+      <el-radio-button label="third">检查计划</el-radio-button>
+      <el-radio-button label="fourth">检查记录</el-radio-button>
+      <el-radio-button label="fivth">更换记录</el-radio-button>
+    </el-radio-group>
+    <!-- 物资清单 -->
+    <div v-if="tabPosition == 'first'" class="materialsListcon">
+      <MaterialInfromation />
+    </div>
+    <!-- 领取记录 -->
+    <div v-if="tabPosition == 'second'" class="materialsListcon">
+      <CollectionManagement />
+    </div>
+    <!-- 检查计划 -->
+    <div v-if="tabPosition == 'third'" class="materialsListcon">
+      <InspectionPlan />
+    </div>
+    <!-- 检查记录 -->
+    <div v-if="tabPosition == 'fourth'" class="materialsListcon">
+      <InspectionRecords />
+    </div>
+    <!-- 更换记录 -->
+    <div v-if="tabPosition == 'fivth'" class="materialsListcon">
+      <ReplacementRecords />
+    </div>
+  </div>
+</template>
+
+<script>
+import MaterialInfromation from "@/views/mes/material/materialinformation/index.vue";
+import CollectionManagement from "@/views/mes/material/collectionmanagement/index.vue";
+import InspectionPlan from "@/views/mes/material/inspectionplan/index.vue";
+import InspectionRecords from "@/views/mes/material/Inspectionrecords/index.vue";
+import ReplacementRecords from "@/views/mes/material/replacementrecords/index.vue";
+
+export default {
+  components: {
+    MaterialInfromation,
+    CollectionManagement,
+    InspectionPlan,
+    InspectionRecords,
+    ReplacementRecords,
+  },
+  data() {
+    return {
+      tabPosition: "first", //顶部切换
+    };
+  },
+  created() {},
+  methods: {},
+};
+</script>
+<style lang="scss" scoped>
+</style>

+ 606 - 321
src/views/mes/material/lockers/index.vue

@@ -22,7 +22,6 @@
           width: '1250px',
           height: '700px',
           position: 'relative',
-
         }"
       >
         <img
@@ -34,15 +33,20 @@
           v-for="(cabinet, index) in TicketListPage"
           :key="cabinet.cabinetId"
           :style="{
-    width: '35px',
-    height: '35px',
-    position: 'absolute',
-    cursor: 'pointer',
-    // 图标垂直居中
-    top: `${deptXLGCenter.top - 53}px`,
-    // 图标水平居中,动态计算偏移
-    left: `${deptXLGCenter.left - (TicketListPage.length * 35 + (TicketListPage.length - 1) * 5) / 2 + index * 40}px`,
-  }"
+            width: '35px',
+            height: '35px',
+            position: 'absolute',
+            cursor: 'pointer',
+            // 图标垂直居中
+            top: `${deptXLGCenter.top - 53}px`,
+            // 图标水平居中,动态计算偏移
+            left: `${
+              deptXLGCenter.left -
+              (TicketListPage.length * 35 + (TicketListPage.length - 1) * 5) /
+                2 +
+              index * 40
+            }px`,
+          }"
           :src="require('@/assets/images/table_map2.jpg')"
           alt=""
           @click="handleCabinetClick(cabinet)"
@@ -53,160 +57,170 @@
           v-for="(cabinet, index) in COCOTicketListPage"
           :key="cabinet.cabinetId"
           :style="{
-    width: '35px',
-    height: '35px',
-    position: 'absolute',
-    cursor: 'pointer',
-    // 图标垂直居中
-    top: `${deptCCOCenter.top - 53}px`,
-    // 图标水平居中,动态计算偏移
-    left: `${deptCCOCenter.left - (COCOTicketListPage.length * 35 + (COCOTicketListPage.length - 1) * 5) / 2 + index * 40}px`,
-  }"
+            width: '35px',
+            height: '35px',
+            position: 'absolute',
+            cursor: 'pointer',
+            // 图标垂直居中
+            top: `${deptCCOCenter.top - 53}px`,
+            // 图标水平居中,动态计算偏移
+            left: `${
+              deptCCOCenter.left -
+              (COCOTicketListPage.length * 35 +
+                (COCOTicketListPage.length - 1) * 5) /
+                2 +
+              index * 40
+            }px`,
+          }"
           :src="require('@/assets/images/table_map2.jpg')"
           alt=""
           @click="handleCabinetClick(cabinet)"
         />
-        <div class="deptXLG" >R&R</div>
-        <div class="deptCCO" >CCO</div>
+        <div class="deptXLG">R&R</div>
+        <div class="deptCCO">CCO</div>
       </div>
     </div>
-    <div v-if="tabPosition == 'second'">
-      <el-form
-        :model="queryParams"
-        ref="queryForm"
-        size="small"
-        :inline="true"
-        v-show="showSearch"
-        label-width="100px"
-      >
-        <el-form-item label="物资柜编码" prop="cabinetCode">
-          <el-input
-            v-model="queryParams.cabinetCode"
-            placeholder="请输入物资柜编码"
-            clearable
-            @keyup.enter.native="handleQuery"
-          />
-        </el-form-item>
-        <el-form-item label="物资柜名称" prop="cabinetName">
-          <el-input
-            v-model="queryParams.cabinetName"
-            placeholder="请输入物资柜名称"
-            clearable
-            @keyup.enter.native="handleQuery"
-          />
-        </el-form-item>
-
-
-        <el-form-item>
-          <el-button
-            v-no-more-click
-            type="primary"
-            icon="el-icon-search"
-            size="mini"
-            @click="handleQuery"
-          >搜索
-          </el-button
-          >
-          <el-button
-            v-no-more-click
-            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
-            v-no-more-click
-            type="primary"
-            plain
-            icon="el-icon-plus"
-            size="mini"
-            @click="handleAdd"
-            v-hasPermi="['iscs:cabinet:add']"
-          >新增
-          </el-button>
-        </el-col>
-        <el-col :span="1.5">
-          <el-button
-            v-no-more-click
-            type="danger"
-            plain
-            icon="el-icon-delete"
-            size="mini"
-            :disabled="multiple"
-            @click="handleDelete"
-            v-hasPermi="['mes:mat:info:batchremove']"
-          >批量删除
-          </el-button>
-        </el-col>
-
-        <right-toolbar
-          :showSearch.sync="showSearch"
-          @queryTable="getList"
-        ></right-toolbar>
-      </el-row>
-      <el-table
-        v-loading="loading"
-        :data="materialsList"
-        @selection-change="handleSelectionChange"
-      >
-        <el-table-column type="selection" width="55" align="center"/>
-        <el-table-column label="物资柜编码" align="center" prop="cabinetCode">
-        </el-table-column>
-        <el-table-column label="物资柜名称" align="center" prop="cabinetName"/>
-        <el-table-column
-          label="硬件名称"
-          align="center"
-          prop="hardwareName"
-        />
-        <!--      <el-table-column-->
-        <!--        label="工作区域"-->
-        <!--        align="center"-->
-        <!--        prop="workareaName"-->
-        <!--      />-->
-        <el-table-column label="创建时间" align="center" prop="createTime"/>
-        <el-table-column label="更新时间" align="center" prop="updateTime"/>
-
-        <el-table-column
-          label="操作"
-          align="center"
-          class-name="small-padding fixed-width"
-        >
-          <template slot-scope="scope">
-            <el-button
-              v-no-more-click
-              size="mini"
-              type="text"
-              icon="el-icon-edit"
-              @click="handleUpdate(scope.row)"
-              v-hasPermi="['iscs:cabinet:edit']"
-            >编辑
-            </el-button>
+    <!-- 物资列表 -->
+    <div v-if="tabPosition == 'second'" class="materialsListcon">
+      <div class="left">
+        <!-- 岗位树 -->
+        <div class="deptTree">
+          <div class="head-container">
+            <el-input
+              v-model="queryParamsEare.workstationName"
+              placeholder="请输入区域名称"
+              clearable
+              size="small"
+              prefix-icon="el-icon-search"
+              style="margin-bottom: 20px"
+              @input="handleInputChange"
+              @clear="handleClear"
+            />
+          </div>
+          <div class="head-container">
+            <el-tree
+              :data="workstationOptions"
+              :props="defaultProps"
+              :expand-on-click-node="false"
+              :filter-node-method="filterNode"
+              ref="treeData"
+              node-key="id"
+              default-expand-all
+              @node-click="handleNodeClick"
+              highlight-current
+            />
+          </div>
+        </div>
+      </div>
+      <div class="right">
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
             <el-button
               v-no-more-click
+              type="primary"
+              plain
+              icon="el-icon-plus"
               size="mini"
-              type="text"
-              icon="el-icon-delete"
-              @click="handleDelete(scope.row)"
-              v-hasPermi="['iscs:cabinet:remove']"
-            >删除
+              @click="handleAdd"
+              v-hasPermi="['iscs:cabinet:add']"
+              >新增
             </el-button>
-          </template>
-        </el-table-column>
-      </el-table>
-      <pagination
-        v-show="total > 0"
-        :total="total"
-        :page.sync="queryParams.pages"
-        :limit.sync="queryParams.size"
-        @pagination="getList"
-      />
-    </div>
+          </el-col>
+          <right-toolbar
+            :showSearch.sync="showSearch"
+            @queryTable="getList"
+          ></right-toolbar>
+        </el-row>
+        <el-table
+          v-loading="loading"
+          :data="materialsList"
+          @selection-change="handleSelectionChange"
+        >
+          <el-table-column type="selection" width="55" align="center" />
+          <el-table-column label="物资柜编号" align="center" prop="cabinetCode">
+          </el-table-column>
+          <el-table-column
+            label="物资柜名称"
+            align="center"
+            prop="cabinetName"
+          />
+          <el-table-column
+            label="物资图片"
+            align="center"
+            prop="materialsTypePicture"
+          >
+            <template slot-scope="scope">
+              <img
+                v-if="scope.row.materialsTypePicture"
+                :src="scope.row.materialsTypePicture"
+                alt=""
+                style="width: 50px; height: 50px"
+              />
+              <span v-else>-</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="物资柜状态"
+            align="center"
+            prop="cabinetName"
+          />
 
+          <el-table-column label="物资柜详情" align="center">
+            <!-- <template slot-scope="scope">
+              <el-button
+                v-no-more-click
+                size="mini"
+                type="text"
+                @click="handleLook(scope.row)"
+                >查看
+              </el-button>
+            </template> -->
+            <template>
+              <el-button
+                v-no-more-click
+                size="mini"
+                type="text"
+                @click="handleLook"
+                >查看
+              </el-button>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="操作"
+            align="center"
+            class-name="small-padding fixed-width"
+          >
+            <template slot-scope="scope">
+              <el-button
+                v-no-more-click
+                size="mini"
+                type="text"
+                icon="el-icon-edit"
+                @click="handleUpdate(scope.row)"
+                v-hasPermi="['iscs:cabinet:edit']"
+                >编辑
+              </el-button>
+              <el-button
+                v-no-more-click
+                size="mini"
+                type="text"
+                icon="el-icon-delete"
+                @click="handleDelete(scope.row)"
+                v-hasPermi="['iscs:cabinet:remove']"
+                >删除
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <!-- <pagination
+          v-show="total > 0"
+          :total="total"
+          :page.sync="queryParams.pages"
+          :limit.sync="queryParams.size"
+          @pagination="getList"
+        /> -->
+      </div>
+    </div>
     <!-- 添加或修改班组对话框 -->
     <el-dialog :visible.sync="open" width="510px" append-to-body>
       <div slot="title" class="dialog-title">
@@ -250,15 +264,15 @@
             />
           </el-select>
         </el-form-item>
-<!--        <el-form-item label="工作区域" prop="workareaId">-->
-<!--          <treeselect-->
-<!--            style="width: 348px"-->
-<!--            v-model="form.workareaId"-->
-<!--            :options="workareaOptions"-->
-<!--            :normalizer="normalizer"-->
-<!--            placeholder="选择工作区域"-->
-<!--          />-->
-<!--        </el-form-item>-->
+        <!--        <el-form-item label="工作区域" prop="workareaId">-->
+        <!--          <treeselect-->
+        <!--            style="width: 348px"-->
+        <!--            v-model="form.workareaId"-->
+        <!--            :options="workareaOptions"-->
+        <!--            :normalizer="normalizer"-->
+        <!--            placeholder="选择工作区域"-->
+        <!--          />-->
+        <!--        </el-form-item>-->
 
         <el-form-item label="备注" prop="remark">
           <el-input
@@ -268,7 +282,6 @@
             style="width: 348px"
           />
         </el-form-item>
-
       </el-form>
 
       <div slot="footer" class="dialog-footer">
@@ -277,13 +290,11 @@
           type="primary"
           @click="cancel"
           v-if="optType == 'view'"
-        >返回
-        </el-button
-        >
+          >返回
+        </el-button>
         <el-button v-no-more-click type="primary" @click="submitForm" v-else
-        >确 定
-        </el-button
-        >
+          >确 定
+        </el-button>
         <el-button v-no-more-click @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
@@ -296,30 +307,30 @@ import {
   addMaterialsCabinet,
   updateMaterialsCabinet,
   deleteMaterialsCabinet,
-  selectMaterialsCabinetById
-} from '@/api/mes/material/lockers.js'
+  selectMaterialsCabinetById,
+} from "@/api/mes/material/lockers.js";
 
-import {
-  listWorkarea
-} from '@/api/mes/wa/workarea'
-import { listType } from '@/api/mes/material/typeindex'
-import { listHardware } from '@/api/mes/hw/hardwareinfo'
-import Treeselect from '@riophae/vue-treeselect'
-import '@riophae/vue-treeselect/dist/vue-treeselect.css'
-import { genCode } from '@/api/system/autocode/rule'
+import { listWorkarea } from "@/api/mes/wa/workarea";
+import { listType } from "@/api/mes/material/typeindex";
+import { listHardware } from "@/api/mes/hw/hardwareinfo";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import { genCode } from "@/api/system/autocode/rule";
+import { listMarsDept } from "@/api/system/marsdept";
+import { listLoto } from "@/api/mes/lotoStation/lotoStation";
 
 export default {
-  name: 'Team',
+  name: "Team",
   components: {
-    Treeselect
+    Treeselect,
   },
-  dicts: ['material_status'],
+  dicts: ["material_status"],
   data() {
     return {
       //自动生成编码
       autoGenFlag: false,
       optType: undefined,
-      tabPosition:'first',//顶部切换
+      tabPosition: "first", //顶部切换
       // 遮罩层
       loading: true,
       // 选中数组
@@ -336,143 +347,381 @@ export default {
       // 班组表格数据
       materialsList: [],
       // 弹出层标题
-      title: '',
+      title: "",
       // 是否显示弹出层
       open: false,
 
       // 查询参数
-      createTime: '',
+      createTime: "",
       queryParams: {
         pages: 1,
         size: 10,
         cabinetCode: null,
-        cabinetName: null
+        cabinetName: null,
+      },
+      // 区域岗位查询参数
+      queryParamsEare: {
+        current: 1,
+        size: 10,
+        workstationName: undefined,
+        workstationId: undefined,
       },
       hardWareList: [],
       queryhwParams: {
         current: 1,
-        size: -1
+        size: -1,
       },
       // 查询参数
       queryParamsCabinets: {
         current: 1,
-        size: -1
+        size: -1,
       },
       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: {},
       // 表单校验
       rules: {
         cabinetCode: [
-          { required: true, message: '物资柜编码不能为空', trigger: 'blur' }
+          { required: true, message: "物资柜编码不能为空", trigger: "blur" },
         ],
         cabinetName: [
-          { required: true, message: '物资柜名称不能为空', trigger: 'blur' }
+          { required: true, message: "物资柜名称不能为空", trigger: "blur" },
         ],
-        hardwareId:[
+        hardwareId: [
           {
-            require:true,message:'硬件名称不能为空',trigger:'blur'
-          }
+            require: true,
+            message: "硬件名称不能为空",
+            trigger: "blur",
+          },
         ],
-
       },
       workareaOptions: [],
-      TicketListPage:[],//R&R岗位
-      COCOTicketListPage:[],//CCO岗位
+      TicketListPage: [], //R&R岗位
+      COCOTicketListPage: [], //CCO岗位
       scaleFactor: 1, // 缩放比例,初始值为1
       deptXLGPosition: {
         left: 500,
         top: 260,
         width: 65,
-        height: 25
+        height: 25,
       },
       deptCCOPosition: {
         left: 670,
         top: 480,
         width: 65,
-        height: 25
-      }
-    }
+        height: 25,
+      },
+      workstationOptions: [], //岗位
+      defaultProps: {
+        children: "children",
+        label: "label",
+      },
+    };
   },
-  computed:{
+  computed: {
     deptXLGCenter() {
       return {
         left: this.deptXLGPosition.left + this.deptXLGPosition.width / 2,
-        top: this.deptXLGPosition.top + this.deptXLGPosition.height / 2
-      }
+        top: this.deptXLGPosition.top + this.deptXLGPosition.height / 2,
+      };
     },
     deptCCOCenter() {
       return {
         left: this.deptCCOPosition.left + this.deptCCOPosition.width / 2,
-        top: this.deptCCOPosition.top + this.deptCCOPosition.height / 2
+        top: this.deptCCOPosition.top + this.deptCCOPosition.height / 2,
+      };
+    },
+  },
+  watch: {
+    "form.workstationId": function (newVal, oldVal) {
+      if (newVal !== oldVal && this.form.lotoId && !this.isEditing) {
+        this.form.lotoId = "";
       }
-    }
+      if (newVal) {
+        const data = {
+          pasge: 1,
+          size: -1,
+          workstationId: this.form.workstationId,
+        };
+        listLoto(data).then((response) => {
+          this.LotoOptions = response.data.records.map((item) => {
+            return {
+              value: item.lotoId,
+              label: item.lotoName,
+            };
+          });
+        });
+      }
+    },
+    tabPosition: function (newVal, oldVal) {
+      if (newVal) {
+        this.getList();
+      }
+    },
   },
   created() {
-    this.getList()
-    this.getHardWare()
-    this.getTreeselect()
+    this.getList();
+    this.getHardWare();
+    this.getTreeselect();
+    this.getOtherList();
   },
 
   methods: {
+    // mars岗位树点击事件
+    handleNodeClick(data) {
+      this.queryParams.workstationId = data.id; //这里给查询传递参数
+      this.queryParams.workstationName = data.label; //这里给回显框显示中文
+      const data1 = {
+        pasge: 1,
+        size: -1,
+      };
+      listMarsDept(data1).then((response) => {
+        // 新增岗位单选
+        this.marsOptions = this.handleTree(
+          response.data.records,
+          "workstationId",
+          "parentId"
+        );
+        // mars岗位树数据
+        this.workstationOptions = this.transformToTree(response.data.records);
+        // 使用递归函数查找匹配的节点
+        const selectedTreeNode = this.findNodeById(
+          this.workstationOptions,
+          this.queryParamsEare.workstationId
+        );
+        // 不再递归调用 handleNodeClick
+        if (selectedTreeNode) {
+          // 可以在这里执行其他逻辑,但不要再次调用 handleNodeClick
+          console.log("找到匹配的节点:", selectedTreeNode);
+        } else {
+          console.log("未找到匹配的节点");
+        }
+      });
+      listTechnology(this.queryParamsEare).then((response) => {
+        debugger;
+        let filteredData;
+        if (this.tabPosition == "craft") {
+          filteredData = this.filterByMachineryType(
+            response.data.records,
+            "工艺"
+          );
+          console.log(filteredData, "工艺列表---a");
+        } else {
+          filteredData = this.filterByMachineryType(
+            response.data.records,
+            "设备"
+          );
+          console.log(filteredData, "设备列表---v");
+        }
+
+        this.deptList = this.handleTree(
+          filteredData,
+          "machineryId",
+          "parentId"
+        );
+
+        // 岗位新增的下拉
+        this.machineryOptions = this.handleTree(
+          response.data.records,
+          "machineryId",
+          "parentId"
+        );
+        this.loading = false;
+      });
+    },
+    /** 转换mars岗位数据结构 */
+    Marsnormalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.workstationId,
+        label: node.workstationName,
+        children: node.children,
+      };
+    },
+    // 筛选节点
+    filterNode(value, data) {
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
+    },
+    // mars树形输入框回显监听
+    handleInputChange() {
+      this.$refs.treeData.filter(this.queryParamsEare.workstationId); // 调用树的 filter 方法
+      const data = {
+        page: 1,
+        size: -1,
+        workstationId: null,
+        workstationName: null,
+      };
+      listMarsDept(data).then((response) => {
+        // 新增岗位单选
+        this.marsOptions = this.handleTree(
+          response.data.records,
+          "workstationId",
+          "parentId"
+        );
+        // mars岗位树数据
+        this.workstationOptions = this.transformToTree(response.data.records);
+        // 使用递归函数查找匹配的节点
+        // const selectedTreeNode = this.findNodeById(this.workstationOptions, this.queryParams.workstationId)
+        // 不再递归调用 handleNodeClick
+        // if (selectedTreeNode) {
+        //   // 可以在这里执行其他逻辑,但不要再次调用 handleNodeClick
+        //   console.log('找到匹配的节点:', selectedTreeNode)
+        // } else {
+        //   console.log('未找到匹配的节点')
+        //
+        // }
+      });
+    },
+    // 岗位查询 清除事件
+    handleClear() {
+      this.queryParamsEare.workstationId = "";
+      this.queryParamsEare.workstationName = "";
+      this.getList();
+    },
+
+    getOtherList() {
+      const data = {
+        pasge: 1,
+        size: -1,
+      };
+
+      listLoto(data).then((response) => {
+        this.LotoOptions = response.data.records.map((item) => {
+          return {
+            value: item.lotoId,
+            label: item.lotoName,
+          };
+        });
+      });
+
+      listMarsDept(data).then((response) => {
+        // 新增岗位单选
+        this.marsOptions = this.handleTree(
+          response.data.records,
+          "workstationId",
+          "parentId"
+        );
+        // mars岗位树数据
+        this.workstationOptions = this.transformToTree(response.data.records);
+        // 使用递归函数查找匹配的节点
+        const selectedTreeNode = this.findNodeById(
+          this.workstationOptions,
+          this.queryParamsEare.workstationId
+        );
+        // 调用 handleNodeClick 方法
+        if (selectedTreeNode) {
+          this.handleNodeClick(selectedTreeNode);
+        } else {
+          console.log("未找到匹配的节点");
+        }
+      });
+    },
+    /** 转换mars岗位树数据为树形结构 */
+    transformToTree(records) {
+      const recordMap = {}; // 创建一个 Map 以存储所有记录
+      const tree = []; // 最终返回的树形结构
+
+      // 初始化所有记录到 Map
+      records.forEach((record) => {
+        recordMap[record.workstationId] = {
+          id: record.workstationId,
+          label: record.workstationName,
+          children: [],
+        };
+      });
+
+      // 遍历记录并构建树
+      records.forEach((record) => {
+        const parentId = record.parentId;
+
+        if (parentId === "0") {
+          // 如果是顶层节点,直接添加到树中
+          tree.push(recordMap[record.workstationId]);
+        } else if (recordMap[parentId]) {
+          // 如果有父节点,则将当前节点加入父节点的 children 中
+          recordMap[parentId].children.push(recordMap[record.workstationId]);
+        }
+      });
+
+      return tree;
+    },
+
+    // mars岗位数深层次遍历
+    findNodeById(nodes, targetId) {
+      for (let i = 0; i < nodes.length; i++) {
+        const node = nodes[i];
+        if (node.id === targetId) {
+          return node;
+        }
+        if (node.children && node.children.length > 0) {
+          const foundNode = this.findNodeById(node.children, targetId);
+          if (foundNode) {
+            return foundNode;
+          }
+        }
+      }
+      return null;
+    },
+
     getHardWare() {
       listHardware(this.queryhwParams).then((response) => {
         this.hardWareList = response.data.records.map((item) => {
           return {
             value: item.id,
-            label: item.hardwareName
-          }
-        })
-
-      })
-
+            label: item.hardwareName,
+          };
+        });
+      });
     },
 
     /** 查询物资类型下拉树结构 */
     getTreeselect() {
       const data = {
         current: 1,
-        size: 99999
-      }
+        size: 99999,
+      };
 
       listType(data).then((response) => {
         this.machinerytypeOptions = this.handleTree(
           response.data.records,
-          'materialsTypeId',
-          'parentId',
-          'children'
-        )
-      })
+          "materialsTypeId",
+          "parentId",
+          "children"
+        );
+      });
     },
     // 格式化日期查询数据
     formatDate(date) {
@@ -480,158 +729,194 @@ 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]);
       }
       getMaterialsCabinet(this.queryParams).then((response) => {
-        this.materialsList = response.data.records
-        console.log(response,'所有物资柜')
-        this.TicketListPage=response.data.records.filter((item) => {return item.workstationId=='8'})
-        this.COCOTicketListPage=response.data.records.filter((item) => {return item.workstationId=='7'})
-        this.total = response.data.total
+        this.materialsList = response.data.records;
+        console.log(response, "所有物资柜");
+        this.TicketListPage = response.data.records.filter((item) => {
+          return item.workstationId == "8";
+        });
+        this.COCOTicketListPage = response.data.records.filter((item) => {
+          return item.workstationId == "7";
+        });
+        this.total = response.data.total;
         this.machinerytypeList = this.handleTree(
           response.data.records,
-          'cabinetId',
-          'parentId',
-          'children'
-        )
-        this.loading = false
-      })
+          "cabinetId",
+          "parentId",
+          "children"
+        );
+        this.loading = false;
+      });
     },
     // 物资柜跳转详情
-    handleCabinetClick(cabinet){
-      console.log(cabinet,'详情拿到的')
+    handleCabinetClick(cabinet) {
+      console.log(cabinet, "详情拿到的");
+    },
+    // 物资柜列表跳转详情
+    handleLook() {
+      this.$router.push("/mes/material/lockers/DetailsIndex");
+
+      console.log("详情tiaozhuan");
     },
     // 取消按钮
     cancel() {
-      this.open = false
-      this.reset()
+      this.open = false;
+      this.reset();
     },
     // 表单重置
     reset() {
       this.form = {
-        cabinetCode: '',
-        cabinetName: ''
-      }
-      this.resetForm('form')
-      this.autoGenFlag = false
+        cabinetCode: "",
+        cabinetName: "",
+      };
+      this.resetForm("form");
+      this.autoGenFlag = false;
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pages = 1
-      this.getList()
+      this.queryParams.pages = 1;
+      this.getList();
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.createTime = ''
-      this.queryParams.cabinetCode = null
-      this.queryParams.cabinetName = null
-      this.resetForm('queryForm')
-      this.handleQuery()
+      this.createTime = "";
+      this.queryParams.cabinetCode = null;
+      this.queryParams.cabinetName = null;
+      this.resetForm("queryForm");
+      this.handleQuery();
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.cabinetId)
-      this.codes = selection.map((item) => item.cabinetCode)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
+      this.ids = selection.map((item) => item.cabinetId);
+      this.codes = selection.map((item) => item.cabinetCode);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
     },
 
-
-
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset()
-      this.open = true
-      this.title = '新增物资柜信息'
-      this.optType = 'add'
-
+      this.reset();
+      this.open = true;
+      this.title = "新增物资柜信息";
+      this.optType = "add";
     },
 
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset()
+      this.reset();
       selectMaterialsCabinetById(row.cabinetId).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) {
           if (this.form.cabinetId != null) {
             updateMaterialsCabinet(this.form).then((response) => {
-              console.log(response, '修改返回')
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            })
+              console.log(response, "修改返回");
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
           } else {
             addMaterialsCabinet(this.form).then((response) => {
-              console.log(response, '新增返回')
-              this.$modal.msgSuccess('新增成功')
-              this.open = false
-              this.getList()
-            })
+              console.log(response, "新增返回");
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
           }
         }
-      })
+      });
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const cabinetIds = row.cabinetId || this.ids
-      const cabinetCodes = row.cabinetCode || this.codes
+      const cabinetIds = row.cabinetId || this.ids;
+      const cabinetCodes = row.cabinetCode || this.codes;
       this.$modal
         .confirm('是否确认删除编号为"' + cabinetCodes + '"的数据项?')
-        .then(function() {
-          return deleteMaterialsCabinet(cabinetIds)
+        .then(function () {
+          return deleteMaterialsCabinet(cabinetIds);
         })
         .then(() => {
-          this.getList()
-          this.$modal.msgSuccess('删除成功')
-        })
-        .catch(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
         })
+        .catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
       this.download(
-        'cal/team/export',
+        "cal/team/export",
         {
-          ...this.queryParams
+          ...this.queryParams,
         },
         `team_${new Date().getTime()}.xlsx`
-      )
+      );
     },
 
     //自动生成编码
     handleAutoGenChange(autoGenFlag) {
       if (autoGenFlag) {
-        genCode('MATERIALS_CABINET').then((response) => {
-          this.form.cabinetCode = response
-        })
+        genCode("MATERIALS_CABINET").then((response) => {
+          this.form.cabinetCode = response;
+        });
       } else {
-        this.form.cabinetCode = null
+        this.form.cabinetCode = null;
       }
-    }
-  }
-}
+    },
+  },
+};
 </script>
 <style lang="scss" src="@/assets/styles/dialog-title.scss" scoped>
+</style>
+<style scoped lang="scss">
 .el-input-width {
   width: 380px !important;
 }
+.app-container {
+  width: 100%;
+  height: 100%;
+  // background: green;
+  .materialsListcon {
+    width: 100%;
+    height: 100%;
+    display: flex;
+    // background: pink;
+    .left {
+      width: 15%;
+      height: 100%;
+      margin-right: 10px;
+      // background: rgb(175, 214, 175);
+      .deptTree {
+        width: 100%;
+        height: 90%;
+        // background: rgb(199, 252, 247);
+      }
+    }
+
+    .right {
+      width: 83%;
+      height: 100%;
+      // background: yellow;
+    }
+  }
+}
 </style>