|
|
|
@ -168,15 +168,13 @@ const getDeviceType = () =>{ |
|
|
|
const formatEnforcer = (item) => { |
|
|
|
const enforcers = []; |
|
|
|
if (item.lawEnforcer) { |
|
|
|
// 处理逗号分隔的多个执法人员
|
|
|
|
const names = item.lawEnforcer.split(',').map(n => n.trim()).filter(n => n); |
|
|
|
const ids = item.lawEnforcerId ? item.lawEnforcerId.split(',').map(id => id.trim()).filter(id => id) : []; |
|
|
|
names.forEach((name, index) => { |
|
|
|
const id = ids[index] || ''; |
|
|
|
enforcers.push(id ? `${name} ${id}` : name); |
|
|
|
enforcers.push({ name, id }); |
|
|
|
}); |
|
|
|
} |
|
|
|
// 支持两种字段名:lawEnforcerTwo 或 lawEnforcerOther
|
|
|
|
const secondName = item.lawEnforcerTwo || item.lawEnforcerOther; |
|
|
|
const secondId = item.lawEnforcerIdTwo || item.lawEnforcerIdOther; |
|
|
|
if (secondName) { |
|
|
|
@ -184,7 +182,7 @@ const formatEnforcer = (item) => { |
|
|
|
const ids = secondId ? secondId.split(',').map(id => id.trim()).filter(id => id) : []; |
|
|
|
names.forEach((name, index) => { |
|
|
|
const id = ids[index] || ''; |
|
|
|
enforcers.push(id ? `${name} ${id}` : name); |
|
|
|
enforcers.push({ name, id }); |
|
|
|
}); |
|
|
|
} |
|
|
|
return enforcers; |
|
|
|
|