760 lines
23 KiB
Vue
760 lines
23 KiB
Vue
<template>
|
||
<div class="printer-management-container">
|
||
<ScanBox width="300px" ref="scanBox" :preset-tree="presetTree" :available-fields="availableFields" />
|
||
|
||
<div class="main-content">
|
||
<!-- 工具栏 -->
|
||
<div class="toolbar">
|
||
<div class="toolbar-left">
|
||
<el-button type="primary" size="small" :icon="Refresh" @click="handleRefresh" title="刷新" :loading="loading">
|
||
刷新
|
||
</el-button>
|
||
|
||
<template v-if="hasPermission('stock.saveWarehouseStock')">
|
||
<el-button type="primary" size="small" :icon="Plus" @click="handleAdd" title="添加商品">
|
||
添加
|
||
</el-button>
|
||
|
||
<el-button type="danger" size="small" :icon="Delete" @click="confirmBatchDelete" title="批量删除"
|
||
:disabled="!hasSelection">
|
||
批量删除
|
||
</el-button>
|
||
|
||
<!-- <el-dropdown v-if="hasPermission('stock.saveWarehouseStock')" @command="handleBatchChange">
|
||
<el-button type="primary" :disabled="!hasSelection" size="small">
|
||
<el-icon>
|
||
<Edit />
|
||
</el-icon>
|
||
批量修改<el-icon class="el-icon--right">
|
||
<ArrowDown />
|
||
</el-icon>
|
||
</el-button>
|
||
<template #dropdown>
|
||
<el-dropdown-menu>
|
||
<el-dropdown-item command="stock_unit">库存单位</el-dropdown-item>
|
||
<el-dropdown-item command="brand_name">品牌</el-dropdown-item>
|
||
<el-dropdown-item command="prohibited_id">违禁品类型</el-dropdown-item>
|
||
<el-dropdown-item command="gross_weight">毛重</el-dropdown-item>
|
||
<el-dropdown-item command="packing_requirements">打包要求</el-dropdown-item>
|
||
<el-dropdown-item command="managementFlags">管理标识</el-dropdown-item>
|
||
</el-dropdown-menu>
|
||
</template>
|
||
</el-dropdown> -->
|
||
</template>
|
||
|
||
<el-button v-if="hasPermission('warehouseExport')" type="success" size="small" :icon="Download"
|
||
@click="handleExport" title="导出" :loading="loading">
|
||
导出
|
||
</el-button>
|
||
</div>
|
||
|
||
<div class="toolbar-right">
|
||
|
||
</div>
|
||
</div>
|
||
<div class="upper-wrapper">
|
||
<upper-table ref="accountTableRef" title="打印台列表" :data="list" :columns="accountColumns" :table-size="tableSize"
|
||
:pagination="pagination" :show-index="true" :show-actions="true" :show-selection="showSelection"
|
||
:loading="loading" :queryTime="queryTime" @current-change="handleRowClick" @page-change="handlePageChange"
|
||
@page-size-change="handlePageSizeChange" @refresh="handleRefresh" @selection-change="selectionChange">
|
||
<!-- 自定义状态列 -->
|
||
<template #column-status="{ row }">
|
||
<el-tag :type="row.status === 'enabled' ? 'success' : 'danger'" size="small">
|
||
{{ row.status === 'enabled' ? '启用' : '禁用' }}
|
||
</el-tag>
|
||
</template>
|
||
|
||
<!-- 自定义列模板 -->
|
||
<template #column-is_online="{ row }">
|
||
<el-tag :type="row.is_online === 1 ? 'success' : 'danger'" size="small">
|
||
{{ row.is_online === 1 ? '在线' : '离线' }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-components_douyin="{ row }">
|
||
<el-tag :type="row.components_douyin === 1 ? 'success' : 'danger'" size="small">
|
||
{{ row.components_douyin === 1 ? '在线' : '离线' }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-components_pinduoduo="{ row }">
|
||
<el-tag :type="row.components_pinduoduo === 1 ? 'success' : 'danger'" size="small">
|
||
{{ row.components_pinduoduo === 1 ? '在线' : '离线' }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-components_kuaishou="{ row }">
|
||
<el-tag :type="row.components_kuaishou === 1 ? 'success' : 'danger'" size="small">
|
||
{{ row.components_kuaishou === 1 ? '在线' : '离线' }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-components_jd="{ row }">
|
||
<el-tag :type="row.components_jd === 1 ? 'success' : 'danger'" size="small">
|
||
{{ row.components_jd === 1 ? '在线' : '离线' }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-components_cainiao="{ row }">
|
||
<el-tag :type="row.components_cainiao === 1 ? 'success' : 'danger'" size="small">
|
||
{{ row.components_cainiao === 1 ? '在线' : '离线' }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-components_shipinhao="{ row }">
|
||
<el-tag :type="row.components_shipinhao === 1 ? 'success' : 'danger'" size="small">
|
||
{{ row.components_shipinhao === 1 ? '在线' : '离线' }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-components_xiaohongshu="{ row }">
|
||
<el-tag :type="row.components_xiaohongshu === 1 ? 'success' : 'danger'" size="small">
|
||
{{ row.components_xiaohongshu === 1 ? '在线' : '离线' }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-components_lodop="{ row }">
|
||
<el-tag :type="row.components_lodop === 1 ? 'success' : 'danger'" size="small">
|
||
{{ row.components_lodop === 1 ? '在线' : '离线' }}
|
||
</el-tag>
|
||
</template>
|
||
|
||
<template #column-is_sn_mgmt="{ row }">
|
||
<el-tag :type="row.is_sn_mgmt === 'Y' ? 'success' : 'info'" size="small">
|
||
{{ row.is_sn_mgmt === 'Y' ? '是' : '否' }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-is_shelf_life_mgmt="{ row }">
|
||
<el-tag :type="row.is_shelf_life_mgmt === 'Y' ? 'success' : 'info'" size="small">
|
||
{{ row.is_shelf_life_mgmt === 'Y' ? '是' : '否' }}
|
||
</el-tag>
|
||
</template>
|
||
<template #column-is_batch_mgmt="{ row }">
|
||
<el-tag :type="row.is_batch_mgmt === 'Y' ? 'success' : 'info'" size="small">
|
||
{{ row.is_batch_mgmt === 'Y' ? '是' : '否' }}
|
||
</el-tag>
|
||
</template>
|
||
|
||
<template #empty>
|
||
<div class="custom-empty">
|
||
<el-icon>
|
||
<User />
|
||
</el-icon>
|
||
<p>暂无打印台数据</p>
|
||
</div>
|
||
</template>
|
||
</upper-table>
|
||
</div>
|
||
|
||
<!-- 下层详情区域 -->
|
||
<div class="lower-level" v-if="currentStationId" :class="tableSize">
|
||
<div class="detail-header">
|
||
<el-tabs v-model="activeTab" class="detail-tab">
|
||
<el-tab-pane label="属性" name="info" />
|
||
<!-- <el-tab-pane label="打印电脑" name="computer" />
|
||
<el-tab-pane label="快递公司" name="express" />
|
||
<el-tab-pane label="组件" name="components" /> -->
|
||
</el-tabs>
|
||
</div>
|
||
|
||
<div class="detail-container">
|
||
<KeepAlive>
|
||
<component :is="activeComponent" :id="currentStationId" :name="currentStationName" @refresh="handleRefresh"
|
||
@updated="handleItemUpdated" />
|
||
</KeepAlive>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="no-selection" v-else>
|
||
<div class="empty-tip">
|
||
<p>请从上方列表中选择一项查看详情</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 抽屉:添加(复用 stock 的 Add 组件) -->
|
||
<el-drawer v-model="drawer" :with-header="false" direction="rtl" size="800px">
|
||
<Add v-if="drawer" @saved="handleSaved" />
|
||
</el-drawer>
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { ref, defineAsyncComponent, computed, onMounted, markRaw } from 'vue'
|
||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||
import ScanBox from '@/components/ScanBox/index.vue'
|
||
import UpperTable from '@/components/UpperTable/index.vue'
|
||
import Info from './components/info.vue'
|
||
import PrintComputer from './components/printComputer.vue'
|
||
import ExpressCompany from './components/expressCompany.vue'
|
||
import ComponentList from './components/Printer.vue'
|
||
import Add from './components/add.vue'
|
||
|
||
import * as stationApi from '@/api/print/station'
|
||
import * as indexApi from '@/api/index'
|
||
|
||
import { useUserStore } from '@/stores/modules/user'
|
||
import { Delete, Download, Plus, Refresh } from '@element-plus/icons-vue'
|
||
|
||
const userStore = useUserStore()
|
||
|
||
|
||
// scanbox使用
|
||
const presetTree = ref<Array<{
|
||
label: string;
|
||
id: string | number;
|
||
custom_barcode?: string;
|
||
is_online?: number;
|
||
children?: Array<{ label: string; is_online: number }>;
|
||
}>>([])
|
||
|
||
const availableFields = ref([
|
||
{
|
||
label: '在线状态',
|
||
value: 'status',
|
||
type: 'select',
|
||
options: [
|
||
{ label: '在线', value: 'online' },
|
||
{ label: '离线', value: 'offline' },
|
||
{ label: '异常', value: 'error' }
|
||
]
|
||
},
|
||
{
|
||
label: '绑定状态',
|
||
value: 'bindingStatus',
|
||
type: 'select',
|
||
options: [
|
||
{ label: '已绑定', value: 'bound' },
|
||
{ label: '未绑定', value: 'unbound' }
|
||
]
|
||
},
|
||
// {
|
||
// label: '字段1',
|
||
// value: 'field1',
|
||
// type: 'text'
|
||
// },
|
||
])
|
||
|
||
|
||
// 用户鉴权菜单
|
||
const hasPermission = (perm: string) => {
|
||
return userStore.checkPermission(perm)
|
||
}
|
||
|
||
|
||
// 底部组件
|
||
const activeTab = ref('info')
|
||
const currentStationId = ref<string | number | null>(null)
|
||
|
||
const activeComponent = computed(() => {
|
||
if (activeTab.value === 'info') {
|
||
return markRaw(Info)
|
||
}
|
||
// if (activeTab.value === 'computer') {
|
||
// return markRaw(PrintComputer)
|
||
// }
|
||
// if (activeTab.value === 'express') {
|
||
// return markRaw(ExpressCompany)
|
||
// }
|
||
// if (activeTab.value === 'components') {
|
||
// return markRaw(ComponentList)
|
||
// }
|
||
return null
|
||
})
|
||
|
||
// 选中打印台
|
||
const currentStationName = ref<string>('')
|
||
|
||
|
||
// table
|
||
const handleRowClick = (row: any) => {
|
||
if (row && row.id) {
|
||
currentStationId.value = row.id
|
||
currentStationName.value = row.name || ''
|
||
}
|
||
}
|
||
|
||
const handlePageChange = (page: number) => {
|
||
pagination.value.currentPage = page
|
||
getList()
|
||
}
|
||
|
||
const handlePageSizeChange = (size: number) => {
|
||
pagination.value.pageSize = size
|
||
getList()
|
||
}
|
||
|
||
// 表格使用
|
||
const selectedRows = ref<any[]>([])
|
||
const selectionChange = (selection: any[]) => {
|
||
hasSelection.value = selection.length > 0
|
||
selectedRows.value = selection
|
||
}
|
||
const accountColumns = ref([
|
||
{
|
||
prop: 'name',
|
||
label: '打印台名称',
|
||
fixed: 'left',
|
||
minWidth: '150',
|
||
showOverflowTooltip: true,
|
||
sortable: true
|
||
},
|
||
{
|
||
prop: 'creator_name',
|
||
label: '创建人',
|
||
minWidth: '100',
|
||
showOverflowTooltip: true,
|
||
sortable: true
|
||
},
|
||
{
|
||
prop: 'is_online',
|
||
label: '在线状态',
|
||
minWidth: '100',
|
||
showOverflowTooltip: true,
|
||
sortable: true
|
||
},
|
||
{
|
||
prop: 'components_douyin',
|
||
label: '抖音',
|
||
minWidth: '100',
|
||
showOverflowTooltip: true,
|
||
},
|
||
{
|
||
prop: 'components_pinduoduo',
|
||
label: '拼多多',
|
||
minWidth: '100',
|
||
showOverflowTooltip: true,
|
||
},
|
||
{
|
||
prop: 'components_kuaishou',
|
||
label: '快手',
|
||
minWidth: '100',
|
||
showOverflowTooltip: true,
|
||
},
|
||
{
|
||
prop: 'components_jd',
|
||
label: '京东',
|
||
minWidth: '100',
|
||
showOverflowTooltip: true,
|
||
},
|
||
{
|
||
prop: 'components_cainiao',
|
||
label: '菜鸟',
|
||
minWidth: '100',
|
||
showOverflowTooltip: true,
|
||
},
|
||
{
|
||
prop: 'components_shipinhao',
|
||
label: '视频号',
|
||
minWidth: '100',
|
||
showOverflowTooltip: true,
|
||
},
|
||
{
|
||
prop: 'components_xiaohongshu',
|
||
label: '小红书',
|
||
minWidth: '100',
|
||
showOverflowTooltip: true,
|
||
},
|
||
{
|
||
prop: 'components_lodop',
|
||
label: 'LODOP',
|
||
minWidth: '100',
|
||
showOverflowTooltip: true,
|
||
},
|
||
{
|
||
prop: '',
|
||
},
|
||
]);
|
||
|
||
// handlers
|
||
const drawer = ref(false)
|
||
const handleAdd = () => { drawer.value = true }
|
||
const handleSaved = () => { drawer.value = false; getList() }
|
||
const handleBatchChange = (command: string) => { }
|
||
const handleExport = () => { }
|
||
|
||
|
||
// 保存后端数组
|
||
const list = ref<any[]>([])
|
||
|
||
// 更新回调
|
||
const handleItemUpdated = (updated: any) => {
|
||
const idx = list.value.findIndex((i: any) => String(i.id) === String(updated.id))
|
||
if (idx !== -1) {
|
||
// merge edited fields
|
||
list.value[idx] = { ...list.value[idx], ...updated }
|
||
}
|
||
// update presetTree entry too, so scan box reflects changes
|
||
const treeItem: any = presetTree.value.find((i: any) => String(i.id) === String(updated.id))
|
||
if (treeItem) {
|
||
Object.assign(treeItem, {
|
||
label: updated.name || treeItem.label,
|
||
...updated
|
||
})
|
||
}
|
||
}
|
||
|
||
|
||
const tableSize = ref('default')
|
||
const pagination = ref({
|
||
currentPage: 1,
|
||
pageSize: 10,
|
||
total: 0
|
||
})
|
||
const loading = ref(false)
|
||
const queryTime = ref(0)
|
||
const hasSelection = ref(false)
|
||
const showSelection = ref(true)
|
||
|
||
|
||
// api功能
|
||
const getList = async () => {
|
||
loading.value = true
|
||
try {
|
||
const payload = {
|
||
page: pagination.value.currentPage || 1,
|
||
pageSize: pagination.value.pageSize || 10,
|
||
where: {}
|
||
}
|
||
|
||
const response: any = await stationApi.getList(payload)
|
||
|
||
// 支持后端返回 code 为 200 或 0 的情况
|
||
if (response && (response.code === 200 || response.code === 0)) {
|
||
const data = response.data || {}
|
||
const rawList: any[] = data.list || []
|
||
|
||
const nameMap: Record<string, string> = {
|
||
'抖音': 'components_douyin',
|
||
'拼多多': 'components_pinduoduo',
|
||
'快手': 'components_kuaishou',
|
||
'京东': 'components_jd',
|
||
'菜鸟': 'components_cainiao',
|
||
'视频号': 'components_shipinhao',
|
||
'小红书': 'components_xiaohongshu',
|
||
'LODOP': 'components_lodop'
|
||
}
|
||
|
||
list.value = rawList.map((item: { components?: { name: string; is_online: number }[] }) => {
|
||
const flatItem: any = { ...item }
|
||
if (item.components) {
|
||
item.components.forEach((comp: { name: string; is_online: number }) => {
|
||
const key = nameMap[comp.name]
|
||
if (key) {
|
||
flatItem[key] = comp.is_online
|
||
}
|
||
})
|
||
}
|
||
return flatItem
|
||
})
|
||
|
||
// 转换为 presetTree 格式
|
||
presetTree.value = rawList.map((item: { name: string; id: string; custom_barcode: string; is_online: number; components?: { name: string; is_online: number }[] }) => ({
|
||
label: item.name,
|
||
id: item.id,
|
||
custom_barcode: item.custom_barcode,
|
||
is_online: item.is_online,
|
||
children: item.components ? item.components.map(comp => ({
|
||
label: comp.name,
|
||
is_online: comp.is_online
|
||
})) : []
|
||
}))
|
||
|
||
// 更新分页总数,兼容不同后端字段名
|
||
pagination.value.total = data.pagination?.total ?? data.total ?? data.count ?? (Array.isArray(rawList) ? rawList.length : 0)
|
||
}
|
||
|
||
console.log('请求结果', response)
|
||
} catch (error) {
|
||
console.error('Failed to fetch preset tree:', error)
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
const handleRefresh = () => {
|
||
getList()
|
||
}
|
||
const confirmBatchDelete = async () => {
|
||
if (!selectedRows.value || selectedRows.value.length === 0) {
|
||
ElMessage.warning('请先选择要删除的打印台')
|
||
return
|
||
}
|
||
|
||
try {
|
||
await ElMessageBox.confirm('确认删除选中打印台?', '删除确认', { type: 'warning' })
|
||
const ids = selectedRows.value.map((r: any) => String(r.id))
|
||
const res: any = await stationApi.delItems(ids)
|
||
if (res && res.code === 0) {
|
||
ElMessage.success('删除成功')
|
||
await getList()
|
||
// 如果当前详情被删除,清空
|
||
if (currentStationId.value && ids.includes(String(currentStationId.value))) {
|
||
currentStationId.value = null
|
||
}
|
||
selectedRows.value = []
|
||
hasSelection.value = false
|
||
} else {
|
||
ElMessage.error((res && (res.msg || res.message)) || '删除失败')
|
||
}
|
||
} catch (e: any) {
|
||
// 取消时 MessageBox 会抛出,忽略取消动作
|
||
if (e && e !== 'cancel') {
|
||
console.error(e)
|
||
ElMessage.error('删除失败')
|
||
}
|
||
}
|
||
}
|
||
const getComputer = async () => {
|
||
loading.value = true
|
||
try {
|
||
const response: any = await stationApi.getComputer()
|
||
if (response && response.code === 0) {
|
||
console.log('所有可用打印电脑:', response.data)
|
||
} else {
|
||
console.warn('获取所有打印电脑返回非 0 状态:', response)
|
||
}
|
||
} catch (error) {
|
||
console.error('Failed to fetch computer :', error)
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
const getExpressList = async () => {
|
||
loading.value = true
|
||
try {
|
||
const response: any = await stationApi.getExpressList()
|
||
if (response && response.code === 0) {
|
||
console.log('快递公司列表:', response.data)
|
||
} else {
|
||
console.warn('获取快递公司列表返回非 0 状态:', response)
|
||
}
|
||
} catch (error) {
|
||
console.error('Failed to fetch express list :', error)
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
const getComputerPrinter = async (stationId?: string | number) => {
|
||
const id = stationId ?? currentStationId.value
|
||
loading.value = true
|
||
try {
|
||
if (id) {
|
||
const response: any = await stationApi.getComputerPrinter(String(id))
|
||
if (response && response.code === 0) {
|
||
console.log('打印机列表:', response.data)
|
||
}
|
||
} else {
|
||
// 无 id 时请求所有可用打印电脑(print.getComputer)
|
||
const response: any = await stationApi.getComputer()
|
||
if (response && response.code === 0) {
|
||
console.log('所有可用打印机:', response.data)
|
||
} else {
|
||
console.warn('获取所有打印机返回非 0 状态:', response)
|
||
}
|
||
}
|
||
} catch (error) {
|
||
console.error('Failed to fetch computer printer :', error)
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
const getComputerPrinters = async ( id?: string | number) => {
|
||
loading.value = true
|
||
try {
|
||
const compsResp: any = await stationApi.getComputer()
|
||
if (compsResp && compsResp.code === 0) {
|
||
const comps: any[] = compsResp.data || []
|
||
for (const comp of comps) {
|
||
if (!comp || !comp.id) continue
|
||
try {
|
||
const resp: any = await stationApi.getComputerPrinter(String(comp.id))
|
||
if (resp && resp.code === 0) {
|
||
console.log(`打印电脑 ${comp.name || comp.id} 上的打印机:`, resp.data)
|
||
} else {
|
||
console.warn(`获取打印机返回非 0 状态,电脑 ${comp.id}:`, resp)
|
||
}
|
||
} catch (err) {
|
||
console.error(`Failed to fetch printers for computer ${comp.id}:`, err)
|
||
}
|
||
}
|
||
} else {
|
||
console.warn('获取打印电脑列表失败:', compsResp)
|
||
}
|
||
} catch (error) {
|
||
console.error('Failed to fetch computer printers:', error)
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
const hashName = async (name: string, id?: string | number) => {
|
||
try {
|
||
const payload: any = { name }
|
||
if (id !== undefined && id !== null) payload.id = id
|
||
const res: any = await stationApi.hasName(payload)
|
||
console.log('print.hasName 返回:', res)
|
||
return res
|
||
} catch (e) {
|
||
console.error('Failed to check name uniqueness', e)
|
||
return null
|
||
}
|
||
}
|
||
const savePrinters = async () => {
|
||
|
||
// 构造模拟请求参数:默认打印机名带上站点 id,以及示例 express 绑定数组
|
||
const payload: any = {
|
||
default: '1',
|
||
express: [
|
||
{ express_id: '1', name: 'Printer-A' },
|
||
{ express_id: '2', name: 'Printer-B' }
|
||
]
|
||
}
|
||
|
||
try {
|
||
// 模拟异步后端请求(500ms 延迟)并返回模拟结果
|
||
const res: any = await new Promise((resolve) => {
|
||
setTimeout(() => {
|
||
resolve({
|
||
code: 0,
|
||
data: {
|
||
message: '模拟保存成功',
|
||
savedPayload: payload
|
||
}
|
||
})
|
||
}, 500)
|
||
})
|
||
|
||
// 在控制台打印后端(模拟)返回结果,便于调试
|
||
console.log('模拟后端返回:', res)
|
||
|
||
if (res && res.code === 0) {
|
||
ElMessage.success(res.data?.message || '保存成功')
|
||
// 可选:此处可以触发详情刷新或其他后续操作
|
||
} else {
|
||
ElMessage.error((res && (res.msg || res.message)) || '保存失败')
|
||
}
|
||
} catch (e) {
|
||
console.error('模拟保存失败:', e)
|
||
ElMessage.error('保存失败')
|
||
}
|
||
}
|
||
|
||
onMounted(async () => {
|
||
|
||
try {
|
||
|
||
const fastRes = await indexApi.fastWhereTree('stock')
|
||
if (fastRes && fastRes.data && fastRes.data.presetTree) {
|
||
presetTree.value = fastRes.data.presetTree
|
||
} else if (fastRes && (fastRes as any).presetTree) {
|
||
// Handle case where interceptor returns data directly
|
||
presetTree.value = (fastRes as any).presetTree
|
||
}
|
||
} catch (e) {
|
||
console.error(e)
|
||
}
|
||
await getList();
|
||
|
||
// savePrinters();
|
||
// getComputerPrinters();
|
||
// getExpressList();
|
||
// try {
|
||
// if (list.value && list.value.length > 0) {
|
||
// const sample = list.value[0]
|
||
// await hashName(sample.name, sample.id)
|
||
// } else {
|
||
// await hashName('测试打印台', currentStationId.value ? String(currentStationId.value) : undefined)
|
||
// }
|
||
// } catch (e) {
|
||
// console.error('hashName 调用异常', e)
|
||
// }
|
||
|
||
// getComputer();
|
||
// getComputerPrinter();
|
||
// getExpressList();
|
||
// getComputerPrinters('1');
|
||
// hashName()
|
||
})
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.printer-management-container {
|
||
display: flex;
|
||
height: calc(100vh - 130px);
|
||
width: 100%;
|
||
background-color: #f0f2f5;
|
||
|
||
.main-content {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
padding: 10px;
|
||
overflow: hidden;
|
||
|
||
.toolbar {
|
||
padding: 10px;
|
||
border-bottom: 1px solid #ebeef5;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
background-color: #fff;
|
||
}
|
||
|
||
.upper-wrapper {
|
||
flex: 1;
|
||
min-height: 0;
|
||
/* 不允许 upper-wrapper 自身滚动,保证页面布局不随数据滚动 */
|
||
overflow: hidden;
|
||
}
|
||
|
||
/* 在 receiving 页面内覆盖 UpperTable,使表格容器填满可用高度,表体滚动,表头与分页固定 */
|
||
.upper-wrapper :deep(.upper-table-container) {
|
||
height: 100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.upper-wrapper :deep(.upper-table-container) :deep(.table-container) {
|
||
/* 取消 UpperTable 的固定像素高度,改为弹性填充 */
|
||
height: auto !important;
|
||
flex: 1 1 auto;
|
||
min-height: 0;
|
||
overflow: hidden;
|
||
/* 交由 el-table__body-wrapper 控制滚动 */
|
||
}
|
||
|
||
/* 表格 body 使用自身滚动条 */
|
||
.upper-wrapper :deep(.el-table__body-wrapper) {
|
||
overflow: auto;
|
||
min-height: 0;
|
||
}
|
||
|
||
.lower-level {
|
||
background-color: #fff;
|
||
margin-top: 10px;
|
||
flex: 0 0 300px;
|
||
/* 固定高度/基础高度 */
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
|
||
&.small {
|
||
flex: 0 0 250px;
|
||
}
|
||
|
||
.detail-header {
|
||
padding: 0 20px;
|
||
border-bottom: 1px solid #ebeef5;
|
||
}
|
||
|
||
.detail-container {
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
min-height: 0;
|
||
}
|
||
}
|
||
|
||
.no-selection {
|
||
margin-top: 10px;
|
||
background-color: #fff;
|
||
flex: 0 0 300px;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
color: #909399;
|
||
}
|
||
}
|
||
}
|
||
</style> |