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

const columns = [
  {
    prop: "projectNo",
    label: "项目单号",
    fixed: "left",
    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",
  },
  {
    prop: "",
    label: "操作",
    fixed: "right",
    width: "50px",
    slot: "operation",
  }
];

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

export default contentConfig;
