import { ref } from 'vue';

export function useList() {
  const monthLabel = [
    {
      label: "近1个月",
    },
    {
      label: "近3个月",
    },
  ]

  /* 表格行的数据处理 */
  function handleRowContent(row, key) {
    if (key == "IsMeeting") {
      return row[key] == 1 ? "已到会" : "未到会";
    } else if (key == "Source") {
      return row[key] == 1 ? "纪要" : row[key] == 2 ? "图表" : row[key] == 3 ? "纪要/图表" : row[key] == 4 ? "产业资源包" : row[key] == 5 ? "报告" : "活动";
    } else if (key == "ActivityType") {
      return row[key] == 1 ? "线上" : `线下(${row["City"]})`;
    } else if (key == "RegisterPlatform") {
      return row[key] == 1 ? "小程序" : row[key] == 2 ? "网页版" : row[key] == 3 ? "策略平台" : "";
    } else {
      return row[key];
    }
  }


  return {
    monthLabel,
    handleRowContent
  }
}


export function useVisibleActivity() {
  const dialogVisibleActivity = ref(false) //专项调研
  const specialDetailId = ref(null)
  const dialogTitle = ref("")
  
  function themeDetails(id) {
    dialogTitle.value = "活动详情";
    specialDetailId.value = id;
    dialogVisibleActivity.value = true;
  }

  return {
    dialogVisibleActivity,
    specialDetailId,
    dialogTitle,
    themeDetails
  }
}