import React from 'react';
import $ from 'jquery/src/ajax';
import 'react-quill/dist/quill.bubble.css';
import {Form,Icon,Button,Input,Select,Spin,Table,message,DatePicker,Modal,Upload,Popconfirm,Cascader,InputNumber,Radio,TimePicker,Tabs,Tag} from 'antd';


export default class JzmList extends React.Component {
	constructor(props) {
		super(props)
        this.state = {
          confirmDirty: false,
          //加载状态
          loading: false,
          //搜索框内容
          nameSearch: undefined,
          //数据类型
          columns:[
              {
                title: '序号',
                dataIndex: 'key',
              },
              {
                title: '企业名称',
                dataIndex: 'title',
              },
              {
                title: '服务项目',
                dataIndex: 'stPorject',
              },              {
                title: '所在地',
                dataIndex: 'adree',
              },
              {
                title: '成立时间',
                dataIndex: 'time',
              },
              {
                title: '联系人',
                dataIndex: 'user',
              },
              {
                title: '电话',
                dataIndex: 'iphone',
              },
              {
                title: '状态',
                dataIndex: 'state',
              },
              {
                title: '排序',
                dataIndex: 'first',
              },
              {
                title: '置顶',
                dataIndex: 'top',
                render: (text)=>{
                  return text?'是':'否'
                }
              },
              {
                title: '操作',
                dataIndex: 'ads',
                render:(text,record,index)=>{
                  return  (<div>
                        <Button type="primary" >修改</Button>
                        <Popconfirm okText="确定" cancelText="取消" title="是否确认删除该信息吗？"  onConfirm={()=>{this.delete(index)}}>
                          <Button type="danger" style={{marginLeft:"10px"}}>删除</Button>
                        </Popconfirm>
                      </div>)
                }
              },
          ],
          //数据列表
          dataSource:[
            {
              key:1,
              title:'南昌XXXXX公司',
              stPorject: '军工',
              adree: '江西南昌',
              time: '2019',
              user: '吴工',
              iphone: '13728469721',
              state: '20',
              first: '1',
              top: '1',
            },
            {
              key:2,
              title:'南昌XXXXX公司',
              stPorject: '军工',
              adree: '江西南昌',
              time: '2019',
              user: '吴工',
              iphone: '13728469721',
              state: '20',
              first: '1',
              top: '1',
            },
            {
              key:3,
              title:'南昌XXXXX公司',
              stPorject: '军工',
              adree: '江西南昌',
              time: '2019',
              user: '吴工',
              iphone: '13728469721',
              state: '20',
              first: '1',
              top: '1',
            },
          ]
		}
  }
  //删除按钮
  delete(id){
    this.state.dataSource.splice(id,1)
    this.setState({
      dataSource: this.state.dataSource
    })
  }

	render() {  
	  return (
      <div className="user-content">
        <div className="content-title">
          <span>页头内容</span>
          <div className="user-search">
            <Input
              placeholder="请输入关键字"
              style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
              value={this.state.nameSearch}
              onChange={(e) => {
                this.setState({ nameSearch: e.target.value });
              }}
            />
            <Button type="primary"  style={{ marginRight: '10px' }}>
              搜索
            </Button>
            <Button style={{ marginRight: '10px' }}>
              重置
            </Button>
            <Button type="primary"  style={{}}>
                +新增类型
              </Button>
          </div>
          <div className="patent-table">
            <Spin spinning={this.state.loading}>
            <Table
                columns={this.state.columns}
                dataSource={this.state.dataSource}
                pagination={this.state.pagination}
                onRowClick={this.tableRowClick}
                bordered
                ellipsis="true"
              />
            </Spin>
          </div>
        </div>
      </div>)
	}
  }

