Compare commits
No commits in common. "e94ecb4e63761c13b84e05fb3c8d26d68991945a" and "134fdbc4b310784cf4d61208e567ad7a9ef9dd9f" have entirely different histories.
e94ecb4e63
...
134fdbc4b3
@ -140,7 +140,7 @@
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||
import { storeWarehouseWarehouseList } from '@/api/storeWarehouse.warehouse/storeWarehouse'
|
||||
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
|
||||
@ -1367,7 +1367,7 @@ export const waveIndexRangeScanField = scanBasicField({
|
||||
defaultOperator: 'between',
|
||||
hideOperator: true
|
||||
})
|
||||
/** ScanBox:波次类型(wave_scope)。0=未分配、1=大团购、2=散单、3=小团购、4=单品单件;
|
||||
/** ScanBox:波次类型(wave_scope)。0=未分配、1=大团购、2=散单、3=小团购;
|
||||
* 后端按值解析波次ID 范围(未分配 wave_id = 0,其余按 wave_type 反查波次ID),多选由后端 OR 合并。 */
|
||||
export const waveScopeScanField = scanBasicField({
|
||||
label: '波次类型',
|
||||
@ -1379,8 +1379,7 @@ export const waveScopeScanField = scanBasicField({
|
||||
{ label: '未分配', value: 0 },
|
||||
{ label: '大团购', value: 1 },
|
||||
{ label: '散单', value: 2 },
|
||||
{ label: '小团购', value: 3 },
|
||||
{ label: '单品单件', value: 4 }
|
||||
{ label: '小团购', value: 3 }
|
||||
]
|
||||
})
|
||||
export const deliveryOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'delivery_order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeTab"
|
||||
@tab-change="handleTabChange"
|
||||
tab-position="top"
|
||||
type="border-card"
|
||||
class="tab-container"
|
||||
@ -76,7 +77,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed, markRaw, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import { useExperimentalStore } from '@/stores/modules/experimental'
|
||||
import { Sort } from '@element-plus/icons-vue'
|
||||
@ -91,7 +92,6 @@ import { safeInvoke } from '@/utils/safe-invoke'
|
||||
import { WAVE_PAGE_CONFIG } from './config/wave-config'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const settingsStore = useSettingsStore()
|
||||
const experimentalStore = useExperimentalStore()
|
||||
/** tab 缓存开关(实验性设置,默认开) */
|
||||
@ -202,38 +202,40 @@ function applyTabOrder(order: string[]) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 首屏 / 刷新 / 外部导航时从地址栏恢复 tab(?tab=<name>)。
|
||||
* 说明:布局层 AppMain 的 router-view :key 已收窄为 route.name ?? route.path
|
||||
* (见 layout/component/AppMain.vue),同页 query 变化不再触发整页销毁重建,
|
||||
* 因此可安全地在页签切换时把当前 tab 写回 URL,刷新 / 复制链接都能回到对应页签。
|
||||
* 非法 / 缺失 tab 时归位到团购波次。
|
||||
* 首屏 / 外部导航时从地址栏恢复 tab。
|
||||
* 方案B:页签切换改为纯本地状态(handleTabChange 不写回路由),
|
||||
* 因为布局层 AppMain 使用 route.fullPath 作为 router-view 的 key,
|
||||
* 任何 URL 变化(含 ?tab=)都会触发整页销毁重建,导致切换卡顿、重复请求与显示闪烁。
|
||||
* 此处仅:① 首屏按 URL 初始化;② 浏览器前进/后退等外部导航时同步本地 tab。
|
||||
* 非法 / 缺失 tab 时纯本地归位到团购波次,绝不写回路由。
|
||||
*/
|
||||
watch(
|
||||
() => route.query.tab,
|
||||
(newTab) => {
|
||||
const validTabs = tabs.value.map((t) => t.name)
|
||||
const raw = newTab === undefined || newTab === null ? '' : String(newTab).trim()
|
||||
activeTab.value = raw && validTabs.includes(raw) ? raw : 'groupWave'
|
||||
|
||||
if (raw && validTabs.includes(raw)) {
|
||||
activeTab.value = raw
|
||||
return
|
||||
}
|
||||
|
||||
activeTab.value = 'groupWave'
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
/** 将当前 tab 名称写入 URL query(?tab=);用 replace 避免每次切换新增历史记录 */
|
||||
function syncActiveTabToUrl(name: string) {
|
||||
if (String(route.query.tab ?? '') === name) return
|
||||
void router.replace({ query: { ...route.query, tab: name } }).catch(() => {})
|
||||
const handleTabChange = (tabName: string | number) => {
|
||||
safeInvoke(() => {
|
||||
const name = String(tabName)
|
||||
// 方案B:纯本地切换,不写回路由(避免改变 fullPath 触发 AppMain 整页销毁重建)
|
||||
if (activeTab.value === name) {
|
||||
return
|
||||
}
|
||||
activeTab.value = name
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听 activeTab 变化并把当前页签同步到 URL。
|
||||
* 注意:不能用 @tab-change——el-tabs 的 v-model 会先更新 activeTab,事件触发时新旧值已相等,
|
||||
* 原代码的守卫恒 return 导致 URL 从未写回;改由 watcher 作为单一同步入口。
|
||||
* 与上方 route.query.tab 监听互斥:URL 已等于 activeTab 时不重复 replace,不会死循环。
|
||||
*/
|
||||
watch(activeTab, (name) => {
|
||||
safeInvoke(() => syncActiveTabToUrl(String(name)))
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
applySavedTabOrder()
|
||||
})
|
||||
|
||||
@ -192,7 +192,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { storeWarehouseWarehouseList } from '@/api/storeWarehouse.warehouse/storeWarehouse'
|
||||
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
|
||||
import { storeWarehouseUnbind, storeWarehouseRename, storeWarehouseConfirmSign } from '@/api/storewarehouse.store/storeWarehouse'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user