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

bug修改

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