import { ContentConfig } from "/@/components/PageContent";
import { httpList, httpDelete } from "/@/api/system/updates";
import { h } from "vue";
import { ElTag } from "element-plus";
const columns = [
  {
    type: "expand",
    slot: "expand"
  },
  {
    label: "版本号",
    prop: "version"
  },
  {
    label: "类型",
    prop: "sys_type",
    cellRenderer({ row }) {
      return h(
        ElTag,
        {
          type: String(row.sys_type) === "VER" ? "" : "success",
          size: "small"
        },
        {
          default: () => (String(row.sys_type) === "VER" ? "版本" : "公告")
        }
      );
    }
  },
  {
    label: "更新模块",
    prop: "module"
  },
  {
    label: "更新时间",
    prop: "addtime"
  },
  {
    label: "操作",
    fixed: "right",
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "版本更新",
  columns,
  isTree: true,
  notPreview: true,
  apis: {
    httpList,
    httpDelete,
    httpAdd: true,
    httpUpdate: true
  }
};

export default contentConfig;
