import { router } from 'umi'
import React, { useState, useEffect } from 'react';

import { Button, Badge, message } from 'antd'
import moment from 'moment'
import OperButton from '@/components/OperButton'
import AuthButton from '@/components/AuthButton'
import withActions from '@/components/ActionList'
import { getImgURL } from '@/utils/image';
import request, { apis } from '@/utils/request'

export default ({page,getBrandData, onEdit, onDelete}) => [
  {
    title: '开发商索引字母',
    dataIndex:'indexLetter',
    key: 'indexLetter',
    align: 'center',
  },
  {
    title: '开发商名称',
    dataIndex: 'brandName',
    key: 'brandName',
    align: 'center',
  },
  {
    title: '品牌Logo',
    dataIndex: 'brandLogo',
    key: 'brandLogo',
    align: 'center',
    render:(_,record)=> <img src={getImgURL(record.brandLogo)} style={{width:'100px',borderRadius:'5px'}}/>,
  },
  {
    title: '品牌宣传图',
    dataIndex: 'brandImg',
    key: 'brandImg',
    align: 'center',
    render:(_,record)=> <img src={getImgURL(record.brandImg)} style={{width:'165px',height:'104px',borderRadius:'5px'}}/>,
  },
  {
    title: '简介',
    dataIndex: 'brandRemark',
    key: 'brandRemark',
    align: 'center',
    width: '40%',
  },
  {
    title: '操作',
    key: 'options',
    align: 'center',
    render: withActions((_, row) => [
      <AuthButton name="building.brand.edit" noRight={null}>
        <OperButton onClick={() => onEdit(row)}>编辑</OperButton>
      </AuthButton>,
      <AuthButton name="building.brand.delete" noRight={null}>
        <OperButton.Confirm
          title="确认删除?"
          content="删除之后不可恢复"
          onClick={()=>onDelete(row,row.brandId)}
        >删除</OperButton.Confirm>
      </AuthButton>
    ], {noMargin: true})
  },
]