feature/2.15.1.2407.01-权限

This commit is contained in:
黎永顺 2024-09-27 13:38:48 +08:00
parent 9a33cc96c6
commit e5d43e7dc5
3 changed files with 74 additions and 41 deletions

View File

@ -97,7 +97,6 @@ class CustomBrowserDialog extends Component {
}
}
};
onLeftListCheck = (keys, datas) => {
const { leftListSelectedData } = this.state;
let targets = leftListSelectedData.concat(datas);
@ -154,6 +153,31 @@ class CustomBrowserDialog extends Component {
}
return bool;
};
renderTitle = () => {
const { dialogType, searchParamsKey, isSingle } = this.props, {
query, pageInfo, selectedRowKeys, singleFilterVal
} = this.state;
return (<div className="wea-hr-muti-dialog-title">
<span>{getLabel(111, "数据选择")}</span>
{
dialogType === "table" ?
<WeaInputSearch
value={query[searchParamsKey]} style={{ width: 220 }}
onChange={value => this.setState({ query: { ...query, [searchParamsKey]: value } })}
onSearch={() => {
this.setState({ pageInfo: { ...pageInfo, current: 1 } }, () => {
this.getData();
selectedRowKeys.forEach((v) => {
let item = this.getItemById(v);
if (item) this.selectedData[v] = item;
});
});
}}/> : isSingle ?
<WeaInputSearch value={singleFilterVal} onChange={singleFilterVal => this.setState({ singleFilterVal })}/> :
<div/>
}
</div>);
};
render() {
const {
@ -161,7 +185,7 @@ class CustomBrowserDialog extends Component {
singleFilterVal
} = this.state;
const { dialogType, tableProps: { rowKey, columns }, isSingle, searchParamsKey } = this.props;
const sheight = this.dialog ? this.dialog.state.height - 55 : 260;
const sheight = this.dialog ? this.dialog.state.height - 116 : 260;
const buttons = [
<Button type="primary" onClick={this.handleOk}
disabled={dialogType !== "table" && _.isEmpty(rightDatas)}>{getLabel(111, "确 定")}</Button>,
@ -172,7 +196,7 @@ class CustomBrowserDialog extends Component {
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-dialog">
{
!isSingle ? <React.Fragment>
<div className="wea-hr-muti-input-left">
@ -184,7 +208,7 @@ class CustomBrowserDialog extends Component {
</Col>
</Row>
<div>
<WeaNewScroll height={sheight}>
<WeaNewScroll height={this.dialog ? this.dialog.state.height - 51 : 260}>
<CustomBrowserMutiLeft
filterData={rightDatas}
datas={listDatas}
@ -209,19 +233,16 @@ class CustomBrowserDialog extends Component {
</div>
<div className="wea-hr-muti-input-right">
<CustomBrowserMutiRight
height={sheight} data={rightDatas} checkedKeys={rightCheckedKeys}
height={this.dialog ? this.dialog.state.height - 51 : 260}
data={rightDatas} checkedKeys={rightCheckedKeys}
checkedCb={rightCheckedKeys => this.setState({ rightCheckedKeys })}
onDoubleClick={this.onRightDoubleClick}
/>
</div>
</React.Fragment> :
<React.Fragment>
<WeaInputSearch value={singleFilterVal} style={{ width: "100%", marginBottom: 10 }}
onChange={singleFilterVal => this.setState({ singleFilterVal })}/>
<WeaTransferList height={this.dialog ? this.dialog.state.height - 65 : 260} checkedKeys={[]}
checkedCb={([id]) => this.handleRowClick(_.find(listDatas, item => item.id === id))}
data={listDatas.filter((item) => item.name.indexOf(_.trim(singleFilterVal)) > -1)}/>
</React.Fragment>
<WeaTransferList height={this.dialog ? this.dialog.state.height - 16 : 260} checkedKeys={[]}
checkedCb={([id]) => this.handleRowClick(_.find(listDatas, item => item.id === id))}
data={listDatas.filter((item) => item.name.indexOf(_.trim(singleFilterVal)) > -1)}/>
}
</div>
</Spin>;
@ -257,33 +278,20 @@ class CustomBrowserDialog extends Component {
selectedRowKeys,
onChange: selectedRowKeys => this.setState({ selectedRowKeys })
};
dom = <React.Fragment>
<WeaInputSearch value={query[searchParamsKey]} className="tableSearch"
onChange={value => this.setState({ query: { ...query, [searchParamsKey]: value } })}
onSearch={() => {
this.setState({ pageInfo: { ...pageInfo, current: 1 } }, () => {
this.getData();
selectedRowKeys.forEach((v) => {
let item = this.getItemById(v);
if (item) this.selectedData[v] = item;
});
});
}}/>
dom = <div className="wea-hr-muti-input-table">
<WeaTable dataSource={listDatas} loading={loading} pagination={pagination} scroll={{ y: sheight }}
onRowClick={this.handleRowClick} rowSelection={!isSingle ? rowSelection : null}
rowKey={rowKey || "id"} columns={columns}/>
</React.Fragment>;
</div>;
}
dialogType === "table" && isSingle && buttons.splice(0, 1);
return (
<WeaDialog
{...this.props} initLoadCss ref={dom => this.dialog = dom} title={getLabel(111, "数据选择")}
className="custom_browser_dialog" style={{
{...this.props} initLoadCss ref={dom => this.dialog = dom} title={this.renderTitle()}
className="custom_browser_dialog" draggable={false} style={{
width: 784, height: 460, minHeight: 200, minWidth: 380,
maxHeight: "90%", maxWidth: "90%", overflow: "hidden", transform: "translate(0px, 0px)"
}} buttons={buttons}>
{dom}
</WeaDialog>
}} buttons={buttons}>{dom}</WeaDialog>
);
}
}

View File

@ -1,10 +1,18 @@
.custom_browser_dialog {
.tableSearch {
float: right;
margin: 16px;
position: relative;
z-index: 99;
min-width: 200px;
.wea-hr-muti-dialog-title {
display: flex;
justify-content: space-between;
align-items: center;
}
.wea-hr-muti-input-table {
background: #f6f6f6;
padding: 8px 16px;
height: 100%;
.wea-new-table {
background: #FFF;
}
}
.ant-spin-nested-loading, .ant-spin-container {
@ -12,6 +20,19 @@
}
.wea-hr-muti-dialog {
height: 100%;
background: #f6f6f6;
padding: 8px 16px;
.wea-hr-muti-input-left, .wea-hr-muti-input-right {
background: #FFF;
}
.wea-transfer-list {
background: #FFF;
border: 1px solid #e9e9e9;
}
.wea-input-focus {
height: 35px !important;
width: 100% !important;

View File

@ -50,10 +50,12 @@ class Index extends Component {
(col.column === "jfValue" || col.column === "dfValue") ? "INPUTNUMBER" : "custom",
viewAttr: !pzlxEnum.includes(pzlx) ? 2 : 1,
render: (text, record, index, onEdit) => {
const value = _.isArray(text) ? _.map(text, o => o.bh).join(",") : !_.isNil(text) ? text.bh : "";
const value = _.isArray(text) ? _.map(text, o => o.bh).join(",") : (!_.isNil(text) && text.bh) ? text.bh : text;
const replaceDatas = _.isArray(text) ? _.map(text, o => ({
...o, id: o.bh, name: `${o.fzhslx}${o.bh}/${o.mc}`
})) : !_.isNil(text) ? [{ ...text, id: text.bh, name: `${text.fzhslx}${text.bh}/${text.mc}` }] : [];
})) : (!_.isNil(text) && text.bh) ? [{
...text, id: text.bh, name: `${text.fzhslx}${text.bh}/${text.mc}`
}] : [];
const fzhslxEnum = { "fzhsXmqs": 0, "fzhsFwlb": 1, "fzhsSllb": 2, "fzhsKs": 3 };
return <CustomBrowser
fieldConfig={{
@ -76,9 +78,11 @@ class Index extends Component {
}
}}
value={value}
onChange={(value) => onEdit({
record: { ...record, [col["column"]]: value }, index
})}
onChange={(value) => {
onEdit({
record: { ...record, [col["column"]]: value }, index, key: "custom", value
});
}}
/>;
}
}