vue3新增修改页面,字段来源于其他表


      
        
          
            
              
            
          

          
            
            
              
            
          
          
        
      
      
    
const unitOptions = ref([]);
const listAdspunitAllLocal = async () => {
  if(!unitOptions.value.length){
    const resUnit = await listAdspunitAll();
    unitOptions.value = resUnit.data;
  }
}
// 单位生成 ID-Name 映射字典  
const idToNameUnitMap = computed(() => {  
  return unitOptions.value.reduce((map, item) => {  
    map[item.unitId] = item.unitName;  
    return map;  
  }, {});  
});

// 格式化函数  
const idUnitFormatter = (row, column, cellValue) => {  
  if(!cellValue){
    return;
  }
  return idToNameUnitMap.value[cellValue] || '';  
};
onMounted(() => {
  getList();
listAdspunitAllLocal();
});

 

vue3新增修改页面,字段来源于其他表_第1张图片比如以上关联单位字段来源于其他表

你可能感兴趣的:(vue.js,elementui,javascript)