Ver código fonte

feat:传参修改

luoy 1 dia atrás
pai
commit
ff82e1c6a1

+ 1 - 0
src/stores/userInfo.ts

@@ -18,6 +18,7 @@ export const useUserInfo = defineStore('userInfo', {
 			roles: [],
 			authBtnList: [],
 		},
+		clientID: ''
 	}),
 
 	actions: {

+ 1 - 0
src/types/pinia.d.ts

@@ -12,6 +12,7 @@ declare interface UserInfosState<T = any> {
 		userName: string;
 		[key: string]: T;
 	};
+	clientID: string;
 }
 
 // 路由缓存列表

+ 2 - 4
src/views/home/user-info.vue

@@ -83,7 +83,7 @@
             <el-table ref="tableRef" :data="tablist" height="250" style="margin-bottom: 10px;">
               <el-table-column label="客户端ID" prop="clientID" show-overflow-tooltip>
               </el-table-column>
-              <el-table-column label="最近在线" prop="lastActiveTime" width="170">
+              <el-table-column label="最近在线" prop="lastActiveTime" width="160" header-align="right">
                 <template v-slot="scope">
                   <el-button @click="goLogs(scope.row.clientID)" link type="primary">{{ scope.row.lastActiveTime }}<el-icon>
                       <ArrowRight />
@@ -291,11 +291,9 @@ onUnmounted(() => {
 const goLogs = (clientID: string) => {
   // const p = clientID ? `?clientID=${clientID}` : ''
   // console.log('p', p);
+  if (clientID) useUserInfo().clientID = clientID;
   router.push({
     path: '/marketing/data/index',
-    query: {
-      clientID
-    }
   });
 }
 

+ 9 - 2
src/views/marketing/data/index.vue

@@ -78,6 +78,7 @@ import { BasicTableProps, useTable } from '/@/hooks/table';
 import { useI18n } from 'vue-i18n';
 import { ref } from 'vue'
 import { formatDate } from '/@/utils/formatTime';
+import { useUserInfo } from '/@/stores/userInfo';
 
 const dataListModal = defineAsyncComponent(() => import('./dataListModal.vue'));
 const dataListRef = ref();
@@ -186,9 +187,15 @@ const statusFormatter = (row: any, column: any, cellValue: any, index: any) => {
 
 onMounted(() => {
   query();
-  if(route.query.clientID) {
+  // if(route.query.clientID) {
+  //   setTimeout(() => {
+  //     dataListRef.value.openDialog(route.query.clientID);
+  //   }, 500);
+  // }
+  console.log(useUserInfo(), '客户端id');
+  if(useUserInfo().clientID) {
     setTimeout(() => {
-      dataListRef.value.openDialog(route.query.clientID);
+      dataListRef.value.openDialog(useUserInfo().clientID);
     }, 500);
     // dataListRef.value.openDialog(route.query.clientID);
   }