提交 a2b9f579 authored 作者: 钟是志's avatar 钟是志

bug修改

上级 2166b56d
...@@ -24,11 +24,10 @@ const Index = (WrappedComponent) => ...@@ -24,11 +24,10 @@ const Index = (WrappedComponent) =>
selectKey: '', selectKey: '',
}, },
formValues: { formValues: {
selectType: 'getAllRole', applyType: 'getAllRole',
sysCode: 'xg', sysCode: 'xg',
}, },
typeList: [], typeList: [],
authorizedApp: [],
}; };
} }
...@@ -38,36 +37,11 @@ const Index = (WrappedComponent) => ...@@ -38,36 +37,11 @@ const Index = (WrappedComponent) =>
}); });
}; };
getAuthorizedApp = () => {
const { selectKey } = this.state.search;
if (selectKey) {
getInfo(
{
roleId: selectKey,
cacheKey: Math.random(),
},
'/CommonApi/queryRoleApply',
).then((x) => {
if (x) {
this.setState({
authorizedApp: x,
});
}
});
// this.instanceComponent.getPage();
}
};
changeSearch = (search) => { changeSearch = (search) => {
this.setState( this.setState({
{ search,
search, });
}, };
() => {
// this.getAuthorizedApp();
},
);
};
componentDidMount() { componentDidMount() {
const { formValues } = this.state; const { formValues } = this.state;
...@@ -98,19 +72,18 @@ const Index = (WrappedComponent) => ...@@ -98,19 +72,18 @@ const Index = (WrappedComponent) =>
} }
render() { render() {
const { search, typeList, authorizedApp, formValues } = this.state; const { search, typeList, formValues } = this.state;
if (!typeList.length || !formValues.groupId) { if (!typeList.length || !formValues.groupId) {
return null; return null;
} }
const pageS = pageSearch({ const pageS = pageSearch({
typeList, typeList,
authorizedApp, selectKey: search.selectKey,
changeFormValues: this.changeFormValues, changeFormValues: this.changeFormValues,
}); });
const pageB = pageButton({ const pageB = pageButton({
roleId: search.selectKey, selectKey: search.selectKey,
authorizedApp, formValues,
// getAuthorizedApp: this.getAuthorizedApp,
}); });
return ( return (
<PageHeaderWrapper title=""> <PageHeaderWrapper title="">
...@@ -121,17 +94,20 @@ const Index = (WrappedComponent) => ...@@ -121,17 +94,20 @@ const Index = (WrappedComponent) =>
selectKey={search.selectKey} selectKey={search.selectKey}
year={search.year} year={search.year}
groupId={formValues.groupId} groupId={formValues.groupId}
/> />
</Col> </Col>
<Col xl={19} xxl={20}> {
<WrappedComponent search.selectKey ? <Col xl={19} xxl={20}>
listConfig={pageSetting.listConfig} <WrappedComponent
pageButton={pageB} listConfig={pageSetting.listConfig}
ref={(instanceComponent) => (this.instanceComponent = instanceComponent)} pageButton={pageB}
pageSearch={pageS} ref={(instanceComponent) => (this.instanceComponent = instanceComponent)}
/> pageSearch={pageS}
</Col> />
</Row> </Col> : null
}
</Row>
</PageHeaderWrapper> </PageHeaderWrapper>
); );
} }
......
...@@ -2,35 +2,36 @@ import React from 'react'; ...@@ -2,35 +2,36 @@ import React from 'react';
import { message } from 'antd'; import { message } from 'antd';
import { getInfo } from '@/highOrderComponent/Service'; import { getInfo } from '@/highOrderComponent/Service';
const submitData = (selectRows, roleId) => { const submitData = (selectRows, formValues, appId) => {
if (!selectRows.length) { if (!selectRows.length) {
message.warning('请先选择一个应用'); message.warning('请先选择一个应用');
return false; return false;
} else { } else {
let content = selectRows.map((x) => { let content = selectRows.map((x) => {
return { return {
appId: x.id, appId,
roleId, bizId: x.id,
applyType: formValues.applyType,
sysCode: formValues.sysCode,
}; };
}); });
content = JSON.stringify(content); content = JSON.stringify(content);
const data = { const data = {
roleId, // roleId,
op: 'add', op: 'add',
content, content,
}; };
return getInfo(data, '/CommonApi/configRoleApply'); return getInfo(data, '/CommonApi/configApply');
} }
}; };
const deleteData = (ids, roleId) => { const deleteData = (ids) => {
const data = { const data = {
ids, ids,
roleId,
op: 'delete', op: 'delete',
}; };
return getInfo(data, '/CommonApi/configRoleApply'); return getInfo(data, '/CommonApi/configApply');
}; };
const handleButton = (props) => { const handleButton = (props) => {
...@@ -40,8 +41,10 @@ const handleButton = (props) => { ...@@ -40,8 +41,10 @@ const handleButton = (props) => {
type: 'Normal', type: 'Normal',
component: 'Normal', component: 'Normal',
handleClick: (selectRows, formValues, getPage, search) => { handleClick: (selectRows, formValues, getPage, search) => {
submitData(selectRows, props.roleId).then((x) => { submitData(selectRows, formValues, props.selectKey).then((x) => {
// props.getAuthorizedApp(); if (x) {
getPage();
}
}); });
}, },
}, },
...@@ -54,17 +57,18 @@ const handleButton = (props) => { ...@@ -54,17 +57,18 @@ const handleButton = (props) => {
message.warning('请先选择一个应用'); message.warning('请先选择一个应用');
return false; return false;
} }
const deleteIds = []; const deleteIds = [];
for (let item of selectRows) { for (let item of selectRows) {
for(let x of props.authorizedApp){ for (let x of props.authorizedApp) {
if(x.appId === item.id){ if (x.appId === item.id) {
deleteIds.push(x.id); deleteIds.push(x.id);
} }
} }
} }
deleteData(deleteIds, props.roleId).then((x) => { deleteData(deleteIds).then((x) => {
// props.getAuthorizedApp(); if (x) {
getPage();
}
}); });
}, },
}, },
......
...@@ -3,9 +3,26 @@ import { Link } from 'react-router-dom'; ...@@ -3,9 +3,26 @@ import { Link } from 'react-router-dom';
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import { getAppList } from '@/webPublic/Services'; import { getAppList } from '@/webPublic/Services';
import { redText } from '@/pages/zydxg/CheckManage/PiciSetting/publicFunc'; import { redText } from '@/pages/zydxg/CheckManage/PiciSetting/publicFunc';
import { getInfo } from '@/highOrderComponent/Service';
import res from '@/pages/zydjy/system/StuBaseInfoManage/StuBaseManage/exportConfig';
const width = 110; const width = 110;
const deleteChildren = (response) => {
if (response && response.length) {
for (let item of response) {
if (item.children && !item.children.length) {
delete item.children;
} else if (item.children) {
deleteChildren(item.children);
}
}
return response;
} else {
return [];
}
};
const handlePageSearch = (props) => { const handlePageSearch = (props) => {
const pageSearch = { const pageSearch = {
search: { search: {
...@@ -19,19 +36,25 @@ const handlePageSearch = (props) => { ...@@ -19,19 +36,25 @@ const handlePageSearch = (props) => {
required: true, required: true,
defaultValue: 'xg', defaultValue: 'xg',
}, },
selectType: { applyType: {
required: true, required: true,
defaultValue: 'getAllRole', defaultValue: 'role',
}, },
}, },
getInfo: (data, url) => { getInfo: (data, url) => {
return getAppList(data, props.formValues); return getInfo({
appId: props.selectKey,
applyType: data.applyType,
sysCode: data.sysCode,
}, '/CommonApi/queryApplyTarget');
}, },
giveFieldsToFormValues: true, giveFieldsToFormValues: true,
afterFormValuesChange: (key, oldValue, getPage) => { afterFormValuesChange: (key, oldValue, getPage) => {
getPage();
props.changeFormValues(oldValue); props.changeFormValues(oldValue);
}, },
responseCallBack: (response) => { responseCallBack: (response) => {
console.log(deleteChildren(response));
return response; return response;
}, },
condition: [ condition: [
...@@ -55,17 +78,17 @@ const handlePageSearch = (props) => { ...@@ -55,17 +78,17 @@ const handlePageSearch = (props) => {
}, },
{ // /PermApi/getAllRole { // /PermApi/getAllRole
key: 'selectType', key: 'applyType',
type: 'radioGroup', type: 'radioGroup',
required: true, required: true,
name: '权限分类', name: '权限分类',
options: [ options: [
{ {
key: 'getAllRole', key: 'role',
name: '角色', name: '角色',
}, },
{ {
key: 'getUserGroupList', key: 'group',
name: '分组', name: '分组',
}, },
], ],
...@@ -90,23 +113,15 @@ const handlePageSearch = (props) => { ...@@ -90,23 +113,15 @@ const handlePageSearch = (props) => {
width, width,
}, },
{ {
dataIndex: 'name', dataIndex: 'title',
title: '应用名', title: '角色/分组',
width: width + 150, width: width + 150,
}, },
{ {
dataIndex: 'isAuthorized', dataIndex: 'hasAuth',
title: '是否已授权', title: '是否已授权',
render: (text, record) => { render: (text, record) => {
// return '未授权'; return text ? redText('已授权') : '未授权';
const includesIds = props.authorizedApp.map((x) => {
return x.appId;
});
if (record && record.id && includesIds.includes(record.id)) {
return redText('已授权');
} else {
return '未授权';
}
}, },
}, },
], ],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论