فهرست منبع

Merge branch 'dev' of https://e.coding.net/g-pheu9517/grt-iscs/ISCS_Ui_Admin_Base into dev

pm 1 سال پیش
والد
کامیت
63e7342cee
4فایلهای تغییر یافته به همراه86 افزوده شده و 61 حذف شده
  1. 3 1
      src/router/index.js
  2. 21 8
      src/store/modules/sopSelectPoints.js
  3. 29 4
      src/views/mes/job/jobm/NewOperations.vue
  4. 33 48
      src/views/mes/sop/sopm/NewSop.vue

+ 3 - 1
src/router/index.js

@@ -319,7 +319,9 @@ export const dynamicRoutes = [
   }
 ]
 
-// 防止连续点击多次路由报错
+
+
+//防止连续点击多次路由报错
 let routerPush = Router.prototype.push;
 Router.prototype.push = function push(location) {
   return routerPush.call(this, location).catch(err => err)

+ 21 - 8
src/store/modules/sopSelectPoints.js

@@ -2,20 +2,27 @@
 const state = {
   selectSopPoints: [],
   PointTableData: [],
-  sopEdit:true,
-
+  sopEdit: true,
+  sopTitle: '',
+  ticketTitle: ''
 };
 
 const mutations = {
   setSelectSopPoints(state, points) {
     state.selectSopPoints = points;
   },
-  setPointTableData(state, points){
+  setPointTableData(state, points) {
     state.PointTableData = points;
   },
-  setSopEdit(state, points){
+  setSopEdit(state, points) {
     state.sopEdit = points;
   },
+  setSopTitle(state, points) {
+    state.sopTitle = points;
+  },
+  setTicketTitle(state, points) {
+    state.ticketTitle = points;
+  },
 
 };
 
@@ -23,20 +30,26 @@ const actions = {
   setSelectSopPoints({ commit }, points) {
     commit('setSelectSopPoints', points);
   },
-  setPointTableData({ commit }, points){
+  setPointTableData({ commit }, points) {
     commit('setPointTableData', points);
   },
-  setSopEdit({ commit }, points){
+  setSopEdit({ commit }, points) {
     commit('setSopEdit', points);
   },
-
+  setSopTitle({ commit }, points) {
+    commit('setSopTitle', points);
+  },
+  setTicketTitle({ commit }, points) {
+    commit('setTicketTitle', points);
+  },
 };
 
 const getters = {
   getSelectSopPoints: state => state.selectSopPoints,
   getPointTableData: state => state.PointTableData,
   getSopEdit: state => state.sopEdit,
-
+  getSopTitle: state => state.sopTitle,
+  getTicketTitle: state => state.ticketTitle
 };
 
 export default {

+ 29 - 4
src/views/mes/job/jobm/NewOperations.vue

@@ -20,10 +20,16 @@
       <div class="right_top">
         <el-card class="box-card">
           <div slot="header" class="clearfix">
-            <span style="font-size: 18px">新建</span>
+            <span style="font-size: 18px">{{ this.getTicketTitle }}</span>
             <span
-              style="float: right; padding: 1px 0; font-size: 22px"
+              style="
+                float: right;
+                padding: 1px 0;
+                font-size: 22px;
+                cursor: pointer;
+              "
               type="text"
+              @click="goBack"
               >×</span
             >
           </div>
@@ -487,6 +493,7 @@ export default {
       "getPointTableData",
       "getSelectSopPoints",
       "getSopEdit",
+      "getTicketTitle",
     ]),
     // 排序 ticketUserDTOList,将 userRole 为 0 的选项放在前面
     sortedTicketUserDTOList() {
@@ -501,9 +508,11 @@ export default {
     if (this.$route.query.ticketId !== "null") {
       this.getTicket();
       this.form.ticketId = this.$route.query.ticketId;
+      this.setTicketTitle("编辑");
     } else {
       this.setSelectSopPoints([]);
       this.setPointTableData([]);
+      this.setTicketTitle("新建");
     }
     // console.log(this.getPointTableData, 'this.getPointTableData')
     if (this.getPointTableData) {
@@ -517,12 +526,21 @@ export default {
       });
     }
   },
+  beforeRouteEnter(to, from, next) {
+    if (to.query.ticketId !== "null" || !to.query.ticketId) {
+      to.meta.title = "SOP管理-编辑作业票"; // 动态修改标题
+    } else {
+      to.meta.title = "SOP管理-新建作业票"; // 动态修改标题
+    }
+    next();
+  },
   methods: {
     // 编辑的时候给隔离点重新存储值
     ...mapActions("sopSelectPoints", [
       "setSelectSopPoints",
       "setPointTableData",
       "setSopEdit",
+      "setTicketTitle",
     ]),
     formatDateTime(date) {
       const year = date.getFullYear().toString().padStart(2, "0");
@@ -875,7 +893,8 @@ export default {
           // 调用编辑接口
           const res = await updateJobTicket(editdata);
           if (res.code === 200) {
-            this.$router.go(-1);
+            // this.$router.go(-1);
+            this.$router.push("/job");
           } else {
             console.error("编辑工单失败", res);
           }
@@ -883,7 +902,8 @@ export default {
           // 调用新增接口
           const res = await addJobTicket(data);
           if (res.code === 200) {
-            this.$router.go(-1);
+            // this.$router.go(-1);
+            this.$router.push("/job");
           } else {
             console.error("提交工单失败", res);
           }
@@ -992,6 +1012,11 @@ export default {
       }),
         (this.autoGenFlag = false);
     },
+
+    // 侧边x关闭
+    goBack() {
+      this.$router.push("/job");
+    },
     //自动生成编码
     handleAutoGenChange(autoGenFlag) {
       if (autoGenFlag) {

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

@@ -20,16 +20,22 @@
       <div class="right_top">
         <el-card class="box-card">
           <div slot="header" class="clearfix">
-            <span style="font-size: 18px">新建SOP</span>
+            <span style="font-size: 18px">{{ this.getSopTitle }}</span>
             <span
-              style="float: right; padding: 1px 0; font-size: 22px"
+              style="
+                float: right;
+                padding: 1px 0;
+                font-size: 22px;
+                cursor: pointer;
+              "
               type="text"
+              @click="goBack"
               >×</span
             >
           </div>
           <div class="text item">
             <el-tabs v-model="activeName" @tab-click="handleClick">
-              <el-tab-pane label="SOP新增" name="first">
+              <el-tab-pane :label="this.getSopTitle" name="first">
                 <!-- 新增作业票信息-->
                 <el-form ref="form" :model="form" label-width="70px">
                   <el-form-item label="SOP名称" prop="sopName">
@@ -252,17 +258,35 @@ export default {
     if (this.$route.query.sopId !== "null") {
       // console.log(this.$route.query.sopId, "接受路由参数");
       this.getSopInfo();
+      this.setSopTitle("编辑SOP");
     } else {
       this.setSelectSopPoints([]);
       this.setPointTableData([]);
+      this.setSopTitle("新增SOP");
     }
   },
+  computed: {
+    ...mapGetters("sopSelectPoints", ["getSopTitle"]),
+  },
+
 
+  beforeRouteEnter(to, from, next) {
+    // console.log(to.query.sopId, "进入路由");
+    if (to.query.sopId !== "null" || !to.query.sopId) {
+      // console.log(to.query.sopId, "编辑");
+      to.meta.title = "SOP管理-编辑SOP"; // 动态修改标题
+    } else {
+      // console.log(to.query.sopId, "新增");
+      to.meta.title = "SOP管理-新建SOP"; // 动态修改标题
+    }
+    next();
+  },
   methods: {
     ...mapActions("sopSelectPoints", [
       "setSelectSopPoints",
       "setPointTableData",
       "setSopEdit",
+      "setSopTitle",
     ]),
     handleClick(tab, event) {
       // console.log(tab, event);
@@ -353,7 +377,7 @@ export default {
         updateIsSop(data).then((res) => {
           console.log(res, "修改接口");
           if (res.code == 200) {
-            this.$router.go(-1);
+            this.$router.push("/sop/sopm");
             this.$message.success("SOP修改成功");
           }
         });
@@ -362,56 +386,13 @@ export default {
         addinsertIsSop(data).then((res) => {
           console.log(res, "新增接口");
           if (res.code == 200) {
-            this.$router.go(-1);
+            this.$router.push("/sop/sopm");
             this.$message.success("SOP新建成功");
           }
         });
       }
     },
 
-    // submit() {
-    //   // 确保 this.form.spoint 是一个数组
-    //   // if (!Array.isArray(this.form.spoint)) {
-    //   //   this.form.spoint = [];
-    //   // }
-
-    //   const selectedpointIds = this.form.spoint.join(",");
-    //   const data = {
-    //     pointIds: selectedpointIds,
-    //     sopContent: this.form.sopContent,
-    //     sopCode: this.form.sopCode,
-    //     sopName: this.form.sopName,
-    //     sopType: this.form.sopType,
-    //     workareaId: this.points.value,
-    //     workshopId: this.emitWorkShop.value,
-    //   };
-
-    //   if (this.$route.query.sopId) {
-    //     // 确保 sopId 存在
-    //     if (!this.form.sopId) {
-    //       console.error("隔离点id不可为空!");
-    //       this.$message.error("隔离点id不可为空!"); // 假设你使用的是 Element UI 的消息提示
-    //       return;
-    //     }
-
-    //     data.sopId = this.form.sopId;
-
-    //     updateIsSop(data).then((res) => {
-    //       console.log(res, "修改接口");
-    //       if (res.code == 200) {
-    //         this.$router.go(-1);
-    //       }
-    //     });
-    //   } else {
-    //     addinsertIsSop(data).then((res) => {
-    //       console.log(res, "新增接口");
-    //       if (res.code == 200) {
-    //         this.$router.go(-1);
-    //       }
-    //     });
-    //   }
-    // },
-
     // 子组件选中的隔离点逆传递拿到的数据
     handleSelectPoint(points) {
       // console.log(points, "父组件接收逆向传递选中的隔离点");
@@ -469,6 +450,10 @@ export default {
         this.form.sopCode = null;
       }
     },
+    // 侧边X关闭
+    goBack() {
+      this.$router.push("/sop/sopm");
+    },
     //   methods结束
   },
 };