import React, { useState, useEffect, useRef, Component } from 'react'
import { connect } from 'dva'
import FormPage from '../../FormPage'
import { initFilter, addRuleAndGroups, guid, extendInclude, extendRule, extend } from "../../../utils/common"
import { Table, Card,Modal,List,Avatar, Row, Col, Icon, Button, Input, DatePicker, Form, Select, notification, Divider,Tabs,Tag   } from 'antd';
// import './home.less'
import config from '../config';
const { TabPane } = Tabs;
class ApproveMobile extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
        visible: false,
        noticeTitle: '',
      retData: [],
      pagination: {},
      tmpData: {},
      type:"1",
    //   querySearch: {},//搜索集合
    //   tableData: [{//工作台四个展示模块
    //     key: '1',
    //     // bgImg: backlog,
    //     title: '待办事项',
    //     total: '0',
    //     // iconImg: backlog_i,
    //     iconDisplay: 'block',
    //   }, {
    //     key: '2',
    //     // bgImg: flow,
    //     title: '已办事项',
    //     total: '0',
    //     // iconImg: flow_i,
    //     iconDisplay: 'none',
    //   },
    //   //  {
    //   //   key: '3',
    //   //   bgImg: finished,
    //   //   title: '今日新增',
    //   //   total: '0',
    //   //   iconImg: finished_i,
    //   //   iconDisplay: 'none',
    //   // }
    //   //   ,
    //   {
    //     key: '4',
    //     // bgImg: remind,
    //     title: '待办超时',
    //     total: '0',
    //     // iconImg: remind_i,
    //     iconDisplay: 'none',
    //   }
    //   ],
    };
  };
  componentDidMount() {
    this.getBaseInfoData(1, "1", 500);
  };
  componentDidUpdate(preProps ){
    // if(preProps.type!==this.props.type){
    //    //放置刷新函数
    // }
 }
   //获取数据
   getBaseInfoData = (pagination, key, limit) => {
    const current = pagination ? pagination.current : 1
    const json = initFilter(this.props.login.OrgId, "", "CODE", 1, current)
    extendRule(json, 'SOURCE_FORMCODE', 9, "FO008")
    // const querySearch = this.state.querySearch;
    // for (var item in querySearch) {
    //   if (item == 'searchName') {
    //     extendRule(json, 'NOTICE_TITLE', 9, querySearch[item])
    //   }
    //   if (item == 'searchCode') {
    //     extendRule(json, 'CODE', 9, querySearch[item])
    //   }
    //   if (item == 'startTime1') {
    //     extendRule(json, 'TASK_STARTDT', 6, querySearch[item])
    //   }
    //   if (item == 'startTime2') {
    //     extendRule(json, 'TASK_STARTDT', 4, querySearch[item])
    //   }
    //   if (item == 'endTime1') {
    //     extendRule(json, 'TASK_ENDDT', 6, querySearch[item])
    //   }
    //   if (item == 'endTime2') {
    //     extendRule(json, 'TASK_ENDDT', 4, querySearch[item])
    //   }
    // }
    json.Limit = limit;
    json.Parameter1 = key;//1待办事项2已办事项3今日新增4待办超时
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'FM/FMNotificationTask/OrderPaged',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data.newData) {
        //   this.state.tableData[0].total = re.Data.todoCount;
        //   this.state.tableData[1].total = re.Data.doneCount;
        //   this.state.tableData[2].total = re.Data.todayNewCount;
        //   this.state.tableData[2].total = re.Data.timeOverCount;
          // if (limit != null || limit != undefined) 
          // {
            this.setState({
              retData: re.Data.newData,
            })
          // } 
          // else {
          //   var pageInfo = {}
          //   pageInfo.current = current;
          //   pageInfo.total = Math.ceil(re.Data.TotalCount, 10);
          //   this.setState({
          //     retDataAll: re.Data.newData,
          //     pagination: pageInfo,
          //   })
          // }
        }
      }
    })
  };
  ShowState(obj,key) {
    if(key!="2")
    {
      var thisResult = (Date.parse(obj.TASK_ENDDT) - Date.parse(Date())) / 3600 / 1000;
      if (thisResult > 0) {
        return (