2019-02-13 17:16:39 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import { connect } from 'dva';
|
|
|
|
import { Button, Col, Form, Input, Row } from 'antd';
|
|
|
|
import Panel from '../../../components/Panel';
|
|
|
|
import Grid from '../../../components/Sword/Grid';
|
|
|
|
import { DEPT_LIST } from '../../../actions/dept';
|
2019-04-01 23:01:21 +08:00
|
|
|
import { tenantMode } from '../../../defaultSettings';
|
2019-02-13 17:16:39 +08:00
|
|
|
|
|
|
|
const FormItem = Form.Item;
|
|
|
|
|
|
|
|
@connect(({ dept, loading }) => ({
|
|
|
|
dept,
|
|
|
|
loading: loading.models.dept,
|
|
|
|
}))
|
|
|
|
@Form.create()
|
|
|
|
class Dept extends PureComponent {
|
|
|
|
// ============ 查询 ===============
|
|
|
|
handleSearch = params => {
|
|
|
|
const { dispatch } = this.props;
|
|
|
|
dispatch(DEPT_LIST(params));
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============ 查询表单 ===============
|
|
|
|
renderSearchForm = onReset => {
|
|
|
|
const { form } = this.props;
|
|
|
|
const { getFieldDecorator } = form;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Row gutter={{ md: 8, lg: 24, xl: 48 }}>
|
2019-03-18 14:32:06 +08:00
|
|
|
<Col md={6} sm={24}>
|
2019-02-13 17:16:39 +08:00
|
|
|
<FormItem label="部门名称">
|
|
|
|
{getFieldDecorator('deptName')(<Input placeholder="请输入部门名称" />)}
|
|
|
|
</FormItem>
|
|
|
|
</Col>
|
2019-03-18 14:32:06 +08:00
|
|
|
<Col md={6} sm={24}>
|
|
|
|
<FormItem label="租户编号">
|
|
|
|
{getFieldDecorator('tenantCode')(<Input placeholder="请输入角色名称" />)}
|
|
|
|
</FormItem>
|
|
|
|
</Col>
|
|
|
|
<Col md={6} sm={24}>
|
2019-02-13 17:16:39 +08:00
|
|
|
<FormItem label="部门全称">
|
|
|
|
{getFieldDecorator('fullName')(<Input placeholder="请输入部门全称" />)}
|
|
|
|
</FormItem>
|
|
|
|
</Col>
|
|
|
|
<Col>
|
|
|
|
<div style={{ float: 'right' }}>
|
|
|
|
<Button type="primary" htmlType="submit">
|
|
|
|
查询
|
|
|
|
</Button>
|
|
|
|
<Button style={{ marginLeft: 8 }} onClick={onReset}>
|
|
|
|
重置
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const code = 'dept';
|
|
|
|
|
|
|
|
const {
|
|
|
|
form,
|
|
|
|
loading,
|
|
|
|
dept: { data },
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const columns = [
|
2019-03-18 14:32:06 +08:00
|
|
|
{
|
|
|
|
title: '租户编号',
|
|
|
|
dataIndex: 'tenantCode',
|
|
|
|
},
|
2019-04-01 23:01:21 +08:00
|
|
|
{
|
|
|
|
title: '部门名称',
|
|
|
|
dataIndex: 'deptName',
|
|
|
|
},
|
2019-02-13 17:16:39 +08:00
|
|
|
{
|
|
|
|
title: '部门全称',
|
|
|
|
dataIndex: 'fullName',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '排序',
|
|
|
|
dataIndex: 'sort',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2019-04-01 23:01:21 +08:00
|
|
|
if (!tenantMode) {
|
|
|
|
columns.splice(0, 1);
|
|
|
|
}
|
|
|
|
|
2019-02-13 17:16:39 +08:00
|
|
|
return (
|
|
|
|
<Panel>
|
|
|
|
<Grid
|
|
|
|
code={code}
|
|
|
|
form={form}
|
|
|
|
onSearch={this.handleSearch}
|
|
|
|
renderSearchForm={this.renderSearchForm}
|
|
|
|
loading={loading}
|
|
|
|
data={data}
|
|
|
|
columns={columns}
|
|
|
|
/>
|
|
|
|
</Panel>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export default Dept;
|