feature/2.15.1.2407.01-权限
This commit is contained in:
parent
b7c5ae22f3
commit
cc81d8c9bd
|
|
@ -27,3 +27,54 @@ export const roleConditions = [
|
|||
title: ""
|
||||
}
|
||||
];
|
||||
export const roleOperatorConditions = [
|
||||
{
|
||||
items: [
|
||||
{
|
||||
conditionType: "INPUT",
|
||||
domkey: ["targetType"],
|
||||
fieldcol: 14,
|
||||
label: "对象类型",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
viewAttr: 1
|
||||
},
|
||||
{
|
||||
conditionType: "BROWSER",
|
||||
domkey: ["targetName"],
|
||||
fieldcol: 14,
|
||||
label: "对象",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
rules: "required",
|
||||
viewAttr: 3
|
||||
},
|
||||
{
|
||||
conditionType: "SELECT",
|
||||
domkey: ["link"],
|
||||
fieldcol: 14,
|
||||
label: "连接符",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
rules: "required|string",
|
||||
viewAttr: 3
|
||||
},
|
||||
{
|
||||
conditionType: "INPUTNUMBER",
|
||||
domkey: ["sortedIndex"],
|
||||
fieldcol: 14,
|
||||
label: "顺序",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
rules: "required",
|
||||
viewAttr: 3
|
||||
}
|
||||
],
|
||||
defaultshow: true,
|
||||
title: ""
|
||||
}
|
||||
];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 编辑橘色操作者
|
||||
*
|
||||
* @Author: 黎永顺
|
||||
* @Date: 2024/8/20
|
||||
* @Wechat:
|
||||
* @Email: 971387674@qq.com
|
||||
* @description:
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { WeaDialog, WeaLocaleProvider } from "ecCom";
|
||||
import { Button } from "antd";
|
||||
import { roleOperatorConditions } from "../conditions";
|
||||
import { getSearchs } from "../../../../util";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
@inject("taxAgentStore")
|
||||
@observer
|
||||
class EditRoleDialog extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
conditions: [], loading: false
|
||||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||
this.setState({
|
||||
conditions: _.map(roleOperatorConditions, item => ({
|
||||
...item, items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) }))
|
||||
}))
|
||||
}, () => nextProps.taxAgentStore.roleOperatorForm.initFormFields(this.state.conditions));
|
||||
}
|
||||
if (nextProps.visible !== this.props.visible && !nextProps.visible) nextProps.taxAgentStore.initRoleOperatorForm();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { conditions, loading } = this.state;
|
||||
const { taxAgentStore: { roleOperatorForm } } = this.props;
|
||||
return (
|
||||
<WeaDialog
|
||||
{...this.props} style={{ width: 480, height: 187 }} initLoadCss title={getLabel(111, "编辑操作者")}
|
||||
buttons={[
|
||||
<Button type="primary" loading={loading} onClick={() => this.save()}>{getLabel(111, "保存")}</Button>
|
||||
]}
|
||||
>
|
||||
<div className="form-dialog-layout">{getSearchs(roleOperatorForm, conditions, 1, false)}</div>
|
||||
</WeaDialog>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default EditRoleDialog;
|
||||
|
|
@ -21,6 +21,7 @@ import {
|
|||
WeaTextarea
|
||||
} from "ecCom";
|
||||
import { commonEnumList } from "../../../../apis/archive";
|
||||
import EditRoleDialog from "./editRoleDialog";
|
||||
import * as API from "../../../../apis/taxAgent";
|
||||
import { Button, Col, message, Modal, Row } from "antd";
|
||||
import "../index.less";
|
||||
|
|
@ -43,7 +44,8 @@ class Index extends Component {
|
|||
this.state = {
|
||||
selectedKey: "auth.MemberTargetTypeEnum", name: "", options: [], enumType: "", selectedRowKeys: [],
|
||||
replaceDatas: [], loading: { set: false, query: false, async: false, delete: false },
|
||||
columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 }
|
||||
columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 },
|
||||
editOperatorDialog: { visible: false, linkOptions: [], record: {} }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -77,13 +79,26 @@ class Index extends Component {
|
|||
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
|
||||
this.setState({
|
||||
dataSource, pageInfo: { ...pageInfo, current, pageSize, total },
|
||||
columns: _.map(columns, o => {
|
||||
return { ...o };
|
||||
})
|
||||
columns: [
|
||||
...columns, {
|
||||
dataIndex: "opt", title: getLabel(111, "操作"), width: 120,
|
||||
render: (__, record) => (<a href="javascript:void(0);"
|
||||
onClick={() => this.handleEditOperator(record)}>{getLabel(111, "编辑")}</a>)
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
handleEditOperator = async (record) => {
|
||||
let { selectedKey } = this.state, linkOptions = [];
|
||||
if (selectedKey === "auth.DataTargetTypeEnum") {
|
||||
const payload = { enumClass: `com.engine.salary.enums.auth.DataLinkEnum` };
|
||||
const { data } = await commonEnumList(payload);
|
||||
linkOptions = _.map(data, o => ({ key: o.enum, showname: o.defaultLabel }));
|
||||
}
|
||||
this.setState({ editOperatorDialog: { visible: true, record, linkOptions } });
|
||||
};
|
||||
addOperatorSettings = () => {
|
||||
const { roleId } = this.props;
|
||||
const { selectedKey, enumType: targetType, replaceDatas } = this.state;
|
||||
|
|
@ -97,7 +112,7 @@ class Index extends Component {
|
|||
const payload = _.map(replaceDatas, o => ({
|
||||
roleId, targetType, target: o.id || "", targetName: o.name || "",
|
||||
link: selectedKey === "auth.DataTargetTypeEnum" ? "OR" : "",
|
||||
sortedIndex: selectedKey === "auth.DataTargetTypeEnum" ? 0 : ""
|
||||
sortedIndex: o.sortedIndex || 0
|
||||
}));
|
||||
this.setState({ loading: { ...this.state.loading, set: true } });
|
||||
APIFOX[`save.${selectedKey}`](payload).then(({ status, errormsg }) => {
|
||||
|
|
@ -189,7 +204,7 @@ class Index extends Component {
|
|||
render() {
|
||||
const { roleId } = this.props;
|
||||
const {
|
||||
selectedKey, name, options, enumType, pageInfo, columns, dataSource, loading, selectedRowKeys
|
||||
selectedKey, name, options, enumType, pageInfo, columns, dataSource, loading, selectedRowKeys, editOperatorDialog
|
||||
} = this.state;
|
||||
const tabs = [
|
||||
{ title: getLabel(111, "成员"), viewcondition: "auth.MemberTargetTypeEnum" },
|
||||
|
|
@ -264,8 +279,12 @@ class Index extends Component {
|
|||
onClick={this.deleteOperatorSettings}>{getLabel(111, "批量删除")}</Button>
|
||||
</div>
|
||||
<WeaTable rowKey="id" columns={columns} dataSource={dataSource} bordered loading={loading.query}
|
||||
pagination={pagination} rowSelection={rowSelection}
|
||||
draggable={selectedKey === "auth.DataTargetTypeEnum"}/>
|
||||
pagination={pagination} rowSelection={rowSelection}/>
|
||||
{/* 编辑操作者*/}
|
||||
<EditRoleDialog {...editOperatorDialog} onInitTable={() => this.getSettingRoler(roleId)}
|
||||
onCancel={callback => this.setState({
|
||||
editOperatorDialog: { ...editOperatorDialog, visible: false }
|
||||
}, () => callback && callback())}/>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ const { TableStore } = WeaTableNew;
|
|||
export class TaxAgentStore {
|
||||
@observable roleForm = new WeaForm(); //权限-角色form表单
|
||||
@action initRoleForm = () => this.roleForm = new WeaForm();
|
||||
|
||||
@observable roleOperatorForm = new WeaForm(); //权限-角色操作者form表单
|
||||
@action initRoleOperatorForm = () => this.roleOperatorForm = new WeaForm();
|
||||
|
||||
|
||||
@observable tableStore = new TableStore(); // new table
|
||||
|
|
|
|||
Loading…
Reference in New Issue