import { ContentConfig } from "/@/components/PageContent";

import { httpList } from "/@/api/stock/survey";

import { statusOptions } from "./options";
import { renderStatus } from "/@/utils/column-helper";
import { CG_ORDER_TYPE_OPTIONS } from "/@/config/status";

const columns = [
  {
    type: "selection",
    width: 55,
    hide: ({ checkList }) => !checkList.includes("勾选列")
  },
  {
    label: "序号",
    type: "index",
    width: 70,
    hide: ({ checkList }) => !checkList.includes("序号列")
  },
  {
    prop: "good_log_code",
    label: "业务编号",
    width: "180"
  },
  {
    prop: "good_name",
    label: "商品名称",
    width: "160px"
  },
  {
    prop: "spuCode",
    label: "商品成本编码",
    width: "180"
  },
  {
    prop: "is_stock",
    label: "是否库存品",
    width: "130",
    cellRenderer({ row }) {
      return row.is_stock === "0" ? "否" : "是";
    }
  },
  {
    prop: "action_type_cn",
    label: "库存来源",
    width: "90px"
  },
  {
    prop: "type",
    label: "变化类别",
    width: "130",
    ...renderStatus(statusOptions, "type")
  },
  {
    prop: "stock",
    label: "变动数量",
    width: "90px"
  },
  {
    prop: "companyNo",
    label: "业务公司编号",
    width: "150px"
  },
  {
    prop: "company",
    label: "业务公司名称",
    "min-width": "150px"
  },
  {
    prop: "code",
    label: "仓库所在公司编号",
    width: "150px"
  },
  {
    prop: "name",
    label: "仓库所在公司名称",
    "min-width": "150px"
  },
  {
    prop: "wsm_code",
    label: "仓库编号",
    width: "165px"
  },
  {
    prop: "wsm_name",
    label: "仓库名称",
    "min-width": "100px"
  },

  {
    prop: "action_name",
    label: "操作人",
    width: "70px"
  },
  {
    prop: "reviewer",
    label: "操作人部门",
    width: "130px",
    cellRenderer({ row }) {
      return row.item ? row.item.map(str => str).join(" ") : "--";
    }
  },
  {
    prop: "addtime",
    label: "操作时间",
    width: "145px",
    sortable: true
  },
  {
    label: "操作",
    fixed: "right",
    width: 60,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "库存概况",
  columns,
  apis: {
    httpList
  }
};

export default contentConfig;
