Commit d344041f by Lin

refactor(reception): 优化接待详情和表单组件

- 更新接待详情页面布局,支持竖屏和横屏模式
- 重构表单组件,移除冗余的字符串处理函数,使用统一的字段提取方法
- 改进样式和结构,提升用户体验和代码可读性
1 parent 8392e9a1
...@@ -370,13 +370,6 @@ const emit = defineEmits<{ ...@@ -370,13 +370,6 @@ const emit = defineEmits<{
'close': [] 'close': []
}>() }>()
function getStr(data: UTSJSONObject | null, key: string): string {
if (data == null) { return '' }
const v = data[key]
if (v == null) { return '' }
return `${v}`
}
// 格式化手机号:13001365398 -> 130 0136 5398 // 格式化手机号:13001365398 -> 130 0136 5398
function formatPhone(phone: string): string { function formatPhone(phone: string): string {
if (phone == null || phone == '') { return '' } if (phone == null || phone == '') { return '' }
...@@ -532,7 +525,6 @@ async function loadMaterialResponsePageForDetail(d: UTSJSONObject | null): Promi ...@@ -532,7 +525,6 @@ async function loadMaterialResponsePageForDetail(d: UTSJSONObject | null): Promi
try { try {
const res = await getMaterialResponsePage(params) const res = await getMaterialResponsePage(params)
console.log('getMaterialResponsePage', res);
const body = res as UTSJSONObject const body = res as UTSJSONObject
const listRaw = body['list'] const listRaw = body['list']
if (listRaw != null && listRaw instanceof Array) { if (listRaw != null && listRaw instanceof Array) {
...@@ -573,32 +565,32 @@ watch( ...@@ -573,32 +565,32 @@ watch(
const displayName = computed((): string => { const displayName = computed((): string => {
const d = resolvedDetail.value const d = resolvedDetail.value
if (d == null) { return '-' } if (d == null) { return '-' }
const v = getStr(d, 'ownerName') const v = fieldStr(d, 'ownerName')
if (v != '') { return v } if (v != '') { return v }
return orPlaceholder(getStr(d, 'name')) return orPlaceholder(fieldStr(d, 'name'))
}) })
const displayPhone = computed((): string => { const displayPhone = computed((): string => {
const d = resolvedDetail.value const d = resolvedDetail.value
if (d == null) { return '-' } if (d == null) { return '-' }
const raw = getStr(d, 'ownerPhone') const raw = fieldStr(d, 'ownerPhone')
if (raw != '') { return formatPhone(raw) } if (raw != '') { return formatPhone(raw) }
const raw2 = getStr(d, 'phone') const raw2 = fieldStr(d, 'phone')
return orPlaceholder(formatPhone(raw2)) return orPlaceholder(formatPhone(raw2))
}) })
const displayBrandModel = computed((): string => { const displayBrandModel = computed((): string => {
const d = resolvedDetail.value const d = resolvedDetail.value
if (d == null) { return '-' } if (d == null) { return '-' }
return orPlaceholder(getStr(d, 'brandModel')) return orPlaceholder(fieldStr(d, 'brandModel'))
}) })
const displayReceptionScenario = computed((): string => { const displayReceptionScenario = computed((): string => {
const d = resolvedDetail.value const d = resolvedDetail.value
if (d == null) { return '-' } if (d == null) { return '-' }
let v = getStr(d, 'receptionScenario') let v = fieldStr(d, 'receptionScenario')
if (v == '') { if (v == '') {
v = getStr(d, 'receptionSceneName') v = fieldStr(d, 'receptionSceneName')
} }
return orPlaceholder(v) return orPlaceholder(v)
}) })
...@@ -613,9 +605,9 @@ const displayVisitDate = computed((): string => { ...@@ -613,9 +605,9 @@ const displayVisitDate = computed((): string => {
const displayCustomerTags = computed((): string => { const displayCustomerTags = computed((): string => {
const d = resolvedDetail.value const d = resolvedDetail.value
if (d == null) { return '-' } if (d == null) { return '-' }
let tag = getStr(d, 'customerTagName') let tag = fieldStr(d, 'customerTagName')
if (tag == '') { if (tag == '') {
tag = getStr(d, 'customerTags') tag = fieldStr(d, 'customerTags')
} }
if (tag.indexOf(',') >= 0) { if (tag.indexOf(',') >= 0) {
const tagParts = tag.split(',') const tagParts = tag.split(',')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!