From cc81d8c9bd146ab1c684ed0d750636b4d1e24f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 20 Aug 2024 18:07:03 +0800 Subject: [PATCH] =?UTF-8?q?feature/2.15.1.2407.01-=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/taxAgent/components/conditions.js | 51 +++++++++++++++++ .../roleDetailSetDialog/editRoleDialog.js | 56 +++++++++++++++++++ .../components/roleDetailSetDialog/index.js | 35 +++++++++--- pc4mobx/hrmSalary/stores/taxAgent.js | 3 +- 4 files changed, 136 insertions(+), 9 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/editRoleDialog.js diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/conditions.js b/pc4mobx/hrmSalary/pages/taxAgent/components/conditions.js index cfad3e1d..abf5dd55 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/conditions.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/conditions.js @@ -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: "" + } +]; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/editRoleDialog.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/editRoleDialog.js new file mode 100644 index 00000000..3e5d8492 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/editRoleDialog.js @@ -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 ( + this.save()}>{getLabel(111, "保存")} + ]} + > +
{getSearchs(roleOperatorForm, conditions, 1, false)}
+
+ ); + } +} + +export default EditRoleDialog; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js index acec1c09..cdf3d1c3 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/components/roleDetailSetDialog/index.js @@ -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) => ( this.handleEditOperator(record)}>{getLabel(111, "编辑")}) + } + ] }); } }); }; + 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, "批量删除")} + pagination={pagination} rowSelection={rowSelection}/> + {/* 编辑操作者*/} + this.getSettingRoler(roleId)} + onCancel={callback => this.setState({ + editOperatorDialog: { ...editOperatorDialog, visible: false } + }, () => callback && callback())}/> diff --git a/pc4mobx/hrmSalary/stores/taxAgent.js b/pc4mobx/hrmSalary/stores/taxAgent.js index 5168078c..dafd7b40 100644 --- a/pc4mobx/hrmSalary/stores/taxAgent.js +++ b/pc4mobx/hrmSalary/stores/taxAgent.js @@ -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