import { ContentConfig } from "/@/components/PageContent";
import { httpList } from "/@/api/sellOut/stockApply";
import { h } from "vue";
import { ElTag } from "element-plus";

import { statusOptions } from "./_options"

const columns = [
  {
    prop: 'bk_code',
    label: '申请编码',
    width: '160'
  },
  {
    prop: 'company_name',
    label: '申请人部门',
    minWidth: '150px'
  },

  {
    prop: 'apply_name',
    label: '申请人',
    width: '60'
  },
  {
    prop: 'companyNo',
    label: '业务公司编码',
    width: '155px'
  },
  {
    prop: 'companyName',
    label: '业务公司名称',
    width: '155px'
  },
  {
    prop: 'supplierNo',
    label: '供应商编码',
    width: '155px'
  },
  {
    prop: 'supplierName',
    label: '供应商名称',
    width: '155px'
  },
  {
    prop: 'good_name',
    label: '商品名称',
    'min-width': '120'
  },
  {
    prop: 'spuCode',
    label: 'SPU编码',
    width: '155'
  },
  {
    prop: 'good_num',
    label: '数量',
    'min-width': '50'
  },
  {
    prop: 'status',
    label: '状态',
    width: '120px',
    cellRenderer({ row }){
      return h(ElTag, { size: 'small' }, {
        default:() => statusOptions.find(({value}) => value == row.status)?.label  || '--'
      })
    }
  },
  {
    prop: 'addtime',
    label: '创建时间',
    width: '150'
  },
  {
    prop: "",
    label: "操作",
    fixed: "right",
    width: "50px",
    slot: "operation",
  }
];

const contentConfig: ContentConfig = {
  title: "备货申请管理",
  columns,
  apis: {
    httpList,
    httpAdd: true
  }
};

export default contentConfig;
