feat: 群信息编辑子类型按群类型动态约束,补全warehouse/express子类型选项
This commit is contained in:
parent
dc707e653e
commit
aef02273ad
@ -193,7 +193,7 @@ export function inboxGroupDisable(data: InboxGroupDisableParams) {
|
||||
export interface InboxGroupUpdateParams {
|
||||
id: number // 群记录主键ID
|
||||
groupType?: string // 群类型:store(货主) / warehouse(仓库) / express(快递)
|
||||
subType?: string // 群子类型:after_sales(售后) / finance(财务) / receiving(收货)
|
||||
subType?: string // 群子类型,值取决于groupType。store→after_sales/finance/receiving。warehouse→receiving/production/stockout/finance/all/customer_service/exception。express→pickup/after_sales
|
||||
storeId?: number // 关联货主ID
|
||||
expressInterfaces?: number[] // 快递接口ID数组,仅groupType=express时生效
|
||||
systemExpressCode?: string // 系统快递编码,groupType=express时必填
|
||||
|
||||
@ -148,11 +148,14 @@
|
||||
<el-option label="快递群" value="express" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="editForm.groupType !== 'express'" label="子类型">
|
||||
<el-form-item v-if="editForm.groupType" label="子类型">
|
||||
<el-select v-model="editForm.subType" placeholder="可选" clearable style="width: 100%">
|
||||
<el-option label="售后" value="after_sales" />
|
||||
<el-option label="财务" value="finance" />
|
||||
<el-option label="收货" value="receiving" />
|
||||
<el-option
|
||||
v-for="opt in getSubTypeOptions(editForm.groupType)"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="editForm.groupType === 'store'" label="关联货主" prop="storeId">
|
||||
@ -244,12 +247,42 @@ import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
const groupTypeLabelMap: Record<string, string> = { store: '货主群', warehouse: '仓库群', express: '快递群' }
|
||||
const groupTypeTagTypeMap: Record<string, string> = { store: 'primary', warehouse: 'warning', express: 'success' }
|
||||
const subTypeLabelMap: Record<string, string> = { after_sales: '售后', finance: '财务', receiving: '收货' }
|
||||
const subTypeLabelMap: Record<string, string> = {
|
||||
after_sales: '售后', finance: '财务', receiving: '收货',
|
||||
production: '生产', stockout: '出库', all: '全体', customer_service: '客服', exception: '异常',
|
||||
pickup: '揽收',
|
||||
}
|
||||
|
||||
function groupTypeLabel(t: string) { return groupTypeLabelMap[t] ?? t ?? '-' }
|
||||
function groupTypeTagType(t: string) { return groupTypeTagTypeMap[t] ?? 'info' }
|
||||
function subTypeLabel(s: string) { return subTypeLabelMap[s] ?? s ?? '-' }
|
||||
|
||||
/** 子类型选项,受群类型约束 */
|
||||
const subTypeConfigMap: Record<string, Array<{ label: string; value: string }>> = {
|
||||
store: [
|
||||
{ label: '售后', value: 'after_sales' },
|
||||
{ label: '财务', value: 'finance' },
|
||||
{ label: '收货', value: 'receiving' },
|
||||
],
|
||||
warehouse: [
|
||||
{ label: '收货', value: 'receiving' },
|
||||
{ label: '生产', value: 'production' },
|
||||
{ label: '出库', value: 'stockout' },
|
||||
{ label: '财务', value: 'finance' },
|
||||
{ label: '全体', value: 'all' },
|
||||
{ label: '客服', value: 'customer_service' },
|
||||
{ label: '异常', value: 'exception' },
|
||||
],
|
||||
express: [
|
||||
{ label: '揽收', value: 'pickup' },
|
||||
{ label: '售后', value: 'after_sales' },
|
||||
],
|
||||
}
|
||||
|
||||
function getSubTypeOptions(groupType: string) {
|
||||
return subTypeConfigMap[groupType] ?? []
|
||||
}
|
||||
|
||||
// ==================== 配置 ====================
|
||||
|
||||
const availableFields = groupAvailableFields
|
||||
@ -484,6 +517,7 @@ function onSystemExpressCodeChange() {
|
||||
}
|
||||
|
||||
function onEditGroupTypeChange() {
|
||||
editForm.subType = ''
|
||||
if (editForm.groupType !== 'express') { editForm.expressInterfaces = []; editForm.systemExpressCode = '' }
|
||||
if (editForm.groupType !== 'store') editForm.storeId = null
|
||||
if (editForm.groupType === 'express') { loadExpressCodes(); loadExpressInterfacesByCode() }
|
||||
@ -496,7 +530,7 @@ async function handleSubmitEdit() {
|
||||
try {
|
||||
const params: any = { id: editingRow.value.id }
|
||||
if (editForm.groupType) params.groupType = editForm.groupType
|
||||
if (editForm.groupType !== 'express' && editForm.subType) params.subType = editForm.subType
|
||||
if (editForm.subType) params.subType = editForm.subType
|
||||
if (editForm.groupType === 'store' && editForm.storeId) params.storeId = editForm.storeId
|
||||
if (editForm.groupType === 'express') { params.expressInterfaces = editForm.expressInterfaces; params.systemExpressCode = editForm.systemExpressCode }
|
||||
params.aiEnabled = editForm.aiEnabled
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user