소스 검색

物资说明部分代码新增

pm 9 달 전
부모
커밋
9d0cbffc95

+ 47 - 0
src/api/mes/instructions/index.js

@@ -0,0 +1,47 @@
+import request from '@/utils/request'
+
+// 查询物资使用说明列表
+export function listInstructions(query) {
+  return request({
+    url: '/iscs/instructions/getIsMaterialsInstructionsPage',
+    method: 'get',
+    params: query
+  })
+}
+
+
+// 查询物资使用说明详细
+export function getInstructionsInfo(deptId) {
+  return request({
+    url: '/iscs/instructions/selectIsMaterialsInstructionsById?instructionsId=' + deptId,
+    method: 'get'
+  })
+}
+
+
+// 新增物资使用说明
+export function addInstructions(data) {
+  return request({
+    url: '/iscs/instructions/insertIsMaterialsInstructions',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改物资使用说明
+export function updateInstructions(data) {
+  return request({
+    url: '/iscs/instructions/updateIsMaterialsInstructions',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除物资使用说明
+export function delInstructions(deptId) {
+  return request({
+    url: '/iscs/instructions/deleteIsMaterialsInstructionsByInstructionsIds?instructionsIds=' + deptId,
+    method: 'post'
+  })
+}
+

+ 9 - 1
src/api/mes/material/information.js

@@ -50,4 +50,12 @@ export function getIsMaterialsCabinets() {
         url: '/iscs/cabinet/getIsMaterialsCabinetPage',
         method: 'get',
     })
-}
+}
+//绑定物资
+export function updateMaterialsBinding(data) {
+  return request({
+    url: '/iscs/materials/updateMaterialsBinding',
+    method: 'post',
+    data: data
+  })
+}

+ 18 - 2
src/views/mes/email/emailTemplates/index.vue

@@ -85,6 +85,7 @@
         label="邮件模板编号"
       ></el-table-column>
       <el-table-column prop="templateName" label="邮件模板名称"></el-table-column>
+      <el-table-column prop="templateTitle" label="邮件模板标题"></el-table-column>
       <el-table-column prop="templateContent" label="内容">
         <template slot-scope="scope">
           <el-button type="text" @click="check(scope.row)">查看</el-button>
@@ -134,11 +135,12 @@
       :limit.sync="queryParams.size"
       @pagination="getList"
     />
-    <!-- 添加或修改部门对话框 -->
+    <!-- 添加或修改邮件模板对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-form-item label="邮件模板编号" prop="templateCode">
           <el-input
+            :disabled="isEdit"
             v-model="form.templateCode"
             placeholder="请输入邮件模板编号"
           />
@@ -146,6 +148,9 @@
         <el-form-item label="邮件模板名称" prop="templateName">
           <el-input v-model="form.templateName" placeholder="请输入邮件模板名称" />
         </el-form-item>
+        <el-form-item label="邮件模板标题" prop="templateTitle">
+          <el-input v-model="form.templateTitle" placeholder="请输入邮件模板标题" />
+        </el-form-item>
         <el-form-item label="邮件模板内容" prop="templateContent">
           <el-input
             type="textarea"
@@ -162,6 +167,14 @@
         <el-button v-no-more-click @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+    <el-dialog title="内容查看" :visible.sync="openCheck" width="600px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" >
+        <el-input type="textarea" autosize v-model="form.templateContent" ></el-input>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button v-no-more-click @click="cancel">关 闭</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -204,7 +217,7 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
-
+      openCheck:false,//内容查看
       // 重新渲染表格状态
       refreshTable: true,
       // 查询参数
@@ -251,6 +264,7 @@ export default {
     // 取消按钮
     cancel() {
       this.open = false;
+      this.openCheck = false;
       this.reset();
     },
     // 表单重置
@@ -323,6 +337,8 @@ export default {
     /* 查看 */
     check(row){
         console.log(row);
+        this.openCheck = true;
+        this.form = row;
     },
     /** 删除按钮操作 */
     handleDelete(row) {

+ 0 - 2
src/views/mes/hw/workCard/index.vue

@@ -442,9 +442,7 @@ export default {
               this.getList();
             });
           } else {
-
             const data=this.userList.find((item) => item.value == this.form.userId?item.value:'');
-            // console.log(data);
            this.form.userName=data.label;
            this.form.userId=data.value;
             //  console.log(this.form, "form");

+ 301 - 296
src/views/mes/job/jobm/NewMarsJob.vue

@@ -141,7 +141,7 @@
         type="primary"
         style="margin-left: 140px"
         @click="handelChange('third')"
-        >开始执行
+      >开始执行
       </el-button>
     </div>
     <div
@@ -157,7 +157,7 @@
             <div slot="header" class="clearfix">
               <span>工艺/设备 工艺图</span>
             </div>
-            <img style="margin-left: 25%" :src="this.machineryImg" alt="" />
+            <img style="margin-left: 25%" :src="this.machineryImg" alt=""/>
           </el-card>
         </div>
         <div class="left-bottom">
@@ -191,7 +191,7 @@
                   v-if="!tableVisible"
                   style="color: #53a3ef; cursor: pointer"
                   @click="handleChangeTable"
-                  >锁定站</span
+                >锁定站</span
                 >
                 <img
                   src="@/assets/images/sopbgimg.png"
@@ -243,8 +243,8 @@
                         </span>
                         <span v-if="scope.row.conflictJobNum !== null">
                           <i class="el-icon-s-claim">{{
-                            scope.row.conflictJobNum
-                          }}</i>
+                              scope.row.conflictJobNum
+                            }}</i>
                         </span>
                       </template>
                     </el-table-column>
@@ -342,7 +342,7 @@
                             type="text"
                             size="small"
                             @click="checkDetail(scope.row)"
-                            >查看</el-button
+                          >查看</el-button
                           >
                         </span>
                       </template>
@@ -353,13 +353,13 @@
             </div>
           </div>
           <el-button style="float: right" type="primary" @click="finshJobticket"
-            >结束作业
+          >结束作业
           </el-button>
           <el-button
             style="float: right; margin-right: 10px"
             type="danger"
             @click="cancelJobticket"
-            >取消作业
+          >取消作业
           </el-button>
         </el-card>
       </div>
@@ -411,8 +411,8 @@
               <el-table-column prop="userType" label="来源">
                 <template slot-scope="scope">
                   <span style="color: #2a87ff">{{
-                    scope.row.userType == "0" ? "内部" : "外部"
-                  }}</span>
+                      scope.row.userType == '0' ? '内部' : '外部'
+                    }}</span>
                 </template>
               </el-table-column>
               <!--              <el-table-column label="操作" width="80">-->
@@ -445,7 +445,7 @@
                 color: 'white',
               }"
             >
-              <el-table-column type="selection" width="55" align="center" />
+              <el-table-column type="selection" width="55" align="center"/>
               <el-table-column
                 prop="userId"
                 label="内部人员Id"
@@ -483,7 +483,7 @@
                 color: 'white',
               }"
             >
-              <el-table-column type="selection" width="55" align="center" />
+              <el-table-column type="selection" width="55" align="center"/>
               <el-table-column
                 prop="userId"
                 label="外部人员Id"
@@ -511,7 +511,7 @@
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button v-no-more-click type="primary" @click="confirmAddUser"
-          >确认
+        >确认
         </el-button>
         <el-button v-no-more-click @click="cancel">取 消</el-button>
       </div>
@@ -580,13 +580,13 @@
                     <span
                       v-else-if="scope.row.jobStatus == 4"
                       style="font-size: 20px; line-height: 30px"
-                      >🔒</span
+                    >🔒</span
                     >
                     <!-- 显示对号 -->
                     <span
                       v-else-if="scope.row.jobStatus == 5"
                       style="font-size: 20px; line-height: 30px"
-                      >✓</span
+                    >✓</span
                     >
                   </div>
                 </template>
@@ -620,13 +620,13 @@
                     <span
                       v-else-if="scope.row.jobStatus == 4"
                       style="font-size: 20px; line-height: 30px"
-                      >🔒</span
+                    >🔒</span
                     >
                     <!-- 显示对号 -->
                     <span
                       v-else-if="scope.row.jobStatus == 5"
                       style="font-size: 20px; line-height: 30px"
-                      >✓</span
+                    >✓</span
                     >
                   </div>
                 </template>
@@ -660,13 +660,13 @@
                     <span
                       v-else-if="scope.row.pointStatus == 1"
                       style="font-size: 20px; line-height: 30px"
-                      >🔒</span
+                    >🔒</span
                     >
                     <!-- 显示对号 -->
                     <span
                       v-else-if="scope.row.pointStatus == 2"
                       style="font-size: 20px; line-height: 30px"
-                      >✓</span
+                    >✓</span
                     >
                   </div>
                 </template>
@@ -694,7 +694,7 @@
       append-to-body
     >
       <el-table :data="AffectedTickets">
-        <el-table-column label="作业票编号" prop="ticketId"> </el-table-column>
+        <el-table-column label="作业票编号" prop="ticketId"></el-table-column>
         <el-table-column label="作业票名称" prop="ticketName" width="220">
         </el-table-column>
 
@@ -783,10 +783,10 @@
 </template>
 
 <script>
-import { listMarsDept } from "@/api/system/marsdept";
-import { getTechnologyInfo, listTechnology } from "@/api/system/machinery";
-import Template from "@/views/print/printtemplate/list.vue";
-import { getIsMarsSopPage } from "@/api/mes/sop/sopindex";
+import { listMarsDept } from '@/api/system/marsdept'
+import { getTechnologyInfo, listTechnology } from '@/api/system/machinery'
+import Template from '@/views/print/printtemplate/list.vue'
+import { getIsMarsSopPage } from '@/api/mes/sop/sopindex'
 import {
   addJobTicket,
   addJobUsers,
@@ -798,33 +798,33 @@ import {
   selectSopTypeByMachineryId,
   updateJobStep,
   updateJobToCancel,
-  updateJobToFinish,
-} from "@/api/mes/job/job";
-import MapData from "@/views/mes/job/jobm/Mapdata.vue";
-import { getUserList } from "@/api/mes/workCard";
-import { getJobPlayTicketInfo } from "@/api/mes/jobplay/jobplay";
-import { getLotoInfo, getLotoMapInfo } from "@/api/mes/lotoStation/lotoStation";
-import LockDetail from "@/views/mes/job/jobm/LockDetail.vue";
+  updateJobToFinish
+} from '@/api/mes/job/job'
+import MapData from '@/views/mes/job/jobm/Mapdata.vue'
+import { getUserList } from '@/api/mes/workCard'
+import { getJobPlayTicketInfo } from '@/api/mes/jobplay/jobplay'
+import { getLotoInfo, getLotoMapInfo } from '@/api/mes/lotoStation/lotoStation'
+import LockDetail from '@/views/mes/job/jobm/LockDetail.vue'
 
 export default {
-  name: "NewSop",
+  name: 'NewSop',
   components: { Template, MapData, LockDetail },
-  dicts: ["sop_type", "ticket_status", "ticket_user_type"],
+  dicts: ['sop_type', 'ticket_status', 'ticket_user_type'],
   data() {
     return {
       imageMap: {
-        0: "ticketType0", //维修
-        1: "ticketType1", //Pm
-        2: "ticketType2", //开收班
-        3: "ticketType3", //清洁
-        4: "ticketType4", //换产
+        0: 'ticketType0', //维修
+        1: 'ticketType1', //Pm
+        2: 'ticketType2', //开收班
+        3: 'ticketType3', //清洁
+        4: 'ticketType4' //换产
       },
-      tabPosition: "first",
-      selectedOption: "",
+      tabPosition: 'first',
+      selectedOption: '',
       selectedRow: null, //设备工艺 单选表格
       marsSopPage: [], //岗位对应sop列表--现在准备存放设备工艺 而不是选设备工艺的sop
       technologyList: [], //设备工艺表格数据
-      marsSopTitle: "", //岗位后 对应展示sop
+      marsSopTitle: '', //岗位后 对应展示sop
       marsDeptList: [],
       listLockerOption: [], //上锁人下拉数据
       form: null, //存储选中的设备工艺sop列表数据
@@ -840,15 +840,15 @@ export default {
       outsideTableDataOrign: [], //外部原始数据
       selectedInsideRows: [], // 存储选中的内部人员的 userId
       selectedOutsideRows: [], // 存储选中的外部人员的 userId
-      insideSearchQuery: "", // 内部搜索条件
-      outsideSearchQuery: "", // 外部搜索条件
+      insideSearchQuery: '', // 内部搜索条件
+      outsideSearchQuery: '', // 外部搜索条件
       AllUserTable: [], //所有选中人员列表
       dialogForm: {
-        nickName: "",
-        username: "",
+        nickName: '',
+        username: ''
       },
       // 弹出层标题
-      title: "",
+      title: '',
       // 弹框中显示的form表单内容
       newticketUserDTOList: [], //为了上锁人单独传递数据
       FiveDetailvisible: false, //第五步详情弹窗
@@ -867,8 +867,8 @@ export default {
       workstationId: null, //岗位Id
       rules: {
         locker: [
-          { required: true, message: "上锁人不能为空", trigger: "change" },
-        ],
+          { required: true, message: '上锁人不能为空', trigger: 'change' }
+        ]
       },
       tableVisible: true, //表格显示
       LockDetailvisible: false, //锁定站详情'
@@ -876,15 +876,15 @@ export default {
         left: 500,
         top: 260,
         width: 65,
-        height: 25,
+        height: 25
       },
       deptCCOPosition: {
         left: 670,
         top: 480,
         width: 65,
-        height: 25,
-      },
-    };
+        height: 25
+      }
+    }
   },
   computed: {
     // filteredSopTypes() {
@@ -896,58 +896,58 @@ export default {
     //   )
     // },
     isStepFourExecuted() {
-      const stepFour = this.EightStepForm.find((step) => step.stepIndex == "4");
-      return stepFour && stepFour.stepStatus === "1";
+      const stepFour = this.EightStepForm.find((step) => step.stepIndex == '4')
+      return stepFour && stepFour.stepStatus === '1'
     },
     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: {
-    tabPosition: function (val, oldVal) {
-      if (val == "first") {
-        this.getList();
+    tabPosition: function(val, oldVal) {
+      if (val == 'first') {
+        this.getList()
       }
     },
-    "dialogForm.locker": function (val) {
+    'dialogForm.locker': function(val) {
       if (val) {
-        this.handlelockerChage(val);
-        console.log("我制定了");
+        this.handlelockerChage(val)
+        console.log('我制定了')
       }
-    },
+    }
   },
 
   mounted() {
-    this.getList();
+    this.getList()
   },
   methods: {
     // 锁定站信息部分表格收缩
     handleChangeTable() {
-      this.tableVisible = !this.tableVisible;
+      this.tableVisible = !this.tableVisible
     },
     // 锁定站进入详细页面
     goLockDetail() {
       // this.$router.push({
       //   name:'LockDetail',params: { machineryId: this.machineryId }
       // },)
-      this.LockDetailvisible = true;
+      this.LockDetailvisible = true
     },
     // 内部人员搜索
     filterInsideTable() {
-      const query = this.insideSearchQuery.trim().toLowerCase();
+      const query = this.insideSearchQuery.trim().toLowerCase()
       const filteredData = this.insideTableDataOrign.filter((item) =>
         item.nickName.toLowerCase().includes(query)
-      );
-      this.insideTableData = filteredData;
+      )
+      this.insideTableData = filteredData
 
       // 如果输入框为空或null,回显选中状态
       if (!this.insideSearchQuery) {
@@ -955,31 +955,31 @@ export default {
         this.insideTableData.forEach((user) => {
           const matchingUser = this.AllUserTable.find(
             (u) => u.userId == user.userId
-          );
+          )
 
-          console.log("Matching User:", matchingUser); // 输出匹配结果
+          console.log('Matching User:', matchingUser) // 输出匹配结果
           if (matchingUser) {
             this.$nextTick(() => {
-              console.log(`Selecting user: ${user.nickName}`);
-              this.$refs.insideTable.toggleRowSelection(user, true);
-            });
+              console.log(`Selecting user: ${user.nickName}`)
+              this.$refs.insideTable.toggleRowSelection(user, true)
+            })
           } else {
             this.$nextTick(() => {
-              console.log(`Deselecting user: ${user.nickName}`);
-              this.$refs.insideTable.toggleRowSelection(user, false);
-            });
+              console.log(`Deselecting user: ${user.nickName}`)
+              this.$refs.insideTable.toggleRowSelection(user, false)
+            })
           }
-        });
+        })
       }
     },
 
     // 外部人员搜索
     filterOutsideTable() {
-      const query = this.outsideSearchQuery.trim().toLowerCase();
+      const query = this.outsideSearchQuery.trim().toLowerCase()
       const filteredData = this.outsideTableDataOrign.filter((item) =>
         item.nickName.toLowerCase().includes(query)
-      );
-      this.outsideTableData = filteredData;
+      )
+      this.outsideTableData = filteredData
 
       // 如果输入框为空或null,回显选中状态
       if (!this.outsideSearchQuery) {
@@ -987,229 +987,234 @@ export default {
         this.outsideTableData.forEach((user) => {
           const matchingUser = this.AllUserTable.find(
             (u) => u.userId == user.userId
-          );
+          )
 
-          console.log("Matching User:", matchingUser); // 输出匹配结果
+          console.log('Matching User:', matchingUser) // 输出匹配结果
           if (matchingUser) {
             this.$nextTick(() => {
-              console.log(`Selecting user: ${user.nickName}`);
-              this.$refs.outsideTable.toggleRowSelection(user, true);
-            });
+              console.log(`Selecting user: ${user.nickName}`)
+              this.$refs.outsideTable.toggleRowSelection(user, true)
+            })
           } else {
             this.$nextTick(() => {
-              console.log(`Deselecting user: ${user.nickName}`);
-              this.$refs.outsideTable.toggleRowSelection(user, false);
-            });
+              console.log(`Deselecting user: ${user.nickName}`)
+              this.$refs.outsideTable.toggleRowSelection(user, false)
+            })
           }
-        });
+        })
       }
     },
     handleTicketClick(data) {
-      console.log(data, "查看作业票详情");
-      this.ticketId = data.ticketId;
-      this.tabPosition = "third";
-      this.workstationId = data.workstationId;
+      console.log(data, '查看作业票详情')
+      this.ticketId = data.ticketId
+      this.tabPosition = 'third'
+      this.workstationId = data.workstationId
 
       getStepInfo(this.ticketId).then((res) => {
-        this.EightStepForm = res.data;
-        console.log(res, "作业票-详细信息");
-      });
-      this.machineryId = data.machineryId;
+        this.EightStepForm = res.data
+        console.log(res, '作业票-详细信息')
+      })
+      this.machineryId = data.machineryId
       // 获取设备工艺图
       getTechnologyInfo(data.machineryId).then((res) => {
-        this.machineryImg = res.data.machineryImg;
+        this.machineryImg = res.data.machineryImg
         // 获取电柜选中隔离点
-        const lotoId = res.data.lotoId;
-        const selectPointsIds = res.data.pointIdList;
+        const lotoId = res.data.lotoId
+        const selectPointsIds = res.data.pointIdList
 
         getLotoMapInfo(lotoId).then((response) => {
-          console.log(response, "电柜信息--NewMarsJob");
+          console.log(response, '电柜信息--NewMarsJob')
           this.selectPointList = response.data.filter((item) =>
             selectPointsIds.includes(item.pointId)
-          );
-          console.log(this.selectPointList, "拿到的选中隔离点数据");
-        });
-      });
+          )
+          console.log(this.selectPointList, '拿到的选中隔离点数据')
+        })
+      })
     },
     getList() {
       const data = {
         pages: 1,
-        size: -1,
-      };
+        size: -1
+      }
       getWorkstationTicketList(data).then((res) => {
-        console.log(res, "查看-正在进行中作业票列表");
+        console.log(res, '查看-正在进行中作业票列表')
 
         this.TicketListPage = res.data.filter(
-          (item) => item.workstationId == "8"
-        );
+          (item) => item.workstationId == '8'
+        )
 
         this.COCOTicketListPage = res.data.filter(
-          (item) => item.workstationId == "7"
-        );
-      });
+          (item) => item.workstationId == '7'
+        )
+      })
       const data1 = {
         pages: 1,
         size: -1,
-        machineryType: "工艺",
-      };
+        machineryType: '工艺'
+      }
       listTechnology(data1).then((res) => {
-        console.log(res, "technologyList");
-        this.technologyList = res.data.records;
-      });
+        console.log(res, 'technologyList')
+        this.technologyList = res.data.records
+      })
       listMarsDept(data).then((res) => {
-        console.log(res, "marsDeptList");
-        this.marsDeptList = res.data.records;
-      });
+        console.log(res, 'marsDeptList')
+        this.marsDeptList = res.data.records
+      })
     },
     // sop类型 el-radio
     handleSopchange(data) {
-      const sopType = this.sopTypeOption.find((item) => item.label == data);
+      const sopType = this.sopTypeOption.find((item) => item.label == data)
       const data1 = {
         pages: 1,
         size: -1,
         machineryId: this.machineryId,
-        sopType: sopType.value,
-      };
+        sopType: sopType.value
+      }
       getIsMarsSopPage(data1).then((res) => {
-        console.log(res, "SopPage");
-        this.sopId = res.data.records[0].sopId;
-      });
+        console.log(res, 'SopPage')
+        this.sopId = res.data.records[0].sopId
+      })
     },
 
     // 作业票切换
     handelChange(val, workstationId, workstationName) {
-      console.log(val);
-      this.tabPosition = val;
-      this.marsSopTitle = workstationName;
-      this.workstationId = workstationId;
+      console.log(val)
+
+      this.marsSopTitle = workstationName
+      this.workstationId = workstationId
       if (workstationId) {
         const data = {
           pages: 1,
           size: -1,
           workstationId: workstationId,
-          machineryType: "工艺",
-        };
+          machineryType: '工艺'
+        }
         listTechnology(data).then((res) => {
-          console.log(res, "设备工艺---列表");
-          this.technologyList = res.data.records;
-        });
+          console.log(res, '设备工艺---列表')
+          this.technologyList = res.data.records
+        })
         // getIsMarsSopPage(data).then((res) => {
         //   console.log(res, 'SopPage')
         //   this.marsSopPage = res.data.records
         // })
       }
-      if (val == "third") {
-        this.selectedOption = "";
-        this.sopTypeOption = [];
-        console.log(this.sopId, "this.sopId");
+      if (!this.sopId&&val == 'third') {
+        this.$message.error('请先选择对应设备工艺或sop类型')
+        return
+      }
+      this.tabPosition = val
+      if (val == 'third') {
+        this.selectedOption = ''
+        this.sopTypeOption = []
+        console.log(this.sopId, 'this.sopId')
         if (this.sopId) {
           const data = {
-            sopId: this.sopId,
-          };
+            sopId: this.sopId
+          }
           addJobTicket(data).then((res) => {
-            console.log(res, "作业票新增");
-            this.$message.success("作业开始执行");
-            this.ticketId = res.data;
+            console.log(res, '作业票新增')
+            this.$message.success('作业开始执行')
+            this.ticketId = res.data
             getStepInfo(this.ticketId).then((res) => {
-              this.EightStepForm = res.data;
-              console.log(res, "作业票-详细信息");
-            });
+              this.EightStepForm = res.data
+              console.log(res, '作业票-详细信息')
+            })
             // 获取设备工艺图
             getTechnologyInfo(this.machineryId).then((res) => {
-              this.machineryImg = res.data.machineryImg;
+              this.machineryImg = res.data.machineryImg
               // 获取电柜选中隔离点
-              const lotoId = res.data.lotoId;
-              const selectPointsIds = res.data.pointIdList;
+              const lotoId = res.data.lotoId
+              const selectPointsIds = res.data.pointIdList
 
               getLotoMapInfo(lotoId).then((response) => {
-                console.log(response, "电柜信息--NewMarsJob");
+                console.log(response, '电柜信息--NewMarsJob')
                 this.selectPointList = response.data.filter((item) =>
                   selectPointsIds.includes(item.pointId)
-                );
-                console.log(this.selectPointList, "拿到的选中隔离点数据");
-              });
-            });
-          });
+                )
+                console.log(this.selectPointList, '拿到的选中隔离点数据')
+              })
+            })
+          })
         }
       }
     },
 
     // 单选选中数据
     handleSelectionChange(selection) {
-      console.log(selection, "mars设备工艺表格多选拿到的数据");
+      console.log(selection, 'mars设备工艺表格多选拿到的数据')
 
-      this.form = selection;
-      this.machineryId = selection.machineryId;
+      this.form = selection
+      this.machineryId = selection.machineryId
       getTechnologyInfo(selection.machineryId).then((res) => {
-        this.machineryImg = res.data.machineryImg;
-      });
+        this.machineryImg = res.data.machineryImg
+      })
       selectSopTypeByMachineryId(selection.machineryId).then((res) => {
-        console.log(res, "SopTypeByMachineryId");
+        console.log(res, 'SopTypeByMachineryId')
         this.sopTypeOption = res.data.map((item) => {
           return {
             label: item.dictLabel,
-            value: item.dictValue,
-          };
-        });
-      });
+            value: item.dictValue
+          }
+        })
+      })
     },
     // 添加内部人员
     addInside(row) {
-      if (row.stepIndex == "3") {
-        this.dialogForm.locker = "";
-        this.AllUserTable = [];
-        this.newticketUserDTOList = [];
+      if (row.stepIndex == '3') {
+        this.dialogForm.locker = ''
+        this.AllUserTable = []
+        this.newticketUserDTOList = []
 
         const roleId = this.dict.type.ticket_user_type.find(
-          (item) => item.label == "jtlocker"
-        ); //利用字典值来记录上锁人 共锁人 方便如果修改了值 直接系统更改
+          (item) => item.label == 'jtlocker'
+        ) //利用字典值来记录上锁人 共锁人 方便如果修改了值 直接系统更改
         const query1 = {
           pageSize: 10000,
           pageNum: 1,
           workstationId: this.workstationId,
           roleId: roleId.value,
-          unitId: 9,
-        };
+          unitId: 9
+        }
         // 上锁人赋值  上锁人 共锁人都要遵循 属于当前工艺 当前作业负责人或者执行人的角色属性
         getUserList(query1).then((res) => {
           // 上锁人下拉数据
           this.listLockerOption = res.rows.map((item) => ({
             label: item.nickName,
-            value: item.userId,
-          }));
-        });
+            value: item.userId
+          }))
+        })
         const roleIdColocker = this.dict.type.ticket_user_type.find(
-          (item) => item.label == "jtcolocker"
-        ); //利用字典值来记录上锁人 共锁人 方便如果修改了值 直接系统更改
+          (item) => item.label == 'jtcolocker'
+        ) //利用字典值来记录上锁人 共锁人 方便如果修改了值 直接系统更改
         const query = {
           pageSize: 10000,
           pageNum: 1,
           workstationId: this.workstationId,
-          roleId: roleIdColocker.value,
-        };
+          roleId: roleIdColocker.value
+        }
         // 共锁人赋值
         getUserList(query).then((res) => {
           // 内部共锁人
-          this.insideTableData = res.rows.filter((item) => item.unitId == 9);
+          this.insideTableData = res.rows.filter((item) => item.unitId == 9)
           // 外部共锁人
-          this.outsideTableData = res.rows.filter((item) => item.unitId != "9");
+          this.outsideTableData = res.rows.filter((item) => item.unitId != '9')
 
           // 获取已分配人员数据
           getJobTicketInfo(this.ticketId).then((res) => {
-            const assignedUsers = res.data.jobTicketUserList || [];
-            console.log(assignedUsers, "已分配人员");
+            const assignedUsers = res.data.jobTicketUserList || []
+            console.log(assignedUsers, '已分配人员')
 
             this.dialogForm.locker = assignedUsers
-              .filter((item) => item.userRole == "jtlocker")
-              .map((item) => item.userName);
+              .filter((item) => item.userRole == 'jtlocker')
+              .map((item) => item.userName)
 
             const newUser = res.data.jobTicketUserList.filter(
-              (item) => item.userRole == "jtlocker"
-            );
+              (item) => item.userRole == 'jtlocker'
+            )
             this.newticketUserDTOList = [
               ...this.newticketUserDTOList,
-              ...newUser,
-            ];
+              ...newUser
+            ]
             // 更新内部和外部用户的选中状态
             this.$nextTick(() => {
               // 手动选中内部人员
@@ -1217,82 +1222,82 @@ export default {
                 const isAssigned = assignedUsers.some(
                   (assigned) =>
                     assigned.userId == user.userId &&
-                    assigned.userType == "0" &&
-                    assigned.userRole !== "jtlocker"
-                );
+                    assigned.userType == '0' &&
+                    assigned.userRole !== 'jtlocker'
+                )
                 if (isAssigned) {
-                  this.$refs.insideTable.toggleRowSelection(user, true);
+                  this.$refs.insideTable.toggleRowSelection(user, true)
                 }
-              });
+              })
 
               // 手动选中外部人员
               this.outsideTableData.forEach((user) => {
                 const isAssigned = assignedUsers.some(
                   (assigned) =>
                     assigned.userId == user.userId &&
-                    assigned.userType == "1" &&
-                    assigned.userRole !== "jtlocker"
-                );
+                    assigned.userType == '1' &&
+                    assigned.userRole !== 'jtlocker'
+                )
                 if (isAssigned) {
-                  this.$refs.outsideTable.toggleRowSelection(user, true);
+                  this.$refs.outsideTable.toggleRowSelection(user, true)
                 }
-              });
-              this.insideTableDataOrign = [...this.insideTableData];
-              this.outsideTableDataOrign = [...this.outsideTableData];
+              })
+              this.insideTableDataOrign = [...this.insideTableData]
+              this.outsideTableDataOrign = [...this.outsideTableData]
 
-              this.open = true;
-            });
-          });
-        });
+              this.open = true
+            })
+          })
+        })
       } else {
         const data = {
           stepId: row.stepId,
-          stepStatus: "1",
-        };
+          stepStatus: '1'
+        }
         updateJobStep(data).then((res) => {
-          this.$message.success("执行成功");
+          this.$message.success('执行成功')
           getStepInfo(this.ticketId).then((res) => {
-            this.EightStepForm = res.data;
-            console.log(res, "作业票-详细信息");
-          });
-        });
+            this.EightStepForm = res.data
+            console.log(res, '作业票-详细信息')
+          })
+        })
       }
     },
 
     // 上锁人下拉选择change事件
     handlelockerChage(val) {
-      console.log(val, "上锁人chage");
+      console.log(val, '上锁人chage')
       if (val) {
         // 操作选中角色发生变化
-        this.newticketUserDTOList = [];
-        this.$set(this.dialogForm, this.dialogForm.locker, val);
+        this.newticketUserDTOList = []
+        this.$set(this.dialogForm, this.dialogForm.locker, val)
       } else {
-        this.$set(this.dialogForm, this.dialogForm.locker, val);
+        this.$set(this.dialogForm, this.dialogForm.locker, val)
       }
-      this.$forceUpdate();
-      const user = this.listLockerOption.find((item) => item.value == val);
+      this.$forceUpdate()
+      const user = this.listLockerOption.find((item) => item.value == val)
 
-      if (user && this.dialogForm.locker !== "") {
+      if (user && this.dialogForm.locker !== '') {
         const existingUser = this.listLockerOption.find(
           (u) => u.userName === user.label
-        );
+        )
         if (!existingUser) {
           this.newticketUserDTOList.push({
             userName: user.label,
             userId: user.value,
             userType: 0,
-            userRole: "jtlocker",
-          });
+            userRole: 'jtlocker'
+          })
 
-          console.log(this.newticketUserDTOList, "用户");
+          console.log(this.newticketUserDTOList, '用户')
         } else {
           // console.log('用户已存在', user.label)
         }
       }
     },
     handlelockerClear() {
-      this.newticketUserDTOList = [];
-      console.log(this.newticketUserDTOList, "清除后的用户");
+      this.newticketUserDTOList = []
+      console.log(this.newticketUserDTOList, '清除后的用户')
     },
     InSelectionChange(selection) {
       // 移除未选中的内部用户
@@ -1300,7 +1305,7 @@ export default {
         (user) =>
           user.userType !== 0 ||
           selection.some((item) => item.userId === user.userId)
-      );
+      )
 
       // 添加新的内部用户
       selection.forEach((item) => {
@@ -1313,12 +1318,12 @@ export default {
             userName: item.nickName,
             userId: item.userId,
             userType: 0,
-            userRole: "jtcolocker",
-          });
+            userRole: 'jtcolocker'
+          })
         }
-      });
+      })
 
-      console.log(this.AllUserTable, "内部人员");
+      console.log(this.AllUserTable, '内部人员')
     },
 
     OutSelectionChange(selection) {
@@ -1327,7 +1332,7 @@ export default {
         (user) =>
           user.userType !== 1 ||
           selection.some((item) => item.userId === user.userId)
-      );
+      )
 
       // 添加新的外部用户
       selection.forEach((item) => {
@@ -1340,111 +1345,111 @@ export default {
             userName: item.nickName,
             userId: item.userId,
             userType: 1,
-            userRole: "jtcolocker",
-          });
+            userRole: 'jtcolocker'
+          })
         }
-      });
+      })
 
-      console.log(this.AllUserTable, "外部人员");
+      console.log(this.AllUserTable, '外部人员')
     },
     confirmAddUser() {
       const data = {
         ticketId: this.ticketId,
-        ticketUserDTOList: [...this.AllUserTable, ...this.newticketUserDTOList],
-      };
-      console.log(data, "添加人员");
+        ticketUserDTOList: [...this.AllUserTable, ...this.newticketUserDTOList]
+      }
+      console.log(data, '添加人员')
       this.$refs.dialogForm.validate((valid) => {
         if (valid) {
           addJobUsers(data).then((res) => {
-            console.log(res, "添加人员");
+            console.log(res, '添加人员')
             if (res.data) {
-              this.$message.success("分配人员成功");
-              this.open = false;
-              this.AllUserTable = [];
-              this.dialogForm.locker = "";
+              this.$message.success('分配人员成功')
+              this.open = false
+              this.AllUserTable = []
+              this.dialogForm.locker = ''
               getStepInfo(this.ticketId).then((res) => {
-                this.EightStepForm = res.data;
-                console.log(res, "作业票-详细信息");
-              });
+                this.EightStepForm = res.data
+                console.log(res, '作业票-详细信息')
+              })
             }
-          });
+          })
         }
-      });
+      })
     },
     // 人员列表删除
     deleteRow(index, rows) {
-      console.log(index, rows, "删除的行");
-      const deletedItem = rows[index]; // 获取要删除的项
-      rows.splice(index, 1); // 从显示的列表中删除
+      console.log(index, rows, '删除的行')
+      const deletedItem = rows[index] // 获取要删除的项
+      rows.splice(index, 1) // 从显示的列表中删除
 
       const formIndex = this.dialogForm.ticketUserDTOList.findIndex(
         (item) => item.userName == deletedItem.userName
-      );
+      )
       if (formIndex !== -1) {
-        this.dialogForm.ticketUserDTOList.splice(formIndex, 1); // 从 form.ticketUserDTOList 中删除
+        this.dialogForm.ticketUserDTOList.splice(formIndex, 1) // 从 form.ticketUserDTOList 中删除
       }
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.FiveDetailvisible = false;
-      this.EightDetailvisible = false;
+      this.open = false
+      this.FiveDetailvisible = false
+      this.EightDetailvisible = false
     },
     // 作业票结束
     finshJobticket() {
       const data = {
-        ticketId: this.ticketId,
-      };
+        ticketId: this.ticketId
+      }
       updateJobToFinish(data).then((res) => {
-        console.log(res, "结束作业票");
+        console.log(res, '结束作业票')
         if (res.data) {
-          this.$message.success("作业票结束");
-          this.tabPosition = "first";
-          this.getList();
+          this.$message.success('作业票结束')
+          this.tabPosition = 'first'
+          this.getList()
         }
-      });
+      })
     },
     // 作业票取消
     cancelJobticket() {
       const data = {
-        ticketId: this.ticketId,
-      };
+        ticketId: this.ticketId
+      }
       updateJobToCancel(data).then((res) => {
-        console.log(res, "取消作业票");
+        console.log(res, '取消作业票')
         if (res.data) {
-          this.$message.success("作业票取消");
-          this.tabPosition = "first";
-          this.getList();
+          this.$message.success('作业票取消')
+          this.tabPosition = 'first'
+          this.getList()
         }
-      });
+      })
     },
     //   查看详情八大步骤
     checkDetail(row) {
-      if (row.stepIndex == "5") {
-        this.FiveDetailvisible = true;
-        let ticketId = this.ticketId;
+      if (row.stepIndex == '5') {
+        this.FiveDetailvisible = true
+        let ticketId = this.ticketId
         getJobPlayTicketInfo(ticketId).then((res) => {
-          console.log(res, "作业执行详细信息");
+          console.log(res, '作业执行详细信息')
           this.jobTicket = [res.data.jobTicket].map((item) => ({
             ...item,
             lockKeyName: res.data.lockKeyName,
-            colockKeyName: res.data.colockKeyName,
-          }));
-          this.lockUserList = res.data.lockUserList;
-          this.colockUserList = res.data.colockUserList;
-          this.ticketPointsList = res.data.ticketPointsList;
-        });
-      } else if (row.stepIndex == "8") {
-        let ticketId = this.ticketId;
-        this.EightDetailvisible = true;
+            colockKeyName: res.data.colockKeyName
+          }))
+          this.lockUserList = res.data.lockUserList
+          this.colockUserList = res.data.colockUserList
+          this.ticketPointsList = res.data.ticketPointsList
+        })
+      } else if (row.stepIndex == '8') {
+        let ticketId = this.ticketId
+        this.EightDetailvisible = true
         getStepEight(ticketId).then((res) => {
-          console.log(res, "第八步查看作业票数据");
-          this.AffectedTickets = res.data;
-        });
+          console.log(res, '第八步查看作业票数据')
+          this.AffectedTickets = res.data
+        })
       }
-    },
-  },
-};
+    }
+  }
+}
 </script>
 
 

+ 36 - 12
src/views/mes/material/Inspectionrecords/index.vue

@@ -19,10 +19,9 @@
 
       <el-form-item label="物资柜" prop="cabinetId">
         <el-select
-          style="width: 208px"
+          :disabled="visibleSelect"
           v-model="queryParams.cabinetId"
           placeholder="请选择物资柜"
-
           clearable
         >
           <el-option
@@ -390,7 +389,15 @@ export default {
   props:{
     cabinetId:{
       type:String,
-      required:true
+      required:false
+    },
+    planId:{
+      type:String,
+      required:false
+    },
+    planName:{
+      type:String,
+      required:false
     }
   },
   dicts: ['material_status','checks_status','exceptions_status'],
@@ -434,6 +441,9 @@ export default {
         endTime: '',
         reason:'',
         status:'',
+        planId:null,
+        planName:'',
+        cabinetId:null,
       },
       // 表单参数
       form: {},
@@ -486,25 +496,37 @@ export default {
         ],
       },
       materialstypeOptions:[],
+      visibleSelect:false,
     }
   },
   created() {
     this.getList()
     this.getTreeselect()
     this.materialsCabinets()
-    this.queryParams.planName = this.$route.query.planName
-    this.queryParams.cabinetId = this.cabinetId
+
+    this.queryParams.planName = this.$route.query.planName || this.planName||null;
+    this.queryParams.cabinetId = this.$route.query.cabinetId ||this.cabinetId||null;
+    if(this.cabinetId){
+      this.visibleSelect=true
+
+    }
+
   },
 
   methods: {
 
     goto(row){
-      this.$router.push({
-        path:'/material/replacementrecords',
-        query:{
-          recordId:row.recordId,
-        }
-      })
+      if(this.cabinetId){
+        this.$emit('recordId',row.recordId);
+      }else{
+        this.$router.push({
+          path:'/material/replacementrecords',
+          query:{
+            recordId:row.recordId,
+          }
+        })
+      }
+
     },
     formatDate(date) {
       const year = date.getFullYear().toString().padStart(2, "0");
@@ -526,11 +548,13 @@ export default {
       }
       const data={
         ...this.queryParams,
-        planId:this.$route.query.planId
+        cabinetId:this.cabinetId,
+        planId:this.$route.query.planId||this.planId,
       }
       listCheckRecord(data).then((response) => {
         console.log(response,'response')
         this.RecordList = response.data.records
+
         this.total = response.data.total
         this.loading = false
       })

+ 7 - 2
src/views/mes/material/collectionmanagement/index.vue

@@ -10,6 +10,7 @@
     >
       <el-form-item label="物资柜" prop="loanFromId">
         <el-select
+          :disabled="visibleSelect"
           style="width: 215px"
           v-model="queryParams.loanFromId"
           placeholder="请选择物资柜"
@@ -251,7 +252,7 @@ export default {
   props:{
     cabinetId:{
       type:String,
-      required:true
+      required:false
     }
   },
   dicts: ["sys_yes_no","record_of_collection"],
@@ -342,10 +343,14 @@ export default {
       // 表单参数
       form: {},
       machinerytypeOptions:[],
+      visibleSelect:false
     };
   },
   created() {
-    this.queryParams.loanFromId = this.cabinetId
+    this.queryParams.loanFromId = this.cabinetId||null
+    if(this.cabinetId){
+      this.visibleSelect=true;
+    }
     this.getList();
     this.getTreeselect()
     this.materialsCabinets();

+ 45 - 16
src/views/mes/material/inspectionplan/index.vue

@@ -8,7 +8,7 @@
       v-show="showSearch"
       label-width="100px"
     >
-      <el-form-item label="计划名称" prop="planName">
+      <el-form-item label="计划名称" prop="planName" v-if="!visibleSelect">
         <el-input
           v-model="queryParams.planName"
           placeholder="请输入计划名称"
@@ -21,6 +21,7 @@
           v-model="queryParams.cabinetId"
           placeholder="请选择需要检查的物资柜"
           clearable
+          :disabled="visibleSelect"
         >
           <el-option
             v-for="dict in cabinets"
@@ -108,7 +109,8 @@
 <!--          v-hasPermi="['iscs:plan:remove']"-->
 <!--          >批量删除-->
 <!--        </el-button>-->
-      </el-col>
+<!--      </el-col>-->
+
       <right-toolbar
         :showSearch.sync="showSearch"
         @queryTable="getList"
@@ -200,7 +202,7 @@
         <el-form-item label="计划名称" prop="planName">
           <el-input v-model="form.planName" placeholder="请输入计划名称"/>
         </el-form-item>
-        <el-form-item label="计划日期">
+        <el-form-item label="计划日期" prop="planDate">
           <el-date-picker
             style="width: 350px"
             v-model="form.planDate"
@@ -274,16 +276,17 @@ import Crontab from '@/components/Crontab/index.vue'
 import Treeselect from '@riophae/vue-treeselect'
 import '@riophae/vue-treeselect/dist/vue-treeselect.css'
 import { listMarsDept } from '@/api/system/marsdept'
-import { getIsMaterialsCabinets } from '@/api/mes/material/information'
+import { getIsMaterialsCabinets, listMaterials } from '@/api/mes/material/information'
 import { listUser } from '@/api/system/user'
+import Template from '@/views/print/printtemplate/list.vue'
 
 export default {
   name: 'Team',
-  components: { Treeselect, Crontab },
+  components: { Template, Treeselect, Crontab },
   props:{
     cabinetId:{
       type:String,
-      required:true
+      required:false
     }
   },
   dicts: ['material_status', 'checking_status'],
@@ -368,7 +371,8 @@ export default {
             }
           }
         ]
-      }
+      },
+      visibleSelect:false,//控制查询
     }
   },
   watch:{
@@ -393,7 +397,10 @@ export default {
     }
   },
   created() {
-    this.queryParams.cabinetId = this.cabinetId
+    this.queryParams.cabinetId = this.cabinetId||null
+    if(this.cabinetId){
+      this.visibleSelect=true
+    }
     this.getList()
     this.getOtherList()
   },
@@ -458,7 +465,8 @@ export default {
         })
       })
       listMarsDept(data).then(res => {
-        this.workstationOption = this.handleTree(res.data.records, 'workstationId', 'parentId')
+        const data=res.data.records.filter((item) => {return item.parentId=='0'})
+        this.workstationOption = this.handleTree(data, 'workstationId', 'parentId')
       })
     },
     normalizer(node) {
@@ -484,13 +492,21 @@ export default {
     },
     goto(row){
       console.log(row,'goto检查计划查看')
-      this.$router.push({
-        path:'/material/Inspectionrecords',
-        query:{
-          planId:row.planId,
-          planName:row.planName,
-        }
-      })
+      if(this.cabinetId){
+        this.$emit('planId', {
+          planId: row.planId,
+          planName: row.planName
+        });
+      }else{
+        this.$router.push({
+          path:'/material/Inspectionrecords',
+          query:{
+            planId:row.planId,
+            planName:row.planName,
+          }
+        })
+      }
+
     },
     // 取消按钮
     cancel() {
@@ -536,7 +552,18 @@ export default {
       this.title = '新增检查计划'
       this.optType = 'add'
     },
+    formatELTime(date) {
+      if (!date) return '';
+      const d = new Date(date);
+      let month = '' + (d.getMonth() + 1),
+        day = '' + d.getDate(),
+        year = d.getFullYear();
+
+      if (month.length < 2) month = '0' + month;
+      if (day.length < 2) day = '0' + day;
 
+      return [year, month,day ].join('-');
+    },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset()
@@ -553,6 +580,7 @@ export default {
       this.$refs['form'].validate((valid) => {
         if (valid) {
           if (this.form.planId != null) {
+            this.form.planDate=this.formatELTime(this.form.planDate)
             updatePlan(this.form).then((response) => {
               console.log(response, '修改返回')
               this.$modal.msgSuccess('修改成功')
@@ -560,6 +588,7 @@ export default {
               this.getList()
             })
           } else {
+            this.form.planDate=this.formatELTime(this.form.planDate)
             addPlan(this.form).then((response) => {
               console.log(response, '新增返回')
               this.$modal.msgSuccess('新增成功')

+ 516 - 0
src/views/mes/material/instructions/index.vue

@@ -0,0 +1,516 @@
+<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="instructionsTitle">
+        <el-input
+          v-model="queryParams.instructionsTitle"
+          placeholder="请输入标题"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="物资类型" prop="materialsTypeId">
+        <treeselect
+          style="width: 200px"
+          v-model="queryParams.materialsTypeId"
+          :options="materialstypeOptions"
+          :normalizer="materialnormalizer"
+          placeholder="请选择物资类型"
+        />
+      </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:instructions: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="['iscs:instructions:remove']"
+        >批量删除
+        </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="instructionsId">
+      </el-table-column>
+      <el-table-column label="标题" align="center" prop="instructionsTitle"/>
+      <el-table-column
+        label="物资类型"
+        align="center"
+        prop="materialsTypeName"
+      />
+      <el-table-column
+        label="类型"
+        align="center"
+        prop="fileType"
+      >
+        <template slot-scope="scope">
+        <dict-tag :options="dict.type.file_type" :value="scope.row.fileType"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="文件" align="center" prop="fileUrl">
+        <template slot-scope="scope">
+          <el-button v-if="scope.row.fileType=='0'" type="text" @click="look(scope.row)">查看</el-button>
+          <a v-else :href="scope.row.fileUrl" target="_blank">查看</a>
+        </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:instructions:edit']"
+          >编辑
+          </el-button>
+          <el-button
+            v-no-more-click
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['iscs:instructions:remove']"
+          >删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.current"
+      :limit.sync="queryParams.size"
+      @pagination="getList"
+    />
+    <!-- 添加或修改物资对话框 -->
+    <el-dialog :visible.sync="open" width="500px" append-to-body>
+      <div slot="title" class="dialog-title">
+        <i></i>
+        <span class="title">{{ title }}</span>
+      </div>
+      <el-form ref="form" :model="form" :rules="rules" label-width="90px">
+        <el-form-item label="标题" prop="instructionsTitle">
+          <el-input
+            v-model="form.instructionsTitle"
+            placeholder="请输入标题"
+          />
+        </el-form-item>
+        <el-form-item label="物资类型" prop="materialsTypeId">
+          <treeselect
+            style="width: 350px"
+            v-model="form.materialsTypeId"
+            :options="materialstypeOptions"
+            :normalizer="materialnormalizer"
+            placeholder="选择物资类型"
+          />
+        </el-form-item>
+        <el-form-item label="类型" prop="fileType">
+          <el-select v-model="form.fileType" placeholder="文件类型">
+            <el-option
+              v-for="dict in dict.type.file_type"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="文件">
+          <el-button v-no-more-click
+                     type="info"
+                     plain
+                     icon="el-icon-upload2"
+                     size="mini"
+                     @click="handleFileUpload"
+                     v-hasPermi="['iscs:sop:import']"
+          >导入</el-button>
+        </el-form-item>
+      </el-form>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button v-no-more-click type="primary" @click="submitForm"
+        >确 定
+        </el-button
+        >
+        <el-button v-no-more-click @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+<!--    文件查看-->
+    <el-dialog v-if="form.fileType=='0'" :visible.sync="openLook" width="500px" style="height: 600px" append-to-body>
+      <div slot="title" class="dialog-title">
+        <i></i>
+        <span class="title">查看物资详情</span>
+      </div>
+      <video  width="470" height="240" controls>
+        <source :src="form.fileUrl" type="video/mp4">
+      </video>
+      <div slot="footer" class="dialog-footer">
+        <el-button v-no-more-click @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+<!--  说明上传-->
+    <el-dialog
+      :title="upload.title"
+      :visible.sync="upload.open"
+      width="400px"
+      append-to-body
+    >
+      <el-upload
+        ref="upload"
+        :limit="1"
+        accept=".mp4, .pdf"
+        :headers="upload.headers"
+        :action="upload.url + '?updateSupport=' + upload.updateSupport"
+        :disabled="upload.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+        <div class="el-upload__tip text-center" slot="tip">
+<!--          <div class="el-upload__tip" slot="tip">-->
+<!--            <el-checkbox v-model="upload.updateSupport" />-->
+<!--            是否更新已经存在的用户数据-->
+<!--          </div>-->
+          <span>mp4、pdf格式文件。</span>
+
+        </div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button v-no-more-click type="primary" @click="submitFileForm"
+        >确 定</el-button
+        >
+        <el-button v-no-more-click @click="upload.open = false"
+        >取 消</el-button
+        >
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  listInstructions,
+  getInstructionsInfo,
+  addInstructions,
+  updateInstructions,
+  delInstructions
+} from '@/api/mes/instructions/index.js'
+
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+
+import Template from '@/views/print/printtemplate/list.vue'
+import { listType } from '@/api/mes/material/typeindex'
+import { getToken } from '@/utils/auth'
+
+export default {
+  name: 'Team',
+  components: {
+    Template,
+    Treeselect
+  },
+  dicts: ['material_status','file_type'],
+  data() {
+    return {
+      //自动生成编码
+      autoGenFlag: false,
+      optType: undefined,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      codes: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 班组表格数据
+      materialsList: [],
+      // 弹出层标题
+      title: '',
+      // 是否显示弹出层
+      open: false,
+      openLook:false,
+      // 查询参数
+      createTime: '',
+      queryParams: {
+        current: 1,
+        size: 10,
+        instructionsTitle:'',
+      },
+      // 表单参数
+      form: {
+      },
+      // 表单校验
+      rules: {
+        materialsName: [
+          { required: true, message: '物资名称不能为空', trigger: 'blur' }
+        ],
+        materialsTypeId: [
+          { required: true, message: '物资类型不能为空', trigger: 'blur' }
+        ]
+      },
+      materialstypeOptions: [],
+      // 用户导入参数
+      upload: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/common/upload"
+      },
+    }
+  },
+  created() {
+
+    this.getList()
+    this.getTreeselect()
+
+  },
+
+  methods: {
+    look(row){
+      this.form=row
+      this.openLook = true
+
+    },
+    handleFileUpload(){
+      this.upload.title = "供应商导入";
+      this.upload.open = true;
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+    },
+    /** 查询物资信息列表 */
+    getList() {
+      this.loading = true
+      listInstructions(this.queryParams).then((response) => {
+        console.log(response, '获取物资说明 ')
+        this.materialsList = response.data.records
+        this.total = response.data.total
+        this.machinerytypeList = this.handleTree(
+          response.data.records,
+          'materialsTypeId',
+          'parentId',
+          'children'
+        )
+        this.loading = false
+      })
+    },
+    /** 查询物资类型下拉树结构 */
+    getTreeselect() {
+      const data = {
+        current: 1,
+        size: -1
+      }
+      listType(data).then((response) => {
+        console.log(response,'物资类型树形结构')
+        this.materialstypeOptions = this.handleTree(
+          response.data.records,
+          'materialsTypeId',
+          'parentId',
+          'children'
+        )
+      })
+    },
+    /** 查询物资类型下拉树结构 */
+    materialnormalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.materialsTypeId,
+        label: node.materialsTypeName,
+        children: node.children
+      }
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      // console.log(response,file, fileList,'文件上传成功回返')
+      this.form.fileUrl=response.url
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
+      this.getList();
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false
+      this.openLook = false
+      this.reset()
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        instructionsTitle:'',
+        fileType:'',
+        fileUrl:'',
+      }
+      this.resetForm('form')
+      this.autoGenFlag = false
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map((item) => item.instructionsId)
+
+    },
+
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset()
+      this.open = true
+      this.title = '新增物资说明'
+      this.optType = 'add'
+    },
+
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset()
+      getInstructionsInfo(row.instructionsId).then((response) => {
+        this.form = response.data
+        this.open = true
+        this.title = '编辑物资说明'
+        this.optType = 'edit'
+      })
+    },
+
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs['form'].validate((valid) => {
+        if (valid) {
+          if (this.form.instructionsId != null) {
+            updateInstructions(this.form).then((response) => {
+              console.log(response, '修改返回')
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
+          } else {
+
+            console.log(this.form, '新增参数')
+            addInstructions(this.form).then((response) => {
+              console.log(response, '新增返回')
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+            })
+          }
+        }
+      })
+    },
+
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const instructionsId = row.instructionsId || this.ids
+      this.$modal
+        .confirm('是否确认删除编号为"' + instructionsId + '"的数据项?')
+        .then(function() {
+          return delInstructions(instructionsId)
+        })
+        .then(() => {
+          this.getList()
+          this.$modal.msgSuccess('删除成功')
+        })
+        .catch(() => {
+        })
+    }
+
+  }
+}
+</script>
+<style lang="scss" src="@/assets/styles/dialog-title.scss" scoped>
+.el-input-width {
+  width: 380px !important;
+}
+</style>

+ 22 - 7
src/views/mes/material/lockers/DetailsIndex.vue

@@ -5,7 +5,7 @@
       <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-button label="fifth">更换记录</el-radio-button>
     </el-radio-group>
     <!-- 物资清单 -->
     <div v-if="tabPosition == 'first'" class="materialsListcon">
@@ -17,15 +17,15 @@
     </div>
     <!-- 检查计划 -->
     <div v-if="tabPosition == 'third'" class="materialsListcon">
-      <InspectionPlan :cabinetId="cabinetId"/>
+      <InspectionPlan :cabinetId="cabinetId" @planId="handlePlanId"/>
     </div>
     <!-- 检查记录 -->
     <div v-if="tabPosition == 'fourth'" class="materialsListcon">
-      <InspectionRecords :cabinetId="cabinetId"/>
+      <InspectionRecords :cabinetId="cabinetId" :planName="planName" :planId="planId" @recordId="handleRecordId"/>
     </div>
     <!-- 更换记录 -->
-    <div v-if="tabPosition == 'fivth'" class="materialsListcon">
-      <ReplacementRecords :cabinetId="cabinetId"/>
+    <div v-if="tabPosition == 'fifth'" class="materialsListcon">
+      <ReplacementRecords :cabinetId="cabinetId" :recordId="recordId"/>
     </div>
   </div>
 </template>
@@ -49,13 +49,28 @@ export default {
     return {
       tabPosition: "first", //顶部切换
       cabinetId: null,
+      planId: null,
+      planName:'',
+      recordId: null,
     };
   },
   created() {
-    this.cabinetId=this.$route.query.cabinetId;
+    this.cabinetId=this.$route.query.cabinetId||'';
 
   },
-  methods: {},
+  methods: {
+    handlePlanId(data) {
+      console.log('接收到的 planId:', data);
+      this.planId = data.planId;
+      this.planName = data.planName;
+      this.tabPosition = 'fourth';
+    },
+    handleRecordId(recordId) {
+      console.log('接收到的 recordId:', recordId);
+      this.recordId = recordId;
+      this.tabPosition = 'fifth';
+    }
+  },
 };
 </script>
 <style lang="scss" scoped>

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

@@ -309,7 +309,7 @@ export default {
   components: {
     Treeselect
   },
-  dicts: ['material_status'],
+  dicts: ['material_status','cabinet_status'],
   data() {
     return {
       //自动生成编码

+ 210 - 79
src/views/mes/material/materialinformation/index.vue

@@ -11,6 +11,7 @@
       <el-form-item label="物资柜" prop="materialsCabinetId">
         <el-select
           style="width: 215px"
+          :disabled="visibleSelect"
           v-model="queryParams.materialsCabinetId"
           placeholder="请选择物资柜"
         >
@@ -55,7 +56,7 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="有效期截" prop="">
+      <el-form-item label="有效期截" prop="">
         <el-date-picker
           style="width: 215px"
           :default-time="['00:00:00', '23:59:59']"
@@ -114,32 +115,46 @@
         >新增
         </el-button>
       </el-col>
+
       <el-col :span="1.5">
         <el-button
           v-no-more-click
-          type="danger"
+          type="primary"
           plain
-          icon="el-icon-delete"
+          icon="el-icon-plus"
           size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['iscs:materials:remove']"
-        >批量删除
-        </el-button>
+          @click="handleImport"
+          v-hasPermi="['iscs:materials:import']"
+        >批量新增
+        </el-button
+        >
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-if="this.cabinetId"
           v-no-more-click
-          type="info"
+          type="primary"
           plain
-          icon="el-icon-upload2"
+          icon="el-icon-link"
           size="mini"
-          @click="handleImport"
-          v-hasPermi="['iscs:materials:import']"
-        >导入
-        </el-button
-        >
+          @click="handleBind"
+          v-hasPermi="['iscs:materials: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="['iscs:materials:remove']"-->
+<!--        >批量删除-->
+<!--        </el-button>-->
+<!--      </el-col>-->
       <right-toolbar
         :showSearch.sync="showSearch"
         @queryTable="getList"
@@ -227,7 +242,7 @@
       :limit.sync="queryParams.size"
       @pagination="getList"
     />
-    <!-- 添加或修改班组对话框 -->
+    <!-- 添加或修改物资对话框 -->
     <el-dialog :visible.sync="open" width="960px" append-to-body>
       <div slot="title" class="dialog-title">
         <i></i>
@@ -270,6 +285,7 @@
           <el-col :span="12">
             <el-form-item label="物资柜" prop="materialsCabinetId">
               <el-select
+                :disabled="visibleSelect"
                 style="width: 348px"
                 v-model="form.materialsCabinetId"
                 placeholder="请选择所属物资柜"
@@ -414,6 +430,74 @@
         >
       </div>
     </el-dialog>
+
+    <!--    绑定物资的弹窗-->
+    <el-dialog :visible.sync="openBind" width="1000px" append-to-body>
+      <div slot="title" class="dialog-title">
+        <i></i>
+        <span class="title">绑定物资</span>
+      </div>
+      <el-table
+        :data="dialogMatList"
+        @selection-change="handleSelectionBindChange"
+      >
+        <el-table-column type="selection" width="55" align="center"/>
+        <el-table-column label="物资编号" align="center" prop="materialsId">
+        </el-table-column>
+        <el-table-column label="物资名称" align="center" prop="materialsName"/>
+        <el-table-column
+          label="物资类型"
+          align="center"
+          prop="materialsTypeName"
+        />
+        <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="RFID" align="center" prop="materialsRfid"/>
+        <el-table-column label="供应商" align="center" prop="supplier">
+        </el-table-column>
+        <el-table-column label="有效期" align="center" prop="expirationDate">
+          <template slot-scope="scope">
+            {{ scope.row.expirationDate }}
+          </template>
+        </el-table-column>
+        <el-table-column label="状态" align="center" prop="loanState">
+          <template slot-scope="scope">
+            <dict-tag
+              :options="dict.type.material_status"
+              :value="scope.row.loanState"
+            />
+          </template>
+        </el-table-column>
+
+      </el-table>
+      <pagination
+        v-show="totalBind > 0"
+        :total="totalBind"
+        :page.sync="queryParams.current"
+        :limit.sync="queryParams.size"
+        @pagination="getmatInfoList"
+      />
+      <div slot="footer" class="dialog-footer">
+        <el-button v-no-more-click type="primary" @click="submitBind"
+        >确 定
+        </el-button>
+        <el-button v-no-more-click @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -424,7 +508,7 @@ import {
   updateMaterials,
   deleteMaterials,
   selectMaterialsById,
-  getIsMaterialsCabinets
+  getIsMaterialsCabinets, updateMaterialsBinding
 } from '@/api/mes/material/information'
 import { listType } from '@/api/mes/material/typeindex'
 import Treeselect from '@riophae/vue-treeselect'
@@ -442,7 +526,7 @@ export default {
   props: {
     cabinetId: {
       type: String,
-      required: true
+      required: false
     }
   },
   dicts: ['material_status'],
@@ -542,7 +626,9 @@ export default {
       },
 
       // 表单参数
-      form: {},
+      form: {
+        materialsCabinetId:null
+      },
       cabinets: [], //物资所属柜
       // 表单校验
       rules: {
@@ -553,47 +639,61 @@ export default {
           { required: true, message: '物资类型不能为空', trigger: 'blur' }
         ]
       },
-
-      machinerytypeOptions: []
-
+      machinerytypeOptions: [],
+      materialsIds:[],//绑定物资传递的数据
+      queryParamsBind:{
+        current: 1,
+        size: 10,
+        materialsCabinetId: 0,
+      },
+      dialogMatList:[],//绑定物资弹窗el-table数据
+      openBind: false,
+      totalBind:0,//弹窗列表总数
+      visibleSelect:false,
     }
   },
   created() {
-    this.queryParams.materialsCabinetId = this.cabinetId
+    this.queryParams.materialsCabinetId = this.cabinetId||null
+    if(this.cabinetId){
+      this.visibleSelect=true
+
+    }
     this.getList()
     this.getTreeselect()
+
   },
   mounted() {
     this.materialsCabinets()
   },
   methods: {
-    /** 转换数据结构 */
-    normalizer(node) {
-      if (node.children && !node.children.length) {
-        delete node.children
-      }
-      return {
-        id: node.materialsTypeId,
-        label: node.materialsTypeName,
-        children: node.children
-      }
+    /* 绑定物资 */
+    handleBind(){
+     this.openBind = true
+      this.getmatInfoList();//绑定物资列表数据
     },
-    /** 查询物资类型下拉树结构 */
-    getTreeselect() {
-      const data = {
-        current: 1,
-        size: 99999
+    getmatInfoList(){
+      listMaterials(this.queryParamsBind).then((response) => {
+        this.dialogMatList = response.data.records
+        this.totalBind = response.data.total
+      })
+    },
+    submitBind(){
+      const data={
+        materialsCabinetId:this.cabinetId,
+        materialsIds:this.materialsIds
       }
-
-      listType(data).then((response) => {
-        this.machinerytypeOptions = this.handleTree(
-          response.data.records,
-          'materialsTypeId',
-          'parentId',
-          'children'
-        )
+      updateMaterialsBinding(data).then(res => {
+      console.log(res,'绑定物资')
+        if(res.data){
+          this.$message.success('绑定成功')
+          this.openBind = false
+        }
       })
     },
+    handleSelectionBindChange(selection){
+      this.materialsIds = selection.map((item) => item.materialsId)
+    },
+    // 物资绑定结束------
     // 格式化日期查询数据
     formatDate(date) {
       if (date && date instanceof Date && !isNaN(date)) {
@@ -631,6 +731,33 @@ export default {
         this.loading = false
       })
     },
+    /** 转换数据结构 */
+    normalizer(node) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.materialsTypeId,
+        label: node.materialsTypeName,
+        children: node.children
+      }
+    },
+    /** 查询物资类型下拉树结构 */
+    getTreeselect() {
+      const data = {
+        current: 1,
+        size: 99999
+      }
+
+      listType(data).then((response) => {
+        this.machinerytypeOptions = this.handleTree(
+          response.data.records,
+          'materialsTypeId',
+          'parentId',
+          'children'
+        )
+      })
+    },
     //图片上传成功
     handleImgUplaoded(imgUrl) {
       this.form.sipUrl = imgUrl
@@ -642,6 +769,7 @@ export default {
     // 取消按钮
     cancel() {
       this.open = false
+      this.openBind = false
       this.reset()
     },
     // 表单重置
@@ -704,6 +832,9 @@ export default {
       this.title = '新增物资信息'
       this.optType = 'add'
       this.form.materialsTypeId = undefined
+      if(this.visibleSelect){
+        this.form.materialsCabinetId=this.cabinetId
+      }
     },
 
     /** 修改按钮操作 */
@@ -716,8 +847,40 @@ export default {
         this.optType = 'edit'
       })
     },
-    // 导入按钮操作
+    // 有效期参数转换时间类型
+    formatDateExpirationDate(dateString) {
+      const date = new Date(dateString)
+      const year = date.getFullYear()
+      const month = String(date.getMonth() + 1).padStart(2, '0') // 月份从0开始,需要加1,并且补零
+      const day = String(date.getDate()).padStart(2, '0') // 补零
 
+      return `${year}-${month}-${day}`
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs['form'].validate((valid) => {
+        if (valid) {
+          if (this.form.materialsId != null) {
+            this.form.expirationDate = this.formatDateExpirationDate(this.form.expirationDate)
+            updateMaterials(this.form).then((response) => {
+              console.log(response, '修改返回')
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
+          } else {
+            this.form.expirationDate = this.formatDateExpirationDate(this.form.expirationDate)
+            console.log(this.form, '新增参数')
+            addMaterials(this.form).then((response) => {
+              console.log(response, '新增返回')
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+            })
+          }
+        }
+      })
+    },
     /** 导入按钮操作 */
     handleImport() {
       this.upload.title = '物资导入'
@@ -753,39 +916,7 @@ export default {
     submitFileForm() {
       this.$refs.upload.submit()
     },
-    // 有效期参数转换时间类型
-    formatDateExpirationDate(dateString) {
-      const date = new Date(dateString)
-      const year = date.getFullYear()
-      const month = String(date.getMonth() + 1).padStart(2, '0') // 月份从0开始,需要加1,并且补零
-      const day = String(date.getDate()).padStart(2, '0') // 补零
 
-      return `${year}-${month}-${day}`
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs['form'].validate((valid) => {
-        if (valid) {
-          if (this.form.materialsId != null) {
-            updateMaterials(this.form).then((response) => {
-              console.log(response, '修改返回')
-              this.$modal.msgSuccess('修改成功')
-              this.open = false
-              this.getList()
-            })
-          } else {
-            this.form.expirationDate = this.formatDateExpirationDate(this.form.expirationDate)
-            console.log(this.form, '新增参数')
-            addMaterials(this.form).then((response) => {
-              console.log(response, '新增返回')
-              this.$modal.msgSuccess('新增成功')
-              this.open = false
-              this.getList()
-            })
-          }
-        }
-      })
-    },
     /** 删除按钮操作 */
     handleDelete(row) {
       const materialsIds = row.materialsId || this.ids

+ 15 - 4
src/views/mes/material/replacementrecords/index.vue

@@ -10,7 +10,7 @@
     >
       <el-form-item label="物资柜" prop="cabinetId">
         <el-select
-          style="width: 208px"
+          :disabled="visibleSelect"
           v-model="queryParams.cabinetId"
           placeholder="请选择物资柜"
           clearable
@@ -352,8 +352,13 @@ export default {
   props:{
     cabinetId:{
       type:String,
-      required:true
+      required:false
+    },
+    recordId: {
+      type:String,
+      required:false
     }
+
   },
   dicts: ['material_status','checking_status'],
   data() {
@@ -447,11 +452,16 @@ export default {
         ],
       },
       materialstypeOptions:[],
+      visibleSelect:false,
     }
   },
 
   created() {
-    this.queryParams.cabinetId = this.cabinetId
+    this.queryParams.cabinetId = this.cabinetId||''
+
+    if(this.cabinetId){
+      this.visibleSelect=true
+    }
     this.getList()
     this.getTreeselect()
     this.materialsCabinets()
@@ -478,7 +488,8 @@ export default {
       }
       const data={
         ...this.queryParams,
-        recordId:this.$route.query.recordId
+        cabinetId:this.cabinetId,
+        recordId:this.$route.query.recordId||this.recordId,
       }
       listChangeRecord(data).then((response) => {
         console.log(response, '获取物资信息allList ')