Jelajahi Sumber

Merge branch 'sit' into dev

xiaodai2022 2 tahun lalu
induk
melakukan
befd39a513

+ 97 - 50
src/components/globalComponents/Breadcrumb/main.vue

@@ -1,93 +1,140 @@
 <template>
-  <el-breadcrumb class="app-breadcrumb" separator="/">
-    <transition-group name="breadcrumb">
-      <el-breadcrumb-item v-for="(item, index) in levelList" :key="item.path">
-        <span
-          v-if="item.redirect === 'noRedirect' || index >0"
-          class="no-redirect"
-        >{{ item.meta.title }}</span>
-        <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
-      </el-breadcrumb-item>
-    </transition-group>
-  </el-breadcrumb>
+  <div class="Breadcrumb">
+    <i
+      class="el-icon-d-arrow-left fl"
+      :class="{ cor: isShow }"
+      @click="back_arrow"
+    ></i>
+    <el-breadcrumb class="app-breadcrumb" separator="/">
+      <transition-group name="breadcrumb">
+        <el-breadcrumb-item v-for="(item, index) in levelList" :key="item.path">
+          <span
+            v-if="item.redirect === 'noRedirect' || index > 0"
+            class="no-redirect"
+            >{{ item.meta.title }}</span
+          >
+          <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
+        </el-breadcrumb-item>
+      </transition-group>
+    </el-breadcrumb>
+  </div>
 </template>
 
 <script>
-import pathToRegexp from 'path-to-regexp'
+import pathToRegexp from "path-to-regexp";
 
 export default {
-  name:'Breadcrumb',
+  name: "Breadcrumb",
   data() {
     return {
-      levelList: null
-    }
+      levelList: null,
+      isShow: false,
+      backOtions: null,
+      backUrl: "",
+    };
   },
   watch: {
     $route(route) {
       // if you go to the redirect page, do not update the breadcrumbs
-      if (route.path.startsWith('/redirect/')) {
-        return
+      if (route.path.startsWith("/redirect/")) {
+        this.isShow = false;
+        return;
       }
-      this.getBreadcrumb()
-    }
+      this.getBreadcrumb();
+    },
   },
   created() {
-    this.getBreadcrumb()
+    this.getBreadcrumb();
   },
   methods: {
     getBreadcrumb() {
       // only show routes with meta.title
       let matched = this.$route.matched.filter(
-        item => item.meta && item.meta.title
-      )
-      const first = matched[0]
+        (item) => item.meta && item.meta.title
+      );
+      const first = matched[0];
 
       if (!this.isDashboard(first)) {
-        matched = [{ path: '/welcome/dashboard', meta: { title: '首页' }}].concat(
-          matched
-        )
+        matched = [
+          { path: "/welcome/dashboard", meta: { title: "首页" } },
+        ].concat(matched);
       }
 
       this.levelList = matched.filter(
-        item => item.meta && item.meta.title && item.meta.breadcrumb !== false
-      )
+        (item) => item.meta && item.meta.title && item.meta.breadcrumb !== false
+      );
+      const { preModel } = this.$route.query;
+      if (preModel) {
+        let model = JSON.parse(preModel);
+        this.isShow = true;
+        const { options, router } = model;
+        this.backOtions = options;
+        this.backUrl = router;
+      } else {
+        this.isShow = false;
+      }
     },
     isDashboard(route) {
-      const name = route && route.name
+      const name = route && route.name;
       if (!name) {
-        return false
+        return false;
       }
       return (
-        name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase()
-      )
+        name.trim().toLocaleLowerCase() === "Dashboard".toLocaleLowerCase()
+      );
     },
     pathCompile(path) {
-      const { params } = this.$route
-      var toPath = pathToRegexp.compile(path)
-      return toPath(params)
+      const { params } = this.$route;
+      var toPath = pathToRegexp.compile(path);
+      return toPath(params);
+    },
+    back_arrow() {
+      if (!this.isShow) {
+        return;
+      }
+      window.vm.$router.push({
+        path: this.backUrl,
+        query: {
+          back: JSON.stringify(this.backOtions),
+        },
+      });
     },
     handleLink(item) {
-      const { redirect, path } = item
+      const { redirect, path } = item;
       if (redirect) {
-        window.vm.$router.push(redirect)
-        return
+        window.vm.$router.push(redirect);
+        return;
       }
-      window.vm.$router.push(this.pathCompile(path))
-    }
-  }
-}
+      window.vm.$router.push(this.pathCompile(path));
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
-.app-breadcrumb.el-breadcrumb {
-  display: inline-block;
-  font-size: 14px;
-  line-height: 50px;
-  margin-left: 18px;
+.Breadcrumb {
+  .el-icon-d-arrow-left {
+    display: inline-block;
+    font-size: 14px;
+    line-height: 50px;
+    margin: 0 8px 0 1px;
+    color: transparent;
+    &.cor {
+      color: #000;
+      &:hover {
+        cursor: pointer;
+      }
+    }
+  }
+  .app-breadcrumb.el-breadcrumb {
+    display: inline-block;
+    font-size: 14px;
+    line-height: 50px;
 
-  .no-redirect {
-    color: #97a8be;
-    cursor: text;
+    .no-redirect {
+      color: #97a8be;
+      cursor: text;
+    }
   }
 }
 </style>

+ 9 - 0
src/views/process/oing/index.vue

@@ -132,6 +132,10 @@ export default {
   },
   mounted() {
     console.log(this.process_router_list);
+    const { back } = this.$route.query;
+    if (back) {
+      this.parmValue = JSON.parse(back);
+    }
     this.searchProList();
     this.searchList();
   },
@@ -148,6 +152,11 @@ export default {
           id: to === "code" ? order_code : order_id,
         };
 
+        let routerModel = {
+          options: JSON.parse(JSON.stringify(this.parmValue)),
+          router: this.$route.fullPath,
+        };
+        model.preModel = JSON.stringify(routerModel);
         this.routeGoto(toRouter, model);
       } else {
         this.$message.warning("暂未找到相关流程!");