Merge branch 'feature/2.9.42310.01-统计维度管理弹框修改以及添加人员的扩展属性设置' into release/2.9.42311.01

# Conflicts:
#	pc4mobx/hrmSalary/apis/statistics.js
This commit is contained in:
黎永顺 2023-11-07 19:16:10 +08:00
commit 147d0908f1
9 changed files with 331 additions and 26 deletions

View File

@ -110,3 +110,15 @@ export const salaryStatisticsPushAddSharedSendMsg = (params) => {
export const statisticsItemChangetab = (params) => {
return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/item/changeTab", "GET", params);
};
//报表记录-扩展人员维度显示值
export const saveExpandFieldSettings = (params) => {
return postFetch("/api/bs/hrmsalary/report/statistics/dimension/saveExpandFieldSettings", params);
};
//报表记录-查询薪酬统计维度扩展字段设置
export const getExpandFieldSettings = (params) => {
return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/dimension/getExpandFieldSettings", "GET", params);
};
//报表记录-复制薪酬统计报表
export const statisticsReportDuplicate = (params) => {
return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/report/duplicate", "GET", params);
};

View File

@ -49,7 +49,7 @@ export const condition = [
labelcol: 6,
options: [],
viewAttr: 2,
helpfulTip: "",
helpfulTip: ""
},
{
colSpan: 1,
@ -90,10 +90,41 @@ export const reportCondition = [
options: [],
rules: "required|string",
viewAttr: 3,
helpfulTip: "",
helpfulTip: ""
}
],
title: "",
defaultshow: true
}
];
export const extensionCondition = [
{
items: [
{
colSpan: 1,
conditionType: "INPUT",
domkey: ["pk"],
fieldcol: 14,
label: "主键",
lanId: 111,
labelcol: 6,
value: "",
rules: "required|string",
viewAttr: 3
},
{
colSpan: 1,
conditionType: "TEXTAREA",
domkey: ["expandSql"],
fieldcol: 14,
label: "sql",
lanId: 111,
labelcol: 6,
value: "",
rules: "required|string",
viewAttr: 3
}
],
defaultshow: true
}
];

View File

@ -0,0 +1,142 @@
/*
* Author: 黎永顺
* name: 统计维度-新增扩展属性
* Description:
* Date: 2023/11/7
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaLocaleProvider, WeaTableEdit } from "ecCom";
import { Button, message } from "antd";
import { getExpandFieldSettings, saveExpandFieldSettings } from "../../../apis/statistics";
import { extensionCondition } from "./conditions";
import { getConditionDomkeys, getSearchs } from "../../../util";
const getLabel = WeaLocaleProvider.getLabel;
@inject("attendanceStore")
@observer
class DimensionExtensionAttrsDialog extends Component {
constructor(props) {
super(props);
this.state = {
conditions: [], loading: false, datas: [], extensionId: ""
};
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getExpandFieldSettings(nextProps);
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
this.setState({ extensionId: "", datas: [] });
nextProps.attendanceStore.initExtensionForm();
}
}
getExpandFieldSettings = (props) => {
getExpandFieldSettings({ module: "dim_employee" }).then(({ status, data }) => {
if (status) {
const { id: extensionId = "", fieldSettings: datas = [] } = data || {};
this.setState({
extensionId, datas,
conditions: _.map(extensionCondition, o => {
return {
...o,
items: _.map(o.items, g => {
return { ...g, label: getLabel(g.lanId, g.label) };
})
};
})
}, () => {
const { attendanceStore: { extensionForm } } = props;
extensionForm.initFormFields(this.state.conditions);
if (!_.isNil(data))
_.map(getConditionDomkeys(this.state.conditions), o => {
extensionForm.updateFields({ [o]: data[o] || "" });
});
});
}
});
};
save = () => {
const { attendanceStore: { extensionForm } } = this.props;
const { datas, extensionId: id } = this.state;
const { pass } = this.tableEdit.refs.edit.doRequiredCheck();
extensionForm.validateForm().then(f => {
if (f.isValid && pass) {
const paylaod = {
fieldSettings: _.map(datas, (o, i) => ({ ...o, index: i + 1 })),
module: "dim_employee", moduleInfo: "", id,
...extensionForm.getFormParams()
};
this.setState({ loading: true });
saveExpandFieldSettings(paylaod).then(({ status, errormsg }) => {
this.setState({ loading: false });
if (status) {
message.success(getLabel(30700, "操作成功!"));
this.props.onCancel();
} else {
message.error(errormsg);
}
}).catch(() => this.setState({ loading: false }));
} else {
f.showErrors();
}
});
};
render() {
const { attendanceStore: { extensionForm } } = this.props;
const { conditions, loading, datas } = this.state;
const columns = [
{
title: getLabel(33439, "名称"),
dataIndex: "name",
key: "name",
com: [
{ label: "", type: "INPUT", viewAttr: 3, key: "name" }
],
colSpan: 1,
width: "50%"
},
{
title: getLabel(111, "字段"),
dataIndex: "field",
key: "field",
com: [
{ label: "", type: "INPUT", viewAttr: 3, key: "field" }
],
colSpan: 1,
width: "50%"
}
];
return (
<WeaDialog
{...this.props} title={getLabel(111, "属性扩展")} hasScroll
className="extensionAttrsDialog" initLoadCss
buttons={[
<Button type="primary" loading={loading} onClick={this.save}>{getLabel(537558, "保存")}</Button>
]}
style={{
width: 850,
height: 606.6,
minHeight: 200,
minWidth: 380,
maxHeight: "90%",
maxWidth: "90%",
overflow: "hidden",
transform: "translate(0px, 0px)"
}}
>
<div className="extensionAttrsDialogContent">
{getSearchs(extensionForm, conditions, 1, false)}
<WeaTableEdit
ref={el => this.tableEdit = el} showCopy={false} draggable deleteConfirm
columns={columns} datas={datas} onChange={datas => this.setState({ datas })}
/>
</div>
</WeaDialog>
);
}
}
export default DimensionExtensionAttrsDialog;

View File

@ -8,6 +8,7 @@ import React, { Component } from "react";
import { WeaLocaleProvider, WeaTable } from "ecCom";
import { message, Modal } from "antd";
import { dimensionDelete, dimensionList } from "../../../apis/statistics";
import DimensionExtensionAttrsDialog from "./dimensionExtensionAttrsDialog";
import "../index.less";
const { getLabel } = WeaLocaleProvider;
@ -16,8 +17,7 @@ class DimensionTable extends Component {
constructor(props) {
super(props);
this.state = {
loading: false,
dataSource: [],
loading: false, dataSource: [], visible: false,
pageInfo: {
current: 1, pageSize: 10, total: 0
}
@ -63,7 +63,7 @@ class DimensionTable extends Component {
};
render() {
const { dataSource, loading, pageInfo } = this.state;
const { dataSource, loading, pageInfo, visible } = this.state;
const { onEdit } = this.props;
const pagination = {
...pageInfo,
@ -100,20 +100,28 @@ class DimensionTable extends Component {
<a href="javascript: void(0);"
onClick={() => this.dimensionDelete([record.id])}>{getLabel(111, "删除")}</a>
}
{
record.dimName === getLabel(30042, "人员") && record.dimType === getLabel(111, "定性") &&
<a href="javascript: void(0);"
onClick={() => this.setState({ visible: true })}>{getLabel(111, "扩展属性")}</a>
}
</span>
);
}
}
];
return (
<WeaTable
rowKey="id"
className="dimensionTableWrapper"
dataSource={dataSource}
pagination={pagination}
loading={loading}
columns={columns}
/>
<React.Fragment>
<WeaTable
rowKey="id"
className="dimensionTableWrapper"
dataSource={dataSource}
pagination={pagination}
loading={loading}
columns={columns}
/>
<DimensionExtensionAttrsDialog visible={visible} onCancel={() => this.setState({ visible: false })}/>
</React.Fragment>
);
}
}

View File

@ -7,7 +7,11 @@
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd";
import { reportStatisticsReportDelete, reportStatisticsReportList } from "../../../apis/statistics";
import {
reportStatisticsReportDelete,
reportStatisticsReportList,
statisticsReportDuplicate
} from "../../../apis/statistics";
import "../index.less";
const SubMenu = Menu.SubMenu;
@ -26,10 +30,20 @@ class ReportList extends Component {
}
handleOptsClick = ({ key }, id, dimensionId) => {
const { reportName = "" } = this.props;
if (key === "delete") {
this.reportStatisticsReportDelete(id.split(","));
} else if (key === "edit") {
this.props.onEdit("addReport", id);
} else if (key === "copy") {
statisticsReportDuplicate({ id }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(30700, "操作成功!"));
this.reportStatisticsReportList({ reportName });
} else {
message.error(errormsg);
}
});
}
};
reportStatisticsReportDelete = (payload) => {
@ -90,6 +104,7 @@ class ReportList extends Component {
<Dropdown overlay={
<Menu onClick={e => this.handleOptsClick(e, id, dimensionId)}>
<Menu.Item key="edit">{getLabel(111, "编辑")}</Menu.Item>
<Menu.Item key="copy">{getLabel(77, "复制")}</Menu.Item>
<Menu.Item key="delete">{getLabel(111, "删除")}</Menu.Item>
</Menu>
}>

View File

@ -6,7 +6,7 @@
*/
import React, { Component } from "react";
import { Button, message, Modal } from "antd";
import { WeaDialog, WeaLocaleProvider } from "ecCom";
import { WeaDialog, WeaLocaleProvider, WeaSlideModal } from "ecCom";
import { reportStatisticsReportSave } from "../../../apis/ruleconfig";
import "../index.less";
@ -45,6 +45,17 @@ class StatisticsModal extends Component {
}
});
};
renderTitle = () => {
return <div className="titleDialog">
<div className="titleCol titleLeftBox">
<div className="titleIcon"><i className="icon-coms-fa"/></div>
<div className="title">{getLabel(543313, "统计维度管理")}</div>
</div>
<div className="titleCol titleRightBox">
<Button type="primary" onClick={() => this.props.onAddDimension()}>{getLabel(543314, "新建统计维度")}</Button>
</div>
</div>;
};
render() {
const { loading } = this.state;
@ -53,16 +64,25 @@ class StatisticsModal extends Component {
<Button type="primary" onClick={this.handleSaveReportList} loading={loading}>{getLabel(111, "保存")}</Button>
] : [];
return (
<WeaDialog
{...this.props} hasScroll
style={typeKey === "addReport" ? { width: 600 } : { width: 640, height: 540 }}
buttons={buttons}
onCancel={onCancel}
initLoadCss
className="dimensionModalWrapper"
>
{this.props.children}
</WeaDialog>
<React.Fragment>
{
typeKey === "addReport" ? <WeaDialog
{...this.props} hasScroll
style={typeKey === "addReport" ? { width: 600 } : { width: 640, height: 540 }}
buttons={buttons}
onCancel={onCancel}
initLoadCss
className="dimensionModalWrapper"
>
{this.props.children}
</WeaDialog> :
<WeaSlideModal
className="dimensionModalWrapper" {...this.props}
top={0} width={760} height={100} measureT={"%"} measureY={"%"} measureX={"px"}
direction={"right"} content={this.props.children} title={this.renderTitle()}
/>
}
</React.Fragment>
);
}
}

View File

@ -287,7 +287,9 @@ class Index extends Component {
keyword={keyword} year={year}
/>
}
<StatisticsModal {...modalReq} onCancel={this.handleCancel} form={reportForm}>
<StatisticsModal {...modalReq} onCancel={this.handleCancel} form={reportForm} onClose={this.handleCancel}
onAddDimension={this.handleAddDimension}
>
{
modalReq.typeKey === "dimension" &&
<DimensionTable ref={dom => this.dimensionTableRef = dom}

View File

@ -1,4 +1,8 @@
.xc_tj_fx_wrapper {
.wea-new-top-req {
z-index: 0 !important;
}
.search {
top: -3px;
margin-right: 10px;
@ -180,6 +184,45 @@
}
}
.titleDialog {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 46px 0 16px;
.titleCol {
flex: 1;
display: flex;
align-items: center;
}
.titleLeftBox {
.titleIcon {
color: #fff;
margin: 0;
width: 40px;
height: 40px;
line-height: 40px;
font-size: 22px;
display: flex;
align-items: center;
justify-content: center;
background: #F14A2D;
border-radius: 50%;
}
.title {
font-size: 14px;
color: #333;
padding-left: 6px;
}
}
.titleRightBox {
justify-content: flex-end;
}
}
}
.dimensionSlideWrapper, .dimensionModalWrapper {
@ -217,3 +260,32 @@
}
}
}
//重构-社保福利档案
.extensionAttrsDialog {
.extensionAttrsDialogContent {
background: #F6F6F6;
padding: 16px;
width: 100%;
height: 100%;
.wea-table-edit {
background: #FFF;
}
.wea-search-group {
padding: 0;
margin-bottom: 10px;
background: #FFF;
.wea-form-cell {
padding: 0;
.wea-form-item {
padding: 10px;
}
}
}
}
}

View File

@ -14,6 +14,9 @@ export class AttendanceStore {
@observable shareForm = new WeaForm();
@observable shareLogForm = new WeaForm();
@observable sharePerForm = new WeaForm();
@observable extensionForm = new WeaForm(); //扩展属性
@action("报表查看-扩展属性表单初始化")
initExtensionForm = () => this.extensionForm = new WeaForm();
@action("报表查看-分享报表表单初始化")
initShareForm = () => this.shareForm = new WeaForm();