feature/2.15.1.2407.01-权限
This commit is contained in:
parent
34bf2c8c52
commit
9759a529f5
|
|
@ -34,9 +34,15 @@ class CustomBrowserDialog extends Component {
|
|||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||
this.getData();
|
||||
this.setState({ selectedRowKeys: nextProps.selectedValues });
|
||||
this.setState({
|
||||
selectedRowKeys: nextProps.selectedValues,
|
||||
leftListSelectedData: _.values(nextProps.datas), rightDatas: _.values(nextProps.datas)
|
||||
});
|
||||
} else {
|
||||
this.setState({ pageInfo: { current: 1, pageSize: 10, total: 0 } });
|
||||
this.setState({
|
||||
pageInfo: { current: 1, pageSize: 10, total: 0 }, query: { [this.props.searchParamsKey]: "" },
|
||||
rightDatas: [], rightCheckedKeys: [], leftListSelectedData: [], leftListSelectedKeys: []
|
||||
});
|
||||
this.selectedData = {};
|
||||
}
|
||||
}
|
||||
|
|
@ -44,7 +50,7 @@ class CustomBrowserDialog extends Component {
|
|||
getData = () => {
|
||||
const { pageInfo, query } = this.state;
|
||||
const { dialogType, completeURL, convertDatasource, dataParams = {} } = this.props;
|
||||
let payload = { ...dataParams };
|
||||
let payload = { ...dataParams, ...query };
|
||||
dialogType === "table" && (payload = { ...pageInfo, ...payload, ...query });
|
||||
this.setState({ loading: true });
|
||||
postFetch(completeURL, payload).then(({ status, data }) => {
|
||||
|
|
@ -56,7 +62,7 @@ class CustomBrowserDialog extends Component {
|
|||
pageInfo: { ...pageInfo, current, pageSize, total }
|
||||
});
|
||||
} else {
|
||||
this.setState({ listDatas: data });
|
||||
this.setState({ listDatas: _.map(data, o => ({ ...o, id: String(o.id) })) });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -72,12 +78,13 @@ class CustomBrowserDialog extends Component {
|
|||
this.props.onChange && this.props.onChange([], {});
|
||||
};
|
||||
handleOk = () => {
|
||||
const { selectedRowKeys } = this.state;
|
||||
selectedRowKeys.forEach((v) => {
|
||||
const { selectedRowKeys, rightDatas } = this.state, { dialogType } = this.props;
|
||||
const convertSelectedRowKeys = dialogType !== "table" ? rightDatas.map((v) => v.id) : selectedRowKeys;
|
||||
convertSelectedRowKeys.forEach((v) => {
|
||||
let item = this.getItemById(v);
|
||||
if (item) this.selectedData[v] = item;
|
||||
});
|
||||
this.props.onChange && this.props.onChange(selectedRowKeys, this.selectedData);
|
||||
this.props.onChange && this.props.onChange(convertSelectedRowKeys, this.selectedData);
|
||||
this.props.onCancel && this.props.onCancel();
|
||||
};
|
||||
getItemById = (id) => {
|
||||
|
|
@ -85,7 +92,7 @@ class CustomBrowserDialog extends Component {
|
|||
if (this.selectedData[id]) return this.selectedData[id];
|
||||
if (!_.isEmpty(listDatas)) {
|
||||
for (let i = 0; i < listDatas.length; i++) {
|
||||
if (id === listDatas[i].id) return listDatas[i];
|
||||
if (String(id) === String(listDatas[i].id)) return listDatas[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -106,6 +113,11 @@ class CustomBrowserDialog extends Component {
|
|||
leftListSelectedKeys: []
|
||||
});
|
||||
};
|
||||
onRightDoubleClick = (key) => {
|
||||
const { rightDatas } = this.state;
|
||||
const newRightDatas = rightDatas.filter(item => String(item.id) !== key);
|
||||
this.setState({ rightDatas: newRightDatas, rightCheckedKeys: [] });
|
||||
};
|
||||
moveTo = (direction) => {
|
||||
const { rightDatas, rightCheckedKeys, listDatas, leftListSelectedData } = this.state;
|
||||
if (direction === "right") {
|
||||
|
|
@ -114,49 +126,58 @@ class CustomBrowserDialog extends Component {
|
|||
leftListSelectedData: [],
|
||||
leftListSelectedKeys: []
|
||||
});
|
||||
}
|
||||
if (direction === "left") {
|
||||
rds = rightDatas.filter(item => !rightCheckedKeys.some(checkedKey => item[inputId] === checkedKey));
|
||||
this.setState({ rightDatas: rds, rightCheckedKeys: [] });
|
||||
this.onCountChange(rds);
|
||||
}
|
||||
|
||||
if (direction === "allToLeft") {
|
||||
} else if (direction === "left") {
|
||||
this.setState({
|
||||
rightDatas: rightDatas.filter(item => !rightCheckedKeys.some(checkedKey => String(item.id) === checkedKey)),
|
||||
rightCheckedKeys: []
|
||||
});
|
||||
} else if (direction === "allToLeft") {
|
||||
this.setState({ rightDatas: [], rightCheckedKeys: [] });
|
||||
this.onCountChange(rds);
|
||||
}
|
||||
|
||||
if (direction === "allToRight") {
|
||||
} else if (direction === "allToRight") {
|
||||
if (this.leftListAllActive()) {
|
||||
rds = rightDatas.concat(listDatas);
|
||||
this.setState({
|
||||
rightDatas: rds,
|
||||
rightDatas: rightDatas.concat(listDatas),
|
||||
rightCheckedKeys: [],
|
||||
leftListSelectedData: [],
|
||||
leftTreeCheckedData: [],
|
||||
leftTreeCheckedKeys: [],
|
||||
leftListSelectedKeys: []
|
||||
});
|
||||
}
|
||||
this.onCountChange(rds);
|
||||
}
|
||||
};
|
||||
leftListAllActive = () => {
|
||||
const { rightDatas, listDatas } = this.state;
|
||||
let bool = true;
|
||||
if (_.isEmpty(listDatas)) bool = false;
|
||||
if (!_.isEmpty(listDatas) && !_.isEmpty(rightDatas)) {
|
||||
bool = listDatas.filter((l) => !rightDatas.some(r => l.id === r.id)).length !== 0;
|
||||
}
|
||||
return bool;
|
||||
};
|
||||
|
||||
render() {
|
||||
const { loading, listDatas, pageInfo, selectedRowKeys, query, leftListSelectedKeys, rightDatas } = this.state;
|
||||
const {
|
||||
loading, listDatas, pageInfo, selectedRowKeys, query, leftListSelectedKeys, rightDatas, rightCheckedKeys
|
||||
} = this.state;
|
||||
const { dialogType, tableProps: { rowKey, columns }, isSingle, searchParamsKey } = this.props;
|
||||
const sheight = this.dialog ? this.dialog.state.height - 55 : 260;
|
||||
const buttons = [
|
||||
<Button type="primary" onClick={this.handleOk}>{getLabel(111, "确 定")}</Button>,
|
||||
<Button type="primary" onClick={this.handleOk}
|
||||
disabled={dialogType !== "table" && _.isEmpty(rightDatas)}>{getLabel(111, "确 定")}</Button>,
|
||||
<Button type="ghost" onClick={this.handleClear}>{getLabel(111, "清 除")}</Button>,
|
||||
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(111, "取 消")}</Button>];
|
||||
let rightActive = false;
|
||||
let rightActive = false, leftActive = false, rightAllActive = false;
|
||||
if (leftListSelectedKeys && leftListSelectedKeys.length > 0) rightActive = true;
|
||||
if (rightCheckedKeys && rightCheckedKeys.length > 0) leftActive = true;
|
||||
if (rightDatas && rightDatas.length > 0) rightAllActive = true;
|
||||
let dom = <Spin spinning={loading}>
|
||||
<div style={{ padding: 10, height: "100%" }} className="wea-hr-muti-dialog">
|
||||
<div className="wea-hr-muti-input-left">
|
||||
<Row style={{ height: 35 }}>
|
||||
<Col span="24"> <WeaInputSearch/> </Col>
|
||||
<Col span="24">
|
||||
<WeaInputSearch value={query[searchParamsKey]} onSearch={this.getData}
|
||||
onChange={value => this.setState({ query: { ...query, [searchParamsKey]: value } })}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<div>
|
||||
<WeaNewScroll height={sheight}>
|
||||
|
|
@ -173,13 +194,20 @@ class CustomBrowserDialog extends Component {
|
|||
<div className="wea-transfer-opration">
|
||||
<CustomBrowserOperation
|
||||
rightActive={rightActive}
|
||||
leftActive={leftActive}
|
||||
leftAllActive={this.leftListAllActive()}
|
||||
rightAllActive={rightAllActive}
|
||||
moveToRight={() => this.moveTo("right")}
|
||||
moveToLeft={() => this.moveTo("left")}
|
||||
moveAllToRight={() => this.moveTo("allToRight")}
|
||||
moveAllToLeft={() => this.moveTo("allToLeft")}
|
||||
/>
|
||||
</div>
|
||||
<div className="wea-hr-muti-input-right">
|
||||
<CustomBrowserMutiRight
|
||||
height={sheight}
|
||||
data={rightDatas}
|
||||
height={sheight} data={rightDatas} checkedKeys={rightCheckedKeys}
|
||||
checkedCb={rightCheckedKeys => this.setState({ rightCheckedKeys })}
|
||||
onDoubleClick={this.onRightDoubleClick}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import { Tree } from "antd";
|
|||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
const TreeNode = Tree.TreeNode;
|
||||
|
||||
let timeout = null;
|
||||
|
||||
class CustomBrowserMutiRight extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
|
@ -53,15 +55,30 @@ class CustomBrowserMutiRight extends Component {
|
|||
});
|
||||
return treeNodes;
|
||||
};
|
||||
handleSearchChange = (v) => this.setState({ key: v });
|
||||
checkHandler = (v) => {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
this.props.checkedCb && this.props.checkedCb(v);
|
||||
}, 200);
|
||||
};
|
||||
onDoubleClick = (key) => {
|
||||
clearTimeout(timeout);
|
||||
this.props.onDoubleClick && this.props.onDoubleClick(key);
|
||||
};
|
||||
|
||||
render() {
|
||||
const { height } = this.props;
|
||||
const { height, checkedKeys } = this.props;
|
||||
return (
|
||||
<div className="wea-transfer-right">
|
||||
<WeaInputSearch placeholder={getLabel(111, "请输入关键字搜索")} value={this.state.key}/>
|
||||
<WeaInputSearch placeholder={getLabel(111, "请输入关键字搜索")} value={this.state.key}
|
||||
onSearchChange={_.debounce(this.handleSearchChange, 200)}/>
|
||||
<div>
|
||||
<WeaNewScroll height={height || 400}>
|
||||
<Tree className="transfer-tree" draggable multiple={true} async={true} selectable={true}>
|
||||
<Tree className="transfer-tree" draggable multiple={true} async={true} selectable={true}
|
||||
onSelect={this.checkHandler}
|
||||
onDoubleClick={this.onDoubleClick}
|
||||
selectedKeys={checkedKeys}>
|
||||
{this.generateTreeNodes()}
|
||||
</Tree>
|
||||
</WeaNewScroll>
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ class CustomBrowserOperation extends Component {
|
|||
|
||||
const moveAllToLeftButton = (
|
||||
<Button type="primary" size="small" disabled={!leftAllActive} onClick={moveAllToRight}>
|
||||
{<span><i className="icon-coms-Browse-box-add-all"/></span>}
|
||||
{<span title={getLabel(111, "将当页数据全部添加到右侧已选列表")}><i className="icon-coms-right"/></span>}
|
||||
</Button>
|
||||
);
|
||||
const moveAllToRightButton = (
|
||||
<Button type="primary" size="small" disabled={!rightAllActive} onClick={moveAllToLeft}>
|
||||
{<span><i className="icon-coms-Browse-box-Delete-all"/></span>}
|
||||
{<span title={getLabel(111, "全部删除")}><i className="icon-coms-Browse-box-Delete-all"/></span>}
|
||||
</Button>
|
||||
);
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -30,15 +30,21 @@ class Index extends Component {
|
|||
|
||||
componentDidMount() {
|
||||
const { value, fieldConfig } = this.props;
|
||||
const { browserConditionParam: { replaceDatas = [] } } = fieldConfig;
|
||||
if (value && replaceDatas.length > 0) {
|
||||
const { value: defaultValue, browserConditionParam: { replaceDatas = [] } } = fieldConfig;
|
||||
if ((value || defaultValue) && replaceDatas.length > 0) {
|
||||
this.setState({
|
||||
searchKeys: value.split(","),
|
||||
searchKeys: (value || defaultValue).split(","),
|
||||
selectedData: _.reduce(replaceDatas, (pre, cur) => ({ ...pre, [cur["id"]]: cur }), {})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.value !== this.props.value && _.isEmpty(nextProps.value)) {
|
||||
this.setState({ searchKeys: [], selectedData: [] });
|
||||
}
|
||||
}
|
||||
|
||||
renderSingle = () => {
|
||||
const { fieldConfig } = this.props;
|
||||
const { selectedData, searchKeys } = this.state;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Index extends Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
conditions: [], loading: false
|
||||
conditions: [], loading: false, formData: { taxAgentIds: [], sobIds: [] }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -40,15 +40,13 @@ class Index extends Component {
|
|||
}
|
||||
|
||||
save = (isSetting) => {
|
||||
const { taxAgentStore: { roleForm }, taxAgentId } = this.props;
|
||||
const { taxAgentStore: { roleForm } } = this.props;
|
||||
const { formData } = this.state;
|
||||
roleForm.validateForm().then(f => {
|
||||
if (f.isValid) {
|
||||
const payload = roleForm.getFormParams();
|
||||
|
||||
console.log(payload,roleForm.getFormDatas())
|
||||
return
|
||||
this.setState({ loading: true });
|
||||
API.saveAuthRole({ ...payload, taxAgentId }).then(({ status, data, errormsg }) => {
|
||||
API.saveAuthRole({ ...payload, ...formData }).then(({ status, data, errormsg }) => {
|
||||
this.setState({ loading: false });
|
||||
if (status) {
|
||||
message.success(getLabel(111, "操作成功!"));
|
||||
|
|
@ -63,16 +61,19 @@ class Index extends Component {
|
|||
}
|
||||
});
|
||||
};
|
||||
handleFormChange=(val)=>{
|
||||
console.log(val)
|
||||
}
|
||||
handleFormChange = (val) => {
|
||||
const key = _.keys(val)[0];
|
||||
if (key === "taxAgentIds" || key === "sobIds") {
|
||||
this.setState({ formData: { ...this.state.formData, ...val } });
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { conditions, loading, roleSetDialog } = this.state;
|
||||
const { taxAgentStore: { roleForm } } = this.props;
|
||||
return (
|
||||
<WeaDialog
|
||||
{...this.props} style={{ width: 520 }} initLoadCss title={getLabel(111, "添加角色")}
|
||||
{...this.props} style={{ width: 520 }} initLoadCss title={getLabel(111, "添加角色")} className="role-dialog"
|
||||
buttons={[
|
||||
<Button type="primary" loading={loading} onClick={() => this.save()}>{getLabel(111, "保存")}</Button>,
|
||||
<Button type="primary" loading={loading}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ export const roleConditions = [
|
|||
},
|
||||
{
|
||||
browserConditionParam: {
|
||||
completeURL: "/api/bs/hrmsalary/salarysob/listAll",
|
||||
completeURL: "/api/bs/hrmsalary/taxAgent/listAuth",
|
||||
dataParams: { filterType: "QUERY_DATA" },
|
||||
filterByName: true,
|
||||
tableProps: {},
|
||||
isSingle: false
|
||||
isSingle: false,
|
||||
searchParamsKey: "name"
|
||||
},
|
||||
conditionType: "CUSTOMBROWSER",
|
||||
domkey: ["taxAgentIds"],
|
||||
|
|
@ -30,8 +32,12 @@ export const roleConditions = [
|
|||
},
|
||||
{
|
||||
browserConditionParam: {
|
||||
completeURL: "/api/bs/hrmsalary/salarysob/listAuth",
|
||||
dataParams: { filterType: "QUERY_DATA" },
|
||||
filterByName: true,
|
||||
tableProps: {},
|
||||
isSingle: false
|
||||
isSingle: false,
|
||||
searchParamsKey: "name"
|
||||
},
|
||||
conditionType: "CUSTOMBROWSER",
|
||||
domkey: ["sobIds"],
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
display: table;
|
||||
width: 100%;
|
||||
|
||||
& > div {
|
||||
& > div:last-child {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
|
@ -95,3 +95,11 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.role-dialog {
|
||||
.form-dialog-layout {
|
||||
.ant-select-selection {
|
||||
height: auto !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* 编辑橘色操作者
|
||||
* 编辑角色操作者
|
||||
*
|
||||
* @Author: 黎永顺
|
||||
* @Date: 2024/8/20
|
||||
|
|
@ -23,7 +23,7 @@ class EditRoleDialog extends Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
conditions: [], loading: false
|
||||
conditions: [], loading: false, targetSob: {}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +55,15 @@ class EditRoleDialog extends Component {
|
|||
...o, startValue: nextProps.record[getKey(o)].split("-")[0],
|
||||
endValue: nextProps.record[getKey(o)].split("-")[1],
|
||||
conditionType: "SCOPE", precision: 0
|
||||
} : nextProps.record.targetType === "SOB" ? {
|
||||
...o, value: nextProps.record["target"],
|
||||
conditionType: "CUSTOMBROWSER", browserConditionParam: {
|
||||
completeURL: "/api/bs/hrmsalary/salarysob/listAuth",
|
||||
dataParams: { filterType: "QUERY_DATA" },
|
||||
filterByName: true, isSingle: true,
|
||||
tableProps: {}, searchParamsKey: "name",
|
||||
replaceDatas: [{ id: nextProps.record["target"], name: nextProps.record["targetName"] }]
|
||||
}
|
||||
} : { ...o };
|
||||
break;
|
||||
default:
|
||||
|
|
@ -65,7 +74,10 @@ class EditRoleDialog extends Component {
|
|||
}))
|
||||
}, () => nextProps.taxAgentStore.roleOperatorForm.initFormFields(this.state.conditions));
|
||||
}
|
||||
if (nextProps.visible !== this.props.visible && !nextProps.visible) nextProps.taxAgentStore.initRoleOperatorForm();
|
||||
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
||||
this.setState({ targetSob: {} });
|
||||
nextProps.taxAgentStore.initRoleOperatorForm();
|
||||
}
|
||||
if (nextProps.loading !== this.props.loading && !nextProps.loading) this.props.onCancel();
|
||||
}
|
||||
|
||||
|
|
@ -93,6 +105,7 @@ class EditRoleDialog extends Component {
|
|||
return browserType;
|
||||
};
|
||||
save = () => {
|
||||
const { targetSob } = this.state;
|
||||
const { taxAgentStore: { roleOperatorForm }, record, onChange } = this.props;
|
||||
roleOperatorForm.validateForm().then(f => {
|
||||
if (f.isValid) {
|
||||
|
|
@ -102,7 +115,7 @@ class EditRoleDialog extends Component {
|
|||
editId: record.id, sortedIndex,
|
||||
id: record.targetType === "LEVEL" ? targetName.value.join("-") : targetName.value,
|
||||
name: record.targetType === "SQL" ? __ :
|
||||
record.targetType === "LEVEL" ? __.join("-") : targetName.valueSpan,
|
||||
record.targetType === "LEVEL" ? __.join("-") : (targetName.valueSpan || targetSob.name),
|
||||
link: link === "undefined" ? "OR" : link
|
||||
})]);
|
||||
} else {
|
||||
|
|
@ -110,6 +123,11 @@ class EditRoleDialog extends Component {
|
|||
}
|
||||
});
|
||||
};
|
||||
handleFormChange = (val) => {
|
||||
const { record } = this.props;
|
||||
const key = _.keys(val)[0];
|
||||
if (key === "targetName" && record.targetType === "SOB") this.setState({ targetSob: _.head(val[key]) });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { conditions } = this.state;
|
||||
|
|
@ -122,7 +140,9 @@ class EditRoleDialog extends Component {
|
|||
<Button type="primary" loading={loading} onClick={this.save}>{getLabel(111, "保存")}</Button>
|
||||
]}
|
||||
>
|
||||
<div className="form-dialog-layout">{getSearchs(roleOperatorForm, conditions, 1, false)}</div>
|
||||
<div className="form-dialog-layout">
|
||||
{getSearchs(roleOperatorForm, conditions, 1, false, this.handleFormChange)}
|
||||
</div>
|
||||
</WeaDialog>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
WeaDialog,
|
||||
WeaFormItem,
|
||||
WeaInput,
|
||||
WeaInputNumber,
|
||||
WeaLocaleProvider,
|
||||
WeaScope,
|
||||
WeaSelect,
|
||||
|
|
@ -26,6 +27,7 @@ import AuthTree from "./authTree";
|
|||
import * as API from "../../../../apis/taxAgent";
|
||||
import { Button, Col, message, Modal, Row } from "antd";
|
||||
import "../index.less";
|
||||
import CustomBrowser from "../../../../components/CustomBrowser";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
const APIFOX = {
|
||||
|
|
@ -46,7 +48,8 @@ class Index extends Component {
|
|||
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 },
|
||||
editOperatorDialog: { visible: false, linkOptions: [], record: {} }
|
||||
editOperatorDialog: { visible: false, linkOptions: [], record: {} },
|
||||
dataTargetSettings: { link: "OR", sortedIndex: null }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +60,10 @@ class Index extends Component {
|
|||
this.getSettingRoler(nextProps.roleId);
|
||||
});
|
||||
} else {
|
||||
this.setState({ selectedRowKeys: [], replaceDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 } });
|
||||
this.setState({
|
||||
selectedRowKeys: [], replaceDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 },
|
||||
dataTargetSettings: { link: "OR", sortedIndex: "" }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -91,18 +97,18 @@ class Index extends Component {
|
|||
}
|
||||
});
|
||||
};
|
||||
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 } });
|
||||
handleEditOperator = (record) => {
|
||||
this.setState({ editOperatorDialog: { ...this.state.editOperatorDialog, visible: true, record } });
|
||||
};
|
||||
getConnectSymbol = async () => {
|
||||
const payload = { enumClass: `com.engine.salary.enums.auth.DataLinkEnum` };
|
||||
const { data } = await commonEnumList(payload);
|
||||
const linkOptions = _.map(data, o => ({ key: o.enum, showname: o.defaultLabel }));
|
||||
this.setState({ editOperatorDialog: { ...this.state.editOperatorDialog, linkOptions } });
|
||||
};
|
||||
addOperatorSettings = () => {
|
||||
const { roleId } = this.props;
|
||||
const { selectedKey, enumType: targetType, replaceDatas } = this.state;
|
||||
const { selectedKey, enumType: targetType, replaceDatas, dataTargetSettings } = this.state;
|
||||
if (_.isEmpty(replaceDatas)) {
|
||||
Modal.warning({
|
||||
title: getLabel(111, "系统提示"),
|
||||
|
|
@ -111,8 +117,11 @@ class Index extends Component {
|
|||
return;
|
||||
}
|
||||
const payload = _.map(replaceDatas, o => ({
|
||||
roleId, targetType: o.targetType || targetType, target: o.id || "", targetName: o.name || "",
|
||||
link: o.link || "OR", sortedIndex: o.sortedIndex || 0, id: o.editId || ""
|
||||
roleId, target: o.id || "", id: o.editId || "",
|
||||
targetType: o.targetType || targetType,
|
||||
targetName: o.name || "",
|
||||
link: o.link || dataTargetSettings.link,
|
||||
sortedIndex: o.sortedIndex || dataTargetSettings.sortedIndex
|
||||
}));
|
||||
this.setState({ loading: { ...this.state.loading, set: true } });
|
||||
APIFOX[`save.${selectedKey}`](payload).then(({ status, errormsg }) => {
|
||||
|
|
@ -213,6 +222,23 @@ class Index extends Component {
|
|||
<WeaScope isMobx value={_.reduce(replaceDatas, (pre, cur) => cur.id.split("-"), [])}
|
||||
onChange={v => this.setState({ replaceDatas: [{ id: v.join("-"), name: v.join("-") }] })}/>
|
||||
</WeaFormItem>);
|
||||
case "SOB":
|
||||
return (<WeaFormItem label={getLabel(111, "薪资账套")} labelCol={{ span: 2 }} wrapperCol={{ span: 5 }}
|
||||
className="tax_role_browser_form_item">
|
||||
<CustomBrowser
|
||||
fieldConfig={{
|
||||
viewAttr: 2,
|
||||
browserConditionParam: {
|
||||
completeURL: "/api/bs/hrmsalary/salarysob/listAuth", dataParams: { filterType: "QUERY_DATA" },
|
||||
filterByName: true, tableProps: {}, isSingle: false, searchParamsKey: "name", replaceDatas
|
||||
}
|
||||
}}
|
||||
value={_.map(replaceDatas, o => (o.id))}
|
||||
onCustomChange={replaceDatas => this.setState({
|
||||
replaceDatas: _.map(_.values(replaceDatas), o => ({ id: o.id, name: o.name }))
|
||||
})}
|
||||
/>
|
||||
</WeaFormItem>);
|
||||
default:
|
||||
return (<Row className="tax_role_browser_form_item"></Row>);
|
||||
}
|
||||
|
|
@ -228,8 +254,10 @@ class Index extends Component {
|
|||
render() {
|
||||
const { roleId } = this.props;
|
||||
const {
|
||||
selectedKey, name, options, enumType, pageInfo, columns, dataSource, loading, selectedRowKeys, editOperatorDialog
|
||||
selectedKey, name, options, enumType, pageInfo, columns, dataSource, loading, selectedRowKeys, editOperatorDialog,
|
||||
dataTargetSettings
|
||||
} = this.state;
|
||||
const { linkOptions } = editOperatorDialog;
|
||||
const tabs = [
|
||||
{ title: getLabel(111, "成员"), viewcondition: "auth.MemberTargetTypeEnum" },
|
||||
{ title: getLabel(111, "权限"), viewcondition: "auth.AuthTargetTypeEnum" },
|
||||
|
|
@ -287,6 +315,7 @@ class Index extends Component {
|
|||
}, () => {
|
||||
this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getEnumList();
|
||||
this.state.selectedKey !== "auth.AuthTargetTypeEnum" && this.getSettingRoler(roleId);
|
||||
this.state.selectedKey === "auth.DataTargetTypeEnum" && this.getConnectSymbol();
|
||||
})}/>
|
||||
{
|
||||
this.state.selectedKey !== "auth.AuthTargetTypeEnum" &&
|
||||
|
|
@ -297,7 +326,30 @@ class Index extends Component {
|
|||
{
|
||||
this.state.selectedKey !== "auth.AuthTargetTypeEnum" &&
|
||||
<Row className="tax_role_operator_setting">
|
||||
<Col span={8} offset={16}>
|
||||
{
|
||||
this.state.selectedKey === "auth.DataTargetTypeEnum" &&
|
||||
<Col span={16}>
|
||||
<Row>
|
||||
<Col span={12}>
|
||||
<WeaFormItem label={getLabel(111, "连接符")} labelCol={{ span: 8 }} wrapperCol={{ span: 14 }}>
|
||||
<WeaSelect value={dataTargetSettings.link} options={linkOptions}
|
||||
onChange={link => this.setState({
|
||||
dataTargetSettings: { ...dataTargetSettings, link }
|
||||
})}/>
|
||||
</WeaFormItem>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<WeaFormItem label={getLabel(111, "顺序")} labelCol={{ span: 8 }} wrapperCol={{ span: 14 }}>
|
||||
<WeaInputNumber value={dataTargetSettings.sortedIndex}
|
||||
onChange={sortedIndex => this.setState({
|
||||
dataTargetSettings: { ...dataTargetSettings, sortedIndex }
|
||||
})}/>
|
||||
</WeaFormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
}
|
||||
<Col span={8} offset={this.state.selectedKey === "auth.DataTargetTypeEnum" ? 0 : 16}>
|
||||
<Button type="primary" loading={loading.set}
|
||||
onClick={this.addOperatorSettings}>{getLabel(111, "添加操作者设置")}</Button>
|
||||
</Col>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ class Index extends Component {
|
|||
super(props);
|
||||
this.state = {
|
||||
query: { name: "" }, dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 },
|
||||
loading: false, selectedRowKeys: [], addRoleDialog: { taxAgentId: "", visible: false }
|
||||
loading: false, selectedRowKeys: [], addRoleDialog: { taxAgentId: "", visible: false },
|
||||
roleSetDialog: { visible: false, roleId: "", name: "" }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -41,14 +42,21 @@ class Index extends Component {
|
|||
this.setState({
|
||||
dataSource, pageInfo: { ...pageInfo, current, pageSize, total },
|
||||
columns: [...columns, {
|
||||
title: getLabel(111, "操作"), width: 120, dataIndex: "action",
|
||||
title: getLabel(111, "操作"), width: 150, dataIndex: "action",
|
||||
render: (__, record) => (
|
||||
<a href="javascript:void(0)" onClick={() => this.deleteAuthRole([record.id])}>{getLabel(111, "删除")}</a>)
|
||||
<React.Fragment>
|
||||
<a href="javascript:void(0)" style={{ marginRight: 10 }}
|
||||
onClick={() => this.showRoleSetDialog(record)}>{getLabel(111, "编辑")}</a>
|
||||
<a href="javascript:void(0)"
|
||||
onClick={() => this.deleteAuthRole([record.id])}>{getLabel(111, "删除")}</a>
|
||||
</React.Fragment>
|
||||
)
|
||||
}]
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
showRoleSetDialog = (role) => this.setState({ roleSetDialog: { visible: true, roleId: role.id, name: role.name } });
|
||||
deleteAuthRole = (payload) => {
|
||||
Modal.confirm({
|
||||
title: getLabel(111, "信息确认"),
|
||||
|
|
@ -98,12 +106,12 @@ class Index extends Component {
|
|||
};
|
||||
return (
|
||||
<WeaTop
|
||||
title={getLabel(111, "角色管理")} icon={<i className="icon-coms-Flow-setting"/>}
|
||||
title={getLabel(111, "业务线管理")} icon={<i className="icon-coms-Flow-setting"/>}
|
||||
iconBgcolor="#F14A2D" buttons={buttons} className="rolemanagement-index"
|
||||
>
|
||||
<div className="rolemanagement-content">
|
||||
<WeaTable dataSource={dataSource} columns={columns} pagination={pagination} loading={loading}
|
||||
rowSelection={rowSelection} scroll={{ y: `calc(100vh - 173px)` }}/>
|
||||
rowSelection={rowSelection} scroll={{ y: `calc(100vh - 173px)` }} rowKey="id"/>
|
||||
{/*添加角色*/}
|
||||
<AddRoleDialog {...addRoleDialog} onSearch={this.getRoleList}
|
||||
showRoleSetDialog={this.showRoleSetDialog}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,6 @@
|
|||
padding: 16px;
|
||||
}
|
||||
|
||||
.wea-content:not(.wea-associative-search) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
.wea-select, .ant-select-selection, .ant-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { Spin } from "antd";
|
||||
import { WeaSwitch } from "comsMobx";
|
||||
import { WeaAlertPage, WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup } from "ecCom";
|
||||
import { WeaAlertPage, WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
|
||||
import CustomBrowser from "../components/CustomBrowser";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
const getKey = WeaTools.getKey;
|
||||
|
||||
// 获取condition的domKey值
|
||||
export const getConditionDomkeys = (condition) => {
|
||||
|
|
@ -46,7 +47,10 @@ export const getSearchs = (form, condition, col, isCenter, onChange = () => void
|
|||
>
|
||||
{
|
||||
fields.conditionType === "CUSTOMBROWSER" ?
|
||||
<CustomBrowser fieldConfig={fields} onCustomChange={onChange} form={form} formParams={formParams}/> :
|
||||
<CustomBrowser fieldConfig={fields} form={form} formParams={formParams}
|
||||
onCustomChange={val => onChange({
|
||||
[getKey(fields)]: _.map(_.values(val), o => ({ id: o.id, name: o.name }))
|
||||
})}/> :
|
||||
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams} onChange={onChange}/>
|
||||
}
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue