提交
This commit is contained in:
1 parent
6e2b440738
commit
244477a771
2 files changed
+64
-158
No files matched your search
@@ -1667,7 +1667,8 @@ const isFieldChanged = (fieldName: string) => {
|
||||
|
||||
/** 根据字典值获取标签 */
|
||||
const getDictLabel = (dictData: any[], value: string | number) => {
|
||||
if (!dictData || !value) return value || '';
|
||||
// 修复:0 也是有效值,需要正确处理
|
||||
if (!dictData || value === null || value === undefined || value === '') return '';
|
||||
const item = dictData.find((item) => item.value === String(value));
|
||||
return item ? item.label : value;
|
||||
};
|
||||
@@ -1694,7 +1695,8 @@ const getRegionName = (code: string) => {
|
||||
|
||||
/** 根据婚姻状况代码获取标签 */
|
||||
const getMaritalStatusLabel = (value: string | number) => {
|
||||
if (!value) return value || '';
|
||||
// 修复:0 也是有效值,需要正确处理
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
|
||||
const maritalStatusMap: Record<string, string> = {
|
||||
'1': '未婚',
|
||||
@@ -1708,7 +1710,8 @@ const getMaritalStatusLabel = (value: string | number) => {
|
||||
|
||||
/** 根据是否字段代码获取标签 */
|
||||
const getYesNoLabel = (value: string | number) => {
|
||||
if (!value) return value || '';
|
||||
// 修复:0 也是有效值,需要转换为"否"
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
|
||||
const yesNoMap: Record<string, string> = {
|
||||
'0': '否',
|
||||
@@ -1720,7 +1723,8 @@ const getYesNoLabel = (value: string | number) => {
|
||||
|
||||
/** 根据血型代码获取标签 */
|
||||
const getBloodTypeLabel = (value: string | number) => {
|
||||
if (!value) return value || '';
|
||||
// 修复:0 也是有效值,需要正确处理
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
|
||||
const bloodTypeMap: Record<string, string> = {
|
||||
'A': 'A型',
|
||||
@@ -1735,7 +1739,8 @@ const getBloodTypeLabel = (value: string | number) => {
|
||||
|
||||
/** 根据残疾类型代码获取标签 */
|
||||
const getDisabilityTypeLabel = (value: string | number) => {
|
||||
if (!value) return value || '';
|
||||
// 修复:0 也是有效值,需要正确处理
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
|
||||
const disabilityTypeMap: Record<string, string> = {
|
||||
'1': '视力残疾',
|
||||
@@ -1749,7 +1754,8 @@ const getDisabilityTypeLabel = (value: string | number) => {
|
||||
|
||||
/** 根据学历层次代码获取标签 */
|
||||
const getAcademicLevelLabel = (value: string | number) => {
|
||||
if (!value) return value || '';
|
||||
// 修复:0 也是有效值,需要正确处理
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
|
||||
const academicLevelMap: Record<string, string> = {
|
||||
'1': '中级工',
|
||||
@@ -1764,7 +1770,8 @@ const getAcademicLevelLabel = (value: string | number) => {
|
||||
|
||||
/** 根据学籍状态代码获取标签 */
|
||||
const getStudentStatusLabel = (value: string | number) => {
|
||||
if (!value) return value || '';
|
||||
// 修复:0 也是有效值,需要正确处理
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
|
||||
const studentStatusMap: Record<string, string> = {
|
||||
'1': '在籍',
|
||||
@@ -1783,7 +1790,8 @@ const getFieldOriginalValue = (fieldName: string) => {
|
||||
if (!changedField) return '';
|
||||
|
||||
const originalValue = changedField.originalValue;
|
||||
|
||||
console.log('fieldName', fieldName);
|
||||
console.log('originalValue', originalValue);
|
||||
// 根据字段名判断是否需要转换为字典标签
|
||||
switch (fieldName) {
|
||||
case 'nationality':
|
||||
|
||||
Reference in new issue
Block a user