提交 8719924e authored 作者: vipcxj's avatar vipcxj

fix: 操作按钮间分隔栏不显示

fix: 上次大合并的衍生问题
上级 c8388d6e
...@@ -4,49 +4,13 @@ ...@@ -4,49 +4,13 @@
*/ */
import React from 'react'; import React from 'react';
import QRcode from 'qrcode'; import QRcode from 'qrcode';
import { Button, Table, Popconfirm, Modal } from 'antd'; import { Button, Table, Popconfirm, Modal, Divider } from 'antd';
import config from '../../../../utils/config'; import config from '../../../../utils/config';
import { encrypt } from '../../../../utils/helper'; import { encrypt } from '../../../../utils/helper';
import styles from './list.less'; import styles from './list.less';
import { thisPush } from '../../../../services/route'; import { thisPush } from '../../../../services/route';
class Deploy extends React.Component { class Deploy extends React.Component {
static makeColumns() {
return [{
title: 'ID',
dataIndex: 'id',
}, {
title: '更新时间',
dataIndex: 'updateTime',
}, {
title: '状态',
dataIndex: 'status',
}, {
title: '版本号',
dataIndex: 'versionNumber',
}, {
title: '描述',
dataIndex: 'description',
}, {
title: 'uri',
dataIndex: 'uri',
}, {
title: '操作',
dataIndex: 'operation',
render: (text, record, index) => (
<span>
<span className="ant-divider" />
<a onClick={() => this.onEdit(record, index)}>Edit</a>
<span className="ant-divider" />
<Popconfirm title="确定删除?" okText="Yes" cancelText="No" onConfirm={() => this.onDelete(record, index)}>
<a>Delete</a>
</Popconfirm>
<span className="ant-divider" />
<a onClick={() => this.onQrcode(record, index)}>qrcode</a>
</span>
),
}];
}
state = { state = {
urls: '', urls: '',
visible: false, visible: false,
...@@ -97,6 +61,42 @@ class Deploy extends React.Component { ...@@ -97,6 +61,42 @@ class Deploy extends React.Component {
visible: false, visible: false,
}); });
}; };
makeColumns = () => {
return [{
title: 'ID',
dataIndex: 'id',
}, {
title: '更新时间',
dataIndex: 'updateTime',
}, {
title: '状态',
dataIndex: 'status',
}, {
title: '版本号',
dataIndex: 'versionNumber',
}, {
title: '描述',
dataIndex: 'description',
}, {
title: 'uri',
dataIndex: 'uri',
}, {
title: '操作',
dataIndex: 'operation',
render: (text, record, index) => (
<span>
<Divider type="vertical" />
<a onClick={() => this.onEdit(record, index)}>Edit</a>
<Divider type="vertical" />
<Popconfirm title="确定删除?" okText="Yes" cancelText="No" onConfirm={() => this.onDelete(record, index)}>
<a>Delete</a>
</Popconfirm>
<Divider type="vertical" />
<a onClick={() => this.onQrcode(record, index)}>qrcode</a>
</span>
),
}];
};
render() { render() {
const { allAppInfo } = this.props.appInfo; const { allAppInfo } = this.props.appInfo;
const { urls, visible, completeUrl } = this.state; const { urls, visible, completeUrl } = this.state;
...@@ -125,7 +125,7 @@ class Deploy extends React.Component { ...@@ -125,7 +125,7 @@ class Deploy extends React.Component {
<Button type="primary" icon="plus" onClick={this.onClick}>新增</Button> <Button type="primary" icon="plus" onClick={this.onClick}>新增</Button>
</div> </div>
<div className={styles.divTable}> <div className={styles.divTable}>
<Table columns={Deploy.makeColumns()} dataSource={data} /> <Table columns={this.makeColumns()} dataSource={data} />
</div> </div>
<div> <div>
<Modal <Modal
......
...@@ -16,7 +16,7 @@ class Edit extends React.Component { ...@@ -16,7 +16,7 @@ class Edit extends React.Component {
this.props.dispatch({ type: 'appInfo/editAppInfo', payload: { values } }); this.props.dispatch({ type: 'appInfo/editAppInfo', payload: { values } });
} }
}); });
} };
render() { render() {
const { value } = this.props.location.state; const { value } = this.props.location.state;
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
......
import React from 'react'; import React from 'react';
import { Button, Table, Popconfirm } from 'antd'; import { Button, Table, Popconfirm, Divider } from 'antd';
import styles from './list.less'; import styles from './list.less';
import { thisPush } from '../../../../services/route'; import { thisPush } from '../../../../services/route';
class List extends React.Component { class List extends React.Component {
static makeColumns() { componentDidMount() {
this.props.dispatch({ type: 'appInfo/getAppInfo', payload: { name: '' } });
}
onDelete = (record) => {
const name = record.name;
this.props.dispatch({ type: 'appInfo/delAppInfo', payload: { name } });
};
onEdit = (record) => {
thisPush(this, { pathname: '../edit', state: { value: record } });
};
onDeploy = (record) => {
thisPush(this, { pathname: '../deploy', state: { value: record } });
this.props.dispatch({ type: 'appInfo/saveRecord', payload: { record } });
};
onClick = () => {
thisPush(this, { pathname: '../add', state: { value: '' } });
};
makeColumns = () => {
return [{ return [{
title: '创建时间', title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime',
...@@ -22,34 +39,17 @@ class List extends React.Component { ...@@ -22,34 +39,17 @@ class List extends React.Component {
dataIndex: 'operation', dataIndex: 'operation',
render: (text, record, index) => ( render: (text, record, index) => (
<span> <span>
<span className="ant-divider" /> <Divider type="vertical" />
<a onClick={() => this.onEdit(record, index)}>Edit</a> <a onClick={() => this.onEdit(record, index)}>Edit</a>
<span className="ant-divider" /> <Divider type="vertical" />
<Popconfirm title="确定删除?" okText="Yes" cancelText="No" onConfirm={() => this.onDelete(record, index)}> <Popconfirm title="确定删除?" okText="Yes" cancelText="No" onConfirm={() => this.onDelete(record, index)}>
<a>Delete</a> <a>Delete</a>
</Popconfirm> </Popconfirm>
<span className="ant-divider" /> <Divider type="vertical" />
<a onClick={() => this.onDeploy(record, index)}>deploy</a> <a onClick={() => this.onDeploy(record, index)}>deploy</a>
</span> </span>
), ),
}]; }];
}
componentDidMount() {
this.props.dispatch({ type: 'appInfo/getAppInfo', payload: { name: '' } });
}
onDelete = (record) => {
const name = record.name;
this.props.dispatch({ type: 'appInfo/delAppInfo', payload: { name } });
};
onEdit = (record) => {
thisPush(this, { pathname: '../edit', state: { value: record } });
};
onDeploy = (record) => {
thisPush(this, { pathname: '../deploy', state: { value: record } });
this.props.dispatch({ type: 'appInfo/saveRecord', payload: { record } });
};
onClick = () => {
thisPush(this, { pathname: '../add', state: { value: '' } });
}; };
render() { render() {
const { allAppInfo } = this.props.appInfo; const { allAppInfo } = this.props.appInfo;
...@@ -70,7 +70,7 @@ class List extends React.Component { ...@@ -70,7 +70,7 @@ class List extends React.Component {
<Button type="primary" icon="plus" onClick={this.onClick}>添加</Button> <Button type="primary" icon="plus" onClick={this.onClick}>添加</Button>
</div> </div>
<div className={styles.divTable}> <div className={styles.divTable}>
<Table columns={List.makeColumns()} dataSource={data} /> <Table columns={this.makeColumns()} dataSource={data} />
</div> </div>
</div> </div>
</div> </div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论