Merge branch 'main' of http://192.168.9.101:4000/liufumingren/WEB
This commit is contained in:
commit
6f8e1c9ca9
@ -356,6 +356,123 @@ export interface AfterSaleBatchCloseFailedItem {
|
|||||||
reason: string
|
reason: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 售后类型/子类型列表分页信息(含 hasPrevious/hasNext) */
|
||||||
|
export interface AfterSaleMetaPagination {
|
||||||
|
page: number
|
||||||
|
pageSize: number
|
||||||
|
total: number
|
||||||
|
totalPages: number
|
||||||
|
hasPrevious?: boolean
|
||||||
|
hasNext?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 售后类型:系统级 warehouse_id=null、is_system=1;仓库自定义 is_system=0 */
|
||||||
|
export interface AfterSaleTypeItem {
|
||||||
|
id: number
|
||||||
|
warehouse_id: number | null
|
||||||
|
type: string
|
||||||
|
name: string
|
||||||
|
is_system: 0 | 1
|
||||||
|
is_enabled: 0 | 1
|
||||||
|
sort_order: number
|
||||||
|
created_at?: string
|
||||||
|
updated_at?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 售后子类型:系统级 warehouse_id=null、is_system=1;仓库自定义 is_system=0 */
|
||||||
|
export interface AfterSaleSubTypeItem {
|
||||||
|
id: number
|
||||||
|
warehouse_id: number | null
|
||||||
|
type: string
|
||||||
|
sub_type: string
|
||||||
|
name: string
|
||||||
|
is_system: 0 | 1
|
||||||
|
is_enabled: 0 | 1
|
||||||
|
sort_order: number
|
||||||
|
created_at?: string
|
||||||
|
updated_at?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 售后子类型按 type 分组项(subTypeList 传 group=true 时返回) */
|
||||||
|
export interface AfterSaleSubTypeGroup {
|
||||||
|
type: string
|
||||||
|
name: string
|
||||||
|
items: AfterSaleSubTypeItem[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 售后类型/子类型列表查询参数 */
|
||||||
|
export interface AfterSaleMetaListParams {
|
||||||
|
pagination?: { page?: number; pageSize?: number }
|
||||||
|
where?: Record<string, any>
|
||||||
|
sort?: { sortField?: string; sortOrder?: 'asc' | 'desc' | 'ASC' | 'DESC' }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 售后子类型列表查询参数(额外支持 group 分组) */
|
||||||
|
export interface AfterSaleSubTypeListParams extends AfterSaleMetaListParams {
|
||||||
|
/** 是否按 type 分组返回 groups(true 时额外返回 groups 数组) */
|
||||||
|
group?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 创建仓库自定义售后类型参数(warehouse_id 由服务端注入,无需传递) */
|
||||||
|
export interface AfterSaleTypeCreateParams {
|
||||||
|
/** 类型编码:仅 /^[a-z0-9_]+$/,长度≤20,不可与系统级编码重复 */
|
||||||
|
type: string
|
||||||
|
/** 类型名称,长度≤50 */
|
||||||
|
name: string
|
||||||
|
/** 排序值,越小越靠前,默认 0 */
|
||||||
|
sort_order?: number
|
||||||
|
/** 是否启用:1=启用(默认),0=停用 */
|
||||||
|
is_enabled?: 0 | 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 更新仓库自定义售后类型参数(type 编码不可变) */
|
||||||
|
export interface AfterSaleTypeUpdateParams {
|
||||||
|
id: number
|
||||||
|
name?: string
|
||||||
|
is_enabled?: 0 | 1
|
||||||
|
sort_order?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 创建仓库自定义售后子类型参数(所属 type 必须已存在且启用) */
|
||||||
|
export interface AfterSaleSubTypeCreateParams {
|
||||||
|
/** 所属类型编码 */
|
||||||
|
type: string
|
||||||
|
/** 子类型编码:仅 /^[a-z0-9_]+$/,长度≤50 */
|
||||||
|
sub_type: string
|
||||||
|
/** 子类型名称,长度≤50 */
|
||||||
|
name: string
|
||||||
|
sort_order?: number
|
||||||
|
is_enabled?: 0 | 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 更新仓库自定义售后子类型参数(type 与 sub_type 编码均不可变) */
|
||||||
|
export interface AfterSaleSubTypeUpdateParams {
|
||||||
|
id: number
|
||||||
|
name?: string
|
||||||
|
is_enabled?: 0 | 1
|
||||||
|
sort_order?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** afterSale.typeList 响应 */
|
||||||
|
export interface AfterSaleTypeListResponse {
|
||||||
|
list: AfterSaleTypeItem[]
|
||||||
|
pagination: AfterSaleMetaPagination
|
||||||
|
}
|
||||||
|
|
||||||
|
/** afterSale.subTypeList 响应 */
|
||||||
|
export interface AfterSaleSubTypeListResponse {
|
||||||
|
list: AfterSaleSubTypeItem[]
|
||||||
|
pagination: AfterSaleMetaPagination
|
||||||
|
/** group=true 时返回:按 type 分组(基于全量过滤结果,不受分页影响) */
|
||||||
|
groups?: AfterSaleSubTypeGroup[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** afterSale.typeDelete / afterSale.subTypeDelete 响应 */
|
||||||
|
export interface AfterSaleMetaDeleteResponse {
|
||||||
|
id: number
|
||||||
|
deleted: boolean
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== API 方法 ====================
|
// ==================== API 方法 ====================
|
||||||
|
|
||||||
/** 2.1 工作列表 afterSale.workList */
|
/** 2.1 工作列表 afterSale.workList */
|
||||||
@ -554,3 +671,156 @@ export function afterSaleBatchClose(data: AfterSaleBatchCloseParams) {
|
|||||||
isSystemApi: true
|
isSystemApi: true
|
||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2.14 售后类型列表 afterSale.typeList
|
||||||
|
* 返回系统级(warehouse_id=null、is_system=1)+ 当前仓库自定义(is_system=0)合并列表,
|
||||||
|
* 默认 sort_order ASC, id ASC;pageSize 上限 500
|
||||||
|
*/
|
||||||
|
export function afterSaleTypeList(
|
||||||
|
data: AfterSaleMetaListParams = {}
|
||||||
|
): Promise<AfterSaleTypeListResponse> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'afterSale.typeList',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2.15 创建仓库自定义售后类型 afterSale.typeCreate
|
||||||
|
* warehouse_id 由服务端从当前仓库上下文注入
|
||||||
|
*/
|
||||||
|
export function afterSaleTypeCreate(data: AfterSaleTypeCreateParams): Promise<AfterSaleTypeItem> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'afterSale.typeCreate',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2.16 更新仓库自定义售后类型 afterSale.typeUpdate
|
||||||
|
* 仅命中 id + 当前仓库 + is_system=0;type 编码不可变
|
||||||
|
*/
|
||||||
|
export function afterSaleTypeUpdate(data: AfterSaleTypeUpdateParams): Promise<AfterSaleTypeItem> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'afterSale.typeUpdate',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2.17 删除仓库自定义售后类型 afterSale.typeDelete
|
||||||
|
* 系统级类型禁止删除;该类型下存在当前仓库自定义子类型时拒绝删除
|
||||||
|
*/
|
||||||
|
export function afterSaleTypeDelete(id: number): Promise<AfterSaleMetaDeleteResponse> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'afterSale.typeDelete',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data: { id },
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2.18 售后子类型列表 afterSale.subTypeList
|
||||||
|
* group=true 时额外返回 groups(按 type 分组,基于全量过滤结果、不受分页影响)
|
||||||
|
*/
|
||||||
|
export function afterSaleSubTypeList(
|
||||||
|
data: AfterSaleSubTypeListParams = {}
|
||||||
|
): Promise<AfterSaleSubTypeListResponse> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'afterSale.subTypeList',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2.19 创建仓库自定义售后子类型 afterSale.subTypeCreate
|
||||||
|
* 所属 type 必须已存在(系统级或当前仓库自定义)且处于启用状态
|
||||||
|
*/
|
||||||
|
export function afterSaleSubTypeCreate(
|
||||||
|
data: AfterSaleSubTypeCreateParams
|
||||||
|
): Promise<AfterSaleSubTypeItem> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'afterSale.subTypeCreate',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2.20 更新仓库自定义售后子类型 afterSale.subTypeUpdate
|
||||||
|
* 仅命中 id + 当前仓库 + is_system=0;type 与 sub_type 编码均不可变
|
||||||
|
*/
|
||||||
|
export function afterSaleSubTypeUpdate(
|
||||||
|
data: AfterSaleSubTypeUpdateParams
|
||||||
|
): Promise<AfterSaleSubTypeItem> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'afterSale.subTypeUpdate',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2.21 删除仓库自定义售后子类型 afterSale.subTypeDelete
|
||||||
|
* 系统级子类型禁止删除;已被当前仓库售后单引用时拒绝删除
|
||||||
|
*/
|
||||||
|
export function afterSaleSubTypeDelete(id: number): Promise<AfterSaleMetaDeleteResponse> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'afterSale.subTypeDelete',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data: { id },
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|||||||
@ -24,6 +24,43 @@ export const DEFAULT_AUTO_OUTBOUND_RULES: Required<SettingWarehouseAutoOutboundR
|
|||||||
require_pick: true
|
require_pick: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 收货未入库提醒配置(subject_config.receiving_pending_inbound_notice) */
|
||||||
|
export type SettingWarehouseReceivingPendingInboundNotice = {
|
||||||
|
/** 是否通知收货未入库(flag:0=关闭,1=开启;默认关闭)。开启后定时任务才会在提醒时间执行 */
|
||||||
|
enabled?: boolean
|
||||||
|
/** 提醒时间,格式 HH:mm,默认 08:30,范围 00:00-23:59(含 10 分钟宽限,每天提醒一次) */
|
||||||
|
notice_time?: string
|
||||||
|
/** 超时下限(小时):创建时间距今超过该值才提醒,默认 24,须为大于 0 的整数 */
|
||||||
|
min_hours?: number
|
||||||
|
/** 超时上限(小时):距今小于该值才提醒(超过则不再提醒),默认 48,须为大于 min_hours 的整数 */
|
||||||
|
max_hours?: number
|
||||||
|
/**
|
||||||
|
* 通知短语(消息第一行,仓库/客服群)。支持变量:{warehouse} 仓库名 / {warehouse_id} 仓库ID /
|
||||||
|
* {store} 货主名(未绑定为「未绑定货主」)/ {store_id} 货主ID / {count} 本批单数 /
|
||||||
|
* {min_hours} 超时下限 / {max_hours} 超时上限 / {date} 提醒日期(YYYY-MM-DD)/ {numbers} 本批收货单号;
|
||||||
|
* 未识别的占位符原样保留;短语后换行逐行列出明细(最多 20 行),留空使用默认短语
|
||||||
|
*/
|
||||||
|
notice_template?: string
|
||||||
|
/** 通知短语(消息第一行,货主群)。变量同 notice_template,留空使用默认短语;最长 500 字符 */
|
||||||
|
store_notice_template?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 文档默认:receiving_pending_inbound_notice 各子项默认值 */
|
||||||
|
export const DEFAULT_RECEIVING_PENDING_INBOUND_NOTICE: Required<SettingWarehouseReceivingPendingInboundNotice> = {
|
||||||
|
enabled: false,
|
||||||
|
notice_time: '08:30',
|
||||||
|
min_hours: 24,
|
||||||
|
max_hours: 48,
|
||||||
|
notice_template: '',
|
||||||
|
store_notice_template: ''
|
||||||
|
}
|
||||||
|
|
||||||
|
/** receiving_pending_inbound_notice 中的纯文本字段 */
|
||||||
|
export const RECEIVING_PENDING_INBOUND_NOTICE_TEXT_KEYS = [
|
||||||
|
'notice_template',
|
||||||
|
'store_notice_template'
|
||||||
|
] as const
|
||||||
|
|
||||||
/** 仓库默认发件人/地址(subject_config 内,文档默认空字符串) */
|
/** 仓库默认发件人/地址(subject_config 内,文档默认空字符串) */
|
||||||
export type SettingWarehouseSenderConfig = {
|
export type SettingWarehouseSenderConfig = {
|
||||||
sender_name?: string
|
sender_name?: string
|
||||||
@ -84,6 +121,11 @@ export type SettingWarehouseSubjectConfig = SettingWarehouseSenderConfig & {
|
|||||||
allocate_start_time?: string
|
allocate_start_time?: string
|
||||||
/** 截单时间,格式 HH:mm,默认 18:00,范围 00:00-23:59;作为最后允许自动分配的时间,开始时间晚于截单时间时截单时间视为次日(跨天窗口) */
|
/** 截单时间,格式 HH:mm,默认 18:00,范围 00:00-23:59;作为最后允许自动分配的时间,开始时间晚于截单时间时截单时间视为次日(跨天窗口) */
|
||||||
cutoff_order_time?: string
|
cutoff_order_time?: string
|
||||||
|
/**
|
||||||
|
* 收货未入库提醒配置(默认关闭)。开启后每天按 notice_time 扫描「创建时间超过 min_hours 且不足 max_hours
|
||||||
|
* 仍未完成入库」的收货单:绑定货主的通知货主收货群(未配群回退仓库客服群),未绑定货主的通知仓库客服群
|
||||||
|
*/
|
||||||
|
receiving_pending_inbound_notice?: SettingWarehouseReceivingPendingInboundNotice
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,6 +226,45 @@ export function normalizeWarehouseSubjectConfig(
|
|||||||
const cutoffTime = String(base.cutoff_order_time ?? '')
|
const cutoffTime = String(base.cutoff_order_time ?? '')
|
||||||
base.cutoff_order_time = HHmmPattern.test(cutoffTime) ? cutoffTime : '18:00'
|
base.cutoff_order_time = HHmmPattern.test(cutoffTime) ? cutoffTime : '18:00'
|
||||||
|
|
||||||
|
// 收货未入库提醒(enabled flag 兼容 boolean / 数字 / 字符串;notice_time 非法回退 08:30;
|
||||||
|
// min_hours 默认 24;max_hours 默认 48 且必须大于 min_hours)
|
||||||
|
const noticeRaw = base.receiving_pending_inbound_notice
|
||||||
|
const notice =
|
||||||
|
noticeRaw && typeof noticeRaw === 'object' && !Array.isArray(noticeRaw)
|
||||||
|
? { ...(noticeRaw as Record<string, unknown>) }
|
||||||
|
: ({} as Record<string, unknown>)
|
||||||
|
|
||||||
|
const noticeEnabled = notice.enabled
|
||||||
|
notice.enabled =
|
||||||
|
noticeEnabled === true || noticeEnabled === 1 || noticeEnabled === '1'
|
||||||
|
|
||||||
|
const noticeTime = String(notice.notice_time ?? '')
|
||||||
|
notice.notice_time = HHmmPattern.test(noticeTime)
|
||||||
|
? noticeTime
|
||||||
|
: DEFAULT_RECEIVING_PENDING_INBOUND_NOTICE.notice_time
|
||||||
|
|
||||||
|
const minHours = Number(notice.min_hours)
|
||||||
|
notice.min_hours =
|
||||||
|
Number.isFinite(minHours) && minHours > 0
|
||||||
|
? Math.trunc(minHours)
|
||||||
|
: DEFAULT_RECEIVING_PENDING_INBOUND_NOTICE.min_hours
|
||||||
|
|
||||||
|
const maxHours = Number(notice.max_hours)
|
||||||
|
notice.max_hours =
|
||||||
|
Number.isFinite(maxHours) && maxHours > (notice.min_hours as number)
|
||||||
|
? Math.trunc(maxHours)
|
||||||
|
: Math.max(
|
||||||
|
DEFAULT_RECEIVING_PENDING_INBOUND_NOTICE.max_hours,
|
||||||
|
(notice.min_hours as number) + 1
|
||||||
|
)
|
||||||
|
|
||||||
|
for (const key of RECEIVING_PENDING_INBOUND_NOTICE_TEXT_KEYS) {
|
||||||
|
if (typeof notice[key] !== 'string') notice[key] = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
base.receiving_pending_inbound_notice =
|
||||||
|
notice as SettingWarehouseReceivingPendingInboundNotice
|
||||||
|
|
||||||
return base as SettingWarehouseSubjectConfig
|
return base as SettingWarehouseSubjectConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,19 +13,15 @@
|
|||||||
import { ref, watch, onMounted } from 'vue'
|
import { ref, watch, onMounted } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { compile } from 'path-to-regexp'
|
import { compile } from 'path-to-regexp'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { tMenu } from '@/lang/index'
|
||||||
|
|
||||||
const { t, te } = useI18n()
|
|
||||||
const levelList = ref<any[]>([])
|
const levelList = ref<any[]>([])
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const generateTitle = (title: string, name: any) => {
|
const generateTitle = (title: string, name: any) => {
|
||||||
// Use name as key if available
|
// 优先用路由 name 查菜单词条(含 menu.<name> 为对象时的 _self 兜底),否则回退 meta.title
|
||||||
if (name && te('menu.' + name)) {
|
return (name ? tMenu(name, false) : '') || title
|
||||||
return t('menu.' + name)
|
|
||||||
}
|
|
||||||
return title
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getBreadcrumb = () => {
|
const getBreadcrumb = () => {
|
||||||
|
|||||||
@ -80,7 +80,10 @@ export default {
|
|||||||
'returnReceived':'Return Received',
|
'returnReceived':'Return Received',
|
||||||
'returnUnpack':'Return Unpack',
|
'returnUnpack':'Return Unpack',
|
||||||
'returnwaybill':'Return Waybill',
|
'returnwaybill':'Return Waybill',
|
||||||
'generalreport':'General Report'
|
'generalreport':'General Report',
|
||||||
|
'afterSale':'After Sale',
|
||||||
|
'afterSaletypeList':'AfterSale TypeList',
|
||||||
|
'afterSalelist':'AfterSale List'
|
||||||
},
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"title": "Login",
|
"title": "Login",
|
||||||
|
|||||||
@ -197,6 +197,39 @@ const i18n = createI18n({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 菜单标题兜底解析(侧边栏 / 标签页 / 面包屑 / 浏览器标题统一入口)
|
||||||
|
*
|
||||||
|
* 背景:后台 i18n 以「扁平键名」存储,返回时会把键名里的 "." 展开成嵌套结构。
|
||||||
|
* 若历史上存在 menu.<name>.<子键>(如 menu.afterSale.list / .detail / .typeList),
|
||||||
|
* 则 menu.<name> 会被撑成对象,$t('menu.<name>') 只能把 key 原样返回
|
||||||
|
* (表现为导航栏显示 menu.afterSale)。
|
||||||
|
*
|
||||||
|
* 解析优先级:
|
||||||
|
* 1) menu.<name> 命中字符串且不等于 key(值 = key 的是自动采集占位符)→ 直接用
|
||||||
|
* 2) menu.<name> 命中对象 → 取 menu.<name>._self(后台「节点自身标签」约定)
|
||||||
|
* 3) 兜底:fallbackToName ? 菜单名本身 : ''
|
||||||
|
*
|
||||||
|
* 与 $t 一样,直接写在模板/计算属性里即可跟随语言切换响应。
|
||||||
|
*/
|
||||||
|
export function tMenu(title: unknown, fallbackToName = true): string {
|
||||||
|
const name = String(title ?? '').replace(/_Child$/, '').trim()
|
||||||
|
if (!name) return ''
|
||||||
|
const key = `menu.${name}`
|
||||||
|
|
||||||
|
// 先调 t():保留「缺失键自动采集上报」的原有行为(见 missing 回调)
|
||||||
|
const value = i18n.global.t(key) as unknown
|
||||||
|
if (typeof value === 'string' && value !== key) return value
|
||||||
|
|
||||||
|
const selfKey = `${key}._self`
|
||||||
|
if (i18n.global.te(selfKey)) {
|
||||||
|
const selfValue = i18n.global.t(selfKey) as unknown
|
||||||
|
if (typeof selfValue === 'string' && selfValue !== selfKey) return selfValue
|
||||||
|
}
|
||||||
|
|
||||||
|
return fallbackToName ? name : ''
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归深度合并对象
|
* 递归深度合并对象
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -83,7 +83,10 @@ export default {
|
|||||||
'returnReceived':'退回收件',
|
'returnReceived':'退回收件',
|
||||||
'returnUnpack':'退回拆包',
|
'returnUnpack':'退回拆包',
|
||||||
'returnwaybill':'退回运单',
|
'returnwaybill':'退回运单',
|
||||||
'generalreport':'通用报表'
|
'generalreport':'通用报表',
|
||||||
|
'afterSale':'售后',
|
||||||
|
'afterSaletypeList':'售后类型列表',
|
||||||
|
'afterSalelist':'售后列表',
|
||||||
},
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"title": "登录",
|
"title": "登录",
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
<el-badge :value="workOrderBadgeCount" :max="99" :hidden="!workOrderBadgeCount">
|
<el-badge :value="workOrderBadgeCount" :max="99" :hidden="!workOrderBadgeCount">
|
||||||
<div class="menu-item-content">
|
<div class="menu-item-content">
|
||||||
<svg-icon icon-class="message" />
|
<svg-icon icon-class="message" />
|
||||||
<span class="menu-text">{{ $t('menu.WorkOrder') === 'menu.WorkOrder' ? '工单' : $t('menu.WorkOrder') }}</span>
|
<span class="menu-text">{{ tMenu('WorkOrder') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</router-link>
|
</router-link>
|
||||||
@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
<router-link to="/profile">
|
<router-link to="/profile">
|
||||||
<el-dropdown-item>
|
<el-dropdown-item>
|
||||||
{{ $t('menu.Profile') }}
|
{{ tMenu('Profile') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
@ -102,6 +102,7 @@ import LangSelect from '@/components/LangSelect/index.vue'
|
|||||||
import TopMenu from './TopMenu.vue'
|
import TopMenu from './TopMenu.vue'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { useFullscreen } from '@vueuse/core'
|
import { useFullscreen } from '@vueuse/core'
|
||||||
|
import { tMenu } from '@/lang/index'
|
||||||
import { afterSaleWorkCount, afterSaleWorkList } from '@/api/aftersale/index'
|
import { afterSaleWorkCount, afterSaleWorkList } from '@/api/aftersale/index'
|
||||||
|
|
||||||
const { isFullscreen, toggle } = useFullscreen()
|
const { isFullscreen, toggle } = useFullscreen()
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
<div class="vertical-menu-item" :class="{ 'horizontal-item': settingsStore.layoutMode === 'top-bottom' }">
|
<div class="vertical-menu-item" :class="{ 'horizontal-item': settingsStore.layoutMode === 'top-bottom' }">
|
||||||
<div class="menu-icon-wrapper">
|
<div class="menu-icon-wrapper">
|
||||||
</div>
|
</div>
|
||||||
<span v-if="title" class="menu-title">{{ $t("menu." + title) }}</span>
|
<span v-if="title" class="menu-title">{{ tMenu(title) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useSettingsStore } from '@/stores/modules/settings'
|
import { useSettingsStore } from '@/stores/modules/settings'
|
||||||
|
import { tMenu } from '@/lang/index'
|
||||||
|
|
||||||
const settingsStore = useSettingsStore()
|
const settingsStore = useSettingsStore()
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<div class="menu-icon-wrapper">
|
<div class="menu-icon-wrapper">
|
||||||
<svg-icon v-if="icon" :icon-class="icon" class="menu-icon" />
|
<svg-icon v-if="icon" :icon-class="icon" class="menu-icon" />
|
||||||
</div>
|
</div>
|
||||||
<span v-if="title" class="menu-title">{{ $t("menu." + title) }}</span>
|
<span v-if="title" class="menu-title">{{ tMenu(title) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="shortcut-toggle" @click.stop.prevent="toggleShortcut">
|
<div class="shortcut-toggle" @click.stop.prevent="toggleShortcut">
|
||||||
<el-icon :class="{ 'is-active': isShortcut }">
|
<el-icon :class="{ 'is-active': isShortcut }">
|
||||||
@ -19,6 +19,7 @@
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { Star, StarFilled } from '@element-plus/icons-vue'
|
import { Star, StarFilled } from '@element-plus/icons-vue'
|
||||||
import { useShortcutsStore } from '@/stores/modules/shortcuts'
|
import { useShortcutsStore } from '@/stores/modules/shortcuts'
|
||||||
|
import { tMenu } from '@/lang/index'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
icon: {
|
icon: {
|
||||||
|
|||||||
@ -58,12 +58,10 @@ import { useScanBoxCacheStore } from '@/stores/modules/scanBoxCache'
|
|||||||
import ScrollPane from './ScrollPane.vue'
|
import ScrollPane from './ScrollPane.vue'
|
||||||
import Navbar from '../Navbar.vue'
|
import Navbar from '../Navbar.vue'
|
||||||
import path from 'path-browserify'
|
import path from 'path-browserify'
|
||||||
import { useI18n } from 'vue-i18n'
|
|
||||||
import { isExternal } from '@/utils/validate'
|
import { isExternal } from '@/utils/validate'
|
||||||
import { ArrowUp, ArrowDown } from '@element-plus/icons-vue'
|
import { ArrowUp, ArrowDown } from '@element-plus/icons-vue'
|
||||||
import { useSettingsStore } from '@/stores/modules/settings'
|
import { useSettingsStore } from '@/stores/modules/settings'
|
||||||
|
import { tMenu } from '@/lang/index'
|
||||||
const { t, te } = useI18n()
|
|
||||||
|
|
||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
const top = ref(0)
|
const top = ref(0)
|
||||||
@ -102,14 +100,8 @@ const isAffix = (tag: any) => {
|
|||||||
return tag.meta && tag.meta.affix
|
return tag.meta && tag.meta.affix
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateTitle = (title: any) => {
|
/** 菜单标题(含后台把 menu.<name> 返回成对象时的 _self 兜底,见 tMenu) */
|
||||||
const titleKey = 'menu.' + title
|
const generateTitle = (title: any) => tMenu(title, false) || title || 'no-name'
|
||||||
const hasKey = te(titleKey)
|
|
||||||
if (hasKey) {
|
|
||||||
return t(titleKey)
|
|
||||||
}
|
|
||||||
return title || 'no-name'
|
|
||||||
}
|
|
||||||
|
|
||||||
const filterAffixTags = (routes: any[], basePath = '/') => {
|
const filterAffixTags = (routes: any[], basePath = '/') => {
|
||||||
let tags: any[] = []
|
let tags: any[] = []
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import App from './App.vue'
|
|||||||
import router from './router'
|
import router from './router'
|
||||||
import './permission' // permission control
|
import './permission' // permission control
|
||||||
import SvgIcon from '@/components/SvgIcon/index.vue'
|
import SvgIcon from '@/components/SvgIcon/index.vue'
|
||||||
import i18n, { loadServerMessages } from '@/lang/index'
|
import i18n, { loadServerMessages, tMenu } from '@/lang/index'
|
||||||
import getPageTitle from '@/utils/get-page-title'
|
import getPageTitle from '@/utils/get-page-title'
|
||||||
|
|
||||||
import '@/styles/index.scss' // global css
|
import '@/styles/index.scss' // global css
|
||||||
@ -57,11 +57,10 @@ app.mount('#app')
|
|||||||
const frontBrandStore = useFrontBrandStore(pinia)
|
const frontBrandStore = useFrontBrandStore(pinia)
|
||||||
|
|
||||||
function resolveRoutePageTitle(route: { name?: unknown; meta?: Record<string, unknown> }): string {
|
function resolveRoutePageTitle(route: { name?: unknown; meta?: Record<string, unknown> }): string {
|
||||||
|
// 菜单词条可能是对象(后台按点分层,见 lang/index.ts 的 tMenu),统一走 tMenu 兜底
|
||||||
const tryMenuKey = (raw: unknown) => {
|
const tryMenuKey = (raw: unknown) => {
|
||||||
if (raw === undefined || raw === null || raw === '') return ''
|
if (raw === undefined || raw === null || raw === '') return ''
|
||||||
const key = String(raw).replace(/_Child$/, '')
|
return tMenu(raw, false)
|
||||||
const path = `menu.${key}`
|
|
||||||
return i18n.global.te(path) ? String(i18n.global.t(path)) : ''
|
|
||||||
}
|
}
|
||||||
const fromName = tryMenuKey(route.name)
|
const fromName = tryMenuKey(route.name)
|
||||||
if (fromName) return fromName
|
if (fromName) return fromName
|
||||||
|
|||||||
@ -81,4 +81,7 @@ export const componentMap: Record<string, any> = {
|
|||||||
'express/returnwaybill/index': () => import('@/views/express/returnwaybill/index.vue'),
|
'express/returnwaybill/index': () => import('@/views/express/returnwaybill/index.vue'),
|
||||||
'express/returnUnpackwork/index': () => import('@/views/express/returnUnpackwork/index.vue'),
|
'express/returnUnpackwork/index': () => import('@/views/express/returnUnpackwork/index.vue'),
|
||||||
'storage/generalreport/index': () => import('@/views/storage/generalreport/index.vue'),
|
'storage/generalreport/index': () => import('@/views/storage/generalreport/index.vue'),
|
||||||
|
'afterSale/afterSalelist': () => import('@/views/afterSale/list/index.vue'),
|
||||||
|
'afterSale/detail/index': () => import('@/views/afterSale/detail/index.vue'),
|
||||||
|
'afterSale/typelist/index': () => import('@/views/afterSale/typelist/index.vue'),
|
||||||
};
|
};
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
<!--
|
||||||
|
ColumnCellRenderer — 通用表格列渲染器
|
||||||
|
|
||||||
|
根据传入的 ColumnSlotConfig 决定如何渲染单元格:
|
||||||
|
- type='tag' → el-tag(支持 tagResolver / tagType 颜色映射)
|
||||||
|
- type='text' → 纯文本(支持 datetime 格式化)
|
||||||
|
- type='default' → 默认插槽渲染
|
||||||
|
- type='operation' → 操作列(由 OperationCellRenderer 处理)
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<template v-if="!config || config.type === 'default'">
|
||||||
|
<slot />
|
||||||
|
</template>
|
||||||
|
<template v-else-if="config.type === 'tag'">
|
||||||
|
<el-tag size="small" :type="resolvedTagType">
|
||||||
|
{{ displayValue }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span>{{ displayValue }}</span>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import type { ColumnSlotConfig } from '../config/template-config'
|
||||||
|
import { TAG_RESOLVERS, translate, formatTime } from '../config/template-config'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ColumnCellRenderer' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
/** 列插槽渲染配置 */
|
||||||
|
config: ColumnSlotConfig | undefined
|
||||||
|
/** 单元格值 */
|
||||||
|
value: any
|
||||||
|
}>()
|
||||||
|
|
||||||
|
/** 显示文本:translateField 翻译 > format 格式化 > 原始值 */
|
||||||
|
const displayValue = computed(() => {
|
||||||
|
const v = props.value
|
||||||
|
if (props.config?.translateField) {
|
||||||
|
return translate(props.config.translateField, v)
|
||||||
|
}
|
||||||
|
if (props.config?.format === 'datetime') {
|
||||||
|
return formatTime(v)
|
||||||
|
}
|
||||||
|
return v ?? '—'
|
||||||
|
})
|
||||||
|
|
||||||
|
const resolvedTagType = computed(() => {
|
||||||
|
if (!props.config || props.config.type !== 'tag') return ''
|
||||||
|
const { tagType, tagResolver } = props.config
|
||||||
|
// 优先使用 tagResolver(函数名映射)
|
||||||
|
if (tagResolver && TAG_RESOLVERS[tagResolver]) {
|
||||||
|
return TAG_RESOLVERS[tagResolver](props.value)
|
||||||
|
}
|
||||||
|
// 其次使用 tagType 映射表(用原始值查找)
|
||||||
|
if (tagType && typeof tagType === 'object') {
|
||||||
|
return tagType[String(props.value)] ?? 'info'
|
||||||
|
}
|
||||||
|
// 最后使用固定值
|
||||||
|
return (typeof tagType === 'string' ? tagType : 'info')
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
@ -0,0 +1,175 @@
|
|||||||
|
<!--
|
||||||
|
OperationCellRenderer — 表格操作列渲染组件
|
||||||
|
|
||||||
|
根据 operationButtons 配置渲染按钮列表。
|
||||||
|
|
||||||
|
支持的行为类型:
|
||||||
|
- actionType='action' → 触发 @operation-action 事件(可选配置 confirmMessage 弹确认框)
|
||||||
|
- actionType='form' → 打开 COMPONENT_REGISTRY 中注册的表单组件
|
||||||
|
|
||||||
|
使用方式:在 index.vue 中通过插槽 column-operation 引入:
|
||||||
|
<OperationCellRenderer
|
||||||
|
:buttons="currentTabConfig?.operationButtons"
|
||||||
|
:row="row"
|
||||||
|
@operation-action="handleOperationAction"
|
||||||
|
/>
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="operation-cell">
|
||||||
|
<template v-for="btn in buttons" :key="btn.key">
|
||||||
|
<!-- action 按钮:支持确认弹窗 -->
|
||||||
|
<el-button
|
||||||
|
v-if="btn.actionType === 'action'"
|
||||||
|
link
|
||||||
|
:type="btn.type || 'primary'"
|
||||||
|
size="small"
|
||||||
|
:loading="actionLoadingMap[btn.key]"
|
||||||
|
:disabled="isDisabled(btn)"
|
||||||
|
@click.stop="handleActionClick(btn)"
|
||||||
|
>
|
||||||
|
{{ btn.label }}
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
<!-- form 按钮:打开表单弹窗 -->
|
||||||
|
<template v-else-if="btn.actionType === 'form'">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
:type="btn.type || 'primary'"
|
||||||
|
size="small"
|
||||||
|
:disabled="isDisabled(btn)"
|
||||||
|
@click.stop="openForm(btn)"
|
||||||
|
>
|
||||||
|
{{ btn.label }}
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
<!-- 表单弹窗 -->
|
||||||
|
<component
|
||||||
|
:is="resolvedFormComponents[btn.key]"
|
||||||
|
v-if="resolvedFormComponents[btn.key] && activeFormKey === btn.key"
|
||||||
|
v-model:visible="formVisibleMap[btn.key]"
|
||||||
|
v-bind="buildFormProps(btn)"
|
||||||
|
@success="handleFormSuccess(btn.key)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, markRaw, type Component } from 'vue'
|
||||||
|
import { ElMessageBox } from 'element-plus'
|
||||||
|
import { COMPONENT_REGISTRY } from '../config/template-config'
|
||||||
|
import type { OperationButtonConfig } from '../config/template-config'
|
||||||
|
|
||||||
|
defineOptions({ name: 'OperationCellRenderer' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
/** 操作按钮配置列表(来自 TabPageConfig.operationButtons) */
|
||||||
|
buttons?: OperationButtonConfig[]
|
||||||
|
/** 当前行数据 */
|
||||||
|
row: Record<string, any>
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
/** action 按钮点击事件(key: 按钮标识, row: 行数据) */
|
||||||
|
(e: 'operation-action', key: string, row: Record<string, any>): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
// ===== form 弹窗管理 =====
|
||||||
|
const activeFormKey = ref('')
|
||||||
|
const formVisibleMap = reactive<Record<string, boolean>>({})
|
||||||
|
const resolvedFormComponents = ref<Record<string, Component>>({})
|
||||||
|
const actionLoadingMap = reactive<Record<string, boolean>>({})
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// action 按钮:支持确认弹窗
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
async function handleActionClick(btn: OperationButtonConfig) {
|
||||||
|
if (btn.confirmMessage) {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm(
|
||||||
|
btn.confirmMessage,
|
||||||
|
btn.confirmTitle || '确认操作',
|
||||||
|
{
|
||||||
|
confirmButtonText: btn.confirmButtonText || '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: (btn.confirmType || 'warning') as any
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} catch {
|
||||||
|
return // 取消
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
actionLoadingMap[btn.key] = true
|
||||||
|
try {
|
||||||
|
emit('operation-action', btn.key, props.row)
|
||||||
|
} finally {
|
||||||
|
actionLoadingMap[btn.key] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// form 按钮:打开表单弹窗
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
function openForm(btn: OperationButtonConfig) {
|
||||||
|
if (!btn.formKey) return
|
||||||
|
|
||||||
|
const comp = COMPONENT_REGISTRY[btn.formKey]
|
||||||
|
if (!comp) {
|
||||||
|
console.warn(`[OperationCellRenderer] 未注册的表单组件: ${btn.formKey}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
activeFormKey.value = btn.key
|
||||||
|
resolvedFormComponents.value[btn.key] = markRaw(comp)
|
||||||
|
formVisibleMap[btn.key] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildFormProps(btn: OperationButtonConfig): Record<string, any> {
|
||||||
|
const result: Record<string, any> = {}
|
||||||
|
|
||||||
|
// paramMap: { formProp: rowField } → 从行数据取值注入表单
|
||||||
|
if (btn.paramMap) {
|
||||||
|
for (const [formProp, rowField] of Object.entries(btn.paramMap)) {
|
||||||
|
result[formProp] = props.row[rowField]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// extraParams: 固定参数直接注入
|
||||||
|
if (btn.extraParams) {
|
||||||
|
Object.assign(result, btn.extraParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFormSuccess(key: string) {
|
||||||
|
emit('operation-action', key, props.row)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 按钮禁用判断
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
function isDisabled(btn: OperationButtonConfig): boolean {
|
||||||
|
if (btn.disabledOnField) {
|
||||||
|
const val = props.row[btn.disabledOnField]
|
||||||
|
if (val === undefined || val === null || val === '' || val === false) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.operation-cell {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 2px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
132
src/views/afterSale/typelist/components/TabArea.vue
Normal file
132
src/views/afterSale/typelist/components/TabArea.vue
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tab-area-wrapper">
|
||||||
|
<el-tabs
|
||||||
|
v-model="activeTab"
|
||||||
|
tab-position="top"
|
||||||
|
type="border-card"
|
||||||
|
class="tab-container"
|
||||||
|
@tab-click="handleTabClick"
|
||||||
|
>
|
||||||
|
<el-tab-pane
|
||||||
|
v-for="tab in tabs"
|
||||||
|
:key="tab.name"
|
||||||
|
:name="tab.name"
|
||||||
|
:lazy="false"
|
||||||
|
>
|
||||||
|
<template #label>
|
||||||
|
<span class="custom-tab-label">{{ tab.label }}</span>
|
||||||
|
</template>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'TabArea' })
|
||||||
|
|
||||||
|
interface TabItem {
|
||||||
|
name: string
|
||||||
|
label: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
tabs?: TabItem[]
|
||||||
|
defaultActive?: string
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
tabs: () => [],
|
||||||
|
defaultActive: ''
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'tab-change', tabName: string): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const activeTab = ref(props.defaultActive || props.tabs[0]?.name || '')
|
||||||
|
|
||||||
|
const handleTabClick = (pane: any) => {
|
||||||
|
const name = pane?.name ?? pane?.props?.name ?? ''
|
||||||
|
if (name) {
|
||||||
|
activeTab.value = name
|
||||||
|
emit('tab-change', name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.tab-area-wrapper {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
:deep(.el-tabs__header) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tabs__header.is-top) {
|
||||||
|
padding: 4px 12px 0;
|
||||||
|
background: #f8fbff;
|
||||||
|
border-bottom: 1px solid #e8eef7;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tabs__nav-wrap::after) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tabs__item.is-top) {
|
||||||
|
height: 38px;
|
||||||
|
line-height: 38px;
|
||||||
|
padding: 0 20px;
|
||||||
|
border-radius: 6px 6px 0 0;
|
||||||
|
color: #606266;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-bottom: none;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tabs__item.is-top:hover) {
|
||||||
|
color: #409eff;
|
||||||
|
background-color: rgba(64, 158, 255, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tabs__item.is-top.is-active) {
|
||||||
|
color: #409eff;
|
||||||
|
font-weight: 600;
|
||||||
|
background: #ffffff;
|
||||||
|
border-color: #e8eef7;
|
||||||
|
border-bottom: 2px solid #ffffff;
|
||||||
|
margin-bottom: -1px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tabs__active-bar) {
|
||||||
|
height: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background-color: #409eff;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tabs__content) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-tab-label {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
179
src/views/afterSale/typelist/config/components/DetailPanel.vue
Normal file
179
src/views/afterSale/typelist/config/components/DetailPanel.vue
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
<!--
|
||||||
|
DetailPanel — 明细面板(通用)
|
||||||
|
|
||||||
|
根据 detailConfig 配置的 sections 渲染 el-descriptions 分区。
|
||||||
|
支持 text、tag、pre 三种渲染类型。
|
||||||
|
支持 translateField + tagResolver 集中式翻译。
|
||||||
|
支持 apiMethod 自动获取详情数据。
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="detail-panel">
|
||||||
|
<div v-if="!row" class="empty-tip">请从上方列表中选择一项查看明细</div>
|
||||||
|
<template v-else>
|
||||||
|
<div v-for="(section, si) in detailConfig" :key="si" class="section">
|
||||||
|
<div class="section-title">{{ section.title }}</div>
|
||||||
|
<el-descriptions :column="section.columnCount" border size="small" class="detail-descriptions">
|
||||||
|
<el-descriptions-item
|
||||||
|
v-for="(field, fi) in section.fields"
|
||||||
|
:key="fi"
|
||||||
|
:label="field.label"
|
||||||
|
:span="field.span ?? 1"
|
||||||
|
>
|
||||||
|
<!-- tag 渲染 -->
|
||||||
|
<template v-if="field.renderType === 'tag'">
|
||||||
|
<el-tag size="small" :type="resolveTagType(field, getRowData()?.[field.key])">
|
||||||
|
{{ resolveDisplayValue(field, getRowData()?.[field.key]) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
<!-- pre 渲染 -->
|
||||||
|
<template v-else-if="field.renderType === 'pre'">
|
||||||
|
<pre class="order-list-pre">{{ formatPre(getRowData()?.[field.key]) }}</pre>
|
||||||
|
</template>
|
||||||
|
<!-- 默认文本渲染 -->
|
||||||
|
<template v-else>
|
||||||
|
{{ resolveDisplayValue(field, getRowData()?.[field.key]) }}
|
||||||
|
</template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
import { TAG_RESOLVERS, translate } from '../template-config'
|
||||||
|
import type { DetailSectionConfig, DetailFieldConfig } from '../template-config'
|
||||||
|
|
||||||
|
defineOptions({ name: 'DetailPanel' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
row: Record<string, any> | null
|
||||||
|
detailConfig: DetailSectionConfig[]
|
||||||
|
/** 可选的 detail API 方法,传入后自动调用获取完整明细数据 */
|
||||||
|
apiMethod?: (...args: any[]) => Promise<any>
|
||||||
|
}>()
|
||||||
|
|
||||||
|
/** 通过 API 获取的增强数据(与 row 合并) */
|
||||||
|
const enrichedData = ref<Record<string, any> | null>(null)
|
||||||
|
|
||||||
|
watch(() => props.row, async (newRow) => {
|
||||||
|
if (newRow && props.apiMethod) {
|
||||||
|
try {
|
||||||
|
const res = await props.apiMethod({
|
||||||
|
id: newRow.id,
|
||||||
|
code: newRow.code
|
||||||
|
})
|
||||||
|
if (res && (res.code === 1 || res.code === 200)) {
|
||||||
|
enrichedData.value = res.data ?? res
|
||||||
|
} else {
|
||||||
|
enrichedData.value = null
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
enrichedData.value = null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
enrichedData.value = null
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
/** 合并 row + API 增强数据 */
|
||||||
|
function getRowData(): Record<string, any> | null {
|
||||||
|
if (!props.row) return null
|
||||||
|
if (enrichedData.value) {
|
||||||
|
return { ...props.row, ...enrichedData.value }
|
||||||
|
}
|
||||||
|
return props.row
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 解析显示值:优先使用 translateField 翻译,否则显示原始值 */
|
||||||
|
function resolveDisplayValue(field: DetailFieldConfig, value: any): string {
|
||||||
|
if (field.translateField) {
|
||||||
|
return translate(field.translateField, value)
|
||||||
|
}
|
||||||
|
return value ?? '—'
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 格式化 pre 渲染值:数组/对象转 JSON 字符串 */
|
||||||
|
function formatPre(value: any): string {
|
||||||
|
if (value === undefined || value === null || value === '') return '—'
|
||||||
|
if (Array.isArray(value) && value.length === 0) return '—'
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
try {
|
||||||
|
return JSON.stringify(value, null, 2)
|
||||||
|
} catch {
|
||||||
|
return String(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return String(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 解析 tag 颜色 */
|
||||||
|
function resolveTagType(field: DetailFieldConfig, value: any): string {
|
||||||
|
if (field.tagResolver) {
|
||||||
|
const resolver = TAG_RESOLVERS[field.tagResolver]
|
||||||
|
if (resolver) return resolver(value)
|
||||||
|
}
|
||||||
|
if (field.tagType) {
|
||||||
|
if (typeof field.tagType === 'object') {
|
||||||
|
return field.tagType[String(value)] ?? 'info'
|
||||||
|
}
|
||||||
|
return field.tagType
|
||||||
|
}
|
||||||
|
return 'info'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
/* 容器对齐 order/orderManagement 的 OrderDetailPanel(.order-detail-view) */
|
||||||
|
.detail-panel {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 10px;
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-tip {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #909399;
|
||||||
|
padding: 40px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding-left: 8px;
|
||||||
|
border-left: 3px solid #409eff;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-descriptions {
|
||||||
|
:deep(.el-descriptions__label) {
|
||||||
|
width: 120px;
|
||||||
|
background: #fafbfc;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-list-pre {
|
||||||
|
margin: 0;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.8;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
194
src/views/afterSale/typelist/config/components/LogPanel.vue
Normal file
194
src/views/afterSale/typelist/config/components/LogPanel.vue
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
<!--
|
||||||
|
LogPanel — 操作日志面板(通用)
|
||||||
|
|
||||||
|
支持两种数据来源:
|
||||||
|
- apiMethod 传入 → 调用真实接口获取日志
|
||||||
|
- 无 apiMethod → 基于 row 生成模拟日志(开发调试用)
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="log-panel">
|
||||||
|
<div v-if="apiLoading" v-loading="true" class="log-empty">加载中…</div>
|
||||||
|
<template v-else>
|
||||||
|
<el-table
|
||||||
|
v-if="logs.length"
|
||||||
|
:data="pagedLogs"
|
||||||
|
border
|
||||||
|
stripe
|
||||||
|
size="small"
|
||||||
|
height="100%"
|
||||||
|
class="log-table"
|
||||||
|
>
|
||||||
|
<el-table-column prop="time" label="时间" width="175" />
|
||||||
|
<el-table-column prop="operator" label="操作人" width="120" />
|
||||||
|
<el-table-column prop="action" label="操作类型" min-width="180" show-overflow-tooltip />
|
||||||
|
<el-table-column label="结果" width="90" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag size="small" :type="resultTagType(row)">{{ row.result }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="说明" min-width="220" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">{{ row.detail || '—' }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div v-else class="log-empty">暂无操作日志</div>
|
||||||
|
|
||||||
|
<div v-if="logs.length > pageSize" class="log-pagination">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="currentPage"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="logs.length"
|
||||||
|
layout="total, prev, pager, next"
|
||||||
|
background
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref, watch } from 'vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'LogPanel' })
|
||||||
|
|
||||||
|
interface LogItem {
|
||||||
|
operator: string
|
||||||
|
action: string
|
||||||
|
result: string
|
||||||
|
detail?: string
|
||||||
|
time: string
|
||||||
|
level: 'success' | 'info' | 'warning' | 'error'
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
/** 当前选中行数据(用于生成关联日志) */
|
||||||
|
row: Record<string, any> | null
|
||||||
|
/** 可选的日志 API 方法,传入后自动调用获取真实日志 */
|
||||||
|
apiMethod?: (...args: any[]) => Promise<any>
|
||||||
|
}>()
|
||||||
|
|
||||||
|
/** 通过 API 获取的真实日志列表 */
|
||||||
|
const apiLogs = ref<LogItem[] | null>(null)
|
||||||
|
const apiLoading = ref(false)
|
||||||
|
|
||||||
|
/** 表格本地分页(对齐 order/orderManagement 的 log.vue 体验) */
|
||||||
|
const currentPage = ref(1)
|
||||||
|
const pageSize = 10
|
||||||
|
const pagedLogs = computed<LogItem[]>(() => {
|
||||||
|
const start = (currentPage.value - 1) * pageSize
|
||||||
|
return logs.value.slice(start, start + pageSize)
|
||||||
|
})
|
||||||
|
|
||||||
|
function resultTagType(row: LogItem): string {
|
||||||
|
if (row.result === '成功') return 'success'
|
||||||
|
if (row.result === '失败') return 'danger'
|
||||||
|
return 'info'
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => props.row, async (newRow) => {
|
||||||
|
currentPage.value = 1
|
||||||
|
if (newRow && props.apiMethod) {
|
||||||
|
apiLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await props.apiMethod({
|
||||||
|
id: newRow.id,
|
||||||
|
code: newRow.code,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 100
|
||||||
|
})
|
||||||
|
if (res && (res.code === 1 || res.code === 200)) {
|
||||||
|
const list = res.data?.list ?? res.data?.logs ?? res.list ?? res.logs ?? []
|
||||||
|
apiLogs.value = Array.isArray(list) ? list.map((item: any) => ({
|
||||||
|
operator: item.operator ?? item.creator ?? '—',
|
||||||
|
action: item.action ?? item.operation ?? '—',
|
||||||
|
result: item.result ?? item.status ?? '—',
|
||||||
|
detail: item.detail ?? item.description ?? '',
|
||||||
|
time: item.time ?? item.create_time ?? '—',
|
||||||
|
level: (item.result === '成功' || item.status === 'success') ? 'success'
|
||||||
|
: (item.result === '失败' || item.status === 'error') ? 'error'
|
||||||
|
: 'info'
|
||||||
|
})) : []
|
||||||
|
} else {
|
||||||
|
apiLogs.value = []
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
apiLogs.value = []
|
||||||
|
} finally {
|
||||||
|
apiLoading.value = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
apiLogs.value = null
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
/** 基于 row 生成模拟日志(无 apiMethod 时使用) */
|
||||||
|
const mockLogs = computed<LogItem[]>(() => {
|
||||||
|
if (!props.row) return []
|
||||||
|
|
||||||
|
const rowName = props.row.name ?? props.row.code ?? '—'
|
||||||
|
const now = new Date()
|
||||||
|
const pad = (n: number) => String(n).padStart(2, '0')
|
||||||
|
const fmt = (d: Date) =>
|
||||||
|
`${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
operator: '系统',
|
||||||
|
action: `创建了「${rowName}」`,
|
||||||
|
result: '成功',
|
||||||
|
time: fmt(new Date(now.getTime() - 3600000 * 3)),
|
||||||
|
level: 'success'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
operator: props.row.creator ?? '管理员',
|
||||||
|
action: `更新了「${rowName}」`,
|
||||||
|
result: '成功',
|
||||||
|
detail: `修改了状态和相关配置`,
|
||||||
|
time: fmt(new Date(now.getTime() - 3600000)),
|
||||||
|
level: 'success'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志 */
|
||||||
|
const logs = computed<LogItem[]>(() => {
|
||||||
|
if (apiLogs.value !== null) {
|
||||||
|
return apiLogs.value
|
||||||
|
}
|
||||||
|
return mockLogs.value
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
/* 对齐 order/orderManagement 的 log.vue(el-table 表格 + 本地分页) */
|
||||||
|
.log-panel {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 10px;
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-table {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-empty {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #909399;
|
||||||
|
padding: 40px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-pagination {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
866
src/views/afterSale/typelist/config/template-config.ts
Normal file
866
src/views/afterSale/typelist/config/template-config.ts
Normal file
@ -0,0 +1,866 @@
|
|||||||
|
/**
|
||||||
|
* 【页面模板】配置文件 v2 — 基于 waveOrder2 架构设计
|
||||||
|
*
|
||||||
|
* ===== 核心设计 =====
|
||||||
|
*
|
||||||
|
* 1. FIELD_DICT — 全局字段预设表,每个字段拥有唯一翻译(label)和完整元数据
|
||||||
|
* 2. VALUE_MAPS — 值翻译映射表(select options 和 tag 翻译共用)
|
||||||
|
* 3. TAG_RESOLVERS — 标签颜色解析器(集中管理 tag 颜色逻辑)
|
||||||
|
* 4. 各标签页通过 key 引用所需字段(scanBoxFieldKeys / tableColumnKeys)
|
||||||
|
* 5. resolveTabConfig() — 加载时将 key 列表展开为完整配置
|
||||||
|
*
|
||||||
|
* ===== 快速上手 =====
|
||||||
|
* 1. 复制整个 views/mode/ 文件夹,重命名为你的页面名
|
||||||
|
* 2. 在 FIELD_DICT 中添加你需要的字段定义
|
||||||
|
* 3. 在 tabPages 中配置标签页(引用 FIELD_DICT 的 key)
|
||||||
|
* 4. 在 TabPageApiConfig 中接入真实接口
|
||||||
|
* 5. 在 router/map.ts 中添加路由
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { Component } from 'vue'
|
||||||
|
import DetailPanel from './components/DetailPanel.vue'
|
||||||
|
import LogPanel from './components/LogPanel.vue'
|
||||||
|
import { afterSaleTypeList, afterSaleSubTypeList } from '@/api/aftersale/index'
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 〇、全局页面配置
|
||||||
|
// ============================================================
|
||||||
|
export const PAGE_CONFIG = {
|
||||||
|
/** 是否显示顶部多标签栏 */
|
||||||
|
showTabArea: true,
|
||||||
|
/** 单页模式:不显示标签栏,仅一个标签页内容 */
|
||||||
|
singlePage: false,
|
||||||
|
/** 是否启用详情面板(底部分栏 + 显示/隐藏详情按钮),false 时表格占满全高 */
|
||||||
|
enableDetailPanel: true
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 〇-A、组件注册表 — 所有可复用组件在此注册
|
||||||
|
// ============================================================
|
||||||
|
export const COMPONENT_REGISTRY: Record<string, Component> = {
|
||||||
|
DetailPanel,
|
||||||
|
LogPanel
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 〇-B、SCANBOX_GROUPS — ScanBox 分组名称
|
||||||
|
// ============================================================
|
||||||
|
export const SCANBOX_GROUPS = {
|
||||||
|
basic: '基础信息',
|
||||||
|
process: '流程状态',
|
||||||
|
time: '时间范围',
|
||||||
|
custom: '自定义字段'
|
||||||
|
} as const
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 一、FIELD_DICT — 全局字段预设表(唯一真相来源)
|
||||||
|
// ============================================================
|
||||||
|
// 每个字段拥有:
|
||||||
|
// label — 唯一翻译文本
|
||||||
|
// scanBox — ScanBox 渲染配置(type/options/group)
|
||||||
|
// table — 表格列配置(minWidth/fixed/align/sortable)
|
||||||
|
// slot — 单元格渲染配置(tag/tagResolver/translateField)
|
||||||
|
// detailLabel — 明细面板中的标签文本(可选,默认用 label)
|
||||||
|
// filterParamMap — ScanBox 筛选值 → API 传参值映射
|
||||||
|
|
||||||
|
export interface FieldDefinition {
|
||||||
|
key: string
|
||||||
|
label: string
|
||||||
|
scanBox: {
|
||||||
|
type: 'text' | 'select' | 'daterange' | 'number'
|
||||||
|
group?: string
|
||||||
|
options?: { label: string; value: any }[]
|
||||||
|
} | null
|
||||||
|
table: {
|
||||||
|
minWidth?: number
|
||||||
|
width?: number
|
||||||
|
fixed?: 'left' | 'right' | boolean
|
||||||
|
align?: 'left' | 'center' | 'right'
|
||||||
|
sortable?: boolean
|
||||||
|
showOverflowTooltip?: boolean
|
||||||
|
copyAction?: 'copy' | 'copyQr'
|
||||||
|
copyValue?: (row: any) => any
|
||||||
|
} | null
|
||||||
|
slot: {
|
||||||
|
type: 'tag' | 'text' | 'default' | 'operation'
|
||||||
|
tagType?: string | Record<string, string>
|
||||||
|
tagResolver?: string
|
||||||
|
translateField?: string
|
||||||
|
format?: 'datetime'
|
||||||
|
} | null
|
||||||
|
detailLabel?: string
|
||||||
|
filterParamMap?: Record<string, any>
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ScanBox 字段渲染覆盖(按标签页覆写 label / type / options)
|
||||||
|
* 用于同一字段在不同标签页语义不同的场景,如 type:类型页签=类型编码(文本),子类型页签=所属类型(下拉)
|
||||||
|
*/
|
||||||
|
export interface ScanBoxFieldOverride {
|
||||||
|
label?: string
|
||||||
|
type?: 'text' | 'select' | 'daterange' | 'number'
|
||||||
|
options?: { label: string; value: any }[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// VALUE_MAPS — 值翻译映射(select options 和 tag 翻译共用)
|
||||||
|
// ============================================================
|
||||||
|
export const VALUE_MAPS: Record<string, Record<string, string>> = {
|
||||||
|
/** 数据来源:1=系统级(全部仓库可见,不可改删),0=当前仓库自定义 */
|
||||||
|
is_system: { '1': '系统级', '0': '仓库自定义' },
|
||||||
|
/** 启用状态:1=启用,0=停用 */
|
||||||
|
is_enabled: { '1': '启用', '0': '停用' }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从 VALUE_MAPS 衍生 options(优先取中文值作为 option value) */
|
||||||
|
export function getOptions(field: string): { label: string; value: string }[] {
|
||||||
|
const map = VALUE_MAPS[field]
|
||||||
|
if (!map) return []
|
||||||
|
const seen = new Set<string>()
|
||||||
|
const opts: { label: string; value: string }[] = []
|
||||||
|
const chineseKeys: [string, string][] = []
|
||||||
|
const otherKeys: [string, string][] = []
|
||||||
|
for (const [v, l] of Object.entries(map)) {
|
||||||
|
if (/^[\u4e00-\u9fa5]/.test(v)) {
|
||||||
|
chineseKeys.push([v, l])
|
||||||
|
} else {
|
||||||
|
otherKeys.push([v, l])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const [v, l] of [...chineseKeys, ...otherKeys]) {
|
||||||
|
if (!seen.has(l)) {
|
||||||
|
seen.add(l)
|
||||||
|
opts.push({ label: l, value: v })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return opts
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 翻译 value → label */
|
||||||
|
export function translate(field: string, value: any): string {
|
||||||
|
const map = VALUE_MAPS[field]
|
||||||
|
if (!map) return String(value ?? '—')
|
||||||
|
return map[String(value)] ?? String(value ?? '—')
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 格式化时间戳为 YYYY-MM-DD HH:mm:ss */
|
||||||
|
export function formatTime(value: any): string {
|
||||||
|
if (!value) return '—'
|
||||||
|
try {
|
||||||
|
const d = new Date(value)
|
||||||
|
if (isNaN(d.getTime())) return String(value)
|
||||||
|
const pad = (n: number) => String(n).padStart(2, '0')
|
||||||
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
|
||||||
|
} catch {
|
||||||
|
return String(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// TAG_RESOLVERS — 标签颜色解析器
|
||||||
|
// ============================================================
|
||||||
|
// 颜色规则:未xx=info(灰) 已xx=success(绿) xx中/部分xx=warning(黄) 错误=danger(红)
|
||||||
|
export const TAG_RESOLVERS: Record<string, (val: any) => string> = {
|
||||||
|
/** 数据来源:系统级=warning(橙),仓库自定义=info(灰) */
|
||||||
|
resolveIsSystemTag(v) {
|
||||||
|
if (v === undefined || v === null || v === '') return 'info'
|
||||||
|
return String(v) === '1' ? 'warning' : 'info'
|
||||||
|
},
|
||||||
|
/** 启用状态:启用=success(绿),停用=info(灰) */
|
||||||
|
resolveIsEnabledTag(v) {
|
||||||
|
if (v === undefined || v === null || v === '') return 'info'
|
||||||
|
return String(v) === '1' ? 'success' : 'info'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 二、FIELD_DICT 实例 — 在此定义页面所需的所有字段
|
||||||
|
// ============================================================
|
||||||
|
export const FIELD_DICT: Record<string, FieldDefinition> = {
|
||||||
|
/** 类型编码(系统级 / 当前仓库自定义,仅小写字母数字下划线) */
|
||||||
|
type: {
|
||||||
|
key: 'type',
|
||||||
|
label: '类型编码',
|
||||||
|
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||||
|
table: { minWidth: 140, fixed: 'left', copyAction: 'copy', showOverflowTooltip: true },
|
||||||
|
slot: null,
|
||||||
|
detailLabel: '类型编码'
|
||||||
|
},
|
||||||
|
/** 子类型编码(所属 type 下的编码) */
|
||||||
|
sub_type: {
|
||||||
|
key: 'sub_type',
|
||||||
|
label: '子类型编码',
|
||||||
|
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||||
|
table: { minWidth: 160, fixed: 'left', copyAction: 'copy', showOverflowTooltip: true },
|
||||||
|
slot: null,
|
||||||
|
detailLabel: '子类型编码'
|
||||||
|
},
|
||||||
|
/** 所属类型名称(虚拟字段:由 afterSale.typeList 结果补全,见 enrichSubTypeRows) */
|
||||||
|
type_name: {
|
||||||
|
key: 'type_name',
|
||||||
|
label: '所属类型',
|
||||||
|
scanBox: null,
|
||||||
|
table: { minWidth: 140, showOverflowTooltip: true },
|
||||||
|
slot: null,
|
||||||
|
detailLabel: '所属类型'
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
key: 'name',
|
||||||
|
label: '名称',
|
||||||
|
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||||
|
table: { minWidth: 150, showOverflowTooltip: true },
|
||||||
|
slot: null,
|
||||||
|
detailLabel: '名称'
|
||||||
|
},
|
||||||
|
/** 数据来源:系统级(warehouse_id=null)不可改删 */
|
||||||
|
is_system: {
|
||||||
|
key: 'is_system',
|
||||||
|
label: '来源',
|
||||||
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('is_system') },
|
||||||
|
table: { minWidth: 110, align: 'center' },
|
||||||
|
slot: { type: 'tag', tagResolver: 'resolveIsSystemTag', translateField: 'is_system' },
|
||||||
|
detailLabel: '来源',
|
||||||
|
filterParamMap: { '1': 1, '0': 0 }
|
||||||
|
},
|
||||||
|
/** 启用状态:1=启用,0=停用 */
|
||||||
|
is_enabled: {
|
||||||
|
key: 'is_enabled',
|
||||||
|
label: '状态',
|
||||||
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('is_enabled') },
|
||||||
|
table: { minWidth: 100, align: 'center' },
|
||||||
|
slot: { type: 'tag', tagResolver: 'resolveIsEnabledTag', translateField: 'is_enabled' },
|
||||||
|
detailLabel: '状态',
|
||||||
|
filterParamMap: { '1': 1, '0': 0 }
|
||||||
|
},
|
||||||
|
/** 排序值:越小越靠前 */
|
||||||
|
sort_order: {
|
||||||
|
key: 'sort_order',
|
||||||
|
label: '排序',
|
||||||
|
scanBox: { type: 'number', group: SCANBOX_GROUPS.basic },
|
||||||
|
table: { minWidth: 80, align: 'center', sortable: true },
|
||||||
|
slot: null,
|
||||||
|
detailLabel: '排序'
|
||||||
|
},
|
||||||
|
created_at: {
|
||||||
|
key: 'created_at',
|
||||||
|
label: '创建时间',
|
||||||
|
scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time },
|
||||||
|
table: { minWidth: 170, sortable: true },
|
||||||
|
slot: { type: 'text', format: 'datetime' },
|
||||||
|
detailLabel: '创建时间'
|
||||||
|
},
|
||||||
|
updated_at: {
|
||||||
|
key: 'updated_at',
|
||||||
|
label: '更新时间',
|
||||||
|
scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time },
|
||||||
|
table: { minWidth: 170, sortable: true },
|
||||||
|
slot: { type: 'text', format: 'datetime' },
|
||||||
|
detailLabel: '更新时间'
|
||||||
|
},
|
||||||
|
/** 操作列(虚拟字段,仅用于表格列渲染) */
|
||||||
|
operation: {
|
||||||
|
key: 'operation',
|
||||||
|
label: '操作',
|
||||||
|
scanBox: null,
|
||||||
|
table: { minWidth: 180, fixed: 'right', align: 'center' },
|
||||||
|
slot: { type: 'operation' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 三、ColumnSlotConfig — 列单元格渲染配置
|
||||||
|
// ============================================================
|
||||||
|
export interface ColumnSlotConfig {
|
||||||
|
type: 'tag' | 'text' | 'default' | 'operation'
|
||||||
|
tagType?: string | Record<string, string>
|
||||||
|
tagResolver?: string
|
||||||
|
translateField?: string
|
||||||
|
format?: 'datetime'
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 三-A、OperationButtonConfig — 操作列按钮配置
|
||||||
|
// ============================================================
|
||||||
|
export interface OperationButtonConfig {
|
||||||
|
key: string
|
||||||
|
label: string
|
||||||
|
type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | ''
|
||||||
|
actionType: 'form' | 'action'
|
||||||
|
formKey?: string
|
||||||
|
formTitle?: string
|
||||||
|
formWidth?: string
|
||||||
|
paramMap?: Record<string, string>
|
||||||
|
extraParams?: Record<string, any>
|
||||||
|
disabledOnField?: string
|
||||||
|
confirmMessage?: string
|
||||||
|
confirmTitle?: string
|
||||||
|
confirmType?: 'warning' | 'danger' | 'info'
|
||||||
|
confirmButtonText?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 四、DetailFieldConfig / DetailSectionConfig — 明细面板配置
|
||||||
|
// ============================================================
|
||||||
|
export interface DetailFieldConfig {
|
||||||
|
key: string
|
||||||
|
label?: string
|
||||||
|
span?: number
|
||||||
|
renderType?: 'text' | 'tag' | 'pre'
|
||||||
|
tagType?: string | Record<string, string>
|
||||||
|
tagResolver?: string
|
||||||
|
translateField?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DetailSectionConfig {
|
||||||
|
title: string
|
||||||
|
columnCount: number
|
||||||
|
fields: DetailFieldConfig[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DetailTabConfig {
|
||||||
|
name: string
|
||||||
|
label: string
|
||||||
|
componentKey: string
|
||||||
|
component?: Component
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 五、TabPageApiConfig — 标签页接口插槽配置
|
||||||
|
// ============================================================
|
||||||
|
export type ApiMethod = (...args: any[]) => Promise<any>
|
||||||
|
export type ApiSource = 'api' | 'list'
|
||||||
|
export type ComponentApiConfig = { source: 'list' } | ApiMethod
|
||||||
|
|
||||||
|
export interface TabPageApiConfig {
|
||||||
|
/** 列表查询接口 */
|
||||||
|
list: ApiMethod
|
||||||
|
/** 明细面板接口(可选,不配则用 row 数据) */
|
||||||
|
detail?: ComponentApiConfig
|
||||||
|
/** 操作日志接口(可选) */
|
||||||
|
log?: ComponentApiConfig
|
||||||
|
/** 导出接口(可选) */
|
||||||
|
export?: ApiMethod
|
||||||
|
/** 导出进度查询接口(可选) */
|
||||||
|
exportProgress?: ApiMethod
|
||||||
|
/** ScanBox 下拉选项数据源接口(可选) */
|
||||||
|
scanBoxOptions?: Record<string, ApiMethod>
|
||||||
|
/** 工具栏按钮 → API 方法映射(可选) */
|
||||||
|
toolbar?: Record<string, ApiMethod>
|
||||||
|
/** 列表响应解析器 */
|
||||||
|
parseListResponse?: (res: any) => { list: any[]; total: number }
|
||||||
|
/** 构建列表请求参数 */
|
||||||
|
buildListParams?: (params: {
|
||||||
|
pagination: { page: number; pageSize: number }
|
||||||
|
conditions: Record<string, any>
|
||||||
|
sort?: { prop: string; order: string }
|
||||||
|
}) => Record<string, any>
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 六、TabPageRawConfig — 标签页声明配置(仅用 key 引用)
|
||||||
|
// ============================================================
|
||||||
|
export interface TabPageRawConfig {
|
||||||
|
name: string
|
||||||
|
label: string
|
||||||
|
scanBoxCacheKey: string
|
||||||
|
/** ScanBox 需要的字段 key 列表(从 FIELD_DICT 中查找) */
|
||||||
|
scanBoxFieldKeys: string[]
|
||||||
|
/** ScanBox 字段渲染覆盖(key → 覆写 label/type/options) */
|
||||||
|
scanBoxOverrides?: Record<string, ScanBoxFieldOverride>
|
||||||
|
/** 表格需要的列 key 列表(从 FIELD_DICT 中查找) */
|
||||||
|
tableColumnKeys: string[]
|
||||||
|
upperTableDefaults: {
|
||||||
|
title: string
|
||||||
|
enableColumnConfig?: boolean
|
||||||
|
showIndex?: boolean
|
||||||
|
showSelection?: boolean
|
||||||
|
emptyText?: string
|
||||||
|
}
|
||||||
|
/** 明细面板标签页配置 */
|
||||||
|
detailTabs?: { name: string; label: string; componentKey: string }[]
|
||||||
|
/** 明细面板分区配置(字段 key 列表,resolveTabConfig 展开) */
|
||||||
|
detailSections: {
|
||||||
|
title: string
|
||||||
|
columnCount: number
|
||||||
|
fieldKeys: string[]
|
||||||
|
}[]
|
||||||
|
/** 接口配置(有 api 时启用真实接口) */
|
||||||
|
api?: TabPageApiConfig
|
||||||
|
/** 操作列按钮配置(需 tableColumnKeys 包含 'operation') */
|
||||||
|
operationButtons?: OperationButtonConfig[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 七、TabPageConfig — 展开后的完整配置(给 index.vue 使用)
|
||||||
|
// ============================================================
|
||||||
|
export interface TabPageConfig {
|
||||||
|
name: string
|
||||||
|
label: string
|
||||||
|
scanBoxCacheKey: string
|
||||||
|
scanBoxFields: Record<string, any>[]
|
||||||
|
upperTable: {
|
||||||
|
title: string
|
||||||
|
enableColumnConfig: boolean
|
||||||
|
showIndex: boolean
|
||||||
|
showSelection: boolean
|
||||||
|
emptyText: string
|
||||||
|
columns: Record<string, any>[]
|
||||||
|
}
|
||||||
|
columnSlots: Record<string, ColumnSlotConfig>
|
||||||
|
detailConfig: DetailSectionConfig[]
|
||||||
|
detailTabs: DetailTabConfig[]
|
||||||
|
api?: TabPageApiConfig
|
||||||
|
operationButtons?: OperationButtonConfig[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 八、resolveTabConfig — 加载时将 RawConfig 展开为完整配置
|
||||||
|
// ============================================================
|
||||||
|
export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
||||||
|
// 展开 ScanBox 字段(支持按标签页覆盖 label/type/options)
|
||||||
|
const scanBoxFields: Record<string, any>[] = []
|
||||||
|
for (const key of raw.scanBoxFieldKeys) {
|
||||||
|
const def = FIELD_DICT[key]
|
||||||
|
if (!def || !def.scanBox) continue
|
||||||
|
const override = raw.scanBoxOverrides?.[key]
|
||||||
|
const options = override?.options ?? def.scanBox.options
|
||||||
|
scanBoxFields.push({
|
||||||
|
label: override?.label ?? def.label,
|
||||||
|
value: def.key,
|
||||||
|
type: override?.type ?? def.scanBox.type,
|
||||||
|
options: options ? [...options] : undefined,
|
||||||
|
group: def.scanBox.group,
|
||||||
|
required: (def.scanBox as any).required
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 展开表格列
|
||||||
|
const columns: Record<string, any>[] = []
|
||||||
|
for (const key of raw.tableColumnKeys) {
|
||||||
|
const def = FIELD_DICT[key]
|
||||||
|
if (!def || !def.table) continue
|
||||||
|
columns.push({
|
||||||
|
prop: def.key,
|
||||||
|
label: def.label,
|
||||||
|
...def.table
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 展开列插槽
|
||||||
|
const columnSlots: Record<string, ColumnSlotConfig> = {}
|
||||||
|
for (const key of raw.tableColumnKeys) {
|
||||||
|
const def = FIELD_DICT[key]
|
||||||
|
if (!def || !def.slot) continue
|
||||||
|
columnSlots[def.key] = { ...def.slot }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 展开明细面板配置
|
||||||
|
const detailConfig: DetailSectionConfig[] = raw.detailSections.map((sec) => ({
|
||||||
|
title: sec.title,
|
||||||
|
columnCount: sec.columnCount,
|
||||||
|
fields: sec.fieldKeys
|
||||||
|
.map((key): DetailFieldConfig | null => {
|
||||||
|
const def = FIELD_DICT[key]
|
||||||
|
if (!def) return null
|
||||||
|
return {
|
||||||
|
key: def.key,
|
||||||
|
label: def.detailLabel ?? def.label,
|
||||||
|
translateField: def.slot?.translateField,
|
||||||
|
tagResolver: def.slot?.tagResolver,
|
||||||
|
tagType: def.slot?.tagType,
|
||||||
|
renderType: def.slot?.type === 'tag' ? 'tag' : 'text'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter((f): f is DetailFieldConfig => f !== null)
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 展开明细标签页(解析 componentKey → Component)
|
||||||
|
const detailTabs: DetailTabConfig[] = raw.detailTabs
|
||||||
|
? raw.detailTabs.map((tab) => ({
|
||||||
|
name: tab.name,
|
||||||
|
label: tab.label,
|
||||||
|
componentKey: tab.componentKey,
|
||||||
|
component: COMPONENT_REGISTRY[tab.componentKey]
|
||||||
|
}))
|
||||||
|
: [{ name: 'detail', label: '明细', componentKey: 'DetailPanel', component: COMPONENT_REGISTRY['DetailPanel'] }]
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: raw.name,
|
||||||
|
label: raw.label,
|
||||||
|
scanBoxCacheKey: raw.scanBoxCacheKey,
|
||||||
|
scanBoxFields,
|
||||||
|
upperTable: {
|
||||||
|
title: raw.upperTableDefaults.title,
|
||||||
|
enableColumnConfig: raw.upperTableDefaults.enableColumnConfig ?? true,
|
||||||
|
showIndex: raw.upperTableDefaults.showIndex ?? true,
|
||||||
|
showSelection: raw.upperTableDefaults.showSelection ?? true,
|
||||||
|
emptyText: raw.upperTableDefaults.emptyText ?? '暂无数据',
|
||||||
|
columns
|
||||||
|
},
|
||||||
|
columnSlots,
|
||||||
|
detailConfig,
|
||||||
|
detailTabs,
|
||||||
|
api: raw.api,
|
||||||
|
operationButtons: raw.operationButtons
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 九、buildWhereConditions — 将 ScanBox 条件转为 API where 参数
|
||||||
|
// ============================================================
|
||||||
|
export function buildWhereConditions(rawConditions: Record<string, any>): Record<string, any> {
|
||||||
|
const where: Record<string, any> = {}
|
||||||
|
for (const [key, cond] of Object.entries(rawConditions || {})) {
|
||||||
|
let value: any = undefined
|
||||||
|
if (cond && typeof cond === 'object' && 'operator' in cond) {
|
||||||
|
value = (cond as any).value
|
||||||
|
} else if (cond !== undefined && cond !== null && cond !== '') {
|
||||||
|
value = Array.isArray(cond) ? cond[0] ?? '' : cond
|
||||||
|
}
|
||||||
|
if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const def = FIELD_DICT[key]
|
||||||
|
if (def?.filterParamMap) {
|
||||||
|
const mapped = def.filterParamMap[String(value)]
|
||||||
|
if (mapped !== undefined) {
|
||||||
|
where[key] = mapped
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
where[key] = value
|
||||||
|
}
|
||||||
|
return where
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 九-A、接口响应 / 排序 / 售后类型下拉 辅助
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
/** 统一判断接口响应是否成功(项目约定:code 1/200/20000 或 flag=success) */
|
||||||
|
export function isApiSuccess(res: any): boolean {
|
||||||
|
if (!res) return false
|
||||||
|
return (
|
||||||
|
res.flag === 'success' ||
|
||||||
|
res.code === 1 ||
|
||||||
|
res.code === 200 ||
|
||||||
|
res.code === 20000
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** el-table 排序方向 → 接口 sortOrder */
|
||||||
|
export function toApiSortOrder(order?: string): 'ASC' | 'DESC' {
|
||||||
|
return order === 'ascending' ? 'ASC' : 'DESC'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 售后类型下拉选项缓存
|
||||||
|
* 由 index.vue 调用 afterSale.typeList 后写入,供子类型页签的「所属类型」筛选与表单下拉复用
|
||||||
|
*/
|
||||||
|
export const afterSaleTypeOptionState: {
|
||||||
|
options: { label: string; value: string }[]
|
||||||
|
nameMap: Record<string, string>
|
||||||
|
} = {
|
||||||
|
options: [],
|
||||||
|
nameMap: {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 写入售后类型下拉选项缓存 */
|
||||||
|
export function setAfterSaleTypeOptions(list: any[]): void {
|
||||||
|
const options: { label: string; value: string }[] = []
|
||||||
|
const nameMap: Record<string, string> = {}
|
||||||
|
for (const item of list || []) {
|
||||||
|
const code = String(item?.type ?? '')
|
||||||
|
if (!code) continue
|
||||||
|
const name = String(item?.name ?? code)
|
||||||
|
options.push({ label: `${name}(${code})`, value: code })
|
||||||
|
nameMap[code] = name
|
||||||
|
}
|
||||||
|
afterSaleTypeOptionState.options = options
|
||||||
|
afterSaleTypeOptionState.nameMap = nameMap
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 按类型编码取类型名称(typeList 未加载时回退编码本身) */
|
||||||
|
export function resolveTypeName(type?: string | null): string {
|
||||||
|
if (!type) return '—'
|
||||||
|
return afterSaleTypeOptionState.nameMap[String(type)] ?? String(type)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 子类型行补全虚拟字段 type_name(依赖 afterSale.typeList 缓存) */
|
||||||
|
export function enrichSubTypeRows(list: any[]): any[] {
|
||||||
|
return (list || []).map((item) => ({
|
||||||
|
...item,
|
||||||
|
type_name: resolveTypeName(item?.type)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 十、工具栏按钮系统
|
||||||
|
// ============================================================
|
||||||
|
// 按钮分为三类:
|
||||||
|
// common — 公共按钮(刷新、导出)
|
||||||
|
// function — 功能按钮(打开表单/确认窗口)
|
||||||
|
// basic — 基础操作(字段设置、隐藏详情)
|
||||||
|
|
||||||
|
export interface ToolbarButtonConfig {
|
||||||
|
key: string
|
||||||
|
label: string
|
||||||
|
category: 'common' | 'function' | 'basic'
|
||||||
|
size?: '' | 'default' | 'small' | 'large'
|
||||||
|
type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger'
|
||||||
|
plain?: boolean
|
||||||
|
loadingKey?: string
|
||||||
|
disabledKey?: string
|
||||||
|
action: string
|
||||||
|
dynamicLabelKey?: string
|
||||||
|
onlyForTabs?: string[]
|
||||||
|
buttonType?: 'default' | 'dropdown'
|
||||||
|
dropdownOptions?: Array<{ label: string; action: string; divided?: boolean }>
|
||||||
|
formKey?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
|
||||||
|
// ===== 公共按钮 =====
|
||||||
|
refresh: {
|
||||||
|
key: 'refresh',
|
||||||
|
label: '刷新',
|
||||||
|
category: 'common',
|
||||||
|
type: 'primary',
|
||||||
|
size: 'small',
|
||||||
|
loadingKey: 'loading',
|
||||||
|
action: 'loadData'
|
||||||
|
},
|
||||||
|
// ===== 功能按钮 =====
|
||||||
|
createType: {
|
||||||
|
key: 'createType',
|
||||||
|
label: '新增类型',
|
||||||
|
category: 'function',
|
||||||
|
type: 'primary',
|
||||||
|
size: 'small',
|
||||||
|
action: 'createType',
|
||||||
|
onlyForTabs: ['type']
|
||||||
|
},
|
||||||
|
createSubType: {
|
||||||
|
key: 'createSubType',
|
||||||
|
label: '新增子类型',
|
||||||
|
category: 'function',
|
||||||
|
type: 'primary',
|
||||||
|
size: 'small',
|
||||||
|
action: 'createSubType',
|
||||||
|
onlyForTabs: ['subType']
|
||||||
|
},
|
||||||
|
// ===== 基础操作 =====
|
||||||
|
columnConfig: {
|
||||||
|
key: 'columnConfig',
|
||||||
|
label: '字段设置',
|
||||||
|
category: 'basic',
|
||||||
|
size: 'small',
|
||||||
|
action: 'openColumnConfigPanel'
|
||||||
|
},
|
||||||
|
toggleDetail: {
|
||||||
|
key: 'toggleDetail',
|
||||||
|
label: '显示详情',
|
||||||
|
category: 'basic',
|
||||||
|
dynamicLabelKey: 'detailToggleLabel',
|
||||||
|
size: 'small',
|
||||||
|
action: 'toggleDetailVisible'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 按标签页名称获取工具栏按钮列表(自动根据 PAGE_CONFIG 过滤) */
|
||||||
|
export function getTabToolbarButtons(tabName: string): ToolbarButtonConfig[] {
|
||||||
|
return Object.values(TOOLBAR_BUTTONS).filter((btn) => {
|
||||||
|
if (btn.onlyForTabs && !btn.onlyForTabs.includes(tabName)) return false
|
||||||
|
// 详情面板禁用时,隐藏「显示/隐藏详情」按钮
|
||||||
|
if (!PAGE_CONFIG.enableDetailPanel && btn.key === 'toggleDetail') return false
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 十一、批量操作配置(可选,接入 BatchOperationForm 时使用)
|
||||||
|
// ============================================================
|
||||||
|
export interface BatchOperationConfig {
|
||||||
|
action: string
|
||||||
|
title: string
|
||||||
|
confirmText: string
|
||||||
|
confirmType?: 'warning' | 'error' | 'info' | 'success'
|
||||||
|
confirmButtonText: string
|
||||||
|
successText: string
|
||||||
|
failText: string
|
||||||
|
apiMethod: (...args: any[]) => Promise<any>
|
||||||
|
payloadKey?: string
|
||||||
|
idField?: string | string[]
|
||||||
|
payloadBuilder?: (rows: Record<string, any>[]) => Record<string, any>
|
||||||
|
useProgress?: boolean
|
||||||
|
progressApiMethod?: (...args: any[]) => Promise<any>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ★ 在此配置批量操作 */
|
||||||
|
export const BATCH_OPERATION_CONFIGS: Record<string, BatchOperationConfig> = {
|
||||||
|
// batchExample: {
|
||||||
|
// action: 'batchExample',
|
||||||
|
// title: '批量操作示例',
|
||||||
|
// confirmText: '确定对选中的 {count} 项执行操作吗?',
|
||||||
|
// confirmType: 'warning',
|
||||||
|
// confirmButtonText: '确认操作',
|
||||||
|
// successText: '批量操作成功',
|
||||||
|
// failText: '批量操作失败',
|
||||||
|
// apiMethod: yourBatchApi,
|
||||||
|
// payloadKey: 'ids',
|
||||||
|
// idField: 'id'
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 十二、标签页注册表 — 在此定义你的页面标签页
|
||||||
|
// ============================================================
|
||||||
|
export const tabPages: TabPageRawConfig[] = [
|
||||||
|
// ===== 售后类型(afterSale.typeList / typeCreate / typeUpdate / typeDelete) =====
|
||||||
|
{
|
||||||
|
name: 'type',
|
||||||
|
label: '售后类型',
|
||||||
|
scanBoxCacheKey: 'afterSale-typelist-type',
|
||||||
|
scanBoxFieldKeys: ['type', 'name', 'is_system', 'is_enabled', 'sort_order', 'created_at'],
|
||||||
|
tableColumnKeys: ['type', 'name', 'is_system', 'is_enabled', 'sort_order', 'created_at', 'updated_at', 'operation'],
|
||||||
|
upperTableDefaults: {
|
||||||
|
title: '售后类型',
|
||||||
|
showIndex: true,
|
||||||
|
showSelection: false,
|
||||||
|
emptyText: '暂无售后类型,可点击「新增类型」创建仓库自定义类型'
|
||||||
|
},
|
||||||
|
detailTabs: [
|
||||||
|
{ name: 'detail', label: '明细', componentKey: 'DetailPanel' }
|
||||||
|
],
|
||||||
|
detailSections: [
|
||||||
|
{
|
||||||
|
title: '基础信息',
|
||||||
|
columnCount: 3,
|
||||||
|
fieldKeys: ['type', 'name', 'is_system', 'is_enabled', 'sort_order']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '时间信息',
|
||||||
|
columnCount: 2,
|
||||||
|
fieldKeys: ['created_at', 'updated_at']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
api: {
|
||||||
|
list: afterSaleTypeList,
|
||||||
|
detail: { source: 'list' },
|
||||||
|
parseListResponse(res) {
|
||||||
|
const data = res?.data ?? res ?? {}
|
||||||
|
const list = Array.isArray(data.list) ? data.list : []
|
||||||
|
return { list, total: Number(data.pagination?.total ?? list.length) }
|
||||||
|
},
|
||||||
|
buildListParams({ pagination, conditions, sort }) {
|
||||||
|
const where = buildWhereConditions(conditions)
|
||||||
|
return {
|
||||||
|
pagination: { page: pagination.page, pageSize: pagination.pageSize },
|
||||||
|
...(Object.keys(where).length ? { where } : {}),
|
||||||
|
...(sort?.prop && sort?.order
|
||||||
|
? { sort: { sortField: sort.prop, sortOrder: toApiSortOrder(sort.order) } }
|
||||||
|
: {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
operationButtons: [
|
||||||
|
{
|
||||||
|
key: 'edit',
|
||||||
|
label: '编辑',
|
||||||
|
actionType: 'action',
|
||||||
|
type: 'primary'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'delete',
|
||||||
|
label: '删除',
|
||||||
|
actionType: 'action',
|
||||||
|
type: 'danger',
|
||||||
|
confirmTitle: '提示',
|
||||||
|
confirmMessage: '确认删除该售后类型吗?删除后不可恢复;系统级类型不可删除,且该类型下存在自定义子类型时会删除失败',
|
||||||
|
confirmType: 'warning',
|
||||||
|
confirmButtonText: '确认删除'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// ===== 售后子类型(afterSale.subTypeList / subTypeCreate / subTypeUpdate / subTypeDelete) =====
|
||||||
|
{
|
||||||
|
name: 'subType',
|
||||||
|
label: '售后子类型',
|
||||||
|
scanBoxCacheKey: 'afterSale-typelist-subtype',
|
||||||
|
scanBoxFieldKeys: ['type', 'sub_type', 'name', 'is_system', 'is_enabled', 'sort_order', 'created_at'],
|
||||||
|
// 子类型页签的「所属类型」改为下拉(选项由 afterSale.typeList 动态注入)
|
||||||
|
scanBoxOverrides: {
|
||||||
|
type: {
|
||||||
|
label: '所属类型',
|
||||||
|
type: 'select',
|
||||||
|
options: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tableColumnKeys: ['type_name', 'sub_type', 'name', 'is_system', 'is_enabled', 'sort_order', 'created_at', 'updated_at', 'operation'],
|
||||||
|
upperTableDefaults: {
|
||||||
|
title: '售后子类型',
|
||||||
|
showIndex: true,
|
||||||
|
showSelection: false,
|
||||||
|
emptyText: '暂无售后子类型,可点击「新增子类型」创建仓库自定义子类型'
|
||||||
|
},
|
||||||
|
detailTabs: [
|
||||||
|
{ name: 'detail', label: '明细', componentKey: 'DetailPanel' }
|
||||||
|
],
|
||||||
|
detailSections: [
|
||||||
|
{
|
||||||
|
title: '基础信息',
|
||||||
|
columnCount: 3,
|
||||||
|
fieldKeys: ['type_name', 'sub_type', 'name', 'is_system', 'is_enabled', 'sort_order']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '时间信息',
|
||||||
|
columnCount: 2,
|
||||||
|
fieldKeys: ['created_at', 'updated_at']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
api: {
|
||||||
|
list: afterSaleSubTypeList,
|
||||||
|
detail: { source: 'list' },
|
||||||
|
parseListResponse(res) {
|
||||||
|
const data = res?.data ?? res ?? {}
|
||||||
|
const list = Array.isArray(data.list) ? data.list : []
|
||||||
|
return { list: enrichSubTypeRows(list), total: Number(data.pagination?.total ?? list.length) }
|
||||||
|
},
|
||||||
|
buildListParams({ pagination, conditions, sort }) {
|
||||||
|
const where = buildWhereConditions(conditions)
|
||||||
|
return {
|
||||||
|
pagination: { page: pagination.page, pageSize: pagination.pageSize },
|
||||||
|
...(Object.keys(where).length ? { where } : {}),
|
||||||
|
...(sort?.prop && sort?.order
|
||||||
|
? { sort: { sortField: sort.prop, sortOrder: toApiSortOrder(sort.order) } }
|
||||||
|
: {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
operationButtons: [
|
||||||
|
{
|
||||||
|
key: 'edit',
|
||||||
|
label: '编辑',
|
||||||
|
actionType: 'action',
|
||||||
|
type: 'primary'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'delete',
|
||||||
|
label: '删除',
|
||||||
|
actionType: 'action',
|
||||||
|
type: 'danger',
|
||||||
|
confirmTitle: '提示',
|
||||||
|
confirmMessage: '确认删除该售后子类型吗?删除后不可恢复;系统级子类型不可删除,且已被售后单引用时会删除失败',
|
||||||
|
confirmType: 'warning',
|
||||||
|
confirmButtonText: '确认删除'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 十三、向后兼容导出
|
||||||
|
// ============================================================
|
||||||
|
export const templateTabs = tabPages.map((t) => ({ name: t.name, label: t.label, scanBoxCacheKey: t.scanBoxCacheKey }))
|
||||||
|
|
||||||
801
src/views/afterSale/typelist/index.vue
Normal file
801
src/views/afterSale/typelist/index.vue
Normal file
@ -0,0 +1,801 @@
|
|||||||
|
<!--
|
||||||
|
╔══════════════════════════════════════════════════════════════╗
|
||||||
|
║ 【页面模板 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="220px"
|
||||||
|
: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>
|
||||||
|
|
||||||
|
<!-- ===== 新增/编辑弹窗(售后类型 / 售后子类型) ===== -->
|
||||||
|
<TypeFormDialog
|
||||||
|
v-model:visible="typeFormVisible"
|
||||||
|
:mode="typeFormMode"
|
||||||
|
:row="typeFormRow"
|
||||||
|
:type-options="typeOptions"
|
||||||
|
@success="handleFormSuccess"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
// ============================================================
|
||||||
|
// ★ 售后类型 / 售后子类型 管理页面
|
||||||
|
// 列表:afterSale.typeList / afterSale.subTypeList
|
||||||
|
// 增改:afterSale.typeCreate / typeUpdate / subTypeCreate / subTypeUpdate(在 pages/TypeFormDialog.vue)
|
||||||
|
// 删除:afterSale.typeDelete / afterSale.subTypeDelete
|
||||||
|
// ============================================================
|
||||||
|
defineOptions({ name: 'AfterSaleTypeList' })
|
||||||
|
|
||||||
|
import { ref, computed, onMounted, reactive } from 'vue'
|
||||||
|
import { ElMessage } 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 TypeFormDialog from './pages/TypeFormDialog.vue'
|
||||||
|
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||||
|
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||||
|
import {
|
||||||
|
afterSaleTypeList,
|
||||||
|
afterSaleTypeDelete,
|
||||||
|
afterSaleSubTypeDelete
|
||||||
|
} from '@/api/aftersale/index'
|
||||||
|
import {
|
||||||
|
PAGE_CONFIG,
|
||||||
|
tabPages,
|
||||||
|
resolveTabConfig,
|
||||||
|
getTabToolbarButtons,
|
||||||
|
isApiSuccess,
|
||||||
|
setAfterSaleTypeOptions,
|
||||||
|
afterSaleTypeOptionState,
|
||||||
|
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 ?? 'afterSale-typelist'
|
||||||
|
)
|
||||||
|
|
||||||
|
/** 售后类型下拉选项(来自 afterSale.typeList,页签切换/类型变更后刷新) */
|
||||||
|
const typeOptions = ref<{ label: string; value: string }[]>([])
|
||||||
|
|
||||||
|
/** 当前 ScanBox 筛选字段(子类型页签的「所属类型」下拉注入 afterSale.typeList 结果) */
|
||||||
|
const currentScanBoxFields = computed(() => {
|
||||||
|
const fields = currentTabConfig.value?.scanBoxFields ?? []
|
||||||
|
return fields.map((field) =>
|
||||||
|
field.value === 'type' && field.type === 'select'
|
||||||
|
? { ...field, options: typeOptions.value.map((o) => ({ ...o })) }
|
||||||
|
: field
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 当前表格列 */
|
||||||
|
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 toolbarActionMap: Record<string, () => void> = {
|
||||||
|
loadData: () => { void loadData() },
|
||||||
|
openColumnConfigPanel: () => { upperTableRef.value?.openColumnConfig?.() },
|
||||||
|
toggleDetailVisible: () => { detailVisible.value = !detailVisible.value },
|
||||||
|
createType: () => { openTypeForm('type') },
|
||||||
|
createSubType: () => { openTypeForm('subType') }
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleToolbarButtonClick(action: string) {
|
||||||
|
const handler = toolbarActionMap[action]
|
||||||
|
if (handler) {
|
||||||
|
handler()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.warn('[AfterSaleTypeList] 未处理的工具栏动作:', action)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 新增 / 编辑 / 删除弹窗(afterSale.type* / subType*)
|
||||||
|
// ============================================================
|
||||||
|
const typeFormVisible = ref(false)
|
||||||
|
const typeFormMode = ref<'type' | 'subType'>('type')
|
||||||
|
const typeFormRow = ref<Record<string, any> | null>(null)
|
||||||
|
|
||||||
|
/** 当前页签对应的弹窗模式 */
|
||||||
|
const currentFormMode = computed<'type' | 'subType'>(() =>
|
||||||
|
activeTabName.value === 'subType' ? 'subType' : 'type'
|
||||||
|
)
|
||||||
|
|
||||||
|
function openTypeForm(mode: 'type' | 'subType', row?: Record<string, any> | null) {
|
||||||
|
if (mode === 'subType' && !row && typeOptions.value.length === 0) {
|
||||||
|
ElMessage.warning('暂无可选售后类型,请先在「售后类型」页签新增类型')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
typeFormMode.value = mode
|
||||||
|
typeFormRow.value = row ?? null
|
||||||
|
typeFormVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFormSuccess() {
|
||||||
|
void reloadAfterMutation()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 加载售后类型下拉(afterSale.typeList,pageSize 上限 500) */
|
||||||
|
async function loadTypeOptions() {
|
||||||
|
try {
|
||||||
|
const res: any = await afterSaleTypeList({ pagination: { page: 1, pageSize: 500 } })
|
||||||
|
const data = res?.data ?? res ?? {}
|
||||||
|
const list = isApiSuccess(res) && Array.isArray(data.list) ? data.list : []
|
||||||
|
setAfterSaleTypeOptions(list)
|
||||||
|
typeOptions.value = afterSaleTypeOptionState.options.map((o) => ({ ...o }))
|
||||||
|
} catch {
|
||||||
|
setAfterSaleTypeOptions([])
|
||||||
|
typeOptions.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 类型/子类型变更后:刷新类型下拉缓存并重载当前列表 */
|
||||||
|
async function reloadAfterMutation() {
|
||||||
|
if (listData.value.length <= 1 && pagination.currentPage > 1) {
|
||||||
|
pagination.currentPage -= 1
|
||||||
|
}
|
||||||
|
await loadTypeOptions()
|
||||||
|
await loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 操作列按钮事件处理
|
||||||
|
// ============================================================
|
||||||
|
async function handleOperationAction(key: string, row: Record<string, any>) {
|
||||||
|
switch (key) {
|
||||||
|
case 'edit':
|
||||||
|
openTypeForm(currentFormMode.value, row)
|
||||||
|
break
|
||||||
|
case 'delete':
|
||||||
|
// 删除前确认已由操作列按钮的 confirmMessage 处理
|
||||||
|
await handleDeleteRow(currentFormMode.value, row)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
console.warn('[AfterSaleTypeList] 未处理的操作按钮:', key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除仓库自定义类型 / 子类型(系统级或已被引用时后端会拒绝并返回错误信息) */
|
||||||
|
async function handleDeleteRow(mode: 'type' | 'subType', row: Record<string, any>) {
|
||||||
|
const id = Number(row?.id)
|
||||||
|
if (!id) return
|
||||||
|
const label =
|
||||||
|
mode === 'subType'
|
||||||
|
? `子类型「${row.name ?? row.sub_type ?? id}」`
|
||||||
|
: `类型「${row.name ?? row.type ?? id}」`
|
||||||
|
try {
|
||||||
|
const res: any =
|
||||||
|
mode === 'subType' ? await afterSaleSubTypeDelete(id) : await afterSaleTypeDelete(id)
|
||||||
|
if (!isApiSuccess(res)) {
|
||||||
|
ElMessage.error(res?.message || '删除失败')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ElMessage.success(`已删除${label}`)
|
||||||
|
await reloadAfterMutation()
|
||||||
|
} catch {
|
||||||
|
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 (isApiSuccess(res)) {
|
||||||
|
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 {
|
||||||
|
// 未配置 API 时保持空列表(请在 config/template-config.ts 的 tabPages 中配置 api 字段)
|
||||||
|
listData.value = []
|
||||||
|
pagination.total = 0
|
||||||
|
}
|
||||||
|
} catch (e: any) {
|
||||||
|
console.error('[AfterSaleTypeList] 加载列表失败:', 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 (isApiSuccess(detailRes)) {
|
||||||
|
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(() => {
|
||||||
|
// 先加载类型下拉(子类型列表的「所属类型」显示依赖 typeList 结果),再加载列表
|
||||||
|
void loadTypeOptions().then(() => loadData())
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
/* 布局样式对齐 order/orderManagement(order-sub.scss) */
|
||||||
|
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||||
|
|
||||||
|
/* ================================================================
|
||||||
|
整体布局
|
||||||
|
================================================================ */
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-content-inner {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 分栏区域:布局样式由 order/orderManagement/styles/order-sub.scss 提供,此处仅补充模板特有规则 */
|
||||||
|
.split-stack {
|
||||||
|
:deep(.el-card__header) {
|
||||||
|
padding: 2px 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================================
|
||||||
|
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>
|
||||||
107
src/views/afterSale/typelist/pages/ExampleFormDialog.vue
Normal file
107
src/views/afterSale/typelist/pages/ExampleFormDialog.vue
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<!--
|
||||||
|
ExampleFormDialog — 示例表单弹窗(模板)
|
||||||
|
|
||||||
|
功能按钮对应的表单组件放在 pages/ 目录下。
|
||||||
|
|
||||||
|
使用方式:
|
||||||
|
1. 在 template-config.ts 的 COMPONENT_REGISTRY 中注册
|
||||||
|
2. 在 template-config.ts 的 TOOLBAR_BUTTONS 中添加功能按钮,设置 formKey
|
||||||
|
3. index.vue 中通过工具栏按钮触发打开
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:model-value="visible"
|
||||||
|
title="示例操作"
|
||||||
|
width="500px"
|
||||||
|
align-center
|
||||||
|
destroy-on-close
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
@closed="handleClosed"
|
||||||
|
>
|
||||||
|
<div class="form-body">
|
||||||
|
<el-form ref="formRef" :model="form" label-width="100px" size="small">
|
||||||
|
<el-form-item label="名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="description">
|
||||||
|
<el-input
|
||||||
|
v-model="form.description"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button size="small" @click="handleClosed">取消</el-button>
|
||||||
|
<el-button size="small" type="primary" :loading="submitting" @click="handleSubmit">
|
||||||
|
确认
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { reactive, ref, watch } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
|
||||||
|
defineOptions({ name: 'ExampleFormDialog' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
visible: boolean
|
||||||
|
/** 从行数据注入的初始值(由 OperationCellRenderer 的 paramMap 传递) */
|
||||||
|
id?: string | number
|
||||||
|
code?: string
|
||||||
|
name?: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:visible', v: boolean): void
|
||||||
|
(e: 'success'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const formRef = ref<any>(null)
|
||||||
|
const submitting = ref(false)
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
name: '',
|
||||||
|
description: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 重置表单
|
||||||
|
watch(() => props.visible, (v) => {
|
||||||
|
if (v) {
|
||||||
|
form.name = props.name ?? ''
|
||||||
|
form.description = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleClosed() {
|
||||||
|
emit('update:visible', false)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
submitting.value = true
|
||||||
|
try {
|
||||||
|
// ★ 替换为真实 API 调用
|
||||||
|
// const res = await yourApi.submit({ id: props.id, ...form })
|
||||||
|
await new Promise((r) => setTimeout(r, 500))
|
||||||
|
|
||||||
|
ElMessage.success('操作成功')
|
||||||
|
emit('update:visible', false)
|
||||||
|
emit('success')
|
||||||
|
} catch (e: any) {
|
||||||
|
ElMessage.error(e?.message || '操作失败')
|
||||||
|
} finally {
|
||||||
|
submitting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.form-body {
|
||||||
|
padding: 12px 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
304
src/views/afterSale/typelist/pages/TypeFormDialog.vue
Normal file
304
src/views/afterSale/typelist/pages/TypeFormDialog.vue
Normal file
@ -0,0 +1,304 @@
|
|||||||
|
<!--
|
||||||
|
TypeFormDialog — 售后类型 / 售后子类型 新增、编辑弹窗
|
||||||
|
|
||||||
|
对接接口:
|
||||||
|
类型:afterSale.typeCreate / afterSale.typeUpdate
|
||||||
|
子类型:afterSale.subTypeCreate / afterSale.subTypeUpdate
|
||||||
|
规则(见 data/module/aftersale/module.json):
|
||||||
|
- warehouse_id 由服务端注入,前端不传
|
||||||
|
- 编码仅允许 /^[a-z0-9_]+$/,type ≤20 位、sub_type ≤50 位,创建后不可修改
|
||||||
|
- 编辑仅允许改 name / is_enabled / sort_order,编码不可变
|
||||||
|
- 子类型的所属 type 必须已存在且处于启用状态
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:model-value="visible"
|
||||||
|
:title="dialogTitle"
|
||||||
|
width="520px"
|
||||||
|
align-center
|
||||||
|
destroy-on-close
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
append-to-body
|
||||||
|
@closed="handleClosed"
|
||||||
|
>
|
||||||
|
<div class="form-body">
|
||||||
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px" size="small">
|
||||||
|
<!-- 子类型:所属类型(编辑态不可改) -->
|
||||||
|
<el-form-item v-if="isSubType" label="所属类型" prop="type">
|
||||||
|
<el-select
|
||||||
|
v-model="form.type"
|
||||||
|
placeholder="请选择所属类型"
|
||||||
|
filterable
|
||||||
|
:disabled="isEdit"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="opt in typeOptions"
|
||||||
|
:key="opt.value"
|
||||||
|
:label="opt.label"
|
||||||
|
:value="opt.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<div v-if="!typeOptions.length" class="form-tip form-tip--warn">
|
||||||
|
暂无可选类型,请先在「售后类型」页签新增类型
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- 编码:类型 / 子类型;编辑态不可改 -->
|
||||||
|
<el-form-item :label="isSubType ? '子类型编码' : '类型编码'" prop="code">
|
||||||
|
<el-input
|
||||||
|
v-model="form.code"
|
||||||
|
:placeholder="codePlaceholder"
|
||||||
|
:disabled="isEdit"
|
||||||
|
:maxlength="codeMaxLength"
|
||||||
|
show-word-limit
|
||||||
|
/>
|
||||||
|
<div class="form-tip">
|
||||||
|
仅支持小写字母、数字、下划线,最长 {{ codeMaxLength }} 位;创建后不可修改
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入名称" maxlength="50" show-word-limit />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="排序" prop="sort_order">
|
||||||
|
<div class="sort-row">
|
||||||
|
<el-input-number
|
||||||
|
v-model="form.sort_order"
|
||||||
|
:min="0"
|
||||||
|
:max="99999"
|
||||||
|
:precision="0"
|
||||||
|
controls-position="right"
|
||||||
|
/>
|
||||||
|
<span class="form-tip">越小越靠前,默认 0</span>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="状态" prop="is_enabled">
|
||||||
|
<el-switch
|
||||||
|
v-model="form.is_enabled"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
active-text="启用"
|
||||||
|
inactive-text="停用"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="handleClosed">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="saving" @click="submitForm">保存</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, watch, computed } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
|
import {
|
||||||
|
afterSaleTypeCreate,
|
||||||
|
afterSaleTypeUpdate,
|
||||||
|
afterSaleSubTypeCreate,
|
||||||
|
afterSaleSubTypeUpdate
|
||||||
|
} from '@/api/aftersale/index'
|
||||||
|
import { isApiSuccess } from '../config/template-config'
|
||||||
|
|
||||||
|
defineOptions({ name: 'AfterSaleTypeFormDialog' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
visible: boolean
|
||||||
|
/** type=售后类型,subType=售后子类型 */
|
||||||
|
mode?: 'type' | 'subType'
|
||||||
|
/** 编辑态传入当前行数据 */
|
||||||
|
row?: Record<string, any> | null
|
||||||
|
/** 所属类型下拉选项(由页面调用 afterSale.typeList 后传入) */
|
||||||
|
typeOptions?: { label: string; value: string }[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:visible', val: boolean): void
|
||||||
|
(e: 'success'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const isSubType = computed(() => props.mode === 'subType')
|
||||||
|
const isEdit = computed(() => Boolean(props.row?.id))
|
||||||
|
const typeOptions = computed(() => props.typeOptions ?? [])
|
||||||
|
|
||||||
|
const dialogTitle = computed(() => {
|
||||||
|
const target = isSubType.value ? '售后子类型' : '售后类型'
|
||||||
|
return `${isEdit.value ? '编辑' : '新增'}${target}`
|
||||||
|
})
|
||||||
|
|
||||||
|
const codeMaxLength = computed(() => (isSubType.value ? 50 : 20))
|
||||||
|
const codePlaceholder = computed(() =>
|
||||||
|
isSubType.value ? '请输入子类型编码,如 damage' : '请输入类型编码,如 order'
|
||||||
|
)
|
||||||
|
|
||||||
|
const CODE_PATTERN = /^[a-z0-9_]+$/
|
||||||
|
|
||||||
|
const formRef = ref<FormInstance>()
|
||||||
|
const saving = ref(false)
|
||||||
|
|
||||||
|
const form = reactive({
|
||||||
|
id: undefined as number | undefined,
|
||||||
|
type: '',
|
||||||
|
code: '',
|
||||||
|
name: '',
|
||||||
|
sort_order: 0,
|
||||||
|
/** 1=启用,0=停用(接口 flag 约定) */
|
||||||
|
is_enabled: 1 as 0 | 1
|
||||||
|
})
|
||||||
|
|
||||||
|
const rules = computed<FormRules>(() => ({
|
||||||
|
type: [
|
||||||
|
{
|
||||||
|
required: isSubType.value,
|
||||||
|
message: '请选择所属类型',
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
code: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: isSubType.value ? '请输入子类型编码' : '请输入类型编码',
|
||||||
|
trigger: 'blur'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: CODE_PATTERN,
|
||||||
|
message: '仅支持小写字母、数字、下划线',
|
||||||
|
trigger: 'blur'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
max: codeMaxLength.value,
|
||||||
|
message: `编码长度不能超过 ${codeMaxLength.value} 位`,
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入名称', trigger: 'blur' },
|
||||||
|
{ max: 50, message: '名称长度不能超过 50 位', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}))
|
||||||
|
|
||||||
|
function resetForm() {
|
||||||
|
form.id = undefined
|
||||||
|
form.type = ''
|
||||||
|
form.code = ''
|
||||||
|
form.name = ''
|
||||||
|
form.sort_order = 0
|
||||||
|
form.is_enabled = 1
|
||||||
|
formRef.value?.clearValidate()
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(val) => {
|
||||||
|
if (!val) return
|
||||||
|
const row = props.row
|
||||||
|
if (row?.id) {
|
||||||
|
form.id = Number(row.id)
|
||||||
|
form.type = String(row.type ?? '')
|
||||||
|
form.code = String(isSubType.value ? row.sub_type ?? '' : row.type ?? '')
|
||||||
|
form.name = String(row.name ?? '')
|
||||||
|
form.sort_order = Number(row.sort_order ?? 0)
|
||||||
|
form.is_enabled = Number(row.is_enabled ?? 1) === 0 ? 0 : 1
|
||||||
|
} else {
|
||||||
|
resetForm()
|
||||||
|
}
|
||||||
|
formRef.value?.clearValidate()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function handleClosed() {
|
||||||
|
emit('update:visible', false)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitForm() {
|
||||||
|
if (!formRef.value || saving.value) return
|
||||||
|
const valid = await formRef.value.validate().catch(() => false)
|
||||||
|
if (!valid) return
|
||||||
|
|
||||||
|
const name = form.name.trim()
|
||||||
|
saving.value = true
|
||||||
|
try {
|
||||||
|
if (isEdit.value) {
|
||||||
|
if (!form.id) {
|
||||||
|
ElMessage.error('缺少主键ID')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 编辑:仅下发 name / is_enabled / sort_order(编码不可变)
|
||||||
|
const payload = {
|
||||||
|
id: form.id,
|
||||||
|
name,
|
||||||
|
is_enabled: form.is_enabled,
|
||||||
|
sort_order: form.sort_order
|
||||||
|
}
|
||||||
|
const res: any = isSubType.value
|
||||||
|
? await afterSaleSubTypeUpdate(payload)
|
||||||
|
: await afterSaleTypeUpdate(payload)
|
||||||
|
if (!isApiSuccess(res)) {
|
||||||
|
ElMessage.error(res?.message || '更新失败')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ElMessage.success('更新成功')
|
||||||
|
} else {
|
||||||
|
const code = form.code.trim()
|
||||||
|
if (!CODE_PATTERN.test(code)) {
|
||||||
|
ElMessage.error('编码仅支持小写字母、数字、下划线')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const res: any = isSubType.value
|
||||||
|
? await afterSaleSubTypeCreate({
|
||||||
|
type: form.type,
|
||||||
|
sub_type: code,
|
||||||
|
name,
|
||||||
|
sort_order: form.sort_order,
|
||||||
|
is_enabled: form.is_enabled
|
||||||
|
})
|
||||||
|
: await afterSaleTypeCreate({
|
||||||
|
type: code,
|
||||||
|
name,
|
||||||
|
sort_order: form.sort_order,
|
||||||
|
is_enabled: form.is_enabled
|
||||||
|
})
|
||||||
|
if (!isApiSuccess(res)) {
|
||||||
|
ElMessage.error(res?.message || '新增失败')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ElMessage.success('新增成功')
|
||||||
|
}
|
||||||
|
emit('update:visible', false)
|
||||||
|
emit('success')
|
||||||
|
} catch {
|
||||||
|
ElMessage.error(isEdit.value ? '更新失败' : '新增失败')
|
||||||
|
} finally {
|
||||||
|
saving.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.form-body {
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-tip {
|
||||||
|
margin-top: 2px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 18px;
|
||||||
|
color: #909399;
|
||||||
|
|
||||||
|
&--warn {
|
||||||
|
color: #e6a23c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -124,67 +124,113 @@
|
|||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
<div class="detail-container" v-loading="detailLoading">
|
<div class="detail-container" v-loading="detailLoading">
|
||||||
<div v-if="activeTab === 'detail'" class="detail-page">
|
<div v-if="activeTab === 'detail'" class="detail-page detail-panel">
|
||||||
<el-descriptions :column="2" border size="small">
|
<!-- 任务信息 -->
|
||||||
<el-descriptions-item label="任务ID">{{ detail.id ?? '—' }}</el-descriptions-item>
|
<div class="section">
|
||||||
<el-descriptions-item label="订单ID">{{ detail.order_id ?? '—' }}</el-descriptions-item>
|
<div class="section-title">任务信息</div>
|
||||||
<el-descriptions-item label="波次号">{{ detail.wave_no || '—' }}</el-descriptions-item>
|
<el-descriptions :column="4" border size="small" class="detail-descriptions">
|
||||||
<el-descriptions-item label="波次ID">{{ detail.wave_id || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="任务ID">{{ detail.id ?? '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="仓库ID">{{ detail.warehouse_id ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="订单ID">{{ detail.order_id ?? '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="工作台ID">{{ detail.workbench_id ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="波次号">{{ detail.wave_no || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="工作台名称">{{ detail.workbench_name || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="波次ID">{{ detail.wave_id || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="工作台类型">{{ detail.workbench_type || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="仓库ID">{{ detail.warehouse_id ?? '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="工作台条码">{{ detail.workbench_barcode || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="任务状态">
|
||||||
<el-descriptions-item label="打包数量">{{ detail.pack_quantity ?? '—' }}</el-descriptions-item>
|
<span :class="getStatusTextClass(statusTagType(detail.status))">
|
||||||
<el-descriptions-item label="商品数量">{{ detail.item_quantity ?? '—' }}</el-descriptions-item>
|
{{ statusLabel(detail.status) }}
|
||||||
<el-descriptions-item label="SKU数">{{ detail.sku_count ?? '—' }}</el-descriptions-item>
|
</span>
|
||||||
<el-descriptions-item label="打包员">{{ detail.operator_text || '—' }}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="打包模式">
|
<el-descriptions-item label="打包模式">
|
||||||
<span :class="getStatusTextClass(packModeTagType(detail.pack_mode))">
|
<span :class="getStatusTextClass(packModeTagType(detail.pack_mode))">
|
||||||
{{ packModeLabel(detail.pack_mode) }}
|
{{ packModeLabel(detail.pack_mode) }}
|
||||||
</span>
|
</span>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="任务状态">
|
<el-descriptions-item label="打包员">{{ detail.operator_text || '—' }}</el-descriptions-item>
|
||||||
<span :class="getStatusTextClass(statusTagType(detail.status))">
|
</el-descriptions>
|
||||||
{{ statusLabel(detail.status) }}
|
</div>
|
||||||
</span>
|
|
||||||
</el-descriptions-item>
|
<!-- 工作台信息 -->
|
||||||
<el-descriptions-item label="设备ID">{{ (detail.device_ids || []).join(',') || '—' }}</el-descriptions-item>
|
<div class="section">
|
||||||
<el-descriptions-item label="包含录像">
|
<div class="section-title">工作台信息</div>
|
||||||
<span :class="getStatusTextClass(hasVideoConfig[resolveHasVideoVal(detail)]?.tagType || 'info')">
|
<el-descriptions :column="4" border size="small" class="detail-descriptions">
|
||||||
{{ hasVideoConfig[resolveHasVideoVal(detail)]?.text || '—' }}
|
<el-descriptions-item label="工作台ID">{{ detail.workbench_id ?? '—' }}</el-descriptions-item>
|
||||||
</span>
|
<el-descriptions-item label="工作台名称">{{ detail.workbench_name || '—' }}</el-descriptions-item>
|
||||||
</el-descriptions-item>
|
<el-descriptions-item label="工作台类型">{{ detail.workbench_type || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="录像可用">
|
<el-descriptions-item label="工作台条码">{{ detail.workbench_barcode || '—' }}</el-descriptions-item>
|
||||||
<span :class="getStatusTextClass(videoEnableConfig[resolveVideoEnableVal(detail)]?.tagType || 'info')">
|
</el-descriptions>
|
||||||
{{ videoEnableConfig[resolveVideoEnableVal(detail)]?.text || '—' }}
|
</div>
|
||||||
</span>
|
|
||||||
</el-descriptions-item>
|
<!-- 打包统计 -->
|
||||||
<el-descriptions-item label="备注">{{ detail.remark || '—' }}</el-descriptions-item>
|
<div class="section">
|
||||||
<el-descriptions-item label="运单号">
|
<div class="section-title">打包统计</div>
|
||||||
<template v-if="detail.expresses && detail.expresses.length">
|
<el-descriptions :column="3" border size="small" class="detail-descriptions">
|
||||||
<el-tag v-for="(exp, i) in detail.expresses" :key="i" size="small" style="margin-right:4px;margin-bottom:2px">{{ exp.waybill_code }}</el-tag>
|
<el-descriptions-item label="打包数量">{{ detail.pack_quantity ?? '—' }}</el-descriptions-item>
|
||||||
</template>
|
<el-descriptions-item label="商品数量">{{ detail.item_quantity ?? '—' }}</el-descriptions-item>
|
||||||
<span v-else>—</span>
|
<el-descriptions-item label="SKU数">{{ detail.sku_count ?? '—' }}</el-descriptions-item>
|
||||||
</el-descriptions-item>
|
</el-descriptions>
|
||||||
<el-descriptions-item label="快递信息" :span="2">
|
</div>
|
||||||
<template v-if="detail.expresses && detail.expresses.length">
|
|
||||||
<div v-for="(exp, i) in detail.expresses" :key="i" class="express-row">
|
<!-- 录像信息 -->
|
||||||
<span>运单号:<b>{{ exp.waybill_code }}</b></span>
|
<div class="section">
|
||||||
<span v-if="exp.logistics_interface_name">接口:{{ exp.logistics_interface_name }}</span>
|
<div class="section-title">录像信息</div>
|
||||||
<span v-if="exp.platform_code">平台:{{ exp.platform_code }}</span>
|
<el-descriptions :column="3" border size="small" class="detail-descriptions">
|
||||||
<el-tag size="small" :type="exp.status === 1 ? 'success' : 'info'">
|
<el-descriptions-item label="包含录像">
|
||||||
{{ exp.status === 1 ? '已发货' : '未发货' }}
|
<span :class="getStatusTextClass(hasVideoConfig[resolveHasVideoVal(detail)]?.tagType || 'info')">
|
||||||
</el-tag>
|
{{ hasVideoConfig[resolveHasVideoVal(detail)]?.text || '—' }}
|
||||||
</div>
|
</span>
|
||||||
</template>
|
</el-descriptions-item>
|
||||||
<span v-else>—</span>
|
<el-descriptions-item label="录像可用">
|
||||||
</el-descriptions-item>
|
<span :class="getStatusTextClass(videoEnableConfig[resolveVideoEnableVal(detail)]?.tagType || 'info')">
|
||||||
<el-descriptions-item label="开始时间">{{ detail.start_time || '—' }}</el-descriptions-item>
|
{{ videoEnableConfig[resolveVideoEnableVal(detail)]?.text || '—' }}
|
||||||
<el-descriptions-item label="结束时间">{{ detail.end_time || '—' }}</el-descriptions-item>
|
</span>
|
||||||
<el-descriptions-item label="创建时间">{{ detail.create_time || '—' }}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="更新时间">{{ detail.update_time || '—' }}</el-descriptions-item>
|
<el-descriptions-item label="设备ID">{{ (detail.device_ids || []).join(',') || '—' }}</el-descriptions-item>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 运单信息 -->
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-title">运单信息</div>
|
||||||
|
<el-descriptions :column="1" border size="small" class="detail-descriptions">
|
||||||
|
<el-descriptions-item label="运单号">
|
||||||
|
<template v-if="detail.expresses && detail.expresses.length">
|
||||||
|
<el-tag v-for="(exp, i) in detail.expresses" :key="i" size="small" style="margin-right:4px;margin-bottom:2px">{{ exp.waybill_code }}</el-tag>
|
||||||
|
</template>
|
||||||
|
<span v-else>—</span>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="快递信息">
|
||||||
|
<template v-if="detail.expresses && detail.expresses.length">
|
||||||
|
<div v-for="(exp, i) in detail.expresses" :key="i" class="express-row">
|
||||||
|
<span>运单号:<b>{{ exp.waybill_code }}</b></span>
|
||||||
|
<span v-if="exp.logistics_interface_name">接口:{{ exp.logistics_interface_name }}</span>
|
||||||
|
<span v-if="exp.platform_code">平台:{{ exp.platform_code }}</span>
|
||||||
|
<el-tag size="small" :type="exp.status === 1 ? 'success' : 'info'">
|
||||||
|
{{ exp.status === 1 ? '已发货' : '未发货' }}
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<span v-else>—</span>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 时间信息 -->
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-title">时间信息</div>
|
||||||
|
<el-descriptions :column="2" border size="small" class="detail-descriptions">
|
||||||
|
<el-descriptions-item label="开始时间">{{ detail.start_time || '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="结束时间">{{ detail.end_time || '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="创建时间">{{ detail.create_time || '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="更新时间">{{ detail.update_time || '—' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 备注 -->
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-title">备注</div>
|
||||||
|
<el-descriptions :column="1" border size="small" class="detail-descriptions">
|
||||||
|
<el-descriptions-item label="备注">{{ detail.remark || '—' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="activeTab === 'videos'" class="detail-page">
|
<div v-else-if="activeTab === 'videos'" class="detail-page">
|
||||||
<template v-if="currentVideos.length">
|
<template v-if="currentVideos.length">
|
||||||
@ -809,11 +855,46 @@ onMounted(() => {
|
|||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||||
|
|
||||||
|
/* 详情区外壳与 stock/external_stock 保持一致:不留上/下间距(各 detail-page 自带
|
||||||
|
8px 上下间距),只保留左右 10px,避免与面板内边距叠加 */
|
||||||
.order-sub-container .main-content .lower-level .detail-container {
|
.order-sub-container .main-content .lower-level .detail-container {
|
||||||
padding: 6px 10px;
|
padding: 0 10px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
|
||||||
|
.detail-page {
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 任务详情面板:分区标题 + 带边框描述列表(对齐 stock/external_stock「基本信息」) */
|
||||||
|
.detail-page.detail-panel {
|
||||||
|
.section {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding-left: 8px;
|
||||||
|
border-left: 3px solid #409eff;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-descriptions :deep(.el-descriptions__label) {
|
||||||
|
width: 100px;
|
||||||
|
background: #fafbfc;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.express-row {
|
.express-row {
|
||||||
|
|||||||
@ -1,25 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="panel-stock-detail">
|
<div class="panel-stock-detail">
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<div class="panel-actions">
|
<div class="header-actions">
|
||||||
<el-button-group class="toolbar-btn-group">
|
<div class="left-actions">
|
||||||
|
<el-button
|
||||||
|
v-if="!groupByBatch"
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
:loading="loading"
|
||||||
|
@click="loadData"
|
||||||
|
>
|
||||||
|
刷新
|
||||||
|
</el-button>
|
||||||
|
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
|
v-if="!isSpaceView"
|
||||||
content="请在下方明细列表勾选一条库存记录(含库存记录 ID)"
|
content="请在下方明细列表勾选一条库存记录(含库存记录 ID)"
|
||||||
:disabled="canTransferByLocation"
|
:disabled="canTransferByLocation"
|
||||||
>
|
>
|
||||||
<span class="transfer-btn-wrap">
|
<span class="transfer-btn-wrap">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="!groupByBatch"
|
|
||||||
size="small"
|
|
||||||
:loading="loading"
|
|
||||||
@click="loadData"
|
|
||||||
>
|
|
||||||
刷新
|
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
v-if="!isSpaceView"
|
|
||||||
size="small"
|
size="small"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
:disabled="!canTransferByLocation"
|
:disabled="!canTransferByLocation"
|
||||||
@click="openTransferDialog('location')"
|
@click="openTransferDialog('location')"
|
||||||
>
|
>
|
||||||
@ -28,14 +31,15 @@
|
|||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
|
v-if="groupByBatch || isSpaceView"
|
||||||
content="请在下方列表勾选一条库位记录;仅未开启批次管理的商品支持"
|
content="请在下方列表勾选一条库位记录;仅未开启批次管理的商品支持"
|
||||||
:disabled="canTransferByProduct"
|
:disabled="canTransferByProduct"
|
||||||
>
|
>
|
||||||
<span class="transfer-btn-wrap">
|
<span class="transfer-btn-wrap">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="groupByBatch || isSpaceView"
|
|
||||||
size="small"
|
size="small"
|
||||||
type="success"
|
type="primary"
|
||||||
|
plain
|
||||||
:disabled="!canTransferByProduct"
|
:disabled="!canTransferByProduct"
|
||||||
@click="openTransferDialog('product')"
|
@click="openTransferDialog('product')"
|
||||||
>
|
>
|
||||||
@ -50,7 +54,8 @@
|
|||||||
<span class="transfer-btn-wrap">
|
<span class="transfer-btn-wrap">
|
||||||
<el-button
|
<el-button
|
||||||
size="small"
|
size="small"
|
||||||
type="warning"
|
type="primary"
|
||||||
|
plain
|
||||||
:disabled="!canEditExpiry"
|
:disabled="!canEditExpiry"
|
||||||
@click="openExpiryDialog"
|
@click="openExpiryDialog"
|
||||||
>
|
>
|
||||||
@ -58,15 +63,18 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</el-button-group>
|
</div>
|
||||||
<el-radio-group
|
|
||||||
v-if="!groupByBatch"
|
<div class="right-actions">
|
||||||
v-model="detailViewMode"
|
<el-radio-group
|
||||||
size="small"
|
v-if="!groupByBatch"
|
||||||
>
|
v-model="detailViewMode"
|
||||||
<el-radio-button value="detail">按明细</el-radio-button>
|
size="small"
|
||||||
<el-radio-button value="space">按库位汇总</el-radio-button>
|
>
|
||||||
</el-radio-group>
|
<el-radio-button value="detail">按明细</el-radio-button>
|
||||||
|
<el-radio-button value="space">按库位汇总</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
@ -191,7 +199,7 @@
|
|||||||
<div ref="tableWrapRef" class="detail-table-wrap">
|
<div ref="tableWrapRef" class="detail-table-wrap">
|
||||||
<el-table
|
<el-table
|
||||||
ref="detailTableRef"
|
ref="detailTableRef"
|
||||||
:data="detailList"
|
:data="pagedDetailList"
|
||||||
border
|
border
|
||||||
stripe
|
stripe
|
||||||
size="small"
|
size="small"
|
||||||
@ -223,8 +231,26 @@
|
|||||||
<span v-else>{{ row[col.prop] || '--' }}</span>
|
<span v-else>{{ row[col.prop] || '--' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<template #empty>
|
||||||
|
<div class="empty-tip">暂无库存明细</div>
|
||||||
|
</template>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="pagination.page"
|
||||||
|
v-model:page-size="pagination.pageSize"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:total="pagination.total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
background
|
||||||
|
size="small"
|
||||||
|
@size-change="handlePageSizeChange"
|
||||||
|
@current-change="handlePageChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -254,6 +280,36 @@ const currentRow = ref<any>(null)
|
|||||||
const tableWrapRef = ref<HTMLElement | null>(null)
|
const tableWrapRef = ref<HTMLElement | null>(null)
|
||||||
const detailTableRef = ref<any>(null)
|
const detailTableRef = ref<any>(null)
|
||||||
const selectedDetailRows = ref<any[]>([])
|
const selectedDetailRows = ref<any[]>([])
|
||||||
|
|
||||||
|
const pagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
total: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 前端分页(接口一次性返回该商品的全部库存明细行) */
|
||||||
|
const pagedDetailList = computed(() => {
|
||||||
|
const start = (pagination.page - 1) * pagination.pageSize
|
||||||
|
return detailList.value.slice(start, start + pagination.pageSize)
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 切页后把表格滚动位置归零 */
|
||||||
|
function resetTableScroll() {
|
||||||
|
nextTick(() => {
|
||||||
|
detailTableRef.value?.setScrollTop?.(0)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.page = page
|
||||||
|
resetTableScroll()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(pageSize: number) {
|
||||||
|
pagination.pageSize = pageSize
|
||||||
|
pagination.page = 1
|
||||||
|
resetTableScroll()
|
||||||
|
}
|
||||||
const tableHeight = ref<number | undefined>(undefined)
|
const tableHeight = ref<number | undefined>(undefined)
|
||||||
let tableResizeObserver: ResizeObserver | null = null
|
let tableResizeObserver: ResizeObserver | null = null
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
@ -371,6 +427,8 @@ const loadData = () => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
currentRow.value = props.row ? normalizeRow(props.row) : null
|
currentRow.value = props.row ? normalizeRow(props.row) : null
|
||||||
detailList.value = currentRow.value ? [currentRow.value] : []
|
detailList.value = currentRow.value ? [currentRow.value] : []
|
||||||
|
pagination.page = 1
|
||||||
|
pagination.total = detailList.value.length
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}, 120)
|
}, 120)
|
||||||
}
|
}
|
||||||
@ -381,9 +439,11 @@ async function loadDetailListByStockId() {
|
|||||||
if (!Number.isInteger(stockId) || stockId <= 0) {
|
if (!Number.isInteger(stockId) || stockId <= 0) {
|
||||||
currentRow.value = null
|
currentRow.value = null
|
||||||
detailList.value = []
|
detailList.value = []
|
||||||
|
pagination.total = 0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
pagination.page = 1
|
||||||
try {
|
try {
|
||||||
const isSpace = detailViewMode.value === 'space'
|
const isSpace = detailViewMode.value === 'space'
|
||||||
const payload: any = { stock_id: stockId }
|
const payload: any = { stock_id: stockId }
|
||||||
@ -398,12 +458,14 @@ async function loadDetailListByStockId() {
|
|||||||
} else {
|
} else {
|
||||||
detailList.value = []
|
detailList.value = []
|
||||||
}
|
}
|
||||||
|
pagination.total = detailList.value.length
|
||||||
await nextTick()
|
await nextTick()
|
||||||
detailTableRef.value?.clearSelection?.()
|
detailTableRef.value?.clearSelection?.()
|
||||||
currentRow.value = null
|
currentRow.value = null
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('加载库存明细失败', e)
|
console.error('加载库存明细失败', e)
|
||||||
detailList.value = []
|
detailList.value = []
|
||||||
|
pagination.total = 0
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
@ -834,12 +896,14 @@ watch(targetSpace, (val) => {
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.panel-stock-detail {
|
.panel-stock-detail {
|
||||||
padding: 10px;
|
width: 100%;
|
||||||
background: #fff;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
padding: 6px 10px 8px;
|
||||||
|
background: #fff;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
.main-content {
|
.main-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@ -849,12 +913,33 @@ watch(targetSpace, (val) => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-actions {
|
/* 按钮行(间距 6px 对齐 toolbar)+ 右侧视图切换,样式对齐 stock/external_stock */
|
||||||
padding-bottom: 8px;
|
.header-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
gap: 4px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 6px;
|
||||||
flex-shrink: 0;
|
|
||||||
|
/* 清除 Element Plus 默认按钮左边距,统一由 gap 控制等间距 */
|
||||||
|
:deep(.el-button) {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-table-wrap {
|
.detail-table-wrap {
|
||||||
@ -863,6 +948,28 @@ watch(targetSpace, (val) => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pagination-container {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 6px;
|
||||||
|
|
||||||
|
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||||
|
:deep(.el-select--small) {
|
||||||
|
width: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-input__wrapper) {
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-tip {
|
||||||
|
color: #909399;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
.transfer-btn-wrap {
|
.transfer-btn-wrap {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -434,9 +434,18 @@ async function loadData() {
|
|||||||
if (res && (res.code === 200 || res.code === 1 || res.flag === 'success')) {
|
if (res && (res.code === 200 || res.code === 1 || res.flag === 'success')) {
|
||||||
const data = res.data || res
|
const data = res.data || res
|
||||||
const rows = Array.isArray(data.list) ? data.list : []
|
const rows = Array.isArray(data.list) ? data.list : []
|
||||||
|
const batchMode = groupByBatch.value
|
||||||
|
|
||||||
list.value = rows.map((item: any) => {
|
list.value = rows.map((item: any) => {
|
||||||
const rowId = `${item.stock_id}`
|
const spaceId = item.space_id ?? item.space?.id ?? null
|
||||||
|
// 批次(明细)模式:接口逐条返回 wms_storage,行 id 即库存记录ID
|
||||||
|
// 汇总模式:按商品聚合,行上没有库存记录ID
|
||||||
|
const storageId = batchMode ? (item.storage_id ?? item.id ?? null) : (item.storage_id ?? null)
|
||||||
|
// 批次模式下同一商品会有多条批次行,行键必须逐行唯一,
|
||||||
|
// 否则列表选中行查找(selectedRow)会永远命中第一条,下方明细联动不到点击行
|
||||||
|
const rowId = batchMode
|
||||||
|
? `batch-${storageId ?? `${item.stock_id}-${spaceId ?? ''}-${item.batch_no ?? ''}-${item.inventory_type ?? ''}`}`
|
||||||
|
: `${item.stock_id}`
|
||||||
return {
|
return {
|
||||||
id: rowId,
|
id: rowId,
|
||||||
stock_id: item.stock_id,
|
stock_id: item.stock_id,
|
||||||
@ -463,8 +472,8 @@ async function loadData() {
|
|||||||
stock: item.stock || null,
|
stock: item.stock || null,
|
||||||
space: item.space || null,
|
space: item.space || null,
|
||||||
space_code: formatInventorySpaceLabel(item.space, '--'),
|
space_code: formatInventorySpaceLabel(item.space, '--'),
|
||||||
storage_id: item.storage_id ?? null,
|
storage_id: storageId,
|
||||||
space_id: item.space_id ?? item.space?.id ?? null,
|
space_id: spaceId,
|
||||||
__raw: item
|
__raw: item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -724,8 +733,10 @@ function handleImport() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 详情区外壳与 stock/external_stock 保持一致:不留上/下间距(库存明细组件自带
|
||||||
|
padding: 6px 10px 8px),只保留左右 10px,避免与组件内边距叠加 */
|
||||||
.order-sub-container .main-content .lower-level .detail-container {
|
.order-sub-container .main-content .lower-level .detail-container {
|
||||||
padding: 10px;
|
padding: 0 10px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,22 +1,38 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="transaction-detail">
|
<div class="transaction-detail detail-panel">
|
||||||
<el-descriptions :column="2" border size="small">
|
<!-- 基础信息:分区展示(对齐 stock/external_stock「基本信息」新表单设计) -->
|
||||||
<el-descriptions-item label="交易类型">
|
<div class="section">
|
||||||
<span :class="getStatusTextClass(getTransactionTypeTagType(row?.transaction_type))">
|
<div class="section-title">交易信息</div>
|
||||||
{{ getTransactionTypeText(row?.transaction_type) }}
|
<el-descriptions :column="3" border size="small" class="detail-descriptions">
|
||||||
</span>
|
<el-descriptions-item label="交易类型">
|
||||||
</el-descriptions-item>
|
<span :class="getStatusTextClass(getTransactionTypeTagType(row?.transaction_type))">
|
||||||
<el-descriptions-item label="商品ID">{{ row?.stock_id ?? '—' }}</el-descriptions-item>
|
{{ getTransactionTypeText(row?.transaction_type) }}
|
||||||
<el-descriptions-item label="库位ID">{{ row?.space_id ?? '—' }}</el-descriptions-item>
|
</span>
|
||||||
<el-descriptions-item label="仓库ID">{{ row?.warehouse_id ?? '—' }}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="货主ID">{{ row?.store_id ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="订单类型">{{ getOrderTypeLabel(row?.order_type) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="订单类型">{{ getOrderTypeLabel(row?.order_type) }}</el-descriptions-item>
|
<el-descriptions-item label="操作人">{{ row?.operator_name ?? '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="操作人">{{ row?.operator_name ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="数量">{{ row?.quantity ?? '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="数量">{{ row?.quantity ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="记录数" :span="2">{{ row?.record_count ?? '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="记录数">{{ row?.record_count ?? '—' }}</el-descriptions-item>
|
</el-descriptions>
|
||||||
<el-descriptions-item label="首次创建" :span="2">{{ formatDateTime(row?.first_created_at) }}</el-descriptions-item>
|
</div>
|
||||||
<el-descriptions-item label="最后创建" :span="2">{{ formatDateTime(row?.last_created_at) }}</el-descriptions-item>
|
|
||||||
</el-descriptions>
|
<div class="section">
|
||||||
|
<div class="section-title">商品与库位</div>
|
||||||
|
<el-descriptions :column="3" border size="small" class="detail-descriptions">
|
||||||
|
<el-descriptions-item label="商品ID">{{ row?.stock_id ?? '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="库位ID">{{ row?.space_id ?? '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="仓库ID">{{ row?.warehouse_id ?? '—' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-title">货主与时间</div>
|
||||||
|
<el-descriptions :column="3" border size="small" class="detail-descriptions">
|
||||||
|
<el-descriptions-item label="货主ID">{{ row?.store_id ?? '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="首次创建">{{ formatDateTime(row?.first_created_at) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="最后创建">{{ formatDateTime(row?.last_created_at) }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -33,7 +49,32 @@ defineProps<{
|
|||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||||
|
|
||||||
|
/* 基础信息面板:分区标题 + 带边框描述列表(对齐 stock/external_stock「基本信息」) */
|
||||||
.transaction-detail {
|
.transaction-detail {
|
||||||
padding: 12px;
|
padding: 8px 0;
|
||||||
|
|
||||||
|
.section {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding-left: 8px;
|
||||||
|
border-left: 3px solid #409eff;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-descriptions :deep(.el-descriptions__label) {
|
||||||
|
width: 120px;
|
||||||
|
background: #fafbfc;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -494,37 +494,11 @@ function handleExportAction(action: string) {
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||||
|
|
||||||
|
/* 详情区外壳与 stock/external_stock 保持一致:不留上/下间距(基础信息组件自带
|
||||||
|
padding: 8px 0),只保留左右 10px,避免与组件内边距叠加 */
|
||||||
.order-sub-container .main-content .lower-level .detail-container {
|
.order-sub-container .main-content .lower-level .detail-container {
|
||||||
padding: 10px;
|
padding: 0 10px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
:deep(.el-descriptions) {
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-descriptions__body) {
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.el-descriptions-item__cell) {
|
|
||||||
padding: 8px 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-sub-container .main-content .lower-level .detail-header {
|
|
||||||
padding: 10px;
|
|
||||||
|
|
||||||
.detail-info {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
|
|
||||||
.detail-title {
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #303133;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-tip {
|
.empty-tip {
|
||||||
|
|||||||
@ -1,34 +1,66 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="productflow-detail">
|
<div class="productflow-detail detail-panel">
|
||||||
<el-descriptions :column="2" border size="small">
|
<!-- 流水信息 -->
|
||||||
<el-descriptions-item label="流水ID">{{ row?.id ?? '—' }}</el-descriptions-item>
|
<div class="section">
|
||||||
<el-descriptions-item label="流水时间">{{ formatDateTime(row?.created_at) }}</el-descriptions-item>
|
<div class="section-title">流水信息</div>
|
||||||
<el-descriptions-item label="流水类型">
|
<el-descriptions :column="4" border size="small" class="detail-descriptions">
|
||||||
<span :class="getStatusTextClass(getTransactionTypeTag(row?.transaction_type))">
|
<el-descriptions-item label="流水ID">{{ row?.id ?? '—' }}</el-descriptions-item>
|
||||||
{{ getTransactionTypeLabel(row?.transaction_type) }}
|
<el-descriptions-item label="流水时间">{{ formatDateTime(row?.created_at) }}</el-descriptions-item>
|
||||||
</span>
|
<el-descriptions-item label="流水类型">
|
||||||
</el-descriptions-item>
|
<span :class="getStatusTextClass(getTransactionTypeTag(row?.transaction_type))">
|
||||||
<el-descriptions-item label="操作人">{{ row?.operator_name || '—' }}</el-descriptions-item>
|
{{ getTransactionTypeLabel(row?.transaction_type) }}
|
||||||
<el-descriptions-item label="商品ID">{{ row?.stock_id ?? '—' }}</el-descriptions-item>
|
</span>
|
||||||
<el-descriptions-item label="货主ID">{{ row?.store_id ?? '—' }}</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="仓库ID">{{ row?.warehouse_id ?? '—' }}</el-descriptions-item>
|
<el-descriptions-item label="操作人">{{ row?.operator_name || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="批次号">{{ row?.batch_no || '—' }}</el-descriptions-item>
|
</el-descriptions>
|
||||||
<el-descriptions-item label="变动数量">
|
</div>
|
||||||
<span :class="getQuantityClass(row)">{{ formatQuantityDisplay(row) }}</span>
|
|
||||||
</el-descriptions-item>
|
<!-- 商品与仓库 -->
|
||||||
<el-descriptions-item label="可用库存">
|
<div class="section">
|
||||||
{{ row?.before_quantity ?? '—' }} → {{ row?.after_quantity ?? '—' }}
|
<div class="section-title">商品与仓库</div>
|
||||||
</el-descriptions-item>
|
<el-descriptions :column="4" border size="small" class="detail-descriptions">
|
||||||
<el-descriptions-item label="锁定库存">
|
<el-descriptions-item label="商品ID">{{ row?.stock_id ?? '—' }}</el-descriptions-item>
|
||||||
{{ row?.before_locked_quantity ?? '—' }} → {{ row?.after_locked_quantity ?? '—' }}
|
<el-descriptions-item label="货主ID">{{ row?.store_id ?? '—' }}</el-descriptions-item>
|
||||||
</el-descriptions-item>
|
<el-descriptions-item label="仓库ID">{{ row?.warehouse_id ?? '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="订单类型">{{ getOrderTypeLabel(row?.order_type) }}</el-descriptions-item>
|
<el-descriptions-item label="批次号">{{ row?.batch_no || '—' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="订单号">{{ row?.order_no || '—' }}</el-descriptions-item>
|
</el-descriptions>
|
||||||
<el-descriptions-item label="订单ID">{{ row?.order_id || '—' }}</el-descriptions-item>
|
</div>
|
||||||
<el-descriptions-item label="收货单ID">{{ row?.receiving_id || '—' }}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="入库单ID">{{ row?.entry_order_id || '—' }}</el-descriptions-item>
|
<!-- 库存变动 -->
|
||||||
<el-descriptions-item label="备注" :span="2">{{ row?.remark || '—' }}</el-descriptions-item>
|
<div class="section">
|
||||||
</el-descriptions>
|
<div class="section-title">库存变动</div>
|
||||||
|
<el-descriptions :column="3" border size="small" class="detail-descriptions">
|
||||||
|
<el-descriptions-item label="变动数量">
|
||||||
|
<span :class="getQuantityClass(row)">{{ formatQuantityDisplay(row) }}</span>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="可用库存">
|
||||||
|
{{ row?.before_quantity ?? '—' }} → {{ row?.after_quantity ?? '—' }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="锁定库存">
|
||||||
|
{{ row?.before_locked_quantity ?? '—' }} → {{ row?.after_locked_quantity ?? '—' }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 关联单据 -->
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-title">关联单据</div>
|
||||||
|
<el-descriptions :column="3" border size="small" class="detail-descriptions">
|
||||||
|
<el-descriptions-item label="订单类型">{{ getOrderTypeLabel(row?.order_type) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="订单号">{{ row?.order_no || '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="订单ID">{{ row?.order_id || '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="收货单ID">{{ row?.receiving_id || '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="入库单ID" :span="2">{{ row?.entry_order_id || '—' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 备注 -->
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-title">备注</div>
|
||||||
|
<el-descriptions :column="1" border size="small" class="detail-descriptions">
|
||||||
|
<el-descriptions-item label="备注">{{ row?.remark || '—' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -51,8 +83,34 @@ defineProps<{
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@use "../../../order/orderManagement/styles/order-sub.scss";
|
@use "../../../order/orderManagement/styles/order-sub.scss";
|
||||||
|
|
||||||
|
/* 基础信息面板:分区标题 + 带边框描述列表(对齐货主侧 store/index.vue 与 stock/external_stock) */
|
||||||
.productflow-detail {
|
.productflow-detail {
|
||||||
padding: 12px;
|
padding: 8px 0;
|
||||||
|
|
||||||
|
.section {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding-left: 8px;
|
||||||
|
border-left: 3px solid #409eff;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-descriptions :deep(.el-descriptions__label) {
|
||||||
|
width: 100px;
|
||||||
|
background: #fafbfc;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.qty-up {
|
.qty-up {
|
||||||
|
|||||||
@ -771,12 +771,9 @@ onMounted(() => {
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 10px;
|
/* 详情区外壳不留上/下间距,由各详情组件自身控制(对齐 stock/external_stock) */
|
||||||
|
padding: 0 10px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
:deep(.el-descriptions__label) {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
:show-selection="true"
|
:show-selection="true"
|
||||||
:selectable="canDeleteDetailRow"
|
:selectable="canDeleteDetailRow"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
:query-time="queryTime"
|
:query-time="queryTime"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
@row-click="handleRowClick"
|
@row-click="handleRowClick"
|
||||||
@ -2979,9 +2980,18 @@ onUnmounted(() => {
|
|||||||
height: auto !important;
|
height: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 分页区与「操作日志」保持一致:去掉 UpperTable 默认的底部分隔线/内边距,
|
||||||
|
右对齐,仅保留 6px 上间距;左侧「已选 N 条 / 查询用时」文案一并去掉 */
|
||||||
.left-col :deep(.pagination-container) {
|
.left-col :deep(.pagination-container) {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
padding: 4px 0 2px;
|
padding: 0;
|
||||||
|
border-top: none;
|
||||||
|
margin-top: 6px;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-col :deep(.pagination-info) {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-detail-row-actions {
|
.product-detail-row-actions {
|
||||||
|
|||||||
@ -1,34 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<el-button-group class="toolbar-btn-group">
|
<div class="header-actions">
|
||||||
<el-button
|
<div class="left-actions">
|
||||||
type="primary"
|
<el-button
|
||||||
size="small"
|
size="small"
|
||||||
icon="Refresh"
|
type="primary"
|
||||||
@click="loadData"
|
:loading="loading"
|
||||||
title="刷新"
|
@click="loadData"
|
||||||
:loading="loading"
|
>
|
||||||
class="toolbar-btn"
|
刷新
|
||||||
>
|
</el-button>
|
||||||
刷新
|
|
||||||
</el-button>
|
|
||||||
|
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
size="small"
|
||||||
size="small"
|
type="primary"
|
||||||
icon="Download"
|
plain
|
||||||
@click="goToStorageLog"
|
@click="goToStorageLog"
|
||||||
title="库存流水"
|
>
|
||||||
class="toolbar-btn"
|
库存流水
|
||||||
>
|
</el-button>
|
||||||
库存流水
|
</div>
|
||||||
</el-button>
|
</div>
|
||||||
</el-button-group>
|
|
||||||
|
|
||||||
<div ref="tableHostRef" class="table-host">
|
<div ref="tableHostRef" class="table-host">
|
||||||
<el-table
|
<el-table
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
border
|
border
|
||||||
|
stripe
|
||||||
size="small"
|
size="small"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:height="tableHeight"
|
:height="tableHeight"
|
||||||
@ -65,6 +63,10 @@
|
|||||||
prop="stock_type"
|
prop="stock_type"
|
||||||
label="库存类型"
|
label="库存类型"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<template #empty>
|
||||||
|
<div class="empty-tip">暂无入库记录</div>
|
||||||
|
</template>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -74,7 +76,6 @@
|
|||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useResizeObserver } from '@vueuse/core'
|
import { useResizeObserver } from '@vueuse/core'
|
||||||
import { Refresh, Download } from '@element-plus/icons-vue'
|
|
||||||
// import * as stockApi from '@/api/stock/stock'
|
// import * as stockApi from '@/api/stock/stock'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -111,26 +112,42 @@ function loadData() {
|
|||||||
function goToStorageLog() {
|
function goToStorageLog() {
|
||||||
router.push('/storage/log')
|
router.push('/storage/log')
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleClick(row: any) {
|
|
||||||
console.log(row)
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
/* 样式对齐 stock/external_stock「外部绑定」新样式:
|
||||||
|
header-actions(按钮行,间距 6px 对齐 toolbar) + table-host(自适应剩余高度) */
|
||||||
.container {
|
.container {
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 6px 10px;
|
height: 100%;
|
||||||
|
padding: 6px 10px 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
background: #fff;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-btn-group {
|
.header-actions {
|
||||||
flex-shrink: 0;
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
gap: 4px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
|
||||||
|
/* 清除 Element Plus 默认按钮左边距,统一由 gap 控制等间距 */
|
||||||
|
:deep(.el-button) {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-host {
|
.table-host {
|
||||||
@ -139,4 +156,9 @@ function handleClick(row: any) {
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.empty-tip {
|
||||||
|
color: #909399;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1696,8 +1696,10 @@ async function handleExportAll() {
|
|||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||||
|
|
||||||
|
/* 详情区外壳与 stock/external_stock 保持一致:不留上/下间距(各详情组件自带
|
||||||
|
padding: 6px 10px 8px),只保留左右 10px,避免与组件内边距叠加 */
|
||||||
.order-sub-container .main-content .lower-level .detail-container {
|
.order-sub-container .main-content .lower-level .detail-container {
|
||||||
padding: 6px 10px;
|
padding: 0 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|||||||
@ -72,17 +72,26 @@
|
|||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
<div class="detail-container">
|
<div class="detail-container">
|
||||||
<div v-if="activeTab === 'detail'" class="detail-page">
|
<div v-if="activeTab === 'detail'" class="detail-page detail-panel">
|
||||||
<el-descriptions :column="2" border size="small">
|
<!-- 库存明细:分区展示(对齐 stock/external_stock「基本信息」新表单设计) -->
|
||||||
<el-descriptions-item
|
<div v-for="section in detailSections" :key="section.title" class="section">
|
||||||
v-for="key in detailKeys"
|
<div class="section-title">{{ section.title }}</div>
|
||||||
:key="key"
|
<el-descriptions
|
||||||
:label="fieldLabel(key)"
|
:column="DETAIL_COLUMNS"
|
||||||
:span="isWideKey(key) ? 2 : 1"
|
border
|
||||||
|
size="small"
|
||||||
|
class="detail-descriptions"
|
||||||
>
|
>
|
||||||
{{ detailValue(key) }}
|
<el-descriptions-item
|
||||||
</el-descriptions-item>
|
v-for="(key, index) in section.keys"
|
||||||
</el-descriptions>
|
:key="key"
|
||||||
|
:label="fieldLabel(key)"
|
||||||
|
:span="detailSpan(section, key, index)"
|
||||||
|
>
|
||||||
|
{{ detailValue(key) }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -131,6 +140,7 @@ import {
|
|||||||
formatReportCell,
|
formatReportCell,
|
||||||
formatReportDateTime,
|
formatReportDateTime,
|
||||||
formatReportNumber,
|
formatReportNumber,
|
||||||
|
groupReportDetailKeys,
|
||||||
normalizeScanConditionToReportWhere,
|
normalizeScanConditionToReportWhere,
|
||||||
reportFieldLabels,
|
reportFieldLabels,
|
||||||
reportScanBoxAvailableFields,
|
reportScanBoxAvailableFields,
|
||||||
@ -225,6 +235,22 @@ function fieldLabel(key: string) {
|
|||||||
return reportFieldLabels[key] || key
|
return reportFieldLabels[key] || key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 明细分区列数(对齐 stock/external_stock「基本信息」的 3 列描述列表) */
|
||||||
|
const DETAIL_COLUMNS = 3
|
||||||
|
|
||||||
|
/** 明细分区(每区一个 .section,含分区标题) */
|
||||||
|
const detailSections = computed(() =>
|
||||||
|
selectedRow.value ? groupReportDetailKeys(detailKeys.value) : []
|
||||||
|
)
|
||||||
|
|
||||||
|
/** 单元格占列数:超长文本独占整行;分区最后一行自动补齐,避免带边框表格缺角 */
|
||||||
|
function detailSpan(section: { keys: string[] }, key: string, index: number) {
|
||||||
|
if (isWideKey(key)) return DETAIL_COLUMNS
|
||||||
|
const rest = section.keys.length % DETAIL_COLUMNS
|
||||||
|
if (rest !== 0 && index === section.keys.length - 1) return DETAIL_COLUMNS - rest + 1
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
function detailValue(key: string) {
|
function detailValue(key: string) {
|
||||||
if (!selectedRow.value) return '--'
|
if (!selectedRow.value) return '--'
|
||||||
const v = (selectedRow.value as any)[key]
|
const v = (selectedRow.value as any)[key]
|
||||||
@ -513,7 +539,8 @@ onMounted(() => {
|
|||||||
.order-sub-container .main-content .lower-level .detail-container {
|
.order-sub-container .main-content .lower-level .detail-container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: 10px;
|
/* 详情区外壳不留上/下间距,由 .detail-panel 自身控制(对齐 stock/external_stock) */
|
||||||
|
padding: 0 10px;
|
||||||
|
|
||||||
:deep(.el-descriptions__body) {
|
:deep(.el-descriptions__body) {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
@ -529,6 +556,35 @@ onMounted(() => {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 库存明细面板:分区标题 + 带边框描述列表(对齐 stock/external_stock「基本信息」) */
|
||||||
|
.detail-page.detail-panel {
|
||||||
|
padding: 8px 0;
|
||||||
|
|
||||||
|
.section {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding-left: 8px;
|
||||||
|
border-left: 3px solid #409eff;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-descriptions :deep(.el-descriptions__label) {
|
||||||
|
width: 120px;
|
||||||
|
background: #fafbfc;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.no-selection {
|
.no-selection {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@ -16,6 +16,8 @@ export const reportFieldLabels: Record<string, string> = {
|
|||||||
end_time: '统计区间结束',
|
end_time: '统计区间结束',
|
||||||
warehouse_id: '仓库ID',
|
warehouse_id: '仓库ID',
|
||||||
warehouse_name: '仓库名称',
|
warehouse_name: '仓库名称',
|
||||||
|
space_id: '库位ID',
|
||||||
|
space_name: '库位'
|
||||||
}
|
}
|
||||||
|
|
||||||
const DETAIL_KEY_ORDER = [
|
const DETAIL_KEY_ORDER = [
|
||||||
@ -23,6 +25,8 @@ const DETAIL_KEY_ORDER = [
|
|||||||
'store_name',
|
'store_name',
|
||||||
'warehouse_id',
|
'warehouse_id',
|
||||||
'warehouse_name',
|
'warehouse_name',
|
||||||
|
'space_id',
|
||||||
|
'space_name',
|
||||||
'stock_id',
|
'stock_id',
|
||||||
'item_code',
|
'item_code',
|
||||||
'barcode',
|
'barcode',
|
||||||
@ -47,6 +51,7 @@ export function sortReportDetailKeys(keys: string[]) {
|
|||||||
*/
|
*/
|
||||||
export const REPORT_DETAIL_SECTIONS: { title: string; keys: string[] }[] = [
|
export const REPORT_DETAIL_SECTIONS: { title: string; keys: string[] }[] = [
|
||||||
{ title: '货主与仓库', keys: ['store_name', 'store_id', 'warehouse_name', 'warehouse_id'] },
|
{ title: '货主与仓库', keys: ['store_name', 'store_id', 'warehouse_name', 'warehouse_id'] },
|
||||||
|
{ title: '库位信息', keys: ['space_name', 'space_id'] },
|
||||||
{ title: '商品信息', keys: ['stock_id', 'item_code', 'barcode', 'item_name'] },
|
{ title: '商品信息', keys: ['stock_id', 'item_code', 'barcode', 'item_name'] },
|
||||||
{ title: '库存数量', keys: ['begin_total', 'inbound_total', 'outbound_total', 'end_total'] },
|
{ title: '库存数量', keys: ['begin_total', 'inbound_total', 'outbound_total', 'end_total'] },
|
||||||
{ title: '统计区间', keys: ['start_time', 'end_time'] }
|
{ title: '统计区间', keys: ['start_time', 'end_time'] }
|
||||||
|
|||||||
@ -1,21 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="log-container">
|
<div class="log-container">
|
||||||
<el-button-group class="toolbar-btn-group">
|
<div class="header-actions">
|
||||||
<el-button
|
<div class="left-actions">
|
||||||
type="primary"
|
<el-button
|
||||||
size="small"
|
size="small"
|
||||||
@click="fetchStockoutLogs"
|
type="primary"
|
||||||
title="刷新"
|
:loading="loading"
|
||||||
:loading="loading"
|
:disabled="!props.id"
|
||||||
:disabled="!props.id"
|
@click="fetchStockoutLogs"
|
||||||
class="toolbar-btn"
|
>
|
||||||
>
|
刷新
|
||||||
刷新
|
</el-button>
|
||||||
</el-button>
|
</div>
|
||||||
</el-button-group>
|
</div>
|
||||||
|
|
||||||
<div ref="tableHostRef" class="table-host">
|
<div ref="tableHostRef" class="table-host">
|
||||||
<el-table
|
<el-table
|
||||||
|
ref="tableRef"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
border
|
border
|
||||||
stripe
|
stripe
|
||||||
@ -86,9 +87,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, watch } from 'vue'
|
import { ref, reactive, nextTick, watch } from 'vue'
|
||||||
import { useResizeObserver } from '@vueuse/core'
|
import { useResizeObserver } from '@vueuse/core'
|
||||||
import { Refresh } from '@element-plus/icons-vue'
|
|
||||||
import { stockoutListLogs } from '@/api/storage.stockout/stockout'
|
import { stockoutListLogs } from '@/api/storage.stockout/stockout'
|
||||||
import RequestData from '@/components/RequestData/index.vue'
|
import RequestData from '@/components/RequestData/index.vue'
|
||||||
|
|
||||||
@ -102,6 +102,7 @@ const showRequestData = ref(false)
|
|||||||
const requestId = ref(0)
|
const requestId = ref(0)
|
||||||
const requestType = ref('')
|
const requestType = ref('')
|
||||||
const tableHostRef = ref<HTMLElement | null>(null)
|
const tableHostRef = ref<HTMLElement | null>(null)
|
||||||
|
const tableRef = ref<any>(null)
|
||||||
const tableHeight = ref(280)
|
const tableHeight = ref(280)
|
||||||
|
|
||||||
const pagination = reactive({
|
const pagination = reactive({
|
||||||
@ -137,15 +138,24 @@ watch(() => props.id, (newVal) => {
|
|||||||
|
|
||||||
async function handlePageChange(page: number) {
|
async function handlePageChange(page: number) {
|
||||||
pagination.page = page
|
pagination.page = page
|
||||||
|
resetTableScroll()
|
||||||
await fetchStockoutLogs()
|
await fetchStockoutLogs()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handlePageSizeChange(pageSize: number) {
|
async function handlePageSizeChange(pageSize: number) {
|
||||||
pagination.pageSize = pageSize
|
pagination.pageSize = pageSize
|
||||||
pagination.page = 1
|
pagination.page = 1
|
||||||
|
resetTableScroll()
|
||||||
await fetchStockoutLogs()
|
await fetchStockoutLogs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 切页后把表格滚动位置归零 */
|
||||||
|
function resetTableScroll() {
|
||||||
|
nextTick(() => {
|
||||||
|
tableRef.value?.setScrollTop?.(0)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchStockoutLogs() {
|
async function fetchStockoutLogs() {
|
||||||
if (!props.id) return
|
if (!props.id) return
|
||||||
|
|
||||||
@ -194,19 +204,39 @@ function backData(_row: any) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
/* 样式对齐 stock/external_stock「外部绑定」新样式:
|
||||||
|
header-actions(按钮行,间距 6px 对齐 toolbar) + table-host(自适应剩余高度) + 右对齐分页 */
|
||||||
.log-container {
|
.log-container {
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 6px 10px;
|
height: 100%;
|
||||||
|
padding: 6px 10px 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
background: #fff;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-btn-group {
|
.header-actions {
|
||||||
flex-shrink: 0;
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
gap: 4px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
|
||||||
|
/* 清除 Element Plus 默认按钮左边距,统一由 gap 控制等间距 */
|
||||||
|
:deep(.el-button) {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-host {
|
.table-host {
|
||||||
@ -221,8 +251,16 @@ function backData(_row: any) {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 8px;
|
margin-top: 6px;
|
||||||
padding-top: 4px;
|
|
||||||
|
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||||
|
:deep(.el-select--small) {
|
||||||
|
width: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-input__wrapper) {
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-drawer__body) {
|
:deep(.el-drawer__body) {
|
||||||
|
|||||||
@ -1,36 +1,61 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="stockout-product-container">
|
<div class="stockout-product-container">
|
||||||
<div v-if="orderInfo" class="order-info">
|
<div class="header-actions">
|
||||||
<span class="order-code">出库单号:{{ orderInfo.stockout_order_code }}</span>
|
<div class="left-actions">
|
||||||
|
<el-button size="small" type="primary" :loading="loading" @click="loadData">刷新</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="right-actions">
|
||||||
|
<span v-if="orderInfo" class="order-code">出库单号:{{ orderInfo.stockout_order_code }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
|
||||||
v-loading="loading"
|
<div ref="tableHostRef" class="table-host">
|
||||||
:data="data"
|
<el-table
|
||||||
border
|
ref="tableRef"
|
||||||
size="small"
|
v-loading="loading"
|
||||||
height="100%"
|
:data="pagedData"
|
||||||
style="width: 100%"
|
border
|
||||||
>
|
stripe
|
||||||
<el-table-column
|
size="small"
|
||||||
v-for="col in productColumns"
|
style="width: 100%"
|
||||||
:key="col.prop"
|
:height="tableHeight"
|
||||||
:prop="col.prop"
|
>
|
||||||
:label="col.label"
|
<el-table-column
|
||||||
:width="col.width"
|
v-for="col in productColumns"
|
||||||
:min-width="col.minWidth"
|
:key="col.prop"
|
||||||
:fixed="col.fixed"
|
:prop="col.prop"
|
||||||
:align="col.align"
|
:label="col.label"
|
||||||
|
:width="col.width"
|
||||||
|
:min-width="col.minWidth"
|
||||||
|
:fixed="col.fixed"
|
||||||
|
:align="col.align"
|
||||||
|
/>
|
||||||
|
<template #empty>
|
||||||
|
<div class="empty-tip">暂无商品明细</div>
|
||||||
|
</template>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
v-model:current-page="pagination.page"
|
||||||
|
v-model:page-size="pagination.pageSize"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:total="pagination.total"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
background
|
||||||
|
size="small"
|
||||||
|
@size-change="handlePageSizeChange"
|
||||||
|
@current-change="handlePageChange"
|
||||||
/>
|
/>
|
||||||
<template #empty>
|
</div>
|
||||||
<div style="padding: 20px; color: #909399;">暂无商品明细</div>
|
|
||||||
</template>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue'
|
import { computed, nextTick, reactive, ref, watch } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { useResizeObserver } from '@vueuse/core'
|
||||||
import { productColumns, formatStockoutListItems } from '../stockout-config'
|
import { productColumns, formatStockoutListItems } from '../stockout-config'
|
||||||
import * as stockoutApi from '@/api/storage.stockout/stockout'
|
import * as stockoutApi from '@/api/storage.stockout/stockout'
|
||||||
|
|
||||||
@ -41,12 +66,52 @@ const props = defineProps<{
|
|||||||
const data = ref<any[]>([])
|
const data = ref<any[]>([])
|
||||||
const orderInfo = ref<any>(null)
|
const orderInfo = ref<any>(null)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
const tableRef = ref<any>(null)
|
||||||
|
const tableHostRef = ref<HTMLElement | null>(null)
|
||||||
|
const tableHeight = ref(280)
|
||||||
|
|
||||||
|
const pagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
total: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 前端分页(接口一次性返回全部明细,无分页参数) */
|
||||||
|
const pagedData = computed(() => {
|
||||||
|
const start = (pagination.page - 1) * pagination.pageSize
|
||||||
|
return data.value.slice(start, start + pagination.pageSize)
|
||||||
|
})
|
||||||
|
|
||||||
|
useResizeObserver(tableHostRef, (entries) => {
|
||||||
|
const h = entries[0]?.contentRect.height ?? 0
|
||||||
|
if (h >= 100) {
|
||||||
|
tableHeight.value = Math.floor(h)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function resetTableScroll() {
|
||||||
|
nextTick(() => {
|
||||||
|
tableRef.value?.setScrollTop?.(0)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.page = page
|
||||||
|
resetTableScroll()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(pageSize: number) {
|
||||||
|
pagination.pageSize = pageSize
|
||||||
|
pagination.page = 1
|
||||||
|
resetTableScroll()
|
||||||
|
}
|
||||||
|
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
if (!props.id) return
|
if (!props.id) return
|
||||||
loading.value = true
|
loading.value = true
|
||||||
data.value = []
|
data.value = []
|
||||||
orderInfo.value = null
|
orderInfo.value = null
|
||||||
|
pagination.page = 1
|
||||||
try {
|
try {
|
||||||
const res: any = await stockoutApi.stockoutListItems({ id: Number(props.id) })
|
const res: any = await stockoutApi.stockoutListItems({ id: Number(props.id) })
|
||||||
if (res && (res.code === 200 || res.code === 1 || res.flag === 'success')) {
|
if (res && (res.code === 200 || res.code === 1 || res.flag === 'success')) {
|
||||||
@ -58,14 +123,19 @@ const loadData = async () => {
|
|||||||
? payload.items
|
? payload.items
|
||||||
: []
|
: []
|
||||||
data.value = formatStockoutListItems(rows)
|
data.value = formatStockoutListItems(rows)
|
||||||
|
pagination.total = data.value.length
|
||||||
} else {
|
} else {
|
||||||
|
pagination.total = 0
|
||||||
ElMessage.error(res?.message || '加载商品明细失败')
|
ElMessage.error(res?.message || '加载商品明细失败')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载商品明细失败', error)
|
console.error('加载商品明细失败', error)
|
||||||
|
data.value = []
|
||||||
|
pagination.total = 0
|
||||||
ElMessage.error('加载商品明细失败')
|
ElMessage.error('加载商品明细失败')
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
resetTableScroll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,22 +143,79 @@ watch(() => props.id, loadData, { immediate: true })
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
/* 样式对齐 stock/external_stock「外部绑定」新样式:
|
||||||
|
header-actions(按钮行,间距 6px 对齐 toolbar) + table-host(自适应剩余高度) + 右对齐分页 */
|
||||||
.stockout-product-container {
|
.stockout-product-container {
|
||||||
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
padding: 6px 10px 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
.order-info {
|
.header-actions {
|
||||||
padding: 6px 10px;
|
display: flex;
|
||||||
font-size: 13px;
|
justify-content: space-between;
|
||||||
color: #606266;
|
align-items: center;
|
||||||
border-bottom: 1px solid #ebeef5;
|
margin-bottom: 6px;
|
||||||
background: #fafafa;
|
flex-shrink: 0;
|
||||||
|
gap: 4px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
.order-code {
|
.left-actions {
|
||||||
font-weight: 500;
|
display: flex;
|
||||||
}
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
|
||||||
|
/* 清除 Element Plus 默认按钮左边距,统一由 gap 控制等间距 */
|
||||||
|
:deep(.el-button) {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.right-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
|
||||||
|
.order-code {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-host {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 120px;
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination-container {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 6px;
|
||||||
|
|
||||||
|
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||||
|
:deep(.el-select--small) {
|
||||||
|
width: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-input__wrapper) {
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-tip {
|
||||||
|
color: #909399;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="stockout-details-container">
|
<div class="stockout-details-container">
|
||||||
<el-form :model="form" label-width="120px" class="details-form">
|
<el-form :model="form" label-width="120px" size="small" class="details-form">
|
||||||
<el-row :gutter="30">
|
<el-row :gutter="16">
|
||||||
<el-col :span="12" v-for="field in detailpanel" :key="field.prop">
|
<el-col :span="12" v-for="field in detailpanel" :key="field.prop">
|
||||||
<el-form-item :label="field.label" :prop="field.prop">
|
<el-form-item :label="field.label" :prop="field.prop">
|
||||||
<!-- 快递编码:下拉(与“修改出库单信息”一致) -->
|
<!-- 快递编码:下拉(与“修改出库单信息”一致) -->
|
||||||
@ -78,10 +78,10 @@
|
|||||||
|
|
||||||
<div class="bottom">
|
<div class="bottom">
|
||||||
<el-button-group class="toolbar-btn-group">
|
<el-button-group class="toolbar-btn-group">
|
||||||
<el-button type="primary" icon="Check" @click="handleSave" :loading="saveLoading">
|
<el-button type="primary" size="small" icon="Check" @click="handleSave" :loading="saveLoading">
|
||||||
保存
|
保存
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="danger" icon="Refresh" @click="handleReset">
|
<el-button type="danger" size="small" icon="Refresh" @click="handleReset">
|
||||||
重置
|
重置
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
@ -237,7 +237,8 @@ onMounted(() => {
|
|||||||
.details-form {
|
.details-form {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 20px;
|
/* 面板自带内边距(对齐 stock/external_stock),宿主 .detail-container 只留左右 10px */
|
||||||
|
padding: 6px 10px 8px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
@ -251,7 +252,7 @@ onMounted(() => {
|
|||||||
.bottom {
|
.bottom {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
padding: 10px 20px;
|
padding: 6px 10px;
|
||||||
border-top: 1px solid #ebeef5;
|
border-top: 1px solid #ebeef5;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
|||||||
@ -1421,8 +1421,10 @@ function handleImport() {
|
|||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||||
|
|
||||||
|
/* 详情区外壳与 stock/external_stock 保持一致:不留上/下间距(各详情组件自带
|
||||||
|
padding: 6px 10px 8px),只保留左右 10px,避免与组件内边距叠加 */
|
||||||
.order-sub-container .main-content .lower-level .detail-container {
|
.order-sub-container .main-content .lower-level .detail-container {
|
||||||
padding: 10px;
|
padding: 0 10px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ defineProps<{
|
|||||||
.log-container {
|
.log-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 6px 10px;
|
padding: 6px 10px 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@ -188,14 +188,13 @@
|
|||||||
|
|
||||||
<div class="detail-container">
|
<div class="detail-container">
|
||||||
<div v-if="activeTab === 'balanceLogs'" class="balance-log-panel store-detail-pane">
|
<div v-if="activeTab === 'balanceLogs'" class="balance-log-panel store-detail-pane">
|
||||||
<div class="balance-log-toolbar">
|
<div class="header-actions">
|
||||||
<div class="balance-log-toolbar__left">
|
<div class="left-actions">
|
||||||
<el-button size="small" @click="loadBalanceLogs">刷新</el-button>
|
<el-button size="small" type="primary" :loading="balanceLogLoading" @click="loadBalanceLogs">刷新</el-button>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="balanceLogFilter"
|
v-model="balanceLogFilter"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="流水类型"
|
placeholder="流水类型"
|
||||||
style="width: 130px"
|
|
||||||
clearable
|
clearable
|
||||||
@change="handleBalanceLogFilterChange"
|
@change="handleBalanceLogFilterChange"
|
||||||
>
|
>
|
||||||
@ -210,26 +209,28 @@
|
|||||||
start-placeholder="开始时间"
|
start-placeholder="开始时间"
|
||||||
end-placeholder="结束时间"
|
end-placeholder="结束时间"
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
style="width: 380px"
|
|
||||||
@change="handleBalanceLogFilterChange"
|
@change="handleBalanceLogFilterChange"
|
||||||
/>
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="hasPermission('storeWarehouse.store.exportPrintQuantityLogs')"
|
v-if="hasPermission('storeWarehouse.store.exportPrintQuantityLogs')"
|
||||||
size="small"
|
size="small"
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
:loading="exportLoading"
|
:loading="exportLoading"
|
||||||
@click="handleExportBalanceLogs"
|
@click="handleExportBalanceLogs"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div ref="balanceLogTableHostRef" class="table-host">
|
||||||
<el-table
|
<el-table
|
||||||
|
ref="balanceLogTableRef"
|
||||||
v-loading="balanceLogLoading"
|
v-loading="balanceLogLoading"
|
||||||
:data="balanceLogList"
|
:data="balanceLogList"
|
||||||
border
|
border
|
||||||
|
stripe
|
||||||
size="small"
|
size="small"
|
||||||
height="100%"
|
:height="balanceLogTableHeight"
|
||||||
class="balance-log-table"
|
class="balance-log-table"
|
||||||
empty-text="暂无余额变动记录"
|
|
||||||
>
|
>
|
||||||
<el-table-column type="index" label="#" width="58" :index="computeBalanceLogIndex" align="center" />
|
<el-table-column type="index" label="#" width="58" :index="computeBalanceLogIndex" align="center" />
|
||||||
<el-table-column prop="created_at" label="变动时间" min-width="160">
|
<el-table-column prop="created_at" label="变动时间" min-width="160">
|
||||||
@ -277,10 +278,17 @@
|
|||||||
{{ getBalanceLogReason(row) || '—' }}
|
{{ getBalanceLogReason(row) || '—' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<template #empty>
|
||||||
|
<div class="empty-tip">暂无余额变动记录</div>
|
||||||
|
</template>
|
||||||
</el-table>
|
</el-table>
|
||||||
<div class="balance-log-pagination">
|
</div>
|
||||||
|
|
||||||
|
<div class="pagination-container">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
background
|
background
|
||||||
|
size="small"
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
:total="balanceLogPagination.total"
|
:total="balanceLogPagination.total"
|
||||||
:current-page="balanceLogPagination.currentPage"
|
:current-page="balanceLogPagination.currentPage"
|
||||||
@ -1038,7 +1046,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, computed, watch } from 'vue'
|
import { ref, reactive, onMounted, computed, watch, nextTick } from 'vue'
|
||||||
|
import { useResizeObserver } from '@vueuse/core'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { Plus, Refresh, QuestionFilled, Link } from '@element-plus/icons-vue'
|
import { Plus, Refresh, QuestionFilled, Link } from '@element-plus/icons-vue'
|
||||||
import { storeWarehouseList, storeWarehouseUnbind,
|
import { storeWarehouseList, storeWarehouseUnbind,
|
||||||
@ -1098,6 +1107,23 @@ const list = ref<any[]>([])
|
|||||||
const selectionRows = ref<any[]>([])
|
const selectionRows = ref<any[]>([])
|
||||||
const selectedRow = ref<any>(null)
|
const selectedRow = ref<any>(null)
|
||||||
const tableRef = ref<any>(null)
|
const tableRef = ref<any>(null)
|
||||||
|
const balanceLogTableRef = ref<any>(null)
|
||||||
|
const balanceLogTableHostRef = ref<HTMLElement | null>(null)
|
||||||
|
const balanceLogTableHeight = ref(280)
|
||||||
|
|
||||||
|
useResizeObserver(balanceLogTableHostRef, (entries) => {
|
||||||
|
const h = entries[0]?.contentRect.height ?? 0
|
||||||
|
if (h >= 100) {
|
||||||
|
balanceLogTableHeight.value = Math.floor(h)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 切页后把表格滚动位置归零 */
|
||||||
|
function resetBalanceLogScroll() {
|
||||||
|
nextTick(() => {
|
||||||
|
balanceLogTableRef.value?.setScrollTop?.(0)
|
||||||
|
})
|
||||||
|
}
|
||||||
const scanBox = ref<any>(null)
|
const scanBox = ref<any>(null)
|
||||||
|
|
||||||
const activeTab = ref('balanceLogs')
|
const activeTab = ref('balanceLogs')
|
||||||
@ -1605,12 +1631,14 @@ async function loadBalanceLogs() {
|
|||||||
|
|
||||||
function handleBalanceLogPageChange(page: number) {
|
function handleBalanceLogPageChange(page: number) {
|
||||||
balanceLogPagination.currentPage = page
|
balanceLogPagination.currentPage = page
|
||||||
|
resetBalanceLogScroll()
|
||||||
void loadBalanceLogs()
|
void loadBalanceLogs()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleBalanceLogSizeChange(size: number) {
|
function handleBalanceLogSizeChange(size: number) {
|
||||||
balanceLogPagination.pageSize = size
|
balanceLogPagination.pageSize = size
|
||||||
balanceLogPagination.currentPage = 1
|
balanceLogPagination.currentPage = 1
|
||||||
|
resetBalanceLogScroll()
|
||||||
void loadBalanceLogs()
|
void loadBalanceLogs()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2701,7 +2729,8 @@ onMounted(() => {
|
|||||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||||
|
|
||||||
.order-sub-container .main-content .lower-level .detail-container {
|
.order-sub-container .main-content .lower-level .detail-container {
|
||||||
padding: 6px 10px;
|
/* 详情区外壳不留上/下间距(各详情面板自带 padding,对齐 stock/external_stock) */
|
||||||
|
padding: 0 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -2795,38 +2824,74 @@ onMounted(() => {
|
|||||||
.balance-log-panel {
|
.balance-log-panel {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
padding: 6px 10px 8px;
|
||||||
|
background: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
.balance-log-toolbar {
|
/* 按钮行(间距 6px 对齐 toolbar),样式对齐 stock/external_stock */
|
||||||
|
.header-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 6px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
gap: 4px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
&__left {
|
/* 筛选控件固定宽度、不参与拉伸:Element Plus 的 .el-select 默认 width:100%,
|
||||||
display: flex;
|
.el-date-editor 自带 flex-grow:1,放在弹性行里会被水平拉长。
|
||||||
align-items: center;
|
下拉 110px;时间范围 340px(实测:完整 YYYY-MM-DD HH:mm:ss 每侧输入框需 ~118px,
|
||||||
gap: 8px;
|
340px 仍有富余,320px 为刚好放下,低于 300px 秒数会被截断) */
|
||||||
|
:deep(.el-select) {
|
||||||
|
width: 110px;
|
||||||
|
flex: 0 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__meta {
|
:deep(.el-date-editor) {
|
||||||
display: inline-flex;
|
width: 340px;
|
||||||
gap: 14px;
|
flex: 0 1 auto;
|
||||||
color: var(--el-text-color-secondary);
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.balance-log-table {
|
.left-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
/* 清除 Element Plus 默认按钮左边距,统一由 gap 控制间距 */
|
||||||
|
:deep(.el-button) {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-host {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 120px;
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.balance-log-pagination {
|
.pagination-container {
|
||||||
margin-top: 10px;
|
flex-shrink: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 6px;
|
||||||
|
|
||||||
|
/* 每页条数下拉框与 UpperTable 的分页器保持一致 */
|
||||||
|
:deep(.el-select--small) {
|
||||||
|
width: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-input__wrapper) {
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.open-account-form-grid {
|
.open-account-form-grid {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user