custom-安仕新能源
This commit is contained in:
parent
4e4a522508
commit
9a99942af5
|
|
@ -8,12 +8,17 @@
|
|||
* @description:
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaLocaleProvider, WeaReqTop } from "ecCom";
|
||||
import { Button, Col, message, Modal, Row } from "antd";
|
||||
import { WeaInputSearch, WeaLocaleProvider, WeaReqTop } from "ecCom";
|
||||
import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd";
|
||||
import { WeaForm, WeaSwitch } from "comsMobx";
|
||||
import * as API from "../../../../apis/custom-apis/liante";
|
||||
import PushedDetailList from "./pushedDetailList";
|
||||
import FormInfo from "../../../../components/FormInfo";
|
||||
import { conditions } from "../conditions";
|
||||
import cs from "classnames";
|
||||
import "../cbsList/index.less";
|
||||
|
||||
const form = new WeaForm();
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
class Index extends Component {
|
||||
|
|
@ -21,10 +26,14 @@ class Index extends Component {
|
|||
super(props);
|
||||
this.state = {
|
||||
selectedKey: "0", baseInfo: {}, queryParams: {}, isQuery: false,
|
||||
selectedRowKeys: []
|
||||
selectedRowKeys: [], showadvance: false
|
||||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
form.initFormFields(conditions);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { params } = this.props, { salaryCbsId: id } = params;
|
||||
API.getPushCBSBaseInfo({ id }).then(({ status, data }) => {
|
||||
|
|
@ -32,15 +41,16 @@ class Index extends Component {
|
|||
});
|
||||
}
|
||||
|
||||
pushDataToCBS = (ids, isConfirm) => {
|
||||
const payload = { ids, isConfirm }, { isQuery } = this.state;
|
||||
pushDataToCBS = (ids, isConfirm, key = "") => {
|
||||
const payload = !!key ? { salaryCbsld: ids, isConfirm } : { ids, isConfirm };
|
||||
const { isQuery } = this.state;
|
||||
API.pushDataToCBS(payload).then(({ status, data, errormsg }) => {
|
||||
if (status && !!data) {
|
||||
Modal.confirm({
|
||||
title: getLabel(111, "提示信息"),
|
||||
content: data,
|
||||
onOk: () => {
|
||||
this.pushDataToCBS(ids, true);
|
||||
this.pushDataToCBS(ids, true, key);
|
||||
}
|
||||
});
|
||||
} else if (status && !data) {
|
||||
|
|
@ -52,36 +62,95 @@ class Index extends Component {
|
|||
});
|
||||
};
|
||||
|
||||
onDropMenuClick = (key) => {
|
||||
const { selectedRowKeys } = this.state;
|
||||
switch (key) {
|
||||
case "select":
|
||||
this.pushDataToCBS(selectedRowKeys, false);
|
||||
break;
|
||||
case "all":
|
||||
const { params } = this.props, { salaryCbsId } = params;
|
||||
this.pushDataToCBS(salaryCbsId, false, "salaryCbsId");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { selectedKey, baseInfo, queryParams, isQuery, selectedRowKeys } = this.state;
|
||||
const { selectedKey, baseInfo, queryParams, isQuery, selectedRowKeys, showadvance } = this.state;
|
||||
const menu = (
|
||||
<Menu onClick={({ key }) => this.onDropMenuClick(key)}>
|
||||
<Menu.Item key="select" disabled={_.isEmpty(selectedRowKeys)}>{getLabel(111, "推送所选")}</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
const tabs = [
|
||||
{
|
||||
title: getLabel(111, "未推送"), key: "0",
|
||||
buttons: [
|
||||
<Button type="primary" disabled={_.isEmpty(selectedRowKeys)}
|
||||
onClick={() => this.pushDataToCBS(selectedRowKeys, false)}>{getLabel(111, "推送所选")}</Button>
|
||||
<Dropdown.Button overlay={menu} type="primary"
|
||||
onClick={() => this.onDropMenuClick("all")}>{getLabel(111, "全部推送")}</Dropdown.Button>,
|
||||
<AdvanceWithInput form={form} onShowOrHide={() => this.setState({ showadvance: !showadvance })}
|
||||
onSearch={() => this.setState({ isQuery: !isQuery })}/>
|
||||
]
|
||||
},
|
||||
{ title: getLabel(111, "已推送"), key: "1", buttons: [] }
|
||||
{
|
||||
title: getLabel(111, "已推送"), key: "1", buttons: [
|
||||
<AdvanceWithInput form={form} onShowOrHide={() => this.setState({ showadvance: !showadvance })}
|
||||
onSearch={() => this.setState({ isQuery: !isQuery })}/>
|
||||
]
|
||||
}
|
||||
];
|
||||
const itemRender = {
|
||||
username: (field, textAreaProps, form, formParams) => {
|
||||
return (<WeaSwitch fieldConfig={{ ...field, ...textAreaProps }} form={form} formParams={formParams}
|
||||
onChange={() => this.forceUpdate()}/>);
|
||||
}
|
||||
};
|
||||
return (<WeaReqTop
|
||||
title={getLabel(111, "CBS推送")} tabDatas={tabs} selectedKey={selectedKey} className="pushCBSDetailWrapper"
|
||||
buttonSpace={10} icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
|
||||
onChange={v => this.setState({
|
||||
selectedKey: v,
|
||||
selectedKey: v, showadvance: false,
|
||||
queryParams: { ...queryParams, name: "", salarySobId: "" }
|
||||
})}
|
||||
buttons={_.find(tabs, o => selectedKey === o.key).buttons}>
|
||||
<div className={cs("advance-search-pannel", { "advance-search-pannel-show": showadvance })}>
|
||||
<FormInfo center={false} colCount={2} itemRender={itemRender} form={form} formFields={conditions}/>
|
||||
<div className="push-advanceSearch-buttons">
|
||||
<span style={{ marginLeft: 15 }}><Button type="primary"
|
||||
onClick={() => this.setState({
|
||||
isQuery: !isQuery, showadvance: !showadvance
|
||||
})}>{getLabel(388113, "搜索")}</Button></span>
|
||||
<span style={{ marginLeft: 15 }}><Button type="ghost"
|
||||
onClick={() => form.resetForm()}>{getLabel(2022, "重置")}</Button></span>
|
||||
<span style={{ marginLeft: 15 }}><Button type="ghost"
|
||||
onClick={() => this.setState({ showadvance: !showadvance })}>{getLabel(31129, "取消")}</Button></span>
|
||||
</div>
|
||||
</div>
|
||||
<Row className="baseInfo-ant-row">
|
||||
<Col span={2}>{getLabel(111, "薪资所属月")}:</Col>
|
||||
<Col span={22}>{baseInfo.salaryMonth}</Col>
|
||||
</Row>
|
||||
<PushedDetailList
|
||||
{...this.props} selectedKey={selectedKey} pushDataToCBS={this.pushDataToCBS} isQuery={isQuery}
|
||||
selectedRowKeys={selectedRowKeys}
|
||||
selectedRowKeys={selectedRowKeys} form={form}
|
||||
setSelectedRowKeys={v => this.setState({ selectedRowKeys: v })}/>
|
||||
</WeaReqTop>);
|
||||
}
|
||||
}
|
||||
|
||||
export default Index;
|
||||
|
||||
const AdvanceWithInput = (props) => {
|
||||
const { onShowOrHide, onSearch } = props;
|
||||
return (<React.Fragment>
|
||||
<div className="push-advanceSearch">
|
||||
<WeaInputSearch value={form.getFormParams().username}
|
||||
onChange={v => form.updateFields({ username: v || "" })}
|
||||
onSearch={onSearch}/>
|
||||
<Button type="ghost" className="push-advanceBtn" onClick={onShowOrHide}>{getLabel(111, "高级搜索")}</Button>
|
||||
</div>
|
||||
</React.Fragment>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,14 +32,16 @@ class PushedDetailList extends Component {
|
|||
columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 }
|
||||
}, () => this.getPushCBSInfoList(nextProps));
|
||||
}
|
||||
if (nextProps.isQuery !== this.props.isQuery) this.getPushCBSInfoList(nextProps);
|
||||
if (nextProps.isQuery !== this.props.isQuery) this.setState({
|
||||
pageInfo: { current: 1, pageSize: 10, total: 0 }
|
||||
}, () => this.getPushCBSInfoList(nextProps));
|
||||
}
|
||||
|
||||
getPushCBSInfoList = (props) => {
|
||||
const { pageInfo } = this.state, {
|
||||
selectedKey: pushStatus, params
|
||||
selectedKey: pushStatus, params, form
|
||||
} = props || this.props, { salaryCbsId } = params;
|
||||
const payload = { ...pageInfo, pushStatus, salaryCbsId };
|
||||
const payload = { ...pageInfo, ...form.getFormParams(), pushStatus, salaryCbsId };
|
||||
this.setState({ loading: true });
|
||||
API.getPushCBSInfoList(payload).then(({ status, data }) => {
|
||||
this.setState({ loading: false });
|
||||
|
|
|
|||
|
|
@ -9,11 +9,47 @@
|
|||
}
|
||||
}
|
||||
|
||||
.push-advanceSearch {
|
||||
.push-advanceBtn {
|
||||
top: 0;
|
||||
left: -1px;
|
||||
height: 28px;
|
||||
line-height: 1;
|
||||
border-radius: 0;
|
||||
position: relative;
|
||||
color: #474747;
|
||||
padding: 4px 15px;
|
||||
}
|
||||
|
||||
.push-advanceBtn:hover {
|
||||
border: 1px solid #dadada;
|
||||
color: #474747;
|
||||
}
|
||||
}
|
||||
|
||||
.pushCBSDetailWrapper {
|
||||
.wea-new-top-req-title > div:last-child {
|
||||
right: 16px !important;
|
||||
}
|
||||
|
||||
.advance-search-pannel {
|
||||
display: none;
|
||||
background: #FFF;
|
||||
margin: 8px 16px;
|
||||
|
||||
.push-advanceSearch-buttons {
|
||||
border-top: 1px solid #dadada;
|
||||
padding: 15px 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.advance-search-pannel-show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.baseInfo-ant-row {
|
||||
margin: 8px 16px;
|
||||
padding: 16px 8px;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
export const conditions = [
|
||||
{
|
||||
items: [
|
||||
{
|
||||
conditionType: "INPUT",
|
||||
domkey: ["username"],
|
||||
fieldcol: 14,
|
||||
label: "姓名",
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
viewAttr: 2
|
||||
},
|
||||
{
|
||||
conditionType: "INPUT",
|
||||
domkey: ["gzkkhh"],
|
||||
fieldcol: 14,
|
||||
label: "工资卡开户行",
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
viewAttr: 2
|
||||
}
|
||||
],
|
||||
defaultshow: true
|
||||
}
|
||||
];
|
||||
Loading…
Reference in New Issue