瀏覽代碼

作业票新增和编辑修复了

pm 11 月之前
父節點
當前提交
c38161546a

+ 2 - 4
src/components/separationPoint/index.vue

@@ -37,6 +37,7 @@ export default {
     'getMapData': {
       handler(newval) {
         if (newval) {
+
           this.$nextTick(()=>{
             this.initKonva()
           })
@@ -49,7 +50,7 @@ export default {
   mounted() {
     this.initKonva()
     console.log(this.points, 'points')
-    // console.log(this.getMapData, 'Mapdata')
+
     console.log(
       this.getSelectSopPoints,
       this.getSopEdit,
@@ -388,9 +389,6 @@ export default {
 
           // 触发父组件的 selection-changed 事件
           this.$emit('selection-changed', this.selectedText)
-
-
-
           this.layer.draw()
 
         }

+ 20 - 36
src/components/separationPoint/workshop.vue

@@ -70,7 +70,8 @@ export default {
         isIndeterminate: false,
         workShop: [],
         producLine: '',
-        sopId: ''
+        sopId: '',
+
       },
       workShopOptions: [],
       producLineOptions: [],
@@ -129,24 +130,18 @@ export default {
         console.log('jobProps 发生变化', newVal)
         if (newVal.length == 0) {
           this.setSopEdit(true)
-          this.form.workShop = []
-          this.form.producLine = ''
           this.form.sopId = ''
-
         } else {
+          this.isDisabled=true;
           // 在这里处理 jobProps 变化后的逻辑
-          this.form.workShop = newVal[0].workshopId
-          this.form.producLine = newVal[0].workareaId
+          if (newVal[0].workareaId) {
+
+            this.workareaName = newVal[0].workareaId  //新工作区域所返回
+            this.handleselectProductLine(newVal[0].workareaId,newVal[0].sopId);//获取已选隔离点的整个数据map
+          }
+          this.getTreeselect();//获取工作区域树
           this.form.sopId = newVal[0].sopId
-          console.log(this.form.sopId, 'form.sopId jobProps')
-          // 确保 handleselect 完成后再调用 handleselectProductLine
-          this.handleselect(newVal[0].workshopId)
-            .then(() => {
-              this.handleselectProductLine(newVal[0].workareaId)
-            })
-            .catch((error) => {
-              console.error('处理车间下拉失败', error)
-            })
+
 
           // 这里是为了拿到sop模板里默认的隔离点选中的数据a
           if (!newVal[0].EditBool) {
@@ -159,7 +154,6 @@ export default {
               // 调用 Vuex action 来存储 selectSopPoints
               this.setSelectSopPoints(selectSopPoints)
               this.setPointTableData(res.data)
-
               this.setSopEdit(false)
               console.log(selectSopPoints, 'sop_selectePoints')
             })
@@ -197,10 +191,8 @@ export default {
       'setSopEdit',
       'setMapData'
     ]),
-    // 如果是查看和编辑禁止点击树形结构
-
     // 区域下拉
-    handleselectProductLine(val) {
+    handleselectProductLine(val,sopId) {
       console.log(val, '区域下拉')
 
       // 获取区域map解析数据
@@ -217,7 +209,7 @@ export default {
       ) {
         data2 = this.$route.query.ticketId // ticketId 存在时,data1 设置为空字符串
       }
-      console.log(this.form.sopId, 'form.sopId')
+
       if (this.jobProps.length == 0) {
         console.log(
           this.jobProps,
@@ -225,8 +217,10 @@ export default {
         )
         data2 = ''
       }
-      if (this.form.sopId) {
-        data1 = this.form.sopId
+
+      if (sopId) {
+        console.log(sopId,'sopId------')
+        data1 = sopId
       }
 
       getMapDataApi(data, data1, data2)
@@ -234,25 +228,13 @@ export default {
           console.log(res, '获取区域map的解析数据')
           const mapdata = res.data
           this.setMapData(mapdata)
+
         })
         .catch((error) => {
           console.error('获取区域map数据失败', error)
         })
 
-      // //   利用组件逆传递 selectProductLine方法传递数据给兄弟组件
-      // const selectedOption = this.producLineOptions.filter((item) => {
-      //   return item.value == val
-      // })
-      // const selectworkShop = this.workShopOptions.filter((item) => {
-      //   return item.value == this.form.workShop
-      // })
-      // // 这里两个赋值是为了方式页面切换数据丢失
-      //
-      // console.log(selectworkShop, selectedOption, 'workshop-components')
-      // // 触发自定义事件,传递 selectedOption[0] 数据给父组件
-      // console.log(selectedOption, 'selectedOption[0]', this.producLineOptions)
-      // this.$emit('product-line-selected', selectedOption[0])
-      // this.$emit('work-shop-selected', selectworkShop[0])
+
     },
 
     /** 查询工作区域下拉树结构 */
@@ -348,6 +330,8 @@ export default {
         console.log('设置了地图数据')
       }
       this.workareaName = data.label
+
+
       this.handleInputChange()
       this.$emit('work-shop-selected', data)
     }

+ 1 - 0
src/router/index.js

@@ -163,6 +163,7 @@ export const dynamicRoutes = [
         meta: { title: '作业管理-查看作业票', activeMenu: '/mes/job/jobm/NewOperations' }
       },
 
+
     ]
   },
   {

+ 9 - 2
src/store/modules/sopSelectPoints.js

@@ -7,7 +7,7 @@ const state = {
   ticketTitle: '',
   sopLook: false,
   MapData:null,
-
+  visibleSopSelect:true,
 };
 
 const mutations = {
@@ -32,6 +32,9 @@ const mutations = {
   setMapData(state, points) {
     state.MapData = points;
   },
+  setVisibleSopSelect(state, points) {
+    state.visibleSopSelect = points;
+  }
 };
 
 const actions = {
@@ -55,6 +58,9 @@ const actions = {
   },
   setMapData({ commit }, points) {
     commit('setMapData', points);
+  },
+  setVisibleSopSelect({commit},points) {
+    commit('setVisibleSopSelect', points);
   }
 };
 
@@ -65,7 +71,8 @@ const getters = {
   getSopTitle: state => state.sopTitle,
   getTicketTitle: state => state.ticketTitle,
   getSopLook: state => state.sopLook,
-  getMapData:state=>state.MapData
+  getMapData:state=>state.MapData,
+  getVisibleSopSelect:state=>state.visibleSopSelect
 };
 
 export default {

+ 120 - 126
src/views/mes/job/jobm/NewOperations.vue

@@ -42,7 +42,9 @@
               <el-tab-pane label="作业票信息" name="first">
                 <!--                  新增作业票信息-->
                 <el-form ref="form" :model="form" label-width="90px">
-                  <el-form-item label="选择SOP" prop="sop">
+<!--                 getVisibleSopSelect是vuex判断新增是自定义还是建SOP作业票 第二个是编辑的时候如果有sopId就渲染 -->
+
+                  <el-form-item label="选择SOP" prop="sop" v-if="this.getVisibleSopSelect&&this.form.sopId!==null">
                     <el-select
                       :disabled="this.getSopLook"
                       v-model="form.sopId"
@@ -60,6 +62,15 @@
                       />
                     </el-select>
                   </el-form-item>
+
+                  <el-form-item label="作业票名称" prop="ticketName">
+                    <el-input
+                      :disabled="this.getSopLook"
+                      v-model="form.ticketName"
+                      placeholder="请输入作业票名称"
+                      style="width: 100%"
+                    />
+                  </el-form-item>
                   <el-row>
                     <el-col :span="16">
                       <el-form-item label="作业票编号" prop="ticketCode">
@@ -85,14 +96,6 @@
                     </el-col>
                   </el-row>
 
-                  <el-form-item label="作业票名称" prop="ticketName">
-                    <el-input
-                      :disabled="this.getSopLook"
-                      v-model="form.ticketName"
-                      placeholder="请输入作业票名称"
-                      style="width: 100%"
-                    />
-                  </el-form-item>
                   <el-form-item label="作业票类型" prop="ticketType">
                     <el-select
                       :disabled="this.getSopLook"
@@ -433,7 +436,7 @@
 
 
 <script>
-import SeparationPoint from "@/components/separationPoint/index1.vue";
+import SeparationPoint from "@/components/separationPoint/index.vue";
 import WorkShop from "@/components/separationPoint/workshop.vue";
 import {
   listJobTicket,
@@ -443,22 +446,16 @@ import {
   deleteIsJobTicket,
   getworkareaList,
 } from "@/api/mes/job/job";
-import {SopUser} from "@/api/mes/sop/sopindex"
+import { selectIsSopById, SopUser } from '@/api/mes/sop/sopindex'
 import { mapGetters, mapActions } from "vuex";
-
-import { listWorkshop } from "@/api/mes/md/workshop";
-import { listWorkarea } from "@/api/mes/wa/workarea";
 import { getIsSopPage } from "@/api/mes/sop/sopindex";
-import { listUser } from "@/api/system/user";
-import { listDept } from "@/api/system/dept";
-import IsolationLeftVue from "@/components/separationPoint/index1.vue";
 import { genCode } from "@/api/system/autocode/rule";
 
 export default {
   name: "addView",
   dicts: ["ticket_type", "power_type", "point_type", "is_user_type"],
   components: {
-    IsolationLeftVue,
+
     SeparationPoint,
     WorkShop,
   },
@@ -466,7 +463,7 @@ export default {
     return {
       //自动生成编码
       autoGenFlag: false,
-      openStaffing:false,
+      openStaffing:true,
       activeName: "first",
       form: {
         sopId: "",
@@ -483,6 +480,7 @@ export default {
         coLocker: "", //共锁人
         ticketStartTime: "", //开始时间
         ticketEndTime: "", //结束时间
+        workareaId:null,//工作区域id
         ticketUserDTOList: [
           // {
           //   userId: '',
@@ -523,8 +521,6 @@ export default {
         nickName: '',
         username: ''
       },
-      listUserOption: null,
-      listDeptOption: null,
       // 已选隔离点
       tableData: [],
       pickerOptions: {
@@ -562,6 +558,7 @@ export default {
       outsideMumber: false,
       points: null, //逆向传递拿到隔离点的数据
       emitWorkShop: null, //车间逆向传递拿到车间相关数据
+      emitworklineId: null,//生产线逆向传递拿到数据
       sopOptions: [], //sop下拉
       jobProps: [], //正向传递给车间components
       // 表单校验
@@ -617,6 +614,7 @@ export default {
       "getSopEdit",
       "getTicketTitle",
       "getSopLook",
+      "getVisibleSopSelect"
     ]),
     // 排序 ticketUserDTOList,将 userRole 为 0 的选项放在前面
     sortedTicketUserDTOList() {
@@ -627,8 +625,7 @@ export default {
   },
   mounted() {
     this.getSopList();
-    this.getUser();
-    this.handleOpenStaffing()
+    this.handleOpenStaffing();
     if (this.$route.query.ticketId !== "null") {
       this.getTicket();
       this.form.ticketId = this.$route.query.ticketId;
@@ -675,14 +672,12 @@ export default {
       return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
     },
     getTicket() {
-      this.getUser();
-
       const ticketId = this.$route.query.ticketId;
       getJobTicketInfo(ticketId).then((response) => {
         console.log(response, "编辑拿到路由参数");
+
         this.form = {
           ...this.form,
-          workshopId: response.data.workshopId,
           workareaId: response.data.workareaId,
           sopId: response.data.sopId,
           ticketCode: response.data.ticketCode,
@@ -696,17 +691,10 @@ export default {
               userRole: item.userRole,
               userId: item.userId,
             })),
-          // ticketUserDTOList: response.data.jobTicketUserList.map((item) => {
-          //   return {
-          //     userName: item.userName,
-          //     userType: item.userType,
-          //     userRole: item.userRole,
-          //     userId: item.userId
-          //   }
-          // }),
+
           locker: response.data.jobTicketUserList
             .filter((item) => item.userType == "0")
-            .map((item) => item.userName),
+            .map((item) => item.userName)[0],
           coLocker: response.data.jobTicketUserList.map((item) => {
             return item.userType !== "0" ? item.userName : null;
           }),
@@ -718,6 +706,14 @@ export default {
           ticketType: response.data.ticketType,
           EditBool: true,
         };
+        this.newticketUserDTOList=response.data.jobTicketUserList
+          .filter((item) => item.userType == "0")
+          .map((item) => ({
+            userName: item.userName,
+            userType: item.userType,
+            userRole: item.userRole,
+            userId: item.userId,
+          })),
         this.jobProps = [this.form];
         // this.listUserOption = response.data.jobTicketUserList
         console.log(this.form, "form");
@@ -741,51 +737,6 @@ export default {
         this.sopOptions = [defaultOption, ...res.data.records];
       });
     },
-    getUser() {
-      const query = {
-        pageNum: 1,
-        pageSize: 100000,
-      };
-      listUser(query).then((res) => {
-        // console.log(res, '用户列表')
-        this.listUserOption = res.rows.map((item) => {
-          return {
-            label: item.nickName,
-            value: item.userId,
-          };
-        });
-      }),
-        listDept(query).then((res) => {
-          // console.log(res, '部门列表')
-          this.listDeptOption = res.data.map((item) => {
-            return {
-              label: item.deptName,
-              value: item.deptId,
-            };
-          });
-        });
-    },
-    // 添加内部人员 部门下拉的chage事件
-    DeptChage(val) {
-      console.log(val, " 部门下拉");
-      // 每次选中先清空用户下拉
-      // this.listUserOption = []
-      this.dialogForm.nickName = null;
-      const query = {
-        pageNum: 1,
-        pageSize: 100000,
-        deptId: this.dialogForm.deptId,
-      };
-      listUser(query).then((res) => {
-        console.log(res, "用户列表");
-        this.listUserOption = res.rows.map((item) => {
-          return {
-            label: item.nickName,
-            value: item.userId,
-          };
-        });
-      });
-    },
     // sop下拉change事件 可以传递sopOptions一整个对象过去
     handleSelectSOP(value) {
       if (value == null) {
@@ -793,8 +744,22 @@ export default {
         console.log(this.form.sopId, this.form, "sop下拉change事件");
       } else {
         this.jobProps = this.sopOptions.filter((item) => item.sopId == value);
+
         this.form.ticketType = this.jobProps[0].sopType;
+
         this.form.ticketName = "sop_";
+        selectIsSopById(value).then((response) => {
+          console.log(response, 'sop-父组件')
+          const value = response.data.ticketUserDTOList //找到上锁人  这里一定要先筛选locker再去给表格筛选 否则表格筛选之后直接不会有上锁人数据了
+            .filter(item => item.userType == '0')
+            .map(item => item.userName);
+          this.form.locker=value[0],//map返回的是数字 所以这样写
+            // console.log(value,response.data.ticketUserDTOList,'form.locker')
+          this.form.ticketUserDTOList=response.data.ticketUserDTOList.filter((item)=>{return item.userType=='1'}) ;//过滤上锁人
+          this.tableData = response.data.pointDetailVOList
+          this.form.workareaId=response.data.workareaId
+        })
+
         console.log(this.jobProps, "父组件jobProps");
       }
     },
@@ -802,6 +767,7 @@ export default {
     handleClearSop() {
       this.form.ticketType = "";
       this.form.ticketName = "";
+
     },
     handleClick(tab, event) {
       // console.log(tab, event);
@@ -824,38 +790,14 @@ export default {
         this.form.ticketEndTime = this.formatDateTime(
           new Date(this.form.ticketEndTime)
         );
-        console.log(this.form, "拿到的所有参数确认");
-
-        const query = {
-          current: 1,
-          size: 100000,
-          workareaName: this.form.workline,
-        };
-
-        const query1 = {
-          current: 1,
-          size: 100000,
-          workshopName: this.form.workshopName,
-        };
-
-        const workareaId = await this.getWorkareaId(query);
-        const workshopId = await this.getWorkshopId(query1);
-
-        // 合并 newticketUserDTOList 到 this.form.ticketUserDTOList
-        if (this.form.locker) {
-          const selectedUser = this.listUserOption.find(
-            (option) => option.label === this.form.locker
-          );
-          if (selectedUser) {
-            this.form.ticketUserDTOList.push({
-              userName: selectedUser.label,
-              userId: selectedUser.value,
-              userType: "0",
-              userRole: "0",
-            });
+        // console.log(this.form, "拿到的所有参数确认");
+        const UserList=[...(this.form.ticketUserDTOList|| []),...(this.newticketUserDTOList|| [])]
+        const pointsList=this.tableData.map((item)=>{
+          return {
+            pointId:item.pointId,
+            prePointId:item.prePointId
           }
-        }
-        this.form.ticketUserDTOList.push(...this.newticketUserDTOList);
+        })
         const data = {
           pointIds: this.form.pointIds,
           sopId: this.form.sopId,
@@ -865,9 +807,9 @@ export default {
           ticketName: this.form.ticketName,
           ticketStartTime: this.form.ticketStartTime,
           ticketType: this.form.ticketType,
-          ticketUserDTOList: this.form.ticketUserDTOList,
-          workareaId: workareaId,
-          workshopId: workshopId,
+          ticketUserDTOList: UserList,
+          workareaId: this.emitworklineId,
+          pointsList: pointsList
         };
         const editdata = {
           pointIds: this.form.spoint.join(","),
@@ -879,25 +821,28 @@ export default {
           ticketName: this.form.ticketName,
           ticketStartTime: this.form.ticketStartTime,
           ticketType: this.form.ticketType,
-          ticketUserDTOList: this.form.ticketUserDTOList,
-          workareaId: workareaId,
-          workshopId: workshopId,
+          ticketUserDTOList: UserList,
+          workareaId: this.emitworklineId,
+          pointsList: pointsList
+
         };
 
         // 检查 route.query.ticketId 是否为 null
         console.log(this.$route.query.ticketId, "this.$route.query.ticketId");
         if (this.$route.query.ticketId !== "null") {
           // 调用编辑接口
+
           const res = await updateJobTicket(editdata);
           if (res.code === 200) {
             // this.$router.go(-1);
             this.$router.push("/job/jobm");
-            localStorage.removeItem("workshopId");
-            localStorage.removeItem("workareaId");
+
+
           } else {
             console.error("编辑工单失败", res);
           }
         } else {
+          console.log(data,'新增的参数')
           // 调用新增接口
           const res = await addJobTicket(data);
           if (res.code === 200) {
@@ -979,14 +924,14 @@ export default {
     },
     // 子组件逆向传递选中的隔离点
     handleSelectPoint(points) {
-      console.log(points, '父组件接收逆向传递选中的隔离点');
+      // console.log(points, '父组件接收逆向传递选中的隔离点');
 
       // 1. 去除重复的点,使用 Set 确保每个 pointId 唯一
       const uniquePoints = Array.from(
         new Set(points.map(point => point.pointId))
       ).map(id => points.find(point => point.pointId === id));
 
-      console.log(uniquePoints, '去重后的选中节点');
+      // console.log(uniquePoints, '去重后的选中节点');
 
       this.tableData = uniquePoints; // 子组件传递过来的选中节点(去重后)
 
@@ -1126,7 +1071,6 @@ export default {
       this.insideMumber = true
       this.outsideMumber = false
       // this.form.ticketUserDTOList = [];
-
       this.dialogForm.nickName = ''
     },
     addOutside() {
@@ -1212,12 +1156,28 @@ export default {
     },
     // 添加外部人员弹窗 添加给表格数据的按钮事件
     insertOutSideTable() {
+      const newUserName = this.dialogForm.username.trim();
+      if (newUserName === '') {
+        this.$message.warning('请输入用户名');
+        return;
+      }
+      // 检查新用户是否已存在于表格中
+      const existingUser = this.OutSideUserTableData.find(user => user.userName === newUserName);
+      if (existingUser) {
+        this.$message.warning('该用户已存在');
+        return;
+      }
+      // 添加新用户
       this.OutSideUserTableData.push({
-        userName: this.dialogForm.username,
+        userName: newUserName,
         userId: this.nextUserId++
-      })
-      this.dialogForm.username = ''
-      console.log(this.OutSideUserTableData, 'OutSideUserTableData')
+      });
+
+      // 清空对话框表单
+      this.dialogForm.username = '';
+
+      // 打印当前的外部人员表格数据
+      console.log(this.OutSideUserTableData, 'OutSideUserTableData');
     },
     // 添加外部人员 确认弹窗
     outSideDialogConfirm() {
@@ -1272,6 +1232,40 @@ export default {
           throw err // 抛出错误以便捕获
         })
       }
+
+      // 调用两次接口,分别传递不同的 roleKey
+      Promise.all([
+        fetchUserData('jtlocker'),
+        fetchUserData('jtcolocker')
+      ]).then((results) => {
+        // 处理两次调用的结果
+        const [jtlockerResult, jtcolockerResult] = results
+        console.log(jtlockerResult, jtcolockerResult, 'jtlocker 结果')
+        this.listLockerOption = jtlockerResult.rows.map((item) => {
+          return {
+            label: item.nickName,
+            value: item.userId
+          }
+        })
+        this.listCoLockerOption = jtcolockerResult.rows.map((item) => {
+          return {
+            label: item.nickName,
+            value: item.userId
+          }
+        })
+
+      }).catch((err) => {
+        console.error(err, '其中一个请求失败')
+      })
+      if (openStaffing) {
+        console.log(openStaffing, '开启人员配置')
+        this.openStaffing = openStaffing
+
+      } else {
+        console.log(openStaffing, '关闭人员配置')
+        this.openStaffing = openStaffing
+        this.activeName = 'first'
+      }
     },
   }
 };

+ 28 - 21
src/views/mes/job/jobm/index.vue

@@ -34,21 +34,21 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="车间名称" prop="workshopId">
-        <el-select
-          v-model="queryParams.workshopId"
-          placeholder="请选择车间名称"
-          @change="workShopChange"
-        >
-          <el-option
-            v-for="item in this.workshopList"
-            :key="item.key"
-            :label="item.label"
-            :value="item.value"
-          />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="区域" prop="workareaId">
+<!--      <el-form-item label="车间名称" prop="workshopId">-->
+<!--        <el-select-->
+<!--          v-model="queryParams.workshopId"-->
+<!--          placeholder="请选择车间名称"-->
+<!--          @change="workShopChange"-->
+<!--        >-->
+<!--          <el-option-->
+<!--            v-for="item in this.workshopList"-->
+<!--            :key="item.key"-->
+<!--            :label="item.label"-->
+<!--            :value="item.value"-->
+<!--          />-->
+<!--        </el-select>-->
+<!--      </el-form-item>-->
+      <el-form-item label="工作区域" prop="workareaId">
         <el-select v-model="queryParams.workareaId" placeholder="请选择区域">
           <el-option
             v-for="dict in this.workareaList"
@@ -122,7 +122,7 @@
           plain
           icon="el-icon-plus"
           size="mini"
-          @click="handleAdd"
+          @click="handleAdd('hasSop')"
           v-hasPermi="['mes:job:jobm:add']"
           >新增sop作业票
         </el-button>
@@ -133,7 +133,7 @@
           plain
           icon="el-icon-plus"
           size="mini"
-          @click="handleAdd"
+          @click="handleAdd('noSop')"
           v-hasPermi="['mes:job:jobm:add']"
           >新增自定义作业票
         </el-button>
@@ -208,8 +208,8 @@
           />
         </template>
       </el-table-column>
-      <el-table-column label="车间名称" align="center" prop="workshopName">
-      </el-table-column>
+<!--      <el-table-column label="车间名称" align="center" prop="workshopName">-->
+<!--      </el-table-column>-->
       <el-table-column label="作业类型" align="center" prop="ticketType">
         <template slot-scope="scope">
           <dict-tag
@@ -218,7 +218,7 @@
           />
         </template>
       </el-table-column>
-      <el-table-column label="区域" align="center" prop="workareaName">
+      <el-table-column label="工作区域" align="center" prop="workareaName">
       </el-table-column>
       <el-table-column label="隔离点总数" align="center" prop="pointCount">
       </el-table-column>
@@ -359,6 +359,7 @@ export default {
 
       // 表单参数
       form: {},
+    //
     };
   },
   created() {
@@ -375,6 +376,7 @@ export default {
       "PointTableData",
       "PointTableData",
       "setMapData",
+      'setVisibleSopSelect'
     ]),
     // 格式化日期查询数据
     formatDate(date) {
@@ -485,7 +487,12 @@ export default {
       this.multiple = !selection.length;
     },
     /** 新增按钮操作 */
-    handleAdd() {
+    handleAdd(val) {
+      if(val=='hasSop'){
+        this.setVisibleSopSelect(true)
+      }else {
+        this.setVisibleSopSelect(false)
+      }
       this.reset();
       this.open = true;
       this.selectSopPoints(null);

+ 2 - 2
src/views/mes/md/workarea/MapData.vue

@@ -35,7 +35,7 @@
 
 <script>
 import Konva from "konva";
-import { getWorkareaInfo,updateWorkarea,getMapData } from '@/api/mes/wa/workarea'
+import { getWorkareaInfo,updateWorkarea,getMapDataApi } from '@/api/mes/wa/workarea'
 
 export default {
   name: "KonvaExample",
@@ -83,7 +83,7 @@ export default {
         console.log(response,'工作区域信息')
         this.form=response.data
       })
-      getMapData(workareaId,sopId,ticketId).then(response => {
+      getMapDataApi(workareaId,sopId,ticketId).then(response => {
         console.log(response,'工作区域预览接口调用');
         this.form.map=response.data;
 

+ 33 - 13
src/views/mes/sop/sopm/NewSop.vue

@@ -600,22 +600,42 @@ export default {
       if (sopId !== null) {
         selectIsSopById(sopId).then((response) => {
           console.log(response, '详细内容')
-          this.form = response.data
-          this.sopProps = [response.data]
-          console.log(this.sopProps ,'编辑拿到的sopProps数据')
+
           if (response.data.ticketUserDTOList) {
             this.openStaffing = true;
           }
-
-          const value = response.data.ticketUserDTOList //找到上锁人  这里一定要先筛选locker再去给表格筛选 否则表格筛选之后直接不会有上锁人数据了
-            .filter(item => item.userType == '0')
-            .map(item => item.userName);
-          this.form.locker=value[0],//map返回的是数字 所以这样写
-          console.log(value,response.data.ticketUserDTOList,'form.locker')
-          this.form.ticketUserDTOList=response.data.ticketUserDTOList.filter((item)=>{return item.userType=='1'}) ;//过滤上锁人
-          this.tableData = response.data.pointDetailVOList
-          console.log(this.tableData, '编辑拿到的隔离点数据')
-
+          this.form = {
+            ...response.data,
+            workareaId: response.data.workareaId,
+            sopId: response.data.sopId,
+            spoint: response.data.pointDetailVOList,
+            ticketUserDTOList: response.data.ticketUserDTOList
+              .filter((item) => item.userType !== "0")
+              .map((item) => ({
+                userName: item.userName,
+                userType: item.userType,
+                userRole: item.userRole,
+                userId: item.userId,
+              })),
+
+            locker: response.data.ticketUserDTOList
+              .filter((item) => item.userType == "0")
+              .map((item) => item.userName)[0],
+            coLocker: response.data.ticketUserDTOList.map((item) => {
+              return item.userType !== "0" ? item.userName : null;
+            }),
+
+          };
+          this.newticketUserDTOList=response.data.ticketUserDTOList
+            .filter((item) => item.userType == "0")
+            .map((item) => ({
+              userName: item.userName,
+              userType: item.userType,
+              userRole: item.userRole,
+              userId: item.userId,
+            })),
+            this.sopProps = [response.data]
+          console.log(this.form,this.newticketUserDTOList,'编辑sop回显的数据',)
           this.title = '修改隔离点信息'
         })
       } else {

+ 1 - 1
src/views/mes/sop/sopm/sopmLook.vue

@@ -570,7 +570,7 @@ export default {
     // // 5秒后隐藏盒子
     setTimeout(() => {
       this.isVisible = false;
-    }, 10000);
+    }, 2000);
 
     this.getTreeselect(); //获取工作区域下拉
     this.handleOpenStaffing();