业务代码

108 阅读1分钟

有这么一个需求,根据接口列表返回的字段的编码,显示对应的文本信息,字段对应的编码如下:

   参数名称                 参数说明

   taskType                1-出险客户, 2-非出险客户
   isRepairShop            1-本店推修, 2-非本店推修
   appointmentSource       01-好车主预约', 03-无预约
   appointmentType         1-自行到店, 2-上门取车

如: 接口只返回 taskType:1;appointmentSource:03; appointmentType:2 ;这三个字段;则显示:“出险客户 无预约 上门取车

getTagList(item) {      const tagList = [];      const tagMap = new Map([        ['taskType', { 1: '出险客户', 2: '非出险客户' }],        ['isRepairShop', { 1: '本店推修', 2: '非本店推修' }],        ['appointmentSource', { '01': '好车主预约', '03': '无预约' }],        ['appointmentType', { 1: '自行到店', 2: '上门取车' }],      ]);      for (let [key, value] of tagMap) {        item[key] && tagList.push(value[item[key]]);      }      return tagList.filter((item) => item);    },

mendInfo(item) {      
  const mendInfoList = [];      
  const mendInfoMap = new Map([        
    ['channelType', { '01': '标的', '02': '三者' }],        
    ['recommendRepairType', { '01': '送修', '02': '返修' }],        
    ['carType', item.carType],      
  ]);     
  for (let [key, value] of mendInfoMap) {        
    item[key] && mendInfoList.push(key !== 'carType' ? value[item[key]] : value);      
  }      
  return mendInfoList.filter((item) => item).join('/') || '--';
}

有这么一个需求,根据接口列表返回的字段的编码,显示对应的文本信息,字段对应的编码如下:

   字段名称                 字段说明

   channelType             01-标的, 02-三者   
   recommendRepairType     01-送修, 02-返修   
   carType                 车型

如: 接口返回 channelType:' 01 ';recommendRepairType:' 02 '; carType:' 奥迪A6 ';这三个字段;则显示:“标的/返修/奥迪A6”

如: 接口返回 channelType:' 02 ';recommendRepairType:' 02 '; 这两个字段;则显示:“三者/返修”

如: 接口返回 recommendRepairType:' 02 '; 这一个字段;则显示:“返修”