fix issue

pull/360/head
vapao 2021-07-26 17:36:39 +08:00
parent 08b5f03bda
commit c49345be38
2 changed files with 27 additions and 31 deletions

View File

@ -15,7 +15,7 @@ import store from './store';
@observer @observer
class TableView extends React.Component { class TableView extends React.Component {
lockIcon = <Tooltip title="私有配置应用专用,不会被其他应用获取到"> lockIcon = <Tooltip title="私有配置应用专用,不会被其他应用获取到">
<LockOutlined style={{marginRight: 5}} /> <LockOutlined style={{marginRight: 5}}/>
</Tooltip>; </Tooltip>;
columns = [{ columns = [{
@ -47,8 +47,10 @@ class TableView extends React.Component {
render: info => ( render: info => (
<Action> <Action>
<Action.Button auth={`config.${store.type}.edit_config`} onClick={() => store.showForm(info)}>编辑</Action.Button> <Action.Button auth={`config.${store.type}.edit_config`} onClick={() => store.showForm(info)}>编辑</Action.Button>
<Action.Button auth={`config.${store.type}.edit_config`} <Action.Button
onClick={() => this.handleDelete(info)}>删除</Action.Button> danger
auth={`config.${store.type}.edit_config`}
onClick={() => this.handleDelete(info)}>删除</Action.Button>
</Action> </Action>
) )
}]; }];

View File

@ -5,20 +5,19 @@
*/ */
import React from 'react'; import React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { Menu, Input, Button, PageHeader, Modal, Space, Radio } from 'antd'; import { Menu, Input, Button, PageHeader, Modal, Space, Radio, Form } from 'antd';
import { import {
DiffOutlined, DiffOutlined,
HistoryOutlined, HistoryOutlined,
NumberOutlined, NumberOutlined,
SyncOutlined,
TableOutlined, TableOutlined,
UnorderedListOutlined, UnorderedListOutlined,
PlusOutlined, PlusOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import envStore from '../environment/store'; import envStore from '../environment/store';
import styles from './index.module.css'; import styles from './index.module.css';
import history from 'libs/history'; import history from 'libs/history';
import { SearchForm, AuthDiv, AuthButton, Breadcrumb } from 'components'; import { AuthDiv, AuthButton, Breadcrumb } from 'components';
import DiffConfig from './DiffConfig'; import DiffConfig from './DiffConfig';
import TableView from './TableView'; import TableView from './TableView';
import TextView from './TextView'; import TextView from './TextView';
@ -100,36 +99,31 @@ class Index extends React.Component {
</Menu> </Menu>
</div> </div>
<div className={styles.right}> <div className={styles.right}>
<SearchForm> <Form layout="inline" style={{marginBottom: 16}}>
<SearchForm.Item span={6} title="视图" style={{paddingLeft: 0}}> <Form.Item label="视图" style={{paddingLeft: 0}}>
<Radio.Group value={view} onChange={e => this.setState({view: e.target.value})}> <Radio.Group value={view} onChange={e => this.setState({view: e.target.value})}>
<Radio.Button value="1"><TableOutlined title="表格视图"/></Radio.Button> <Radio.Button value="1"><TableOutlined title="表格视图"/></Radio.Button>
<Radio.Button value="2"><UnorderedListOutlined title="文本视图"/></Radio.Button> <Radio.Button value="2"><UnorderedListOutlined title="文本视图"/></Radio.Button>
<Radio.Button value="3"><NumberOutlined title="JSON视图"/></Radio.Button> <Radio.Button value="3"><NumberOutlined title="JSON视图"/></Radio.Button>
</Radio.Group> </Radio.Group>
</SearchForm.Item> </Form.Item>
<SearchForm.Item span={7} title="Key"> <Form.Item label="Key">
<Input allowClear value={store.f_name} onChange={e => store.f_name = e.target.value} placeholder="请输入"/> <Input allowClear value={store.f_name} onChange={e => store.f_name = e.target.value} placeholder="请输入"/>
</SearchForm.Item> </Form.Item>
<SearchForm.Item span={3}> <Space style={{flex: 1, justifyContent: 'flex-end'}}>
<Button type="primary" icon={<SyncOutlined/>} onClick={this.handleRefresh}>刷新</Button> <AuthButton
</SearchForm.Item> auth="config.app.edit_config|config.service.edit_config"
<SearchForm.Item span={8} style={{textAlign: 'right', padding: 0}}> disabled={view !== '1'}
<Space size="large"> type="primary"
<AuthButton icon={<PlusOutlined/>}
auth="config.app.edit_config|config.service.edit_config" onClick={() => store.showForm()}>新增配置</AuthButton>
disabled={view !== '1'} <Button
type="primary" type="primary"
icon={<PlusOutlined/>} style={{backgroundColor: 'orange', borderColor: 'orange'}}
onClick={() => store.showForm()}>新增配置</AuthButton> icon={<HistoryOutlined/>}
<Button onClick={store.showRecord}>更改历史</Button>
type="primary" </Space>
style={{backgroundColor: 'orange', borderColor: 'orange'}} </Form>
icon={<HistoryOutlined/>}
onClick={store.showRecord}>更改历史</Button>
</Space>
</SearchForm.Item>
</SearchForm>
{view === '1' && <TableView/>} {view === '1' && <TableView/>}
{view === '2' && <TextView ref={ref => this.textView = ref}/>} {view === '2' && <TextView ref={ref => this.textView = ref}/>}