import { httpList, httpStatus } from "/@/api/serviceParam/supplierBankDetail";
import { ContentConfig } from "/@/components/PageContent";

import { isSettleOptions, statusOptions } from "./_options";
import { createTooltip } from "/@/utils/tootip";
import { ElTag } from "element-plus";
import { h } from "vue";

const columns = [
  {
    label: "供应商名称",
    minWidth: '160px',
    cellRenderer({ row }){
      return  createTooltip(row.name, "供应商编码:" + row.code, 360);
    }
  },
  {
    label: "状态",
    width: '70px',
    cellRenderer({ row }){
      return h(ElTag,{
        type: ( statusOptions.find(({value}) => String(value) === String(row.status))?.type || '') as any
      },{
        default: () => statusOptions.find(({value}) => String(value) === String(row.status))?.label || '--'
      })
    }
  },
  {
    label: "是否为结算卡",
    width: '110px',
    cellRenderer({ row }){
      return h(ElTag, {
        type: ( isSettleOptions.find(({value}) => String(value) === String(row.is_default))?.type || '') as any
      } ,{
        default: () => isSettleOptions.find(({value}) => String(value) === String(row.is_default))?.label || '--'
      })
    }
  },
  {
    label: '开户银行',
    minWidth: '180px',
    prop: 'bank_name'
  },
  {
    label: '银行卡号',
    minWidth: '180px',
    prop: 'bank_no'
  },
  {
    prop: "createTime",
    label: "创建时间",
    minWidth: "145px",
  },
  {
    prop: "",
    label: "操作",
    fixed: "right",
    width: "185px",
    slot: "operation",
  }
]

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

export default contentConfig;
