From 752aa0ef69d7a78e4ce633e01141024a19e0dde3 Mon Sep 17 00:00:00 2001 From: Hongyuan Ma Date: Wed, 11 Jul 2018 12:44:53 +0800 Subject: [PATCH] add branch_num in machineinfo page --- front-end/src/component/farmer-detail-card/index.jsx | 3 ++- .../src/component/history-records-pane1/index.jsx | 11 +++++++---- front-end/src/page/machineInfo/index.jsx | 6 ++++-- front-end/src/util/machine-record-table/index.jsx | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/front-end/src/component/farmer-detail-card/index.jsx b/front-end/src/component/farmer-detail-card/index.jsx index 10549ce..bee5456 100644 --- a/front-end/src/component/farmer-detail-card/index.jsx +++ b/front-end/src/component/farmer-detail-card/index.jsx @@ -9,6 +9,7 @@ class FarmerDetailCard extends React.Component { } render(){ let machine = this.props.machine || {} + let branch_num = this.props.branch_num || 0 let system = machine.os_name + ' ' + machine.os_version; let camp = machine.comp_name + ' ' + machine.comp_version; let owner = machine.owner || {}; @@ -37,7 +38,7 @@ class FarmerDetailCard extends React.Component {
{/*todo link to machine page*/}
diff --git a/front-end/src/component/history-records-pane1/index.jsx b/front-end/src/component/history-records-pane1/index.jsx index a93eedb..bd92ac2 100644 --- a/front-end/src/component/history-records-pane1/index.jsx +++ b/front-end/src/component/history-records-pane1/index.jsx @@ -19,8 +19,8 @@ class HistoryRecordPane1 extends React.Component { currentTotal: 0, currentPage:1, machine_sn: props.machine_sn || '', - branches: props.branches || [], - selected_branch: 1, + branches: props.branches, + selected_branch: props.branches[0].value, } // console.dir(this.state.branches) this.loadMachineRecordListByBranch = this.loadMachineRecordListByBranch.bind(this); @@ -28,7 +28,8 @@ class HistoryRecordPane1 extends React.Component { } componentDidMount() { - // this.loadHistoryRecordList(); + // console.log(this.state.branches[0].value) + this.loadMachineRecordListByBranch() } componentWillReceiveProps(nextProps) { this.setState({ @@ -55,7 +56,9 @@ class HistoryRecordPane1 extends React.Component { listParam.page = page; listParam.test_machine__machine_sn = this.state.machine_sn; listParam.branch__id = this.state.selected_branch; - + if(listParam.branch__id <= 0) { + return; + } _record.getMachineRecordListByBranch(listParam).then(res => { _this.setState({ currentList: res.results, diff --git a/front-end/src/page/machineInfo/index.jsx b/front-end/src/page/machineInfo/index.jsx index 4f59c38..3634145 100644 --- a/front-end/src/page/machineInfo/index.jsx +++ b/front-end/src/page/machineInfo/index.jsx @@ -13,7 +13,9 @@ class MachineInfo extends React.Component { super(props); this.state = { machineNo: this.props.match.params.machine_sn, - branches:[], + branches: [ + {'branch':0,'value':0} + ], machineInfo: {}, isLoading: false, currentPage: 1, @@ -98,7 +100,7 @@ class MachineInfo extends React.Component {
{/*Farmer Info*/} - +
diff --git a/front-end/src/util/machine-record-table/index.jsx b/front-end/src/util/machine-record-table/index.jsx index 89b5160..27c34c7 100644 --- a/front-end/src/util/machine-record-table/index.jsx +++ b/front-end/src/util/machine-record-table/index.jsx @@ -84,7 +84,7 @@ class MachineRecordTable extends React.Component { - + Link -- 2.39.5