import './copyrightG-goods.css'
import {
  Select, DatePicker, Button, Table,
  // message,
  Space, Input, Empty
} from 'antd';
// import type { TableColumnsType } from 'antd';
import { SearchOutlined,ClearOutlined } from '@ant-design/icons';
import type { DatePickerProps } from 'antd';
import locale from 'antd/es/date-picker/locale/zh_CN';
const { Column } = Table;
export default function CopyrightGgoods() {
  // const [messageApi, contextHolder] = message.useMessage();
  const dateFormat = 'YYYY年MM月DD日';
  const belongTypeChange = (value: string) => {
    console.log(`selected ${value}`);
  }
  const onChange: DatePickerProps['onChange'] = (date, dateString) => {
    console.log(date, dateString);
  };
  const height = window.innerHeight - 180;
  interface DataType {
    name: string
    short: string
    number: string
    price: string
    version: string
    time: string
    language: string
  }

  const data: DataType[] = [
    {
      name: '智能管理系统',
      short: '简称',
      number: '123456789123456789',
      price: '5.00',
      version: '1-1-1',
      time: '2020-04-19 15：42:21',
      language: 'java'
    },
    {
      name: '商城管理系统',
      short: '简称',
      number: '123456789123456789',
      price: '5.00',
      version: '1-1-1',
      time: '2020-04-19 15：42:21',
      language: 'java'
    },
    {
      name: 'xx系统',
      short: '简称',
      number: '123456789123456789',
      price: '5.00',
      version: '1-1-1',
      time: '2020-04-19 15：42:21',
      language: 'java'
    },
  ];



  return (
    <div className='copyrightG-goods' style={{ height: `${height}px`, overflow: 'auto' }}>
      {/* {contextHolder} */}
      <div className='copyrightG-goods-search'>
        <Input placeholder="最低价格" type="number" min={0}
          style={{ width: 198, height: 36, marginRight: 12 }} />
        至
        <Input placeholder="最高价格" type="number" min={0} style={{ width: 198, height: 36, marginRight: 12, marginLeft: 12 }} />

        <DatePicker placeholder="软著获取时间"
          style={{ width: 198, height: 36, marginRight: 12 }}
          format={dateFormat}
          locale={locale}
          onChange={onChange}
        />
        <Select
          // defaultValue="lucy"
          placeholder='价格排序'
          style={{ width: 198, height: 36, marginRight: 12 }}
          onChange={belongTypeChange}
          options={[
            { value: 'person', label: '升序' },
            { value: 'lucy', label: '降序' },
          ]}
        />
        <Select
          // defaultValue="lucy"
          placeholder='选择开发语言'
          style={{ width: 198, height: 36, marginRight: 12 }}
          onChange={belongTypeChange}
          options={[
            { value: 'person', label: 'java' },
            { value: 'lucy', label: 'php' },
          ]}
        />
        <Select
          // defaultValue="lucy"
          placeholder='选择软著类型'
          style={{ width: 198, height: 36, marginRight: 12 }}
          onChange={belongTypeChange}
          options={[
            { value: 'person', label: '111' },
            { value: 'lucy', label: '222' },
          ]}
        />
        <Button type="primary"
          style={{
            height: 36,
            // backgroundColor: '#FF9F08'
          }}

          icon={<SearchOutlined />}>
          搜索
        </Button>
        <Button
          style={{
            height: 36,
            marginLeft: 10,
            // backgroundColor: '#FF9F08'
          }}
          icon={<ClearOutlined />}>
          清除
        </Button>
      </div>
      <div className='copyrightG-goods-table'>
        {/* 表格 */}
        {data.length == 0 ? (
          <div className='nodata' style={{ height: `${height - 93}px` }}>
            <Empty
              description={
                '暂无数据'
              } />
          </div>) : (<Table
            rowSelection={{
              type: 'checkbox',
              // selectedRowKeys: belongselectedKeys // 设置默认选中的行
            }}

            dataSource={data}
            // pagination={{
            //   defaultPageSize: 10, // 设置默认一页显示 5 条数据
            // }}
            pagination={false} // 不显示分页
            style={{ textAlign: 'center' }} // 设置表格内容居中显示
            rowKey="order" // 指定数据项的唯一标识符
          >
            <Column title="序号" render={(_text, _record, index: number) => (
              index + 1
            )} align="center" />
            <Column
              title="软著名称"
              dataIndex="name"
              align="center"
              render={(text) => (
                <span style={{ color: '#1B8BD2', fontSize: '16px', fontWeight: '700' }}>{text}</span>
              )}
            />
            <Column
              title="软著简称"
              dataIndex="short"
              align="center"
            />
            <Column
              title="软著证号"
              dataIndex="number"
              align="center"
            />
            <Column title="售价" dataIndex="price" align="center"
              render={(text) => (
                <span style={{ color: '#FF5D15', fontSize: '24px', fontWeight: '700' }}>{text}</span>
              )} />
            <Column title="软著版本" dataIndex="version" align="center" />
            <Column title="软著取得时间" dataIndex="time" align="center" />
            <Column title="软著开发语言" dataIndex="language" align="center" />
            {/* <Column title="实名认证状态" dataIndex="address" key="key" /> */}
            <Column
              align="center"
              title="软著电子版"
              render={(_text, record: any) => (
                <Space size="middle">
                  <span className='copyrightG-goods-table-btn' onClick={() => {
                    console.log(record.order);

                  }}>预览</span>
                </Space>
              )}
            />
          </Table>)}



      </div>
    </div>
  )
}
