跟进状态映射
This commit is contained in:
parent
e29c26c88b
commit
fa0b67a76d
|
|
@ -235,6 +235,11 @@ import {
|
|||
getCustomerFollowTypeDict
|
||||
} from '@/common/api/customer.js';
|
||||
import FollowupPickers from '@/components/followup-form/FollowupPickers.vue';
|
||||
import {
|
||||
getCustomerStatusText,
|
||||
getIntentLevelText as getIntentLevelTextFromMapping,
|
||||
getFollowTypeText as getFollowTypeTextFromMapping
|
||||
} from '@/utils/customerMappings';
|
||||
|
||||
// 表单数据
|
||||
const formData = ref({
|
||||
|
|
@ -803,22 +808,19 @@ const formatDateTimeForInput = (date) => {
|
|||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
};
|
||||
|
||||
// 获取状态文本
|
||||
// 使用统一映射函数获取状态文本
|
||||
const getStatusText = (value) => {
|
||||
const item = statusOptions.value.find(item => item.dictValue === value);
|
||||
return item ? item.dictLabel : '';
|
||||
return getCustomerStatusText(value, statusOptions.value);
|
||||
};
|
||||
|
||||
// 获取意向强度文本
|
||||
// 使用统一映射函数获取意向强度文本
|
||||
const getIntentLevelText = (value) => {
|
||||
const item = intentLevelOptions.value.find(item => item.dictValue === value);
|
||||
return item ? item.dictLabel : '';
|
||||
return getIntentLevelTextFromMapping(value, intentLevelOptions.value);
|
||||
};
|
||||
|
||||
// 获取跟进方式文本
|
||||
// 使用统一映射函数获取跟进方式文本
|
||||
const getFollowTypeText = (value) => {
|
||||
const item = followTypeOptions.value.find(item => item.dictValue === value);
|
||||
return item ? item.dictLabel : '';
|
||||
return getFollowTypeTextFromMapping(value, followTypeOptions.value);
|
||||
};
|
||||
|
||||
// 提交表单
|
||||
|
|
|
|||
|
|
@ -185,7 +185,8 @@ import { getFollowupDetail, getCustomerFollowTypeDict } from '@/common/api/custo
|
|||
import {
|
||||
getCustomerStatusText,
|
||||
getCustomerStatusClass,
|
||||
getIntentLevelText
|
||||
getIntentLevelText,
|
||||
getFollowTypeText as getFollowTypeTextFromMapping
|
||||
} from '@/utils/customerMappings';
|
||||
|
||||
// 页面参数
|
||||
|
|
@ -375,13 +376,9 @@ const getStatusText = getCustomerStatusText;
|
|||
// getCustomerStatusClass 和 getCustomerStatusText 直接使用导入的函数
|
||||
const getIntentStrengthText = getIntentLevelText;
|
||||
|
||||
// 获取跟进方式文本
|
||||
// 使用统一映射函数获取跟进方式文本
|
||||
const getFollowTypeText = (followTypeValue) => {
|
||||
if (!followTypeValue) return '--';
|
||||
|
||||
// 从字典数据中查找对应的标签
|
||||
const option = followTypeOptions.value.find(item => item.dictValue === String(followTypeValue));
|
||||
return option ? option.dictLabel : '--';
|
||||
return getFollowTypeTextFromMapping(followTypeValue, followTypeOptions.value);
|
||||
};
|
||||
|
||||
// 预览图片
|
||||
|
|
|
|||
|
|
@ -238,6 +238,11 @@ import {
|
|||
getCustomerFollowTypeDict
|
||||
} from '@/common/api/customer.js';
|
||||
import FollowupPickers from '@/components/followup-form/FollowupPickers.vue';
|
||||
import {
|
||||
getCustomerStatusText,
|
||||
getIntentLevelText as getIntentLevelTextFromMapping,
|
||||
getFollowTypeText as getFollowTypeTextFromMapping
|
||||
} from '@/utils/customerMappings';
|
||||
|
||||
// 跟进ID
|
||||
const followId = ref('');
|
||||
|
|
@ -871,22 +876,19 @@ const formatDateTimeForInput = (date) => {
|
|||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
};
|
||||
|
||||
// 获取状态文本
|
||||
// 使用统一映射函数获取状态文本
|
||||
const getStatusText = (value) => {
|
||||
const item = statusOptions.value.find(item => item.dictValue === value);
|
||||
return item ? item.dictLabel : '';
|
||||
return getCustomerStatusText(value, statusOptions.value);
|
||||
};
|
||||
|
||||
// 获取意向强度文本
|
||||
// 使用统一映射函数获取意向强度文本
|
||||
const getIntentLevelText = (value) => {
|
||||
const item = intentLevelOptions.value.find(item => item.dictValue === value);
|
||||
return item ? item.dictLabel : '';
|
||||
return getIntentLevelTextFromMapping(value, intentLevelOptions.value);
|
||||
};
|
||||
|
||||
// 获取跟进方式文本
|
||||
// 使用统一映射函数获取跟进方式文本
|
||||
const getFollowTypeText = (value) => {
|
||||
const item = followTypeOptions.value.find(item => item.dictValue === value);
|
||||
return item ? item.dictLabel : '';
|
||||
return getFollowTypeTextFromMapping(value, followTypeOptions.value);
|
||||
};
|
||||
|
||||
// 提交表单
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* 客户相关映射配置
|
||||
* 统一管理客户状态、意向强度、客户类型等映射关系
|
||||
* 统一管理客户状态、意向强度、客户类型、跟进方式等映射关系
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -48,10 +48,21 @@ export const CUSTOMER_TYPE_MAP = {
|
|||
/**
|
||||
* 获取客户状态文本
|
||||
* @param {string|number} status - 客户状态值
|
||||
* @param {Array} statusOptions - 客户状态选项数组(可选),格式: [{dictLabel: '', dictValue: ''}] 或 [{label: '', value: ''}]
|
||||
* @returns {string} 状态文本
|
||||
*/
|
||||
export const getCustomerStatusText = (status) => {
|
||||
export const getCustomerStatusText = (status, statusOptions = []) => {
|
||||
if (!status) return '未知';
|
||||
// 如果提供了字典数据,优先从字典数据中查找
|
||||
if (statusOptions && statusOptions.length > 0) {
|
||||
const option = statusOptions.find(item =>
|
||||
String(item.dictValue || item.value) === String(status)
|
||||
);
|
||||
if (option) {
|
||||
return option.dictLabel || option.label || '未知';
|
||||
}
|
||||
}
|
||||
// 否则使用静态映射
|
||||
return CUSTOMER_STATUS_MAP[String(status)] || '未知';
|
||||
};
|
||||
|
||||
|
|
@ -73,10 +84,21 @@ export const getCustomerStatusClass = (status) => {
|
|||
/**
|
||||
* 获取意向强度文本
|
||||
* @param {string|number} intentLevel - 意向强度值
|
||||
* @param {Array} intentLevelOptions - 意向强度选项数组(可选),格式: [{dictLabel: '', dictValue: ''}] 或 [{label: '', value: ''}]
|
||||
* @returns {string} 强度文本
|
||||
*/
|
||||
export const getIntentLevelText = (intentLevel) => {
|
||||
export const getIntentLevelText = (intentLevel, intentLevelOptions = []) => {
|
||||
if (!intentLevel) return '--';
|
||||
// 如果提供了字典数据,优先从字典数据中查找
|
||||
if (intentLevelOptions && intentLevelOptions.length > 0) {
|
||||
const option = intentLevelOptions.find(item =>
|
||||
String(item.dictValue || item.value) === String(intentLevel)
|
||||
);
|
||||
if (option) {
|
||||
return option.dictLabel || option.label || '--';
|
||||
}
|
||||
}
|
||||
// 否则使用静态映射
|
||||
return INTENT_LEVEL_MAP[String(intentLevel)] || '--';
|
||||
};
|
||||
|
||||
|
|
@ -128,3 +150,21 @@ export const getIntentLevelOptions = () => {
|
|||
}));
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取跟进方式文本(从字典数据中查找)
|
||||
* @param {string|number} followType - 跟进方式值
|
||||
* @param {Array} followTypeOptions - 跟进方式选项数组,格式: [{dictLabel: '', dictValue: ''}] 或 [{label: '', value: ''}]
|
||||
* @returns {string} 跟进方式文本
|
||||
*/
|
||||
export const getFollowTypeText = (followType, followTypeOptions = []) => {
|
||||
if (!followType) return '--';
|
||||
if (!followTypeOptions || followTypeOptions.length === 0) {
|
||||
return '--';
|
||||
}
|
||||
// 从字典数据中查找
|
||||
const option = followTypeOptions.find(item =>
|
||||
String(item.dictValue || item.value) === String(followType)
|
||||
);
|
||||
return option ? (option.dictLabel || option.label) : '--';
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user