feature/2.15.1.2407.01-权限

This commit is contained in:
黎永顺 2024-09-26 10:01:49 +08:00
parent a7e67b9358
commit 112988ceba
2 changed files with 17 additions and 21 deletions

View File

@ -119,9 +119,10 @@ export default class SalaryItem extends React.Component {
break;
case "customAdd":
case "edit":
const { taxAgentStore: { showOperateBtn, showSalaryItemBtn } } = this.props;
const { loading } = this.state;
const title = key === "edit" ? getLabel(111, "修改自定义薪资项目") : getLabel(111, "新建自定义薪资项目");
const { taxAgentStore: { PageAndOptAuth } } = this.props;
const { loading } = this.state, showOperateBtn = PageAndOptAuth.opts.includes("admin");
const editTitle = !showOperateBtn ? getLabel(111, "查看自定义薪资项目") : getLabel(111, "修改自定义薪资项目");
const title = key === "edit" ? editTitle : getLabel(111, "新建自定义薪资项目");
const buttons = key === "edit" ? [
<Button type="ghost" onClick={() => this.setState({
syncSalarySetDialog: { visible: true, id: targetid }
@ -136,7 +137,7 @@ export default class SalaryItem extends React.Component {
];
this.setState({
customItemDialog: {
visible: true, title, buttons: (showSalaryItemBtn || showOperateBtn) ? buttons : [], id: targetid
visible: true, title, buttons: showOperateBtn ? buttons : [], id: targetid
}
});
break;
@ -152,14 +153,12 @@ export default class SalaryItem extends React.Component {
};
render() {
const { salaryItemStore, taxAgentStore: { showOperateBtn, showSalaryItemBtn } } = this.props;
const { taxAgentStore: { PageAndOptAuth } } = this.props;
const {
selectedRowKeys, logDialogVisible, filterConditions, name, isQuery, customItemDialog, sysVisible,
salaryItemImpDialog
} = this.state;
const { loading, deleteItemRequest, getTableDatas } = salaryItemStore;
const { systemItemVisible, setSystemItemVisible } = salaryItemStore;
const showOperateBtn = PageAndOptAuth.opts.includes("admin");
const menu = (
<Menu onClick={({ key }) => this.onDropMenuClick(key)}>
<Menu.Item key="sysAdd">{getLabel(111, "新增系统薪资项")}</Menu.Item>
@ -172,19 +171,20 @@ export default class SalaryItem extends React.Component {
<WeaInputSearch value={name} onChange={val => this.setState({ name: val })}
placeholder={getLabel(111, "请输入名称")} onSearch={() => this.setState({ isQuery: !isQuery })}/>
];
const dropMenuDatas = [
let dropMenuDatas = [
{ key: "import", icon: <i className="icon-coms02-Template-import1"/>, content: getLabel(111, "导入") },
{ key: "export", icon: <i className="iconfont icon-daochu"/>, content: getLabel(111, "导出") },
{ key: "log", icon: <i className="iconfont icon-caozuorizhi32"/>, content: getLabel(545781, "操作日志") }
];
!(showOperateBtn || showSalaryItemBtn) && (buttons = buttons.slice(-1));
!showOperateBtn && (buttons = buttons.slice(-1));
!showOperateBtn && (dropMenuDatas = dropMenuDatas.slice(-1));
return (
<React.Fragment>
<WeaTop title={getLabel(111, "薪资项目管理")} icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
buttons={buttons} showDropIcon onDropMenuClick={this.onDropMenuClick} dropMenuDatas={dropMenuDatas}
className="salaryProjectManagement">
<div className="salaryItems_content">
<SalaryItemsTable {...this.props} name={name} isQuery={isQuery}
<SalaryItemsTable {...this.props} name={name} isQuery={isQuery} showOperateBtn={showOperateBtn}
selectedRowKeys={selectedRowKeys} onDropMenuClick={this.onDropMenuClick}
onChange={val => this.setState({ selectedRowKeys: val })}/>
</div>
@ -204,11 +204,11 @@ export default class SalaryItem extends React.Component {
onCancel={callback => {
this.setState({
salaryItemImpDialog: { ...salaryItemImpDialog, visible: false }
}, () => callback && this.handleSearch(this.state.searchValue));
}, () => callback && this.setState({ isQuery: !isQuery }));
}}/>
{/*新增编辑自定义薪资项目*/}
<CustomSalaryItemSlide {...customItemDialog} onSearch={() => this.setState({ isQuery: !isQuery })}
showOperateBtn={showOperateBtn || showSalaryItemBtn}
showOperateBtn={showOperateBtn}
onClose={callback => this.setState({
customItemDialog: { ...customItemDialog, visible: false, id: "" }
}, () => callback && callback())}/>

View File

@ -57,9 +57,7 @@ class SalaryItemsTable extends Component {
render() {
const { dataSource, columns, pageInfo, loading } = this.state;
const {
selectedRowKeys, onChange, onDropMenuClick, taxAgentStore: { showOperateBtn, showSalaryItemBtn }
} = this.props;
const { selectedRowKeys, onChange, onDropMenuClick, showOperateBtn } = this.props;
const pagination = {
...pageInfo,
showTotal: total => `${getLabel(111, "共")} ${total} ${getLabel(111, "条")}`,
@ -77,9 +75,7 @@ class SalaryItemsTable extends Component {
};
const rowSelection = {
selectedRowKeys, onChange,
getCheckboxProps: record => ({
disabled: !record.canDelete
})
getCheckboxProps: record => ({ disabled: !record.canDelete })
};
return (<Spin spinning={loading && pageInfo.total === 0}>
<WeaTable rowKey="id" dataSource={dataSource} rowSelection={rowSelection} pagination={pagination}
@ -89,9 +85,9 @@ class SalaryItemsTable extends Component {
dataIndex: "opt", title: getLabel(111, "操作"), width: 140,
render: (__, record) => (<React.Fragment>
<a style={{ marginRight: 8 }} onClick={() => onDropMenuClick("edit", record.id)}
href="javascript:void(0);">{(showOperateBtn || showSalaryItemBtn) ? getLabel(111, "编辑") : getLabel(111, "查看")}</a>
href="javascript:void(0);">{showOperateBtn ? getLabel(111, "编辑") : getLabel(111, "查看")}</a>
{
(showOperateBtn || showSalaryItemBtn) && record.canDelete &&
showOperateBtn && record.canDelete &&
<a style={{ marginRight: 8 }} href="javascript:void(0);"
onClick={() => onDropMenuClick("delete", record.id)}>{getLabel(111, "删除")}</a>
}