Merge branch 'feature/V2-社保福利档案新增编辑页面重构' into develop

# Conflicts:
#	pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js
#	pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js
#	pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less
#	pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js
#	pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js
This commit is contained in:
黎永顺 2023-02-22 09:13:05 +08:00
commit 3694b009a4
13 changed files with 1044 additions and 854 deletions

View File

@ -1,14 +1,27 @@
import React from "react";
import { inject, observer } from "mobx-react";
import { Col, Row } from "antd";
import { WeaCheckbox, WeaDatePicker, WeaInput, WeaInputNumber, WeaSelect } from "ecCom";
import GroupCard from "../../../components/groupCard";
import cs from "classnames";
import { message } from "antd";
import { toJS } from "mobx";
import { WeaSearchGroup } from "ecCom";
import {
ConsistentWelfare,
SocialDatePicker,
SocialEditInput,
SocialInputNumber,
SocialSelect,
SocialTitle
} from "./socialSecurityForm";
import "./index.less";
@inject("archivesStore")
@observer
export default class AccumulationFundForm extends React.Component {
constructor(props) {
super(props);
this.state = {
Welfare: ""
};
}
componentWillMount() {
const { archivesStore: { getBaseForm, getPaymentForm } } = this.props;
@ -16,172 +29,142 @@ export default class AccumulationFundForm extends React.Component {
getPaymentForm(this.props.employeeId, "ACCUMULATION_FUND", this.props.record.fundSchemeId, this.props.record.paymentOrganization);
}
// 表单变化
handleFormChange(params) {
handleFormChange = ({ key, value }) => {
const params = { [key]: value };
const { archivesStore: { accumulationFundForm, setAccumulationFundForm }, onChangeRecordFundSchemeId } = this.props;
const { data } = accumulationFundForm;
let request = { ...data, ...params };
request.fundName = request.fundSchemeId;
let form = { ...accumulationFundForm };
form.data = request;
setAccumulationFundForm(form);
Object.keys(params).length>1 &&
onChangeRecordFundSchemeId(params.fundSchemeId)
}
key === "fundSchemeId" && this.setState({ Welfare: "" });
key === "fundSchemeId" && this.handleFetchPaymentForm(value);
key === "fundSchemeId" && onChangeRecordFundSchemeId(value);
};
// 获取基数表单
handleFetchPaymentForm(fundName) {
handleFetchPaymentForm = (fundName) => {
const { archivesStore: { getPaymentForm } } = this.props;
getPaymentForm(this.props.employeeId, "ACCUMULATION_FUND", fundName, this.props.record.paymentOrganization);
}
//基数变化
handlePaymentChange(params) {
getPaymentForm(this.props.employeeId, "ACCUMULATION_FUND", fundName, this.props.record.paymentOrganization, true);
};
handlePaymentChange = ({ key, value }) => {
const params = { [key]: !_.isNil(value) ? value.toString() : "" };
const { archivesStore: { accumulationFundPaymentForm, setAccumulationFundPaymentForm } } = this.props;
const { data } = accumulationFundPaymentForm;
let request = { ...data, ...params };
let form = { ...accumulationFundPaymentForm };
form.data = request;
setAccumulationFundPaymentForm(form);
}
render() {
const { archivesStore: { accumulationFundForm, accumulationFundPaymentForm } } = this.props;
const { items } = accumulationFundForm;
let baseData = accumulationFundForm.data;
let paymentData = accumulationFundPaymentForm.data;
let paymentItems = accumulationFundPaymentForm.items;
let data = { ...baseData };
// Integer数据转为string
if (data) {
Object.keys(data).map(key => {
if (data[key]) {
data[key] = data[key].toString();
};
handleChangeWelfare = (val) => {
const { archivesStore: { accumulationFundPaymentForm, setAccumulationFundPaymentForm } } = this.props;
let paymentData = toJS(accumulationFundPaymentForm.data);
const [paymentFormItems] = toJS(accumulationFundPaymentForm.items);
const { items } = paymentFormItems;
if (val) {
_.forEach(items, (it) => {
const { min, max, domkey } = it;
const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
if ((val < minNum || val > maxNum) && !_.isNil(min) && !_.isNil(max) && (!!maxNum || !!minNum)) {
message.warning("超出所选缴纳方案设置的基数上下限范围,将自动按基数上下限填充。");
paymentData = {
...paymentData,
[domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val
};
} else {
paymentData = { ...paymentData, [domkey[0]]: val };
}
});
} else {
_.forEach(items, (it) => {
const { domkey } = it;
paymentData = { ...paymentData, [domkey[0]]: "" };
});
}
setAccumulationFundPaymentForm({ ...accumulationFundPaymentForm, data: { ...paymentData } });
};
render() {
const { Welfare } = this.state;
const { archivesStore: { accumulationFundForm, accumulationFundPaymentForm } } = this.props;
const { items, data: foundData } = accumulationFundForm;
const paymentData = accumulationFundPaymentForm.data;
const paymentItems = accumulationFundPaymentForm.items;
const {
nonPayment = "", fundAccount = "", supplementFundAccount = "", fundStartTime = "", fundEndTime = "",
fundSchemeId = ""
} = foundData || {};
const foundItems = !_.isNil(toJS(items)) ? [
..._.map(_.filter(toJS(items)[0].items, it => it.domkey[0] !== "paymentOrganization"),
item => ({
com: SocialSelect({
key: item["domkey"][0],
label: item.label,
value: !_.isNil(foundData[item["domkey"][0]]) ? foundData[item["domkey"][0]].toString() : "",
options: item.options,
onChange: this.handleFormChange
})
})),
{
com: SocialDatePicker({
key: "fundStartTime",
label: "公积金起始缴纳月",
viewAttr: fundSchemeId ? 3 : 2,
value: fundStartTime,
onChange: this.handleFormChange
})
},
{
com: SocialEditInput({
key: "fundAccount",
label: "公积金账号",
value: fundAccount,
onChange: this.handleFormChange
})
},
{
com: SocialDatePicker({
key: "fundEndTime",
label: "公积金最后缴纳月",
value: fundEndTime,
onChange: this.handleFormChange
})
},
{
com: SocialEditInput({
key: "supplementFundAccount",
label: "补充公积金账号",
value: supplementFundAccount,
onChange: this.handleFormChange
})
}
] : [];
return (
<div className="socialFormWrapper">
<div style={{ overflow: "hidden" }}>
<WeaCheckbox style={{ float: "right", marginRight: "10px", marginTop: "10px" }}
value={data && data.nonPayment} id="nonPayment" content="暂不缴纳" onChange={(value) => {
this.handleFormChange({ nonPayment: value });
}}/>
</div>
<GroupCard title="公积金基础信息">
<Row>
<Col span={6} className="formItem borderR-none borderB-none">公积金起始缴纳月</Col>
<Col span={6} className="formItem borderR-none borderB-none">
<WeaDatePicker
viewAttr={(accumulationFundForm.data && accumulationFundForm.data.fundSchemeId) ? 3 : 2}
format="yyyy-MM"
value={data && data.fundStartTime}
onChange={value => this.handleFormChange({ fundStartTime: value })}
/>
</Col>
<Col span={6} className="formItem borderR-none borderB-none">公积金方案名称</Col>
<Col span={6} className="formItem borderB-none">
<WeaSelect
options={
(items && items[0].items && items[0].items[0]) ? [{
key: "",
showname: ""
}, ...items[0].items[0].options] : []
}
value={data && data.fundSchemeId}
style={{ width: "100%" }}
onChange={(value, showname) => {
this.handleFormChange({ fundSchemeId: value, fundName: showname });
this.handleFetchPaymentForm(value);
}}
/>
</Col>
</Row>
<Row>
<Col span={6} className="formItem borderR-none borderB-none">公积金最后缴纳月</Col>
<Col span={6} className="formItem borderR-none borderB-none">
<WeaDatePicker
format="yyyy-MM"
value={data && data.fundEndTime}
onChange={value => this.handleFormChange({ fundEndTime: value })}
/>
</Col>
<Col span={6} className="formItem borderR-none borderB-none">公积金账号</Col>
<Col span={6} className="formItem borderB-none">
<WeaInput
value={data && data.fundAccount}
onChange={(value) => this.handleFormChange({ fundAccount: value })}/>
</Col>
</Row>
<Row>
<Col span={6} className="formItem borderR-none">补充公积金账号</Col>
<Col span={6} className="formItem borderR-none">
<WeaInput value={data && data.supplementFundAccount}
onChange={(value) => this.handleFormChange({ supplementFundAccount: value })}/>
</Col>
<Col span={6} className="formItem borderR-none">公积金个人实际承担方</Col>
<Col span={6} className="formItem">
<WeaSelect
options={(items && items[0].items && items[0].items[2]) ? items[0].items[2].options : []}
value={data && data.underTake}
style={{ width: "100%" }}
onChange={(value) => {
this.handleFormChange({ underTake: value });
}}
/>
</Col>
</Row>
{/*<Row>*/}
{/*<Col span={6} className="formItem">公积金缴纳组织:</Col>*/}
{/*<Col span={6} className="formItem">*/}
{/* <Select defaultValue={data && data.paymentOrganization}*/}
{/* notFoundContent="暂无数据" value={data && data.paymentOrganization} style={{ width: "100%" }}*/}
{/* onChange={(value) => this.handleFormChange({ paymentOrganization: value })}>*/}
{/* {*/}
{/* items && items[0].items && items[0].items[1] && items[0].items[1].options.map(item => (*/}
{/* <Option value={item.key}>{item.showname}</Option>*/}
{/* ))*/}
{/* }*/}
{/* </Select>*/}
{/*</Col>*/}
{/*</Row>*/}
</GroupCard>
<WeaSearchGroup
title="公积金基础信息"
customComponent={<SocialTitle keyname="nonPayment" value={nonPayment.toString()}
onChange={this.handleFormChange}/>}
items={foundItems} col={2} showGroup needTigger={false}/>
{
data.fundSchemeId && paymentItems && paymentItems.map(group => (
<div>
{
group.items && group.items.length > 0 && <GroupCard title={group.title}>
<Row>
{
group.items && group.items.map((item, idx) => (
<Col span={12}>
<Row>
<Col span={12}
className={cs("formItem", "borderR-none")}>{item.label}</Col>
<Col span={12}
className={cs("formItem", { "borderR-none": idx === 0 })}>
<WeaInputNumber
min={0}
precision={2}
value={(paymentData && paymentData[item.domkey[0]]) ? paymentData[item.domkey[0]] : 0}
onChange={(value) => {
this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : '0' });
}}
/>
</Col>
</Row>
</Col>
))
}
</Row>
</GroupCard>
}
</div>
))
fundSchemeId && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => {
const { title, items } = item;
return <WeaSearchGroup
items={_.map(items, child => ({
com: SocialInputNumber({
key: child["domkey"][0],
label: child.label,
value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "",
onChange: this.handlePaymentChange,
min: child.min,
max: child.max
})
}))}
customComponent={<ConsistentWelfare value={Welfare} onChange={(Welfare) => this.setState({ Welfare })}
onBlurChange={this.handleChangeWelfare}/>}
title={title} col={2} showGroup
/>;
})
}
</div>
);

View File

@ -1,64 +1,43 @@
import React from "react";
import GroupCard from "../../../components/groupCard";
import { Col, Row, Tooltip } from "antd";
import { WeaFormItem, WeaInput, WeaSearchGroup } from "ecCom";
import { inject, observer } from "mobx-react";
import "./index.less";
@inject("archivesStore")
@observer
export default class BaseForm extends React.Component {
componentWillMount() {
const { archivesStore: { getBaseForm } } = this.props;
getBaseForm(this.props.employeeId);
}
render() {
const { archivesStore: { baseFormData } ,record} = this.props;
const { archivesStore: { baseFormData }, record } = this.props;
const { username, department, position, telephone, hiredate, dimissionDate } = baseFormData;
const { paymentOrganizationName } = record;
const baseItems = [
{ com: Input("姓名", username) },
{ com: Input("部门", department) },
{ com: Input("岗位", position) },
{ com: Input("手机号", telephone) },
{ com: Input("入职日期", hiredate) },
{ com: Input("合同到期日期", dimissionDate) }
];
const taxagentItems = [
{ com: Input("个税扣缴义务人", paymentOrganizationName, 6, 18) }
];
return (
<div className="socialFormWrapper">
<GroupCard title="基本信息">
<Row>
<Col span={4} className="formItem borderR-none borderB-none">姓名:</Col>
<Col span={4} className="formItem borderR-none borderB-none">
<Tooltip title={baseFormData.username}>
<span>{baseFormData.username}</span>
</Tooltip>
</Col>
<Col span={4} className="formItem borderR-none borderB-none">部门:</Col>
<Col span={4} className="formItem borderR-none borderB-none">
<Tooltip title={baseFormData.department}>
<span>{baseFormData.department}</span>
</Tooltip>
</Col>
<Col span={4} className="formItem borderR-none borderB-none">岗位:</Col>
<Col span={4} className="formItem borderB-none">
<Tooltip title={baseFormData.position}>
<span>{baseFormData.position}</span>
</Tooltip>
</Col>
</Row>
<Row>
<Col span={4} className="formItem borderR-none">入职日期:</Col>
<Col span={4} className="formItem borderR-none">{baseFormData.hiredate}</Col>
<Col span={4} className="formItem borderR-none">手机号:</Col>
<Col span={4} className="formItem borderR-none">
<Tooltip title={baseFormData.telephone}>
<span>{baseFormData.telephone}</span>
</Tooltip>
</Col>
<Col span={4} className="formItem borderR-none">合同到期日期:</Col>
<Col span={4} className="formItem">{baseFormData.dimissionDate}</Col>
</Row>
</GroupCard>
<GroupCard title="个税扣缴义务人">
<Row>
<Col span={6} className="formItem borderR-none">个税扣缴义务人</Col>
<Col span={6} className="formItem">{record.paymentOrganizationName}</Col>
</Row>
</GroupCard>
<WeaSearchGroup title="基本信息" items={baseItems} col={3} showGroup/>
<WeaSearchGroup title="个税扣缴义务人" items={taxagentItems} col={1} showGroup/>
</div>
);
}
}
const Input = (label, value, labelColSpan = 12, wrapperColSpan = 12) => {
return (
<WeaFormItem label={label} labelCol={{ span: labelColSpan }} wrapperCol={{ span: wrapperColSpan }}>
<WeaInput value={value} viewAttr={1}/>
</WeaFormItem>
);
};

View File

@ -3,7 +3,7 @@ import { inject, observer } from "mobx-react";
import { toJS } from "mobx";
import { Button, Dropdown, Menu, message, Modal, Popover } from "antd";
import { WeaHelpfulTip, WeaSlideModal, WeaTab, WeaTable, WeaTop, WeaNewScroll } from "ecCom";
import { getSearchs, renderLoading } from "../../../util"; // 渲染form数据的方法因为多个页面都会使用所以抽的公共方法在util中
import { getSearchs, renderLoading } from "../../../util";
import BaseForm from "./baseForm";
import SlideModalTitle from "../../../components/slideModalTitle";
import SocialSecurityForm from "./socialSecurityForm";
@ -50,9 +50,7 @@ export default class Archives extends React.Component {
total: 0
}
};
this.record = {};
this.pageInfo = { current: 1, pageSize: 10 };
}
componentDidMount() {
@ -94,16 +92,16 @@ export default class Archives extends React.Component {
});
};
handleEdit(record) {
handleEdit = (record) => {
this.record = record;
this.setState({ employeeId: record.employeeId, editSlideVisible: true });
}
};
setStep(step) {
setStep = (step) => {
this.setState({ step });
}
};
getColumns() {
getColumns = () => {
const { columns, pageInfo, selectedKey } = this.state;
const { taxAgentStore: { showOperateBtn } } = this.props;
let tmpV = _.map(columns.filter(item => item.display === "TRUE"), (item, index) => {
@ -206,49 +204,57 @@ export default class Archives extends React.Component {
);
}
}] : [];
}
};
// 保存
handleEditSlideSave = () => {
const { selectedTab } = this.state;
const { archivesStore: { save, socialSecurityForm, accumulationFundForm, otherForm } } = this.props;
if (selectedTab == 1) {
const { data } = socialSecurityForm;
if (data.socialSchemeId && !data.socialStartTime) {
Modal.warning({
title: "信息确认",
content: "必要信息不完整,红色*为必填项!"
});
return;
}
save("SOCIAL_SECURITY").then(() => {
this.query();
});
} else if (selectedTab == 2) {
const { data } = accumulationFundForm;
if (data.fundSchemeId && !data.fundStartTime) {
Modal.warning({
title: "信息确认",
content: "必要信息不完整,红色*为必填项!"
});
return;
}
save("ACCUMULATION_FUND").then(() => {
this.query();
});
} else if (selectedTab == 3) {
const { data } = otherForm;
if (data.otherSchemeId && !data.otherStartTime) {
Modal.warning({
title: "信息确认",
content: "必要信息不完整,红色*为必填项!"
});
return;
}
save("OTHER").then(() => {
this.query();
});
if (!this.handleSave) {
this.handleSave = _.debounce(() => {
const { selectedTab } = this.state;
const { archivesStore: { save, socialSecurityForm, accumulationFundForm, otherForm } } = this.props;
if (selectedTab == 1) {
const { data } = socialSecurityForm;
const { socialSchemeId, socialStartTime } = data;
if (socialSchemeId && !socialStartTime) {
Modal.warning({
title: "信息确认",
content: "必要信息不完整,红色*为必填项!"
});
return;
}
save("SOCIAL_SECURITY").then(() => {
this.query();
});
} else if (selectedTab == 2) {
const { data } = accumulationFundForm;
const { fundSchemeId, fundStartTime } = data;
if (fundSchemeId && !fundStartTime) {
Modal.warning({
title: "信息确认",
content: "必要信息不完整,红色*为必填项!"
});
return;
}
save("ACCUMULATION_FUND").then(() => {
this.query();
});
} else if (selectedTab == 3) {
const { data } = otherForm;
const { otherSchemeId, otherStartTime } = data;
if (otherSchemeId && !otherStartTime) {
Modal.warning({
title: "信息确认",
content: "必要信息不完整,红色*为必填项!"
});
return;
}
save("OTHER").then(() => {
this.query();
});
}
}, 500);
}
this.handleSave();
};
// 导入
@ -264,34 +270,34 @@ export default class Archives extends React.Component {
};
// 导入预览
handlePreviewImport(params) {
handlePreviewImport = (params) => {
const { archivesStore: { previewCurData } } = this.props;
previewCurData(params);
}
};
// 导入
handleImport(params) {
handleImport = (params) => {
const { archivesStore: { importBatch } } = this.props;
const { runStatus } = this.state;
importBatch({ ...params, runStatus });
}
};
// 导入完成
handleFinish() {
handleFinish = () => {
const { archivesStore: { initImportParams } } = this.props;
initImportParams();
this.setState({ importVisible: false, step: 0 }, () => {
this.query();
});
}
};
// 初始化导入参数
handleInitModal() {
handleInitModal = () => {
const { archivesStore: { setPreviewCurDataColumns, setPreviewCurDataDataSource, setImportResult } } = this.props;
setPreviewCurDataColumns([]);
setPreviewCurDataDataSource([]);
setImportResult({});
}
};
// 选项设置
onSelectChange = selectedRowKeys => {
@ -299,7 +305,7 @@ export default class Archives extends React.Component {
};
// 关闭导入框
handleImportCancel() {
handleImportCancel = () => {
const { archivesStore: { initImportParams, getTableDatas } } = this.props;
initImportParams();
@ -307,7 +313,7 @@ export default class Archives extends React.Component {
getTableDatas();
}
this.setState({ importVisible: false, step: 0 });
}
};
//切换tab
handleChangeTab = (selectedKey) => {
@ -536,24 +542,7 @@ export default class Archives extends React.Component {
form, condition, showSearchAd, setShowSearchAd,
previewCurDataColumns, previewCurDataDataSource, importResult
} = archivesStore;
if (_.isEmpty(this.getColumns())) { // 无权限处理
return renderLoading();
}
const rightMenu = [// 右键菜单
// {
// key: 'BTN_COLUMN',
// icon: <i className='icon-coms-Custom' />,
// content: '显示列定制',
// onClick: this.showColumn
// },
];
const collectParams = { // 收藏功能配置
favname: "社保福利档案",
favouritetype: 1,
objid: 0,
link: "wui/index.html#/ns_demo03/index",
importantlevel: 1
};
if (_.isEmpty(this.getColumns())) return renderLoading();
const adBtn = [ // 高级搜索内部按钮
<Button type="primary" onClick={() => {
setShowSearchAd(false);
@ -729,8 +718,6 @@ export default class Archives extends React.Component {
icon={<i className="icon-coms-fa"/>} // 左侧图标
iconBgcolor="#F14A2D" // 左侧图标背景色
showDropIcon={false} // 是否显示下拉按钮
dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同)
dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能
>
<WeaTab
datas={tabCondition}
@ -782,10 +769,12 @@ export default class Archives extends React.Component {
className="slideOuterWrapper"
visible={this.state.editSlideVisible}
top={0}
width={48}
measureT="%"
width={800}
measureX="px"
height={100}
direction={"right"}
measure={"%"}
measureY="%"
direction="right"
title={
<SlideModalTitle
subtitle={"员工福利档案"}
@ -800,11 +789,7 @@ export default class Archives extends React.Component {
(showOperateBtn && selectedKey !== "stop" && selectedTab != 0) ?
[<Button type="primary" onClick={() => this.handleEditSlideSave()}>保存</Button>] : []
}
subItemChange={
(selectedTab) => {
this.setState({ selectedTab });
}
}
subItemChange={selectedTab => this.setState({ selectedTab })}
/>
}
content={<div>

View File

@ -1,36 +1,33 @@
.socialFormWrapper {
.formItem {
height: 40px;
line-height: 40px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding-left: 10px;
padding-right: 10px;
border: 1px solid #e2e2e2;
margin-bottom: 0 !important;
.wea-search-group {
padding: 0 16px;
.ant-select-selection {
height: 30px;
border-radius: 0;
.wea-form-cell-wrapper {
border: 1px solid #e5e5e5;
border-bottom: none;
border-right: none;
margin: 0 16px;
.wea-form-cell {
padding: 4px 16px;
border-bottom: 1px solid #e5e5e5;
border-right: 1px solid #e5e5e5;
.wea-form-item {
padding: 0;
}
}
}
}
.borderR-none {
border-right: none;
}
.borderB-none {
border-bottom: none;
.welfareBaseWrapper {
.title {
margin-right: 10px;
}
}
}
.mySalaryBenefitsWrapper {
.tableWrapper {
flex: 1;
overflow: hidden;
}
.tdEllipsis {
display: inline-block;
width: 100%;

View File

@ -1,8 +1,15 @@
import React from "react";
import { inject, observer } from "mobx-react";
import { Col, Row } from "antd";
import { WeaCheckbox, WeaDatePicker, WeaInputNumber, WeaSelect } from "ecCom";
import GroupCard from "../../../components/groupCard";
import { message } from "antd";
import { WeaSearchGroup } from "ecCom";
import { toJS } from "mobx";
import {
ConsistentWelfare,
SocialDatePicker,
SocialInputNumber,
SocialSelect,
SocialTitle
} from "./socialSecurityForm";
import "./index.less";
@inject("archivesStore")
@ -11,7 +18,7 @@ export default class OtherForm extends React.Component {
constructor(props) {
super(props);
this.state = {
inited: false
Welfare: ""
};
}
@ -22,151 +29,122 @@ export default class OtherForm extends React.Component {
}
// 获取基数表单
handleFetchPaymentForm(value) {
handleFetchPaymentForm = (value) => {
const { archivesStore: { getPaymentForm } } = this.props;
getPaymentForm(this.props.employeeId, "OTHER", value, this.props.record.paymentOrganization);
}
// 表单变化
handleFormChange(params) {
getPaymentForm(this.props.employeeId, "OTHER", value, this.props.record.paymentOrganization, true);
};
handleFormChange = ({ key, value }) => {
const params = { [key]: value };
const { archivesStore: { otherForm, setOtherForm }, onChangeRecordOtherSchemeId } = this.props;
const { data } = otherForm;
let request = { ...data, ...params };
let form = { ...otherForm };
form.data = request;
setOtherForm(form);
Object.keys(params).length > 1 &&
onChangeRecordOtherSchemeId(params.otherSchemeId);
}
//基数变化
handlePaymentChange(params) {
key === "otherSchemeId" && this.setState({ Welfare: "" });
key === "otherSchemeId" && this.handleFetchPaymentForm(value);
key === "otherSchemeId" && onChangeRecordOtherSchemeId(value);
};
handlePaymentChange = ({ key, value }) => {
const params = { [key]: !_.isNil(value) ? value.toString() : "" };
const { archivesStore: { otherPaymentForm, setOtherPaymentForm } } = this.props;
const { data } = otherPaymentForm;
let request = { ...data, ...params };
let form = { ...otherPaymentForm };
form.data = request;
setOtherPaymentForm(form);
}
};
render() {
const { archivesStore: { otherForm, otherPaymentForm } } = this.props;
const { items } = otherForm;
let baseData = otherForm.data;
let data = { ...baseData };
let paymentData = otherPaymentForm.data;
let paymentItems = otherPaymentForm.items;
// Integer数据转为string
if (data) {
Object.keys(data).map(key => {
if (data[key]) {
data[key] = data[key].toString();
handleChangeWelfare = (val) => {
const { archivesStore: { otherPaymentForm, setOtherPaymentForm } } = this.props;
let paymentData = toJS(otherPaymentForm.data);
const [paymentFormItems] = toJS(otherPaymentForm.items);
const { items } = paymentFormItems;
if (val) {
_.forEach(items, (it) => {
const { min, max, domkey } = it;
const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
if ((val < minNum || val > maxNum) && !_.isNil(min) && !_.isNil(max) && (!!maxNum || !!minNum)) {
message.warning("超出所选缴纳方案设置的基数上下限范围,将自动按基数上下限填充。");
paymentData = {
...paymentData,
[domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val
};
} else {
paymentData = { ...paymentData, [domkey[0]]: val };
}
});
} else {
_.forEach(items, (it) => {
const { domkey } = it;
paymentData = { ...paymentData, [domkey[0]]: "" };
});
}
setOtherPaymentForm({ ...otherPaymentForm, data: { ...paymentData } });
};
render() {
const { Welfare } = this.state;
const { archivesStore: { otherForm, otherPaymentForm } } = this.props;
const { items, data: otherData } = otherForm;
let paymentData = otherPaymentForm.data;
let paymentItems = otherPaymentForm.items;
const { nonPayment = "", otherStartTime = "", otherEndTime = "", otherSchemeId = "" } = otherData || {};
const otherItems = !_.isNil(toJS(items)) ? [
..._.map(_.filter(toJS(items)[0].items, it => it.domkey[0] !== "paymentOrganization"),
item => ({
com: SocialSelect({
key: item["domkey"][0],
label: item.label,
value: !_.isNil(otherData[item["domkey"][0]]) ? otherData[item["domkey"][0]].toString() : "",
options: item.options,
onChange: this.handleFormChange
})
})),
{
com: SocialDatePicker({
key: "otherStartTime",
label: "其他福利起始缴纳月",
viewAttr: otherSchemeId ? 3 : 2,
value: otherStartTime,
onChange: this.handleFormChange
})
},
{
com: SocialDatePicker({
key: "otherEndTime",
label: "其他福利最后缴纳月",
value: otherEndTime,
onChange: this.handleFormChange
})
}
] : [];
return (
<div className="socialFormWrapper">
<div style={{ overflow: "hidden" }}>
<WeaCheckbox style={{ float: "right", marginRight: "10px", marginTop: "10px" }}
value={data && data.nonPayment} id="nonPayment" content="暂不缴纳" onChange={(value) => {
this.handleFormChange({ nonPayment: value });
}}/>
</div>
<GroupCard title="其他福利基础信息">
<Row>
<Col span={6} className="formItem borderR-none borderB-none">其他福利起始缴纳月</Col>
<Col span={6} className="formItem borderR-none borderB-none">
<WeaDatePicker
viewAttr={(otherForm.data && otherForm.data.otherSchemeId) ? 3 : 2}
format="yyyy-MM"
value={data && data.otherStartTime}
onChange={value => this.handleFormChange({ otherStartTime: value })}
/>
</Col>
<Col span={6} className="formItem borderR-none borderB-none">其他福利方案名称</Col>
<Col span={6} className="formItem borderB-none">
<WeaSelect
options={(items && items[0].items && items[0].items[0]) ? [{
key: "",
showname: ""
}, ...items[0].items[0].options] : []}
value={data && data.otherSchemeId}
style={{ width: "100%" }}
onChange={(value, showname) => {
this.handleFormChange({ otherName: showname, otherSchemeId: value });
this.handleFetchPaymentForm(value);
}}/>
</Col>
</Row>
<Row>
<Col span={6} className="formItem borderR-none">其他福利最后缴纳月</Col>
<Col span={6} className="formItem borderR-none">
<WeaDatePicker
format="yyyy-MM"
value={data && data.otherEndTime}
onChange={value => this.handleFormChange({ otherEndTime: value })}
/>
</Col>
<Col span={6} className="formItem borderR-none"><span
title="其他福利个人实际承担方">其他福利个人实际承担方</span></Col>
<Col span={6} className="formItem">
<WeaSelect
options={(items && items[0].items && items[0].items[2]) ? items[0].items[2].options : []}
value={data && data.underTake}
style={{ width: "100%" }}
onChange={(value) => {
this.handleFormChange({ underTake: value });
}}
/>
</Col>
</Row>
{/*<Row>*/}
{/*<Col span={6} className="formItem">社保缴纳组织:</Col>*/}
{/*<Col span={6} className="formItem">*/}
{/* <Select defaultValue={data && data.paymentOrganization} */}
{/* notFoundContent="暂无数据" value={data && data.paymentOrganization} style={{ width: "100%" }} onChange={(value) => this.handleFormChange({paymentOrganization: value})}>*/}
{/* {*/}
{/* items && items[0].items &&items[0].items[1] && items[0].items[1].options.map(item => (*/}
{/* <Option value={item.key}>{item.showname}</Option>*/}
{/* ))*/}
{/* }*/}
{/* </Select>*/}
{/* */}
{/*</Col>*/}
{/*</Row>*/}
</GroupCard>
<WeaSearchGroup
title="其他福利基础信息"
customComponent={<SocialTitle keyname="nonPayment" value={nonPayment.toString()}
onChange={this.handleFormChange}/>}
items={otherItems} col={2} showGroup needTigger={false}/>
{
data.otherSchemeId && paymentItems && paymentItems.map(group => (
<div>
{
group.items && group.items.length > 0 && <GroupCard title={group.title}>
<Row>
{
group.items && group.items.map(item => (
<Col span={12}>
<Row>
<Col span={12} className="formItem">{item.label}</Col>
<Col span={12} className="formItem">
<WeaInputNumber
min={0}
precision={2}
value={(paymentData && paymentData[item.domkey[0]]) ? paymentData[item.domkey[0]] : 0}
onChange={(value) => {
this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : "0" });
}}
/>
</Col>
</Row>
</Col>
))
}
</Row>
</GroupCard>
}
</div>
))
otherSchemeId && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => {
const { title, items } = item;
return <WeaSearchGroup
items={_.map(items, child => ({
com: SocialInputNumber({
key: child["domkey"][0],
label: child.label,
value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "",
onChange: this.handlePaymentChange,
min: child.min,
max: child.max
})
}))}
customComponent={<ConsistentWelfare value={Welfare} onChange={(Welfare) => this.setState({ Welfare })}
onBlurChange={this.handleChangeWelfare}/>}
title={title} col={2} showGroup
/>;
})
}
</div>
);

View File

@ -1,14 +1,20 @@
import React from "react";
import GroupCard from "../../../components/groupCard";
import { Col, Row } from "antd";
import { WeaCheckbox, WeaDatePicker, WeaInput, WeaInputNumber, WeaSelect } from "ecCom";
import { WeaCheckbox, WeaDatePicker, WeaFormItem, WeaInput, WeaInputNumber, WeaSearchGroup, WeaSelect } from "ecCom";
import { message } from "antd";
import { inject, observer } from "mobx-react";
import cs from "classnames";
import { toJS } from "mobx";
import "./index.less";
@inject("archivesStore")
@observer
export default class SocialSecurityForm extends React.Component {
constructor(props) {
super(props);
this.state = {
Welfare: ""
};
}
componentWillMount() {
const { archivesStore } = this.props;
const { getBaseForm, getPaymentForm } = archivesStore;
@ -17,173 +23,204 @@ export default class SocialSecurityForm extends React.Component {
getPaymentForm(this.props.employeeId, "SOCIAL_SECURITY", siSchemeId, this.props.record.paymentOrganization);
}
// 表单变化
handleFormChange(params) {
const { archivesStore: { socialSecurityForm, setSocialSecurityForm }, onChangeRecordSchemeId } = this.props;
handleFormChange = ({ key, value }) => {
const params = { [key]: value };
const {
archivesStore: { socialSecurityForm, setSocialSecurityForm },
onChangeRecordSchemeId
} = this.props;
const { data } = socialSecurityForm;
let request = { ...data, ...params };
let form = { ...socialSecurityForm };
form.data = request;
setSocialSecurityForm(form);
Object.keys(params).length > 1 &&
onChangeRecordSchemeId(params.socialSchemeId);
}
key === "socialSchemeId" && this.setState({ Welfare: "" });
key === "socialSchemeId" && this.handleFetchPaymentForm(value);
key === "socialSchemeId" && onChangeRecordSchemeId(value);
};
// 获取基数表单
handleFetchPaymentForm(value) {
const { archivesStore: { getPaymentForm } } = this.props;
getPaymentForm(this.props.employeeId, "SOCIAL_SECURITY", value, this.props.record.paymentOrganization);
}
handleFetchPaymentForm = (value) => {
const { archivesStore: { getPaymentForm }, employeeId, record } = this.props;
const { paymentOrganization } = record;
getPaymentForm(employeeId, "SOCIAL_SECURITY", value, paymentOrganization, true);
};
//基数变化
handlePaymentChange(params) {
handlePaymentChange = ({ key, value }) => {
const params = { [key]: !_.isNil(value) ? value.toString() : "" };
const { archivesStore: { socialSecurityPaymentForm, setSocialSecurityPaymentForm } } = this.props;
const { data } = socialSecurityPaymentForm;
let request = { ...data, ...params };
let form = { ...socialSecurityPaymentForm };
form.data = request;
setSocialSecurityPaymentForm(form);
}
render() {
const { archivesStore: { socialSecurityForm, socialSecurityPaymentForm } } = this.props;
const { items } = socialSecurityForm;
let baseData = socialSecurityForm.data;
let paymentData = socialSecurityPaymentForm.data;
let paymentItems = socialSecurityPaymentForm.items;
// Integer数据转为string
let data = { ...baseData };
if (data) {
Object.keys(data).map(key => {
if (data[key]) {
data[key] = data[key].toString();
};
handleChangeWelfare = (val) => {
const { archivesStore: { socialSecurityPaymentForm, setSocialSecurityPaymentForm } } = this.props;
let paymentData = toJS(socialSecurityPaymentForm.data);
const [paymentFormItems] = toJS(socialSecurityPaymentForm.items);
const { items } = paymentFormItems;
if (val) {
_.forEach(items, (it) => {
const { min, max, domkey } = it;
const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
if ((val < minNum || val > maxNum) && !_.isNil(min) && !_.isNil(max) && (!!maxNum || !!minNum)) {
message.warning("超出所选缴纳方案设置的基数上下限范围,将自动按基数上下限填充。");
paymentData = {
...paymentData,
[domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val
};
} else {
paymentData = { ...paymentData, [domkey[0]]: val };
}
});
} else {
_.forEach(items, (it) => {
const { domkey } = it;
paymentData = { ...paymentData, [domkey[0]]: "" };
});
}
setSocialSecurityPaymentForm({ ...socialSecurityPaymentForm, data: { ...paymentData } });
};
render() {
const { Welfare } = this.state;
const { archivesStore: { socialSecurityForm, socialSecurityPaymentForm } } = this.props;
const { items, data: socialData } = socialSecurityForm;
const paymentData = toJS(socialSecurityPaymentForm.data);
const paymentItems = socialSecurityPaymentForm.items;
const {
nonPayment = "", schemeAccount = "", socialStartTime = "", socialEndTime = "",
socialSchemeId = ""
} = socialData || {};
const socialItems = !_.isNil(toJS(items)) ? [
..._.map(_.filter(toJS(items)[0].items, it => it.domkey[0] !== "paymentOrganization"),
item => ({
com: SocialSelect({
key: item["domkey"][0],
label: item.label,
value: !_.isNil(socialData[item["domkey"][0]]) ? socialData[item["domkey"][0]].toString() : "",
options: item.options,
onChange: this.handleFormChange
})
})),
{
com: SocialDatePicker({
key: "socialStartTime",
label: "社保起始缴纳月",
viewAttr: socialSchemeId ? 3 : 2,
value: socialStartTime,
onChange: this.handleFormChange
})
},
{
com: SocialEditInput({
key: "schemeAccount",
label: "社保账号",
value: schemeAccount,
onChange: this.handleFormChange
})
},
{
com: SocialDatePicker({
key: "socialEndTime",
label: "社保最后缴纳月",
value: socialEndTime,
onChange: this.handleFormChange
})
}
] : [];
return (
<div className="socialFormWrapper">
<div style={{ overflow: "hidden" }}>
<WeaCheckbox
style={{ float: "right", marginRight: "10px", marginTop: "10px" }}
value={data && data.nonPayment}
id="nonPayment"
content="暂不缴纳"
onChange={(value) => {
this.handleFormChange({ nonPayment: value });
}}
/>
</div>
<GroupCard title="社保基础信息">
<Row>
<Col span={6} className="formItem borderR-none borderB-none">社保起始缴纳月</Col>
<Col span={6} className="formItem borderR-none borderB-none">
<WeaDatePicker
viewAttr={(socialSecurityForm.data && socialSecurityForm.data.socialSchemeId) ? 3 : 2}
format="YYYY-MM"
value={data && data.socialStartTime}
onChange={value => {
this.handleFormChange({ socialStartTime: value });
}}
/>
</Col>
<Col span={6} className="formItem borderR-none borderB-none">社保方案名称</Col>
<Col span={6} className="formItem">
<WeaSelect
options={(items && items[0].items && items[0].items[0]) ? [{
key: "",
showname: ""
}, ...items[0].items[0].options] : []}
value={data && data.socialSchemeId}
style={{ width: "100%" }}
onChange={(value, showName) => {
this.handleFormChange({ socialName: showName, socialSchemeId: value });
this.handleFetchPaymentForm(value);
}}
/>
</Col>
</Row>
<Row>
<Col span={6} className="formItem borderR-none borderB-none">社保最后缴纳月</Col>
<Col span={6} className="formItem borderR-none borderB-none">
<WeaDatePicker
format="YYYY-MM"
value={data && data.socialEndTime}
onChange={value => this.handleFormChange({ socialEndTime: value })}
/>
</Col>
<Col span={6} className="formItem borderR-none">社保账号</Col>
<Col span={6} className="formItem">
<WeaInput value={data && data.schemeAccount} onChange={(value) => {
this.handleFormChange({ schemeAccount: value });
}}/>
</Col>
</Row>
<Row>
{/*<Col span={6} className="formItem borderR-none">个税扣缴义务人:</Col>*/}
{/*<Col span={6} className="formItem borderR-none">*/}
{/* <Select*/}
{/* defaultValue={data && data.paymentOrganization}*/}
{/* value={data && data.paymentOrganization}*/}
{/* style={{ width: "100%" }}*/}
{/* notFoundContent={"暂无数据"}*/}
{/* onChange={(value) => this.handleFormChange({ paymentOrganization: value })}>*/}
{/* {*/}
{/* items && items[0].items && items[0].items[1] && items[0].items[1].options.map(item => (*/}
{/* <Option value={item.key}>{item.showname}</Option>*/}
{/* ))*/}
{/* }*/}
{/* </Select>*/}
{/*</Col>*/}
<Col span={6} className="formItem borderR-none">社保个人实际承担方</Col>
<Col span={6} className="formItem">
<WeaSelect
options={(items && items[0].items && items[0].items[2]) ? items[0].items[2].options : []}
value={data && data.underTake}
style={{ width: "100%" }}
onChange={(value) => {
this.handleFormChange({ underTake: value });
}}
/>
</Col>
</Row>
</GroupCard>
<WeaSearchGroup
title="社保基础信息"
customComponent={<SocialTitle keyname="nonPayment" value={nonPayment.toString()}
onChange={this.handleFormChange}/>}
items={socialItems} col={2} showGroup needTigger={false}/>
{
data.socialSchemeId && paymentItems && paymentItems.map(group => (
<div>
{
group.items && group.items.length > 0 && <GroupCard title={group.title}>
<Row>
{
group.items && group.items.map((item, idx) => (
<Col span={12}>
<Row>
<Col span={12}
className={cs("formItem", "borderR-none", { "borderB-none": idx !== group.items.length - 1 && idx !== group.items.length - 2 })}>{item.label}</Col>
<Col span={12} className={cs("formItem", {
"borderR-none": idx === 0 || idx === 2,
"borderB-none": idx === 0 || idx === 2 || idx === 1
})}>
<WeaInputNumber
min={0}
precision={2}
value={(paymentData && paymentData[item.domkey[0]]) ? paymentData[item.domkey[0]] : 0}
onChange={(value) => {
this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : "0" });
}}
/>
</Col>
</Row>
</Col>
))
}
</Row>
</GroupCard>
}
</div>
))
socialSchemeId && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => {
const { title, items } = item;
return <WeaSearchGroup
items={_.map(items, child => ({
com: SocialInputNumber({
key: child["domkey"][0],
label: child.label,
value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "",
onChange: this.handlePaymentChange,
min: child.min,
max: child.max
})
}))}
customComponent={<ConsistentWelfare value={Welfare} onChange={(Welfare) => this.setState({ Welfare })}
onBlurChange={this.handleChangeWelfare}/>}
title={title} col={2} showGroup
/>;
})
}
</div>
);
}
}
export const ConsistentWelfare = (props) => {
const { onChange, onBlurChange, value } = props;
return <div className="welfareBaseWrapper">
<span className="title">各项福利基数一致</span>
<WeaInputNumber
style={{ width: 100 }}
onBlur={onBlurChange}
value={value}
onChange={onChange}
precision={2}
/>
</div>;
};
export const SocialTitle = (props) => {
const { value, onChange, keyname: key } = props;
return <WeaCheckbox value={value} content="暂不缴纳" onChange={(val) => onChange({ key, value: val })}/>;
};
export const SocialSelect = (props) => {
const { key, value, onChange, options, label, labelColSpan = 12, wrapperColSpan = 12 } = props;
return <WeaFormItem label={label} labelCol={{ span: labelColSpan }} wrapperCol={{ span: wrapperColSpan }}>
<WeaSelect value={value} options={options} onChange={(val) => onChange({ key, value: val })}/>
</WeaFormItem>;
};
export const SocialEditInput = (props) => {
const { key, value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props;
return (
<WeaFormItem label={label} labelCol={{ span: labelColSpan }} wrapperCol={{ span: wrapperColSpan }}>
<WeaInput value={value} onChange={(val) => onChange({ key, value: val })}/>
</WeaFormItem>
);
};
export const SocialInputNumber = (props) => {
const { key, value, onChange, label, min, max, labelColSpan = 12, wrapperColSpan = 12 } = props;
const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
return (
<WeaFormItem label={label} labelCol={{ span: labelColSpan }} wrapperCol={{ span: wrapperColSpan }}>
<WeaInputNumber
value={value} onChange={(val) => onChange({ key, value: val })} precision={2}
min={minNum > 0 ? minNum : -999999999999999}
max={maxNum > 0 ? maxNum : 999999999999999}
/>
</WeaFormItem>
);
};
export const SocialDatePicker = (props) => {
const {
key,
value,
onChange,
label,
format = "YYYY-MM",
viewAttr = 2,
labelColSpan = 12,
wrapperColSpan = 12
} = props;
return (
<WeaFormItem label={label} labelCol={{ span: labelColSpan }} wrapperCol={{ span: wrapperColSpan }}>
<WeaDatePicker value={value} viewAttr={viewAttr} format={format}
onChange={(val) => onChange({ key, value: val })}/>
</WeaFormItem>
);
};

View File

@ -1,11 +1,11 @@
import React from "react";
import { WeaHelpfulTip, WeaInput, WeaInputNumber, WeaSelect, WeaTable } from "ecCom";
import { Col, Row, Switch } from "antd";
import { WeaHelpfulTip, WeaInputNumber, WeaSelect, WeaTab, WeaTable } from "ecCom";
import { Switch } from "antd";
import { insertUpdateColumns } from "./columns";
import { inject, observer } from "mobx-react";
import SmallTab from "../../../components/smallTab";
import PaymentPeriodModal from "./paymentPeriodModal";
import "./index.less";
import SchemeInfoForm from "./schemeInfoForm";
@inject("programmeStore", "salaryFileStore", "taxAgentStore")
@observer
@ -14,7 +14,7 @@ export default class DefaultSlideForm extends React.Component {
super(props);
this.state = {
value: "SCHEME_TOWN",
selectItem: "个人",
selectedKey: "PERSONAL",
dataSource: {},
paymentPeriodModal: {
visible: false,
@ -275,7 +275,7 @@ export default class DefaultSlideForm extends React.Component {
setDefaultPersonDataSource(dataSource);
setDefaultCompanyDataSource(dataSource_company);
} else {
if (this.state.selectItem == "个人") {
if (this.state.selectedKey === "PERSONAL") {
let dataSource = [...defaultPersonDataSource];
dataSource = dataSource.map(item => {
if (item.id == result.id) return result;
@ -330,15 +330,9 @@ export default class DefaultSlideForm extends React.Component {
});
};
componentDidMount() {
const { taxAgentStore } = this.props;
const { getTaxAgentSelectListAsAdmin } = taxAgentStore;
getTaxAgentSelectListAsAdmin();
}
render() {
const { paymentPeriodModal } = this.state;
const { programmeStore, salaryFileStore, taxAgentStore } = this.props;
const { programmeStore, salaryFileStore, taxAgentStore, requestParams, onChange } = this.props;
const { userStatusList } = salaryFileStore;
const { taxAgentAdminOption, getTaxAgentSelectListAsAdmin } = taxAgentStore;
const { defaultPersonDataSource, defaultCompanyDataSource } = programmeStore;
@ -359,120 +353,112 @@ export default class DefaultSlideForm extends React.Component {
showname: "农村"
}
];
const handleSmallTabChange = item => {
this.setState({
selectItem: item.value
});
};
return (
<div className="defaultSlideForm">
<div>
<Row style={{ lineHeight: "40px" }}>
<Col span={6}>
缴纳类型
</Col>
<Col span={18}>
<WeaSelect
style={{ width: "200px" }}
options={options}
viewAttr={3}
value={this.props.requestParams.paymentType}
onChange={(v, showname) => {
let requestParams = { ...this.props.requestParams };
requestParams.paymentType = v;
this.props.onChange(requestParams);
}}
/>
</Col>
</Row>
{/*<div>*/}
{/* <Row style={{ lineHeight: "40px" }}>*/}
{/* <Col span={6}>*/}
{/* 缴纳类型*/}
{/* </Col>*/}
{/* <Col span={18}>*/}
{/* <WeaSelect*/}
{/* style={{ width: "200px" }}*/}
{/* options={options}*/}
{/* viewAttr={3}*/}
{/* value={this.props.requestParams.paymentType}*/}
{/* onChange={(v, showname) => {*/}
{/* let requestParams = { ...this.props.requestParams };*/}
{/* requestParams.paymentType = v;*/}
{/* this.props.onChange(requestParams);*/}
{/* }}*/}
{/* />*/}
{/* </Col>*/}
{/* </Row>*/}
<Row style={{ lineHeight: "40px" }}>
<Col span={6}>
方案名称
</Col>
<Col span={18}>
<WeaInput
style={{ width: "200px" }}
viewAttr={3}
value={this.props.requestParams.schemeName}
onChange={value => {
let requestParams = { ...this.props.requestParams };
requestParams.schemeName = value;
this.props.onChange(requestParams);
}}
/>
</Col>
</Row>
<Row style={{ lineHeight: "40px" }}>
<Col span={6}>可见性</Col>
<Col span={18}>
<WeaSelect
style={{ width: "200px" }}
value={this.props.requestParams.sharedType}
options={userStatusList}
onChange={(visibleVal) => {
let requestParams = { ...this.props.requestParams };
visibleVal === "1" && getTaxAgentSelectListAsAdmin();
(visibleVal === "0" || visibleVal === "") && (requestParams.taxAgentIds = "");
requestParams.sharedType = visibleVal;
this.props.onChange(requestParams);
}}
/>
</Col>
</Row>
{
this.props.requestParams.sharedType === "1" &&
<Row style={{ display: "flex", alignItems: "center", height: 40, marginTop: 8 }}>
<Col span={6}>可见性范围</Col>
<Col span={18}>
<WeaSelect
multiple
viewAttr={3}
style={{ width: "200px" }}
value={this.props.requestParams.taxAgentIds}
options={taxAgentAdminOption}
onChange={(value) => {
let requestParams = { ...this.props.requestParams };
requestParams.taxAgentIds = value;
this.props.onChange(requestParams);
}}
/>
</Col>
</Row>
}
<Row style={{ lineHeight: "40px" }}>
<Col span={6}>备注</Col>
<Col span={18}>
<WeaInput
style={{ width: "200px" }}
value={this.props.requestParams.remarks}
onChange={value => {
let requestParams = { ...this.props.requestParams };
requestParams.remarks = value;
this.props.onChange(requestParams);
}}
/>
</Col>
</Row>
</div>
{/* <Row style={{ lineHeight: "40px" }}>*/}
{/* <Col span={6}>*/}
{/* 方案名称*/}
{/* </Col>*/}
{/* <Col span={18}>*/}
{/* <WeaInput*/}
{/* style={{ width: "200px" }}*/}
{/* viewAttr={3}*/}
{/* value={this.props.requestParams.schemeName}*/}
{/* onChange={value => {*/}
{/* let requestParams = { ...this.props.requestParams };*/}
{/* requestParams.schemeName = value;*/}
{/* this.props.onChange(requestParams);*/}
{/* }}*/}
{/* />*/}
{/* </Col>*/}
{/* </Row>*/}
{/* <Row style={{ lineHeight: "40px" }}>*/}
{/* <Col span={6}>可见性</Col>*/}
{/* <Col span={18}>*/}
{/* <WeaSelect*/}
{/* style={{ width: "200px" }}*/}
{/* value={this.props.requestParams.sharedType}*/}
{/* options={userStatusList}*/}
{/* onChange={(visibleVal) => {*/}
{/* let requestParams = { ...this.props.requestParams };*/}
{/* visibleVal === "1" && getTaxAgentSelectListAsAdmin();*/}
{/* (visibleVal === "0" || visibleVal === "") && (requestParams.taxAgentIds = "");*/}
{/* requestParams.sharedType = visibleVal;*/}
{/* this.props.onChange(requestParams);*/}
{/* }}*/}
{/* />*/}
{/* </Col>*/}
{/* </Row>*/}
{/* {*/}
{/* this.props.requestParams.sharedType === "1" &&*/}
{/* <Row style={{ display: "flex", alignItems: "center", height: 40, marginTop: 8 }}>*/}
{/* <Col span={6}>可见性范围</Col>*/}
{/* <Col span={18}>*/}
{/* <WeaSelect*/}
{/* multiple*/}
{/* viewAttr={3}*/}
{/* style={{ width: "200px" }}*/}
{/* value={this.props.requestParams.taxAgentIds}*/}
{/* options={taxAgentAdminOption}*/}
{/* onChange={(value) => {*/}
{/* let requestParams = { ...this.props.requestParams };*/}
{/* requestParams.taxAgentIds = value;*/}
{/* this.props.onChange(requestParams);*/}
{/* }}*/}
{/* />*/}
{/* </Col>*/}
{/* </Row>*/}
{/* }*/}
{/* <Row style={{ lineHeight: "40px" }}>*/}
{/* <Col span={6}>备注</Col>*/}
{/* <Col span={18}>*/}
{/* <WeaInput*/}
{/* style={{ width: "200px" }}*/}
{/* value={this.props.requestParams.remarks}*/}
{/* onChange={value => {*/}
{/* let requestParams = { ...this.props.requestParams };*/}
{/* requestParams.remarks = value;*/}
{/* this.props.onChange(requestParams);*/}
{/* }}*/}
{/* />*/}
{/* </Col>*/}
{/* </Row>*/}
{/*</div>*/}
<SchemeInfoForm {...this.props} onChangeFieldsItem={(val) => onChange({ ...requestParams, ...val })}/>
<div className="tableBar">
<div>
<SmallTab
items={[
{ title: "个人", value: "个人" },
{ title: "公司", value: "公司" }
]}
onChange={item => {
handleSmallTabChange(item);
}}
/>
</div>
<WeaTab
datas={[
{ title: "个人", viewcondition: "PERSONAL" },
{ title: "公司", viewcondition: "COMPANY" }
]}
keyParam="viewcondition"
selectedKey={this.state.selectedKey}
onChange={selectedKey => this.setState({ selectedKey })}
/>
<div className="tableWrapper">
{this.state.selectItem == "个人"
{this.state.selectedKey === "PERSONAL"
? <WeaTable
dataSource={defaultPersonDataSource}
columns={insertUpdateColumns}

View File

@ -1,10 +1,65 @@
export const paymentScopeEnum = {
1: "SCOPE_COMPANY",
2: "SCOPE_PERSON"
}
1: "SCOPE_COMPANY",
2: "SCOPE_PERSON"
};
export const welfareTypeEnum = {
1: "SOCIAL_SECURITY",
2: "ACCUMULATION_FUND",
3: "OTHER"
}
1: "SOCIAL_SECURITY",
2: "ACCUMULATION_FUND",
3: "OTHER"
};
export const schemeFields = [
{
key: "paymentType",
label: "缴纳类型",
type: "SELECT",
options: [
{
key: "",
selected: false,
showname: ""
},
{
key: "SCHEME_TOWN",
selected: true,
showname: "城镇"
},
{
key: "SCHEME_VILLAGE",
selected: false,
showname: "农村"
}
],
viewAttr: 3,
tip: ""
},
{
key: "schemeName",
label: "方案名称",
type: "INPUT",
viewAttr: 3,
tip: ""
},
{
key: "sharedType",
label: "可见性",
type: "SELECT",
viewAttr: 2,
tip: ""
},
{
key: "taxAgentIds",
label: "可见性范围",
type: "SELECT",
viewAttr: 3,
tip: ""
},
{
key: "remarks",
label: "备注",
type: "TEXTAREA",
viewAttr: 2,
tip: ""
}
];

View File

@ -38,11 +38,13 @@ export default class Programme extends React.Component {
}
componentWillMount() {
const { programmeStore, salaryFileStore } = this.props;
const { programmeStore, salaryFileStore, taxAgentStore } = this.props;
const { doInit } = programmeStore;
doInit();
const { commonEnumList } = salaryFileStore;
commonEnumList("user", { enumClass: "com.engine.salary.enums.sicategory.SharedTypeEnum" });
const { getTaxAgentSelectListAsAdmin } = taxAgentStore;
getTaxAgentSelectListAsAdmin();
}
// 增加编辑功能重写columns绑定事件
@ -67,6 +69,7 @@ export default class Programme extends React.Component {
case "operate":
return (
<a
href="javascript: void(0);"
onClick={() => {
this.onEdit(record);
}}>
@ -196,8 +199,9 @@ export default class Programme extends React.Component {
getForm({
welfareTypeEnum: selectedKey,
id
}).then(() => {
this.setState({ slideVisiable: true, customEdit: true, currentOperate: "update" });
});
this.setState({ slideVisiable: true, customEdit: true, currentOperate: "update" });
}
onCopy(record) {
@ -498,19 +502,22 @@ export default class Programme extends React.Component {
className="slideOuterWrapper"
visible={this.state.slideVisiable}
top={0}
width={60}
measureT="%"
width={800}
measureX="px"
height={100}
measureY="%"
direction={"right"}
measure={"%"}
title={
<SlideModalTitle
subtitle={this.state.customEdit ? "修改" : "新增"}
subTabs={[{ title: "基础设置" }]}
subtitle={
this.state.customEdit ?
`修改${_.find(topTab, it => it.viewcondition === selectedKey).title}方案` :
`新增${_.find(topTab, it => it.viewcondition === selectedKey).title}方案`
}
editable={true}
showOperateBtn={showOperateBtn}
onSave={() => {
handleOnSave();
}}
onSave={() => handleOnSave()}
/>
}
content={

View File

@ -1,5 +1,20 @@
.defaultSlideForm {
padding: 20px;
padding: 16px;
.wea-search-group {
padding: 0;
border: 1px solid #e5e5e5;
border-bottom: none;
.wea-content {
padding: 0;
}
.wea-form-item {
padding: 4px 16px;
border-bottom: 1px solid #e5e5e5;
}
}
.tableBar {
margin-top: 10px;

View File

@ -0,0 +1,97 @@
/*
* Author: 黎永顺
* name: 社保福利方案-信息表单
* Description:
* Date: 2023/2/13
*/
import React, { Component } from "react";
import { WeaFormItem, WeaInput, WeaSearchGroup, WeaSelect, WeaTextarea } from "ecCom";
import { schemeFields } from "./enum";
class SchemeInfoForm extends Component {
constructor(props) {
super(props);
this.state = {
schemeFieldsItem: schemeFields
};
}
componentDidMount() {
const { schemeFieldsItem } = this.state;
const { requestParams, salaryFileStore: { userStatusList }, taxAgentStore: { taxAgentAdminOption } } = this.props;
const { sharedType } = requestParams;
this.setState({
schemeFieldsItem: _.map(schemeFieldsItem, item => {
const { key } = item;
switch (key) {
case "sharedType":
return {
...item,
options: userStatusList
};
case "taxAgentIds":
return {
...item,
multiple: true,
display: !_.isNil(sharedType) && sharedType.toString() === "1",
options: taxAgentAdminOption
};
default:
break;
}
return { ...item };
})
});
}
handleChangeSchemeFiledItems = (key, v) => {
const { onChangeFieldsItem } = this.props;
const { schemeFieldsItem } = this.state;
this.setState({
schemeFieldsItem: _.map(schemeFieldsItem, item => {
if (key === "sharedType" && item.key === "taxAgentIds") {
return { ...item, display: v === "1" };
}
return { ...item };
})
}, () => {
onChangeFieldsItem({ [key]: (key === "useDefault" || key === "useInEmployeeSalary") ? Number(v) : v });
});
};
render() {
const { requestParams } = this.props;
const { schemeFieldsItem } = this.state;
return (
<WeaSearchGroup showGroup needTigger={false}>
{
_.map(schemeFieldsItem, item => {
const { key, label, type, viewAttr, options, display = true, multiple = false } = item;
const value = !_.isNil(requestParams[key]) ? requestParams[key].toString() : "";
return <React.Fragment>
{
(type === "INPUT" && display) ?
<WeaFormItem label={label} labelCol={{ span: 6 }} wrapperCol={{ span: 12 }}>
<WeaInput viewAttr={viewAttr} value={value}
onChange={v => this.handleChangeSchemeFiledItems(key, v)}/></WeaFormItem> :
(type === "SELECT" && display) ?
<WeaFormItem label={label} labelCol={{ span: 6 }} wrapperCol={{ span: 12 }}>
<WeaSelect value={value} options={options}
multiple={multiple} viewAttr={viewAttr}
onChange={v => this.handleChangeSchemeFiledItems(key, v)}/>
</WeaFormItem> :
(type === "TEXTAREA" && display) ?
<WeaFormItem label={label} labelCol={{ span: 6 }} wrapperCol={{ span: 12 }}>
<WeaTextarea value={value} viewAttr={viewAttr} minRows={3}
onChange={v => this.handleChangeSchemeFiledItems(key, v)}/>
</WeaFormItem> : null
}
</React.Fragment>;
})
}
</WeaSearchGroup>
);
}
}
export default SchemeInfoForm;

View File

@ -1,4 +1,4 @@
import { action, observable } from "mobx";
import { action, observable, toJS } from "mobx";
import { message } from "antd";
import { WeaForm, WeaTableNew } from "comsMobx";
import { removePropertyCondition } from "../util/response";
@ -166,7 +166,7 @@ export class ArchivesStore {
// 查询档案缴纳基数表单
@action
getPaymentForm = (employeeId, welfareTypeEnum, schemeId, paymentOrganization = "") => {
getPaymentForm = (employeeId, welfareTypeEnum, schemeId, paymentOrganization = "", isChange = false) => {
API.getPaymentForm({ employeeId, welfareTypeEnum, schemeId, paymentOrganization }).then(res => {
if (res.status) {
let obj = {};
@ -176,25 +176,67 @@ export class ArchivesStore {
_.map(baseList.items, item => {
obj = {
...obj,
[item["domkey"][0]]: "0"
[item["domkey"][0]]: ""
};
});
}
if (welfareTypeEnum == "SOCIAL_SECURITY") {
if (welfareTypeEnum === "SOCIAL_SECURITY") {
this.socialSecurityPaymentForm = res.data.data ? {
...res.data,
data: { ...obj, ...res.data.data }
} : { ...res.data, data: obj };
} else if (welfareTypeEnum == "ACCUMULATION_FUND") {
if (isChange) {
const socialSecurityPaymentData = toJS(this.socialSecurityPaymentForm).data;
const socialSecurityPaymentItems = toJS(this.socialSecurityPaymentForm).items[0].items;
const tmpV = socialSecurityPaymentItems.reduce((pre, cur) => {
const { domkey, max, min } = cur;
const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
const val = socialSecurityPaymentData[domkey[0]];
return Object.assign(pre, { [domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val });
}, {});
this.setSocialSecurityPaymentForm({
...toJS(this.socialSecurityPaymentForm),
data: { ...socialSecurityPaymentData, ...tmpV }
});
}
} else if (welfareTypeEnum === "ACCUMULATION_FUND") {
this.accumulationFundPaymentForm = res.data.data ? {
...res.data,
data: { ...obj, ...res.data.data }
} : { ...res.data, data: obj };
} else if (welfareTypeEnum == "OTHER") {
if (isChange) {
const accumulationFundPaymentData = toJS(this.accumulationFundPaymentForm).data;
const accumulationFundPaymentItems = toJS(this.accumulationFundPaymentForm).items[0].items;
const tmpV = accumulationFundPaymentItems.reduce((pre, cur) => {
const { domkey, max, min } = cur;
const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
const val = accumulationFundPaymentData[domkey[0]];
return Object.assign(pre, { [domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val });
}, {});
this.setAccumulationFundPaymentForm({
...toJS(this.accumulationFundPaymentForm),
data: { ...accumulationFundPaymentData, ...tmpV }
});
}
} else if (welfareTypeEnum === "OTHER") {
this.otherPaymentForm = res.data.data ? { ...res.data, data: { ...obj, ...res.data.data } } : {
...res.data,
data: obj
};
if (isChange) {
const otherPaymentData = toJS(this.otherPaymentForm).data;
const otherPaymentItems = toJS(this.otherPaymentForm).items[0].items;
const tmpV = otherPaymentItems.reduce((pre, cur) => {
const { domkey, max, min } = cur;
const minNum = !_.isNil(min) ? Number(min) : 0, maxNum = !_.isNil(max) ? Number(max) : 0;
const val = otherPaymentData[domkey[0]];
return Object.assign(pre, { [domkey[0]]: (val < minNum && !!minNum) ? minNum : (val > maxNum && !!maxNum) ? maxNum : val });
}, {});
this.setOtherPaymentForm({
...toJS(this.otherPaymentForm),
data: { ...otherPaymentData, ...tmpV }
});
}
}
}
});
@ -205,15 +247,39 @@ export class ArchivesStore {
save = (welfareType) => {
let baseForm = "";
let paymentForm = "";
if (welfareType == "SOCIAL_SECURITY") {
if (welfareType === "SOCIAL_SECURITY") {
baseForm = JSON.stringify(this.socialSecurityForm.data);
paymentForm = this.socialSecurityForm.data.socialSchemeId ? JSON.stringify(this.socialSecurityPaymentForm.data) : "";
} else if (welfareType == "ACCUMULATION_FUND") {
if (this.socialSecurityForm.data.socialSchemeId) {
const socialSecurityPaymentData = toJS(this.socialSecurityPaymentForm).data;
const socialSecurityPaymentItems = toJS(this.socialSecurityPaymentForm).items[0].items;
const payload = socialSecurityPaymentItems.reduce((pre, cur) => {
const { domkey } = cur;
return Object.assign(pre, { [domkey[0]]: socialSecurityPaymentData[domkey[0]] ? socialSecurityPaymentData[domkey[0]].toString() : "0" });
}, {});
paymentForm = JSON.stringify(payload);
}
} else if (welfareType === "ACCUMULATION_FUND") {
baseForm = JSON.stringify(this.accumulationFundForm.data);
paymentForm = this.accumulationFundForm.data.fundSchemeId ? JSON.stringify(this.accumulationFundPaymentForm.data) : "";
} else if (welfareType == "OTHER") {
if (this.accumulationFundForm.data.fundSchemeId) {
const accumulationFundPaymentData = toJS(this.accumulationFundPaymentForm).data;
const accumulationFundPaymentItems = toJS(this.accumulationFundPaymentForm).items[0].items;
const payload = accumulationFundPaymentItems.reduce((pre, cur) => {
const { domkey } = cur;
return Object.assign(pre, { [domkey[0]]: accumulationFundPaymentData[domkey[0]] ? accumulationFundPaymentData[domkey[0]].toString() : "0" });
}, {});
paymentForm = JSON.stringify(payload);
}
} else if (welfareType === "OTHER") {
baseForm = JSON.stringify(this.otherForm.data);
paymentForm = this.otherForm.data.otherSchemeId ? JSON.stringify(this.otherPaymentForm.data) : "";
if (this.otherForm.data.otherSchemeId) {
const otherPaymentData = toJS(this.otherPaymentForm).data;
const otherPaymentItems = toJS(this.otherPaymentForm).items[0].items;
const payload = otherPaymentItems.reduce((pre, cur) => {
const { domkey } = cur;
return Object.assign(pre, { [domkey[0]]: otherPaymentData[domkey[0]] ? otherPaymentData[domkey[0]].toString() : "0" });
}, {});
paymentForm = JSON.stringify(payload);
}
}
return new Promise((resolve, reject) => {
API.save({ welfareType, baseForm, paymentForm }).then(res => {

View File

@ -13,9 +13,9 @@ export class ProgrammeStore {
@observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据
@observable showSearchAd = false; // 高级搜索面板显示
@observable loading = true; // 数据加载状态
@observable deleteLoading = false; // 删除加载状态
@observable deleteLoading = false; // 删除加载状态
@observable selectedKey = "SOCIAL_SECURITY";
@observable customSelectkey = ""
@observable customSelectkey = "";
@observable defaultPersonDataSource = []; // 默认新增列表DataSource
@observable defaultCompanyDataSource = [];
@observable requestParams = {
@ -23,12 +23,12 @@ export class ProgrammeStore {
remarks: "",
paymentArea: "1",
sharedType: "",
taxAgentIds: "",
}
taxAgentIds: ""
};
@observable form = new WeaForm();
@observable formCondition = []; // 存储后台得到的form数据
@observable customNewVisible = false;
@observable customRequest = {}
@observable customRequest = {};
// 福利方案列表
@observable tableDataSource = [];
@ -37,10 +37,10 @@ export class ProgrammeStore {
@action
setCustomSelectkey = customSelectkey => this.customSelectkey = customSelectkey
setCustomSelectkey = customSelectkey => this.customSelectkey = customSelectkey;
@action
setCustomRequest = customRequest => this.customRequest = customRequest
setCustomRequest = customRequest => this.customRequest = customRequest;
@action
setCustomNewVisible = customNewVisible => this.customNewVisible = customNewVisible;
@ -61,11 +61,11 @@ export class ProgrammeStore {
remarks: "",
paymentType: "SCHEME_TOWN",
sharedType: "",
taxAgentIds: "",
}
taxAgentIds: ""
};
this.defaultPersonDataSource = [];
this.defaultCompanyDataSource = [];
}
};
@action
setSelectedKey = selectedKey => this.selectedKey = selectedKey;
@ -75,7 +75,7 @@ export class ProgrammeStore {
doInit = () => {
this.getTableDatas();
// this.getCustomCategoryList();
}
};
// 获得高级搜索表单数据
// @action
@ -96,7 +96,7 @@ export class ProgrammeStore {
this.loading = true;
const formParams = this.form.getFormParams() || {};
params = params || formParams;
params.welfareTypeEnum = selectKey
params.welfareTypeEnum = selectKey;
API.getTable(params).then(action(res => {
if (res.status) { // 接口请求成功/失败处理
// this.tableStore.getDatas(res.data.datas); // table 请求数据
@ -104,11 +104,11 @@ export class ProgrammeStore {
this.tableColumns = res.data.columns;
this.tablePageInfo = res.data;
} else {
message.error(res.errormsg || '接口调用失败!')
message.error(res.errormsg || "接口调用失败!");
}
this.loading = false;
}));
}
};
// 渲染自定义福利
@ -117,16 +117,16 @@ export class ProgrammeStore {
this.loading = true;
const formParams = this.form.getFormParams() || {};
params = params || formParams;
params.welfareTypeEnum = selectKey
params.welfareTypeEnum = selectKey;
API.getCustomCategoryList(params).then(action(res => {
if (res.status) { // 接口请求成功/失败处理
this.tableStore.getDatas(res.data.datas, 1); // table 请求数据
} else {
message.error(res.errormsg || '接口调用失败!')
message.error(res.errormsg || "接口调用失败!");
}
this.loading = false;
}));
}
};
@action
setShowSearchAd = bool => this.showSearchAd = bool;
@ -135,171 +135,176 @@ export class ProgrammeStore {
@action doSearch = () => {
this.getTableDatas();
this.showSearchAd = false;
}
};
// 获取form, 获取获取详情
@action getForm = (params) => {
API.getForm(params).then(res => {
if(res.status) {
let resultList = res.data.form.schemeDetailList;
resultList= _.map(resultList, it => ({
...it,
rententionRule: it.rententionRule ? it.rententionRule : "2",
validNum: !_.isNil(it.validNum) ? it.validNum : "2"
}))
this.defaultPersonDataSource = resultList.filter(item => item.paymentScope == "个人")
this.defaultCompanyDataSource = resultList.filter(item => item.paymentScope == "公司")
let defaultRequest = {
schemeName: "",
remarks: "",
paymentArea: "1"
return new Promise((resolve, reject) => {
API.getForm(params).then(res => {
if (res.status) {
let resultList = res.data.form.schemeDetailList;
resultList = _.map(resultList, it => ({
...it,
rententionRule: it.rententionRule ? it.rententionRule : "2",
validNum: !_.isNil(it.validNum) ? it.validNum : "2"
}));
this.defaultPersonDataSource = resultList.filter(item => item.paymentScope == "个人");
this.defaultCompanyDataSource = resultList.filter(item => item.paymentScope == "公司");
let defaultRequest = {
schemeName: "",
remarks: "",
paymentArea: "1"
};
this.requestParams = { ...defaultRequest, ...res.data.form.schemeBatch };
resolve();
} else {
reject();
}
this.requestParams = {...defaultRequest, ...res.data.form.schemeBatch}
}
})
}
}).catch(() => reject());
});
};
valideForm(params) {
if(!notNull(params.insuranceScheme.paymentType)) {
message.warning("缴纳类型不能为空")
return false
if (!notNull(params.insuranceScheme.paymentType)) {
message.warning("缴纳类型不能为空");
return false;
}
if(!notNull(params.insuranceScheme.schemeName)) {
message.warning("方案名称不能为空")
return false
if (!notNull(params.insuranceScheme.schemeName)) {
message.warning("方案名称不能为空");
return false;
}
if(this.requestParams.sharedType=== "1" && !notNull(params.insuranceScheme.taxAgentIds)) {
message.warning("可见性范围不能为空")
return false
if (this.requestParams.sharedType === "1" && !notNull(params.insuranceScheme.taxAgentIds)) {
message.warning("可见性范围不能为空");
return false;
}
return true;
}
@action createScheme = (params) => {
params.insuranceScheme.paymentArea = params.insuranceScheme.paymentType;
return new Promise((resolve, reject)=>{
if(!this.valideForm(params)) {
return new Promise((resolve, reject) => {
if (!this.valideForm(params)) {
reject("新建失败");
return
return;
}
API.createScheme(params).then(res => {
if(res.status) {
resolve(res)
if (res.status) {
resolve(res);
message.success("新建成功");
this.getTableDatas(this.selectedKey);
} else {
reject("新建失败");
message.error(res.errormsg || "新建失败")
message.error(res.errormsg || "新建失败");
}
})
})
}
});
});
};
@action updateScheme = (params) => {
params.insuranceScheme.paymentArea = params.insuranceScheme.paymentType;
return new Promise((resolve, reject)=>{
if(!this.valideForm(params)) {
return new Promise((resolve, reject) => {
if (!this.valideForm(params)) {
reject("新建失败");
return
return;
}
API.updateScheme(params).then(res => {
if(res.status) {
resolve(res)
if (res.status) {
resolve(res);
message.success("更新成功");
this.getTableDatas(this.selectedKey);
} else {
reject("更新失败")
message.error(res.errormsg || "更新失败")
reject("更新失败");
message.error(res.errormsg || "更新失败");
}
})
})
}
});
});
};
@action("复制福利方案")
copyScheme = (params) => {
return new Promise((resolve,reject)=>{
return new Promise((resolve, reject) => {
API.copyScheme(params).then(res => {
if(res.status) {
if (res.status) {
resolve("复制成功");
message.success("复制成功");
this.getTableDatas(this.selectedKey);
} else {
reject(res.errormsg || "复制失败");
message.error(res.errormsg || "复制失败");
reject(res.errormsg || "复制失败");
message.error(res.errormsg || "复制失败");
}
})
})
}
});
});
};
@action("删除社保数据")
deleteScheme = (params) => {
this.deleteLoading= true;
this.deleteLoading = true;
API.deleteScheme(params).then(res => {
this.deleteLoading= false;
if(res.status) {
message.success("刪除成功")
this.deleteLoading = false;
if (res.status) {
message.success("刪除成功");
this.getTableDatas(this.selectedKey);
} else {
message.error(res.errormsg || "刪除失败")
message.error(res.errormsg || "刪除失败");
}
})
}
});
};
@action getCustomForm = (params) => {
API.getCustomCategoryForm(params).then(res => {
if(res.status) {
if (res.status) {
let condition = res.data.item;
let items = Object.keys(condition).map(item => {
return condition[item]
})
let fieldCondtion = items
return condition[item];
});
let fieldCondtion = items;
this.formCondition = fieldCondtion;
} else {
message.error(res.errormsg || "获取失败")
message.error(res.errormsg || "获取失败");
}
})
}
});
};
validateCustomRequest() {
let flag = true;
try {
this.formCondition.forEach(item => {
if(item.rules == "required") {
if(!notNull(this.customRequest[item.domkey[0]])) {
message.warning(item.label + "不能为空")
throw new Error(item.label + "不能为空")
if (item.rules == "required") {
if (!notNull(this.customRequest[item.domkey[0]])) {
message.warning(item.label + "不能为空");
throw new Error(item.label + "不能为空");
}
}
})
} catch(e) {
flag = false
}
});
} catch (e) {
flag = false;
}
return flag;
}
// 新增自定义福利
@action createSICategory = (params) => {
return new Promise((resolve, reject) => {
if(!this.validateCustomRequest()) {
if (!this.validateCustomRequest()) {
reject();
return
return;
}
API.createSICategory({...params, paymentScope: params.paymentScope.split(",")}).then(res => {
if(res.status) {
message.success("新增成功")
resolve()
this.getCustomCategoryList()
API.createSICategory({ ...params, paymentScope: params.paymentScope.split(",") }).then(res => {
if (res.status) {
message.success("新增成功");
resolve();
this.getCustomCategoryList();
} else {
reject()
message.error(res.errormsg || "新增失败")
reject();
message.error(res.errormsg || "新增失败");
}
}).catch(()=>{
message.error("新增失败")
})
})
}).catch(() => {
message.error("新增失败");
});
});
}
};
// 自定义福利启用、停用
@action
@ -307,34 +312,34 @@ export class ProgrammeStore {
let params = {
id,
isUse: isUse ? 1 : 0
}
};
API.updateCustomCategoryStatus(params).then(res => {
if(res.status) {
message.success("修改成功")
this.getCustomCategoryList()
if (res.status) {
message.success("修改成功");
this.getCustomCategoryList();
} else {
message.error(res.errormsg || "修改失败")
message.error(res.errormsg || "修改失败");
}
})
}
});
};
// 自定义福利编辑
@action
updateCustomCategory = (params) => {
return new Promise((resolve, reject) => {
API.updateCustomCategory(_.pick(params, ['id',"insuranceName"])).then(res => {
if(res.status) {
message.success("编辑成功")
resolve()
this.getCustomCategoryList()
API.updateCustomCategory(_.pick(params, ["id", "insuranceName"])).then(res => {
if (res.status) {
message.success("编辑成功");
resolve();
this.getCustomCategoryList();
} else {
reject()
message.error(res.errormsg || "编辑失败")
reject();
message.error(res.errormsg || "编辑失败");
}
})
})
});
});
}
};
}