From 1ccfdf2db7ee1c947d747f6fa98f14f075f141fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E4=BA=8C=E7=8C=9B?= Date: Mon, 2 Dec 2019 23:22:18 +0800 Subject: [PATCH] F web fix bug --- spug_web/src/pages/monitor/Table.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/spug_web/src/pages/monitor/Table.js b/spug_web/src/pages/monitor/Table.js index 813060d..0995008 100644 --- a/spug_web/src/pages/monitor/Table.js +++ b/spug_web/src/pages/monitor/Table.js @@ -21,16 +21,20 @@ class ComTable extends React.Component { componentDidMount() { store.fetchRecords(); if (hostStore.records.length === 0) { - hostStore.fetchRecords().then(() => { - const tmp = {}; - for (let item of hostStore.records) { - tmp[item.id] = item - } - this.setState({hosts: tmp}) - }) + hostStore.fetchRecords().then(this._handleHosts) + } else { + this._handleHosts() } } + _handleHosts = () => { + const tmp = {}; + for (let item of hostStore.records) { + tmp[item.id] = item + } + this.setState({hosts: tmp}) + }; + columns = [{ title: '序号', key: 'series',