分权功能增加角色选取

This commit is contained in:
Chengliang 2024-08-20 15:27:34 +08:00
parent cf20e06137
commit 13da1c14bc
6 changed files with 64 additions and 8 deletions

View File

@ -72,6 +72,9 @@ export default class NewAndEditDialog extends React.Component {
if (moduleName == 'staff' && data.planId) {
bindChangeEnvent(data);
}
if (moduleName == 'managerDetach' && data.managerType) {
bindChangeEnvent(data);
}
};
onBlur = data => {

View File

@ -9,7 +9,8 @@ import {
WeaTab,
WeaFormItem,
WeaRightMenu,
WeaAlertPage
WeaAlertPage,
WeaBrowser
} from 'ecCom'
import {
Row,
@ -234,9 +235,13 @@ export default class ManagerDetach extends React.Component {
reRenderColumns(columns) {
let _this = this;
// columns.forEach((c, index) => {
// })
columns.forEach((c, index) => {
if (c.dataIndex == 'manager_type') {
c.render = function (text, record) {
return record.manager_type == "0" ? '人员' : '角色'
}
};
})
}
doDetachSwitch(checked) {
@ -430,10 +435,12 @@ export default class ManagerDetach extends React.Component {
isFormInit={form.isFormInit}
loading={dialogLoading}
isEdit={isEdit}
height={200}
height={220}
conditionLen={1}
save={() => this.handleSave()}
onCancel={() => managerDetach.setVisible(false)}
moduleName='managerDetach'
bindChangeEnvent={val => managerDetach.updateConditions(val)}
/>
</div>
)

View File

@ -75,6 +75,7 @@ export class JobStore {
@action initData() {
this.getHasRight();
this.getTableInfo();
//this.refresh();
// this.getCopyForm();
// this.getMergeForm();

View File

@ -69,7 +69,7 @@ export class JobGradeStore {
@action initData = () => {
this.selectedTreeNodeInfo = null;
this.treeConfig.treeExpandKeys.length = 0;
//this.treeConfig.treeExpandKeys.length = 0;
Api.getTree().then(res => {
if (res.code === 200) {
if (res.data.length > 0) {

View File

@ -68,7 +68,7 @@ export class JobLevelStore {
@action initData = () => {
this.selectedTreeNodeInfo = null;
this.treeConfig.treeExpandKeys.length = 0;
//this.treeConfig.treeExpandKeys.length = 0;
Api.getTree().then(res => {
if (res.code === 200) {
if (res.data.length > 0) {

View File

@ -28,6 +28,7 @@ export class ManagerDetachStore {
@observable topMenu = []
@observable rightMenu = [];
@observable condition = [];
fcondition = [];
@observable searchCondition = [];
@observable isEdit = true;
@observable isNew = true;
@ -93,10 +94,16 @@ export class ManagerDetachStore {
})
}
@action("新建删除") save() {
@action("新建保存") save() {
let params = {
...this.form.getFormParams()
};
if (params.managerType == "0" && params.ecManager == "") {
return message.error("管理员字段必填");
}
if (params.managerType == "1" && params.roleId == "") {
return message.error("角色字段必填");
}
this.form.validateForm().then(f => {
if (f.isValid) {
Api.add(params).then(response => {
@ -152,6 +159,7 @@ export class ManagerDetachStore {
Api.getForm(params).then(res => {
if (res.code === 200) {
this.setDialogLoadingStatus(false);
res.data.condition && this.setFcondition(res.data.condition);
res.data.condition && this.setCondition(res.data.condition);
res.data.condition && this.form.initFormFields(res.data.condition);
} else {
@ -213,6 +221,39 @@ export class ManagerDetachStore {
});
}
updateConditions(data) {
this.form.updateFields({
ecManager: {
value: ''
},
roleId: {
value: ''
}
});
const type = data.managerType.value;
debugger
this.condition = this.fcondition;
switch(type) {
case '0':
this.condition[0].items = this.condition[0].items.filter(item => {
if(item.domkey[0] == 'ecManager'){
item.viewAttr = 3;
}
return item.domkey[0] != 'roleId';
});
break;
case '1':
this.condition[0].items = this.condition[0].items.filter(item => {
if(item.domkey[0] == 'roleId'){
item.viewAttr = 3;
}
return item.domkey[0] != 'ecManager';
})
}
this.setCondition(this.condition);
this.form.initFormFields(this.condition);
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
@ -299,4 +340,8 @@ export class ManagerDetachStore {
this.hasRight = bool;
}
setFcondition(condition) {
this.fcondition = condition;
}
}