/* eslint-disable prettier/prettier */
// eslint-disable-next-line prettier/prettier

import { ContentConfig } from "/@/components/PageContent";
import { httpList, httpUpdate, httpStatus } from "/@/api/parameter/finance";

import dayjs from "dayjs";
import { h } from "vue";
import { ElTag } from "element-plus";
import { renderIconLabelLeft } from "/@/utils/columnRenderHelper";

// const status = [
//   {
//     label: "增值税专用发票",
//     value: "04"
//   },
//   {
//     label: "增值税普通发票",
//     value: "07"
//   },
//   {
//     label: "增值税电子专用发票",
//     value: "27"
//   },
//   {
//     label: "增值税电子普通发票",
//     value: "26"
//   }
// ];

const columns = [
  {
    type: "selection",
    width: 40,
    align: "center",
    hide: ({ checkList }) => !checkList.includes("勾选列")
  },
  {
    label: "序号",
    type: "index",
    width: 70,
    hide: ({ checkList }) => !checkList.includes("序号列")
  },
  {
    label: "业务企业编码",
    prop: "companyNo",
    width: 150,
  },
  {
    label: "业务企业名称",
    prop: "company_name",
    width: 180
  },
  {
    label: "公司抬头",
    prop: "invoice_title",
    width: 180
  },
  {
    label: "企业纳税号",
    prop: "company_license",
    width: 120
  },
  {
    label: "开户银行账户",
    prop: "bank_name",
    minWidth: 120
  },
  {
    label: "开户银行账户",
    prop: "bankNo",
    minWidth: 120
  },
  {
    label: "企业联系方式",
    prop: "mobile",
    width: 120
  },
  {
    label: "状态",
    width: "80px",
    cellRenderer({ row }) {
      return h(
        ElTag,
        {
          type: String(row.status) === "1" ? "success" : "danger"
        },
        {
          default: () => (String(row.status) === "1" ? "启用" : "禁用")
        }
      );
    }
  },
  {
    label: "进项设置",
    prop: "input_ticket",
    width: 100,
    cellRenderer: ({ row }) =>
      String(row.input_ticket) === "1"
        ? "金税"
        : String(row.input_ticket) === "2"
        ? "人工"
        : "--"
  },
  {
    label: "销项设置",
    prop: "out_ticket",
    width: 100,
    cellRenderer: ({ row }) =>
      String(row.out_ticket) === "1"
        ? "金税"
        : String(row.out_ticket) === "2"
        ? "人工"
        : "--"
  },
  {
    label: "最大面额",
    prop: "denomination",
    width: 120,
    cellRenderer: ({ row }) =>
      String(row.denomination).trim() ? row.denomination + "万元" : "--"
  },
  {
    label: "创建时间",
    prop: "addTime",
    width: 150,
    formatter: ({ addtime }) => dayjs(addtime).format("YYYY-MM-DD HH:mm:ss")
  },
  {
    label: "操作",
    fixed: "right",
    width: 120,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "业务公司发票",
  statusProp: "companyNo",
  columns,
  // httpAdd,
  apis: {
    httpList,
    httpUpdate,
    httpStatus
  }
};

export default contentConfig;
