From 715b59f90253d68b79c0f0b564254a41c2cfcfe9 Mon Sep 17 00:00:00 2001 From: vapao Date: Fri, 27 Nov 2020 15:31:20 +0800 Subject: [PATCH] style migrate v3 --- spug_web/src/pages/alarm/alarm/Table.js | 20 +++++++++++++------- spug_web/src/pages/alarm/alarm/index.js | 14 ++++++++++---- spug_web/src/pages/alarm/alarm/store.js | 10 +++++++++- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/spug_web/src/pages/alarm/alarm/Table.js b/spug_web/src/pages/alarm/alarm/Table.js index 32ca95d..32315e8 100644 --- a/spug_web/src/pages/alarm/alarm/Table.js +++ b/spug_web/src/pages/alarm/alarm/Table.js @@ -5,7 +5,8 @@ */ import React from 'react'; import { observer } from 'mobx-react'; -import { Table, Tag } from 'antd'; +import { Radio, Tag } from 'antd'; +import { TableCard } from 'components'; import store from './store'; import groupStore from '../group/store'; @@ -61,15 +62,20 @@ class ComTable extends React.Component { }]; render() { - let data = store.records; - if (store.f_name) { - data = data.filter(item => item['name'].toLowerCase().includes(store.f_name.toLowerCase())) - } return ( - store.f_status = e.target.value}> + 全部 + 报警发生 + 报警恢复 + + ]} pagination={{ showSizeChanger: true, showLessItems: true, diff --git a/spug_web/src/pages/alarm/alarm/index.js b/spug_web/src/pages/alarm/alarm/index.js index dbc031b..9df96f1 100644 --- a/spug_web/src/pages/alarm/alarm/index.js +++ b/spug_web/src/pages/alarm/alarm/index.js @@ -5,23 +5,29 @@ */ import React from 'react'; import { observer } from 'mobx-react'; +import { SyncOutlined } from '@ant-design/icons'; import { Input, Button } from 'antd'; -import { SearchForm, AuthCard } from 'components'; +import { SearchForm, AuthDiv, Breadcrumb } from 'components'; import ComTable from './Table'; import store from './store'; export default observer(function () { return ( - + + + 首页 + 报警中心 + 报警历史 + store.f_name = e.target.value} placeholder="请输入"/> - + - + ) }) diff --git a/spug_web/src/pages/alarm/alarm/store.js b/spug_web/src/pages/alarm/alarm/store.js index b83166f..4b7dfc6 100644 --- a/spug_web/src/pages/alarm/alarm/store.js +++ b/spug_web/src/pages/alarm/alarm/store.js @@ -3,7 +3,7 @@ * Copyright (c) * Released under the AGPL-3.0 License. */ -import { observable } from "mobx"; +import { observable, computed } from 'mobx'; import http from 'libs/http'; class Store { @@ -11,6 +11,14 @@ class Store { @observable isFetching = false; @observable f_name; + @observable f_status = ''; + + @computed get dataSource() { + let records = this.records; + if (this.f_name) records = records.filter(x => x.name.toLowerCase().includes(this.f_name.toLowerCase())); + if (this.f_status) records = records.filter(x => x.status === this.f_status); + return records + } fetchRecords = () => { this.isFetching = true;