Procházet zdrojové kódy

esc按键返回优化

@dongkboy před 4 měsíci
rodič
revize
82c9510734

+ 6 - 6
src/views/finance/index.vue

@@ -136,7 +136,7 @@
             <template #default="scope">
               <el-button link type="primary" size="small" @click="auditReceive(scope.row)">领取</el-button>
               <el-button link type="primary" size="small" @click="updateSigningTime(scope.row)">更新签单时间</el-button>
-              <el-button link type="primary" size="small" @click="handleToDetail(scope)">详情</el-button>
+              <el-button link type="primary" size="small" @click="handleToDetail(scope, '0')">详情</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -281,7 +281,7 @@
             <template #default="scope">
               <!--                            <el-button link type="primary" size="small" @click="auditReceive(scope.row)">领取</el-button>
                             <el-button link type="primary" size="small" @click="updateSigningTime(scope.row)">更新签单时间</el-button>-->
-              <el-button link type="primary" size="small" @click="handleToDetail(scope)">详情</el-button>
+              <el-button link type="primary" size="small" @click="handleToDetail(scope, '1')">详情</el-button>
               <el-button link type="primary" size="small" @click="handleTrack(scope)">订单轨迹</el-button>
             </template>
           </el-table-column>
@@ -430,7 +430,7 @@
             <template #default="scope">
               <el-button link type="primary" size="small" @click="auditReceive(scope.row)">领取</el-button>
               <el-button link type="primary" size="small" @click="updateSigningTime(scope.row)">更新签单时间</el-button>
-              <el-button link type="primary" size="small" @click="handleToDetail(scope)">详情</el-button>
+              <el-button link type="primary" size="small" @click="handleToDetail(scope, '2')">详情</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -475,7 +475,7 @@ import { useRoute, useRouter } from 'vue-router'
 const myRoute = useRoute()
 const myRouter = useRouter()
 
-let activeName = ref('0')
+let activeName = ref(myRoute.query.activeindex as any || '0')
 const handleClick = (e) => {
   activeName.value = e.props.name
   pages.value = 1
@@ -622,12 +622,12 @@ const handleReset = () => {
   initData(activeName.value)
 }
 
-const handleToDetail = (scope) => {
+const handleToDetail = (scope, type) => {
   myRouter.push({
     path: '/finance/auditOrderDetail',
     query: {
       id: scope.row.orderNo,
-      isShow: 0
+      activeindex: type
     }
   })
 }

+ 11 - 5
src/views/finance/modules/auditDetail.vue

@@ -928,7 +928,7 @@
         </template>
       </el-popconfirm>
       <el-button plain @click="myRouter.push({
-        path: '/finance/audit',
+        path: previousRoute,
         query: {
           activeindex: activeindex
         }
@@ -967,11 +967,12 @@ import image from "@/assets/images/image.png";
 import pdf from "@/assets/images/pdf.png";
 import word from "@/assets/images/word.png";
 import VueOfficeDocx from "@vue-office/docx";
-import { ElMessage, ElLoading } from "element-plus";
+import { ElMessage, ElLoading, valueEquals } from "element-plus";
 const myRoute = useRoute()
 const myRouter = useRouter()
 const activeindex = ref(myRoute.query.activeindex)
-
+// 获取上一个路由的完整信息
+const previousRoute = ref(myRouter.options.history.state.back)
 // 页签
 let tipsIndex = ref(0)
 let tipsList = ref([
@@ -1336,7 +1337,12 @@ let isShow = ref('0')
 // 键盘事件处理
 const handleKeydown = (event) => {
   if (event.key === 'Escape') {
-    myRouter.back()
+    myRouter.push({
+      path: previousRoute.value,
+      query: {
+        activeindex: activeindex.value
+      }
+    })
   }
 }
 
@@ -1862,4 +1868,4 @@ onUnmounted(() => {
     display: none;
   }
 }
-</style>
+</style>