custom-安仕新能源

This commit is contained in:
lys 2025-05-13 09:56:51 +08:00
parent 4e4a522508
commit 9a99942af5
4 changed files with 147 additions and 15 deletions

View File

@ -8,12 +8,17 @@
* @description: * @description:
*/ */
import React, { Component } from "react"; import React, { Component } from "react";
import { WeaLocaleProvider, WeaReqTop } from "ecCom"; import { WeaInputSearch, WeaLocaleProvider, WeaReqTop } from "ecCom";
import { Button, Col, message, Modal, Row } from "antd"; import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd";
import { WeaForm, WeaSwitch } from "comsMobx";
import * as API from "../../../../apis/custom-apis/liante"; import * as API from "../../../../apis/custom-apis/liante";
import PushedDetailList from "./pushedDetailList"; import PushedDetailList from "./pushedDetailList";
import FormInfo from "../../../../components/FormInfo";
import { conditions } from "../conditions";
import cs from "classnames";
import "../cbsList/index.less"; import "../cbsList/index.less";
const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel; const getLabel = WeaLocaleProvider.getLabel;
class Index extends Component { class Index extends Component {
@ -21,10 +26,14 @@ class Index extends Component {
super(props); super(props);
this.state = { this.state = {
selectedKey: "0", baseInfo: {}, queryParams: {}, isQuery: false, selectedKey: "0", baseInfo: {}, queryParams: {}, isQuery: false,
selectedRowKeys: [] selectedRowKeys: [], showadvance: false
}; };
} }
componentWillMount() {
form.initFormFields(conditions);
}
componentDidMount() { componentDidMount() {
const { params } = this.props, { salaryCbsId: id } = params; const { params } = this.props, { salaryCbsId: id } = params;
API.getPushCBSBaseInfo({ id }).then(({ status, data }) => { API.getPushCBSBaseInfo({ id }).then(({ status, data }) => {
@ -32,15 +41,16 @@ class Index extends Component {
}); });
} }
pushDataToCBS = (ids, isConfirm) => { pushDataToCBS = (ids, isConfirm, key = "") => {
const payload = { ids, isConfirm }, { isQuery } = this.state; const payload = !!key ? { salaryCbsld: ids, isConfirm } : { ids, isConfirm };
const { isQuery } = this.state;
API.pushDataToCBS(payload).then(({ status, data, errormsg }) => { API.pushDataToCBS(payload).then(({ status, data, errormsg }) => {
if (status && !!data) { if (status && !!data) {
Modal.confirm({ Modal.confirm({
title: getLabel(111, "提示信息"), title: getLabel(111, "提示信息"),
content: data, content: data,
onOk: () => { onOk: () => {
this.pushDataToCBS(ids, true); this.pushDataToCBS(ids, true, key);
} }
}); });
} else if (status && !data) { } 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() { 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 = [ const tabs = [
{ {
title: getLabel(111, "未推送"), key: "0", title: getLabel(111, "未推送"), key: "0",
buttons: [ buttons: [
<Button type="primary" disabled={_.isEmpty(selectedRowKeys)} <Dropdown.Button overlay={menu} type="primary"
onClick={() => this.pushDataToCBS(selectedRowKeys, false)}>{getLabel(111, "推送所选")}</Button> 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 return (<WeaReqTop
title={getLabel(111, "CBS推送")} tabDatas={tabs} selectedKey={selectedKey} className="pushCBSDetailWrapper" title={getLabel(111, "CBS推送")} tabDatas={tabs} selectedKey={selectedKey} className="pushCBSDetailWrapper"
buttonSpace={10} icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D" buttonSpace={10} icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
onChange={v => this.setState({ onChange={v => this.setState({
selectedKey: v, selectedKey: v, showadvance: false,
queryParams: { ...queryParams, name: "", salarySobId: "" } queryParams: { ...queryParams, name: "", salarySobId: "" }
})} })}
buttons={_.find(tabs, o => selectedKey === o.key).buttons}> 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"> <Row className="baseInfo-ant-row">
<Col span={2}>{getLabel(111, "薪资所属月")}:</Col> <Col span={2}>{getLabel(111, "薪资所属月")}:</Col>
<Col span={22}>{baseInfo.salaryMonth}</Col> <Col span={22}>{baseInfo.salaryMonth}</Col>
</Row> </Row>
<PushedDetailList <PushedDetailList
{...this.props} selectedKey={selectedKey} pushDataToCBS={this.pushDataToCBS} isQuery={isQuery} {...this.props} selectedKey={selectedKey} pushDataToCBS={this.pushDataToCBS} isQuery={isQuery}
selectedRowKeys={selectedRowKeys} selectedRowKeys={selectedRowKeys} form={form}
setSelectedRowKeys={v => this.setState({ selectedRowKeys: v })}/> setSelectedRowKeys={v => this.setState({ selectedRowKeys: v })}/>
</WeaReqTop>); </WeaReqTop>);
} }
} }
export default Index; 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>
);
};

View File

@ -32,14 +32,16 @@ class PushedDetailList extends Component {
columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 } columns: [], dataSource: [], pageInfo: { current: 1, pageSize: 10, total: 0 }
}, () => this.getPushCBSInfoList(nextProps)); }, () => 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) => { getPushCBSInfoList = (props) => {
const { pageInfo } = this.state, { const { pageInfo } = this.state, {
selectedKey: pushStatus, params selectedKey: pushStatus, params, form
} = props || this.props, { salaryCbsId } = params; } = props || this.props, { salaryCbsId } = params;
const payload = { ...pageInfo, pushStatus, salaryCbsId }; const payload = { ...pageInfo, ...form.getFormParams(), pushStatus, salaryCbsId };
this.setState({ loading: true }); this.setState({ loading: true });
API.getPushCBSInfoList(payload).then(({ status, data }) => { API.getPushCBSInfoList(payload).then(({ status, data }) => {
this.setState({ loading: false }); this.setState({ loading: false });

View File

@ -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 { .pushCBSDetailWrapper {
.wea-new-top-req-title > div:last-child { .wea-new-top-req-title > div:last-child {
right: 16px !important; 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 { .baseInfo-ant-row {
margin: 8px 16px; margin: 8px 16px;
padding: 16px 8px; padding: 16px 8px;

View File

@ -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
}
];