import { ElTag } from "element-plus";
import { httpList, httpStatus } from "/@/api/serviceParam/expressSet";

import { ContentConfig } from "/@/components/PageContent";
import { h } from "vue";
import { expressType } from "./_options";

const columns = [
  {
    prop: "comTypeName",
    label: "快递类型名称",
  },
  {
    prop: "name",
    label: "快递名称",
  },
  {
    prop: "shortName",
    label: "快递简称",
  },
  {
    prop: "shortNameEn",
    label: "快递英文",
  },
  {
    prop: "type",
    label: "快递属性",
    width: "100px",
    cellRenderer: ({ row }) => {
      return h( ElTag, { }, { default: () => (expressType.find(({value}) => value === String(row.type)))?.label || '--'}
      );
    }
  },
  {
    prop: "canOrder",
    label: "状态",
    width: "80px",
    cellRenderer: ({ row }) => {
      return h( ElTag,
        { type: String(row.canOrder) === "1" ? "success" : "danger" },
        { default: () => (String(row.canOrder) === "1" ? "启用" : "禁用")}
      );
    }
  },
  {
    prop: "",
    label: "操作",
    fixed: "right",
    width: "90px",
    slot: "operation",
  },
];

const contentConfig: ContentConfig = {
  title: "快递信息设置",
  columns,
  statusListProp:'canOrder',
  apis: {
    httpList,
    httpStatus,
  }
};

export default contentConfig;
