import { httpList, httpStatus,httpDelete } from "/@/api/serviceParam/specs";

import { h } from "vue";
import { ElTag } from "element-plus";
import { options, statusOptions } from "./_options";
import { ContentConfig } from "/@/components/PageContent";

const columns = [
  {
    prop: "id",
    label: "ID",
  },
  {
    prop: "spec_name",
    label: "规格名称",
  },
  {
    prop: "status",
    label: "状态",
    width: "80px",
    cellRenderer: ({ row }) => {
      return h( ElTag, { 
        type: (statusOptions.find(({value}) => value === String(row.status)))?.type || 'info'
      }, { default: () => (statusOptions.find(({value}) => value === String(row.status)))?.label || '--'}
      );
    }
  },
  {
    prop: "addtime",
    label: "创建时间",
  },  
  {
    prop: "",
    label: "操作",
    fixed: "right",
    slot: "operation",
    width: "150px",
  },
]




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

export default contentConfig;
