Browse Source

修复执法人员bug

dev-V1.0.6
wangmingyong@163.com 3 months ago
parent
commit
67661d62c3
  1. 12
      zdxt-web-client/zdxt-efcode-enterprise-app/src/util/util.js
  2. 21
      zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementEvaluateDetail.vue
  3. 5
      zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementRegistrationList.vue
  4. 3
      zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/plan/planNoticeDetail.vue

12
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};

21
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;
}

5
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 : ['-'];

3
zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/plan/planNoticeDetail.vue

@ -57,6 +57,7 @@
<script setup name="planNoticeDetail">
import { useRouter, useRoute } from 'vue-router';
import { getPlanNoticeDetail } from '@/api/enterprise/planNotice';
import { alignNames } from '@/util/util';
const router = useRouter();
const route = useRoute();
@ -98,7 +99,7 @@ onMounted(() => {
const names = res.data.enforceUserNames.split(',');
const tels = res.data.enforceUserTels ? res.data.enforceUserTels.split(',') : [];
personList.value = names.map((name, i) => ({
name,
name: alignNames(name),
phone: i < tels.length ? tels[i] : '',
}));
}

Loading…
Cancel
Save