feature/2.15.1.2407.01-权限

This commit is contained in:
黎永顺 2024-10-11 11:11:06 +08:00
parent 6aa662d432
commit c72d34fb9a
3 changed files with 19 additions and 41 deletions

View File

@ -296,7 +296,7 @@ export const personScopeConditions = [
items: [
{
conditionType: "SELECT_LINKAGE",
domkey: ["targetParams"],
domkey: ["targetType"],
fieldcol: 18,
label: "对象类型",
lanId: 111,

View File

@ -228,14 +228,10 @@ class PersonalScope extends Component {
{...personalAddModal}
taxAgentId={taxAgentId}
onSuccess={() => this.personalScopeTableRef.getPersonalScopeList()}
onCancel={() =>
onCancel={(callback) =>
this.setState({
personalAddModal: {
...personalAddModal,
visible: false,
includeType: ""
}
})
personalAddModal: { ...personalAddModal, visible: false, includeType: "" }
}, () => callback && callback())
}
/>
{importParams.visible && (

View File

@ -8,7 +8,7 @@ import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaSwitch } from "comsMobx";
import { WeaBrowser, WeaCheckbox, WeaDialog, WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
import { Button, message, Modal } from "antd";
import { Button, message } from "antd";
import { getTaxAgentRangeForm, taxAgentRangeSave } from "../../../apis/taxAgent";
import { personScopeConditions, scopeSelectLinkageDatas } from "./constants";
@ -55,8 +55,10 @@ class PersonalScopeModal extends Component {
}
return {
...o, label: getLabel(o.lanId, o.label),
options: _.map(targetTypeList, it => ({ key: it.id, showname: it.name })),
selectLinkageDatas: scopeSelectLinkageDatas[_.head(targetTypeList).id]
options: _.map(targetTypeList, it => ({
key: it.id, showname: it.name, selected: it.id === "EMPLOYEE"
})),
selectLinkageDatas: { ...scopeSelectLinkageDatas }
};
})
}))
@ -68,39 +70,25 @@ class PersonalScopeModal extends Component {
const { taxAgentStore: { personScopeForm } } = this.props;
personScopeForm.validateForm().then(f => {
if (f.isValid) {
console.log(70, personScopeForm.getFormParams());
const { status, targetTypeIds, targetType } = this.state;
const { includeType, taxAgentId, onSuccess, onCancel } = this.props;
if (_.isEmpty(status) || _.isEmpty(targetTypeIds)) {
Modal.warning({
title: "信息确认",
content: "必要信息不完整,红色*为必填项!"
});
return;
}
const { employeeStatus, targetType, target } = personScopeForm.getFormParams();
const { includeType, taxAgentId } = this.props;
const payload = {
employeeStatus: status.split(","),
includeType,
targetParams: _.map(targetTypeIds.split(","), it => ({ targetType, targetId: it })),
taxAgentId
includeType, taxAgentId,
employeeStatus: employeeStatus.split(","),
targetParams: _.map(target.split(","), it => ({ targetType, targetId: it }))
};
this.setState({ loading: true });
taxAgentRangeSave(payload).then(({ status, errormsg }) => {
this.setState({ loading: false });
if (status) {
message.success("保存成功");
this.handleReset();
onSuccess();
onCancel();
message.success(getLabel(111, "操作成功!"));
this.props.onCancel(this.props.onSuccess);
} else {
message.error(errormsg || "保存失败");
message.error(errormsg);
}
}).catch(() => this.setState({ loading: true }));
} else {
f.showErrors();
this.forceUpdate();
}
});
};
@ -154,8 +142,7 @@ class PersonalScopeModal extends Component {
<WeaCheckbox value={checked ? "1" : "0"} content={getLabel(111, "全选")}
onChange={this.handleChangeAll}/>
}
<WeaSwitch fieldConfig={fields} form={personScopeForm} formParams={formParams}
onChange={this.handleChange}/>
<WeaSwitch fieldConfig={fields} form={personScopeForm} formParams={formParams}/>
</WeaFormItem>),
hide: fields.hide
});
@ -169,18 +156,13 @@ class PersonalScopeModal extends Component {
val === "1" ? personScopeForm.updateFields({ employeeStatus: { value: _.map(employeeStatus, o => o.id).join(",") } }) :
personScopeForm.updateFields({ employeeStatus: { value: "" } });
};
handleChange = (params) => {
const { taxAgentStore: { personScopeForm } } = this.props, { employeeStatus } = this.state;
const key = _.keys(params)[0], value = params[key].value;
console.log(params, key, value);
};
render() {
const { onCancel, title, visible, taxAgentStore: { personScopeForm } } = this.props;
const { employeeStatus, targetTypeList, targetType, status, statusAll, loading, conditions } = this.state;
const buttons = [
<Button type="primary" onClick={this.taxAgentRangeSave} loading={loading}>确定</Button>,
<Button type="ghost" onClick={() => personScopeForm.renderForm()}>重置</Button>
<Button type="ghost" onClick={() => personScopeForm.resetForm()}>重置</Button>
];
return (
<WeaDialog {...this.props} initLoadCss title={title} style={{ width: 600 }} buttons={buttons}>