From 67661d62c3e894d75ddf398331e71be278403bcc Mon Sep 17 00:00:00 2001 From: "wangmingyong@163.com" Date: Tue, 11 Aug 2026 09:49:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=A7=E6=B3=95=E4=BA=BA?= =?UTF-8?q?=E5=91=98bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/util/util.js | 12 ++++++----- .../enforcement/enforcementEvaluateDetail.vue | 21 +++++-------------- .../enforcementRegistrationList.vue | 5 +++-- .../enterprise/plan/planNoticeDetail.vue | 3 ++- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/zdxt-web-client/zdxt-efcode-enterprise-app/src/util/util.js b/zdxt-web-client/zdxt-efcode-enterprise-app/src/util/util.js index 3cb7ce9c..f921c8f8 100644 --- a/zdxt-web-client/zdxt-efcode-enterprise-app/src/util/util.js +++ b/zdxt-web-client/zdxt-efcode-enterprise-app/src/util/util.js @@ -119,15 +119,17 @@ const formattedDate = (dateTime) =>{ } /** - * 格式化用户名称为两个字的姓名 + * 格式化用户名称:两字姓名中间加全角空格,与三字对齐显示 * @param {*} name * @returns */ const alignNames = (name) =>{ - if(name.length == 2){ - name = name.substring(0,1) + " " + name.substring(1,2); + if(!name) return ''; + const trimmed = String(name).trim(); + if(trimmed.length == 2){ + return trimmed.charAt(0) + ' ' + trimmed.charAt(1); } - return name; + return trimmed; } const getDeviceType = () =>{ @@ -142,4 +144,4 @@ const getDeviceType = () =>{ } } -export { setGoodsNum, isObject, comparisonObject, isElementHidden ,formattedTimeYYYYmmdd,formattedTimeWithoutSecond,formattedTime,getDeviceType,formattedDate}; +export { setGoodsNum, isObject, comparisonObject, isElementHidden ,formattedTimeYYYYmmdd,formattedTimeWithoutSecond,formattedTime,getDeviceType,formattedDate,alignNames}; diff --git a/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementEvaluateDetail.vue b/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementEvaluateDetail.vue index d6d860c6..57dd4ce1 100644 --- a/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementEvaluateDetail.vue +++ b/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementEvaluateDetail.vue @@ -208,6 +208,7 @@ import { submitEvaluate, } from '@/api/enterprise'; import { loadDict, getDictText } from '@/util/dictUtil'; +import { alignNames } from '@/util/util'; const router = useRouter(); const route = useRoute(); @@ -285,7 +286,7 @@ const getEnforcers = (data) => { const list = []; // 第一名执法人员 if (data.lawEnforcer) { - list.push({ name: data.lawEnforcer, phone: data.lawEnforcerId || '' }); + list.push({ name: alignNames(data.lawEnforcer), phone: data.lawEnforcerId || '' }); } // 第二名及之后:lawEnforcerTwo 和 lawEnforcerIdTwo 均为逗号分隔字符串 if (data.lawEnforcerTwo) { @@ -293,22 +294,10 @@ const getEnforcers = (data) => { const phones = data.lawEnforcerIdTwo ? String(data.lawEnforcerIdTwo).split(',') : []; names.forEach((name, i) => { const trimmed = name.trim(); - if (trimmed) list.push({ name: trimmed, phone: phones[i] ? phones[i].trim() : '' }); - }); - } - // 数组形式(兼容其他字段名) - const raw = data.enforcers || data.enforcerList || data.lawEnforcer2List || []; - if (Array.isArray(raw) && raw.length) { - raw.forEach(p => { - if (typeof p === 'string') { - list.push({ name: p, phone: '' }); - } else { - const name = p.name || p.userName || p.realName || ''; - const phone = p.phone || p.mobile || p.tel || ''; - if (name) list.push({ name, phone }); - } + if (trimmed) list.push({ name: alignNames(trimmed), phone: phones[i] ? phones[i].trim() : '' }); }); } + return list.filter(p => p.name); }; @@ -549,7 +538,7 @@ const onSubmit = () => { line-height: 1.6; .enforcer-name { - color: #666; + color: #999; font-weight: 500; } diff --git a/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementRegistrationList.vue b/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementRegistrationList.vue index 8837d785..c337627c 100644 --- a/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementRegistrationList.vue +++ b/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementRegistrationList.vue @@ -52,6 +52,7 @@ import { queryEnforcementRegistrationPageList } from '@/api/enterprise'; import { showToast } from 'vant'; import 'vant/es/toast/style'; import SearchFilterBar from '@/components/common/SearchFilterBar.vue'; +import { alignNames } from '@/util/util'; const { useCommon } = $globalStore; const router = useRouter(); @@ -89,7 +90,7 @@ const getEnforcers = (item) => { const list = []; // 第一名执法人员:lawEnforcer + lawEnforcerId if (item.lawEnforcer) { - list.push(`${item.lawEnforcer} ${item.lawEnforcerId || ''}`); + list.push(`${alignNames(item.lawEnforcer)} ${item.lawEnforcerId || ''}`); } // 第二名及之后:lawEnforcerTwo 和 lawEnforcerIdTwo 均为逗号分隔字符串 if (item.lawEnforcerTwo) { @@ -97,7 +98,7 @@ const getEnforcers = (item) => { const phones = item.lawEnforcerIdTwo ? String(item.lawEnforcerIdTwo).split(',') : []; names.forEach((name, i) => { const trimmed = name.trim(); - if (trimmed) list.push(`${trimmed} ${phones[i] ? phones[i].trim() : ''}`); + if (trimmed) list.push(`${alignNames(trimmed)} ${phones[i] ? phones[i].trim() : ''}`); }); } return list.length ? list : ['-']; diff --git a/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/plan/planNoticeDetail.vue b/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/plan/planNoticeDetail.vue index 56ba91fb..6d79bf3b 100644 --- a/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/plan/planNoticeDetail.vue +++ b/zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/plan/planNoticeDetail.vue @@ -57,6 +57,7 @@