A 新建发布申请选择应用支持过滤

pull/103/head
vapao 2020-05-15 21:12:02 +08:00
parent b175f51a33
commit 6da1371d28
3 changed files with 29 additions and 17 deletions

View File

@ -6,7 +6,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { observer } from 'mobx-react';
import { Modal, Button, Menu, Spin, Icon, Tooltip } from 'antd';
import { Modal, Button, Menu, Spin, Icon, Input, Tooltip } from 'antd';
import store from './store';
import styles from './index.module.css';
import envStore from 'pages/config/environment/store';
@ -17,7 +17,8 @@ class SelectApp extends React.Component {
constructor(props) {
super(props);
this.state = {
env_id: 0
env_id: 0,
search: ''
}
}
@ -58,7 +59,10 @@ class SelectApp extends React.Component {
render() {
const {env_id} = this.state;
const records = store.deploys.filter(x => x.env_id === Number(env_id));
let records = store.deploys.filter(x => x.env_id === Number(env_id));
if (this.state.search) {
records = records.filter(x => x['app_name'].toLowerCase().includes(this.state.search.toLowerCase()))
}
return (
<Modal
visible
@ -83,7 +87,14 @@ class SelectApp extends React.Component {
<div className={styles.right}>
<Spin spinning={store.isLoading}>
<div className={styles.title}>{lds.get(envStore.idMap, `${env_id}.name`)}</div>
<div className={styles.title}>
<div>{lds.get(envStore.idMap, `${env_id}.name`)}</div>
<Input.Search
allowClear
style={{width: 200}}
placeholder="请输入快速搜应用"
onChange={e => this.setState({search: e.target.value})}/>
</div>
{records.map(item => (
<Tooltip key={item.id} title={store.refs[item.id] ? item['app_name'] : null}>
<Button type="primary" className={styles.appBlock} onClick={() => this.handleClick(item)}>

View File

@ -6,7 +6,7 @@
import React from 'react';
import { observer } from 'mobx-react';
import { Button, Select, DatePicker, Radio, Row, Col, Modal, Form, message } from 'antd';
import { SearchForm, AuthButton, AuthCard } from 'components';
import { SearchForm, AuthFragment, AuthCard } from 'components';
import SelectApp from './SelectApp';
import Ext1Form from './Ext1Form';
import Ext2Form from './Ext2Form';
@ -91,18 +91,16 @@ class Index extends React.Component {
</Radio.Group>
</Col>
<Col span={8} style={{textAlign: 'right'}}>
<AuthButton
hide
type="primary"
icon="delete"
auth="deploy.request.del"
onClick={this.handleBatchDel} style={{marginRight: 20}}>批量删除</AuthButton>
<AuthButton
hide
type="primary"
icon="plus"
auth="deploy.request.add"
onClick={() => store.addVisible = true}>新建发布申请</AuthButton>
<AuthFragment auth="deploy.request.del">
<Button type="primary" icon="delete" onClick={this.handleBatchDel}>批量删除</Button>
</AuthFragment>
<AuthFragment auth="deploy.request.add">
<Button
type="primary"
icon="plus"
onClick={() => store.addVisible = true}
style={{marginLeft: 20}}>新建发布申请</Button>
</AuthFragment>
</Col>
</Row>
<ComTable/>

View File

@ -14,6 +14,9 @@
}
.title {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
color: rgba(0, 0, 0, .85);
font-weight: 500;