feat(inbox): 自动回复/会话页面改版,权限管理迁移 UpperTable,统一状态文本样式

自动回复(inbox/autoReply)
- 页面改为「左侧类型/子类型树 + 右侧配置区」两栏布局,树支持按类型名/子类型搜索
- 右侧类型信息与子类型列表重排:子类型改用 UpperTable,操作收敛为「配置 / 编辑 / 删除」链接按钮
- FunctionPanel / GroupPanel / NumberRulePanel 改用 UpperTable(统一 table-id、行 key 与列定义)
- KeywordPanel 关键词编辑改为 task-panel 弹窗,补充字段说明文案
- panel.scss 增补共享面板样式,减少各面板重复定义

会话消息(inbox/message)
- 会话链路由行内展开改为 task-panel 弹窗,时间线重做(收发方向标签、时间右对齐、
  消息卡片悬停态),支持直接「回复」并在弹窗内展示收发条数统计

品牌 Logo(frontBrand / Navbar / login)
- 新增 DEFAULT_BRAND_LOGO 常量与 isBrandExemptHost 计算属性
- 品牌豁免域名(主域名)恒用前端默认 Logo,不再消费后端 logo_url
- 登录页与顶栏统一改用该常量,修正兜底路径 '../../../public/logo/1.png'

权限管理(setting/permission)
- 列表迁移到 UpperTable(permissionColumns 抽到 permission-config)
- 新增「路径 / 名称 / 标题」关键字过滤、客户端分页、工具栏按钮组与批量删除(按勾选态置灰)

通用组件
- UpperTable 新增 selectionMode='native':树形表格使用原生勾选列,展开箭头不再挤占勾选列,
  并统一勾选框尺寸与行高
- 消息模块 DocSearchPicker 改为「单行筛选 + 表格填满高度 + 底部内嵌分页」,
  新增重置、已选提示(多选时提示只取第一条)

样式与交互统一
- 售后类型列表/详情、账号角色列的状态标签改为 ut-status-text 彩色文本(去掉 el-tag 色块)
- 售后列表、拣货车、打印电脑/工作台模板配置的工具栏按钮统一为
  refresh / setting / action / cancel 四类,批量操作按 noSelection 置灰
- ExpressWaybillPanel 表格内容居中;绑定包材弹窗成功后直接关闭并移除结果展示区
- 隐藏拣货车「详情」入口与角色树面板头部
This commit is contained in:
yin 2026-11-01 18:07:39 +08:00
parent 6053b8916f
commit 7958f0fd12
28 changed files with 2162 additions and 994 deletions

View File

@ -13,6 +13,7 @@
@row-click="handleRowClick"
@row-contextmenu="handleRowContextMenu"
@sort-change="handleSortChange"
@selection-change="handleSelectionChangeEvent"
style="width: 100%"
:size="tableSize"
:border="border"
@ -26,8 +27,17 @@
:span-method="spanMethod"
height="100%"
>
<!-- 原生选择列:selectionMode='native'(树形表格推荐,展开箭头落在首个数据列) -->
<el-table-column
v-if="showSelection && selectionMode === 'native'"
type="selection"
:width="selectionColumnWidth"
fixed="left"
:selectable="selectable"
/>
<!-- 自定义选择列 -->
<el-table-column v-if="showSelection" :width="selectionColumnWidth" fixed="left">
<el-table-column v-else-if="showSelection" :width="selectionColumnWidth" fixed="left">
<!-- 表头 -->
<template #header>
<div class="custom-selection-header" @click.stop="toggleAllSelection">
@ -461,6 +471,16 @@ const props = defineProps({
type: Boolean,
default: false,
},
/**
* 选择列模式:
* - custom(默认):自带居中勾选列,支持虚拟滚动 / 外部选中同步
* - native:el-table 原生 type="selection",树形表格用它可避免展开箭头占用勾选列(行高与位置正常)
*/
selectionMode: {
type: String,
default: 'custom',
validator: (value: string) => ['custom', 'native'].includes(value),
},
// 是否显示展开行(展开内容由 expand 插槽提供)
showExpand: {
type: Boolean,
@ -914,6 +934,13 @@ watch(selectedRows, (newVal) => {
emit('selection-change', [...newVal])
}, { deep: true })
/** 原生选择列(selectionMode='native')的勾选同步:回写 selectedRows,复用统一的 selection-change 事件 */
function handleSelectionChangeEvent(rows: any[]) {
if (props.selectionMode !== 'native') return
selectedRows.value = [...rows]
selectedRowKeys.value = new Set(rows.map((row: any) => getRowKey(row)))
}
// Lifecycle
onMounted(() => {
initTableMode()
@ -2216,6 +2243,25 @@ watch(
pointer-events: none; /* 让父元素处理点击事件 */
}
/* native 勾选列(type="selection"):尺寸对齐自定义勾选列,避免树形表格行高 / 勾选框比其它列表页小一圈 */
:deep(.el-table-column--selection .cell) {
display: flex;
align-items: center;
justify-content: center;
height: 32px;
padding: 0;
}
:deep(.el-table-column--selection .el-checkbox) {
height: auto;
margin: 0;
}
:deep(.el-table-column--selection .el-checkbox__inner) {
width: 14px;
height: 14px;
}
:deep(.virtual-spacer-row td) {
padding: 0 !important;
border: 0 !important;

View File

@ -95,7 +95,7 @@ import { ChatDotRound } from '@element-plus/icons-vue'
import { useAppStore } from '@/stores/modules/app'
import { useUserStore } from '@/stores/modules/user'
import { useSettingsStore } from '@/stores/modules/settings'
import { useFrontBrandStore } from '@/stores/modules/frontBrand'
import { useFrontBrandStore, DEFAULT_BRAND_LOGO } from '@/stores/modules/frontBrand'
import { useAiStore } from '@/stores/modules/ai'
import { useRouter, useRoute } from 'vue-router'
import Breadcrumb from '@/components/Breadcrumb/index.vue'
@ -120,9 +120,9 @@ const sidebar = computed(() => appStore.sidebar)
const user = computed(() => userStore.user)
const avatar = computed(() => userStore.avatar)
// 主页面/顶栏 logo:优先主题约定 mainLogoUrl(theme.mainLogoUrl),缺省用默认图片
// 主页面/顶栏 logo:优先品牌 logo_url,缺省(含品牌豁免域名)用前端默认图片
const frontBrandStore = useFrontBrandStore()
const mainLogo = computed(() => frontBrandStore.themeMainLogoUrl || '/logo/1.png')
const mainLogo = computed(() => frontBrandStore.themeMainLogoUrl || DEFAULT_BRAND_LOGO)
const device = computed(() => appStore.device)
const layoutMode = computed(() => settingsStore.layoutMode)

View File

@ -46,6 +46,12 @@ export function getMainDomainHosts(): string[] {
return Array.from(FRONT_BRAND_EXEMPT_HOSTS)
}
/**
* 前端默认品牌 Logo(public/logo/1.png,部署后即 /logo/1.png)。
* 登录页与顶栏(Navbar)共用同一常量,避免出现「相对路径 /public/...」这类解析错误的兜底地址。
*/
export const DEFAULT_BRAND_LOGO = '/logo/1.png'
/**
* 当前访问域名是否为主域名(= 品牌豁免域名,来源 VITE_FRONT_CONFIG_EXEMPT_HOSTS)。
* 用途:微信小程序授权页只能从主域名进入(自持域名下微信授权回调无法回到本系统),
@ -69,6 +75,14 @@ export const useFrontBrandStore = defineStore('frontBrand', () => {
/** 品牌配置;null=使用系统默认品牌 */
const brand = ref<FrontConfigPublicItem | null>(null)
/** 当前访问域名(归一化) */
const currentHost = normalizeFrontHost(typeof window !== 'undefined' ? window.location.hostname : '')
/**
* 当前访问域名是否命中品牌豁免(主域名,见 VITE_FRONT_CONFIG_EXEMPT_HOSTS)。
* 命中时不拉取后端品牌,登录页 / 顶栏一律使用前端默认 Logo 与默认标题。
*/
const isBrandExemptHost = computed(() => Boolean(currentHost) && FRONT_BRAND_EXEMPT_HOSTS.has(currentHost))
/** 历史 theme 约定键(曾承载 网页名称/主页面logo/登录页logo/登录页文字):现由品牌顶层字段(title/logo_url 等)配置,
* 不再从 theme 语义消费;此处仅用于 applyThemeCssVars 排除,避免历史残留污染自定义 CSS 变量 */
const FRONT_THEME_DEFAULT_KEYS = ['siteName', 'mainLogoUrl', 'loginLogoUrl', 'loginText'] as const
@ -94,10 +108,14 @@ export const useFrontBrandStore = defineStore('frontBrand', () => {
const siteName = computed(() => brand.value?.title?.trim() || defaultSettings.title || '天豹云仓')
/** 登录页文字(slogan):无独立配置字段时为默认文案(登录页用默认标语)。不再从 theme 约定 loginText */
const themeLoginText = computed(() => '')
/** 登录页 logo:品牌顶层 logo_url(空→调用方用默认图片)。不再从 theme 约定 loginLogoUrl */
const themeLoginLogoUrl = computed(() => brand.value?.logo_url?.trim() || '')
/** 主页面/顶栏 logo:品牌顶层 logo_url(空→调用方用默认图片)。不再从 theme 约定 mainLogoUrl */
const themeMainLogoUrl = computed(() => brand.value?.logo_url?.trim() || '')
/** 登录页 logo:品牌顶层 logo_url(空→调用方用默认图片)。豁免域名恒为空,强制走前端默认 Logo */
const themeLoginLogoUrl = computed(() =>
isBrandExemptHost.value ? '' : brand.value?.logo_url?.trim() || ''
)
/** 主页面/顶栏 logo:品牌顶层 logo_url(空→调用方用默认图片)。豁免域名恒为空,强制走前端默认 Logo */
const themeMainLogoUrl = computed(() =>
isBrandExemptHost.value ? '' : brand.value?.logo_url?.trim() || ''
)
/** 站点标题/网页名称(theme.siteName 或品牌 title,最后回退系统默认标题 settings.title) */
const siteTitle = computed(() => siteName.value)
@ -225,6 +243,7 @@ export const useFrontBrandStore = defineStore('frontBrand', () => {
return {
loaded,
brand,
isBrandExemptHost,
themeObj,
siteName,
siteTitle,

View File

@ -358,6 +358,8 @@ export const afterSaleColumns = [
]
// -------------------- 工具栏按钮 --------------------
// 批量类按钮统一按「勾选态」控制可用性(disabledKey: noSelection),
// 与 order/waveOrder「团购波次」工具栏按钮规则一致:未勾选置灰,勾选后可点击。
export const afterSaleToolbarButtons: ToolbarButtonConfig[] = [
{ key: 'refresh', label: '刷新', category: 'refresh', size: 'small', loadingKey: 'loading', action: 'refresh' },
{
@ -374,9 +376,33 @@ export const afterSaleToolbarButtons: ToolbarButtonConfig[] = [
],
},
{ key: 'columnConfig', label: '字段设置', category: 'setting', size: 'small', action: 'openColumnConfigPanel' },
{ key: 'batchPendingFeedback', label: '设为待反馈', category: 'action', size: 'small', loadingKey: 'batchPendingFeedbackLoading', action: 'batchSetPendingFeedback' },
{ key: 'batchComplete', label: '批量完成', category: 'action', size: 'small', loadingKey: 'batchCompleteLoading', action: 'batchComplete' },
{ key: 'batchClose', label: '批量关闭', category: 'cancel', size: 'small', loadingKey: 'batchCloseLoading', action: 'batchClose' },
{
key: 'batchPendingFeedback',
label: '设为待反馈',
category: 'action',
size: 'small',
disabledKey: 'noSelection',
loadingKey: 'batchPendingFeedbackLoading',
action: 'batchSetPendingFeedback',
},
{
key: 'batchComplete',
label: '批量完成',
category: 'action',
size: 'small',
disabledKey: 'noSelection',
loadingKey: 'batchCompleteLoading',
action: 'batchComplete',
},
{
key: 'batchClose',
label: '批量关闭',
category: 'cancel',
size: 'small',
disabledKey: 'noSelection',
loadingKey: 'batchCloseLoading',
action: 'batchClose',
},
]

View File

@ -381,7 +381,8 @@ const buttonLoadingMap = computed(() => ({
}))
const buttonDisabledMap = computed(() => ({
batchPendingFeedbackDisabled: selectedRows.value.length === 0,
// 与 order/waveOrder「团购波次」一致:未勾选时批量操作按钮置灰(noSelection)
noSelection: selectedRows.value.length === 0,
}))
const buttonLabelMap = computed(() => ({}))

View File

@ -1,8 +1,8 @@
<!--
ColumnCellRenderer — 通用表格列渲染器
根据传入的 ColumnSlotConfig 决定如何渲染单元格:
- type='tag' → el-tag(支持 tagResolver / tagType 颜色映射)
- type='tag' → 彩色状态文本(与 order/waveOrder 的 ut-status-text 一致,无色块背景)
- type='text' → 纯文本(支持 datetime 格式化)
- type='default' → 默认插槽渲染
- type='operation' → 操作列(由 OperationCellRenderer 处理)
@ -12,9 +12,7 @@
<slot />
</template>
<template v-else-if="config.type === 'tag'">
<el-tag size="small" :type="resolvedTagType">
{{ displayValue }}
</el-tag>
<span class="ut-status-text" :class="tagTextClass">{{ displayValue }}</span>
</template>
<template v-else>
<span>{{ displayValue }}</span>
@ -61,5 +59,40 @@ const resolvedTagType = computed(() => {
// 最后使用固定值
return (typeof tagType === 'string' ? tagType : 'info')
})
/** 状态文本配色类:对齐 order/waveOrder 的 ut-status-text--xxx(彩色文字,无色块背景) */
const tagTextClass = computed(() => {
const tagType = resolvedTagType.value
return tagType ? `ut-status-text--${tagType}` : ''
})
</script>
<style scoped lang="scss">
/* 轻量状态文本(与 order/orderManagement/styles/order-sub.scss 的 .ut-status-text 一致) */
.ut-status-text {
font-size: 12px;
line-height: 18px;
white-space: nowrap;
}
.ut-status-text--primary {
color: var(--el-color-primary);
}
.ut-status-text--success {
color: var(--el-color-success);
}
.ut-status-text--warning {
color: var(--el-color-warning);
}
.ut-status-text--info {
color: var(--el-color-info);
}
.ut-status-text--danger {
color: var(--el-color-danger);
}
</style>

View File

@ -19,11 +19,14 @@
:label="field.label"
:span="field.span ?? 1"
>
<!-- tag 渲染 -->
<!-- tag 渲染:彩色纯文本(与 order/waveOrder 的 ut-status-text 一致,无色块背景) -->
<template v-if="field.renderType === 'tag'">
<el-tag size="small" :type="resolveTagType(field, getRowData()?.[field.key])">
<span
class="ut-status-text"
:class="`ut-status-text--${resolveTagType(field, getRowData()?.[field.key])}`"
>
{{ resolveDisplayValue(field, getRowData()?.[field.key]) }}
</el-tag>
</span>
</template>
<!-- pre 渲染 -->
<template v-else-if="field.renderType === 'pre'">
@ -182,4 +185,31 @@ function resolveTagType(field: DetailFieldConfig, value: any): string {
white-space: pre-wrap;
color: #606266;
}
/* 轻量状态文本(与 order/orderManagement/styles/order-sub.scss 的 .ut-status-text 一致) */
.ut-status-text {
font-size: 13px;
line-height: 20px;
white-space: nowrap;
}
.ut-status-text--primary {
color: var(--el-color-primary);
}
.ut-status-text--success {
color: var(--el-color-success);
}
.ut-status-text--warning {
color: var(--el-color-warning);
}
.ut-status-text--info {
color: var(--el-color-info);
}
.ut-status-text--danger {
color: var(--el-color-danger);
}
</style>

View File

@ -1,12 +1,11 @@
<template>
<div class="ar-panel">
<div class="ar-panel-toolbar">
<div class="ar-panel-toolbar-left">
<span class="ar-panel-tip">
按顺序执行关联函数,可用性由代码注册表决定
</span>
<div class="ar-toolbar">
<div class="ar-toolbar__left">
<span class="ar-toolbar__title">处理函数</span>
<span class="ar-toolbar__sub">按顺序执行关联函数,可用性由代码注册表决定</span>
</div>
<div class="ar-panel-toolbar-right">
<div class="ar-toolbar__right">
<el-select
v-model="pendingFunctionId"
placeholder="选择函数加入关联"
@ -40,64 +39,51 @@
</div>
</div>
<div class="ar-panel-table">
<el-table
v-loading="loading"
<div class="ar-table-wrap">
<upper-table
table-id="inbox-auto-reply-function"
:data="rows"
border
stripe
size="small"
height="100%"
:columns="columns"
:loading="loading"
:show-pagination="false"
row-key="function_id"
empty-text="暂未关联处理函数"
>
<el-table-column
v-for="col in columns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
:align="col.align ?? 'left'"
:show-overflow-tooltip="col.showOverflowTooltip"
>
<template #default="{ row, $index }">
<template v-if="col.prop === 'status'">
<el-tag v-if="row.in_registry === null || row.in_registry === undefined" size="small" type="info">
未知
</el-tag>
<el-tag v-else size="small" :type="row.in_registry ? 'success' : 'danger'">
{{ row.in_registry ? '可用' : '代码已下线' }}
</el-tag>
</template>
<template v-else-if="col.prop === 'sort_order'">
{{ $index + 1 }}
</template>
<template v-else-if="col.prop === 'actions'">
<el-button size="small" type="primary" link :disabled="!writable || $index === 0" @click="moveRow($index, -1)">
上移
</el-button>
<el-button
size="small"
type="primary"
link
:disabled="!writable || $index === rows.length - 1"
@click="moveRow($index, 1)"
>
下移
</el-button>
<el-button size="small" type="danger" link :disabled="!writable" @click="removeRow($index)">
移除
</el-button>
</template>
<template v-else-if="col.prop === 'name'">
{{ row.function_name || row.function_code || '-' }}
</template>
<template v-else>
{{ row[col.prop] ?? '-' }}
</template>
</template>
</el-table-column>
</el-table>
<template #column-sort_order="{ index }">
{{ (index ?? 0) + 1 }}
</template>
<template #column-name="{ row }">
{{ row.function_name || row.function_code || '-' }}
</template>
<template #column-status="{ row }">
<span
v-if="row.in_registry === null || row.in_registry === undefined"
class="ut-status-text ut-status-text--info"
>未知</span>
<span
v-else
class="ut-status-text"
:class="row.in_registry ? 'ut-status-text--success' : 'ut-status-text--danger'"
>{{ row.in_registry ? '可用' : '代码已下线' }}</span>
</template>
<template #column-actions="{ index }">
<el-button size="small" type="primary" link :disabled="!writable || index === 0" @click="moveRow(index ?? 0, -1)">
上移
</el-button>
<el-button
size="small"
type="primary"
link
:disabled="!writable || index === rows.length - 1"
@click="moveRow(index ?? 0, 1)"
>
下移
</el-button>
<el-button size="small" type="danger" link :disabled="!writable" @click="removeRow(index ?? 0)">
移除
</el-button>
</template>
</upper-table>
</div>
</div>
</template>
@ -113,6 +99,7 @@ import {
type InboxV2FunctionItem,
} from '@/api/inbox-2/autoReply'
import { functionColumns } from '../autoReply-config'
import UpperTable from '@/components/UpperTable/index.vue'
const props = defineProps<{
subTypeId: number

View File

@ -1,12 +1,11 @@
<template>
<div class="ar-panel">
<div class="ar-panel-toolbar">
<div class="ar-panel-toolbar-left">
<span class="ar-panel-tip">
命中白名单的群才走该子类型链路;子类型选「全部子类型」即通配该群类型下所有子类型,系统预设行不可删
</span>
<div class="ar-toolbar">
<div class="ar-toolbar__left">
<span class="ar-toolbar__title">群白名单</span>
<span class="ar-toolbar__sub">命中白名单的群才走该子类型链路;子类型选「全部」即通配,系统预设行不可删</span>
</div>
<div class="ar-panel-toolbar-right">
<div class="ar-toolbar__right">
<el-select
v-model="pendingGroupType"
placeholder="群类型"
@ -47,57 +46,42 @@
</div>
</div>
<div class="ar-panel-table">
<el-table
v-loading="loading"
<div class="ar-table-wrap">
<upper-table
table-id="inbox-auto-reply-group"
:data="rows"
border
stripe
size="small"
height="100%"
:columns="columns"
:loading="loading"
:show-pagination="false"
row-key="uid"
empty-text="暂未配置群白名单"
>
<el-table-column
v-for="col in columns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
:align="col.align ?? 'left'"
:show-overflow-tooltip="col.showOverflowTooltip"
>
<template #default="{ row }">
<template v-if="col.prop === 'source'">
<el-tag size="small" :type="Number(row.is_system) === 1 ? 'info' : 'success'">
{{ Number(row.is_system) === 1 ? systemTagText : '自定义' }}
</el-tag>
</template>
<template v-else-if="col.prop === 'actions'">
<el-tooltip
:disabled="isGroupRelationRemovable(row)"
content="系统预设关联不可删除"
placement="top"
<template #column-source="{ row }">
<span
class="ut-status-text"
:class="Number(row.is_system) === 1 ? 'ut-status-text--info' : 'ut-status-text--success'"
>{{ Number(row.is_system) === 1 ? systemTagText : '自定义' }}</span>
</template>
<template #column-actions="{ row }">
<el-tooltip
:disabled="isGroupRelationRemovable(row)"
content="系统预设关联不可删除"
placement="top"
>
<span>
<el-button
size="small"
type="danger"
link
:disabled="!writable || !isGroupRelationRemovable(row)"
@click="removeRow(row)"
>
<span>
<el-button
size="small"
type="danger"
link
:disabled="!writable || !isGroupRelationRemovable(row)"
@click="removeRow(row)"
>
移除
</el-button>
</span>
</el-tooltip>
</template>
<template v-else>
{{ row[col.prop] ?? '-' }}
</template>
</template>
</el-table-column>
</el-table>
移除
</el-button>
</span>
</el-tooltip>
</template>
</upper-table>
</div>
</div>
</template>
@ -120,6 +104,7 @@ import {
subGroupLabel,
systemTagText,
} from '../autoReply-config'
import UpperTable from '@/components/UpperTable/index.vue'
const props = defineProps<{
subTypeId: number

View File

@ -1,120 +1,167 @@
<template>
<div class="ar-panel">
<div class="ar-panel-toolbar">
<div class="ar-panel-toolbar-left">
<span class="ar-panel-tip">
关键词命中即进入该子类型,系统预设关键词只读
</span>
<div class="ar-toolbar">
<div class="ar-toolbar__left">
<span class="ar-toolbar__title">关键词</span>
<span class="ar-toolbar__sub">关键词命中即进入该子类型,系统预设关键词只读</span>
</div>
<div class="ar-panel-toolbar-right">
<div class="ar-toolbar__right">
<el-button size="small" type="primary" :loading="loading" @click="loadList">刷新</el-button>
<el-button size="small" type="primary" plain @click="openCreate">新增关键词</el-button>
</div>
</div>
<div class="ar-panel-table">
<el-table
v-loading="loading"
<div class="ar-table-wrap">
<upper-table
table-id="inbox-auto-reply-keyword"
:data="list"
border
stripe
size="small"
height="100%"
row-key="id"
:columns="columns"
:loading="loading"
:pagination="pagination"
:enable-column-config="true"
empty-text="暂无关键词"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadList"
>
<el-table-column
v-for="col in columns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
:align="col.align ?? 'left'"
:show-overflow-tooltip="col.showOverflowTooltip"
>
<template #default="{ row }">
<template v-if="col.prop === 'source'">
<el-tag size="small" :type="isSystemRecord(row) ? 'info' : 'success'">
{{ isSystemRecord(row) ? systemTagText : '自定义' }}
</el-tag>
</template>
<template v-else-if="col.prop === 'is_enabled'">
<el-switch
:model-value="toFlag(row.is_enabled)"
:active-value="1"
:inactive-value="0"
:disabled="isSystemRecord(row) || togglingId === row.id"
@change="(val: number) => handleToggleEnabled(row, val)"
/>
</template>
<template v-else-if="col.prop === 'actions'">
<el-button
size="small"
type="primary"
link
:disabled="isSystemRecord(row)"
@click="openEdit(row)"
>
编辑
</el-button>
<el-button
size="small"
type="danger"
link
:disabled="isSystemRecord(row)"
@click="handleDelete(row)"
>
删除
</el-button>
</template>
<template v-else>
{{ row[col.prop] ?? '-' }}
</template>
</template>
</el-table-column>
</el-table>
</div>
<template #column-source="{ row }">
<span :class="isSystemRecord(row) ? 'ut-status-text ut-status-text--info' : 'ut-status-text ut-status-text--success'">
{{ isSystemRecord(row) ? systemTagText : '自定义' }}
</span>
</template>
<div class="ar-panel-pagination">
<el-pagination
v-model:current-page="pagination.page"
v-model:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50, 100]"
:disabled="loading"
background
small
layout="total, sizes, prev, pager, next"
@current-change="loadList"
@size-change="handlePageSizeChange"
/>
<template #column-is_enabled="{ row }">
<el-switch
:model-value="toFlag(row.is_enabled)"
:active-value="1"
:inactive-value="0"
:disabled="isSystemRecord(row) || togglingId === row.id"
@change="(val: number) => handleToggleEnabled(row, val)"
/>
</template>
<template #column-actions="{ row }">
<el-button
size="small"
type="primary"
link
:disabled="isSystemRecord(row)"
@click="openEdit(row)"
>
编辑
</el-button>
<el-button
size="small"
type="danger"
link
:disabled="isSystemRecord(row)"
@click="handleDelete(row)"
>
删除
</el-button>
</template>
</upper-table>
</div>
<el-dialog
v-model="dialogVisible"
:title="editingId ? '编辑关键词' : '新增关键词'"
width="480px"
class="ar-keyword-dialog"
width="min(560px, 92vw)"
align-center
append-to-body
destroy-on-close
:show-close="false"
:close-on-click-modal="false"
>
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px" size="small">
<el-form-item label="关键词" prop="keyword">
<el-input v-model="form.keyword" placeholder="请输入关键词(≤100 字符)" maxlength="100" show-word-limit />
</el-form-item>
<el-form-item v-if="editingId" label="启用状态">
<el-switch v-model="form.isEnabled" :active-value="1" :inactive-value="0" active-text="启用" inactive-text="停用" />
</el-form-item>
<el-form-item label="匹配优先级">
<el-input-number v-model="form.sortOrder" :min="0" :max="9999" controls-position="right" />
<span class="ar-form-tip">数值越小越优先</span>
</el-form-item>
</el-form>
<template #footer>
<el-button size="small" :disabled="submitting" @click="dialogVisible = false">取消</el-button>
<el-button size="small" type="primary" :loading="submitting" @click="handleSubmit">保存</el-button>
</template>
<!-- 面板结构 / 尺寸对齐「手工录入运单号」(ManualWaybillForm) -->
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>{{ editingId ? '编辑关键词' : '新增关键词' }}</h2>
<p>{{ editingId ? '可调整关键词内容、匹配优先级与启用状态' : '关键词命中即进入当前子类型,系统预设关键词只读' }}</p>
</div>
<button
class="task-panel__close"
type="button"
aria-label="关闭"
@click="dialogVisible = false"
>
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<div class="task-panel__body">
<el-form
ref="formRef"
:model="form"
:rules="rules"
class="task-panel__form"
@submit.prevent
>
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label is-required">关键词</span>
<div class="task-panel__field-form">
<el-form-item prop="keyword">
<el-input
v-model="form.keyword"
size="default"
placeholder="请输入关键词(≤100 字符)"
maxlength="100"
show-word-limit
clearable
@keyup.enter="handleSubmit"
/>
</el-form-item>
</div>
</div>
<div class="task-panel__field task-panel__field--control">
<span class="task-panel__field-label">匹配优先级</span>
<div class="task-panel__field-form task-panel__field-form--row">
<el-form-item prop="sortOrder">
<el-input-number
v-model="form.sortOrder"
size="default"
:min="0"
:max="9999"
:precision="0"
controls-position="right"
style="width: 100%"
/>
</el-form-item>
</div>
</div>
<div v-if="editingId" class="task-panel__field task-panel__field--control">
<span class="task-panel__field-label">启用状态</span>
<div class="task-panel__field-form task-panel__field-form--row">
<el-switch
v-model="form.isEnabled"
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="停用"
/>
</div>
</div>
</el-form>
<!-- 提示条:对齐「手工录入运单号」的 .task-panel__form-tip -->
<p class="task-panel__form-tip">
关键词必填且最长 100 字符,命中任意关键词即进入当前子类型;匹配优先级数值越小越靠前(默认 0)。
</p>
</div>
<footer class="task-panel__foot">
<span class="task-panel__hint">提交前请确认关键词内容与优先级</span>
<div class="task-panel__actions">
<el-button size="small" :disabled="submitting" @click="dialogVisible = false">取消</el-button>
<el-button size="small" type="primary" :loading="submitting" @click="handleSubmit">保存</el-button>
</div>
</footer>
</div>
</el-dialog>
</div>
</template>
@ -136,6 +183,7 @@ import {
systemTagText,
toFlag,
} from '../autoReply-config'
import UpperTable from '@/components/UpperTable/index.vue'
const props = defineProps<{
subTypeId: number
@ -152,7 +200,7 @@ const loading = ref(false)
const submitting = ref(false)
const togglingId = ref<number | null>(null)
const list = ref<InboxV2KeywordItem[]>([])
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const dialogVisible = ref(false)
const editingId = ref<number | null>(null)
@ -185,12 +233,12 @@ async function loadList() {
try {
const res = await inboxV2KeywordList({
subTypeId: props.subTypeId,
page: pagination.page,
page: pagination.currentPage,
pageSize: pagination.pageSize,
})
const data = unwrapInboxV2Data(res)
list.value = data?.list ?? []
pagination.page = data?.pagination?.page ?? pagination.page
pagination.currentPage = data?.pagination?.page ?? pagination.currentPage
pagination.pageSize = data?.pagination?.pageSize ?? pagination.pageSize
pagination.total = data?.pagination?.total ?? list.value.length
} catch (error) {
@ -202,8 +250,14 @@ async function loadList() {
}
}
function handlePageSizeChange() {
pagination.page = 1
function handlePageChange(page: number) {
pagination.currentPage = page
void loadList()
}
function handlePageSizeChange(size: number) {
pagination.pageSize = size
pagination.currentPage = 1
void loadList()
}
@ -297,7 +351,7 @@ async function handleDelete(row: InboxV2KeywordItem) {
watch(
() => props.subTypeId,
() => {
pagination.page = 1
pagination.currentPage = 1
resetForm()
dialogVisible.value = false
void loadList()
@ -309,3 +363,19 @@ watch(
<style scoped lang="scss">
@use "./panel.scss";
</style>
<style lang="scss">
/* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板(同「手工录入运单号」) */
.el-dialog.ar-keyword-dialog {
padding: 0;
overflow: hidden;
.el-dialog__header {
display: none;
}
.el-dialog__body {
padding: 0;
}
}
</style>

View File

@ -1,12 +1,11 @@
<template>
<div class="ar-panel">
<div class="ar-panel-toolbar">
<div class="ar-panel-toolbar-left">
<span class="ar-panel-tip">
取号规则全局只读,按顺序用正则从消息中提取单据号
</span>
<div class="ar-toolbar">
<div class="ar-toolbar__left">
<span class="ar-toolbar__title">取号规则</span>
<span class="ar-toolbar__sub">取号规则全局只读,按顺序用正则从消息中提取单据号</span>
</div>
<div class="ar-panel-toolbar-right">
<div class="ar-toolbar__right">
<el-select
v-model="pendingRuleId"
placeholder="选择取号规则加入"
@ -33,53 +32,37 @@
</div>
</div>
<div class="ar-panel-table">
<el-table
v-loading="loading"
<div class="ar-table-wrap">
<upper-table
table-id="inbox-auto-reply-number-rule"
:data="rows"
border
stripe
size="small"
height="100%"
:columns="columns"
:loading="loading"
:show-pagination="false"
row-key="number_rule_id"
empty-text="暂未关联取号规则"
>
<el-table-column
v-for="col in columns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
:align="col.align ?? 'left'"
:show-overflow-tooltip="col.showOverflowTooltip"
>
<template #default="{ row, $index }">
<template v-if="col.prop === 'sort_order'">
{{ $index + 1 }}
</template>
<template v-else-if="col.prop === 'actions'">
<el-button size="small" type="primary" link :disabled="!writable || $index === 0" @click="moveRow($index, -1)">
上移
</el-button>
<el-button
size="small"
type="primary"
link
:disabled="!writable || $index === rows.length - 1"
@click="moveRow($index, 1)"
>
下移
</el-button>
<el-button size="small" type="danger" link :disabled="!writable" @click="removeRow($index)">
移除
</el-button>
</template>
<template v-else>
{{ row[col.prop] ?? '-' }}
</template>
</template>
</el-table-column>
</el-table>
<template #column-sort_order="{ index }">
{{ (index ?? 0) + 1 }}
</template>
<template #column-actions="{ index }">
<el-button size="small" type="primary" link :disabled="!writable || index === 0" @click="moveRow(index ?? 0, -1)">
上移
</el-button>
<el-button
size="small"
type="primary"
link
:disabled="!writable || index === rows.length - 1"
@click="moveRow(index ?? 0, 1)"
>
下移
</el-button>
<el-button size="small" type="danger" link :disabled="!writable" @click="removeRow(index ?? 0)">
移除
</el-button>
</template>
</upper-table>
</div>
</div>
</template>
@ -95,6 +78,7 @@ import {
type InboxV2NumberRuleItem,
} from '@/api/inbox-2/autoReply'
import { numberRuleColumns, numberRuleTargetLabel } from '../autoReply-config'
import UpperTable from '@/components/UpperTable/index.vue'
const props = defineProps<{
subTypeId: number

View File

@ -1,66 +1,94 @@
<template>
<div class="ar-panel reply-panel">
<div class="ar-panel-toolbar">
<div class="ar-panel-toolbar-right">
<el-button size="small" type="primary" :loading="submitting" @click="handleSave">
保存配置
</el-button>
<div class="ar-toolbar">
<div class="ar-toolbar__left">
<span class="ar-toolbar__title">回复配置</span>
<span class="ar-toolbar__sub">仓库级配置优先于系统级;「还原配置」将回退为系统级配置</span>
</div>
<div class="ar-toolbar__right">
<el-button size="small" type="danger" plain :disabled="submitting" @click="handleRestore">
还原配置
</el-button>
<el-button
size="small"
type="primary"
:loading="submitting"
:disabled="!formDirty"
@click="handleSave"
>
保存配置
</el-button>
</div>
</div>
<div v-loading="loading" class="reply-body">
<el-form :model="form" label-width="120px" size="small">
<el-form-item label="回复方式">
<el-radio-group v-model="form.isReply">
<el-radio :value="1">回复</el-radio>
<el-radio :value="0">不回复</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="处理方式">
<el-radio-group v-model="form.createWorkOrder">
<el-radio :value="1">登记工单</el-radio>
<el-radio :value="0">不登记工单</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="回复文案" prop="reply">
<el-input
v-model="form.reply"
type="textarea"
:rows="6"
maxlength="2000"
show-word-limit
placeholder="支持换行;可使用占位符"
/>
<div class="placeholder-bar">
<span class="placeholder-label">可用占位符:</span>
<el-tag v-for="item in replyPlaceholders" :key="item" size="small" type="info">{{ item }}</el-tag>
<el-form :model="form" class="task-panel__form" @submit.prevent>
<div class="task-panel__grid">
<div class="task-panel__field task-panel__field--control">
<span class="task-panel__field-label">回复方式</span>
<div class="task-panel__field-form task-panel__field-form--row">
<el-form-item>
<el-radio-group v-model="form.isReply">
<el-radio :value="1">回复</el-radio>
<el-radio :value="0">不回复</el-radio>
</el-radio-group>
</el-form-item>
</div>
</div>
</el-form-item>
<el-form-item label="取号失败引导语">
<el-input
v-model="form.noNumberHint"
type="textarea"
:rows="3"
maxlength="500"
show-word-limit
placeholder="关联取号规则但未提取到单据号时回复(留空则用默认引导语)"
/>
</el-form-item>
<div class="task-panel__field task-panel__field--control">
<span class="task-panel__field-label">处理方式</span>
<div class="task-panel__field-form task-panel__field-form--row">
<el-form-item>
<el-radio-group v-model="form.createWorkOrder">
<el-radio :value="1">登记工单</el-radio>
<el-radio :value="0">不登记工单</el-radio>
</el-radio-group>
</el-form-item>
</div>
</div>
</div>
<el-alert
v-if="silentAndNoWorkOrder"
type="info"
:closable="false"
show-icon
title="不回复 + 不登记工单:函数仍执行,但不回消息也不建单"
/>
<div class="task-panel__field task-panel__field--input task-panel__field--textarea">
<span class="task-panel__field-label">回复文案</span>
<div class="task-panel__field-form">
<el-form-item prop="reply">
<el-input
v-model="form.reply"
type="textarea"
:rows="6"
maxlength="2000"
show-word-limit
placeholder="支持换行;可使用占位符"
/>
</el-form-item>
</div>
</div>
<div class="task-panel__field task-panel__field--input task-panel__field--textarea">
<span class="task-panel__field-label">取号失败引导语</span>
<div class="task-panel__field-form">
<el-form-item>
<el-input
v-model="form.noNumberHint"
type="textarea"
:rows="3"
maxlength="500"
show-word-limit
placeholder="关联取号规则但未提取到单据号时回复(留空则用默认引导语)"
/>
</el-form-item>
</div>
</div>
</el-form>
<p class="task-panel__form-tip">
可用占位符:{{ replyPlaceholders.join('、') }};由后端规则引擎替换,占位符缺失时按原文保留。
</p>
<p v-if="silentAndNoWorkOrder" class="task-panel__form-tip task-panel__form-tip--warning">
不回复 + 不登记工单:处理函数仍会执行,但不回消息也不建单。
</p>
</div>
</div>
</template>
@ -216,30 +244,13 @@ watch(
<style scoped lang="scss">
@use "./panel.scss";
/* 回复配置:面板内滚动,字段行复用 task-panel 语言 */
.reply-body {
flex: 1;
min-height: 0;
overflow: auto;
display: flex;
flex-direction: column;
gap: 12px;
}
// 工具栏只剩右侧操作按钮,靠右对齐
.ar-panel-toolbar-right {
margin-left: auto;
}
.placeholder-bar {
display: flex;
align-items: center;
gap: 6px;
margin-top: 6px;
flex-wrap: wrap;
}
.placeholder-label {
font-size: 12px;
color: #909399;
gap: 8px;
}
</style>

View File

@ -1,4 +1,7 @@
// 自动回复设置 - 配置面板通用样式(由各子面板 @use 复用)
// 视觉语言对齐 order/orderManagement 最新页面:
// 白色栏条(标题 + 说明 + 操作) → .ar-toolbar
// 内容区(UpperTable / 字段行) → .ar-table-wrap / .ar-form-card
.ar-panel {
display: flex;
@ -8,44 +11,96 @@
min-height: 0;
}
.ar-panel-toolbar {
/* ---------- 分区栏条(对齐 order 页 .toolbar) ---------- */
.ar-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
gap: 10px;
flex-wrap: wrap;
flex-shrink: 0;
min-height: 34px;
box-sizing: border-box;
padding: 6px 10px;
border: 1px solid #ebeef5;
background: #fff;
}
.ar-panel-toolbar-left {
flex: 1;
min-width: 0;
}
.ar-panel-toolbar-right {
.ar-toolbar__left {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
gap: 10px;
flex: 1;
min-width: 0;
flex-wrap: wrap;
}
.ar-toolbar__right {
display: flex;
align-items: center;
gap: 6px;
flex-shrink: 0;
flex-wrap: wrap;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
.ar-toolbar__title {
font-size: 13px;
font-weight: 600;
color: #303133;
white-space: nowrap;
}
.ar-toolbar__sub,
.ar-panel-tip {
font-size: 12px;
color: #909399;
line-height: 1.5;
color: #909399;
}
.ar-panel-table {
/* ---------- 内容区 ---------- */
/* 表格容器:为 UpperTable 提供弹性高度 */
.ar-table-wrap {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.ar-panel-pagination {
display: flex;
justify-content: flex-end;
/* 页面内嵌表单卡片:内部字段行复用 .task-panel__* */
.ar-form-card {
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
overflow: hidden;
flex-shrink: 0;
min-height: 0;
}
.ar-form-card--flex {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
/* 页签卡片:内容面板自身负责内边距 */
.ar-tabs-card {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 0 10px 10px;
overflow: hidden;
}
.ar-form-tip {
@ -60,3 +115,277 @@
color: #909399;
font-size: 13px;
}
/* 轻量状态文本(替代 el-tag,与 order 页 .ut-status-text 一致) */
.ut-status-text {
font-size: 12px;
line-height: 18px;
white-space: nowrap;
}
.ut-status-text--primary { color: var(--el-color-primary); }
.ut-status-text--success { color: var(--el-color-success); }
.ut-status-text--warning { color: var(--el-color-warning); }
.ut-status-text--info { color: var(--el-color-info); }
.ut-status-text--danger { color: var(--el-color-danger); }
/* ==========================================================================
弹窗面板:结构 / 尺寸对齐「手工录入运单号」
(src/views/order/orderManagement/form/ManualWaybillForm.vue)
========================================================================== */
.task-panel {
background: #fff;
color: #303133;
&__head {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px;
}
&__titles {
flex: 1;
min-width: 0;
h2 {
margin: 0;
font-size: 18px;
line-height: 24px;
font-weight: 400;
color: #303133;
}
p {
margin: 4px 0 0;
font-size: 12px;
line-height: 18px;
color: #909399;
}
}
&__close {
width: 24px;
height: 24px;
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
cursor: pointer;
transition: color 0.2s;
svg {
width: 12px;
height: 12px;
}
&:hover {
color: #409eff;
}
}
&__body {
padding: 12px 16px 0;
/* 字段较多:超出 64vh 时面板内滚动 */
&--scroll {
max-height: 64vh;
overflow-y: auto;
}
}
&__form {
display: flex;
flex-direction: column;
gap: 8px;
}
/* 字段横向排开:宽屏一行放多个字段(auto-fit),窄屏自动折行 */
&__grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
column-gap: 16px;
row-gap: 6px;
/* 标签列收窄(一行多列时给输入框留出宽度) */
.task-panel__field-label {
flex: 0 0 76px;
width: 76px;
}
@media (max-width: 720px) {
grid-template-columns: minmax(0, 1fr);
.task-panel__field-label {
flex: 0 0 88px;
width: 88px;
}
}
}
&__field {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
min-height: 40px;
padding: 8px 12px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #fafafa;
/* 输入行:去掉灰色容器,与静态信息行拉开层次 */
&--input {
align-items: flex-start;
min-height: 0;
/* 左 12px 与静态信息行标签对齐;右 0 让输入框右边顶到容器右边缘 */
padding: 4px 0 0 12px;
border: none;
border-radius: 0;
background: transparent;
.task-panel__field-label {
padding-top: 7px;
/* 输入行标签整体下移 7px,星号同步下移以保持与文字基线对齐 */
&.is-required::before {
top: 7px;
}
}
}
/* 开关 / 数字输入等控件行:高度与输入框(32px)对齐 */
&--control {
align-items: center;
min-height: 0;
padding: 4px 0 0 12px;
border: none;
border-radius: 0;
background: transparent;
.task-panel__field-label {
padding-top: 7px;
}
}
/* 多行文本行:标签与文本域顶部对齐 */
&--textarea {
padding-top: 8px;
}
}
/* 标签列固定宽度(含必填星号占位):各行列、控件左边缘严格对齐 */
&__field-label {
position: relative;
flex: 0 0 88px;
width: 88px;
padding-left: 10px;
box-sizing: border-box;
font-size: 12px;
line-height: 20px;
color: #606266;
text-align: left;
/* 必填星号绝对定位在标签左侧,不占用标签宽度 */
&.is-required::before {
content: '*';
position: absolute;
left: 0;
top: 0;
color: #f56c6c;
line-height: 20px;
}
}
&__field-value {
font-size: 13px;
font-weight: 500;
color: #303133;
text-align: right;
word-break: break-all;
}
/* 输入控件容器:占满标签列右侧剩余宽度 */
&__field-form {
flex: 1;
min-width: 0;
max-width: none;
:deep(.el-form-item) {
flex: 1;
min-width: 0;
width: 100%;
margin-bottom: 0;
}
:deep(.el-form-item__content) {
margin-left: 0 !important;
width: 100%;
line-height: 1.4;
}
:deep(.el-form-item__error) {
position: static;
padding-top: 4px;
}
:deep(.el-input),
:deep(.el-select),
:deep(.el-input-number) {
width: 100%;
}
/* 控件行:开关 / 数字输入与输入框行高对齐 */
&--row {
display: flex;
align-items: center;
gap: 8px;
min-height: 32px;
}
}
/* 表单下方统一提示条 */
&__form-tip {
margin: 8px 0 0;
padding: 8px 12px;
border-radius: 4px;
background: #f4f4f5;
font-size: 12px;
line-height: 18px;
color: #909399;
/* 警示态:规则互斥 / 数据缺失等需要用户留意的情况 */
&--warning {
background: #fdf6ec;
color: #e6a23c;
}
}
&__foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 16px;
}
&__hint {
font-size: 12px;
color: #909399;
}
&__actions {
display: flex;
align-items: center;
/* 与工具栏按钮组一致:gap 6px */
gap: 6px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
}

View File

@ -1,20 +1,29 @@
<template>
<div class="order-sub-container auto-reply-page">
<!-- ========== 左:类型 / 子类型 树 ========== -->
<aside class="ar-tree-pane">
<div class="ar-tree-header">
<span class="ar-tree-title">回信规则配置</span>
<div class="ar-tree-actions">
<aside class="ar-side">
<div class="ar-toolbar">
<div class="ar-toolbar__left">
<span class="ar-toolbar__title">回信规则</span>
<span class="ar-toolbar__sub">类型 / 子类型</span>
</div>
<div class="ar-toolbar__right">
<el-button size="small" type="primary" plain @click="openTypeCreate">新增类型</el-button>
<el-button size="small" type="primary" :loading="treeLoading" @click="handleTreeRefresh">刷新</el-button>
</div>
</div>
<div class="ar-tree-filter">
<el-input v-model="treeKeyword" size="small" placeholder="搜索类型 / 子类型" clearable />
<div class="ar-side__filter">
<el-input
v-model="treeKeyword"
size="small"
placeholder="搜索类型 / 子类型"
clearable
:prefix-icon="Search"
/>
</div>
<div v-loading="treeLoading" class="ar-tree-body">
<div v-loading="treeLoading" class="ar-side__tree">
<el-tree
ref="treeRef"
:data="treeData"
@ -29,8 +38,8 @@
<span class="ar-tree-node" :class="{ 'ar-tree-node--system': data.isSystem }">
<span class="ar-tree-node-label" :title="data.label">{{ data.label }}</span>
<span class="ar-tree-node-code">{{ data.typeCode }}</span>
<el-tag v-if="data.isSystem" size="small" type="info" disable-transitions>系统</el-tag>
<el-tag v-if="!data.isEnabled" size="small" type="danger" disable-transitions>停用</el-tag>
<span v-if="data.isSystem" class="ar-tree-badge">系统</span>
<span v-if="!data.isEnabled" class="ar-tree-badge ar-tree-badge--danger">停用</span>
</span>
</template>
</el-tree>
@ -48,160 +57,208 @@
</div>
<!-- 类型面板 -->
<div v-else-if="currentType" class="ar-type-panel">
<div class="ar-block">
<div class="ar-block-header">
<span class="ar-block-title">类型信息</span>
<div class="ar-block-actions">
<el-tag size="small" :type="isTypeReadOnly ? 'info' : 'success'">
{{ isTypeReadOnly ? systemTagText : '仓库自定义' }}
</el-tag>
<template v-else-if="currentType">
<div class="ar-toolbar">
<div class="ar-toolbar__left">
<span class="ar-toolbar__title">类型信息</span>
<span class="ar-toolbar__sub">
{{ isTypeReadOnly ? '系统预设类型只读,不可修改' : '修改名称 / 排序 / 状态后点击保存生效' }}
</span>
</div>
<div class="ar-toolbar__right">
<el-tag size="small" :type="isTypeReadOnly ? 'info' : 'success'">
{{ isTypeReadOnly ? systemTagText : '仓库自定义' }}
</el-tag>
</div>
</div>
<div class="ar-form-card">
<div class="task-panel">
<div class="task-panel__body">
<el-form
:model="typeForm"
:disabled="isTypeReadOnly"
class="task-panel__form"
@submit.prevent
>
<div class="task-panel__grid">
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label">类型编码</span>
<div class="task-panel__field-form">
<el-form-item>
<el-input v-model="typeForm.type" size="default" disabled placeholder="—" />
</el-form-item>
</div>
</div>
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label is-required">类型名称</span>
<div class="task-panel__field-form">
<el-form-item>
<el-input
v-model="typeForm.name"
size="default"
maxlength="50"
show-word-limit
clearable
placeholder="请输入类型名称"
@input="typeFormDirty = true"
/>
</el-form-item>
</div>
</div>
<div class="task-panel__field task-panel__field--control">
<span class="task-panel__field-label">排序值</span>
<div class="task-panel__field-form task-panel__field-form--row">
<el-form-item>
<el-input-number
v-model="typeForm.sortOrder"
size="default"
:min="0"
:max="9999"
:precision="0"
controls-position="right"
style="width: 100%"
@change="typeFormDirty = true"
/>
</el-form-item>
</div>
</div>
<div class="task-panel__field task-panel__field--control">
<span class="task-panel__field-label">启用状态</span>
<div class="task-panel__field-form task-panel__field-form--row">
<el-switch
v-model="typeForm.isEnabled"
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="停用"
@change="typeFormDirty = true"
/>
</div>
</div>
</div>
</el-form>
<!-- <p class="task-panel__form-tip">
排序值越小越靠前;停用后该类型下的子类型不参与规则匹配。
</p> -->
</div>
<footer class="task-panel__foot">
<span class="task-panel__hint">
{{ typeFormDirty ? '有未保存的修改' : '当前配置已保存' }}
</span>
<div class="task-panel__actions">
<el-button size="small" type="danger" plain :disabled="isTypeReadOnly" @click="handleDeleteType">
删除类型
</el-button>
<el-button size="small" :disabled="isTypeReadOnly || !typeFormDirty" @click="syncTypeForm">
重置
</el-button>
<el-button
size="small"
type="primary"
:loading="typeSaving"
:disabled="isTypeReadOnly || !typeFormDirty"
@click="handleSaveType"
>
保存
</el-button>
</div>
</footer>
</div>
</div>
<div class="ar-toolbar">
<div class="ar-toolbar__left">
<span class="ar-toolbar__title">子类型({{ typeSubTypes.length }})</span>
<span class="ar-toolbar__sub">
系统预设子类型只读;「配置」可维护关键词、处理函数、取号规则与回复
</span>
</div>
<div class="ar-toolbar__right">
<el-button size="small" type="primary" plain @click="openSubTypeCreate">
新增子类型
</el-button>
</div>
</div>
<div class="ar-table-wrap">
<upper-table
table-id="inbox-auto-reply-sub-type"
:data="typeSubTypes"
:columns="subTypeTableColumns"
:show-pagination="false"
empty-text="该类型下暂无子类型"
>
<template #column-source="{ row }">
<span
class="ut-status-text"
:class="isSystemRecord(row) ? 'ut-status-text--info' : 'ut-status-text--success'"
>{{ isSystemRecord(row) ? systemTagText : '自定义' }}</span>
</template>
<template #column-is_enabled="{ row }">
<span
class="ut-status-text"
:class="toFlag(row.is_enabled, 1) === 1 ? 'ut-status-text--success' : 'ut-status-text--info'"
>{{ toFlag(row.is_enabled, 1) === 1 ? '启用' : '停用' }}</span>
</template>
<template #column-actions="{ row }">
<el-button size="small" type="primary" link @click="handleOpenSubType(row)">
配置
</el-button>
<el-button
size="small"
type="primary"
:loading="typeSaving"
:disabled="isTypeReadOnly || !typeFormDirty"
@click="handleSaveType"
link
:disabled="isSystemRecord(row)"
@click="openSubTypeEdit(row)"
>
保存
编辑
</el-button>
<el-button
size="small"
type="danger"
plain
:disabled="isTypeReadOnly"
@click="handleDeleteType"
link
:disabled="isSystemRecord(row)"
@click="handleDeleteSubType(row)"
>
删除类型
删除
</el-button>
</div>
</div>
<el-form :model="typeForm" label-width="90px" size="small" :disabled="isTypeReadOnly">
<div class="ar-form-row">
<el-form-item label="类型编码">
<el-input v-model="typeForm.type" disabled />
</el-form-item>
<el-form-item label="类型名称">
<el-input v-model="typeForm.name" maxlength="50" show-word-limit @input="typeFormDirty = true" />
</el-form-item>
<el-form-item label="排序值">
<el-input-number
v-model="typeForm.sortOrder"
:min="0"
:max="9999"
controls-position="right"
@change="typeFormDirty = true"
/>
</el-form-item>
<el-form-item label="启用状态">
<el-switch
v-model="typeForm.isEnabled"
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="停用"
@change="typeFormDirty = true"
/>
</el-form-item>
</div>
</el-form>
</template>
</upper-table>
</div>
<div class="ar-block ar-block--flex">
<div class="ar-block-header">
<span class="ar-block-title">
子类型({{ typeSubTypes.length }})
<span class="ar-block-tip">
系统预设子类型只读
</span>
</span>
<div class="ar-block-actions">
<el-button size="small" type="primary" plain @click="openSubTypeCreate">
新增子类型
</el-button>
</div>
</div>
<div class="ar-block-table">
<el-table
:data="typeSubTypes"
border
stripe
size="small"
height="100%"
row-key="id"
empty-text="该类型下暂无子类型"
>
<el-table-column
v-for="col in subTypeColumns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
:align="col.align ?? 'left'"
:show-overflow-tooltip="col.showOverflowTooltip"
>
<template #default="{ row }">
<template v-if="col.prop === 'source'">
<el-tag size="small" :type="isSystemRecord(row) ? 'info' : 'success'">
{{ isSystemRecord(row) ? systemTagText : '自定义' }}
</el-tag>
</template>
<template v-else-if="col.prop === 'is_enabled'">
<el-tag size="small" :type="toFlag(row.is_enabled, 1) === 1 ? 'success' : 'info'">
{{ toFlag(row.is_enabled, 1) === 1 ? '启用' : '停用' }}
</el-tag>
</template>
<template v-else>
{{ row[col.prop] ?? '-' }}
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="190" align="center" fixed="right">
<template #default="{ row }">
<el-button size="small" type="primary" link @click="handleOpenSubType(row)">
配置
</el-button>
<el-button
size="small"
type="primary"
link
:disabled="isSystemRecord(row)"
@click="openSubTypeEdit(row)"
>
编辑
</el-button>
<el-button
size="small"
type="danger"
link
:disabled="isSystemRecord(row)"
@click="handleDeleteSubType(row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</template>
<!-- 子类型面板 -->
<div v-else-if="currentSubType" class="ar-subtype-panel">
<div class="ar-subtype-header">
<div class="ar-subtype-title">
<span class="ar-subtype-name">{{ currentSubType.name }}</span>
<el-tag size="small" type="info" disable-transitions>{{ currentSubType.sub_type }}</el-tag>
<div v-else-if="currentSubType" class="ar-panel">
<div class="ar-toolbar">
<div class="ar-toolbar__left">
<span class="ar-toolbar__title">{{ currentSubType.name }}</span>
<span class="ar-toolbar__sub">{{ currentSubType.sub_type }}</span>
<el-tag size="small" :type="isSubTypeReadOnly ? 'info' : 'success'">
{{ isSubTypeReadOnly ? systemTagText : '仓库自定义' }}
</el-tag>
<el-tag v-if="toFlag(currentSubType.is_enabled, 1) === 0" size="small" type="danger">停用</el-tag>
<el-tag v-if="toFlag(currentSubType.is_enabled, 1) === 0" size="small" type="danger">
停用
</el-tag>
</div>
<div class="ar-subtype-actions">
<span class="ar-subtype-path">
<div class="ar-toolbar__right">
<span class="ar-toolbar__sub">
上级类型:{{ currentTypeOfSubType?.name ?? currentSubType.type }}
</span>
<el-button
size="small"
:disabled="isSubTypeReadOnly"
@click="openSubTypeEdit(currentSubType)"
>
编辑子类型
</el-button>
<el-button
size="small"
type="danger"
@ -214,93 +271,140 @@
</div>
</div>
<el-tabs v-model="activeTab" class="ar-tabs">
<el-tab-pane label="基本信息" name="base">
<el-form
:model="subTypeForm"
label-width="110px"
size="small"
:disabled="isSubTypeReadOnly"
class="ar-base-form"
>
<el-form-item label="子类型编码">
<el-input v-model="subTypeForm.subType" disabled />
</el-form-item>
<el-form-item label="子类型名称">
<el-input v-model="subTypeForm.name" maxlength="50" show-word-limit @input="subTypeFormDirty = true" />
</el-form-item>
<el-form-item label="排序值">
<el-input-number
v-model="subTypeForm.sortOrder"
:min="0"
:max="9999"
controls-position="right"
@change="subTypeFormDirty = true"
/>
<span class="ar-form-tip">数值越小越靠前</span>
</el-form-item>
<el-form-item label="启用状态">
<el-switch
v-model="subTypeForm.isEnabled"
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="停用"
@change="subTypeFormDirty = true"
/>
<span class="ar-form-tip">停用后该子类型不参与规则匹配</span>
</el-form-item>
<el-form-item>
<el-button
size="small"
type="primary"
:loading="subTypeSaving"
:disabled="isSubTypeReadOnly || !subTypeFormDirty"
@click="handleSaveSubType"
>
保存
</el-button>
<el-button size="small" :disabled="!subTypeFormDirty" @click="syncSubTypeForm">
重置
</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
<div class="ar-tabs-card">
<el-tabs v-model="activeTab" class="ar-tabs">
<el-tab-pane label="基本信息" name="base">
<div class="task-panel ar-tab-panel">
<div class="task-panel__body">
<el-form
:model="subTypeForm"
:disabled="isSubTypeReadOnly"
class="task-panel__form"
@submit.prevent
>
<div class="task-panel__grid">
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label">子类型编码</span>
<div class="task-panel__field-form">
<el-form-item>
<el-input v-model="subTypeForm.subType" size="default" disabled placeholder="—" />
</el-form-item>
</div>
</div>
<el-tab-pane label="关键词" name="keyword" lazy>
<KeywordPanel
:sub-type-id="currentSubType.id"
@dirty-change="keywordDirty = $event"
/>
</el-tab-pane>
<el-tab-pane label="处理函数" name="function" lazy>
<FunctionPanel
:sub-type-id="currentSubType.id"
:writable="!isSubTypeReadOnly"
@dirty-change="functionDirty = $event"
/>
</el-tab-pane>
<el-tab-pane label="取号规则" name="rule" lazy>
<NumberRulePanel
:sub-type-id="currentSubType.id"
:writable="!isSubTypeReadOnly"
@dirty-change="ruleDirty = $event"
/>
</el-tab-pane>
<el-tab-pane label="群白名单" name="group" lazy>
<GroupPanel
:sub-type-id="currentSubType.id"
:writable="!isSubTypeReadOnly"
@dirty-change="groupDirty = $event"
/>
</el-tab-pane>
<el-tab-pane label="回复配置" name="reply" lazy>
<ReplyPanel
:sub-type-id="currentSubType.id"
@dirty-change="replyDirty = $event"
/>
</el-tab-pane>
</el-tabs>
<div class="task-panel__field task-panel__field--input">
<span class="task-panel__field-label is-required">子类型名称</span>
<div class="task-panel__field-form">
<el-form-item>
<el-input
v-model="subTypeForm.name"
size="default"
maxlength="50"
show-word-limit
clearable
placeholder="请输入子类型名称"
@input="subTypeFormDirty = true"
/>
</el-form-item>
</div>
</div>
<div class="task-panel__field task-panel__field--control">
<span class="task-panel__field-label">排序值</span>
<div class="task-panel__field-form task-panel__field-form--row">
<el-form-item>
<el-input-number
v-model="subTypeForm.sortOrder"
size="default"
:min="0"
:max="9999"
:precision="0"
controls-position="right"
style="width: 100%"
@change="subTypeFormDirty = true"
/>
</el-form-item>
</div>
</div>
<div class="task-panel__field task-panel__field--control">
<span class="task-panel__field-label">启用状态</span>
<div class="task-panel__field-form task-panel__field-form--row">
<el-switch
v-model="subTypeForm.isEnabled"
:active-value="1"
:inactive-value="0"
active-text="启用"
inactive-text="停用"
@change="subTypeFormDirty = true"
/>
</div>
</div>
</div>
</el-form>
<p class="task-panel__form-tip">
排序值越小越靠前;停用后该子类型不参与规则匹配,已配置的关键词与回复保留。
</p>
</div>
<footer class="task-panel__foot">
<span class="task-panel__hint">
{{ subTypeFormDirty ? '有未保存的修改' : '当前配置已保存' }}
</span>
<div class="task-panel__actions">
<el-button size="small" :disabled="!subTypeFormDirty" @click="syncSubTypeForm">
重置
</el-button>
<el-button
size="small"
type="primary"
:loading="subTypeSaving"
:disabled="isSubTypeReadOnly || !subTypeFormDirty"
@click="handleSaveSubType"
>
保存
</el-button>
</div>
</footer>
</div>
</el-tab-pane>
<el-tab-pane label="关键词" name="keyword" lazy>
<KeywordPanel
:sub-type-id="currentSubType.id"
@dirty-change="keywordDirty = $event"
/>
</el-tab-pane>
<el-tab-pane label="处理函数" name="function" lazy>
<FunctionPanel
:sub-type-id="currentSubType.id"
:writable="!isSubTypeReadOnly"
@dirty-change="functionDirty = $event"
/>
</el-tab-pane>
<el-tab-pane label="取号规则" name="rule" lazy>
<NumberRulePanel
:sub-type-id="currentSubType.id"
:writable="!isSubTypeReadOnly"
@dirty-change="ruleDirty = $event"
/>
</el-tab-pane>
<el-tab-pane label="群白名单" name="group" lazy>
<GroupPanel
:sub-type-id="currentSubType.id"
:writable="!isSubTypeReadOnly"
@dirty-change="groupDirty = $event"
/>
</el-tab-pane>
<el-tab-pane label="回复配置" name="reply" lazy>
<ReplyPanel
:sub-type-id="currentSubType.id"
@dirty-change="replyDirty = $event"
/>
</el-tab-pane>
</el-tabs>
</div>
</div>
</section>
@ -324,6 +428,7 @@
<script setup lang="ts">
import { computed, nextTick, reactive, ref, watch } from 'vue'
import { ElMessage, ElMessageBox, type TreeInstance } from 'element-plus'
import { Search } from '@element-plus/icons-vue'
import {
inboxV2SubTypeDelete,
inboxV2SubTypeList,
@ -351,6 +456,13 @@ import GroupPanel from './components/GroupPanel.vue'
import ReplyPanel from './components/ReplyPanel.vue'
import TypeFormDialog from './components/TypeFormDialog.vue'
import SubTypeFormDialog from './components/SubTypeFormDialog.vue'
import UpperTable from '@/components/UpperTable/index.vue'
/** 子类型表格列:在公共列配置基础上追加「操作」列 */
const subTypeTableColumns = [
...subTypeColumns,
{ prop: 'actions', label: '操作', width: '190', align: 'center' as const },
]
const treeRef = ref<TreeInstance | null>(null)
const treeLoading = ref(false)
@ -763,58 +875,49 @@ loadTreeData()
<style scoped lang="scss">
@use "../../order/orderManagement/styles/order-sub.scss";
@use "./components/panel.scss";
.auto-reply-page {
gap: 10px;
padding: 10px;
}
/* 右侧主内容区:内边距由页面统一控制,避免与容器 padding 叠加 */
.order-sub-container .ar-main {
padding: 0;
gap: 10px;
/* 子类型面板:填充剩余高度 */
> .ar-panel {
flex: 1;
min-height: 0;
height: auto;
}
}
// ==================== 左侧树 ====================
.ar-tree-pane {
.ar-side {
flex: 0 0 288px;
width: 288px;
display: flex;
flex-direction: column;
gap: 8px;
padding: 10px;
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
min-height: 0;
}
.ar-tree-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
.ar-side__filter {
flex-shrink: 0;
}
.ar-tree-title {
font-size: 14px;
font-weight: 600;
color: #303133;
}
.ar-tree-actions {
display: flex;
align-items: center;
gap: 6px;
}
.ar-tree-filter {
flex-shrink: 0;
}
.ar-tree-body {
.ar-side__tree {
flex: 1;
min-height: 0;
overflow: auto;
padding: 4px;
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 4px;
:deep(.el-tree) {
background: transparent;
@ -850,12 +953,24 @@ loadTreeData()
color: #606266;
}
// ==================== 右侧内容 ====================
/* 树节点轻量标记(替代 el-tag,减少组件开销) */
.ar-tree-badge {
flex-shrink: 0;
padding: 0 4px;
border-radius: 2px;
font-size: 11px;
line-height: 16px;
color: #909399;
background: #f4f4f5;
.ar-main {
gap: 10px;
&--danger {
color: #f56c6c;
background: #fef0f0;
}
}
// ==================== 右侧内容 ====================
.ar-empty {
flex: 1;
display: flex;
@ -879,129 +994,15 @@ loadTreeData()
color: #c0c4cc;
}
.ar-type-panel {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
gap: 10px;
}
.ar-block {
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 10px;
display: flex;
flex-direction: column;
gap: 8px;
}
.ar-block--flex {
flex: 1;
min-height: 0;
}
.ar-block-table {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.ar-block-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-shrink: 0;
}
.ar-block-title {
font-size: 13px;
font-weight: 600;
color: #303133;
}
.ar-block-tip {
margin-left: 8px;
font-size: 12px;
font-weight: 400;
color: #909399;
}
.ar-block-actions {
display: flex;
align-items: center;
gap: 8px;
}
.ar-form-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0 12px;
:deep(.el-form-item) {
margin-bottom: 8px;
}
}
.ar-subtype-panel {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
padding: 10px;
}
.ar-subtype-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
flex-shrink: 0;
padding-bottom: 8px;
border-bottom: 1px solid #ebeef5;
}
.ar-subtype-title {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}
.ar-subtype-name {
font-size: 14px;
font-weight: 600;
color: #303133;
}
.ar-subtype-actions {
display: flex;
align-items: center;
gap: 10px;
}
.ar-subtype-path {
font-size: 12px;
color: #909399;
}
/* 页签卡片内部:让内容面板吃满高度 */
.ar-tabs {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
padding-top: 6px;
:deep(.el-tabs__header) {
margin-bottom: 10px;
margin: 0 0 10px;
flex-shrink: 0;
}
@ -1011,11 +1012,39 @@ loadTreeData()
}
:deep(.el-tab-pane) {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
}
}
.ar-base-form {
max-width: 560px;
/* 页签内的行条:不再重复卡片边框,改为面板内分隔标题 */
.ar-tabs :deep(.ar-toolbar) {
border: none;
border-bottom: 1px solid #ebeef5;
background: transparent;
padding: 0 0 8px;
margin-bottom: 8px;
}
/* 基本信息页签:面板自身负责内边距,与外层卡片不再叠加 */
.ar-tab-panel {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
/* 表单区按内容高度撑开(不再拉伸填满页签),空间不足时内部滚动 */
.task-panel__body {
flex: 0 1 auto;
min-height: 0;
overflow: auto;
padding: 0;
}
.task-panel__foot {
padding: 12px 0 0;
}
}
</style>

View File

@ -264,39 +264,96 @@
</div>
</el-dialog>
<!-- 对话链弹窗 -->
<el-dialog v-model="threadVisible" title="对话链" width="800px" destroy-on-close align-center>
<div v-if="threadData.length" class="thread-content">
<el-timeline>
<el-timeline-item
v-for="item in threadData"
:key="item.id"
:timestamp="formatTime(item.created_at)"
placement="top"
:type="item.direction === 'inbound' ? 'primary' : 'success'"
<!-- 对话链弹窗:面板结构 / 字段行对齐「新建波次策略」,时间轴仅做收发方向着色 -->
<el-dialog
v-model="threadVisible"
class="inbox-thread-dialog"
width="min(720px, 94vw)"
align-center
destroy-on-close
append-to-body
:show-close="false"
:close-on-click-modal="false"
>
<div class="task-panel">
<header class="task-panel__head">
<div class="task-panel__titles">
<h2>对话链</h2>
<p>按时间顺序查看该会话的收件与回信记录,共 {{ threadData.length }} 条</p>
</div>
<button
class="task-panel__close"
type="button"
aria-label="关闭"
@click="threadVisible = false"
>
<el-card shadow="hover" size="small">
<div class="thread-card-header">
<span :class="getStatusTextClass(item.direction === 'inbound' ? 'primary' : 'success')">
{{ item.direction === 'inbound' ? '收件' : '回信' }}
</span>
<span v-if="item.target_channel" :class="getStatusTextClass('primary')" style="margin-left: 8px">
{{ channelLabel(item.target_channel) }}
</span>
<span v-if="item.direction === 'outbound'" :class="getStatusTextClass(pushStatusTagType(item.push_status))" style="margin-left: 8px">
{{ pushStatusLabel(item.push_status) }}
</span>
<svg viewBox="0 0 12 12" fill="none">
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
</svg>
</button>
</header>
<div class="task-panel__body task-panel__body--scroll">
<div class="task-panel__grid task-panel__grid--stats">
<div class="task-panel__field">
<span class="task-panel__field-label">对话条数</span>
<strong class="task-panel__field-value">{{ threadData.length }} 条</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">收件</span>
<strong class="task-panel__field-value">
<span :class="getStatusTextClass('primary')">{{ threadInboundCount }}</span>
<span class="thread-unit">条</span>
</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">回信</span>
<strong class="task-panel__field-value">
<span :class="getStatusTextClass('success')">{{ threadOutboundCount }}</span>
<span class="thread-unit">条</span>
</strong>
</div>
</div>
<ol v-if="threadData.length" class="thread-flow">
<li
v-for="item in threadData"
:key="item.id"
class="thread-flow__item"
:class="item.direction === 'inbound' ? 'is-inbound' : 'is-outbound'"
>
<span class="thread-flow__node" aria-hidden="true"></span>
<div class="thread-flow__card">
<div class="thread-flow__head">
<span class="thread-flow__badge">{{ item.direction === 'inbound' ? '收件' : '回信' }}</span>
<span v-if="item.target_channel" class="thread-flow__tag">{{ channelLabel(item.target_channel) }}</span>
<span
v-if="item.direction === 'outbound'"
class="thread-flow__tag"
:class="getStatusTextClass(pushStatusTagType(item.push_status))"
>{{ pushStatusLabel(item.push_status) }}</span>
<time class="thread-flow__time">{{ formatTime(item.created_at) }}</time>
</div>
<p v-if="item.content" class="thread-flow__text">{{ item.content }}</p>
<div v-if="item.ext_id || item.group_name" class="thread-flow__meta">
<span v-if="item.ext_id">外部ID:{{ item.ext_id }}</span>
<span v-if="item.group_name">群:{{ item.group_name }}</span>
</div>
</div>
<div class="thread-card-body">
<p v-if="item.content" class="thread-content-text">{{ item.content }}</p>
<p v-if="item.ext_id" class="thread-meta">外部ID: {{ item.ext_id }}</p>
<p v-if="item.group_name" class="thread-meta">群: {{ item.group_name }}</p>
</div>
</el-card>
</el-timeline-item>
</el-timeline>
</li>
</ol>
<div v-else v-loading="threadLoading" class="thread-flow__empty">暂无对话链数据</div>
</div>
<footer class="task-panel__foot">
<span class="task-panel__hint">时间正序排列;推送失败的回信可在列表中重推</span>
<div class="task-panel__actions">
<el-button size="small" @click="threadVisible = false">关闭</el-button>
<el-button size="small" type="primary" @click="handleReplyFromThread">回信</el-button>
</div>
</footer>
</div>
<div v-else v-loading="threadLoading" class="thread-empty">暂无对话链数据</div>
</el-dialog>
</div>
</template>
@ -627,8 +684,18 @@ async function handleRetry(row: any) {
const threadVisible = ref(false)
const threadLoading = ref(false)
const threadData = ref<any[]>([])
/** 触发对话链的原始行:用于在弹窗内直接发起回信 */
const threadRootRow = ref<any>(null)
const threadInboundCount = computed(
() => threadData.value.filter((item) => item?.direction === 'inbound').length
)
const threadOutboundCount = computed(
() => threadData.value.filter((item) => item?.direction === 'outbound').length
)
async function handleViewThread(row: any) {
threadRootRow.value = row ?? null
threadVisible.value = true
threadData.value = []
threadLoading.value = true
@ -641,6 +708,13 @@ async function handleViewThread(row: any) {
finally { threadLoading.value = false }
}
/** 对话链底部「回信」:复用行内回信弹窗,父消息取打开对话链的那条 */
function handleReplyFromThread() {
const row = threadRootRow.value
threadVisible.value = false
if (row) handleOpenReply(row)
}
// ==================== 货主列表加载 ====================
async function loadStoreOptions() {
@ -701,16 +775,146 @@ onMounted(() => {
}
}
.thread-content {
max-height: 500px;
overflow-y: auto;
.thread-card-header { display: flex; align-items: center; margin-bottom: 8px; }
.thread-card-body {
.thread-content-text { font-size: 13px; color: #303133; margin: 0 0 6px 0; line-height: 1.5; }
.thread-meta { margin: 2px 0; font-size: 12px; color: #909399; }
/* 对话链时间轴:左侧竖线 + 方向色节点,卡片沿用面板 4px 圆角 / 1px 边框语言 */
.thread-flow {
position: relative;
margin: 0;
padding: 2px 0 2px 20px;
list-style: none;
/* 竖线:与节点圆心对齐(节点 9px,圆心 4.5px) */
&::before {
content: '';
position: absolute;
left: 4px;
top: 8px;
bottom: 8px;
width: 1px;
background: #e4e7ed;
}
&__item {
position: relative;
padding-bottom: 10px;
&:last-child {
padding-bottom: 0;
}
}
&__node {
position: absolute;
left: -20px;
top: 12px;
width: 9px;
height: 9px;
box-sizing: border-box;
border: 2px solid #909399;
border-radius: 50%;
background: #fff;
}
&__item.is-inbound &__node {
border-color: #409eff;
}
&__item.is-outbound &__node {
border-color: #67c23a;
}
&__card {
padding: 8px 12px;
border: 1px solid #ebeef5;
border-radius: 4px;
background: #fff;
transition: border-color 0.2s, box-shadow 0.2s;
&:hover {
border-color: #dcdfe6;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
}
&__head {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 4px;
}
&__badge {
flex: none;
padding: 0 6px;
border-radius: 2px;
font-size: 12px;
line-height: 18px;
color: #606266;
background: #f4f4f5;
}
&__item.is-inbound &__badge {
color: #409eff;
background: #ecf5ff;
}
&__item.is-outbound &__badge {
color: #67c23a;
background: #f0f9eb;
}
&__tag {
font-size: 12px;
line-height: 18px;
color: #606266;
}
/* 时间靠右,与标签同一基线 */
&__time {
margin-left: auto;
padding-left: 8px;
font-size: 12px;
line-height: 18px;
color: #909399;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
&__text {
margin: 0;
font-size: 13px;
line-height: 1.6;
color: #303133;
white-space: pre-wrap;
word-break: break-word;
}
&__meta {
display: flex;
flex-wrap: wrap;
gap: 2px 12px;
margin-top: 4px;
font-size: 12px;
line-height: 18px;
color: #909399;
word-break: break-all;
}
&__empty {
padding: 40px 0;
text-align: center;
font-size: 13px;
color: #909399;
}
}
.thread-empty { text-align: center; padding: 40px; color: #909399; }
.thread-unit {
margin-left: 2px;
font-size: 12px;
font-weight: 400;
color: #909399;
}
.empty-tip { color: #909399; font-size: 13px; padding: 16px; }
/* 系统回信:面板结构 / 尺寸对齐「手工录入运单号」(ManualWaybillForm) */
@ -785,6 +989,28 @@ onMounted(() => {
gap: 8px;
}
/* 双列栅格:每格一个「标签 + 值 / 控件」行,窄屏(<720px)自动降为单列 */
&__grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
column-gap: 16px;
row-gap: 8px;
@media (max-width: 720px) {
grid-template-columns: minmax(0, 1fr);
}
/* 对话链概览:三格等分,并与下方时间轴留出间距 */
&--stats {
grid-template-columns: repeat(3, minmax(0, 1fr));
margin-bottom: 12px;
@media (max-width: 720px) {
grid-template-columns: minmax(0, 1fr);
}
}
}
&__field {
display: flex;
align-items: center;
@ -941,7 +1167,8 @@ onMounted(() => {
<style lang="scss">
/* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板 */
.el-dialog.system-reply-dialog {
.el-dialog.system-reply-dialog,
.el-dialog.inbox-thread-dialog {
padding: 0;
overflow: hidden;

View File

@ -242,7 +242,7 @@ import { ElMessage, type FormInstance } from 'element-plus'
import { Loading, CircleCheck, RefreshRight } from '@element-plus/icons-vue'
import { useUserStore } from '@/stores/modules/user'
import * as userApi from '@/api/user/user'
import { useFrontBrandStore } from '@/stores/modules/frontBrand'
import { useFrontBrandStore, DEFAULT_BRAND_LOGO } from '@/stores/modules/frontBrand'
import { setToken } from '@/utils/auth'
import { useI18n } from 'vue-i18n'
import LangSelect from '@/components/LangSelect/index.vue'
@ -258,7 +258,8 @@ const frontBrand = useFrontBrandStore()
const brand = computed(() => frontBrand.brand)
// 网页名称=品牌顶层 title(站点标题)、登录页 logo=品牌顶层 logo_url;登录页文字无独立配置字段时用默认标语(saveFrontConfig 顶层品牌字段配置)
const brandName = computed(() => frontBrand.siteTitle)
const brandLogo = computed(() => frontBrand.themeLoginLogoUrl || '../../../public/logo/1.png')
// 品牌豁免域名(主域名)不拉取后端 Logo,固定使用前端默认 Logo(与 Navbar 一致)
const brandLogo = computed(() => frontBrand.themeLoginLogoUrl || DEFAULT_BRAND_LOGO)
const loginDesc = computed(() => frontBrand.themeLoginText || '现代化仓储管理系统 - 助力企业高效运营')
const loginBgStyle = computed(() =>
brand.value?.login_bg_url?.trim()

View File

@ -15,53 +15,77 @@
<el-dialog
v-model="dialogVisible"
:title="title"
width="1100px"
class="doc-picker-dialog"
width="min(1080px, 94vw)"
align-center
append-to-body
destroy-on-close
:close-on-click-modal="false"
>
<div class="picker-body">
<div class="picker-toolbar">
<el-input
v-model="keyword"
:placeholder="`输入${searchFieldLabel}搜索`"
clearable
style="width: 320px"
@keyup.enter="loadData(1)"
>
<template #append>
<el-button size="small" :loading="loading" @click="loadData(1)">查询</el-button>
</template>
</el-input>
</div>
<!-- 结构对齐 order/waveOrder「抓取团购单」:单行筛选 + 表格填满剩余高度 + 分页贴底 -->
<div class="doc-picker-body">
<el-form :inline="true" size="small" class="doc-picker-filters" @submit.prevent>
<el-form-item :label="searchFieldLabel">
<el-input
v-model="keyword"
clearable
:placeholder="`输入${searchFieldLabel}搜索`"
@keyup.enter="loadData(1)"
/>
</el-form-item>
<el-form-item class="doc-picker-filters__actions">
<el-button type="primary" :loading="loading" @click="loadData(1)">查询</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<div class="picker-table-wrap">
<div class="doc-picker-table-host">
<UpperTable
ref="tableRef"
:data="list"
:loading="loading"
show-selection
:pagination="{ currentPage: pagination.page, pageSize: pagination.pageSize, total: pagination.total }"
:show-pagination="false"
default-align="center"
:columns="columns"
:row-key="(row: any) => row.id ?? row[valueField] ?? ''"
empty-text="暂无数据,请输入关键字查询"
@selection-change="handleSelectionChange"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
/>
>
<template #empty>
<div class="empty-tip">暂无数据,请输入关键字查询</div>
</template>
</UpperTable>
</div>
</div>
<template #footer>
<el-button size="small" @click="dialogVisible = false">取消</el-button>
<el-button size="small" type="primary" :disabled="!selectedItem" @click="applySelection">确定</el-button>
<div class="doc-picker-footer">
<span class="doc-picker-footer__hint">{{ selectedHint }}</span>
<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"
background
size="small"
class="doc-picker-pagination"
@current-change="handlePageChange"
@size-change="handlePageSizeChange"
/>
<div class="doc-picker-footer__actions">
<el-button size="small" @click="dialogVisible = false">取消</el-button>
<el-button size="small" type="primary" :disabled="!selectedItem" @click="applySelection">确定</el-button>
</div>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue'
import { computed, ref, reactive } from 'vue'
import UpperTable from '@/components/UpperTable/index.vue'
export interface DocSearchPickerColumn {
@ -113,15 +137,26 @@ const loading = ref(false)
const keyword = ref('')
const list = ref<any[]>([])
const selectedItem = ref<any>(null)
const selectedRows = ref<any[]>([])
const tableRef = ref()
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
/** 页脚提示:展示当前已选记录的主字段(第一列) */
const selectedHint = computed(() => {
if (!selectedItem.value) return '未选择记录'
if (selectedRows.value.length > 1) return `已勾选 ${selectedRows.value.length} 条,确定后只取第一条`
const primaryColumn = props.columns?.[0]
const text = primaryColumn ? String(selectedItem.value[primaryColumn.prop] ?? '').trim() : ''
return text ? `已选:${text}` : '已选 1 条记录'
})
function openPicker() {
dialogVisible.value = true
keyword.value = ''
list.value = []
pagination.total = 0
selectedItem.value = null
selectedRows.value = []
}
function handleClear() {
@ -152,7 +187,8 @@ async function loadData(page = 1) {
}
function handleSelectionChange(selection: any[]) {
selectedItem.value = selection?.[0] ?? null
selectedRows.value = Array.isArray(selection) ? selection : []
selectedItem.value = selectedRows.value[0] ?? null
}
function handlePageChange(page: number) {
@ -165,6 +201,17 @@ function handlePageSizeChange(size: number) {
loadData(1)
}
/** 重置筛选与勾选(不自动查询,与刚打开弹窗的状态一致) */
function handleReset() {
keyword.value = ''
list.value = []
pagination.page = 1
pagination.total = 0
selectedItem.value = null
selectedRows.value = []
tableRef.value?.clearSelection?.()
}
function applySelection() {
if (!selectedItem.value) return
const value = String(selectedItem.value[props.valueField] ?? '')
@ -174,25 +221,177 @@ function applySelection() {
}
</script>
<style scoped>
<style lang="scss" scoped>
.doc-search-picker {
width: 100%;
}
.picker-body {
.doc-picker-body {
display: flex;
flex-direction: column;
gap: 8px;
height: 100%;
min-height: 0;
}
.picker-toolbar {
margin-bottom: 12px;
flex-shrink: 0;
/* 筛选条:对齐「抓取团购单」——单行排列,标签不压缩,按钮不参与等分 */
.doc-picker-filters {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px 12px;
:deep(.el-form-item) {
flex: 1 1 200px;
min-width: 208px;
margin: 0;
align-items: center;
}
:deep(.el-form-item__label) {
padding: 0 4px 0 0;
white-space: nowrap;
color: var(--el-text-color-regular);
}
:deep(.el-input),
:deep(.el-select) {
width: 100%;
}
/* 查询 / 重置:按内容宽度,不参与列等分 */
:deep(.el-form-item.doc-picker-filters__actions) {
flex: 0 0 auto;
min-width: 0;
}
:deep(.doc-picker-filters__actions .el-form-item__content) {
flex: 0 0 auto;
flex-wrap: nowrap;
gap: 8px;
}
:deep(.doc-picker-filters__actions .el-button) {
margin: 0;
}
}
.picker-table-wrap {
/* 表格区填满弹窗剩余高度(UpperTable 内部表格自适应 100% 高度) */
.doc-picker-table-host {
flex: 1;
min-height: 200px;
max-height: 50vh;
overflow: auto;
min-height: 120px;
min-width: 0;
overflow: hidden;
display: flex;
flex-direction: column;
/* 勾选列(表头 + 数据单元格)复选框居中 */
:deep(.el-table-column--selection .cell) {
display: flex;
align-items: center;
justify-content: center;
padding: 0;
}
}
/* 页脚:左侧提示 + 分页与按钮同一水平行 */
.doc-picker-footer {
display: flex;
align-items: center;
justify-content: flex-end;
flex-wrap: wrap;
gap: 12px;
:deep(.el-button) {
margin-left: 0;
margin-right: 0;
}
}
.doc-picker-footer__hint {
margin-right: auto;
min-width: 0;
font-size: 12px;
line-height: 20px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.doc-picker-footer__actions {
display: flex;
align-items: center;
gap: 8px;
}
/* 分页尺寸 / 选择器宽度对齐 UpperTable 默认分页 */
.doc-picker-pagination {
flex: none;
margin-right: 4px;
:deep(.el-pagination) {
flex-wrap: wrap;
justify-content: flex-end;
--el-pagination-button-width: 28px;
--el-pagination-button-height: 28px;
}
:deep(.el-pagination__total),
:deep(.el-pagination__sizes) {
display: inline-flex !important;
margin-right: 8px;
}
:deep(.el-select--small) {
width: 80px;
}
:deep(.el-input__wrapper) {
padding: 0 4px;
}
}
.empty-tip {
font-size: 13px;
color: #909399;
}
</style>
<style lang="scss">
/* el-dialog 会被 append 到 body:固定 80vh + 内容区撑满(对齐「抓取团购单」的 wave-fixed-height-dialog) */
.el-dialog.doc-picker-dialog {
height: 80vh;
max-height: 80vh;
display: flex;
flex-direction: column;
box-sizing: border-box;
overflow: hidden;
padding: 0;
.el-dialog__header {
flex-shrink: 0;
margin: 0;
padding: 16px 16px 8px;
}
/* 关闭按钮沿用 EP 默认定位(右上角 54×54 热区,图标居中),
不要额外 top/right 偏移,否则图标会离开角落、看起来「飘」在标题里 */
.el-dialog__headerbtn {
top: 0;
right: 0;
}
.el-dialog__body {
flex: 1;
min-height: 0;
overflow: hidden;
padding: 0 16px;
}
.el-dialog__footer {
flex-shrink: 0;
padding: 12px 16px 16px;
}
}
</style>

View File

@ -74,32 +74,8 @@
</el-form>
<p class="task-panel__form-tip">
系统会根据运单号自动反查订单运单记录并绑定包材,无需订单 ID;绑定成功后下方展示反查结果。
系统会根据运单号自动反查订单运单记录并绑定包材,无需订单 ID;绑定成功后自动关闭。
</p>
<!-- 绑定结果:静态信息行展示(与上方输入行拉开层次) -->
<div v-if="lastResult" class="task-panel__form task-panel__result">
<div class="task-panel__field">
<span class="task-panel__field-label">订单 ID</span>
<strong class="task-panel__field-value">{{ lastResult.order_id ?? '—' }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">运单号</span>
<strong class="task-panel__field-value">{{ lastResult.waybill_code || '—' }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">包材 ID</span>
<strong class="task-panel__field-value">{{ lastResult.package_material_id ?? '—' }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">包材编码</span>
<strong class="task-panel__field-value">{{ lastResult.package_material_code || '—' }}</strong>
</div>
<div class="task-panel__field">
<span class="task-panel__field-label">包材名称</span>
<strong class="task-panel__field-value">{{ lastResult.package_material_name_snapshot || '—' }}</strong>
</div>
</div>
</div>
<footer class="task-panel__foot">
@ -136,7 +112,7 @@ const props = defineProps<{
const emit = defineEmits<{
(e: 'update:modelValue', value: boolean): void
(e: 'success', payload: BindExpressPackageMaterialByWaybillResponse): void
(e: 'success', payload?: BindExpressPackageMaterialByWaybillResponse): void
}>()
const formRef = ref<FormInstance>()
@ -144,7 +120,6 @@ const materialSelectRef = ref<{ focus?: () => void } | null>(null)
const submitting = ref(false)
const materialLoading = ref(false)
const materialOptions = ref<Array<{ id: number; material_code: string; material_name: string }>>([])
const lastResult = ref<BindExpressPackageMaterialByWaybillResponse | null>(null)
const form = reactive({
waybill_code: '',
@ -160,7 +135,6 @@ watch(
() => props.modelValue,
(visible) => {
if (!visible) return
lastResult.value = null
form.waybill_code = String(props.initialWaybillCode || '').trim()
form.package_material_id = undefined
materialOptions.value = []
@ -176,7 +150,6 @@ function resetForm() {
form.waybill_code = ''
form.package_material_id = undefined
materialOptions.value = []
lastResult.value = null
formRef.value?.clearValidate()
}
@ -234,11 +207,10 @@ async function handleSubmit() {
throw new Error(res?.message || '绑定包材失败')
}
const payload = unwrapBindPayload(res)
if (payload) {
lastResult.value = payload
emit('success', payload)
}
emit('success', payload ?? undefined)
ElMessage.success('包材绑定成功')
// 绑定成功后直接关闭表单,不再展示任何结果信息
handleClose()
} catch (error: any) {
ElMessage.error(error?.message || '绑定包材失败')
} finally {
@ -418,11 +390,6 @@ async function handleSubmit() {
color: #909399;
}
/* 绑定结果:与上方表单行保持 8px 间距 */
&__result {
margin-top: 8px;
}
&__foot {
display: flex;
align-items: center;

View File

@ -7,16 +7,16 @@
<!-- <el-tag v-if="waybillCodesText" size="small" type="info">运单汇总:{{ waybillCodesText }}</el-tag> -->
</div>
<el-table :data="expressRows" border stripe size="small" empty-text="暂无运单信息">
<el-table-column prop="waybill_code" label="运单号" min-width="160" show-overflow-tooltip>
<el-table :data="expressRows" border stripe size="small" empty-text="暂无运单信息" align="center">
<el-table-column prop="waybill_code" label="运单号" min-width="160" align="center" show-overflow-tooltip>
<template #default="{ row }">
<span>{{ row.waybill_code }}</span>
<el-tag v-if="row.is_main" size="small" type="danger" effect="dark" style="margin-left:4px">主</el-tag>
</template>
</el-table-column>
<el-table-column prop="logistics_name" label="物流公司" min-width="120" show-overflow-tooltip />
<el-table-column prop="logistics_interface_name" label="快递接口" min-width="120" show-overflow-tooltip />
<el-table-column label="称重(g)" width="110" align="right">
<el-table-column prop="logistics_name" label="物流公司" min-width="120" align="center" show-overflow-tooltip />
<el-table-column prop="logistics_interface_name" label="快递接口" min-width="120" align="center" show-overflow-tooltip />
<el-table-column label="称重(g)" width="110" align="center">
<template #default="{ row }">
{{ formatWeight(row.weighing_weight) }}
</template>
@ -26,7 +26,7 @@
{{ formatTime(row.created_at) }}
</template>
</el-table-column>
<el-table-column label="包材" min-width="140" show-overflow-tooltip>
<el-table-column label="包材" min-width="140" align="center" show-overflow-tooltip>
<template #default="{ row }">
{{ row.package_material_name_snapshot || row.package_material_code || '—' }}
</template>

View File

@ -65,17 +65,16 @@
</span>
</template>
<template #column-roles="{ row }">
<template v-if="row.roles && row.roles.length">
<el-tag
<span v-if="row.roles && row.roles.length" class="role-text-group">
<span
v-for="r in row.roles"
:key="r.role_id"
class="role-tag"
size="small"
:type="roleTagMap[r.role_name] || 'info'"
class="ut-status-text"
:class="`ut-status-text--${roleTagMap[r.role_name] || 'info'}`"
>
{{ r.role_name }}
</el-tag>
</template>
</span>
</span>
<span v-else class="cell-empty">未分配</span>
</template>
<template #column-actions="{ row }">
@ -1166,8 +1165,12 @@ const handleUnbindWechat = (row: any) => {
white-space: nowrap;
}
.role-tag {
margin: 2px;
/* 角色:彩色纯文本(与 order 页 .ut-status-text 一致,去掉 el-tag 色块背景) */
.role-text-group {
display: inline-flex;
align-items: center;
flex-wrap: wrap;
gap: 2px 8px;
}
.cell-empty {

View File

@ -1,75 +1,95 @@
<template>
<div class="permission-container">
<!-- 左侧树 -->
<div class="left-panel">
<div class="panel-header">权限类型</div>
<div class="panel-body">
<div class="order-sub-container permission-page" :style="{ height: containerHeight }">
<!-- 左侧:权限类型(白色栏条 + 树卡片,布局对齐 order 页导航区) -->
<aside class="permission-side">
<div class="permission-toolbar">
<span class="permission-toolbar__title">权限类型</span>
<span class="permission-toolbar__sub">点击筛选</span>
</div>
<div class="permission-tree">
<el-tree
:data="typeTreeData"
:props="{ label: 'label' }"
node-key="value"
:current-node-key="currentType"
highlight-current
:expand-on-click-node="false"
@node-click="handleNodeClick"
/>
</div>
</div>
</aside>
<!-- 右侧容器 -->
<div class="right-panel">
<div class="filter-container">
<el-form :inline="true" :model="listQuery" class="demo-form-inline" size="small" style="display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 0;">
<el-form-item label="关键词" style="margin-bottom: 0;">
<el-input v-model="listQuery.keyword" placeholder="路径/名称/标题" clearable @keyup.enter="handleFilter" style="width: 200px" />
</el-form-item>
<el-form-item label="包含已禁用" style="margin-bottom: 0;">
<el-switch v-model="listQuery.includeDisabled" @change="handleFilter" />
</el-form-item>
<el-form-item style="margin-bottom: 0; margin-left: auto;">
<el-button size="small" type="primary" icon="Search" @click="handleFilter">搜索</el-button>
<el-button size="small" type="success" icon="Plus" @click="handleCreate">新增权限</el-button>
<el-button size="small" type="danger" icon="Delete" :disabled="selectedIds.length === 0" @click="handleBatchDelete">批量删除</el-button>
</el-form-item>
</el-form>
<!-- 右侧:工具栏 + 树形列表(对齐 order/waveOrder 列表页结构) -->
<section class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<order-toolbar-button-group
:buttons="toolbarButtons"
:resolve-disabled="resolveButtonDisabled"
:resolve-loading="resolveButtonLoading"
:resolve-label="resolveButtonLabel"
:layout-key="toolbarLayoutKey"
@action="handleToolbarButtonClick"
/>
</div>
<div class="toolbar-right">
<el-input
v-model="listQuery.keyword"
class="toolbar-right__keyword"
size="small"
placeholder="路径 / 名称 / 标题"
clearable
:prefix-icon="Search"
@keyup.enter="handleFilter"
@clear="handleFilter"
/>
<span class="toolbar-right__label">包含已禁用</span>
<el-switch v-model="listQuery.includeDisabled" size="small" @change="handleFilter" />
</div>
</div>
<!-- 列表视图(树形展示) -->
<el-table
v-loading="listLoading"
:data="filteredTreeData"
row-key="permission_id"
border
height="calc(100vh - 180px)"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="标题" prop="meta_title" min-width="160" show-overflow-tooltip />
<el-table-column label="名称" prop="name" min-width="140" show-overflow-tooltip />
<el-table-column label="组件" prop="component" min-width="160" show-overflow-tooltip />
<el-table-column label="路径 (Path)" prop="path" min-width="220" show-overflow-tooltip />
<el-table-column label="类型" prop="type" width="120" align="center">
<template #default="{ row }">
<span :class="getStatusTextClass(permissionTypeTagMap[row.type] || 'info')">{{ permissionTypeNameMap[row.type] || row.type }}</span>
<div class="upper-wrapper">
<upper-table
ref="upperTableRef"
table-id="setting-permission"
default-align="center"
:data="pagedTreeData"
:columns="columns"
row-key="permission_id"
:show-selection="true"
selection-mode="native"
:pagination="pagination"
:page-sizes="[10, 20, 50, 100]"
:enable-column-config="true"
:virtual-threshold="999999"
:loading="listLoading"
:query-time="queryTime"
empty-text="暂无权限数据"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@selection-change="handleSelectionChange"
>
<template #column-type="{ row }">
<span :class="getStatusTextClass(permissionTypeTagMap[row.type] || 'info')">
{{ permissionTypeNameMap[row.type] || row.type }}
</span>
</template>
</el-table-column>
<el-table-column label="排序" prop="sort" width="80" align="center" />
<el-table-column label="状态" prop="status" width="90" align="center">
<template #default="{ row }">
<template #column-status="{ row }">
<span :class="getStatusTextClass(row.status === 1 ? 'success' : 'danger')">
{{ row.status === 1 ? '启用' : '禁用' }}
</span>
</template>
</el-table-column>
<el-table-column label="操作" width="220" align="center" fixed="right">
<template #default="{ row }">
<el-button size="small" type="primary" link icon="Plus" @click="handleCreateChild(row)">下级</el-button>
<el-button size="small" type="primary" link icon="Edit" @click="handleUpdate(row)">编辑</el-button>
<el-button size="small" type="danger" link icon="Delete" @click="handleDelete(row)">删除</el-button>
<template #column-actions="{ row }">
<el-button size="small" type="primary" link @click.stop="handleCreateChild(row)">下级</el-button>
<el-button size="small" type="primary" link @click.stop="handleUpdate(row)">编辑</el-button>
<el-button size="small" type="danger" link @click.stop="handleDelete(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</upper-table>
</div>
</section>
<!-- 新增权限弹窗:面板结构 / 尺寸对齐「手工录入运单号」(ManualWaybillForm) -->
<el-dialog
@ -111,6 +131,8 @@
placeholder="请选择上级权限(留空表示顶级)"
clearable
check-strictly
fit-input-width
popper-class="permission-parent-select-popper"
style="width: 100%"
/>
</el-form-item>
@ -251,6 +273,8 @@
placeholder="请选择上级权限(留空表示顶级)"
clearable
check-strictly
fit-input-width
popper-class="permission-parent-select-popper"
style="width: 100%"
/>
</el-form-item>
@ -360,23 +384,32 @@
</template>
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue'
import { ref, reactive, computed, onMounted, watch } from 'vue'
import { permissionList, permissionAdd, permissionUpdate, permissionDelete } from '@/api/setting.permission/permission'
import { ElMessage, ElMessageBox } from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { Search } from '@element-plus/icons-vue'
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import { useSettingsStore } from '@/stores/modules/settings'
import {
permissionRules,
defaultCreateTemp,
defaultUpdateTemp,
permissionTypeTagMap,
permissionTypeNameMap,
permissionTypeOptions
permissionTypeOptions,
permissionColumns
} from './permission-config'
const listLoading = ref(false)
const rawList = ref<any[]>([])
const treeData = ref<any[]>([])
const queryTime = ref(0)
const upperTableRef = ref<any>(null)
const columns = permissionColumns
const listQuery = reactive({
keyword: '',
@ -385,6 +418,59 @@ const listQuery = reactive({
const selectedIds = ref<number[]>([])
// ============================================================
// 容器高度 + 工具栏按钮组(布局对齐 order/waveOrder 列表页)
// ============================================================
const settingsStore = useSettingsStore()
const containerHeight = computed(() =>
settingsStore.shortcutExpanded ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)'
)
/** 勾选态驱动的按钮禁用(noSelection:未勾选时批量操作不可用) */
const buttonDisabledMap = computed<Record<string, boolean>>(() => ({
noSelection: selectedIds.value.length === 0
}))
const toolbarButtons: ToolbarButtonConfig[] = [
{ key: 'refresh', label: '刷新', category: 'refresh', size: 'small', loadingKey: 'loading', action: 'refresh' },
{ key: 'columnConfig', label: '字段设置', category: 'setting', size: 'small', action: 'openColumnConfigPanel' },
{ key: 'create', label: '新增权限', category: 'action', size: 'small', action: 'create' },
// 批量删除依赖勾选行:与团购波次一致,未勾选置灰
{ key: 'batchDelete', label: '批量删除', category: 'cancel', size: 'small', disabledKey: 'noSelection', action: 'batchDelete' }
]
const toolbarLayoutKey = computed(() =>
JSON.stringify({
loading: listLoading.value,
disabled: buttonDisabledMap.value
})
)
function resolveButtonDisabled(disabledKey?: string) {
if (!disabledKey) return false
return Boolean(buttonDisabledMap.value[disabledKey])
}
function resolveButtonLoading(loadingKey?: string) {
if (!loadingKey) return false
return loadingKey === 'loading' ? listLoading.value : false
}
function resolveButtonLabel(defaultLabel: string) {
return defaultLabel
}
const toolbarActionMap: Record<string, () => void> = {
refresh: () => { void getList() },
create: () => handleCreate(),
batchDelete: () => handleBatchDelete(),
openColumnConfigPanel: () => { upperTableRef.value?.openColumnConfig?.() }
}
function handleToolbarButtonClick(action: string) {
toolbarActionMap[action]?.()
}
// 左侧树数据
const typeTreeData = ref([
{ label: '全部类型', value: '' },
@ -394,6 +480,7 @@ const currentType = ref<string>('')
const handleNodeClick = (data: any) => {
currentType.value = data.value
currentPage.value = 1
}
const filteredTreeData = computed(() => {
@ -425,9 +512,46 @@ const filteredTreeData = computed(() => {
return result
})
// ============================================================
// 前端分页:setting.permission.list 返回全量权限树(入参无 page/pageSize),
// 因此按「顶层节点」分页,子节点跟随父节点在同一页渲染
// ============================================================
const currentPage = ref(1)
const pageSize = ref(20)
const pagination = computed(() => ({
currentPage: currentPage.value,
pageSize: pageSize.value,
total: filteredTreeData.value.length
}))
const pagedTreeData = computed(() => {
const start = (currentPage.value - 1) * pageSize.value
return filteredTreeData.value.slice(start, start + pageSize.value)
})
function handlePageChange(page: number) {
currentPage.value = page
}
function handlePageSizeChange(size: number) {
pageSize.value = size
currentPage.value = 1
}
/** 数据变化后页码超界时回退到最后一项 */
watch(
() => filteredTreeData.value.length,
(len) => {
const maxPage = Math.max(1, Math.ceil(len / pageSize.value))
if (currentPage.value > maxPage) currentPage.value = maxPage
}
)
// 获取并构建树形结构
const getList = async () => {
listLoading.value = true
const start = Date.now()
try {
const res = await permissionList({
keyword: listQuery.keyword || undefined,
@ -438,6 +562,7 @@ const getList = async () => {
} catch (err) {
console.error(err)
} finally {
queryTime.value = Date.now() - start
listLoading.value = false
}
}
@ -502,6 +627,7 @@ const getParentOptions = async () => {
}
const handleFilter = () => {
currentPage.value = 1
getList()
}
@ -673,55 +799,94 @@ onMounted(() => {
<style scoped lang="scss">
@use "../../../order/orderManagement/styles/order-sub.scss";
.permission-container {
height: calc(100vh - 84px);
/* 页面容器:对齐 order 页(左侧树卡片 + 右侧工具栏/表格) */
.permission-page {
gap: 10px;
padding: 10px;
}
/* 右侧主内容区内边距由页面统一控制,避免与容器 padding 叠加 */
.order-sub-container.permission-page .main-content {
padding: 0;
}
/* ==================== 左侧:权限类型树 ==================== */
.permission-side {
flex: 0 0 240px;
width: 240px;
display: flex;
flex-direction: row;
gap: 16px;
background-color: #f0f2f5;
padding: 16px;
flex-direction: column;
gap: 8px;
min-height: 0;
}
.permission-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
flex-shrink: 0;
min-height: 34px;
box-sizing: border-box;
padding: 6px 10px;
border: 1px solid #ebeef5;
background: #fff;
}
.left-panel {
width: 220px;
background: #fff;
border-radius: 4px;
display: flex;
flex-direction: column;
border: 1px solid #ebeef5;
.permission-toolbar__title {
font-size: 13px;
font-weight: 600;
color: #303133;
}
.panel-header {
padding: 12px 16px;
border-bottom: 1px solid #ebeef5;
font-weight: 600;
font-size: 15px;
color: #303133;
flex-shrink: 0;
}
.permission-toolbar__sub {
font-size: 12px;
color: #909399;
}
.panel-body {
flex: 1;
overflow-y: auto;
padding: 12px;
}
.permission-tree {
flex: 1;
min-height: 0;
overflow: auto;
padding: 4px;
background: #fff;
border: 1px solid #ebeef5;
border-radius: 4px;
:deep(.el-tree) {
background: transparent;
}
.right-panel {
flex: 1;
background: #fff;
border-radius: 4px;
display: flex;
flex-direction: column;
border: 1px solid #ebeef5;
padding: 16px;
min-width: 0;
.filter-container {
margin-bottom: 16px;
}
:deep(.el-tree-node__content) {
height: 32px;
}
}
/* ==================== 表格微调(树形表格对齐 order 页行高) ==================== */
/* 树形行:展开箭头落在首个数据列(标题),勾选列尺寸/行高由 UpperTable 统一控制 */
/* 单元格内容不换行、不拉高行高(长路径统一省略号 + tooltip) */
.upper-wrapper :deep(.el-table__body .cell) {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* ==================== 工具栏右侧 ==================== */
.toolbar-right__keyword {
width: 200px;
flex: 0 0 auto;
}
.toolbar-right__label {
font-size: 13px;
color: #606266;
white-space: nowrap;
}
/* 新增权限:面板结构 / 尺寸对齐「手工录入运单号」(ManualWaybillForm) */
.task-panel {
background: #fff;
@ -948,4 +1113,39 @@ onMounted(() => {
padding: 0;
}
}
/* 上级权限(el-tree-select)下拉:行高 / 字号 / 悬停 / 选中态对齐「权限类型」el-select 选项
(popper 挂载在 body,需用非 scoped 样式 + popper-class) */
.permission-parent-select-popper {
.el-tree {
background: transparent;
padding: 0;
}
.el-tree-node__content {
height: 34px;
line-height: 34px;
padding-right: 32px;
font-size: 14px;
color: var(--el-text-color-regular);
}
.el-tree-node__content:hover,
.el-tree-node:focus > .el-tree-node__content {
background-color: var(--el-fill-color-light);
}
/* 选中项:与 el-select 选项一致(主题色 + 加粗) */
.el-tree-node.is-current > .el-tree-node__content {
color: var(--el-color-primary);
font-weight: 700;
background-color: transparent;
}
/* 选中项悬停 / 聚焦时同样给出灰色背景(对齐 el-select 的 is-hovering 表现) */
.el-tree-node.is-current > .el-tree-node__content:hover,
.el-tree-node.is-current:focus > .el-tree-node__content {
background-color: var(--el-fill-color-light);
}
}
</style>

View File

@ -56,3 +56,15 @@ export const permissionTypeOptions = [
{ label: '小程序页面', value: 'miniprogram_pages', fullLabel: '小程序页面 (miniprogram_pages)' },
{ label: '工作台页面', value: 'workerstation_pages', fullLabel: '工作台页面 (workerstation_pages)' }
]
/** 权限列表列配置(UpperTable,对齐 order 页列定义写法) */
export const permissionColumns = [
{ prop: 'meta_title', label: '标题', minWidth: '160', showOverflowTooltip: true },
{ prop: 'name', label: '名称', minWidth: '140', showOverflowTooltip: true },
{ prop: 'component', label: '组件', minWidth: '160', showOverflowTooltip: true },
{ prop: 'path', label: '路径', minWidth: '220', showOverflowTooltip: true },
{ prop: 'type', label: '类型', width: '120', align: 'center' },
{ prop: 'sort', label: '排序', width: '80', align: 'center' },
{ prop: 'status', label: '状态', width: '90', align: 'center' },
{ prop: 'actions', label: '操作', width: '220', align: 'center', fixed: 'right' }
]

View File

@ -65,7 +65,7 @@
<template #column-actions="{ row }">
<div class="pickcart-operation-actions">
<el-button link type="primary" size="small" @click.stop="handleRowClick(row)">详情</el-button>
<!-- <el-button link type="primary" size="small" @click.stop="handleRowClick(row)">详情</el-button> -->
<el-button link type="primary" size="small" @click.stop="openEdit(row)">编辑</el-button>
<el-button link type="success" size="small" @click.stop="openBind(row)">绑定任务</el-button>
<el-button link type="danger" size="small" @click.stop="handleDelete(row)">删除</el-button>
@ -614,12 +614,19 @@ const toolbarButtons: ToolbarButtonConfig[] = [
{ key: 'scanQuery', label: '扫码查询', category: 'setting', size: 'small', action: 'openScanDialog' },
{ key: 'create', label: '新增拣货车', category: 'action', size: 'small', action: 'openCreate' },
{ key: 'batchCreate', label: '批量新增', category: 'action', size: 'small', action: 'openBatchCreate' },
{ key: 'batchDelete', label: '批量删除', category: 'action', size: 'small', action: 'handleBatchDelete' }
// 批量删除:危险操作走 category: 'cancel'(与团购波次「批量取消波次」同款红字按钮),
// 且依赖勾选行:未勾选置灰(disabledKey: noSelection)
{ key: 'batchDelete', label: '批量删除', category: 'cancel', size: 'small', disabledKey: 'noSelection', action: 'handleBatchDelete' }
]
/** 勾选态驱动的按钮禁用(noSelection:未勾选时批量操作不可用,勾选后恢复可用) */
const buttonDisabledMap = computed<Record<string, boolean>>(() => ({
noSelection: selectedRows.value.length === 0
}))
function resolveButtonDisabled(key?: string): boolean {
if (key === 'batchDelete') return selectedRows.value.length === 0
return false
if (!key) return false
return Boolean(buttonDisabledMap.value[key])
}
function resolveButtonLoading(key?: string): boolean {

View File

@ -501,15 +501,16 @@ export function buildWhereConditions(rawConditions: Record<string, any>): Record
// ============================================================
// 十、工具栏按钮系统
// ============================================================
// 按钮分为三类:
// common — 公共按钮(刷新、导出)
// function — 功能按钮(打开表单/确认窗口)
// basic — 基础操作(字段设置、隐藏详情)
// 按钮样式分类对齐 order/waveOrder 工具栏按钮组(OrderToolbarButtonGroup):
// refresh — 刷新类(蓝底白字)
// setting — 基础操作(白底黑字,如字段设置 / 隐藏详情)
// action — 功能按钮(白底蓝边蓝字,如新增 / 打印)
// cancel — 危险操作(白底红边红字,如批量删除)
export interface ToolbarButtonConfig {
key: string
label: string
category: 'common' | 'function' | 'basic'
category?: 'refresh' | 'setting' | 'action' | 'cancel'
size?: '' | 'default' | 'small' | 'large'
type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger'
plain?: boolean
@ -527,8 +528,7 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
refresh: {
key: 'refresh',
label: '刷新',
category: 'common',
type: 'primary',
category: 'refresh',
size: 'small',
loadingKey: 'loading',
action: 'loadData'
@ -536,8 +536,7 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
batchDelete: {
key: 'batchDelete',
label: '批量删除',
category: 'function',
type: 'danger',
category: 'cancel',
size: 'small',
disabledKey: 'noSelection',
action: 'batchDelete'

View File

@ -488,6 +488,7 @@ const currentToolbarButtons = computed<OrderToolbarButtonConfig[]>(() => {
return btns.map((btn: ToolbarButtonConfig) => ({
key: btn.key,
label: btn.label,
category: btn.category,
size: btn.size,
type: btn.type,
plain: btn.plain,

View File

@ -9,14 +9,14 @@
-->
<template>
<div class="role-tree-panel">
<div class="role-tree-panel__header">
<!-- <div class="role-tree-panel__header">
<span class="role-tree-panel__title">角色架构</span>
<el-tooltip content="刷新角色树" placement="bottom">
<el-button class="role-tree-panel__refresh" link size="small" :loading="loading" @click="emit('refresh')">
<el-icon><Refresh /></el-icon>
</el-button>
</el-tooltip>
</div>
</div> -->
<div class="role-tree-panel__body">
<el-input

View File

@ -517,7 +517,11 @@ export function buildWhereConditions(rawConditions: Record<string, any>): Record
export interface ToolbarButtonConfig {
key: string
label: string
category: 'common' | 'function' | 'basic'
/**
* 按钮样式分类(与 order/waveOrder 工具栏按钮组规则一致):
* refresh=蓝底白字 / setting=白底黑字 / action=白底蓝边蓝字 / cancel=白底红边红字
*/
category?: 'refresh' | 'setting' | 'action' | 'cancel'
size?: '' | 'default' | 'small' | 'large'
type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger'
plain?: boolean
@ -535,8 +539,7 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
refresh: {
key: 'refresh',
label: '刷新',
category: 'common',
type: 'primary',
category: 'refresh',
size: 'small',
loadingKey: 'loading',
action: 'loadData'
@ -544,16 +547,14 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
addWorkbench: {
key: 'addWorkbench',
label: '新增工作台',
category: 'function',
type: 'success',
category: 'action',
size: 'small',
action: 'openCreateDialog'
},
printQrcode: {
key: 'printQrcode',
label: '打印二维码',
category: 'function',
type: 'warning',
category: 'action',
size: 'small',
disabledKey: 'noSelection',
action: 'printWorkbenchQrcode'
@ -561,7 +562,7 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
toggleDetail: {
key: 'toggleDetail',
label: '显示详情',
category: 'basic',
category: 'setting',
dynamicLabelKey: 'detailToggleLabel',
size: 'small',
action: 'toggleDetailVisible'

View File

@ -834,6 +834,7 @@ const currentToolbarButtons = computed<OrderToolbarButtonConfig[]>(() => {
return btns.map((btn: ToolbarButtonConfig) => ({
key: btn.key,
label: btn.label,
category: btn.category,
size: btn.size,
type: btn.type,
plain: btn.plain,