lex 1 year ago
parent
commit
6a39874165

+ 6 - 0
src/components/VueFormMaking/components/Upload/index.vue

@@ -76,6 +76,7 @@
         accept="image/*"
         :limit="5"
         :data="dataObj"
+        style="width: 100%; height: 100%"
       >
         <i
           class="el-icon-plus"
@@ -667,6 +668,11 @@ export default {
     opacity: 0;
     cursor: pointer;
   }
+  .el-upload--text {
+    width: 100%;
+    height: 100%;
+    display: block;
+  }
 
   .drag-img-list {
     display: inline;

+ 28 - 23
src/layout/components/TagsView/index.vue

@@ -50,7 +50,7 @@ export default {
       top: 0,
       left: 0,
       selectedTag: {},
-      affixTags: []
+      affixTags: [],
     };
   },
   computed: {
@@ -59,7 +59,7 @@ export default {
     },
     routes() {
       return this.$store.state.permission.routes;
-    }
+    },
   },
   watch: {
     $route() {
@@ -97,7 +97,7 @@ export default {
     },
     async "$route.meta.title"(val) {
       await this.$store.dispatch("tagsView/addVisitedView", this.$route);
-    }
+    },
   },
   mounted() {
     this.initTags();
@@ -112,14 +112,14 @@ export default {
     },
     filterAffixTags(routes, basePath = "/") {
       let tags = [];
-      routes.forEach(route => {
+      routes.forEach((route) => {
         if (route.meta && route.meta.affix) {
           const tagPath = path.resolve(basePath, route.path);
           tags.push({
             fullPath: tagPath,
             path: tagPath,
             name: route.name,
-            meta: { ...route.meta }
+            meta: { ...route.meta },
           });
         }
         if (route.children) {
@@ -160,7 +160,7 @@ export default {
       return keyName;
     },
     syncTagViewAndSaveForm() {
-      const keys = this.$store.state.tagsView.visitedViews.map(item => {
+      const keys = this.$store.state.tagsView.visitedViews.map((item) => {
         //  (item)
         return item.path;
       });
@@ -216,27 +216,32 @@ export default {
         const { fullPath } = view;
         this.$nextTick(() => {
           this.$router.replace({
-            path: "/redirect" + fullPath
+            path: "/redirect" + fullPath,
           });
         });
       });
     },
     closeSelectedTag(view) {
+      console.log(view, "closeSelectedTag");
+      // 为了处理拦截问题
+      if (view.path == "/process/create-ticket") {
+        this.$confirm("您的申请尚未提交,是否确认返回?", "提示", {
+          confirmButtonText: "确认",
+          cancelButtonText: "取消",
+          type: "warning",
+        }).then(() => {
+          sessionStorage.setItem("create_ticket_status", 1);
+          setTimeout(() => {
+            this.selectCloseTag(view);
+          }, 20);
+        });
+      } else {
+        this.selectCloseTag(view);
+      }
+    },
+    selectCloseTag(view) {
       const searchs = new Searchs();
       searchs.remove(this.$route.path);
-      // this.$store
-      //   .dispatch("delVisitedViews", { ...view, dontNeedSave: true })
-      //   .then(views => {
-      //     if (this.isActive(view)) {
-      //       const latestView = views.slice(-1)[0];
-      //       if (latestView) {
-      //         this.$router.push(latestView.fullPath);
-      //       } else {
-      //         let firstMenuUrl = localStorage.getItem("firstMenuUrl");
-      //         this.$router.push(firstMenuUrl || "/");
-      //       }
-      //     }
-      //   });
       this.$store
         .dispatch("tagsView/delView", view)
         .then(({ visitedViews }) => {
@@ -263,7 +268,7 @@ export default {
     },
     closeAllTags(view) {
       this.$store.dispatch("tagsView/delAllViews").then(({ visitedViews }) => {
-        if (this.affixTags.some(tag => tag.path === view.path)) {
+        if (this.affixTags.some((tag) => tag.path === view.path)) {
           return;
         }
         this.toLastView(visitedViews, view);
@@ -303,8 +308,8 @@ export default {
     },
     closeMenu() {
       this.visible = false;
-    }
-  }
+    },
+  },
 };
 </script>
 

+ 7 - 1
src/views/process/list/create.vue

@@ -574,7 +574,9 @@ export default {
     },
   },
   beforeRouteLeave(to, from, next) {
-    if (this.documentState == 0) {
+    // 从 bar 里面赋值的
+    const create_ticket_status = sessionStorage.getItem("create_ticket_status");
+    if (this.documentState == 0 && !create_ticket_status) {
       setTimeout(() => {
         // 做是否离开判断?
         // 还是做是否保存判断?
@@ -592,6 +594,10 @@ export default {
           });
       }, 200);
     } else {
+      if (create_ticket_status) {
+        this.onGetFormData();
+        sessionStorage.removeItem("create_ticket_status");
+      }
       next();
     }
   },