修改权限的接口
This commit is contained in:
parent
bbb4189700
commit
ae70da48be
|
|
@ -7,7 +7,7 @@ import {
|
|||
WeaRightMenu,
|
||||
WeaSearchGroup,
|
||||
WeaFormItem,
|
||||
WeaTable,
|
||||
WeaTable
|
||||
} from "ecCom";
|
||||
import { renderNoright } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中
|
||||
import EditModal from "./editModal";
|
||||
|
|
@ -27,14 +27,14 @@ export default class TaxAgent extends React.Component {
|
|||
current: 0,
|
||||
btnType: "save", //save: 添加, edit: 编辑, prev: '上一步'
|
||||
editId: "",
|
||||
editType: "save",
|
||||
editType: "save"
|
||||
},
|
||||
editModalLoading: {
|
||||
saveloading: false,
|
||||
saveloading: false
|
||||
},
|
||||
devolutionStatus: 0,
|
||||
conditions: editConditions,
|
||||
permission: {},
|
||||
permission: {}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ export default class TaxAgent extends React.Component {
|
|||
});
|
||||
};
|
||||
|
||||
taxAgentBaseSave = (devolutionStatus) => {
|
||||
taxAgentBaseSave = devolutionStatus => {
|
||||
Modal.confirm({
|
||||
title: "信息确认",
|
||||
content: `确认${!devolutionStatus ? "停用" : "启用"}分权?`,
|
||||
|
|
@ -81,13 +81,11 @@ export default class TaxAgent extends React.Component {
|
|||
this.getTaxAgentBaseForm();
|
||||
doInit({ current: pageObj.current, pageSize: pageObj.pageSize });
|
||||
} else {
|
||||
message.error(
|
||||
errormsg || `${!devolutionStatus ? "停用" : "启用"}分权失败`
|
||||
);
|
||||
message.error(errormsg || `${!devolutionStatus ? "停用" : "启用"}分权失败`);
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel() {},
|
||||
onCancel() {}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -98,26 +96,26 @@ export default class TaxAgent extends React.Component {
|
|||
getTaxAgentForm({ id }).then(({ status, data }) => {
|
||||
if (status && !_.isEmpty(data)) {
|
||||
const [conditionItem] = conditions;
|
||||
const conditionMap = _.map(conditionItem.items, (it) => {
|
||||
const conditionMap = _.map(conditionItem.items, it => {
|
||||
const key = it.domkey.join("");
|
||||
if (it.conditionType === "BROWSER") {
|
||||
return {
|
||||
...it,
|
||||
browserConditionParam: {
|
||||
...it.browserConditionParam,
|
||||
replaceDatas: _.map(data[key], (b) => ({
|
||||
replaceDatas: _.map(data[key], b => ({
|
||||
id: b.id,
|
||||
name: b.content,
|
||||
})),
|
||||
name: b.content
|
||||
}))
|
||||
},
|
||||
viewAttr: current == 1 ? 1 : it.viewAttr,
|
||||
viewAttr: current == 1 ? 1 : it.viewAttr
|
||||
};
|
||||
} else {
|
||||
if (data[key]) {
|
||||
return {
|
||||
...it,
|
||||
value: data[key],
|
||||
viewAttr: current == 1 ? 1 : it.viewAttr,
|
||||
viewAttr: current == 1 ? 1 : it.viewAttr
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -125,7 +123,7 @@ export default class TaxAgent extends React.Component {
|
|||
});
|
||||
this.setState(
|
||||
{
|
||||
conditions: [{ defaultshow: true, items: conditionMap }],
|
||||
conditions: [{ defaultshow: true, items: conditionMap }]
|
||||
},
|
||||
() => {
|
||||
getCondition(this.state.conditions);
|
||||
|
|
@ -145,8 +143,8 @@ export default class TaxAgent extends React.Component {
|
|||
btnType: editId ? "edit" : "save",
|
||||
editId: editId,
|
||||
editType: current ? "set" : editId && !current ? "edit" : "save",
|
||||
current: current ? current : 0,
|
||||
},
|
||||
current: current ? current : 0
|
||||
}
|
||||
},
|
||||
() => {
|
||||
editId && this.getTaxAgentForm(editId, current);
|
||||
|
|
@ -166,9 +164,9 @@ export default class TaxAgent extends React.Component {
|
|||
btnType: "save",
|
||||
editId: "",
|
||||
editType: "save",
|
||||
visible: false,
|
||||
visible: false
|
||||
},
|
||||
conditions: editConditions,
|
||||
conditions: editConditions
|
||||
},
|
||||
() => {
|
||||
form.resetForm();
|
||||
|
|
@ -180,7 +178,7 @@ export default class TaxAgent extends React.Component {
|
|||
* name:表单提交
|
||||
* return {*}
|
||||
*/
|
||||
handleSubmit = (module) => {
|
||||
handleSubmit = module => {
|
||||
const { taxAgentStore } = this.props;
|
||||
const { editModalProps } = this.state;
|
||||
const { doInit, saveTaxAgent, updateTaxAgent, pageObj } = taxAgentStore;
|
||||
|
|
@ -189,15 +187,15 @@ export default class TaxAgent extends React.Component {
|
|||
// 新增
|
||||
this.setState({
|
||||
editModalLoading: {
|
||||
saveloading: true,
|
||||
},
|
||||
saveloading: true
|
||||
}
|
||||
});
|
||||
const payload = { ...module };
|
||||
saveTaxAgent(payload).then(({ status, errormsg, data }) => {
|
||||
this.setState({
|
||||
editModalLoading: {
|
||||
saveloading: false,
|
||||
},
|
||||
saveloading: false
|
||||
}
|
||||
});
|
||||
if (status) {
|
||||
message.success("新增成功");
|
||||
|
|
@ -206,8 +204,8 @@ export default class TaxAgent extends React.Component {
|
|||
...editModalProps,
|
||||
editId: data,
|
||||
current: 1,
|
||||
btnType: "prev",
|
||||
},
|
||||
btnType: "prev"
|
||||
}
|
||||
});
|
||||
doInit({ current: pageObj.current, pageSize: pageObj.pageSize });
|
||||
} else {
|
||||
|
|
@ -218,15 +216,15 @@ export default class TaxAgent extends React.Component {
|
|||
// 编辑
|
||||
this.setState({
|
||||
editModalLoading: {
|
||||
saveloading: true,
|
||||
},
|
||||
saveloading: true
|
||||
}
|
||||
});
|
||||
const payload = { ...module, id: editId };
|
||||
updateTaxAgent(payload).then(({ status, errormsg }) => {
|
||||
this.setState({
|
||||
editModalLoading: {
|
||||
saveloading: false,
|
||||
},
|
||||
saveloading: false
|
||||
}
|
||||
});
|
||||
if (status) {
|
||||
message.success("更新成功");
|
||||
|
|
@ -237,8 +235,8 @@ export default class TaxAgent extends React.Component {
|
|||
editModalProps: {
|
||||
...editModalProps,
|
||||
current: 1,
|
||||
btnType: "prev",
|
||||
},
|
||||
btnType: "prev"
|
||||
}
|
||||
});
|
||||
}
|
||||
doInit({ current: pageObj.current, pageSize: pageObj.pageSize });
|
||||
|
|
@ -253,7 +251,7 @@ export default class TaxAgent extends React.Component {
|
|||
* param {*} agentId
|
||||
* return {*}
|
||||
*/
|
||||
deleteTaxAgent = (agentId) => {
|
||||
deleteTaxAgent = agentId => {
|
||||
const { taxAgentStore } = this.props;
|
||||
const { deleteTaxAgent, pageObj, doInit } = taxAgentStore;
|
||||
Modal.confirm({
|
||||
|
|
@ -268,7 +266,7 @@ export default class TaxAgent extends React.Component {
|
|||
message.error(errormsg || "删除失败");
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -279,10 +277,16 @@ export default class TaxAgent extends React.Component {
|
|||
editModalLoading,
|
||||
devolutionStatus,
|
||||
conditions,
|
||||
permission,
|
||||
permission
|
||||
} = this.state;
|
||||
const { loading, pageObj, dataSource, columns, doInit, hasRight } =
|
||||
taxAgentStore;
|
||||
const {
|
||||
loading,
|
||||
pageObj,
|
||||
dataSource,
|
||||
columns,
|
||||
doInit,
|
||||
hasRight
|
||||
} = taxAgentStore;
|
||||
|
||||
if (!hasRight && !loading) {
|
||||
// 无权限处理
|
||||
|
|
@ -292,21 +296,21 @@ export default class TaxAgent extends React.Component {
|
|||
const renderTipsLabel = () => {
|
||||
const tipList = [
|
||||
"1、个税扣缴义务人与档案中的个税扣缴义务人匹配,修改个税扣缴义务人名称,薪资档案的个税扣缴义务人数据同步更新;",
|
||||
"2、删除个税扣缴义务人需先确认档案里无人员使用该个税扣缴义务人,否则不予删除;",
|
||||
"2、删除个税扣缴义务人需先确认档案里无人员使用该个税扣缴义务人,否则不予删除;"
|
||||
];
|
||||
return <TipLabel tipList={tipList} />;
|
||||
};
|
||||
|
||||
const pagination = {
|
||||
total: pageObj.total,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
showTotal: total => `共 ${total} 条`,
|
||||
showSizeChanger: true,
|
||||
onShowSizeChange(current, pageSize) {
|
||||
doInit({ current, pageSize });
|
||||
},
|
||||
onChange(current) {
|
||||
doInit({ current, pageSize: pageObj.pageSize });
|
||||
},
|
||||
}
|
||||
};
|
||||
const newColumns = _.map(
|
||||
[
|
||||
|
|
@ -314,7 +318,7 @@ export default class TaxAgent extends React.Component {
|
|||
{
|
||||
title: "操作",
|
||||
key: "operation",
|
||||
render: (text, record) => (
|
||||
render: (text, record) =>
|
||||
<div className="operationWapper">
|
||||
<a
|
||||
href="javaScript:void(0);"
|
||||
|
|
@ -338,10 +342,9 @@ export default class TaxAgent extends React.Component {
|
|||
</a>
|
||||
</Dropdown>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
}
|
||||
],
|
||||
(item) => {
|
||||
item => {
|
||||
if (item.dataIndex === "employeeRange") {
|
||||
return {
|
||||
...item,
|
||||
|
|
@ -355,7 +358,7 @@ export default class TaxAgent extends React.Component {
|
|||
</a>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return { ...item };
|
||||
|
|
@ -370,14 +373,14 @@ export default class TaxAgent extends React.Component {
|
|||
title="个税扣缴义务人" // 文字
|
||||
icon={<i className="icon-coms-meeting" />} // 左侧图标
|
||||
iconBgcolor="#F14A2D" // 左侧图标背景色
|
||||
showDropIcon={true} // 是否显示下拉按钮
|
||||
>
|
||||
showDropIcon={true}>
|
||||
{" "}// 是否显示下拉按钮
|
||||
<Row
|
||||
gutter={16}
|
||||
style={{ overflow: "hidden", width: "100%", marginTop: 8 }}>
|
||||
<Col sm={24} md={24} lg={18} xl={18}>
|
||||
<div className="mySalaryTableWrapper">
|
||||
{permission.isChief && (
|
||||
{permission.isChief &&
|
||||
<WeaSearchGroup title={"基础信息"} showGroup>
|
||||
<WeaFormItem
|
||||
label="启用分权"
|
||||
|
|
@ -388,20 +391,18 @@ export default class TaxAgent extends React.Component {
|
|||
onChange={this.taxAgentBaseSave}
|
||||
/>
|
||||
</WeaFormItem>
|
||||
</WeaSearchGroup>
|
||||
)}
|
||||
</WeaSearchGroup>}
|
||||
<WeaSearchGroup
|
||||
title={
|
||||
<div className="titleWrapper">
|
||||
<div className="title">个税扣缴义务人</div>
|
||||
{/* 总管理员开启新增功能 */}
|
||||
{permission.isChief && (
|
||||
{permission.isChief &&
|
||||
<i
|
||||
className="icon-coms-Add-to"
|
||||
title="新增"
|
||||
onClick={() => this.showEditModal()}
|
||||
/>
|
||||
)}
|
||||
/>}
|
||||
</div>
|
||||
}
|
||||
showGroup>
|
||||
|
|
@ -421,7 +422,7 @@ export default class TaxAgent extends React.Component {
|
|||
</WeaTop>
|
||||
</WeaRightMenu>
|
||||
|
||||
{editModalProps.visible && (
|
||||
{editModalProps.visible &&
|
||||
<EditModal
|
||||
{...editModalProps}
|
||||
{...editModalLoading}
|
||||
|
|
@ -432,22 +433,20 @@ export default class TaxAgent extends React.Component {
|
|||
editModalProps: {
|
||||
...editModalProps,
|
||||
current: 0,
|
||||
btnType: "edit",
|
||||
},
|
||||
})
|
||||
}
|
||||
onChangeTab={(current) => {
|
||||
btnType: "edit"
|
||||
}
|
||||
})}
|
||||
onChangeTab={current => {
|
||||
this.setState({
|
||||
editModalProps: {
|
||||
...editModalProps,
|
||||
current,
|
||||
},
|
||||
current
|
||||
}
|
||||
});
|
||||
}}
|
||||
onClose={this.closeModal}
|
||||
onSubmit={this.handleSubmit}
|
||||
/>
|
||||
)}
|
||||
/>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,34 +23,30 @@ export class TaxAgentStore {
|
|||
@observable dataSource = []; //列表数据
|
||||
@observable taxAgentOption = []; // 个税扣缴义务人
|
||||
|
||||
@action
|
||||
setModalVisiable = (visiable) => (this.modalVisiable = visiable);
|
||||
@action setModalVisiable = visiable => (this.modalVisiable = visiable);
|
||||
|
||||
@action
|
||||
setColumns = (columns) => (this.columns = columns);
|
||||
@action setColumns = columns => (this.columns = columns);
|
||||
|
||||
@action
|
||||
setPageObj = (pageObj) => (this.pageObj = pageObj);
|
||||
@action setPageObj = pageObj => (this.pageObj = pageObj);
|
||||
|
||||
@action
|
||||
setDataSource = (dataSource) => (this.dataSource = dataSource);
|
||||
@action setDataSource = dataSource => (this.dataSource = dataSource);
|
||||
|
||||
// 初始化操作
|
||||
@action
|
||||
doInit = (params) => {
|
||||
doInit = params => {
|
||||
this.getTaxAgentList(params);
|
||||
this.getCondition(editConditions);
|
||||
};
|
||||
|
||||
// 获得高级搜索表单数据
|
||||
@action
|
||||
getCondition = (condition) => {
|
||||
getCondition = condition => {
|
||||
this.form.initFormFields(condition);
|
||||
};
|
||||
|
||||
// 渲染table数据
|
||||
@action
|
||||
getTaxAgentList = (params) => {
|
||||
getTaxAgentList = params => {
|
||||
this.loading = true;
|
||||
params = params || {};
|
||||
API.getTaxAgentList(params).then(
|
||||
|
|
@ -64,7 +60,7 @@ export class TaxAgentStore {
|
|||
this.setPageObj({
|
||||
total,
|
||||
current,
|
||||
pageSize,
|
||||
pageSize
|
||||
});
|
||||
} else {
|
||||
message.error(res.msg || "接口调用失败!");
|
||||
|
|
@ -73,74 +69,95 @@ export class TaxAgentStore {
|
|||
);
|
||||
};
|
||||
|
||||
@action
|
||||
setShowSearchAd = (bool) => (this.showSearchAd = bool);
|
||||
@action setShowSearchAd = bool => (this.showSearchAd = bool);
|
||||
|
||||
// 高级搜索 - 搜索
|
||||
@action doSearch = (name) => {
|
||||
@action
|
||||
doSearch = name => {
|
||||
this.getTaxAgentList({ name });
|
||||
this.showSearchAd = false;
|
||||
};
|
||||
|
||||
// 新增
|
||||
@action saveTaxAgent = (params) => {
|
||||
@action
|
||||
saveTaxAgent = params => {
|
||||
return API.saveTaxAgent(params);
|
||||
};
|
||||
|
||||
// 更新
|
||||
@action updateTaxAgent = (params) => {
|
||||
@action
|
||||
updateTaxAgent = params => {
|
||||
return API.updateTaxAgent(params);
|
||||
};
|
||||
|
||||
// 获取个税扣缴义务人基础信息表单
|
||||
@action getTaxAgentBaseForm = (params) => {
|
||||
@action
|
||||
getTaxAgentBaseForm = params => {
|
||||
return API.getTaxAgentBaseForm(params);
|
||||
};
|
||||
|
||||
// 获取个税扣缴义务人表单
|
||||
@action getTaxAgentForm = (params) => {
|
||||
@action
|
||||
getTaxAgentForm = params => {
|
||||
return API.getTaxAgentForm(params);
|
||||
};
|
||||
|
||||
// 保存个税扣缴义务人基础信息
|
||||
@action taxAgentBaseSave = (params) => {
|
||||
@action
|
||||
taxAgentBaseSave = params => {
|
||||
return API.taxAgentBaseSave(params);
|
||||
};
|
||||
|
||||
@action deleteTaxAgent = (params) => {
|
||||
@action
|
||||
deleteTaxAgent = params => {
|
||||
return API.deleteTaxAgent(params);
|
||||
};
|
||||
|
||||
@action getPermission = (params) => {
|
||||
return API.getPermission(params);
|
||||
@action
|
||||
getPermission = params => {
|
||||
return new Promise((resolve, reject) => {
|
||||
API.getPermission(params).then(({ status, data }) => {
|
||||
if (status) {
|
||||
resolve({ status, data });
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
// 人员范围列表
|
||||
@action getTaxAgentRangeListInclude = (params) => {
|
||||
@action
|
||||
getTaxAgentRangeListInclude = params => {
|
||||
return API.getTaxAgentRangeListInclude(params);
|
||||
};
|
||||
// 人员范围排除列表
|
||||
@action getTaxAgentRangeListExclude = (params) => {
|
||||
@action
|
||||
getTaxAgentRangeListExclude = params => {
|
||||
return API.getTaxAgentRangeListExclude(params);
|
||||
};
|
||||
// 获取人员范围表单
|
||||
@action getTaxAgentRangeForm = (params) => {
|
||||
@action
|
||||
getTaxAgentRangeForm = params => {
|
||||
return API.getTaxAgentRangeForm(params);
|
||||
};
|
||||
// 人员范围保存
|
||||
@action taxAgentRangeSave = (params) => {
|
||||
@action
|
||||
taxAgentRangeSave = params => {
|
||||
return API.taxAgentRangeSave(params);
|
||||
};
|
||||
// 人员范围删除
|
||||
@action taxAgentRangeDelete = (params) => {
|
||||
@action
|
||||
taxAgentRangeDelete = params => {
|
||||
return API.taxAgentRangeDelete(params);
|
||||
};
|
||||
|
||||
@action fetchTaxAgentOption = () => {
|
||||
@action
|
||||
fetchTaxAgentOption = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
API.getTaxAgentSelectList().then(
|
||||
action((res) => {
|
||||
action(res => {
|
||||
if (res.status) {
|
||||
this.taxAgentOption = res.data.map((item) => {
|
||||
this.taxAgentOption = res.data.map(item => {
|
||||
return { key: item.id, showname: item.content };
|
||||
});
|
||||
resolve();
|
||||
|
|
|
|||
Loading…
Reference in New Issue