feature/2.15.1.2407.01-权限
This commit is contained in:
parent
2dc1061fa2
commit
6e7137b6b3
|
|
@ -108,4 +108,12 @@ export const saveAuthRole = (params) => {
|
|||
export const deleteAuthRole = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/auth/role/delete", params);
|
||||
};
|
||||
//成员列表
|
||||
export const authMemberList = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/auth/member/list", params);
|
||||
};
|
||||
//数据列表
|
||||
export const authDataList = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/auth/data/list", params);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -78,5 +78,11 @@
|
|||
margin: 12px 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.tax_role_operator_setting_table {
|
||||
.setting_table_title {
|
||||
//line-height: 45px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,24 +8,43 @@
|
|||
* @description:
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaBrowser, WeaDialog, WeaFormItem, WeaInput, WeaLocaleProvider, WeaSelect, WeaTab, WeaTextarea } from "ecCom";
|
||||
import {
|
||||
WeaBrowser,
|
||||
WeaDialog,
|
||||
WeaFormItem,
|
||||
WeaInput,
|
||||
WeaLocaleProvider,
|
||||
WeaSelect,
|
||||
WeaTab,
|
||||
WeaTable,
|
||||
WeaTextarea
|
||||
} from "ecCom";
|
||||
import { commonEnumList } from "../../../../apis/archive";
|
||||
import * as API from "../../../../apis/taxAgent";
|
||||
import { Button, Col, Row } from "antd";
|
||||
import "../index.less";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
const APIFOX = {
|
||||
"auth.MemberTargetTypeEnum": API.authMemberList,
|
||||
"auth.DataTargetTypeEnum": API.authDataList
|
||||
};
|
||||
|
||||
class Index extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
selectedKey: "auth.MemberTargetTypeEnum", name: "", options: [], enumType: ""
|
||||
selectedKey: "auth.MemberTargetTypeEnum", name: "", options: [], enumType: "",
|
||||
columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 }
|
||||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||
this.setState({ name: nextProps.name, selectedKey: "auth.MemberTargetTypeEnum" }, () => this.getEnumList());
|
||||
this.setState({ name: nextProps.name, selectedKey: "auth.MemberTargetTypeEnum" }, () => {
|
||||
this.getEnumList();
|
||||
this.getSettingRoler(nextProps.roleId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -39,6 +58,26 @@ class Index extends Component {
|
|||
if (!status) this.setState({ options: [], enumType: "" });
|
||||
});
|
||||
};
|
||||
getSettingRoler = (roleId) => {
|
||||
const { selectedKey, pageInfo } = this.state;
|
||||
APIFOX[selectedKey]({ roleId, ...pageInfo }).then(({ status, data }) => {
|
||||
if (status) {
|
||||
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
|
||||
this.setState({
|
||||
dataSource, pageInfo: { ...pageInfo, current, pageSize, total },
|
||||
columns: _.map(columns, o => {
|
||||
if (o.dataIndex === "targetType") {
|
||||
return {
|
||||
...o,
|
||||
render: (txt, record) => (<span>{txt}</span>)
|
||||
};
|
||||
}
|
||||
return { ...o };
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
getOperatorSetting = () => {
|
||||
const { selectedKey, enumType } = this.state;
|
||||
if (selectedKey !== "auth.AuthTargetTypeEnum") {
|
||||
|
|
@ -61,7 +100,7 @@ class Index extends Component {
|
|||
break;
|
||||
case "SQL":
|
||||
return (<Row className="tax_role_browser_form_item">
|
||||
<WeaTextarea style={{ width: "100%" }} minRows={3} />
|
||||
<WeaTextarea style={{ width: "100%" }} minRows={3}/>
|
||||
</Row>);
|
||||
default:
|
||||
break;
|
||||
|
|
@ -75,12 +114,30 @@ class Index extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { selectedKey, name, options, enumType } = this.state;
|
||||
const { roleId } = this.props;
|
||||
const { selectedKey, name, options, enumType, pageInfo, columns, dataSource } = this.state;
|
||||
const tabs = [
|
||||
{ title: getLabel(111, "成员"), viewcondition: "auth.MemberTargetTypeEnum" },
|
||||
{ title: getLabel(111, "权限"), viewcondition: "auth.AuthTargetTypeEnum" },
|
||||
{ title: getLabel(111, "数据"), viewcondition: "auth.DataTargetTypeEnum" }
|
||||
];
|
||||
const pagination = {
|
||||
...pageInfo,
|
||||
showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`,
|
||||
showQuickJumper: true,
|
||||
showSizeChanger: true,
|
||||
pageSizeOptions: ["10", "20", "50", "100"],
|
||||
onShowSizeChange: (current, pageSize) => {
|
||||
this.setState({
|
||||
pageInfo: { ...pageInfo, current, pageSize }
|
||||
}, () => this.getSettingRoler(roleId));
|
||||
},
|
||||
onChange: current => {
|
||||
this.setState({
|
||||
pageInfo: { ...pageInfo, current }
|
||||
}, () => this.getSettingRoler(roleId));
|
||||
}
|
||||
};
|
||||
return (
|
||||
<WeaDialog
|
||||
{...this.props} hasScroll className="tax_role_set_dialog" initLoadCss title={getLabel(111, "编辑角色")}
|
||||
|
|
@ -104,7 +161,10 @@ class Index extends Component {
|
|||
<WeaTab datas={tabs} keyParam="viewcondition" selectedKey={selectedKey}
|
||||
onChange={v => this.setState({
|
||||
selectedKey: v, name: !name ? null : name
|
||||
}, () => this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getEnumList())}/>
|
||||
}, () => {
|
||||
this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getEnumList();
|
||||
this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getSettingRoler(roleId);
|
||||
})}/>
|
||||
<WeaSelect options={options} detailtype={3} value={enumType}
|
||||
onChange={v => this.setState({ enumType: v })}/>
|
||||
{this.getOperatorSetting()}
|
||||
|
|
@ -113,7 +173,14 @@ class Index extends Component {
|
|||
</Row>
|
||||
</div>
|
||||
</Row>
|
||||
|
||||
{/*表格*/}
|
||||
<Row className="tax_role_operator_setting_table">
|
||||
<Col span={24} className="setting_table_title">
|
||||
<div className="wea-f12 text-elli">{getLabel(111, "已设操作者")}</div>
|
||||
<WeaTable columns={columns} dataSource={dataSource} draggable={true} bordered
|
||||
pagination={pagination}/>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</WeaDialog>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue