import { httpList, httpStatus } from "/@/api/serviceParam/purchaseSetting";

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

const columns = [
  {
    prop: "companyName",
    label: "业务公司",
  },
  {
    prop: "is_cgd",
    label: "状态",
    cellRenderer: ({ row }) => {
      return h(
        ElTag,
        {
          type: String(row.is_cgd) === "1" ? "success" : "danger"
        },
        {
          default: () => (String(row.is_cgd) === "1" ? "启用" : "禁用")
        }
      );
    }
  },
  {
    prop: "apply_name",
    label: "创建人",
  },
  {
    prop: "addtime",
    label: "创建时间",
  },
  {
    prop: "操作",
    label: "操作",
    width: '80px',
    _slot_: 'operation'
  }
];

const contentConfig: ContentConfig = {
  title: "采购单修改设置",
  columns,
  statusProp: 'is_cgd',
  statusListProp: 'is_cgd',
  apis: {
    httpStatus,
    httpList: (params = {} as any) => {
      const { is_cgd, ...rest } = params
      return httpList({ is_cgd: is_cgd || '', ...rest })
    }
  }
};

export default contentConfig;
