分权开关设置

This commit is contained in:
Chengliang 2022-10-28 17:45:47 +08:00
parent 710293d536
commit 8931a06127
3 changed files with 32 additions and 7 deletions

View File

@ -15,10 +15,14 @@ export const getAdvanceSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/detach/getSearchCondition', 'GET', params);
}
export const getSchemeForm = (params) => {
export const getForm = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/detach/getForm', 'GET', params);
}
export const doDetachSwitch = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/detach/doDetach', 'GET', params);
}
export const deleteTableData = (params) => {
return fetch('/api/bs/hrmorganization/detach/deleteByIds', {
method: 'POST',

View File

@ -237,17 +237,17 @@ export default class ManagerDetach extends React.Component {
// })
}
updateForbiddenTag(checked, id) {
doDetachSwitch(checked) {
const {
managerDetach
} = this.props;
confirm({
title: i18n.confirm.defaultTitle(),
content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(),
content: (checked == true) ? "确定启用组织管理分权吗" : "确定取消组织管理分权",
okText: i18n.button.ok(),
cancelText: i18n.button.cancel(),
onOk() {
managerDetach.updateForbiddenTag(checked, id);
managerDetach.setDetach(checked);
},
onCancel() {
return false;
@ -293,6 +293,8 @@ export default class ManagerDetach extends React.Component {
});
}
handleSave() {
const {
@ -369,7 +371,7 @@ export default class ManagerDetach extends React.Component {
} = this.props;
const {
isPanelShow, form2, managerName, conditionNum, tableStore, nEdialogTitle, visible, condition,
form, dialogLoading, isEdit, date, hasRight
form, dialogLoading, isEdit, date, hasRight,isDetach
} = managerDetach;
if (hasRight === false) {
@ -381,7 +383,11 @@ export default class ManagerDetach extends React.Component {
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`}
datas={this.getDropMenuDatas()}
onClick={key => this.handleMenuClick(key)}
>
>
<div style={{"width":"100%","height":"50px","lineHeight":"50px"}}>
<span style={{"marginLeft":"20px","fontWeight":"bold"}}>启用组织管理分权:</span>
<Switch style={{"marginLeft":"20px"}} checked={isDetach == "true" ? true : false} onChange={checked => this.doDetachSwitch(checked)} />
</div>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@bj98s7`}
title={i18n.label.mangerDetachName()}
icon={<i className='icon-coms-hrm' />}

View File

@ -44,6 +44,7 @@ export class ManagerDetachStore {
@observable detachId = '';
@observable date = '';
@observable hasRight = '';
@observable isDetach = '';
@action("列表数据加载") getTableInfo(isOnChange = false) {
let params;
@ -60,6 +61,7 @@ export class ManagerDetachStore {
Api.getSearchList(params).then(res => {
if (res.code === 200) {
this.setHasRight(res.data.hasRight);
this.isDetach = res.data.isDetach;
isOnChange ? this.tableStore.getDatas(res.data.datas, current) : this.tableStore.getDatas(res.data.datas,1);
} else {
message.warning(res.msg);
@ -145,7 +147,7 @@ export class ManagerDetachStore {
id: this.detachId
}
this.setDialogLoadingStatus(true);
Api.getSchemeForm(params).then(res => {
Api.getForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setCondition(res.data.condition);
@ -188,6 +190,19 @@ export class ManagerDetachStore {
})
}
@action("分权设置") setDetach(checked) {
Api.doDetachSwitch({idDetach:checked}).then(res => {
if (res.code === 200) {
this.isDetach = res.data;
message.success(res.msg);
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
updateFields(val) {
this.form2.updateFields({
ecManager: {