import React from 'react';
// import './index.css';
import {Tab, Divider, Segment, Icon} from 'semantic-ui-react'
import FarmerDetailCard from 'component/farmer-detail-card/index.jsx'
import Record from 'service/record-service.jsx'
import PGUtil from 'util/util.jsx'
import HistoryRecordsPane1 from 'component/history-records-pane1/index.jsx'
const _util = new PGUtil();
const _record = new Record();
class MachineInfo extends React.Component {
constructor(props) {
super(props);
this.state = {
machineNo: this.props.match.params.machine_sn,
branches: [
{'branch':0,'value':0}
],
machineInfo: {},
isLoading: false,
currentPage: 1,
total:3,
filter: {},
list: [
]
},
// console.dir(this.props.match.params)
// this.onPageChange = this.onPageChange.bind(this);
this.handleApplyBtnClick = this.handleApplyBtnClick.bind(this);
this.loadHistoryRecordList = this.loadHistoryRecordList.bind(this);
}
componentDidMount() {
this.loadHistoryRecordList();
}
handleApplyBtnClick(params) {
console.log('handle apply!')
let self = this
this.setState({filter: params}, ()=> {
self.loadRecordList()
});
}
// load history record list
loadHistoryRecordList() {
let _this = this;
let listParam = {};
// listParam= this.state.filter;
// listParam.page = page;
listParam.machine_sn = this.state.machineNo;
_record.getHistoryRecordList(listParam).then(res => {
console.log('res is:')
console.dir(res)
this.setState({
branches: res.branches || [],
machineInfo: res.machine_info || {},
list: res.reports || [],
// total: res.count,
isLoading: false
}, ()=> {
console.log(this.state.branches);
// 123
});
// _this.changeIsLoading(false);
}, errMsg => {
this.setState({
list: []
});
_util.errorTips(errMsg);
console.log(errMsg)
_this.changeIsLoading(false);
});
console.log(this.state.list)
}
render() {
// let branches = this.state.branches;
let panes = [
{ menuItem: 'Review By Branches', render: () =>