import React, { useMemo, useRef, useCallback, useState } from 'react';
import apis from '@/services/apis';
import moment from 'moment'
import QueryTable from '@/components/QueryTable';
import BuildingSelect from '@/components/SelectButton/BuildSelect';

import { router } from 'umi';

export default props => {
  const ref = useRef();

  const searchFields = [
    {
      name: 'buildingId',
      label: '项目',
      placeholder: '请选择项目',
      render: () => <BuildingSelect style={{ width: 160 }} />,
    },
  ];

  const tableColumns = [
    {
      title: '项目',
      dataIndex: 'buildingName',
      key: 'buildingName',
      align: 'center',
    },
    {
      title: '编辑人',
      dataIndex: 'updateName',
      key: 'updateName',
      align: 'center',
    },

    {
      title: '编辑时间',
      dataIndex: 'updateTime',
      key: 'updateTime',
      align: 'center',
      render:(t)=>moment(t).format('YYYY-MM-DD HH:mm:ss')
    },
  ];

  return (
    <>
      <QueryTable
        ref={ref}
        rowKey="id"
        api={apis.building.logs}
        columns={tableColumns}
        searchFields={searchFields}
      />
    </>
  );
};
