feature/V2-dev合并多语言
This commit is contained in:
parent
83f77d4e16
commit
a702e31295
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Author: 黎永顺
|
||||
* name: 自定义社保福利档案
|
||||
* Description:
|
||||
* Date: 2023/11/30
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom";
|
||||
import { Button, message } from "antd";
|
||||
import { getConditionDomkeys, getSearchs } from "../../../util";
|
||||
import { createSICategory, getCustomCategoryForm, updateCustomCategory } from "../../../apis/welfareScheme";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
const getKey = WeaTools.getKey;
|
||||
const API = {
|
||||
create: createSICategory, update: updateCustomCategory
|
||||
};
|
||||
|
||||
@inject("programmeStore")
|
||||
@observer
|
||||
class CustomBenefitsDialog extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: false, conditions: []
|
||||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
const { id, programmeStore } = nextProps;
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||
getCustomCategoryForm({ id }).then(({ status, data }) => {
|
||||
if (status) {
|
||||
this.setState({
|
||||
conditions: [{
|
||||
defaultshow: true, title: "",
|
||||
items: _.map(_.values(data.item), o => {
|
||||
if (getKey(o) === "welfareType" || getKey(o) === "paymentScope") {
|
||||
return { ...o, viewAttr: id ? 1 : o.viewAttr };
|
||||
} else {
|
||||
return { ...o };
|
||||
}
|
||||
})
|
||||
}]
|
||||
}, () => {
|
||||
programmeStore.cusBeneForm.initFormFields(this.state.conditions);
|
||||
id &&
|
||||
_.map(getConditionDomkeys(this.state.conditions), item => {
|
||||
programmeStore.cusBeneForm.updateFields({
|
||||
[item]: { value: item === "paymentScope" ? data["form"][item].join(",") : data["form"][item] }
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
programmeStore.setCusBeneForm();
|
||||
}
|
||||
}
|
||||
|
||||
save = () => {
|
||||
const { programmeStore: { cusBeneForm }, id } = this.props;
|
||||
cusBeneForm.validateForm().then(f => {
|
||||
if (f.isValid) {
|
||||
const { paymentScope, ...extra } = cusBeneForm.getFormParams();
|
||||
this.setState({ loading: true });
|
||||
const payload = {
|
||||
...extra,
|
||||
paymentScope: paymentScope.split(",")
|
||||
};
|
||||
API[id ? "update" : "create"](id ? { id, ...payload } : payload)
|
||||
.then(({ status, errormsg }) => {
|
||||
this.setState({ loading: false });
|
||||
if (status) {
|
||||
message.success(getLabel(30700, "操作成功!"));
|
||||
this.props.onCancel(true);
|
||||
} else {
|
||||
message.error(errormsg);
|
||||
}
|
||||
}).catch(() => this.setState({ loading: false }));
|
||||
} else {
|
||||
f.showErrors();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { programmeStore: { cusBeneForm } } = this.props;
|
||||
const { loading, conditions } = this.state;
|
||||
return (
|
||||
<WeaDialog
|
||||
{...this.props} style={{ width: 480, height: 174 }} initLoadCss className="customFLOuter"
|
||||
title={this.props.id ? getLabel(543155, "编辑自定义福利") : getLabel(543178, "新建自定义福利")}
|
||||
buttons={[
|
||||
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(826, "确定")}</Button>
|
||||
]}
|
||||
>
|
||||
<div className="cusBene-dialog-layout">{getSearchs(cusBeneForm, conditions, 1, false)}</div>
|
||||
</WeaDialog>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default CustomBenefitsDialog;
|
||||
|
|
@ -1,14 +1,15 @@
|
|||
import React from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { toJS } from "mobx";
|
||||
import { Button, Dropdown, Menu, message, Modal } from "antd";
|
||||
import { Button, Dropdown, Menu, Modal } from "antd";
|
||||
import { WeaLocaleProvider, WeaNewScroll, WeaSelect, WeaSlideModal, WeaTab, WeaTools, WeaTop } from "ecCom";
|
||||
import { getSearchs, renderNoright } from "../../../util";
|
||||
import SlideModalTitle from "../../../components/slideModalTitle";
|
||||
import TipLabel from "../../../components/TipLabel";
|
||||
import DefaultSlideForm from "./defaultSlideForm";
|
||||
import CustomNewModal from "./customNewModal";
|
||||
import { paymentScopeEnum, welfareTypeEnum } from "./enum";
|
||||
// import CustomNewModal from "./customNewModal";
|
||||
// import { paymentScopeEnum, welfareTypeEnum } from "./enum";
|
||||
import CustomBenefitsDialog from "./customBenefitsDialog";
|
||||
import CustomPaginationTable from "../../../components/customPaginationTable";
|
||||
import TwoColContent from "../../../components/twoColContent";
|
||||
import CopySchemaModal from "./copySchemaModal";
|
||||
|
|
@ -32,7 +33,8 @@ export default class Programme extends React.Component {
|
|||
copyId: "",
|
||||
customNewVisible: false,
|
||||
customEdit: false,
|
||||
showSearchAd: false
|
||||
showSearchAd: false,
|
||||
cusBeneDialog: { visible: false, id: "" }
|
||||
};
|
||||
|
||||
this.pageInfo = { current: 1, pageSize: 10 };
|
||||
|
|
@ -162,26 +164,27 @@ export default class Programme extends React.Component {
|
|||
};
|
||||
|
||||
onCustomEdit = (record) => {
|
||||
const {
|
||||
programmeStore: { getCustomForm, setCustomNewVisible, setCustomRequest },
|
||||
taxAgentStore: { showOperateBtn }
|
||||
} = this.props;
|
||||
if (!showOperateBtn) {
|
||||
message.warning(getLabel(543156, "请设置编辑权限!"));
|
||||
return;
|
||||
}
|
||||
getCustomForm();
|
||||
setCustomNewVisible(true);
|
||||
this.setState({
|
||||
customEdit: true
|
||||
});
|
||||
setCustomRequest({
|
||||
insuranceName: record["insuranceName"],
|
||||
id: record.id,
|
||||
isUse: record.isUse,
|
||||
paymentScope: record["paymentScope"].split(",").map(item => paymentScopeEnum[item]).join(","),
|
||||
welfareType: welfareTypeEnum[record.welfareType]
|
||||
});
|
||||
this.setState({ cusBeneDialog: { visible: true, id: record.id } });
|
||||
// const {
|
||||
// programmeStore: { getCustomForm, setCustomNewVisible, setCustomRequest },
|
||||
// taxAgentStore: { showOperateBtn }
|
||||
// } = this.props;
|
||||
// if (!showOperateBtn) {
|
||||
// message.warning(getLabel(543156, "请设置编辑权限!"));
|
||||
// return;
|
||||
// }
|
||||
// getCustomForm();
|
||||
// setCustomNewVisible(true);
|
||||
// this.setState({
|
||||
// customEdit: true
|
||||
// });
|
||||
// setCustomRequest({
|
||||
// insuranceName: record["insuranceName"],
|
||||
// id: record.id,
|
||||
// isUse: record.isUse,
|
||||
// paymentScope: record["paymentScope"].split(",").map(item => paymentScopeEnum[item]).join(","),
|
||||
// welfareType: welfareTypeEnum[record.welfareType]
|
||||
// });
|
||||
};
|
||||
|
||||
// 页面跳转
|
||||
|
|
@ -192,7 +195,7 @@ export default class Programme extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { showSearchAd } = this.state;
|
||||
const { showSearchAd, cusBeneDialog } = this.state;
|
||||
const { programmeStore, taxAgentStore: { showOperateBtn } } = this.props;
|
||||
const { loading, hasRight, form, getTableDatas } = programmeStore;
|
||||
const {
|
||||
|
|
@ -260,17 +263,18 @@ export default class Programme extends React.Component {
|
|||
};
|
||||
|
||||
const handleCustomNewClick = () => {
|
||||
const {
|
||||
programmeStore: {
|
||||
getCustomForm,
|
||||
setCustomNewVisible,
|
||||
setCustomRequest
|
||||
}
|
||||
} = this.props;
|
||||
getCustomForm();
|
||||
setCustomRequest({});
|
||||
setCustomNewVisible(true);
|
||||
this.setState({ customEdit: false });
|
||||
// const {
|
||||
// programmeStore: {
|
||||
// getCustomForm,
|
||||
// setCustomNewVisible,
|
||||
// setCustomRequest
|
||||
// }
|
||||
// } = this.props;
|
||||
// getCustomForm();
|
||||
// setCustomRequest({});
|
||||
// setCustomNewVisible(true);
|
||||
// this.setState({ customEdit: false });
|
||||
this.setState({ cusBeneDialog: { ...this.state.cusBeneDialog, visible: true } });
|
||||
};
|
||||
|
||||
const handleOnSave = () => {
|
||||
|
|
@ -486,18 +490,22 @@ export default class Programme extends React.Component {
|
|||
</Button>]
|
||||
}
|
||||
/>}
|
||||
|
||||
{customNewVisible &&
|
||||
<CustomNewModal
|
||||
visible={customNewVisible}
|
||||
condition={formCondition}
|
||||
form={form}
|
||||
edit={this.state.customEdit}
|
||||
onCancel={(isRefresh) => {
|
||||
setCustomNewVisible(false);
|
||||
isRefresh && this.customBenefitsTableRef.getCustomCategoryList();
|
||||
}}
|
||||
/>}
|
||||
<CustomBenefitsDialog {...cusBeneDialog}
|
||||
onCancel={(isRefresh) => this.setState({
|
||||
cusBeneDialog: { id: "", visible: false }
|
||||
}, () => isRefresh && this.customBenefitsTableRef.getCustomCategoryList())}
|
||||
/>
|
||||
{/*{customNewVisible &&*/}
|
||||
{/* <CustomNewModal*/}
|
||||
{/* visible={customNewVisible}*/}
|
||||
{/* condition={formCondition}*/}
|
||||
{/* form={form}*/}
|
||||
{/* edit={this.state.customEdit}*/}
|
||||
{/* onCancel={(isRefresh) => {*/}
|
||||
{/* setCustomNewVisible(false);*/}
|
||||
{/* isRefresh && this.customBenefitsTableRef.getCustomCategoryList();*/}
|
||||
{/* }}*/}
|
||||
{/* />}*/}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,28 @@
|
|||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.cusBene-dialog-layout {
|
||||
background: #f6f6f6;
|
||||
|
||||
.wea-search-group {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.wea-content {
|
||||
padding: 0;
|
||||
|
||||
.wea-form-cell-wrapper {
|
||||
background: #FFF;
|
||||
border: 1px solid #e5e5e5;
|
||||
border-bottom: none;
|
||||
|
||||
.wea-form-cell {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.socialSecurityAndWelfareSchemeWrapper, .mySalaryBenefitsWrapper {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ const getLabel = WeaLocaleProvider.getLabel;
|
|||
export class ProgrammeStore {
|
||||
//lys-表单初始化(方案查询表单)
|
||||
@observable planSearchForm = new WeaForm();
|
||||
@observable cusBeneForm = new WeaForm(); //自定义社保福利档案form
|
||||
@action setCusBeneForm = () => this.cusBeneForm = new WeaForm();
|
||||
|
||||
|
||||
@observable tableStore = new TableStore(); // new table
|
||||
|
|
@ -275,7 +277,7 @@ export class ProgrammeStore {
|
|||
this.formCondition.forEach(item => {
|
||||
if (item.rules == "required") {
|
||||
if (!notNull(this.customRequest[item.domkey[0]])) {
|
||||
message.warning(item.label + getLabel(18622,'不能为空'));
|
||||
message.warning(item.label + getLabel(18622, "不能为空"));
|
||||
throw new Error(item.label + "不能为空");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue