import { httpList } from "/@/api/serviceParam/purchaseCategory";
import { ContentConfig } from "/@/components/PageContent";
import { statusOptions } from "./_options";
import { ElTag } from "element-plus";
import { h } from "vue";


const columns = [
  {
    prop: "cat_code",
    label: "类目编码",
    width: '90px'
  },
  {
    prop: "cat_name",
    label: "货物和劳务名称",
    minWidth: '120px'
  },
  {
    prop: "short_name",
    label: "商品和服务分类简称",
    minWidth: '120px'
  },
  {
    prop: "tax",
    label: "增值税税率",
    minWidth: '80px',
    _slot_: 'tax'
  },
  {
    prop: "companyName",
    label: "业务公司",
    minWidth: "150px",
  },
  {
    label: "可用状态",
    width: '80px',
    cellRenderer({ row }){
      return h(ElTag, {
        size: 'small',
        type: statusOptions.find(({ value }) => value == row.output)?.type || 'info'
      }, {
        default: () => statusOptions.find(({ value }) => value == row.output)?.label || '--'
      })
    }
    // _slot_: 'status'
  },
  {
    prop: "",
    label: "操作",
    fixed: "right",
    width: "140px",
    _noset_: true,
    slot: "operation",
  },
];

const contentConfig: ContentConfig = {
  title: "公司账号角色查询",
  columns,
  apis: {
    httpList,
    httpAdd: true,
    httpUpdate: true
  }
};

export default contentConfig;
