Commit 0c577b6868346455a729524a3d7a030acab33ec7

Authored by 刘淇
1 parent 9fee3e9c

首页tab切换

Showing 1 changed file with 9 additions and 9 deletions
pages/index/index.vue
... ... @@ -66,8 +66,8 @@
66 66 <view
67 67 v-if="showMainTabXj"
68 68 class="main-tab-item"
69   - :class="{active: mainTab === 'inspect'}"
70   - @click="handleMainTabClick('inspect')"
  69 + :class="{active: mainTab === 'inspection'}"
  70 + @click="handleMainTabClick('inspection')"
71 71 >巡检任务</view>
72 72 <view
73 73 class="main-tab-item"
... ... @@ -191,7 +191,7 @@ const useDistanceApi = computed(() =&gt; currentGroup.value.useWalkText);
191 191  
192 192 // ========== 一级Tab:养护/巡检/工单 =========
193 193 // 默认期望打开 maintain,watch权限自动修正
194   -const mainTab = ref<'maintain' | 'inspect' | 'workorder'>('maintain');
  194 +const mainTab = ref<'maintain' | 'inspection' | 'workorder'>('maintain');
195 195  
196 196 // ✅ 修复:用户角色数组
197 197 const userRoles = computed<string[]>(() => userStore.userInfo?.roles || []);
... ... @@ -215,9 +215,9 @@ const showMainTabXj = computed(() =&gt; {
215 215  
216 216 // 获取可见tab数组,用于自动选中
217 217 const availableTabList = computed(() => {
218   - const list: Array<'maintain' | 'inspect' | 'workorder'> = [];
  218 + const list: Array<'maintain' | 'inspection' | 'workorder'> = [];
219 219 if (showMainTabYh.value) list.push('maintain');
220   - if (showMainTabXj.value) list.push('inspect');
  220 + if (showMainTabXj.value) list.push('inspection');
221 221 list.push('workorder');
222 222 return list;
223 223 });
... ... @@ -233,7 +233,7 @@ watch([showMainTabYh, showMainTabXj], () =&gt; {
233 233 }, { immediate: true });
234 234  
235 235 // 一级Tab切换事件
236   -const handleMainTabClick = async (tabKey: 'maintain' | 'inspect' | 'workorder') => {
  236 +const handleMainTabClick = async (tabKey: 'maintain' | 'inspection' | 'workorder') => {
237 237 if (mainTab.value === tabKey) return;
238 238 mainTab.value = tabKey;
239 239 currentTabValue.value = 0; // 切大tab默认回到待办
... ... @@ -504,11 +504,11 @@ const loadAllTaskByDept = async () =&gt; {
504 504 } else {
505 505 await loadSmartSortTask(loc.lon, loc.lat, 'maintain');
506 506 }
507   - } else if (mainTab.value === 'inspect') {
  507 + } else if (mainTab.value === 'inspection') {
508 508 if (useDistanceApi.value) {
509   - await loadDistanceApiTask(loc.lon, loc.lat, 'inspect');
  509 + await loadDistanceApiTask(loc.lon, loc.lat, 'inspection');
510 510 } else {
511   - await loadSmartSortTask(loc.lon, loc.lat, 'inspect');
  511 + await loadSmartSortTask(loc.lon, loc.lat, 'inspection');
512 512 }
513 513 } else if (mainTab.value === 'workorder') {
514 514 // ========= 工单tab,后续对接工单接口,先置空列表占位 =========
... ...