feature/2.15.1.2407.01-权限
This commit is contained in:
parent
2d15f19ddd
commit
fd188c9f51
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<span className={`${clsname}`} ref="treeSelectWrapperMui"><TreeSelect {...tProps} /></span>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default AssociativeTreeMult;
|
||||
|
|
@ -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 (<div>
|
||||
<AssociativeSearchMult
|
||||
{...fieldConfig}
|
||||
{...this.props}
|
||||
datas={selectedData}
|
||||
selectedValues={searchKeys}
|
||||
onChange={this.onBrowerChangeHandler}
|
||||
clickCallback={this.onBrowerClick}
|
||||
/>
|
||||
{
|
||||
browserConditionParam.treeSelect ?
|
||||
<AssociativeTreeMult
|
||||
{...fieldConfig}
|
||||
{...this.props}
|
||||
datas={selectedData}
|
||||
selectedValues={searchKeys}
|
||||
onChange={this.onBrowerChangeHandler}
|
||||
/> :
|
||||
<AssociativeSearchMult
|
||||
{...fieldConfig}
|
||||
{...this.props}
|
||||
datas={selectedData}
|
||||
selectedValues={searchKeys}
|
||||
onChange={this.onBrowerChangeHandler}
|
||||
clickCallback={this.onBrowerClick}
|
||||
/>
|
||||
}
|
||||
</div>);
|
||||
};
|
||||
onBrowerChangeHandler = (values, datas) => {
|
||||
|
|
|
|||
|
|
@ -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(",") };
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 }) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue