92 lines
3.4 KiB
JavaScript
92 lines
3.4 KiB
JavaScript
/*
|
|
* 薪酬二开项目
|
|
* 统一报表基础
|
|
* @Author: 黎永顺
|
|
* @Date: 2025/4/7
|
|
* @Wechat:
|
|
* @Email: 971387674@qq.com
|
|
* @description:
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { WeaLocaleProvider, WeaTools, WeaTop } from "ecCom";
|
|
import FormInfo from "../../../components/FormInfo";
|
|
import { getffgsAllList } from "../../../apis/custom-apis/lingyue";
|
|
import { baseConditions } from "./components/conditions";
|
|
import CustomSelect from "../../../components/CustomSelect";
|
|
import { postFetch } from "../../../util/request";
|
|
import { WeaSwitch } from "comsMobx";
|
|
import moment from "moment";
|
|
import { Button } from "antd";
|
|
import "./index.less";
|
|
|
|
const getKey = WeaTools.getKey;
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
class Layout extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = { conditions: [] };
|
|
}
|
|
|
|
componentDidMount() {
|
|
const promise = this.init();
|
|
}
|
|
|
|
init = async () => {
|
|
const [{ data: fycdgsOptions }, { data: taxAgentList }] = await Promise.all([
|
|
getffgsAllList(),
|
|
postFetch("/api/bs/hrmsalary/taxAgent/listAll", { filterType: "QUERY_DATA" })
|
|
]);
|
|
this.setState({
|
|
conditions: _.map(baseConditions, item => ({
|
|
...item, items: _.map(item.items, o => {
|
|
if (getKey(o) === "fycdgsqc") {
|
|
return { ...o, options: _.map(fycdgsOptions, o => ({ ...o, name: o.content })) };
|
|
} else if (getKey(o) === "taxAgentIds") {
|
|
return {
|
|
...o, hide: this.props.type === "salaryStatistic",
|
|
options: _.map(taxAgentList, o => ({ key: String(o.id), showname: o.name }))
|
|
};
|
|
}
|
|
return { ...o, label: getLabel(o.lanId, o.label), value: moment().format("YYYY-MM") };
|
|
})
|
|
}))
|
|
}, () => this.props.form.initFormFields(this.state.conditions));
|
|
};
|
|
|
|
render() {
|
|
const { title, form, onChange, onExport } = this.props, { conditions } = this.state;
|
|
const buttons = [
|
|
<Button type="primary" onClick={onExport}>{getLabel(111, "导出全部")}</Button>
|
|
];
|
|
const itemRender = {
|
|
fycdgsqc: (field, textAreaProps, form, formParams) => {
|
|
return (<CustomSelect value={formParams.fycdgsqc} options={field.options}
|
|
onChange={v => {
|
|
form.updateFields({ fycdgsqc: { value: v } });
|
|
onChange();
|
|
}}/>);
|
|
},
|
|
salaryMonth: (field, textAreaProps, form, formParams) => {
|
|
return (<WeaSwitch fieldConfig={{ ...field, ...textAreaProps }} form={form} formParams={formParams}
|
|
onChange={onChange}/>);
|
|
},
|
|
taxAgentIds: (field, textAreaProps, form, formParams) => {
|
|
return (<WeaSwitch fieldConfig={{ ...field, ...textAreaProps }} form={form} formParams={formParams}
|
|
onChange={onChange}/>);
|
|
}
|
|
};
|
|
return (
|
|
<WeaTop title={title} icon={<i className="icon-coms-fa"/>} buttons={buttons} showDropIcon={false}
|
|
iconBgcolor="#F14A2D" className="custom_salary_lingyue">
|
|
<div className="lingyue-body">
|
|
<FormInfo className="baseLayoutQuery_lingyue" center={false} colCount={3} form={form}
|
|
formFields={conditions} itemRender={itemRender}/>
|
|
{this.props.children}
|
|
</div>
|
|
</WeaTop>);
|
|
}
|
|
}
|
|
|
|
export default Layout;
|