Commit 8576f971 authored by superman's avatar superman

1.3.6-3

parent 04f979a1
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -63,9 +63,9 @@ export default class EditItem extends Component {
const {params:{id}} = this.props;
if (id) {
this.fetchItem(id);
if (id !== 'ROLE_ADMIN') {
this.fetchResourceList();
}
if (id !== 'ROLE_ADMIN') {
this.fetchResourceList(1);
}
};
......@@ -76,9 +76,11 @@ export default class EditItem extends Component {
history.replace('/admin/authorities/' + item.id);
return;
}
if (item && item.permissions && resources) {
// if (item && item.permissions && resources) {
if (resources) {
this.analysisCheckedKeys(nextProps);
}
// }
};
fetchItem(id) {
......@@ -88,7 +90,8 @@ export default class EditItem extends Component {
});
};
fetchResourceList() {
fetchResourceList(a) {
console.log('fetchResourceList', a);
this.props.dispatch({
type: 'FETCH_RESOURCE_LIST',
query: {s: 100}
......@@ -102,7 +105,12 @@ export default class EditItem extends Component {
if (this.props.params.id) {
data.id = this.props.params.id;
}
if (!data.id) {
data.status = 1;
}
if (data.id) {
//创建的时候是不能分配权限的
const permissions = {};
this.state.checkedKeys.forEach(key=> {
const [ka, cn, mask] = key.split('-');
......@@ -111,6 +119,7 @@ export default class EditItem extends Component {
}
});
data.permissions = JSON.stringify(permissions);
}
if (isNaN(data.status)) {
ENABLE_STATUS_LIST.forEach(item=> {
if (item.text === data.status) {
......@@ -119,11 +128,11 @@ export default class EditItem extends Component {
}
})
}
if(data.name){
if(!/^ROLE_/g.test(data.name)){
if (data.name) {
if (!/^ROLE_/g.test(data.name)) {
data.name = 'ROLE_' + data.name;
}
data.name = (data.name+'').toUpperCase();
data.name = (data.name + '').toUpperCase();
}
console.log(data);
this.props.dispatch({
......@@ -133,7 +142,8 @@ export default class EditItem extends Component {
}
analysisCheckedKeys(props) {
const {item:{permissions}, resources, isEdit} = props;
const {item, resources, isEdit} = props;
const permissions = item && item.permissions || null;
//对权限资源分组
const resourcesCategoryMap = {};
const checkedKeys = [];
......@@ -176,6 +186,7 @@ export default class EditItem extends Component {
resourcesCategoryMap,
checkedKeys
});
// console.log('analysisCheckedKeys', resourcesCategoryMap, checkedKeys);
}
......@@ -205,6 +216,8 @@ export default class EditItem extends Component {
/>
);
// console.log('params=>', params, this.state);
return (
<Layout header={header}>
<Spin spinning={loading}>
......@@ -229,6 +242,8 @@ export default class EditItem extends Component {
item.description || NULL
}
</Form.Item>
{
!isCreate &&
<Form.Item label="状态" {...smallFormItemLayout}>
{
isEdit ?
......@@ -242,6 +257,7 @@ export default class EditItem extends Component {
(typeof item.status !== 'undefined' ? enableStatusToString(item.status) : NULL)
}
</Form.Item>
}
{
!isCreate &&
<Form.Item label="创建时间" {...smallFormItemLayout}>
......@@ -260,7 +276,7 @@ export default class EditItem extends Component {
</Col>
{
params.id !== 'ROLE_ADMIN' &&
(params.id && params.id !== 'ROLE_ADMIN') ?
<Col span="12">
<Tree checkable={isEdit}
defaultExpandAll={true}
......@@ -302,6 +318,7 @@ export default class EditItem extends Component {
</Tree>
</Col>
: null
}
</Row>
</Form>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment