自动回复(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 表格内容居中;绑定包材弹窗成功后直接关闭并移除结果展示区 - 隐藏拣货车「详情」入口与角色树面板头部
435 lines
11 KiB
Vue
435 lines
11 KiB
Vue
<template>
|
||
<el-dialog
|
||
:model-value="modelValue"
|
||
class="bind-material-by-waybill-dialog"
|
||
width="min(560px, 92vw)"
|
||
align-center
|
||
append-to-body
|
||
:show-close="false"
|
||
destroy-on-close
|
||
:close-on-click-modal="false"
|
||
@close="handleClose"
|
||
@closed="resetForm"
|
||
>
|
||
<!-- 面板结构 / 尺寸对齐「手工录入运单号」(ManualWaybillForm) -->
|
||
<div class="task-panel">
|
||
<header class="task-panel__head">
|
||
<div class="task-panel__titles">
|
||
<h2>按运单号绑定包材</h2>
|
||
<p>仅需运单号与包材,系统自动反查订单运单记录并绑定包材</p>
|
||
</div>
|
||
<button class="task-panel__close" type="button" aria-label="关闭" @click="handleClose">
|
||
<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="waybill_code">
|
||
<el-input
|
||
v-model.trim="form.waybill_code"
|
||
size="default"
|
||
placeholder="请输入运单号"
|
||
clearable
|
||
@keyup.enter="focusMaterialSelect"
|
||
/>
|
||
</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 prop="package_material_id">
|
||
<el-select
|
||
ref="materialSelectRef"
|
||
v-model="form.package_material_id"
|
||
size="default"
|
||
filterable
|
||
remote
|
||
remote-show-suffix
|
||
clearable
|
||
reserve-keyword
|
||
placeholder="输入编码/名称搜索"
|
||
:remote-method="searchPackageMaterials"
|
||
:loading="materialLoading"
|
||
style="width: 100%"
|
||
@keyup.enter="handleSubmit"
|
||
>
|
||
<el-option
|
||
v-for="item in materialOptions"
|
||
:key="item.id"
|
||
:label="`${item.material_code} / ${item.material_name}`"
|
||
:value="item.id"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</div>
|
||
</div>
|
||
</el-form>
|
||
|
||
<p class="task-panel__form-tip">
|
||
系统会根据运单号自动反查订单运单记录并绑定包材,无需订单 ID;绑定成功后自动关闭。
|
||
</p>
|
||
</div>
|
||
|
||
<footer class="task-panel__foot">
|
||
<span class="task-panel__hint">提交前请确认运单号与包材无误</span>
|
||
<div class="task-panel__actions">
|
||
<el-button size="small" @click="handleClose">取消</el-button>
|
||
<el-button size="small" type="primary" :loading="submitting" @click="handleSubmit">绑定</el-button>
|
||
</div>
|
||
</footer>
|
||
</div>
|
||
</el-dialog>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { nextTick, reactive, ref, watch } from 'vue'
|
||
import { ElMessage } from 'element-plus'
|
||
import type { FormInstance, FormRules } from 'element-plus'
|
||
import {
|
||
orderBindExpressPackageMaterialByWaybill,
|
||
type BindExpressPackageMaterialByWaybillResponse
|
||
} from '@/api/order/order'
|
||
import { packageMaterialSearch } from '@/api/setting.packagematerial/packagematerial'
|
||
import {
|
||
isPackageMaterialApiSuccess,
|
||
parsePackageMaterialSearchResponse
|
||
} from '@/views/material/packageMaterial/package-material-config'
|
||
import { isOrderIndexApiSuccess } from '../utils/order-index-helpers'
|
||
|
||
const props = defineProps<{
|
||
modelValue: boolean
|
||
/** 打开时预填运单号(如从运单列表带入) */
|
||
initialWaybillCode?: string
|
||
}>()
|
||
|
||
const emit = defineEmits<{
|
||
(e: 'update:modelValue', value: boolean): void
|
||
(e: 'success', payload?: BindExpressPackageMaterialByWaybillResponse): void
|
||
}>()
|
||
|
||
const formRef = ref<FormInstance>()
|
||
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 form = reactive({
|
||
waybill_code: '',
|
||
package_material_id: undefined as number | undefined
|
||
})
|
||
|
||
const rules: FormRules = {
|
||
waybill_code: [{ required: true, message: '请输入运单号', trigger: 'blur' }],
|
||
package_material_id: [{ required: true, message: '请选择包材', trigger: 'change' }]
|
||
}
|
||
|
||
watch(
|
||
() => props.modelValue,
|
||
(visible) => {
|
||
if (!visible) return
|
||
form.waybill_code = String(props.initialWaybillCode || '').trim()
|
||
form.package_material_id = undefined
|
||
materialOptions.value = []
|
||
void searchPackageMaterials('')
|
||
}
|
||
)
|
||
|
||
function handleClose() {
|
||
emit('update:modelValue', false)
|
||
}
|
||
|
||
function resetForm() {
|
||
form.waybill_code = ''
|
||
form.package_material_id = undefined
|
||
materialOptions.value = []
|
||
formRef.value?.clearValidate()
|
||
}
|
||
|
||
function focusMaterialSelect() {
|
||
nextTick(() => materialSelectRef.value?.focus?.())
|
||
}
|
||
|
||
async function searchPackageMaterials(query: string) {
|
||
const keyword = String(query || '').trim()
|
||
materialLoading.value = true
|
||
try {
|
||
const res: any = await packageMaterialSearch(keyword ? { keyword } : {})
|
||
if (!isPackageMaterialApiSuccess(res)) {
|
||
materialOptions.value = []
|
||
return
|
||
}
|
||
materialOptions.value = parsePackageMaterialSearchResponse(res)
|
||
.map((item) => ({
|
||
id: Number(item.id),
|
||
material_code: String(item.material_code || '').trim(),
|
||
material_name: String(item.material_name || '').trim()
|
||
}))
|
||
.filter((item) => Number.isFinite(item.id) && item.id > 0 && item.material_code)
|
||
} catch {
|
||
materialOptions.value = []
|
||
} finally {
|
||
materialLoading.value = false
|
||
}
|
||
}
|
||
|
||
function unwrapBindPayload(res: any): BindExpressPackageMaterialByWaybillResponse | null {
|
||
const raw = res?.data
|
||
if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
|
||
return raw as BindExpressPackageMaterialByWaybillResponse
|
||
}
|
||
return null
|
||
}
|
||
|
||
async function handleSubmit() {
|
||
if (!formRef.value || submitting.value) return
|
||
const valid = await formRef.value.validate().catch(() => false)
|
||
if (!valid) return
|
||
|
||
const waybill_code = form.waybill_code.trim()
|
||
const package_material_id = form.package_material_id
|
||
if (!waybill_code || package_material_id == null) return
|
||
|
||
submitting.value = true
|
||
try {
|
||
const res: any = await orderBindExpressPackageMaterialByWaybill({
|
||
waybill_code,
|
||
package_material_id
|
||
})
|
||
if (!isOrderIndexApiSuccess(res)) {
|
||
throw new Error(res?.message || '绑定包材失败')
|
||
}
|
||
const payload = unwrapBindPayload(res)
|
||
emit('success', payload ?? undefined)
|
||
ElMessage.success('包材绑定成功')
|
||
// 绑定成功后直接关闭表单,不再展示任何结果信息
|
||
handleClose()
|
||
} catch (error: any) {
|
||
ElMessage.error(error?.message || '绑定包材失败')
|
||
} finally {
|
||
submitting.value = false
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
/* 面板结构 / 尺寸对齐「手工录入运单号」(ManualWaybillForm) */
|
||
.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;
|
||
}
|
||
|
||
&__form {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8px;
|
||
}
|
||
|
||
&__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;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/* 标签列固定宽度(含必填星号占位):输入框左边缘与上方静态信息行的标签列对齐 */
|
||
&__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) {
|
||
width: 100%;
|
||
}
|
||
}
|
||
|
||
/* 表单下方统一提示条 */
|
||
&__form-tip {
|
||
margin: 8px 0 0;
|
||
padding: 8px 12px;
|
||
border-radius: 4px;
|
||
background: #f4f4f5;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: #909399;
|
||
}
|
||
|
||
&__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;
|
||
/* 与工具栏按钮组(OrderToolbarButtonGroup)保持一致:gap 6px */
|
||
gap: 6px;
|
||
|
||
:deep(.el-button) {
|
||
margin-left: 0;
|
||
margin-right: 0;
|
||
}
|
||
}
|
||
}
|
||
</style>
|
||
|
||
<style lang="scss">
|
||
/* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板 */
|
||
.el-dialog.bind-material-by-waybill-dialog {
|
||
padding: 0;
|
||
overflow: hidden;
|
||
|
||
.el-dialog__header {
|
||
display: none;
|
||
}
|
||
|
||
.el-dialog__body {
|
||
padding: 0;
|
||
}
|
||
}
|
||
</style>
|