/* eslint-disable prettier/prettier */
import { h } from "vue"
import { ContentConfig } from "/@/components/PageContent";
import apis from "./apis";
import { ElTag } from "element-plus";

const statusOptions = [
  { value: '1', label: "数据未入报表" },
  { value: '2', label: "数据已入报表" },
]

const departTypeOptions = [
  { value: "1", label: "客服部@百辰荣达" },
  { value: "2", label: "新媒体" },
  { value: "3", label: "项目部@普润心堂" },
  { value: "4", label: "销售部" },
]

const columns = [
  {
    prop: "orderCode",
    minWidth: "155px",
    label: "销售主订单编号"
  },
  {
    prop: "goodNo",
    label: "商品成本编号",
    minWidth: "155px"
  },
  {
    prop: "goodName",
    label: "商品名称",
    minWidth: "155px"
  },
  {
    prop: 'status',
    label: '状态',
    minWidth: '155px',
    cellRenderer: ({ row }) => {
      return h(ElTag, null, {
        default: () => statusOptions.find((item) => item.value === String(row.status)).label
      })
    }
  },
  {
    prop: 'before',
    label: '修改前成本',
    minWidth: '155px'
  },
  {
    prop: 'after',
    label: '修改后成本',
    minWidth: '155px'
  },
  {
    label: '部门',
    prop: 'depart_type',
    minWidth: '155px',
    cellRenderer({ row }) {
      return departTypeOptions.find((item) => item.value === String(row.depart_type))?.label || "--"
    }
  },
  {
    label: '创建人',
    prop: 'apply_name',
    minWidth: '155px'
  },
  {
    label: '创建人所在部门',
    prop: 'depart_name',
    minWidth: '155px'
  },
  {
    prop: 'addtime',
    label: '创建时间',
    minWidth: '155px'
  }
]


const contentConfig: ContentConfig = {
  columns,
  responseCode: 1,
  showTitle: false,
  superUserNoAction: false,
  apis: { httpList: apis.list }
};


export default contentConfig;
