2026-07-25 18:14:50 +08:00

1015 lines
34 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--
╔══════════════════════════════════════════════════════════════╗
║ 【页面模板 v2】— 基于 waveOrder2 架构设计 ║
╚══════════════════════════════════════════════════════════════╝
===== 快速复制使用 =====
1. 复制整个 views/mode/ 文件夹 → 重命名为你的页面名(如 views/order/myPage/)
2. 修改 defineOptions name(如 'MyPage')
3. 编辑 config/template-config.ts:
a. 在 FIELD_DICT 中添加页面字段
b. 在 tabPages 中配置标签页(引用 FIELD_DICT 的 key)
c. 在 TabPageApiConfig 中接入真实接口
4. 在 router/map.ts 中添加路由
===== 页面结构 =====
┌─────────────────────────────────────────────────────────┐
│ TabArea(多标签页切换,可关闭) │
├──────────┬──────────────────────────────────────────────┤
│ ScanBox │ OrderToolbarButtonGroup(工具栏按钮组) │
│ 筛选面板 │ ┌──────────────────────────────────────────┐│
│ │ │ UpperTable(表格) ││
│ │ │ - OperationCellRenderer(操作列) ││
│ │ ├──────────────────────────────────────────┤│
│ │ │ 分隔条(可拖拽) ││
│ │ ├──────────────────────────────────────────┤│
│ │ │ DetailPanel / LogPanel(明细/日志面板) ││
│ │ └──────────────────────────────────────────┘│
└──────────┴──────────────────────────────────────────────┘
-->
<template>
<div class="page-wrapper" :style="{ height: containerHeight }">
<!-- ===== 多标签模式:显示顶部标签栏 ===== -->
<template v-if="PAGE_CONFIG.showTabArea && !PAGE_CONFIG.singlePage">
<div class="tab-section">
<TabArea
:tabs="tabList"
:default-active="activeTabName"
@tab-change="handleTabChange"
/>
</div>
</template>
<!-- ===== 主内容区 ===== -->
<div class="main-container">
<div class="order-sub-container">
<!-- 左侧:ScanBox 筛选面板 -->
<ScanBox
ref="scanBoxRef"
:cache-key="currentScanBoxCacheKey"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="currentScanBoxFields"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
/>
<!-- 右侧:内容区 -->
<div class="main-content">
<transition name="tab-fade" mode="out-in">
<div :key="activeTabName" class="tab-content-inner">
<!-- 工具栏按钮组 -->
<div class="toolbar">
<div class="toolbar-left">
<OrderToolbarButtonGroup
:buttons="currentToolbarButtons"
:resolve-disabled="resolveButtonDisabled"
:resolve-loading="resolveButtonLoading"
:resolve-label="resolveButtonLabel"
:layout-key="toolbarLayoutKey"
@action="handleToolbarButtonClick"
/>
</div>
</div>
<!-- 上下分栏区域:详情面板启用时才显示分栏 + 详情 -->
<template v-if="PAGE_CONFIG.enableDetailPanel">
<div class="split-stack" ref="splitStackRef">
<!-- 上半:表格 -->
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
<UpperTable
ref="upperTableRef"
:title="currentTabConfig?.upperTable.title ?? '列表'"
default-align="center"
:enable-column-config="currentTabConfig?.upperTable.enableColumnConfig ?? true"
:column-config-schema-version="1"
:table-id="`template-table-${activeTabName}`"
:data="listData"
:row-key="'id'"
:columns="currentColumns"
table-size="small"
:pagination="pagination"
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
:loading="loading"
:query-time="queryTime"
@current-change="handleRowClick"
@row-click="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@sort-change="handleSortChange"
@selection-change="handleSelectionChange"
>
<!-- 动态列插槽:根据 columnSlots 配置自动渲染 -->
<template
v-for="(slotConfig, colProp) in currentColumnSlots"
:key="`columnSlots-${colProp}`"
#[`column-${colProp}`]="{ row }"
>
<!-- 操作列:渲染操作按钮 -->
<OperationCellRenderer
v-if="slotConfig.type === 'operation'"
:buttons="currentTabConfig?.operationButtons"
:row="row"
@operation-action="handleOperationAction"
/>
<!-- 其他列:标签/文本渲染 -->
<ColumnCellRenderer
v-else
:config="slotConfig"
:value="row[colProp]"
/>
</template>
<template #empty>
<div class="empty-tip">{{ currentTabConfig?.upperTable.emptyText ?? '暂无数据' }}</div>
</template>
</UpperTable>
</div>
<!-- 分隔条(可拖拽) -->
<template v-if="detailVisible">
<div
class="pane-resizer"
title="拖动调整列表与详情区域高度"
@mousedown="beginSplitDrag"
/>
<!-- 下半:明细面板 -->
<div v-if="selectedRow" class="lower-level" :style="lowerPaneStyle">
<div class="detail-header">
<el-tabs v-model="activeDetailTab" class="detail-tab">
<el-tab-pane
v-for="tab in currentDetailTabs"
:key="tab.name"
:label="tab.label"
:name="tab.name"
/>
</el-tabs>
</div>
<div class="detail-container">
<component
:is="activeDetailTabComponent"
:row="selectedDetail"
:detail-config="currentDetailConfig"
:api-method="currentDetailTabApiMethod"
/>
</div>
</div>
<!-- 未选中行时的占位 -->
<div v-else class="no-selection" :style="lowerPaneStyle">
<div class="empty-tip">
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</template>
</div>
</template>
<!-- 详情面板禁用:表格占满全高 -->
<template v-else>
<div class="upper-wrapper upper-wrapper--full">
<UpperTable
ref="upperTableRef"
:title="currentTabConfig?.upperTable.title ?? '列表'"
default-align="center"
:enable-column-config="currentTabConfig?.upperTable.enableColumnConfig ?? true"
:column-config-schema-version="1"
:table-id="`template-table-${activeTabName}`"
:data="listData"
:row-key="'id'"
:columns="currentColumns"
table-size="small"
:pagination="pagination"
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
:show-selection="currentTabConfig?.upperTable.showSelection ?? false"
:loading="loading"
:query-time="queryTime"
@current-change="handleRowClick"
@row-click="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadData"
@sort-change="handleSortChange"
@selection-change="handleSelectionChange"
>
<template
v-for="(slotConfig, colProp) in currentColumnSlots"
:key="`columnSlots-${colProp}`"
#[`column-${colProp}`]="{ row }"
>
<OperationCellRenderer
v-if="slotConfig.type === 'operation'"
:buttons="currentTabConfig?.operationButtons"
:row="row"
@operation-action="handleOperationAction"
/>
<ColumnCellRenderer
v-else
:config="slotConfig"
:value="row[colProp]"
/>
</template>
<template #empty>
<div class="empty-tip">{{ currentTabConfig?.upperTable.emptyText ?? '暂无数据' }}</div>
</template>
</UpperTable>
</div>
</template>
</div>
</transition>
</div>
</div>
</div>
<!-- ===== 编辑/设置录制弹窗 ===== -->
<el-dialog
v-model="dialogVisible"
:title="dialogTitle"
width="520px"
:close-on-click-modal="false"
destroy-on-close
align-center
>
<el-form label-width="120px" label-position="right" :disabled="submitting">
<template v-if="dialogMode === 'edit'">
<el-form-item label="电脑名称" required>
<el-input v-model="formData.name" placeholder="请输入电脑名称" clearable />
</el-form-item>
</template>
<template v-if="dialogMode === 'recording'">
<el-form-item label="录制大小" required>
<el-input v-model.number="formData.recording_size_value" placeholder="请输入数值" style="width: 160px" />
<el-select v-model="formData.recording_size_unit" placeholder="单位" style="width: 100px; margin-left: 8px">
<el-option label="KB" value="KB" />
<el-option label="MB" value="MB" />
<el-option label="GB" value="GB" />
<el-option label="TB" value="TB" />
</el-select>
</el-form-item>
<el-form-item label="远程播放地址" required>
<el-input v-model="formData.remote_play_url" placeholder="以 http:// 或 https:// 开头" />
</el-form-item>
<el-form-item label="录制目录" required>
<el-input v-model="formData.recording_directory" placeholder="如 D:/record" />
</el-form-item>
</template>
</el-form>
<template #footer>
<el-button @click="dialogVisible = false" :disabled="submitting">取消</el-button>
<el-button type="primary" :loading="submitting" @click="handleDialogSubmit">
{{ dialogMode === 'edit' ? '保存' : '设置录制' }}
</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
// ============================================================
// ★★★ 第一步:修改组件名 ★★★
// ============================================================
defineOptions({ name: 'PrintComputer' })
import { ref, computed, onMounted, reactive } from 'vue'
import { ElMessage, ElMessageBox, ElDialog, ElForm, ElFormItem, ElInput, ElSelect, ElOption, ElButton } from 'element-plus'
import { useSettingsStore } from '@/stores/modules/settings'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import TabArea from './components/TabArea.vue'
import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
import OperationCellRenderer from './components/OperationCellRenderer.vue'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import { update as printComputerUpdate, del as printComputerDel, setRecording as printComputerSetRecording, cancelRecording as printComputerCancelRecording } from '@/api/print_computer/print_computer'
import {
PAGE_CONFIG,
tabPages,
resolveTabConfig,
getTabToolbarButtons,
type TabPageConfig,
type DetailTabConfig,
type ToolbarButtonConfig,
} from './config/template-config'
// ============================================================
// 容器高度
// ============================================================
const settingsStore = useSettingsStore()
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() =>
shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
)
// ============================================================
// 标签页
// ============================================================
const tabList = computed(() =>
tabPages.map((t) => ({ name: t.name, label: t.label }))
)
const activeTabName = ref(tabPages[0]?.name ?? 'tab1')
/** 当前激活标签页的完整配置 */
const currentTabConfig = computed<TabPageConfig | undefined>(() => {
const raw = tabPages.find((t) => t.name === activeTabName.value)
if (!raw) return undefined
return resolveTabConfig(raw)
})
/** 当前 ScanBox 缓存 key */
const currentScanBoxCacheKey = computed(
() => currentTabConfig.value?.scanBoxCacheKey ?? 'template-default'
)
/** 当前 ScanBox 筛选字段 */
const currentScanBoxFields = computed(
() => currentTabConfig.value?.scanBoxFields ?? []
)
/** 当前表格列 */
const currentColumns = computed(
() => currentTabConfig.value?.upperTable.columns ?? []
)
/** 当前列插槽配置 */
const currentColumnSlots = computed(
() => currentTabConfig.value?.columnSlots ?? {}
)
/** 当前明细面板配置 */
const currentDetailConfig = computed(
() => currentTabConfig.value?.detailConfig ?? []
)
/** 当前明细标签页列表 */
const currentDetailTabs = computed<DetailTabConfig[]>(
() => currentTabConfig.value?.detailTabs ?? []
)
/** 当前激活的明细标签页组件 */
const activeDetailTabComponent = computed(() => {
const tab = currentDetailTabs.value.find(
(t) => t.name === activeDetailTab.value
)
return tab?.component ?? null
})
/** 当前激活明细标签页对应的 API 方法 */
const currentDetailTabApiMethod = computed(() => {
const cfg = currentTabConfig.value
if (!cfg?.api) return undefined
const tab = currentDetailTabs.value.find((t) => t.name === activeDetailTab.value)
if (!tab) return undefined
let componentCfg: unknown
switch (tab.componentKey) {
case 'DetailPanel':
componentCfg = cfg.api.detail
break
case 'LogPanel':
componentCfg = cfg.api.log
break
default:
return undefined
}
if (typeof componentCfg === 'function') {
return componentCfg
}
return undefined
})
// ============================================================
// 工具栏按钮系统
// ============================================================
/** 当前标签页的工具栏按钮列表 */
const currentToolbarButtons = computed<OrderToolbarButtonConfig[]>(() => {
const btns = getTabToolbarButtons(activeTabName.value)
return btns.map((btn: ToolbarButtonConfig) => ({
key: btn.key,
label: btn.label,
size: btn.size,
type: btn.type,
plain: btn.plain,
loadingKey: btn.loadingKey,
disabledKey: btn.disabledKey,
action: btn.action,
dynamicLabelKey: btn.dynamicLabelKey,
buttonType: btn.buttonType,
dropdownOptions: btn.dropdownOptions
}))
})
const buttonDisabledMap = computed<Record<string, boolean>>(() => ({
noSelection: selectedRows.value.length === 0
}))
const buttonLoadingMap = computed<Record<string, boolean>>(() => ({
loading: loading.value,
exportLoading: false
}))
const buttonLabelMap = computed<Record<string, string>>(() => ({
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
}))
const toolbarLayoutKey = computed(() =>
JSON.stringify({
loading: buttonLoadingMap.value,
disabled: buttonDisabledMap.value,
labels: buttonLabelMap.value
})
)
function resolveButtonLoading(loadingKey?: string) {
if (!loadingKey) return false
return Boolean(buttonLoadingMap.value[loadingKey])
}
function resolveButtonDisabled(disabledKey?: string) {
if (!disabledKey) return false
return Boolean(buttonDisabledMap.value[disabledKey])
}
function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) {
if (!dynamicLabelKey) return defaultLabel
return buttonLabelMap.value[dynamicLabelKey] || defaultLabel
}
// ============================================================
// 工具栏动作分发
// ============================================================
const okCode = (c: unknown) => c === 0 || c === 200 || c === 1
const toolbarActionMap: Record<string, () => void> = {
loadData: () => { void loadData() },
batchDelete: () => { void confirmBatchDelete() }
}
function handleToolbarButtonClick(action: string) {
const handler = toolbarActionMap[action]
if (handler) {
handler()
return
}
console.warn('[PrintComputer] 未处理的工具栏动作:', action)
}
// ============================================================
// 批量删除
// ============================================================
const confirmBatchDelete = async () => {
if (!selectedRows.value?.length) {
ElMessage.warning('请先选择要删除的打印电脑')
return
}
try {
await ElMessageBox.confirm(`确认删除选中的 ${selectedRows.value.length} 台打印电脑?`, '批量删除确认', { type: 'warning' })
let hasError = false
for (const row of selectedRows.value) {
if (row.id == null) continue
try {
const res: any = await printComputerDel({ id: row.id })
if (!res || !okCode(res.code)) hasError = true
} catch { hasError = true }
}
if (hasError) {
ElMessage.warning('部分删除失败,请刷新后检查')
} else {
ElMessage.success('批量删除成功')
}
selectedRows.value = []
await loadData()
} catch (e: any) {
if (e && e !== 'cancel') { console.error(e); ElMessage.error('批量删除失败') }
}
}
// ============================================================
// 操作列按钮事件处理
// ============================================================
const dialogVisible = ref(false)
const dialogMode = ref<'edit' | 'recording'>('edit')
const dialogTitle = computed(() => dialogMode.value === 'edit' ? '编辑打印电脑' : '设置录制电脑')
const currentEditRow = ref<Record<string, any> | null>(null)
const submitting = ref(false)
const formData = reactive({
name: '',
recording_size_value: undefined as number | undefined,
recording_size_unit: 'GB' as string,
remote_play_url: '',
recording_directory: ''
})
function resetForm() {
formData.name = ''
formData.recording_size_value = undefined
formData.recording_size_unit = 'GB'
formData.remote_play_url = ''
formData.recording_directory = ''
}
async function handleOperationAction(key: string, row: Record<string, any>) {
switch (key) {
case 'edit':
currentEditRow.value = row
dialogMode.value = 'edit'
formData.name = row.name || ''
dialogVisible.value = true
break
case 'setRecording':
currentEditRow.value = row
dialogMode.value = 'recording'
resetForm()
dialogVisible.value = true
break
case 'cancelRecording':
await handleCancelRecording(row)
break
case 'delete':
await handleDelete(row)
break
default:
console.warn('[PrintComputer] 未处理的操作按钮:', key)
}
}
async function handleDialogSubmit() {
const row = currentEditRow.value
if (!row || row.id == null) { ElMessage.error('数据异常'); return }
submitting.value = true
try {
let res: any
if (dialogMode.value === 'edit') {
res = await printComputerUpdate({ id: row.id, name: formData.name })
} else {
if (!formData.recording_size_value || !formData.recording_size_unit || !formData.remote_play_url || !formData.recording_directory) {
ElMessage.warning('请填写完整的录制参数')
submitting.value = false
return
}
res = await printComputerSetRecording({
id: row.id,
recording_size_value: formData.recording_size_value,
recording_size_unit: formData.recording_size_unit,
remote_play_url: formData.remote_play_url,
recording_directory: formData.recording_directory
})
}
if (res && okCode(res.code)) {
ElMessage.success(dialogMode.value === 'edit' ? '更新成功' : '设置录制成功')
dialogVisible.value = false
await loadData()
} else {
ElMessage.error((res && (res.msg || res.message)) || '操作失败')
}
} catch (e: any) {
console.error(e)
ElMessage.error(e?.message || '操作失败')
} finally {
submitting.value = false
}
}
async function handleCancelRecording(row: Record<string, any>) {
try {
await ElMessageBox.confirm(`确认取消电脑「${row.name || row.id}」的录制状态?`, '取消录制', { type: 'warning' })
const res: any = await printComputerCancelRecording({ id: row.id })
if (res && okCode(res.code)) {
ElMessage.success('已取消录制')
await loadData()
} else {
ElMessage.error((res && (res.msg || res.message)) || '操作失败')
}
} catch (e: any) {
if (e && e !== 'cancel') { console.error(e); ElMessage.error('操作失败') }
}
}
async function handleDelete(row: Record<string, any>) {
try {
await ElMessageBox.confirm(`确认删除电脑「${row.name || row.id}」?`, '删除确认', { type: 'warning' })
const res: any = await printComputerDel({ id: row.id })
if (res && okCode(res.code)) {
ElMessage.success('删除成功')
await loadData()
} else {
ElMessage.error((res && (res.msg || res.message)) || '删除失败')
}
} catch (e: any) {
if (e && e !== 'cancel') { console.error(e); ElMessage.error('删除失败') }
}
}
// ============================================================
// ★★★ 第二步:接入真实接口 ★★★
// ============================================================
const listData = ref<Record<string, any>[]>([])
const loading = ref(false)
const queryTime = ref(0)
const pagination = reactive({
currentPage: 1,
pageSize: 20,
total: 0
})
const currentSort = reactive({ prop: '', order: '' })
const loadData = async () => {
const cfg = currentTabConfig.value
if (!cfg) return
loading.value = true
const startTime = performance.now()
try {
if (cfg.api) {
// 使用真实接口
const conditions = scanBoxRef.value?.getConditions?.() || {}
const params = cfg.api.buildListParams
? cfg.api.buildListParams({
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
conditions,
sort: currentSort.prop ? { prop: currentSort.prop, order: currentSort.order } : undefined
})
: {
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
where: conditions
}
const res = await cfg.api.list(params)
if (res && [0, 1, 200].includes(res.code)) {
const parsed = cfg.api.parseListResponse
? cfg.api.parseListResponse(res)
: { list: res.data?.list ?? res.list ?? [], total: res.data?.pagination?.total ?? res.total ?? 0 }
listData.value = parsed.list
pagination.total = parsed.total
} else {
throw new Error(res?.message || '接口返回异常')
}
} else {
console.warn('[PrintComputer] 未配置 API,列表为空')
listData.value = []
pagination.total = 0
}
} catch (e: any) {
console.error('[PrintComputer] 加载列表失败:', e)
ElMessage.error(e?.message || '获取列表数据失败')
listData.value = []
pagination.total = 0
} finally {
loading.value = false
queryTime.value = Math.round(performance.now() - startTime)
}
}
// ============================================================
// ScanBox 筛选事件
// ============================================================
const scanBoxRef = ref<any>(null)
const presetTree = ref<any[]>([])
const handleConditionChange = () => {
pagination.currentPage = 1
loadData()
}
const handleConditionReset = () => {
pagination.currentPage = 1
loadData()
}
const handleConditionClear = () => {
pagination.currentPage = 1
loadData()
}
// ============================================================
// UpperTable 事件
// ============================================================
const upperTableRef = ref<any>(null)
const selectedRows = ref<Record<string, any>[]>([])
const handleSortChange = ({ prop, order }: any) => {
currentSort.prop = prop
currentSort.order = order
pagination.currentPage = 1
loadData()
}
const handlePageChange = (page: number) => {
pagination.currentPage = page
loadData()
}
const handlePageSizeChange = (size: number) => {
pagination.pageSize = size
pagination.currentPage = 1
loadData()
}
const handleSelectionChange = (rows: Record<string, any>[]) => {
selectedRows.value = rows
}
// ============================================================
// 明细面板
// ============================================================
const detailVisible = ref(PAGE_CONFIG.enableDetailPanel)
const selectedRow = ref<Record<string, any> | null>(null)
const selectedDetail = ref<Record<string, any> | null>(null)
const activeDetailTab = ref('detail')
const handleRowClick = async (row: Record<string, any>) => {
if (!PAGE_CONFIG.enableDetailPanel) return
const cfg = currentTabConfig.value
if (!cfg) return
selectedRow.value = row
// 根据 DetailPanel 的 api 配置决定数据来源
const detailCfg = cfg.api?.detail
if (typeof detailCfg === 'function') {
try {
const detailRes = await detailCfg({ id: row.id, code: row.code })
if (detailRes && (detailRes.code === 1 || detailRes.code === 200)) {
selectedDetail.value = detailRes.data ?? detailRes
} else {
selectedDetail.value = { ...row }
}
} catch {
selectedDetail.value = { ...row }
}
} else {
// source='list' 或未配置:直接用行数据
selectedDetail.value = { ...row }
}
}
// ============================================================
// 标签页切换
// ============================================================
const handleTabChange = (tabName: string) => {
if (activeTabName.value === tabName) return
activeTabName.value = tabName
pagination.currentPage = 1
currentSort.prop = ''
currentSort.order = ''
selectedRow.value = null
selectedDetail.value = null
selectedRows.value = []
activeDetailTab.value = 'detail'
loadData()
}
// ============================================================
// 分栏拖拽
// ============================================================
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } =
useVerticalSplitPane({ defaultLowerPercent: 38 })
const upperPaneFullStyle = computed(() => ({
flex: '1 1 auto',
minHeight: '0',
overflow: 'hidden' as const
}))
// ============================================================
// 初始化
// ============================================================
onMounted(() => {
loadData()
})
</script>
<style lang="scss" scoped>
/* ================================================================
整体布局
================================================================ */
.page-wrapper {
position: relative;
width: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* ================================================================
1. 顶部多标签页
================================================================ */
.tab-section {
flex-shrink: 0;
background: #fff;
border: 1px solid #e8eef7;
border-bottom: none;
border-radius: 6px 6px 0 0;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
overflow: hidden;
}
/* ================================================================
2. 主内容区
================================================================ */
.main-container {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
background: #fff;
border: 1px solid #e8eef7;
border-radius: 0 0 6px 6px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
overflow: hidden;
}
.order-sub-container {
display: flex;
height: 100%;
width: 100%;
background-color: #f0f2f5;
:deep(.scan-box-container) {
flex: 0 0 250px;
flex-shrink: 0;
height: 100%;
}
}
.main-content {
flex: 1;
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
min-width: 0;
}
.tab-content-inner {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
}
/* ================================================================
3. 工具栏
================================================================ */
.toolbar {
margin-bottom: 3px;
padding: 6px 10px;
border: 1px solid #ebeef5;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
min-width: 0;
overflow: hidden;
.toolbar-left {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 10px;
overflow: hidden;
}
.toolbar-right {
flex: 0 0 auto;
margin-left: 10px;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 10px;
}
}
/* ================================================================
4. 分栏区域
================================================================ */
.split-stack {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
overflow: hidden;
:deep(.el-card__header) {
padding: 2px 12px;
font-size: 13px;
}
}
.upper-wrapper {
flex: 1 1 62%;
min-height: 0;
overflow: hidden;
}
/* 详情面板禁用时,表格占满全高 */
.upper-wrapper--full {
flex: 1 1 auto;
min-height: 0;
overflow: hidden;
}
.pane-resizer {
flex-shrink: 0;
height: 5px;
cursor: row-resize;
background-color: #f0f2f5;
border-top: 1px solid #ebeef5;
border-bottom: 1px solid #ebeef5;
transition: background-color 0.2s;
user-select: none;
&:hover {
background-color: #d3d9e3;
}
}
.lower-level {
flex: 1 1 38%;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
:deep(.el-card) {
height: 100%;
display: flex;
flex-direction: column;
}
}
.no-selection {
flex: 1 1 38%;
min-height: 0;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #ebeef5;
border-radius: 4px;
.empty-tip p {
font-size: 14px;
color: #909399;
}
}
/* ================================================================
5. 明细面板
================================================================ */
.detail-header {
flex-shrink: 0;
border-bottom: 1px solid #e8eef7;
background: #fff;
padding: 0 12px;
.detail-tab {
:deep(.el-tabs__header) {
margin-bottom: 0;
}
:deep(.el-tabs__nav-wrap::after) {
height: 1px;
}
}
}
.detail-container {
flex: 1;
overflow: auto;
padding: 12px;
background: #fff;
}
/* ================================================================
6. 过渡动画
================================================================ */
.tab-fade-enter-active,
.tab-fade-leave-active {
transition: opacity 0.2s ease;
opacity: 1;
}
.tab-fade-enter-from,
.tab-fade-leave-to {
opacity: 0;
}
/* ================================================================
7. 空状态
================================================================ */
.empty-tip {
font-size: 13px;
color: #909399;
}
</style>