salary-management-front/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js

80 lines
2.0 KiB
JavaScript

/*
* Author: 黎永顺
* name: 新增统计维度弹框
* Description:
* Date: 2023/4/11
*/
import React, { Component } from "react";
import { WeaDialog } from "ecCom";
import { Button } from "antd";
import { condition } from "./conditions";
import { commonEnumList } from "../../../apis/ruleconfig";
import { dimensionGetForm } from "../../../apis/statistics";
import { getSearchs } from "../../../util";
import "../index.less";
class DimensionSlide extends Component {
constructor(props) {
super(props);
this.state = {
date: ""
};
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) {
const promise = this.initCondition();
nextProps.form.initFormFields(condition);
}
}
initCondition = async () => {
const [dimTypeEnum, dimCodeList] = await Promise.all([this.commonEnumList(), this.dimensionGetForm()]);
const { data: dimTypeData } = dimTypeEnum, { data: dimCodeData } = dimCodeList;
console.log(dimTypeEnum, dimCodeList, condition);
};
commonEnumList = () => {
const payload = {
enumClass: "com.engine.salary.report.enums.SalaryStatisticsDimensionTypeEnum"
};
return commonEnumList(payload);
};
dimensionGetForm = () => {
return dimensionGetForm();
};
handleSave = () => {
this.props.form.validateForm().then(f => {
if (f.isValid) {
} else {
f.showErrors();
this.setState({ date: new Date() });
}
});
};
render() {
const { form } = this.props;
return (
<WeaDialog
{...this.props}
initLoadCss hasScroll
style={{ width: 900, height: 350 }}
className="dimensionSlideWrapper"
title={
<div className="dimensionTitle">
<span>新建统计维度</span>
<Button type="primary" onClick={this.handleSave}>保存</Button>
</div>
}
>
{getSearchs(form, condition, 1)}
</WeaDialog>
);
}
}
export default DimensionSlide;