⚡ 修复系统管理部分bug,增加多租户开关
This commit is contained in:
parent
ad25e9b427
commit
d4f3b36406
|
|
@ -24,7 +24,7 @@ module.exports = {
|
|||
2,
|
||||
{
|
||||
optionalDependencies: true,
|
||||
devDependencies: ['**/tests/**.js', '/mock/**.js', '**/**.test.js'],
|
||||
devDependencies: ['**/tests/**.js', '/mock/**/**.js', '**/**.test.js'],
|
||||
},
|
||||
],
|
||||
'jsx-a11y/no-noninteractive-element-interactions': 0,
|
||||
|
|
@ -33,8 +33,9 @@ module.exports = {
|
|||
'jsx-a11y/anchor-is-valid': 0,
|
||||
'no-nested-ternary': 0,
|
||||
'linebreak-style': 0,
|
||||
'camelcase': 1,
|
||||
},
|
||||
settings: {
|
||||
polyfills: ['fetch', 'promises', 'url'],
|
||||
polyfills: ['fetch', 'promises', 'url', 'object-assign'],
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
module.exports = {
|
||||
title: 'Sword企业级开发平台',
|
||||
tenantMode: true, // 开启租户模式
|
||||
navTheme: 'dark', // theme for nav menu
|
||||
primaryColor: '#1890FF', // primary color of ant design
|
||||
layout: 'sidemenu', // nav menu position: sidemenu or topmenu
|
||||
|
|
@ -10,6 +12,5 @@ module.exports = {
|
|||
menu: {
|
||||
disableLocal: false,
|
||||
},
|
||||
title: 'Sword企业级开发平台',
|
||||
pwa: true,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { formatMessage, FormattedMessage } from 'umi/locale';
|
|||
import { Checkbox, Alert } from 'antd';
|
||||
import Login from '../../components/Login';
|
||||
import styles from './Login.less';
|
||||
import { tenantMode } from '../../defaultSettings';
|
||||
|
||||
const { Tab, TenantCode, UserName, Password, Submit } = Login;
|
||||
|
||||
|
|
@ -80,16 +81,18 @@ class LoginPage extends Component {
|
|||
login.type === 'account' &&
|
||||
!submitting &&
|
||||
this.renderMessage(formatMessage({ id: 'app.login.message-invalid-credentials' }))}
|
||||
<TenantCode
|
||||
name="tenantCode"
|
||||
placeholder={`${formatMessage({ id: 'app.login.tenantCode' })}: 000000`}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: formatMessage({ id: 'validation.tenantCode.required' }),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{tenantMode ? (
|
||||
<TenantCode
|
||||
name="tenantCode"
|
||||
placeholder={`${formatMessage({ id: 'app.login.tenantCode' })}: 000000`}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: formatMessage({ id: 'validation.tenantCode.required' }),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
) : null}
|
||||
<UserName
|
||||
name="account"
|
||||
placeholder={`${formatMessage({ id: 'app.login.userName' })}: admin`}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ 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';
|
||||
import { tenantMode } from '../../../defaultSettings';
|
||||
|
||||
const FormItem = Form.Item;
|
||||
|
||||
|
|
@ -65,14 +66,14 @@ class Dept extends PureComponent {
|
|||
} = this.props;
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '部门名称',
|
||||
dataIndex: 'deptName',
|
||||
},
|
||||
{
|
||||
title: '租户编号',
|
||||
dataIndex: 'tenantCode',
|
||||
},
|
||||
{
|
||||
title: '部门名称',
|
||||
dataIndex: 'deptName',
|
||||
},
|
||||
{
|
||||
title: '部门全称',
|
||||
dataIndex: 'fullName',
|
||||
|
|
@ -83,6 +84,10 @@ class Dept extends PureComponent {
|
|||
},
|
||||
];
|
||||
|
||||
if (!tenantMode) {
|
||||
columns.splice(0, 1);
|
||||
}
|
||||
|
||||
return (
|
||||
<Panel>
|
||||
<Grid
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class DeptAdd extends PureComponent {
|
|||
const { dispatch, form } = this.props;
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
console.log(values);
|
||||
dispatch(DEPT_SUBMIT(values));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React, { PureComponent } from 'react';
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect } from 'antd';
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect, message } from "antd";
|
||||
import { connect } from 'dva';
|
||||
import Panel from '../../../components/Panel';
|
||||
import styles from '../../../layouts/Sword.less';
|
||||
|
|
@ -34,13 +34,17 @@ class DeptEdit extends PureComponent {
|
|||
},
|
||||
form,
|
||||
} = this.props;
|
||||
const parentId = form.getFieldValue('parentId');
|
||||
if (id === parentId.toString()) {
|
||||
message.warn('上级部门不能选择自身!');
|
||||
return;
|
||||
}
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
const params = {
|
||||
id,
|
||||
...values,
|
||||
};
|
||||
console.log(params);
|
||||
dispatch(DEPT_SUBMIT(params));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ class DictAdd extends PureComponent {
|
|||
const { dispatch, form } = this.props;
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
console.log(values);
|
||||
dispatch(DICT_SUBMIT(values));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React, { PureComponent } from 'react';
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect } from 'antd';
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect, message } from "antd";
|
||||
import { connect } from 'dva';
|
||||
import Panel from '../../../components/Panel';
|
||||
import styles from '../../../layouts/Sword.less';
|
||||
|
|
@ -39,13 +39,17 @@ class DictEdit extends PureComponent {
|
|||
},
|
||||
form,
|
||||
} = this.props;
|
||||
const parentId = form.getFieldValue('parentId');
|
||||
if (id === parentId.toString()) {
|
||||
message.warn('上级字典不能选择自身!');
|
||||
return;
|
||||
}
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
const params = {
|
||||
id,
|
||||
...values,
|
||||
};
|
||||
console.log(params);
|
||||
dispatch(DICT_SUBMIT(params));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ class MenuAdd extends PureComponent {
|
|||
const { dispatch, form } = this.props;
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
console.log(values);
|
||||
dispatch(MENU_SUBMIT(values));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
Radio,
|
||||
Icon,
|
||||
Modal,
|
||||
message,
|
||||
} from 'antd';
|
||||
import { connect } from 'dva';
|
||||
import Panel from '../../../components/Panel';
|
||||
|
|
@ -51,13 +52,17 @@ class MenuEdit extends PureComponent {
|
|||
},
|
||||
form,
|
||||
} = this.props;
|
||||
const parentId = form.getFieldValue('parentId');
|
||||
if (id === parentId.toString()) {
|
||||
message.warn('上级菜单不能选择自身!');
|
||||
return;
|
||||
}
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
const params = {
|
||||
id,
|
||||
...values,
|
||||
};
|
||||
console.log(params);
|
||||
dispatch(MENU_SUBMIT(params));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
ROLE_GRANT,
|
||||
} from '../../../actions/role';
|
||||
import { MENU_REFRESH_DATA } from '../../../actions/menu';
|
||||
import { tenantMode } from '../../../defaultSettings';
|
||||
|
||||
const FormItem = Form.Item;
|
||||
const { TreeNode } = Tree;
|
||||
|
|
@ -176,14 +177,14 @@ class Role extends PureComponent {
|
|||
} = this.props;
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '角色名称',
|
||||
dataIndex: 'roleName',
|
||||
},
|
||||
{
|
||||
title: '租户编号',
|
||||
dataIndex: 'tenantCode',
|
||||
},
|
||||
{
|
||||
title: '角色名称',
|
||||
dataIndex: 'roleName',
|
||||
},
|
||||
{
|
||||
title: '角色别名',
|
||||
dataIndex: 'roleAlias',
|
||||
|
|
@ -194,6 +195,10 @@ class Role extends PureComponent {
|
|||
},
|
||||
];
|
||||
|
||||
if (!tenantMode) {
|
||||
columns.splice(0, 1);
|
||||
}
|
||||
|
||||
return (
|
||||
<Panel>
|
||||
<Grid
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class RoleAdd extends PureComponent {
|
|||
const { dispatch, form } = this.props;
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
console.log(values);
|
||||
dispatch(ROLE_SUBMIT(values));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React, { PureComponent } from 'react';
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect } from 'antd';
|
||||
import { Form, Input, Card, Row, Col, Button, InputNumber, TreeSelect, message } from "antd";
|
||||
import { connect } from 'dva';
|
||||
import Panel from '../../../components/Panel';
|
||||
import styles from '../../../layouts/Sword.less';
|
||||
|
|
@ -34,13 +34,17 @@ class RoleEdit extends PureComponent {
|
|||
},
|
||||
form,
|
||||
} = this.props;
|
||||
const parentId = form.getFieldValue('parentId');
|
||||
if (id === parentId.toString()) {
|
||||
message.warn('上级角色不能选择自身!');
|
||||
return;
|
||||
}
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
if (!err) {
|
||||
const params = {
|
||||
id,
|
||||
...values,
|
||||
};
|
||||
console.log(params);
|
||||
dispatch(ROLE_SUBMIT(params));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import Panel from '../../../components/Panel';
|
|||
import Grid from '../../../components/Sword/Grid';
|
||||
import { USER_INIT, USER_LIST, USER_ROLE_GRANT } from '../../../actions/user';
|
||||
import { resetPassword } from '../../../services/user';
|
||||
import { tenantMode } from '../../../defaultSettings';
|
||||
|
||||
const FormItem = Form.Item;
|
||||
const { TreeNode } = Tree;
|
||||
|
|
@ -211,6 +212,10 @@ class User extends PureComponent {
|
|||
},
|
||||
];
|
||||
|
||||
if (!tenantMode) {
|
||||
columns.splice(0, 1);
|
||||
}
|
||||
|
||||
return (
|
||||
<Panel>
|
||||
<Grid
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import Panel from '../../../components/Panel';
|
|||
import styles from '../../../layouts/Sword.less';
|
||||
import { USER_INIT, USER_CHANGE_INIT, USER_SUBMIT } from '../../../actions/user';
|
||||
import func from '../../../utils/Func';
|
||||
import { tenantMode } from '../../../defaultSettings';
|
||||
|
||||
const FormItem = Form.Item;
|
||||
|
||||
|
|
@ -66,6 +67,15 @@ class UserAdd extends PureComponent {
|
|||
},
|
||||
};
|
||||
|
||||
const formAllItemLayout = {
|
||||
labelCol: {
|
||||
span: 4,
|
||||
},
|
||||
wrapperCol: {
|
||||
span: 20,
|
||||
},
|
||||
};
|
||||
|
||||
const action = (
|
||||
<Button type="primary" onClick={this.handleSubmit} loading={submitting}>
|
||||
提交
|
||||
|
|
@ -77,8 +87,8 @@ class UserAdd extends PureComponent {
|
|||
<Form hideRequiredMark style={{ marginTop: 8 }}>
|
||||
<Card title="基本信息" className={styles.card} bordered={false}>
|
||||
<Row gutter={24}>
|
||||
<Col span={10}>
|
||||
<FormItem {...formItemLayout} label="登录账号">
|
||||
<Col span={20}>
|
||||
<FormItem {...formAllItemLayout} label="登录账号">
|
||||
{getFieldDecorator('account', {
|
||||
rules: [
|
||||
{
|
||||
|
|
@ -89,35 +99,39 @@ class UserAdd extends PureComponent {
|
|||
})(<Input placeholder="请输入登录账号" />)}
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span={10}>
|
||||
<FormItem {...formItemLayout} label="所属租户">
|
||||
{getFieldDecorator('tenantCode', {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择所属租户',
|
||||
},
|
||||
],
|
||||
})(
|
||||
<Select
|
||||
showSearch
|
||||
onChange={this.handleChange}
|
||||
filterOption={(input, option) =>
|
||||
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
}
|
||||
allowClear
|
||||
placeholder="请选择所属租户"
|
||||
>
|
||||
{tenantList.map(d => (
|
||||
<Select.Option key={d.tenantCode} value={d.tenantCode}>
|
||||
{d.tenantName}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
)}
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
{tenantMode ? (
|
||||
<Row gutter={24}>
|
||||
<Col span={20}>
|
||||
<FormItem {...formAllItemLayout} label="所属租户">
|
||||
{getFieldDecorator('tenantCode', {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择所属租户',
|
||||
},
|
||||
],
|
||||
})(
|
||||
<Select
|
||||
showSearch
|
||||
onChange={this.handleChange}
|
||||
filterOption={(input, option) =>
|
||||
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
}
|
||||
allowClear
|
||||
placeholder="请选择所属租户"
|
||||
>
|
||||
{tenantList.map(d => (
|
||||
<Select.Option key={d.tenantCode} value={d.tenantCode}>
|
||||
{d.tenantName}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
)}
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
) : null}
|
||||
<Row gutter={24}>
|
||||
<Col span={10}>
|
||||
<FormItem {...formItemLayout} label="密码">
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import Panel from '../../../components/Panel';
|
|||
import func from '../../../utils/Func';
|
||||
import styles from '../../../layouts/Sword.less';
|
||||
import { USER_CHANGE_INIT, USER_DETAIL, USER_INIT, USER_SUBMIT } from '../../../actions/user';
|
||||
import { tenantMode } from '../../../defaultSettings';
|
||||
|
||||
const FormItem = Form.Item;
|
||||
|
||||
|
|
@ -65,8 +66,6 @@ class UserEdit extends PureComponent {
|
|||
submitting,
|
||||
} = this.props;
|
||||
|
||||
console.log(detail);
|
||||
|
||||
const formItemLayout = {
|
||||
labelCol: {
|
||||
span: 8,
|
||||
|
|
@ -76,6 +75,15 @@ class UserEdit extends PureComponent {
|
|||
},
|
||||
};
|
||||
|
||||
const formAllItemLayout = {
|
||||
labelCol: {
|
||||
span: 4,
|
||||
},
|
||||
wrapperCol: {
|
||||
span: 20,
|
||||
},
|
||||
};
|
||||
|
||||
const action = (
|
||||
<Button type="primary" onClick={this.handleSubmit} loading={submitting}>
|
||||
提交
|
||||
|
|
@ -87,8 +95,8 @@ class UserEdit extends PureComponent {
|
|||
<Form hideRequiredMark style={{ marginTop: 8 }}>
|
||||
<Card title="基本信息" className={styles.card} bordered={false}>
|
||||
<Row gutter={24}>
|
||||
<Col span={10}>
|
||||
<FormItem {...formItemLayout} label="登录账号">
|
||||
<Col span={20}>
|
||||
<FormItem {...formAllItemLayout} label="登录账号">
|
||||
{getFieldDecorator('account', {
|
||||
rules: [
|
||||
{
|
||||
|
|
@ -100,36 +108,40 @@ class UserEdit extends PureComponent {
|
|||
})(<Input placeholder="请输入登录账号" />)}
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span={10}>
|
||||
<FormItem {...formItemLayout} label="所属租户">
|
||||
{getFieldDecorator('tenantCode', {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择所属租户',
|
||||
},
|
||||
],
|
||||
initialValue: detail.tenantCode,
|
||||
})(
|
||||
<Select
|
||||
showSearch
|
||||
onChange={this.handleChange}
|
||||
filterOption={(input, option) =>
|
||||
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
}
|
||||
allowClear
|
||||
placeholder="请选择所属租户"
|
||||
>
|
||||
{tenantList.map(d => (
|
||||
<Select.Option key={d.tenantCode} value={d.tenantCode}>
|
||||
{d.tenantName}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
)}
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
{tenantMode ? (
|
||||
<Row gutter={24}>
|
||||
<Col span={20}>
|
||||
<FormItem {...formAllItemLayout} label="所属租户">
|
||||
{getFieldDecorator('tenantCode', {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择所属租户',
|
||||
},
|
||||
],
|
||||
initialValue: detail.tenantCode,
|
||||
})(
|
||||
<Select
|
||||
showSearch
|
||||
onChange={this.handleChange}
|
||||
filterOption={(input, option) =>
|
||||
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
}
|
||||
allowClear
|
||||
placeholder="请选择所属租户"
|
||||
>
|
||||
{tenantList.map(d => (
|
||||
<Select.Option key={d.tenantCode} value={d.tenantCode}>
|
||||
{d.tenantName}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
)}
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
) : null}
|
||||
<Row gutter={24}>
|
||||
<Col span={10}>
|
||||
<FormItem {...formItemLayout} label="用户昵称">
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { connect } from 'dva';
|
|||
import Panel from '../../../components/Panel';
|
||||
import { USER_DETAIL } from '../../../actions/user';
|
||||
import styles from '../../../layouts/Sword.less';
|
||||
import { tenantMode } from '../../../defaultSettings';
|
||||
|
||||
const FormItem = Form.Item;
|
||||
|
||||
|
|
@ -46,6 +47,15 @@ class UserView extends PureComponent {
|
|||
},
|
||||
};
|
||||
|
||||
const formAllItemLayout = {
|
||||
labelCol: {
|
||||
span: 4,
|
||||
},
|
||||
wrapperCol: {
|
||||
span: 20,
|
||||
},
|
||||
};
|
||||
|
||||
const action = (
|
||||
<Button type="primary" onClick={this.handleEdit}>
|
||||
修改
|
||||
|
|
@ -57,17 +67,21 @@ class UserView extends PureComponent {
|
|||
<Form hideRequiredMark style={{ marginTop: 8 }}>
|
||||
<Card title="基本信息" className={styles.card} bordered={false}>
|
||||
<Row gutter={24}>
|
||||
<Col span={10}>
|
||||
<FormItem {...formItemLayout} label="登录账号">
|
||||
<Col span={20}>
|
||||
<FormItem {...formAllItemLayout} label="登录账号">
|
||||
<span>{detail.account}</span>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col span={10}>
|
||||
<FormItem {...formItemLayout} label="所属租户">
|
||||
<span>{detail.tenantCode}</span>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
{tenantMode ? (
|
||||
<Row gutter={24}>
|
||||
<Col span={20}>
|
||||
<FormItem {...formAllItemLayout} label="所属租户">
|
||||
<span>{detail.tenantCode}</span>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
) : null}
|
||||
<Row gutter={24}>
|
||||
<Col span={10}>
|
||||
<FormItem {...formItemLayout} label="用户昵称">
|
||||
|
|
|
|||
|
|
@ -7,5 +7,8 @@
|
|||
"jsx-no-lambda": false,
|
||||
"no-implicit-dependencies": false,
|
||||
"no-console": false
|
||||
},
|
||||
"jsRules": {
|
||||
"object-literal-sort-keys": false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user