feature/2.15.1.2407.01-权限
This commit is contained in:
parent
a56ee784db
commit
34bf2c8c52
|
|
@ -39,23 +39,28 @@ class AssociativeSearchMult extends Component {
|
|||
};
|
||||
getData = (name = "") => {
|
||||
const { browserConditionParam } = this.props;
|
||||
const { completeURL, searchParamsKey, convertDatasource, dataParams = {} } = browserConditionParam;
|
||||
const {
|
||||
completeURL, filterByName, searchParamsKey, convertDatasource, dataParams = {}
|
||||
} = browserConditionParam;
|
||||
if (_.trim(name)) {
|
||||
postFetch(completeURL, { ...dataParams, [searchParamsKey]: name, current: 1, pageSize: 9999 })
|
||||
.then(({ status, data }) => {
|
||||
this.setState({ loading: false });
|
||||
if (status && data.list) {
|
||||
this.setState({
|
||||
data: convertDatasource ? convertDatasource(data.list) : data.list,
|
||||
activeKey: this.getActiveKey(convertDatasource ? convertDatasource(data.list) : data.list)
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
data: _.map(data, o => ({ ...o, id: String(o.id), name: o.name })),
|
||||
activeKey: this.getActiveKey(data)
|
||||
});
|
||||
}
|
||||
});
|
||||
let payload = { ...dataParams };
|
||||
searchParamsKey && (payload = { ...payload, [searchParamsKey]: name, current: 1, pageSize: 9999 });
|
||||
postFetch(completeURL, payload).then(({ status, data }) => {
|
||||
this.setState({ loading: false });
|
||||
if (status && data.list) {
|
||||
this.setState({
|
||||
data: convertDatasource ? convertDatasource(data.list) : data.list,
|
||||
activeKey: this.getActiveKey(convertDatasource ? convertDatasource(data.list) : data.list)
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
data: filterByName ? _.filter(_.map(data, o => ({
|
||||
...o, id: String(o.id), name: o.name
|
||||
})), k => k.name.indexOf(name) !== -1) : _.map(data, o => ({ ...o, id: String(o.id), name: o.name })),
|
||||
activeKey: this.getActiveKey(data)
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.setState({ data: [], loading: false, activeKey: "" });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,15 +22,20 @@ class CustomBrowserDialog extends Component {
|
|||
super(props);
|
||||
this.state = {
|
||||
loading: false, listDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, selectedRowKeys: [],
|
||||
query: { [props.searchParamsKey]: "" }
|
||||
query: { [props.searchParamsKey]: "" },
|
||||
leftListSelectedKeys: [], // 左侧table选择的keys
|
||||
leftListSelectedData: [], // 左侧table选择的数据
|
||||
rightCheckedKeys: [], //右侧选择的keys
|
||||
rightDatas: [] // 右侧展示的数据
|
||||
};
|
||||
this.selectedData = {};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getData();
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) this.setState({ selectedRowKeys: nextProps.selectedValues });
|
||||
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||
this.getData();
|
||||
this.setState({ selectedRowKeys: nextProps.selectedValues });
|
||||
} else {
|
||||
this.setState({ pageInfo: { current: 1, pageSize: 10, total: 0 } });
|
||||
this.selectedData = {};
|
||||
}
|
||||
|
|
@ -85,16 +90,70 @@ class CustomBrowserDialog extends Component {
|
|||
}
|
||||
};
|
||||
|
||||
onLeftListCheck = (keys, datas) => {
|
||||
const { leftListSelectedData } = this.state;
|
||||
let targets = leftListSelectedData.concat(datas);
|
||||
targets = _.uniqBy(targets, "id");
|
||||
targets = targets.filter((t) => keys.indexOf(t["id"]) > -1);
|
||||
this.setState({ leftListSelectedKeys: keys, leftListSelectedData: targets });
|
||||
};
|
||||
onleftDoubleClick = (data) => {
|
||||
const { rightDatas } = this.state;
|
||||
this.setState({
|
||||
rightDatas: rightDatas.concat(data),
|
||||
rightCheckedKeys: [],
|
||||
leftListSelectedData: [],
|
||||
leftListSelectedKeys: []
|
||||
});
|
||||
};
|
||||
moveTo = (direction) => {
|
||||
const { rightDatas, rightCheckedKeys, listDatas, leftListSelectedData } = this.state;
|
||||
if (direction === "right") {
|
||||
this.setState({
|
||||
rightDatas: rightDatas.concat(leftListSelectedData),
|
||||
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") {
|
||||
this.setState({ rightDatas: [], rightCheckedKeys: [] });
|
||||
this.onCountChange(rds);
|
||||
}
|
||||
|
||||
if (direction === "allToRight") {
|
||||
if (this.leftListAllActive()) {
|
||||
rds = rightDatas.concat(listDatas);
|
||||
this.setState({
|
||||
rightDatas: rds,
|
||||
rightCheckedKeys: [],
|
||||
leftListSelectedData: [],
|
||||
leftTreeCheckedData: [],
|
||||
leftTreeCheckedKeys: [],
|
||||
leftListSelectedKeys: []
|
||||
});
|
||||
}
|
||||
this.onCountChange(rds);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { loading, listDatas, pageInfo, selectedRowKeys, query } = this.state;
|
||||
const { loading, listDatas, pageInfo, selectedRowKeys, query, leftListSelectedKeys, rightDatas } = 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="ghost" onClick={this.handleClear}>{getLabel(111, "清 除")}</Button>,
|
||||
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(111, "取 消")}</Button>];
|
||||
let rightActive = false;
|
||||
if (leftListSelectedKeys && leftListSelectedKeys.length > 0) rightActive = true;
|
||||
let dom = <Spin spinning={loading}>
|
||||
<div style={{ padding: 10, height: "100%" }}>
|
||||
<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>
|
||||
|
|
@ -102,16 +161,26 @@ class CustomBrowserDialog extends Component {
|
|||
<div>
|
||||
<WeaNewScroll height={sheight}>
|
||||
<CustomBrowserMutiLeft
|
||||
filterData={rightDatas}
|
||||
datas={listDatas}
|
||||
onDoubleClick={this.onleftDoubleClick}
|
||||
onClick={this.onLeftListCheck}
|
||||
selectedKeys={leftListSelectedKeys}
|
||||
/>
|
||||
</WeaNewScroll>
|
||||
</div>
|
||||
</div>
|
||||
<div className="wea-transfer-opration">
|
||||
<CustomBrowserOperation/>
|
||||
<CustomBrowserOperation
|
||||
rightActive={rightActive}
|
||||
moveToRight={() => this.moveTo("right")}
|
||||
/>
|
||||
</div>
|
||||
<div className="wea-hr-muti-input-right">
|
||||
<CustomBrowserMutiRight height={sheight}/>
|
||||
<CustomBrowserMutiRight
|
||||
height={sheight}
|
||||
data={rightDatas}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Spin>;
|
||||
|
|
|
|||
|
|
@ -12,11 +12,51 @@ import { WeaLocaleProvider } from "ecCom";
|
|||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
let timeout = null;
|
||||
|
||||
class CustomBrowserMutiLeft extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.dataObj = {};
|
||||
}
|
||||
|
||||
onClick = (data) => {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
let { selectedKeys } = this.props;
|
||||
let keys = selectedKeys ? [...selectedKeys] : [];
|
||||
let datas = [];
|
||||
if (keys.indexOf(data.id) > -1) {
|
||||
keys = keys.filter((k) => k !== data.id);
|
||||
} else {
|
||||
keys.push(data.id);
|
||||
}
|
||||
keys.forEach((k) => this.dataObj[k] && datas.push(this.dataObj[k]));
|
||||
this.props.onClick && this.props.onClick(keys, datas);
|
||||
}, 200);
|
||||
};
|
||||
onDoubleClick = (data) => {
|
||||
clearTimeout(timeout);
|
||||
this.props.onDoubleClick && this.props.onDoubleClick([data]);
|
||||
};
|
||||
cls = (item) => {
|
||||
const { selectedKeys, filterData } = this.props;
|
||||
let cls = [];
|
||||
if (selectedKeys && selectedKeys.indexOf(item.id) > -1) {
|
||||
cls.push("selected");
|
||||
}
|
||||
if (filterData && filterData.filter((d) => d.id === item.id).length > 0) {
|
||||
cls.push("hide");
|
||||
}
|
||||
return cls.join(" ");
|
||||
};
|
||||
|
||||
render() {
|
||||
const { datas } = this.props;
|
||||
const { datas, selectedKeys } = this.props;
|
||||
const list = datas.map(item => {
|
||||
return <li>
|
||||
this.dataObj[item.id] = item;
|
||||
return <li className={this.cls(item)} onClick={() => this.onClick(item)}
|
||||
onDoubleClick={() => this.onDoubleClick(item)}>
|
||||
<div className="item-wrap" style={{ fontSize: 12 }}> {item.name} </div>
|
||||
<div className="icon-wrap"/>
|
||||
<i className="icon-coms-Selected"/>
|
||||
|
|
|
|||
|
|
@ -15,24 +15,55 @@ const getLabel = WeaLocaleProvider.getLabel;
|
|||
const TreeNode = Tree.TreeNode;
|
||||
|
||||
class CustomBrowserMutiRight extends Component {
|
||||
generateTreeNodes = () => {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
key: ""
|
||||
};
|
||||
this.nodeIds = [];
|
||||
this.nodeObj = {};
|
||||
}
|
||||
|
||||
generateTreeNodes = () => {
|
||||
const { data } = this.props, { key } = this.state;
|
||||
const treeNodes = [];
|
||||
let showData = [...data];
|
||||
if (_.trim(key)) {
|
||||
showData = showData.filter((item) => {
|
||||
return item.name.indexOf(_.trim(key)) > -1;
|
||||
});
|
||||
}
|
||||
showData = _.uniqBy(showData, "id");
|
||||
this.nodeIds = [];
|
||||
this.nodeObj = {};
|
||||
showData.map((item) => {
|
||||
let title = (
|
||||
<div>
|
||||
<div className="item-wrap" style={{ whiteSpace: "normal" }}>
|
||||
<div className="item-top">
|
||||
<span style={{ marginRight: "5px" }}>{item.name}</span>
|
||||
</div>
|
||||
<div className="item-bottom"></div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
treeNodes.push(<TreeNode title={title} key={item["id"]} isLeaf={true}/>);
|
||||
this.nodeIds.push(item["id"]);
|
||||
this.nodeObj[item["id"]] = item;
|
||||
});
|
||||
return treeNodes;
|
||||
};
|
||||
|
||||
render() {
|
||||
const { height } = this.props;
|
||||
return (
|
||||
<div className="wea-transfer-right">
|
||||
<WeaInputSearch/>
|
||||
<WeaInputSearch placeholder={getLabel(111, "请输入关键字搜索")} value={this.state.key}/>
|
||||
<div>
|
||||
<WeaNewScroll height={height || 400}>
|
||||
{/*<Tree className="transfer-tree"*/}
|
||||
{/* draggable*/}
|
||||
{/* multiple={true}*/}
|
||||
{/* async={true}*/}
|
||||
{/* selectable={true}>*/}
|
||||
{/* {this.generateTreeNodes()}*/}
|
||||
{/*</Tree>*/}
|
||||
<Tree className="transfer-tree" draggable multiple={true} async={true} selectable={true}>
|
||||
{this.generateTreeNodes()}
|
||||
</Tree>
|
||||
</WeaNewScroll>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ class Index extends Component {
|
|||
selectedData: ((isSingle || browserConditionParam.isSingle) && !_.isEmpty(values)) ? { [_.last(values)]: datas[_.last(values)] } : datas
|
||||
}, () => {
|
||||
this.props.onChange && this.props.onChange(values.join(","));
|
||||
this.props.onCustomChange && this.props.onCustomChange(this.state.selectedData);
|
||||
if (form) {
|
||||
form.updateFields({
|
||||
[getKey(fieldConfig)]: { value: this.state.searchKeys.join(",") }
|
||||
|
|
|
|||
|
|
@ -11,12 +11,14 @@
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
.wea-input-focus {
|
||||
height: 35px !important;
|
||||
//width: 100% !important;
|
||||
.wea-hr-muti-dialog {
|
||||
.wea-input-focus {
|
||||
height: 35px !important;
|
||||
width: 100% !important;
|
||||
|
||||
input {
|
||||
height: 100% !important;
|
||||
input {
|
||||
height: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ class Index extends Component {
|
|||
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 }) => {
|
||||
this.setState({ loading: false });
|
||||
|
|
@ -60,20 +63,23 @@ class Index extends Component {
|
|||
}
|
||||
});
|
||||
};
|
||||
handleFormChange=(val)=>{
|
||||
console.log(val)
|
||||
}
|
||||
|
||||
render() {
|
||||
const { conditions, loading, roleSetDialog } = this.state;
|
||||
const { taxAgentStore: { roleForm } } = this.props;
|
||||
return (
|
||||
<WeaDialog
|
||||
{...this.props} style={{ width: 480, height: 147 }} initLoadCss title={getLabel(111, "添加角色")}
|
||||
{...this.props} style={{ width: 520 }} initLoadCss title={getLabel(111, "添加角色")}
|
||||
buttons={[
|
||||
<Button type="primary" loading={loading} onClick={() => this.save()}>{getLabel(111, "保存")}</Button>,
|
||||
<Button type="primary" loading={loading}
|
||||
onClick={() => this.save(true)}>{getLabel(111, "保存并进入详细设置")}</Button>
|
||||
]}
|
||||
>
|
||||
<div className="form-dialog-layout">{getSearchs(roleForm, conditions, 1, false)}</div>
|
||||
<div className="form-dialog-layout">{getSearchs(roleForm, conditions, 1, false, this.handleFormChange)}</div>
|
||||
</WeaDialog>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ export const roleConditions = [
|
|||
{
|
||||
conditionType: "INPUT",
|
||||
domkey: ["name"],
|
||||
fieldcol: 14,
|
||||
fieldcol: 16,
|
||||
label: "名称",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
|
|
@ -13,29 +13,39 @@ export const roleConditions = [
|
|||
viewAttr: 3
|
||||
},
|
||||
{
|
||||
browserConditionParam: {},
|
||||
browserConditionParam: {
|
||||
completeURL: "/api/bs/hrmsalary/salarysob/listAll",
|
||||
filterByName: true,
|
||||
tableProps: {},
|
||||
isSingle: false
|
||||
},
|
||||
conditionType: "CUSTOMBROWSER",
|
||||
domkey: ["taxAgentIds"],
|
||||
fieldcol: 14,
|
||||
fieldcol: 16,
|
||||
label: "个税扣缴义务人",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
viewAttr: 2
|
||||
rules: "required|string",
|
||||
viewAttr: 3
|
||||
},
|
||||
{
|
||||
browserConditionParam: {},
|
||||
browserConditionParam: {
|
||||
tableProps: {},
|
||||
isSingle: false
|
||||
},
|
||||
conditionType: "CUSTOMBROWSER",
|
||||
domkey: ["sobIds"],
|
||||
fieldcol: 14,
|
||||
fieldcol: 16,
|
||||
label: "薪资账套",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
viewAttr: 2
|
||||
rules: "required|string",
|
||||
viewAttr: 3
|
||||
},
|
||||
{
|
||||
conditionType: "TEXTAREA",
|
||||
domkey: ["description"],
|
||||
fieldcol: 14,
|
||||
fieldcol: 16,
|
||||
label: "描述",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@
|
|||
padding: 16px;
|
||||
}
|
||||
|
||||
.wea-content:not(.wea-associative-search) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
.wea-select, .ant-select-selection, .ant-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ export const getSearchs = (form, condition, col, isCenter, onChange = () => void
|
|||
>
|
||||
{
|
||||
fields.conditionType === "CUSTOMBROWSER" ?
|
||||
<CustomBrowser fieldConfig={fields} onChange={onChange} form={form} formParams={formParams}/> :
|
||||
<CustomBrowser fieldConfig={fields} onCustomChange={onChange} form={form} formParams={formParams}/> :
|
||||
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams} onChange={onChange}/>
|
||||
}
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue