From f6c83a9f5a571df866612c8a5a4f5bfa37bf0985 Mon Sep 17 00:00:00 2001 From: Hongyuan Ma Date: Sat, 30 Jun 2018 23:57:23 +0800 Subject: [PATCH] add machine info page --- front-end/src/page/machineInfo/index.jsx | 92 +++++++++++++++++++++++ front-end/src/page/machineInfo/index.scss | 0 2 files changed, 92 insertions(+) create mode 100644 front-end/src/page/machineInfo/index.jsx create mode 100644 front-end/src/page/machineInfo/index.scss diff --git a/front-end/src/page/machineInfo/index.jsx b/front-end/src/page/machineInfo/index.jsx new file mode 100644 index 0000000..0c9740e --- /dev/null +++ b/front-end/src/page/machineInfo/index.jsx @@ -0,0 +1,92 @@ +import React from 'react'; +// import './index.css'; +import ResultFilter from 'component/result-filter/index.jsx'; +import BasicTable from 'util/basic-table/index.jsx'; +import Record from 'service/record-service.jsx' +import PGUtil from 'util/util.jsx' + +const _util = new PGUtil(); +const _record = new Record(); +class MachineInfo extends React.Component { + constructor(props) { + super(props); + this.state = { + isLoading: false, + currentPage: 1, + total:3, + filter: {}, + list: [ + ] + + }, + + this.onPageChange = this.onPageChange.bind(this); + this.onIsLoadingChange = this.onIsLoadingChange.bind(this); + this.handleApplyBtnClick = this.handleApplyBtnClick.bind(this); + this.loadRecordList = this.loadRecordList.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(page=1) { + let _this = this; + let listParam = {}; + listParam= this.state.filter; + listParam.page = page; + + _record.getRecordList(listParam).then(res => { + console.log('res is:' + res) + this.setState({ + list: res.results, + total: res.count, + isLoading: false + }); + _this.changeIsLoading(false); + }, errMsg => { + this.setState({ + list: [] + }); + _util.errorTips(errMsg); + + console.log(errMsg) + _this.changeIsLoading(false); + }); + + console.log(this.state.list) + } + + onPageChange(page) { + console.log(page); + console.log(this); + this.setState({ + current: page, + }); + } + + render() { + let show = this.state.isLoading ? "none" : "block"; + let style = { + display: show + }; + + return ( +
+ +
+ ) + } +} + +export default MachineInfo; \ No newline at end of file diff --git a/front-end/src/page/machineInfo/index.scss b/front-end/src/page/machineInfo/index.scss new file mode 100644 index 0000000..e69de29 -- 2.39.5