From da58ebab4ab2b36366c3cfa94cf65a3e4afcee73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E4=BA=8C=E7=8C=9B?= Date: Fri, 6 Dec 2019 13:05:44 +0800 Subject: [PATCH] F web fix bug --- spug_web/src/pages/alarm/group/Table.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/spug_web/src/pages/alarm/group/Table.js b/spug_web/src/pages/alarm/group/Table.js index 09b1838..bb036ef 100644 --- a/spug_web/src/pages/alarm/group/Table.js +++ b/spug_web/src/pages/alarm/group/Table.js @@ -16,19 +16,24 @@ class ComTable extends React.Component { contactMap: {} } } + componentDidMount() { store.fetchRecords(); if (contactStore.records.length === 0) { - contactStore.fetchRecords().then(() => { - const tmp = {}; - for (let item of contactStore.records) { - tmp[item.id] = item - } - this.setState({contactMap: tmp}) - }) + contactStore.fetchRecords().then(this._handleContacts) + } else { + this._handleContacts() } } + _handleContacts = () => { + const tmp = {}; + for (let item of contactStore.records) { + tmp[item.id] = item + } + this.setState({contactMap: tmp}) + }; + columns = [{ title: '序号', key: 'series',