salary-management-front/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareAdvanceSearchPannel/index.js

97 lines
3.1 KiB
JavaScript

/*
* Author: 黎永顺
* name: 社保福利档案页面重构-高级搜索面板
* Description:
* Date: 2023/10/31
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTools } from "ecCom";
import { Button } from "antd";
import { inject, observer } from "mobx-react";
import { getSaCondition } from "../../../../../apis/archive";
import { getSearchs } from "../../../../../util";
const getLabel = WeaLocaleProvider.getLabel;
const getKey = WeaTools.getKey;
@inject("archivesStore")
@observer
class WelfareAdvanceSearchPannel extends Component {
constructor(props) {
super(props);
this.state = {
searchConditions: []
};
}
componentDidMount() {
getSaCondition().then(({ status, data }) => {
if (status) {
this.setState({
searchConditions: _.map(data.condition, item => ({
...item, items: _.map(item.items, o => {
if (getKey(o) === "departmentIdsStr" || getKey(o) === "positionsStr" || getKey(o) === "subcompanyIdsStr") {
return {
...o, browserConditionParam: {
completeParams: {},
conditionDataParams: {},
dataParams: {},
destDataParams: {},
hasAddBtn: false,
hasAdvanceSerach: false,
idSeparator: ",",
isAutoComplete: 1,
isDetail: 0,
isMultCheckbox: false,
isSingle: false,
icon: "icon-coms-hrm",
linkUrl: "",
pageSize: 10,
quickSearchName: "",
replaceDatas: [],
title: "",
type: getKey(o) === "departmentIdsStr" ? "57" : getKey(o) === "positionsStr" ? "278" : "194",
viewAttr: 2
}
};
}
return { ...o };
})
}))
}, () => {
const { archivesStore: { welfareForm } } = this.props;
welfareForm.initFormFields(this.state.searchConditions);
});
}
});
}
render() {
const { searchConditions } = this.state;
const { archivesStore: { welfareForm } } = this.props;
return (
<React.Fragment>
<div className="wea-advanced-searchsAd">
{getSearchs(welfareForm, searchConditions, 2, false)}
</div>
<div className="wea-search-buttons">
<div style={{ textAlign: "center" }}>
<span style={{ marginLeft: 15 }}>
<Button type="primary" onClick={this.props.onAdSearch}>{getLabel(388113, "搜索")}</Button>
</span>
<span style={{ marginLeft: 15 }}>
<Button type="ghost" onClick={() => welfareForm.resetForm()}>{getLabel(2022, "重置")}</Button>
</span>
<span style={{ marginLeft: 15 }}>
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(31129, "取消")}</Button>
</span>
</div>
</div>
</React.Fragment>
);
}
}
export default WelfareAdvanceSearchPannel;