83 lines
2.6 KiB
JavaScript
83 lines
2.6 KiB
JavaScript
/*
|
|
* Author: 黎永顺
|
|
* name: 薪资账套查询
|
|
* Description:
|
|
* Date: 2023/11/27
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { inject, observer } from "mobx-react";
|
|
import { Button } from "antd";
|
|
import { WeaSwitch } from "comsMobx";
|
|
import { WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
|
|
import { searchConditions } from "../config";
|
|
import { getTaxAgentSelectList } from "../../../apis/taxAgent";
|
|
|
|
const getKey = WeaTools.getKey;
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
@inject("ledgerStore") @observer
|
|
class LedgerSearchComp extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
conditions: []
|
|
};
|
|
}
|
|
|
|
componentDidMount() {
|
|
this.getTaxAgentSelectList();
|
|
}
|
|
|
|
getTaxAgentSelectList = () => {
|
|
const { ledgerStore: { searchForm } } = this.props;
|
|
getTaxAgentSelectList().then(({ status, data }) => {
|
|
if (status) {
|
|
this.setState({
|
|
conditions: _.map(searchConditions, o => {
|
|
return {
|
|
...o, items: _.map(o.items, j => {
|
|
if (getKey(j) === "taxAgentId") {
|
|
return {
|
|
...j, options: [{ key: "", showname: getLabel(332, "全部") }, ..._.map(data, g => ({
|
|
key: g.id, showname: g.content
|
|
}))]
|
|
};
|
|
}
|
|
return { ...j };
|
|
})
|
|
};
|
|
})
|
|
}, () => searchForm.initFormFields(this.state.conditions));
|
|
}
|
|
});
|
|
};
|
|
formRender = (form, condition) => {
|
|
const { isFormInit } = form, formParams = form.getFormParams();
|
|
let group = [];
|
|
isFormInit && condition && condition.map(c => {
|
|
let items = [];
|
|
c.items.map(fields => {
|
|
items.push({
|
|
com: (<WeaFormItem label={`${fields.label}`} labelCol={{ span: `${fields.labelcol}` }}
|
|
wrapperCol={{ span: `${fields.fieldcol}` }} error={form.getError(fields)}
|
|
tipPosition="bottom">
|
|
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams}
|
|
onChange={_.debounce(this.props.onSearch, 500)}/>
|
|
</WeaFormItem>), colSpan: 2
|
|
});
|
|
});
|
|
group.push(<WeaSearchGroup col={2} needTigger={true} title={c.title} showGroup={c.defaultshow} center={false}
|
|
items={items}/>);
|
|
});
|
|
return group;
|
|
};
|
|
|
|
render() {
|
|
const { conditions } = this.state;
|
|
const { ledgerStore: { searchForm } } = this.props;
|
|
return (<div className="ledgerSearch-Wrapper">{this.formRender(searchForm, conditions)}</div>);
|
|
}
|
|
}
|
|
|
|
export default LedgerSearchComp;
|