import { httpList } from "/@/api/sellOut/project";
import { ContentConfig } from "/@/components/PageContent";
import { ElTag } from "element-plus";
import { h } from "vue";

const statusOptions =  [
  { value: "1", label: "待商品反馈" },
  { value: "2", label: "待客户选择商品" },
  { value: "3", label: "待项目方案制定" },
  { value: "4", label: "待方案选择" },
  { value: "5", label: "项目待下单" },
  { value: "6", label: "项目已结束" },
]

const columns = [
  {
    type: 'selection',
    width: '40',
    fixed: 'left'
  },
  {
    prop: "projectNo",
    label: "项目单号",
    width: "170px",
  },
  {
    prop: "project_name",
    label: "项目名称",
    'min-width': "120px",
  },
  {
    prop: "low_rate",
    label: "项目毛利率",
    _slot_: "low_rate",
    'width': "85px",
  },
  
  {
    prop: "status",
    label: "状态",
    width: "130px",
    cellRenderer({ row }){
      return h(ElTag, null, {
        default: () => statusOptions.find((item) => Number(item.value) === Number(row.status))?.label || '--' 
      })
    }
  },
  {
    prop: "khNo",
    label: "客户公司编码",
    width: "125px",
  },
  {
    prop: "khName",
    label: "客户公司名称",
    "min-width": "158px",
  },
  {
    prop: "platform_name",
    label: "平台名称",
    "width": "100px",
  },
  {
    prop: "budget_total",
    label: "项目总预算",
    "width": "130px",
  },
  {
    prop: "company",
    label: "业务公司",
    'min-width': "130px",
  },
  {
    prop: "company_name",
    label: "申请人部门",
    minWidth: "150px",
  },
  {
    prop: "creater",
    label: "申请人",
    width: "60px",
  },
  {
    prop: "addtime",
    label: "创建时间",
    width: "140px",
  }
];

const contentConfig: ContentConfig = {
  title: "项目管理",
  columns,
  apis: {
    httpList,
  }
};

export default contentConfig;
