Merge branch 'feature/2.15.2.2409.01-薪酬统计薪资明细默认显示列' into release/2.15.2.2409.01

This commit is contained in:
黎永顺 2024-10-12 13:39:15 +08:00
commit 2b541a85df
14 changed files with 1295 additions and 14 deletions

View File

@ -134,3 +134,7 @@ export const getSalaryListSum = (params) => {
export const exportSalaryList = (params) => {
return postExportFetch("/api/bs/hrmsalary/report/statistics/employee/exportSalaryList", params);
};
//薪酬统计报表-保存全局自定义列配置
export const savePageListSetting = (params) => {
return postFetch("/api/bs/hrmsalary/common/pageList/save/setting", params);
};

View File

@ -0,0 +1,26 @@
/*
* 自定义浏览框组件
* 单选
* @Author: 黎永顺
* @Date: 2024/9/3
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import AssociativeSearchMult from "./associativeSearchMult";
const getLabel = WeaLocaleProvider.getLabel;
class AssociativeSearchSingle extends Component {
render() {
return (
<AssociativeSearchMult {...this.props}/>
);
}
}
export default AssociativeSearchSingle;

View File

@ -0,0 +1,165 @@
/*
* 自定义浏览框组件
* 多选
* @Author: 黎永顺
* @Date: 2024/8/29
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { Button, Icon, Select } from "antd";
import { postFetch } from "../../../util/request";
import classNames from "classnames";
const getLabel = WeaLocaleProvider.getLabel;
const Option = Select.Option;
class AssociativeSearchMult extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, data: [], activeKey: "", dropdownWidth: 200
};
this.selectedData = {};
}
componentDidMount() {
const { dropdownWidth } = this.state;
const w = $(this.refs.searchWrapperMui).outerWidth();
if (dropdownWidth < w) {
this.setState({ dropdownWidth: w });
}
}
handleSearch = (value) => {
this.setState({ loading: true });
this.getData(value);
};
getData = (name = "") => {
const { browserConditionParam } = this.props;
const {
completeURL, filterByName, searchParamsKey, convertDatasource, dataParams = {}
} = browserConditionParam;
if (_.trim(name)) {
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: "" });
}
};
getActiveKey = (data) => {
const { selectedValues = [] } = this.props;
let v = "";
if (data && data.length > 0) {
let target = data.filter((d) => selectedValues.indexOf(d.id) === -1);
if (!_.isEmpty(target)) v = String(target[0].id);
}
return v;
};
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];
}
}
};
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);
this.setState({ activeKey: "" });
};
handleBlur = () => this.setState({ data: [], activeKey: "" });
handleClick = (e) => {
e && e.preventDefault();
const { datas, selectedValues } = this.props;
if (this.props.clickCallback) this.props.clickCallback(selectedValues, datas);
};
isReadOnly = () => {
const { viewAttr } = this.props;
return viewAttr === 1 || viewAttr === "1";
};
render() {
const { data, dropdownWidth } = this.state;
const { viewAttr, selectedValues, datas, isSingle, browserConditionParam = {} } = this.props;
const clsname = classNames({
"required": (viewAttr === 3 || viewAttr === "3") && _.isEmpty(selectedValues),
"mr12": viewAttr === "3" && _.isEmpty(selectedValues),
"wea-associative-single": (isSingle || browserConditionParam.isSingle),
"wea-associative-search-mult": !(isSingle || browserConditionParam.isSingle)
});
if (this.isReadOnly()) {
let arr = [];
selectedValues && selectedValues.map(v => {
let item = datas[v].name;
if (_.isString(item)) {
arr.push(<a className="child-item wdb">{item}</a>);
} else {
arr.push(<a className="child-item wdb" dangerouslySetInnerHTML={{ __html: item }}> </a>);
}
});
return (
<span className={`wea-associative-search wea-field-readonly ${clsname} `} ref="searchWrapperMui">{arr}</span>
);
}
let options = data.map(d => <Option key={d.id} title={d.name}>{d.name}</Option>);
selectedValues && selectedValues.map((v) => {
v && options.unshift(<Option key={v} title={datas[v].name}>{datas[v].name}</Option>);
});
const select = <Select
{...this.props}
hasScroll={false}
hideSelected={true}
transitionName=""
animation=""
multiple={true}
notFoundContent=""
defaultActiveFirstOption={true}
showArrow={false}
filterOption={false}
defaultValue={selectedValues}
value={selectedValues}
dropdownStyle={{ minWidth: dropdownWidth }}
onSearch={_.debounce(this.handleSearch, 400)}
onChange={this.handleChange}
onBlur={this.handleBlur}
>
{options}
</Select>;
return (
<div className={`wea-associative-search ${clsname}`} ref="searchWrapperMui">
{select}
<Icon type="loading" style={{ display: this.state.loading ? "block" : "none" }}/>
<div className="ant-input-group-wrap">
<Button type="ghost" icon="search" onClick={this.handleClick}/>
</div>
</div>
);
}
}
export default AssociativeSearchMult;

View File

@ -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;

View File

@ -0,0 +1,299 @@
/*
* 自定义浏览框组件
* 弹框选择
* @Author: 黎永顺
* @Date: 2024/8/30
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaDialog, WeaInputSearch, WeaLocaleProvider, WeaNewScroll, WeaTable, WeaTransfer } from "ecCom";
import { Button, Col, Row, Spin } from "antd";
import CustomBrowserMutiLeft from "./customBrowserMutiLeft";
import CustomBrowserMutiRight from "./customBrowserMutiRight";
import CustomBrowserOperation from "./customBrowserOperation";
import { postFetch } from "../../../util/request";
const WeaTransferList = WeaTransfer.list;
const getLabel = WeaLocaleProvider.getLabel;
class CustomBrowserDialog extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, listDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, selectedRowKeys: [],
query: { [props.searchParamsKey]: "" }, singleFilterVal: "",
leftListSelectedKeys: [], // 左侧table选择的keys
leftListSelectedData: [], // 左侧table选择的数据
rightCheckedKeys: [], //右侧选择的keys
rightDatas: [] // 右侧展示的数据
};
this.selectedData = {};
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) {
this.getData();
this.setState({
selectedRowKeys: nextProps.selectedValues,
leftListSelectedData: _.values(nextProps.datas), rightDatas: _.values(nextProps.datas)
});
} else {
this.setState({
pageInfo: { current: 1, pageSize: 10, total: 0 }, query: { [this.props.searchParamsKey]: "" },
rightDatas: [], rightCheckedKeys: [], leftListSelectedData: [], leftListSelectedKeys: []
});
this.selectedData = {};
}
}
getData = () => {
const { pageInfo, query } = this.state;
const { dialogType, completeURL, convertDatasource, dataParams = {} } = this.props;
let payload = { ...dataParams, ...query };
dialogType === "table" && (payload = { ...pageInfo, ...payload, ...query });
this.setState({ loading: true });
postFetch(completeURL, payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status && data.list) {
const { pageNum: current, pageSize, total } = data;
this.setState({
listDatas: convertDatasource ? convertDatasource(data.list) : data.list,
pageInfo: { ...pageInfo, current, pageSize, total }
});
} else {
this.setState({ listDatas: _.map(data, o => ({ ...o, id: String(o.id) })) });
}
});
};
handleRowClick = record => {
if (!this.props.isSingle) return;
const values = [record.id];
const selectedData = { [record["id"]]: record };
this.props.onCancel();
this.props.onChange && this.props.onChange(values, selectedData);
};
handleClear = () => {
this.props.onCancel();
this.props.onChange && this.props.onChange([], {});
};
handleOk = () => {
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(convertSelectedRowKeys, this.selectedData);
this.props.onCancel && this.props.onCancel();
};
getItemById = (id) => {
const { listDatas } = this.state;
if (this.selectedData[id]) return this.selectedData[id];
if (!_.isEmpty(listDatas)) {
for (let i = 0; i < listDatas.length; i++) {
if (String(id) === String(listDatas[i].id)) return listDatas[i];
}
}
};
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: []
});
};
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") {
this.setState({
rightDatas: rightDatas.concat(leftListSelectedData),
leftListSelectedData: [],
leftListSelectedKeys: []
});
} 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: [] });
} else if (direction === "allToRight") {
if (this.leftListAllActive()) {
this.setState({
rightDatas: rightDatas.concat(listDatas),
rightCheckedKeys: [],
leftListSelectedData: [],
leftListSelectedKeys: []
});
}
}
};
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;
};
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 {
loading, listDatas, pageInfo, selectedRowKeys, query, leftListSelectedKeys, rightDatas, rightCheckedKeys,
singleFilterVal
} = this.state;
const { dialogType, tableProps: { rowKey, columns }, isSingle, searchParamsKey } = this.props;
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>,
<Button type="ghost" onClick={this.handleClear}>{getLabel(111, "清 除")}</Button>,
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(111, "取 消")}</Button>];
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 className="wea-hr-muti-dialog">
{
!isSingle ? <React.Fragment>
<div className="wea-hr-muti-input-left">
<Row style={{ height: 35 }}>
<Col span="24">
<WeaInputSearch value={query[searchParamsKey]} onSearch={this.getData}
onChange={value => this.setState({ query: { ...query, [searchParamsKey]: value } })}
/>
</Col>
</Row>
<div>
<WeaNewScroll height={this.dialog ? this.dialog.state.height - 51 : 260}>
<CustomBrowserMutiLeft
filterData={rightDatas}
datas={listDatas}
onDoubleClick={this.onleftDoubleClick}
onClick={this.onLeftListCheck}
selectedKeys={leftListSelectedKeys}
/>
</WeaNewScroll>
</div>
</div>
<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={this.dialog ? this.dialog.state.height - 51 : 260}
data={rightDatas} checkedKeys={rightCheckedKeys}
checkedCb={rightCheckedKeys => this.setState({ rightCheckedKeys })}
onDoubleClick={this.onRightDoubleClick}
/>
</div>
</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>;
if (dialogType === "table") {
const pagination = {
...pageInfo,
showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: (current, pageSize) => {
this.setState({
pageInfo: { ...pageInfo, current, pageSize }
}, () => {
this.getData();
selectedRowKeys.forEach((v) => {
let item = this.getItemById(v);
if (item) this.selectedData[v] = item;
});
});
},
onChange: current => {
this.setState({ pageInfo: { ...pageInfo, current } }, () => {
this.getData();
selectedRowKeys.forEach((v) => {
let item = this.getItemById(v);
if (item) this.selectedData[v] = item;
});
});
}
};
const rowSelection = {
selectedRowKeys,
onChange: selectedRowKeys => this.setState({ selectedRowKeys })
};
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}/>
</div>;
}
dialogType === "table" && isSingle && buttons.splice(0, 1);
return (
<WeaDialog
{...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>
);
}
}
export default CustomBrowserDialog;

View File

@ -0,0 +1,81 @@
/*
* 自定义浏览框组件
* 选择框左边
* @Author: 黎永顺
* @Date: 2024/8/30
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
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, selectedKeys } = this.props;
const list = datas.map(item => {
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"/>
</li>;
});
return (
<div className="wea-crm-list">
<ul className="wea-crm-list-wrapper">
{list}
</ul>
{
list.length === 0 &&
<div className="empty-tip" style={{ color: "#2f2929", paddingTop: 30, textAlign: "center" }}>
{getLabel(111, "没有可显示的数据")}
</div>
}
</div>
);
}
}
export default CustomBrowserMutiLeft;

View File

@ -0,0 +1,91 @@
/*
* 自定义浏览框组件
* 选择框右边
* @Author: 黎永顺
* @Date: 2024/8/30
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaInputSearch, WeaLocaleProvider, WeaNewScroll } from "ecCom";
import { Tree } from "antd";
const getLabel = WeaLocaleProvider.getLabel;
const TreeNode = Tree.TreeNode;
let timeout = null;
class CustomBrowserMutiRight extends Component {
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;
};
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, checkedKeys } = this.props;
return (
<div className="wea-transfer-right">
<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}
onSelect={this.checkHandler}
onDoubleClick={this.onDoubleClick}
selectedKeys={checkedKeys}>
{this.generateTreeNodes()}
</Tree>
</WeaNewScroll>
</div>
</div>
);
}
}
export default CustomBrowserMutiRight;

View File

@ -0,0 +1,64 @@
/*
* 自定义浏览框组件
* 弹框操作栏
* @Author: 黎永顺
* @Date: 2024/8/30
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { Button } from "antd";
const getLabel = WeaLocaleProvider.getLabel;
class CustomBrowserOperation extends Component {
render() {
const {
moveToLeft,
moveToRight,
leftArrowText,
rightArrowText,
leftActive,
rightActive,
className,
leftAllActive,
moveAllToLeft,
rightAllActive,
moveAllToRight
} = this.props;
const moveToLeftButton = (
<Button type="primary" size="small" disabled={!rightActive} onClick={moveToRight}>
{<span><i className="icon-coms-Browse-box-Add-to"/></span>}
</Button>
);
const moveToRightButton = (
<Button type="primary" size="small" disabled={!leftActive} onClick={moveToLeft}>
{<span><i className="icon-coms-Browse-box-delete"/></span>}
</Button>
);
const moveAllToLeftButton = (
<Button type="primary" size="small" disabled={!leftAllActive} onClick={moveAllToRight}>
{<span title={getLabel(111, "将当页数据全部添加到右侧已选列表")}><i className="icon-coms-right"/></span>}
</Button>
);
const moveAllToRightButton = (
<Button type="primary" size="small" disabled={!rightAllActive} onClick={moveAllToLeft}>
{<span title={getLabel(111, "全部删除")}><i className="icon-coms-Browse-box-Delete-all"/></span>}
</Button>
);
return (
<div className={className}>
{moveToLeftButton}
{moveToRightButton}
{moveAllToLeftButton}
{moveAllToRightButton}
</div>
);
}
}
export default CustomBrowserOperation;

View File

@ -0,0 +1,206 @@
/*
* 自定义穿梭框组件
* 弹框选择
* @Author: 黎永顺
* @Date: 2024/8/30
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaDialog, WeaInputSearch, WeaLocaleProvider, WeaNewScroll } from "ecCom";
import { Button, Col, Row, Spin } from "antd";
import CustomBrowserMutiLeft from "./customBrowserMutiLeft";
import CustomBrowserMutiRight from "./customBrowserMutiRight";
import CustomBrowserOperation from "./customBrowserOperation";
import { postFetch } from "../../../util/request";
import "../index.less";
const getLabel = WeaLocaleProvider.getLabel;
class CustomTransferDialog extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, listDatas: [],
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(true);
if (nextProps.datas) {
this.setState({
leftListSelectedData: _.values(nextProps.datas), rightDatas: _.values(nextProps.datas)
});
}
} else if (nextProps.visible !== this.props.visible && !nextProps.visible) {
this.setState({
query: { [this.props.searchParamsKey]: "" },
rightDatas: [], rightCheckedKeys: [], leftListSelectedData: [], leftListSelectedKeys: []
});
this.selectedData = {};
}
}
getData = (init = false) => {
const { query } = this.state;
const { completeURL, convertDatasource, dataParams = {} } = this.props;
let payload = { ...dataParams, ...query };
this.setState({ loading: true });
postFetch(completeURL, payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status && data.list) {
const { pageNum: current, pageSize, total } = data;
this.setState({
listDatas: convertDatasource ? convertDatasource(data.list) : data.list
});
} else {
this.setState({
listDatas: convertDatasource ? convertDatasource(data).listDatas : [],
leftListSelectedData: (init && convertDatasource) ? convertDatasource(data).checked : this.state.leftListSelectedData,
rightDatas: (init && convertDatasource) ? convertDatasource(data).checked : this.state.rightDatas
});
}
});
};
handleOk = () => {
const { rightDatas } = this.state;
this.props.onChange && this.props.onChange(rightDatas);
};
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: []
});
};
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") {
this.setState({
rightDatas: rightDatas.concat(leftListSelectedData),
leftListSelectedData: [],
leftListSelectedKeys: []
});
} 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: [] });
} else if (direction === "allToRight") {
if (this.leftListAllActive()) {
this.setState({
rightDatas: rightDatas.concat(listDatas),
rightCheckedKeys: [],
leftListSelectedData: [],
leftListSelectedKeys: []
});
}
}
};
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;
};
renderTitle = () => {
return (<div className="wea-hr-muti-dialog-title">
<span>{getLabel(111, "数据选择")}</span>
<div/>
</div>);
};
render() {
const { loading, listDatas, query, leftListSelectedKeys, rightDatas, rightCheckedKeys } = this.state;
const { searchParamsKey, saveLoading } = this.props;
const buttons = [
<Button type="primary" loading={saveLoading} onClick={this.handleOk}
disabled={_.isEmpty(rightDatas)}>{getLabel(111, "确 定")}</Button>,
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(111, "取 消")}</Button>];
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 className="wea-hr-muti-dialog">
<div className="wea-hr-muti-input-left">
<Row style={{ height: 35 }}>
<Col span="24">
<WeaInputSearch value={query[searchParamsKey]} onSearch={() => this.getData()}
onChange={value => this.setState({ query: { ...query, [searchParamsKey]: value } })}
/>
</Col>
</Row>
<div>
<WeaNewScroll height={this.dialog ? this.dialog.state.height - 51 : 260}>
<CustomBrowserMutiLeft
filterData={rightDatas}
datas={listDatas}
onDoubleClick={this.onleftDoubleClick}
onClick={this.onLeftListCheck}
selectedKeys={leftListSelectedKeys}
/>
</WeaNewScroll>
</div>
</div>
<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={this.dialog ? this.dialog.state.height - 51 : 260}
data={rightDatas} checkedKeys={rightCheckedKeys}
checkedCb={rightCheckedKeys => this.setState({ rightCheckedKeys })}
onDoubleClick={this.onRightDoubleClick}
/>
</div>
</div>
</Spin>;
return (
<WeaDialog
{...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>
);
}
}
export default CustomTransferDialog;

View File

@ -0,0 +1,136 @@
/*
* 自定义浏览框组件
*
* @Author: 黎永顺
* @Date: 2024/8/29
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
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";
import classNames from "classnames";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
const getKey = WeaTools.getKey;
class Index extends Component {
constructor(props) {
super(props);
this.state = {
browserDialog: { visible: false },
selectedData: {}, searchKeys: [], // 搜索按钮选择的数据和keys
rightDatas: [] // 右侧展示的数据
};
}
componentDidMount() {
const { value, fieldConfig } = this.props;
const { value: defaultValue, browserConditionParam: { replaceDatas = [] } } = fieldConfig;
if ((value || defaultValue) && replaceDatas.length > 0) {
this.setState({
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)) ||
(nextProps.fieldConfig.value !== this.props.fieldConfig.value && _.isEmpty(nextProps.fieldConfig.value))
) {
this.setState({ searchKeys: [], selectedData: [] });
}
}
renderSingle = () => {
const { fieldConfig } = this.props;
const { selectedData, searchKeys } = this.state;
return (<div>
<AssociativeSearchSingle
{...fieldConfig}
{...this.props}
datas={selectedData}
selectedValues={searchKeys}
onChange={this.onBrowerChangeHandler}
clickCallback={this.onBrowerClick}
/>
</div>);
};
renderMult = () => {
const { fieldConfig } = this.props;
const { browserConditionParam = {} } = fieldConfig || {};
const { selectedData, searchKeys } = this.state;
return (<div>
{
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) => {
const { form, fieldConfig, isSingle } = this.props;
const { browserConditionParam = {} } = fieldConfig || {};
this.setState({
searchKeys: (isSingle || browserConditionParam.isSingle) ? values.slice(-1) : values,
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(",") }
});
}
});
};
onBrowerClick = (keys, selectedObj) => {
if (_.isEmpty(keys)) {
this.setState({ searchKeys: [], selectedData: {}, rightDatas: [] });
}
this.setState({ browserDialog: { visible: true } });
};
render() {
const { browserDialog, selectedData, searchKeys } = this.state;
const { isSingle, viewAttr, fieldConfig = {} } = this.props;
const { browserConditionParam = {} } = fieldConfig || {};
const className = classNames({
"wea-browser": true,
"wea-field-readonly": viewAttr === "1" || fieldConfig.viewAttr === "1"
});
const browser = (isSingle || browserConditionParam.isSingle) ? this.renderSingle() : this.renderMult();
const style = {};
if (this.props.resize) style.visibility = "hidden";
return (<React.Fragment>
<div className={`${className} ${this.props.className || ""}`} style={style}>{browser}</div>
<CustomBrowserDialog
{...browserDialog} {...browserConditionParam} {...this.props} onChange={this.onBrowerChangeHandler}
onCancel={() => this.setState({ browserDialog: { visible: false } })}
datas={selectedData} selectedValues={searchKeys}/>
</React.Fragment>
);
}
}
export default Index;

View File

@ -0,0 +1,72 @@
.custom_browser_dialog {
.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 {
height: 100%;
}
.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;
input {
height: 100% !important;
}
}
.wea-transfer-list-wrapper {
border: none !important;
.transfer-tree {
padding: 0 !important;
& > li {
margin: 0;
cursor: pointer;
width: 100%;
position: relative;
padding: 6px 0 6px 20px !important;
border-bottom: 1px solid #e9e9e9;
color: #333;
overflow: hidden;
.ant-tree-switcher {
display: none !important;
}
.tree-title {
line-height: 30px;
}
}
}
}
}
}

View File

@ -6,13 +6,14 @@
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { toJS } from "mobx";
import { WeaLoadingGlobal, WeaLocaleProvider } from "ecCom";
import { WeaTableNew } from "comsMobx";
import { WeaLoadingGlobal, WeaLocaleProvider } from "ecCom";
import { message, Spin } from "antd";
import * as API from "../../../apis/statistics";
import { toJS } from "mobx";
import { getIframeParentHeight } from "../../../util";
import { sysConfCodeRule } from "../../../apis/ruleconfig";
import CustomTransferDialog from "../../../components/CustomBrowser/components/customTransferDialog";
import * as API from "../../../apis/statistics";
import "../index.less";
const WeaTableComx = WeaTableNew.WeaTable;
@ -26,7 +27,16 @@ class SalaryDetails extends Component {
this.state = {
loading: false, dataSource: [], columns: [], selectedRowKeys: [],
pageInfo: { current: 1, pageSize: 10, total: 0 }, payload: {},
showTotalCell: false, updateSum: true
showTotalCell: false, updateSum: true,
transferDialog: {
visible: false, searchParamsKey: "name", dataParams: { page: "salary_details_report" }, saveLoading: false,
completeURL: "/api/bs/hrmsalary/common/pageList/get/setting", convertDatasource: datas => {
return {
listDatas: _.map(datas.setting, o => ({ id: o.id, name: o.name })),
checked: this.converCheckedCol(datas)
};
}
}
};
}
@ -73,10 +83,10 @@ class SalaryDetails extends Component {
childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
};
getSalaryList = (props) => {
const { attendanceStore: { salaryDetailSearchForm, tableStore }, dateRange } = props;
const { attendanceStore: { salaryDetailSearchForm, tableStore }, dateRange } = props || this.props;
const [startDateStr, endDateStr] = dateRange;
const { taxAgentIds, subcompanyIds, departmentIds, ...extra } = salaryDetailSearchForm.getFormParams();
const { pageInfo } = this.state;
const { pageInfo, transferDialog } = this.state;
const payload = {
taxAgentIds: taxAgentIds ? taxAgentIds.split(",") : [],
departmentIds: departmentIds ? departmentIds.split(",") : [],
@ -93,7 +103,7 @@ class SalaryDetails extends Component {
const { list: dataSource, pageNum: current, total, pageSize } = pageparams;
this.setState({
dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, payload,
showTotalCell: confCode === "1"
showTotalCell: confCode === "1", transferDialog: { ...transferDialog, cancel: false }
}, () => tableStore.getDatas(dataKey.datas));
}
}).catch(() => this.setState({ loading: false }));
@ -113,10 +123,10 @@ class SalaryDetails extends Component {
};
getColumns = () => {
const { attendanceStore: { tableStore } } = this.props;
const { dataSource, pageInfo, selectedRowKeys, showTotalCell, payload, updateSum } = this.state;
const { dataSource, pageInfo, selectedRowKeys, showTotalCell, payload, updateSum, transferDialog } = this.state;
const columns = _.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes");
const sumRowlistUrl = showTotalCell ? "/api/bs/hrmsalary/report/statistics/employee/salaryListSum" : "";
if (!_.isEmpty(columns)) {
if (!_.isEmpty(columns) && !transferDialog.visible && !transferDialog.cancel) {
this.postMessageToChild({
dataSource, pageInfo, selectedRowKeys, showTotalCell, calcDetail: true, tableScrollHeight: 154,
sumRowlistUrl, payload: { ...payload, updateSum },
@ -130,9 +140,33 @@ class SalaryDetails extends Component {
}
return [];
};
handleSetDefCols = () => this.setState({ transferDialog: { ...this.state.transferDialog, visible: true } });
converCheckedCol = (data) => {
return _.reduce(data.checked, (pre, cur) => {
const item = _.find(data.setting, k => k.id === cur);
if (!_.isEmpty(item)) return [...pre, item];
return pre;
}, []);
};
savePageListSetting = (values) => {
const payload = {
page: "salary_details_report",
setting: _.map(values, o => o.id)
};
this.setState({ transferDialog: { ...this.state.transferDialog, saveLoading: true } });
API.savePageListSetting(payload).then(({ status, errormsg }) => {
this.setState({ transferDialog: { ...this.state.transferDialog, saveLoading: false } });
if (status) {
message.success(getLabel(111, "操作成功!"));
this.setState({ transferDialog: { ...this.state.transferDialog, visible: false } }, () => this.getSalaryList());
} else {
message.error(errormsg);
}
});
};
render() {
const { loading, dataSource } = this.state;
const { loading, dataSource, transferDialog } = this.state;
const { attendanceStore: { tableStore } } = this.props;
return (
<div className="table-layout"
@ -151,6 +185,11 @@ class SalaryDetails extends Component {
needScroll={true}
columns={this.getColumns()}
/>
{/*默认显示列*/}
<CustomTransferDialog {...transferDialog} onChange={this.savePageListSetting}
onCancel={() => this.setState({
transferDialog: { ...transferDialog, visible: false, cancel: true }
})}/>
</div>
);
}

View File

@ -275,7 +275,7 @@ class Index extends Component {
render() {
const {
taxAgentStore: { statisticsReportBtn },
taxAgentStore: { statisticsReportBtn, PageAndOptAuth },
attendanceStore: { statisticsForm, reportForm, tableStore }
} = this.props;
const {
@ -313,7 +313,7 @@ class Index extends Component {
<AdvanceInputBtn onOpenAdvanceSearch={this.handleOpenAdvanceSearch}
onAdvanceSearch={this.handleAdvanceSearch}/>
];
const dropMenuDatas = [
let dropMenuDatas = [
{
key: "log", icon: <i className="iconfont icon-caozuorizhi32"/>,
content: getLabel(545781, "操作日志")
@ -333,6 +333,11 @@ class Index extends Component {
{ key: "detail", title: getLabel(111, "员工明细") },
{ key: "salaryDetail", title: getLabel(111, "薪资明细") }
];
dropMenuDatas = selectedKey === "salaryDetail" ? dropMenuDatas.slice(-1) : dropMenuDatas.slice(0, 1);
(PageAndOptAuth.isChief && selectedKey === "salaryDetail") && (dropMenuDatas = [...dropMenuDatas, {
key: "DEF_COLUMN", icon: <i className="icon-coms-Custom"/>, content: getLabel(111, "默认显示列"),
onClick: () => this.salaryRef.wrappedInstance.handleSetDefCols()
}]);
return (
<WeaReqTop
title={getLabel(111, "薪酬统计报表")} icon={<i className="icon-coms-fa"/>} selectedKey={selectedKey}
@ -340,8 +345,7 @@ class Index extends Component {
buttons={(!statisticsReportBtn && selectedKey === "statistics") ? buttons.slice(-1) : buttons} buttonSpace={10}
onChange={selectedKey => this.setState({ selectedKey }, () => this.state.selectedKey === "statistics" && this.initReportFormCondition())}
showDropIcon={selectedKey !== "detail"} onDropMenuClick={this.onDropMenuClick}
dropMenuDatas={selectedKey === "salaryDetail" ? dropMenuDatas.slice(-1) : dropMenuDatas.slice(0, 1)}
>
dropMenuDatas={dropMenuDatas}>
<div className={cs("searchAdvanced-condition-container", { "searchAdvanced-condition-hide": !showSearchAd })}>
<SearchPannel onCancel={() => this.setState({ showSearchAd: false })} onAdSearch={this.onAdSearch}/>
</div>

View File

@ -8,6 +8,15 @@ import { decentralizationConditions, editConditions } from "../pages/taxAgent/ed
const { TableStore } = WeaTableNew;
export class TaxAgentStore {
@observable advanceForm = new WeaForm(); //权限-角色高级搜索form表单
@observable roleForm = new WeaForm(); //权限-角色form表单
@action initRoleForm = () => this.roleForm = new WeaForm();
@observable roleOperatorForm = new WeaForm(); //权限-角色操作者form表单
@action initRoleOperatorForm = () => this.roleOperatorForm = new WeaForm();
@observable PageAndOptAuth = { able: false, opts: [] }; // 业务线页面权限
@action initPageAndOptAuth = () => this.PageAndOptAuth = { able: true, opts: ["query", "admin"] };// 设置业务线页面权限
@observable tableStore = new TableStore(); // new table
@observable form = new WeaForm(); //表单实体
@observable formDecentralization = new WeaForm(); //关闭分权表单
@ -140,6 +149,7 @@ export class TaxAgentStore {
return new Promise((resolve, reject) => {
API.getPermission(params).then(({ status, data }) => {
if (status) {
this.PageAndOptAuth = data;
const { isAdminEnable, isChief, isOpenDevolution } = data;
this.setShowOperateBtn(
!isOpenDevolution ? true : isAdminEnable ? true : false