import React from 'react';
import { Icon, Button, Select, Spin, Table, message } from 'antd';
import { provinceArr } from '../../../dataDic.js';
import { companySearch } from '../../../tools.js';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import './technology.less';
import WebsiteAdd from './websiteAdd.jsx';
import WebsiteChange from './websiteChange.jsx';
const Cognizance = React.createClass({
    loadData(pageNo) {
        this.state.data = [];
        this.setState({
            loading: true
        });
        $.ajax({
            method: "post",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + "/api/admin/techproject/listTechWebsite",
            data: {
                pageNo: pageNo || 1,
                pageSize: this.state.pagination.pageSize,
                unitName: this.state.unitName,
            },
            success: function (data) {
                if (!data.data || !data.data.list) {
                    if (data.error && data.error.length) {
                        message.warning(data.error[0].message);
                    };
                    return;
                };
                for (let i = 0; i < data.data.list.length; i++) {
                    let thisdata = data.data.list[i];
                    this.state.data.push({
                        key: i,
                        id: thisdata.id,
                        uid: thisdata.uid,
                        unitName: thisdata.unitName,
                        department: thisdata.department,
                        webSite: thisdata.website,
                        userName: thisdata.accountNumber,
                        password: thisdata.password
                    });
                };
                this.state.pagination.current = data.data.pageNo;
                this.state.pagination.total = data.data.totalCount;
                this.setState({
                    dataSource: this.state.data,
                    pagination: this.state.pagination
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
    },
    getCompanyList() {
        this.setState({
            loading: true
        });
        $.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + "/api/admin/techproject/websiteUnit",
            success: function (data) {
                if (!data.data) {
                    if (data.error && data.error.length) {
                        message.warning(data.error[0].message);
                    };
                    return;
                };
                let _me = this;
                for (var item in data.data) {
                    _me.state.companyOption.push(