53 lines
2.4 KiB
TypeScript
53 lines
2.4 KiB
TypeScript
export const courierAvailableFields = [
|
|
{ label: 'ID', value: 'id', type: 'number' },
|
|
{ label: '业务编码', value: 'code', type: 'text' },
|
|
{ label: '业务名称', value: 'name', type: 'text' },
|
|
{ label: '快递公司', value: 'platform', type: 'select', options: [] as Array<{ label: string; value: string }> }
|
|
]
|
|
|
|
export const courierColumns = [
|
|
{ prop: 'id', label: 'ID', width: '80', sortable: true },
|
|
{ prop: 'express_name', label: '快递名称', minWidth: '180', showOverflowTooltip: true },
|
|
{ prop: 'code', label: '业务编码', minWidth: '180', showOverflowTooltip: true },
|
|
{ prop: 'name', label: '业务名称', minWidth: '180', showOverflowTooltip: true },
|
|
{ prop: 'actions', label: '操作', width: '140', fixed: 'right' }
|
|
]
|
|
|
|
export const platformAvailableFields = [
|
|
{ label: 'ID', value: 'id', type: 'number' },
|
|
{ label: '业务编码', value: 'code', type: 'text' },
|
|
{ label: '业务名称', value: 'name', type: 'text' },
|
|
{ label: '平台', value: 'platform_code', type: 'select', options: [] as Array<{ label: string; value: string }> },
|
|
{ label: '关键词', value: 'keyword', type: 'text' }
|
|
]
|
|
|
|
export const platformColumns = [
|
|
{ prop: 'id', label: 'ID', width: '80', sortable: true },
|
|
{ prop: 'platform_name', label: '平台名称', minWidth: '160', showOverflowTooltip: true },
|
|
{ prop: 'code', label: '业务编码', minWidth: '140', showOverflowTooltip: true },
|
|
{ prop: 'label', label: '显示标签', minWidth: '180', showOverflowTooltip: true },
|
|
{ prop: 'name', label: '业务名称', minWidth: '180', showOverflowTooltip: true },
|
|
{ prop: 'actions', label: '操作', width: '140', fixed: 'right' }
|
|
]
|
|
|
|
export function buildWhereConditions(rawConditions: Record<string, any>) {
|
|
const where: Record<string, any> = {}
|
|
Object.keys(rawConditions || {}).forEach((key) => {
|
|
const condition = rawConditions[key]
|
|
if (condition && typeof condition === 'object' && 'operator' in condition) {
|
|
where[key] = Array.isArray(condition.value)
|
|
? { ...condition, value: condition.value[0] ?? '', type: condition.type || 'text' }
|
|
: condition
|
|
return
|
|
}
|
|
if (condition !== undefined && condition !== null && condition !== '') {
|
|
where[key] = {
|
|
operator: key === 'name' || key === 'code' ? 'like' : 'eq',
|
|
value: Array.isArray(condition) ? condition[0] ?? '' : condition,
|
|
type: key === 'id' ? 'number' : 'text'
|
|
}
|
|
}
|
|
})
|
|
return where
|
|
}
|