From fd188c9f51e9f9285ed3d7600a307cd80361d6f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Wed, 25 Sep 2024 10:02:46 +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
---
.../components/associativeSearchMult.js | 2 +-
.../components/associativeTreeMult.js | 84 +++++++++++++++++++
.../components/CustomBrowser/index.js | 28 +++++--
.../components/advanceSearchPannel/index.js | 29 +++++--
.../roleManagement/components/conditions.js | 17 ++--
.../hrmSalary/pages/roleManagement/index.js | 3 +-
6 files changed, 141 insertions(+), 22 deletions(-)
create mode 100644 pc4mobx/hrmSalary/components/CustomBrowser/components/associativeTreeMult.js
diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js
index cfa0b04a..3f1dbc54 100644
--- a/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js
+++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeSearchMult.js
@@ -10,8 +10,8 @@
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { Button, Icon, Select } from "antd";
-import classNames from "classnames";
import { postFetch } from "../../../util/request";
+import classNames from "classnames";
const getLabel = WeaLocaleProvider.getLabel;
const Option = Select.Option;
diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeTreeMult.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeTreeMult.js
new file mode 100644
index 00000000..f7e975c3
--- /dev/null
+++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/associativeTreeMult.js
@@ -0,0 +1,84 @@
+/*
+ * 自定义组件
+ * 下拉树选择框
+ * @Author: 黎永顺
+ * @Date: 2024/9/24
+ * @Wechat:
+ * @Email: 971387674@qq.com
+ * @description:
+*/
+import React, { Component } from "react";
+import { WeaLocaleProvider } from "ecCom";
+import { TreeSelect } from "antd";
+import classNames from "classnames";
+
+const getLabel = WeaLocaleProvider.getLabel;
+
+class AssociativeTreeMult extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ data: []
+ };
+ this.selectedData = {};
+ }
+
+ componentDidMount() {
+ const { treeData } = this.props;
+ this.setState({ data: this.filterTree(treeData) });
+ }
+
+ handleChange = (values) => {
+ this.selectedData = {};
+ values.forEach((v) => {
+ let item = this.getItemById(v);
+ if (item) this.selectedData[v] = item;
+ });
+ this.props.onChange && this.props.onChange(values, this.selectedData);
+ };
+ getItemById = (id) => {
+ const { data } = this.state, { datas } = this.props;
+ if (datas[id]) return datas[id];
+ if (!_.isEmpty(data)) {
+ for (let i = 0; i < data.length; i++) {
+ if (id === data[i].id) return data[i];
+ }
+ }
+ };
+ filterTree = (nodes) => {
+ const selectableNodes = [];
+ const recurse = (nodes) => {
+ nodes.forEach((node) => {
+ if (node.selectable) selectableNodes.push(node);
+ if (node.children) recurse(node.children);
+ });
+ };
+ recurse(nodes);
+ return selectableNodes;
+ };
+
+ render() {
+ const { viewAttr, selectedValues, datas, isSingle, treeData } = this.props;
+ const clsname = classNames({
+ "required": (viewAttr === 3 || viewAttr === "3") && _.isEmpty(selectedValues)
+ });
+ const tProps = {
+ treeData,
+ multiple: true,
+ allowClear: false,
+ treeCheckable: true,
+ style: { width: "100%" },
+ treeDefaultExpandAll: true,
+ value: selectedValues,
+ onChange: this.handleChange,
+ dropdownMatchSelectWidth: true,
+ dropdownStyle: { minWidth: 200, maxHeight: 280, overflowY: "auto" },
+ getPopupContainer: (triggerNode) => triggerNode.parentNode
+ };
+ return (
+
+ );
+ }
+}
+
+export default AssociativeTreeMult;
diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/index.js b/pc4mobx/hrmSalary/components/CustomBrowser/index.js
index b7afc211..f77d566d 100644
--- a/pc4mobx/hrmSalary/components/CustomBrowser/index.js
+++ b/pc4mobx/hrmSalary/components/CustomBrowser/index.js
@@ -9,6 +9,7 @@
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTools } from "ecCom";
+import AssociativeTreeMult from "./components/associativeTreeMult";
import AssociativeSearchMult from "./components/associativeSearchMult";
import AssociativeSearchSingle from "./components/AssociativeSearchSingle";
import CustomBrowserDialog from "./components/customBrowserDialog";
@@ -64,16 +65,27 @@ class Index extends Component {
};
renderMult = () => {
const { fieldConfig } = this.props;
+ const { browserConditionParam = {} } = fieldConfig || {};
const { selectedData, searchKeys } = this.state;
return (
-
+ {
+ browserConditionParam.treeSelect ?
+
:
+
+ }
);
};
onBrowerChangeHandler = (values, datas) => {
diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/advanceSearchPannel/index.js b/pc4mobx/hrmSalary/pages/roleManagement/components/advanceSearchPannel/index.js
index fab6c856..72f0970d 100644
--- a/pc4mobx/hrmSalary/pages/roleManagement/components/advanceSearchPannel/index.js
+++ b/pc4mobx/hrmSalary/pages/roleManagement/components/advanceSearchPannel/index.js
@@ -11,6 +11,7 @@ import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaTools } from "ecCom";
import { roleSearchConditions } from "../conditions";
+import { getAuthOptTree } from "../../../../apis/taxAgent";
import { getSearchs } from "../../../../util";
import { Button } from "antd";
@@ -25,16 +26,32 @@ class AdvanceSearchPannel extends Component {
this.state = { conditions: [] };
}
- componentDidMount() {
+ async componentDidMount() {
const { taxAgentStore: { advanceForm } } = this.props;
+ const { data } = await getAuthOptTree();
this.setState({
conditions: _.map(roleSearchConditions, item => ({
...item, title: getLabel(item.lanId, item.title),
items: _.map(item.items, o => {
- if (getKey(0) === "opts") {
+ if (getKey(o) === "opts") {
return {
...o, label: getLabel(o.lanId, o.label),
- options: _.map(o.options, o => ({ ...o, label: getLabel(o.lanId, o.label) }))
+ options: _.map(o.options, k => ({ ...k, showname: getLabel(k.lanId, k.showname) }))
+ };
+ } else if (getKey(o) === "pages") {
+ return {
+ ...o, label: getLabel(o.lanId, o.label),
+ treeData: [{
+ label: data.name, value: data.key, key: data.key, id: data.key, name: data.name,
+ children: _.map(data.modules, i => ({
+ label: i.name, value: `${data.key}-${i.key}`, key: `${data.key}-${i.key}`,
+ id: `${data.key}-${i.key}`, name: i.name,
+ children: _.map(i.pages, k => ({
+ label: k.name, value: k.key, key: k.key, selectable: true,
+ id: k.key, name: k.name
+ }))
+ }))
+ }]
};
}
return { ...o, label: getLabel(o.lanId, o.label) };
@@ -46,7 +63,7 @@ class AdvanceSearchPannel extends Component {
handleReset = () => {
const { taxAgentStore: { advanceForm } } = this.props;
this.setState({
- conditions: _.map(roleSearchConditions, item => ({
+ conditions: _.map(this.state.conditions, item => ({
...item, items: _.map(item.items, o => ({ ...o, value: "" }))
}))
}, () => advanceForm.resetForm());
@@ -54,9 +71,9 @@ class AdvanceSearchPannel extends Component {
handleFormChange = (val) => {
const key = _.keys(val)[0];
const { taxAgentStore: { advanceForm } } = this.props;
- if (key === "taxAgentIds" || key === "sobIds") {
+ if (key === "taxAgentIds" || key === "sobIds" || key === "pages") {
this.setState({
- conditions: _.map(roleSearchConditions, item => ({
+ conditions: _.map(this.state.conditions, item => ({
...item, items: _.map(item.items, o => {
if (key === getKey(o)) {
return { ...o, value: _.map(val[key], o => o.id).join(",") };
diff --git a/pc4mobx/hrmSalary/pages/roleManagement/components/conditions.js b/pc4mobx/hrmSalary/pages/roleManagement/components/conditions.js
index 4b2bd858..6a32be00 100644
--- a/pc4mobx/hrmSalary/pages/roleManagement/components/conditions.js
+++ b/pc4mobx/hrmSalary/pages/roleManagement/components/conditions.js
@@ -233,17 +233,22 @@ export const roleSearchConditions = [
viewAttr: 2
},
{
- conditionType: "SELECT",
+ browserConditionParam: {
+ completeURL: "",
+ dataParams: { filterType: "" },
+ filterByName: true,
+ tableProps: {},
+ isSingle: false,
+ treeSelect: true,
+ searchParamsKey: "name"
+ },
+ conditionType: "CUSTOMBROWSER",
domkey: ["pages"],
fieldcol: 16,
label: "页面",
lanId: 111,
labelcol: 8,
- multiple: true,
- options: [
- { key: "query", showname: "查询", lanId: 111 },
- { key: "admin", showname: "管理", lanId: 111 }
- ],
+ treeData: [],
value: "",
viewAttr: 2
}
diff --git a/pc4mobx/hrmSalary/pages/roleManagement/index.js b/pc4mobx/hrmSalary/pages/roleManagement/index.js
index 28ab4f22..f379e1de 100644
--- a/pc4mobx/hrmSalary/pages/roleManagement/index.js
+++ b/pc4mobx/hrmSalary/pages/roleManagement/index.js
@@ -47,7 +47,8 @@ class Index extends Component {
opts: !_.isEmpty(advanceForm.getFormParams()["opts"]) ? advanceForm.getFormParams()["opts"].split(",") : [],
roleEmpIds: !_.isEmpty(advanceForm.getFormParams()["roleEmpIds"]) ? advanceForm.getFormParams()["roleEmpIds"].split(",") : [],
sobIds: !_.isEmpty(advanceForm.getFormParams()["sobIds"]) ? advanceForm.getFormParams()["sobIds"].split(",") : [],
- taxAgentIds: !_.isEmpty(advanceForm.getFormParams()["taxAgentIds"]) ? advanceForm.getFormParams()["taxAgentIds"].split(",") : []
+ taxAgentIds: !_.isEmpty(advanceForm.getFormParams()["taxAgentIds"]) ? advanceForm.getFormParams()["taxAgentIds"].split(",") : [],
+ pages: !_.isEmpty(advanceForm.getFormParams()["pages"]) ? advanceForm.getFormParams()["pages"].split(",") : []
};
this.setState({ loading: true });
API.getRoleList(paylaod).then(({ status, data }) => {