From f6f786b33feee88b07673840aa89324f46f616b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 13 Feb 2023 16:00:14 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../programme/defaultSlideForm.js | 218 +++++++++--------- .../socialSecurityBenefits/programme/enum.js | 69 +++++- .../socialSecurityBenefits/programme/index.js | 17 +- .../programme/schemeInfoForm.js | 97 ++++++++ 4 files changed, 274 insertions(+), 127 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/schemeInfoForm.js diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js index 2d28bd46..0ec301ba 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js @@ -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; @@ -338,7 +338,7 @@ export default class DefaultSlideForm extends React.Component { 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 +359,112 @@ export default class DefaultSlideForm extends React.Component { showname: "农村" } ]; - - const handleSmallTabChange = item => { - this.setState({ - selectItem: item.value - }); - }; - return (
-
- - - 缴纳类型 - - - { - let requestParams = { ...this.props.requestParams }; - requestParams.paymentType = v; - this.props.onChange(requestParams); - }} - /> - - + {/*
*/} + {/* */} + {/* */} + {/* 缴纳类型*/} + {/* */} + {/* */} + {/* {*/} + {/* let requestParams = { ...this.props.requestParams };*/} + {/* requestParams.paymentType = v;*/} + {/* this.props.onChange(requestParams);*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} - - - 方案名称 - - - { - let requestParams = { ...this.props.requestParams }; - requestParams.schemeName = value; - this.props.onChange(requestParams); - }} - /> - - - - 可见性 - - { - let requestParams = { ...this.props.requestParams }; - visibleVal === "1" && getTaxAgentSelectListAsAdmin(); - (visibleVal === "0" || visibleVal === "") && (requestParams.taxAgentIds = ""); - requestParams.sharedType = visibleVal; - this.props.onChange(requestParams); - }} - /> - - - { - this.props.requestParams.sharedType === "1" && - - 可见性范围 - - { - let requestParams = { ...this.props.requestParams }; - requestParams.taxAgentIds = value; - this.props.onChange(requestParams); - }} - /> - - - } - - 备注 - - { - let requestParams = { ...this.props.requestParams }; - requestParams.remarks = value; - this.props.onChange(requestParams); - }} - /> - - -
+ {/* */} + {/* */} + {/* 方案名称*/} + {/* */} + {/* */} + {/* {*/} + {/* let requestParams = { ...this.props.requestParams };*/} + {/* requestParams.schemeName = value;*/} + {/* this.props.onChange(requestParams);*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* */} + {/* 可见性*/} + {/* */} + {/* {*/} + {/* let requestParams = { ...this.props.requestParams };*/} + {/* visibleVal === "1" && getTaxAgentSelectListAsAdmin();*/} + {/* (visibleVal === "0" || visibleVal === "") && (requestParams.taxAgentIds = "");*/} + {/* requestParams.sharedType = visibleVal;*/} + {/* this.props.onChange(requestParams);*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* {*/} + {/* this.props.requestParams.sharedType === "1" &&*/} + {/* */} + {/* 可见性范围*/} + {/* */} + {/* {*/} + {/* let requestParams = { ...this.props.requestParams };*/} + {/* requestParams.taxAgentIds = value;*/} + {/* this.props.onChange(requestParams);*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* }*/} + {/* */} + {/* 备注*/} + {/* */} + {/* {*/} + {/* let requestParams = { ...this.props.requestParams };*/} + {/* requestParams.remarks = value;*/} + {/* this.props.onChange(requestParams);*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/*
*/} + onChange({ ...requestParams, ...val })}/>
-
- { - handleSmallTabChange(item); - }} - /> -
+ this.setState({ selectedKey })} + />
- {this.state.selectItem == "个人" + {this.state.selectedKey === "PERSONAL" ? it.viewcondition === selectedKey).title}方案` : + `新增${_.find(topTab, it => it.viewcondition === selectedKey).title}方案` + } editable={true} showOperateBtn={showOperateBtn} - onSave={() => { - handleOnSave(); - }} + onSave={() => handleOnSave()} /> } content={ diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/schemeInfoForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/schemeInfoForm.js new file mode 100644 index 00000000..2afbd1a3 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/schemeInfoForm.js @@ -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 ( + + { + _.map(schemeFieldsItem, item => { + const { key, label, type, viewAttr, options, display = true, multiple = false } = item; + const value = !_.isNil(requestParams[key]) ? requestParams[key].toString() : ""; + return + { + (type === "INPUT" && display) ? + + this.handleChangeSchemeFiledItems(key, v)}/> : + (type === "SELECT" && display) ? + + this.handleChangeSchemeFiledItems(key, v)}/> + : + (type === "TEXTAREA" && display) ? + + this.handleChangeSchemeFiledItems(key, v)}/> + : null + } + ; + }) + } + + ); + } +} + +export default SchemeInfoForm; From 38ca2cc421c2530e46703248ef5d0976def6c004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 13 Feb 2023 16:38:15 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../programme/defaultSlideForm.js | 6 - .../socialSecurityBenefits/programme/enum.js | 2 +- .../socialSecurityBenefits/programme/index.js | 8 +- .../programme/index.less | 17 +- pc4mobx/hrmSalary/stores/programme.js | 253 +++++++++--------- 5 files changed, 152 insertions(+), 134 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js index 0ec301ba..d5601a1c 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js @@ -330,12 +330,6 @@ 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, requestParams, onChange } = this.props; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/enum.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/enum.js index fd4f8064..f5277ea7 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/enum.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/enum.js @@ -45,7 +45,7 @@ export const schemeFields = [ key: "sharedType", label: "可见性", type: "SELECT", - viewAttr: 3, + viewAttr: 2, tip: "" }, { diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js index 96e30ffe..3b31956a 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js @@ -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绑定事件 @@ -66,6 +68,7 @@ export default class Programme extends React.Component { case "operate": return ( { this.onEdit(record); }}> @@ -194,8 +197,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) { diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.less b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.less index 98d96ad4..a7d5bee4 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.less +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.less @@ -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; diff --git a/pc4mobx/hrmSalary/stores/programme.js b/pc4mobx/hrmSalary/stores/programme.js index 4a857dd9..2f4153a2 100644 --- a/pc4mobx/hrmSalary/stores/programme.js +++ b/pc4mobx/hrmSalary/stores/programme.js @@ -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 || "编辑失败"); } - }) - }) + }); + }); - } + }; } From 4ce7eca13974815236fe4d730ff9c73b510315b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 14 Feb 2023 13:38:19 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archives/baseForm.js | 69 ++--- .../socialSecurityBenefits/archives/index.js | 152 +++++------ .../archives/index.less | 65 +++-- .../archives/socialSecurityForm.js | 251 +++++++++--------- 4 files changed, 245 insertions(+), 292 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/baseForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/baseForm.js index 03be2c76..c21bcf93 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/baseForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/baseForm.js @@ -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 (
- - - 姓名: - - - {baseFormData.username} - - - 部门: - - - {baseFormData.department} - - - 岗位: - - - {baseFormData.position} - - - - - - 入职日期: - {baseFormData.hiredate} - 手机号: - - - {baseFormData.telephone} - - - 合同到期日期: - {baseFormData.dimissionDate} - - - - - 个税扣缴义务人: - {record.paymentOrganizationName} - - + +
); } } +const Input = (label, value, labelColSpan = 12, wrapperColSpan = 12) => { + return ( + + + + ); +}; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js index a61e6cc7..b8f6c267 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js @@ -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 } 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,54 @@ 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; + 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(); + }); + } + }, 500); } + this.handleSave(); }; // 导入 @@ -264,34 +267,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 +302,7 @@ export default class Archives extends React.Component { }; // 关闭导入框 - handleImportCancel() { + handleImportCancel = () => { const { archivesStore: { initImportParams, getTableDatas } } = this.props; initImportParams(); @@ -307,7 +310,7 @@ export default class Archives extends React.Component { getTableDatas(); } this.setState({ importVisible: false, step: 0 }); - } + }; //切换tab handleChangeTab = (selectedKey) => { @@ -536,24 +539,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: , - // 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 = [ // 高级搜索内部按钮 ] : [] } - subItemChange={ - (selectedTab) => { - this.setState({ selectedTab }); - } - } + subItemChange={selectedTab => this.setState({ selectedTab })} /> } content={
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less index dd3e3a88..8b29b6ef 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less @@ -1,36 +1,32 @@ .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; - .ant-select-selection{ - height: 30px; - border-radius: 0; + .wea-search-group { + padding: 0 16px; + + .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; + } } } - .borderR-none { - border-right: none; - } - - .borderB-none { - border-bottom: none; - } } -.mySalaryBenefitsWrapper{ - .tdEllipsis{ + +.mySalaryBenefitsWrapper { + .tdEllipsis { display: inline-block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + .optWrapper { display: flex; align-items: center; @@ -40,6 +36,7 @@ } } } + //提示语 .helpWrapper { display: flex; @@ -50,30 +47,32 @@ } } -.slideOuterWrapper{ - .wea-slide-modal-title{ +.slideOuterWrapper { + .wea-slide-modal-title { height: initial; line-height: initial; text-align: left; } - .rodal-close{ + + .rodal-close { z-index: 99; - top: 10px!important; + top: 10px !important; } } -@media (min-width: 1260px){ - .slideOuterWrapper{ - .reqTopWrapper .wea-new-top-req-title>div:first-child>div{ - max-width: 100%!important; +@media (min-width: 1260px) { + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: 100% !important; } } } + @media screen and (min-width: 1060px) and (max-width: 1260px) { - .slideOuterWrapper{ - .reqTopWrapper .wea-new-top-req-title>div:first-child>div{ - max-width: calc(100% - 96px)!important; + .slideOuterWrapper { + .reqTopWrapper .wea-new-top-req-title > div:first-child > div { + max-width: calc(100% - 96px) !important; } } } diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index 7f86be27..bc0c538f 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -1,9 +1,6 @@ import React from "react"; -import GroupCard from "../../../components/groupCard"; -import { Col, Row } from "antd"; -import { WeaCheckbox, WeaDatePicker, WeaInput, WeaInputNumber, WeaSelect } from "ecCom"; +import { WeaCheckbox, WeaSearchGroup } from "ecCom"; import { inject, observer } from "mobx-react"; -import cs from "classnames"; import "./index.less"; @inject("archivesStore") @@ -18,7 +15,9 @@ export default class SocialSecurityForm extends React.Component { } // 表单变化 - handleFormChange(params) { + handleFormChange = (params) => { + console.log("params", params); + return; const { archivesStore: { socialSecurityForm, setSocialSecurityForm }, onChangeRecordSchemeId } = this.props; const { data } = socialSecurityForm; let request = { ...data, ...params }; @@ -27,7 +26,7 @@ export default class SocialSecurityForm extends React.Component { setSocialSecurityForm(form); Object.keys(params).length > 1 && onChangeRecordSchemeId(params.socialSchemeId); - } + }; // 获取基数表单 handleFetchPaymentForm(value) { @@ -53,137 +52,131 @@ export default class SocialSecurityForm extends React.Component { let paymentItems = socialSecurityPaymentForm.items; // Integer数据转为string let data = { ...baseData }; - if (data) { + if (!_.isNil(data)) { Object.keys(data).map(key => { - if (data[key]) { + if (!_.isNil(data[key])) { data[key] = data[key].toString(); } }); } + const { nonPayment } = data; + console.log(baseData, data); return (
-
- { - this.handleFormChange({ nonPayment: value }); - }} - /> -
- - - 社保起始缴纳月: - - { - this.handleFormChange({ socialStartTime: value }); - }} - /> - - 社保方案名称: - - { - this.handleFormChange({ socialName: showName, socialSchemeId: value }); - this.handleFetchPaymentForm(value); - }} - /> - - - - 社保最后缴纳月: - - this.handleFormChange({ socialEndTime: value })} - /> - - 社保账号: - - { - this.handleFormChange({ schemeAccount: value }); - }}/> - - - - {/*个税扣缴义务人:*/} - {/**/} - {/* this.handleFormChange({ paymentOrganization: value })}>*/} - {/* {*/} - {/* items && items[0].items && items[0].items[1] && items[0].items[1].options.map(item => (*/} - {/* */} - {/* ))*/} - {/* }*/} - {/* */} - {/**/} - 社保个人实际承担方: - - { - this.handleFormChange({ underTake: value }); - }} - /> - - - - - { - data.socialSchemeId && paymentItems && paymentItems.map(group => ( -
- { - group.items && group.items.length > 0 && - - { - group.items && group.items.map((item, idx) => ( - - - {item.label}: - - { - this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : '0' }); - }} - /> - - - - )) - } - - - } -
- )) - } + } + items={[]} col={2} showGroup needTigger={false}/> + {/*
*/} + {/* {*/} + {/* this.handleFormChange({ nonPayment: value });*/} + {/* }}*/} + {/* />*/} + {/*
*/} + {/**/} + {/* */} + {/* 社保起始缴纳月:*/} + {/* */} + {/* {*/} + {/* this.handleFormChange({ socialStartTime: value });*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* 社保方案名称:*/} + {/* */} + {/* {*/} + {/* this.handleFormChange({ socialName: showName, socialSchemeId: value });*/} + {/* this.handleFetchPaymentForm(value);*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* */} + {/* 社保最后缴纳月:*/} + {/* */} + {/* this.handleFormChange({ socialEndTime: value })}*/} + {/* />*/} + {/* */} + {/* 社保账号:*/} + {/* */} + {/* {*/} + {/* this.handleFormChange({ schemeAccount: value });*/} + {/* }}/>*/} + {/* */} + {/* */} + {/* */} + {/* 社保个人实际承担方:*/} + {/* */} + {/* {*/} + {/* this.handleFormChange({ underTake: value });*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/**/} + {/*{*/} + {/* data.socialSchemeId && paymentItems && paymentItems.map(group => (*/} + {/*
*/} + {/* {*/} + {/* group.items && group.items.length > 0 && */} + {/* */} + {/* {*/} + {/* group.items && group.items.map((item, idx) => (*/} + {/* */} + {/* */} + {/* {item.label}:*/} + {/* */} + {/* {*/} + {/* this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : '0' });*/} + {/* }}*/} + {/* />*/} + {/* */} + {/* */} + {/* */} + {/* ))*/} + {/* }*/} + {/* */} + {/* */} + {/* }*/} + {/*
*/} + {/* ))*/} + {/*}*/}
); } } +const SocialTitle = (props) => { + const { value, onChange } = props; + return ; +}; From 7c4e2f5588f80ab22aa847a48737cb04388fbc09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 14 Feb 2023 14:32:02 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archives/index.less | 4 + .../archives/socialSecurityForm.js | 84 +++++++++++++++---- 2 files changed, 74 insertions(+), 14 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less index 8b29b6ef..348327f9 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less @@ -12,6 +12,10 @@ padding: 4px 16px; border-bottom: 1px solid #e5e5e5; border-right: 1px solid #e5e5e5; + + .wea-form-item { + padding: 0; + } } } } diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index bc0c538f..d1f69780 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -1,6 +1,7 @@ import React from "react"; -import { WeaCheckbox, WeaSearchGroup } from "ecCom"; +import { WeaCheckbox, WeaDatePicker, WeaFormItem, WeaInput, WeaSearchGroup, WeaSelect } from "ecCom"; import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; import "./index.less"; @inject("archivesStore") @@ -46,27 +47,58 @@ export default class SocialSecurityForm extends React.Component { render() { const { archivesStore: { socialSecurityForm, socialSecurityPaymentForm } } = this.props; - const { items } = socialSecurityForm; + const { items, data: socialData } = socialSecurityForm; let baseData = socialSecurityForm.data; let paymentData = socialSecurityPaymentForm.data; let paymentItems = socialSecurityPaymentForm.items; // Integer数据转为string - let data = { ...baseData }; - if (!_.isNil(data)) { - Object.keys(data).map(key => { - if (!_.isNil(data[key])) { - data[key] = data[key].toString(); - } - }); - } - const { nonPayment } = data; - console.log(baseData, data); + // let socialData = { ...baseData }; + // if (!_.isNil(socialData)) { + // Object.keys(socialData).map(key => { + // if (!_.isNil(socialData[key])) { + // socialData[key] = socialData[key].toString(); + // } + // }); + // } + const { nonPayment = "", schemeAccount = "", socialStartTime = "", socialEndTime = "" } = socialData || {}; + const socialItems = !_.isNil(toJS(items)) ? [ + ..._.map(_.filter(toJS(items)[0].items, it => it.domkey[0] !== "paymentOrganization"), + item => ({ + com: SocialSelect({ + label: item.label, + value: !_.isNil(socialData[item["domkey"][0]]) ? socialData[item["domkey"][0]].toString() : "", + options: item.options, + onChange: this.handleFormChange + }) + })), + { + com: SocialDatePicker({ + label: "社保起始缴纳月", + value: socialStartTime, + onChange: this.handleFormChange + }) + }, + { + com: SocialEditInput({ + label: "社保账号", + value: schemeAccount, + onChange: this.handleFormChange + }) + }, + { + com: SocialDatePicker({ + label: "社保最后缴纳月", + value: socialEndTime, + onChange: this.handleFormChange + }) + } + ] : []; return (
} - items={[]} col={2} showGroup needTigger={false}/> + customComponent={} + items={socialItems} col={2} showGroup needTigger={false}/> {/*
*/} {/* { const { value, onChange } = props; return ; }; +const SocialSelect = (props) => { + const { value, onChange, options, label, labelColSpan = 12, wrapperColSpan = 12 } = props; + return + + ; +}; +const SocialEditInput = (props) => { + const { value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; + return ( + + + + ); +}; +const SocialDatePicker = (props) => { + const { value, onChange, label, format = "YYYY-MM", viewAttr = 2, labelColSpan = 12, wrapperColSpan = 12 } = props; + return ( + + + + ); +}; + + From e3f4cebe575108ab20fccceef7628df8d44f6809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 14 Feb 2023 14:59:55 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archives/socialSecurityForm.js | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index d1f69780..d67c1566 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -1,5 +1,5 @@ import React from "react"; -import { WeaCheckbox, WeaDatePicker, WeaFormItem, WeaInput, WeaSearchGroup, WeaSelect } from "ecCom"; +import { WeaCheckbox, WeaDatePicker, WeaFormItem, WeaInput, WeaInputNumber, WeaSearchGroup, WeaSelect } from "ecCom"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; import "./index.less"; @@ -48,9 +48,8 @@ export default class SocialSecurityForm extends React.Component { render() { const { archivesStore: { socialSecurityForm, socialSecurityPaymentForm } } = this.props; const { items, data: socialData } = socialSecurityForm; - let baseData = socialSecurityForm.data; - let paymentData = socialSecurityPaymentForm.data; - let paymentItems = socialSecurityPaymentForm.items; + const paymentData = socialSecurityPaymentForm.data; + const paymentItems = socialSecurityPaymentForm.items; // Integer数据转为string // let socialData = { ...baseData }; // if (!_.isNil(socialData)) { @@ -60,7 +59,10 @@ export default class SocialSecurityForm extends React.Component { // } // }); // } - const { nonPayment = "", schemeAccount = "", socialStartTime = "", socialEndTime = "" } = socialData || {}; + const { + nonPayment = "", schemeAccount = "", socialStartTime = "", socialEndTime = "", + socialName = "" + } = socialData || {}; const socialItems = !_.isNil(toJS(items)) ? [ ..._.map(_.filter(toJS(items)[0].items, it => it.domkey[0] !== "paymentOrganization"), item => ({ @@ -99,6 +101,21 @@ export default class SocialSecurityForm extends React.Component { title="社保基础信息" customComponent={} items={socialItems} col={2} showGroup needTigger={false}/> + { + !_.isEmpty(socialName) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { + const { title, items } = item; + return ({ + com: SocialInputNumber({ + label: child.label, + value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "", + onChange: this.handleFormChange + }) + }))} + title={title} col={2} showGroup + />; + }) + } {/*
*/} {/* { ); }; +const SocialInputNumber = (props) => { + const { value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; + return ( + + + + ); +}; const SocialDatePicker = (props) => { const { value, onChange, label, format = "YYYY-MM", viewAttr = 2, labelColSpan = 12, wrapperColSpan = 12 } = props; return ( From 661cc02ed43233f2f57f961f1887c4bbbd9ad5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 14 Feb 2023 17:32:37 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archives/socialSecurityForm.js | 58 ++++++++++++------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index d67c1566..461f542c 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -15,25 +15,23 @@ export default class SocialSecurityForm extends React.Component { getPaymentForm(this.props.employeeId, "SOCIAL_SECURITY", siSchemeId, this.props.record.paymentOrganization); } - // 表单变化 - handleFormChange = (params) => { - console.log("params", params); - return; + 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 === "socialName" && this.handleFetchPaymentForm(value); + key === "socialName" && 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); + }; //基数变化 handlePaymentChange(params) { @@ -67,6 +65,7 @@ export default class SocialSecurityForm extends React.Component { ..._.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, @@ -75,6 +74,7 @@ export default class SocialSecurityForm extends React.Component { })), { com: SocialDatePicker({ + key: "socialStartTime", label: "社保起始缴纳月", value: socialStartTime, onChange: this.handleFormChange @@ -82,6 +82,7 @@ export default class SocialSecurityForm extends React.Component { }, { com: SocialEditInput({ + key: "schemeAccount", label: "社保账号", value: schemeAccount, onChange: this.handleFormChange @@ -89,6 +90,7 @@ export default class SocialSecurityForm extends React.Component { }, { com: SocialDatePicker({ + key: "socialEndTime", label: "社保最后缴纳月", value: socialEndTime, onChange: this.handleFormChange @@ -99,7 +101,8 @@ export default class SocialSecurityForm extends React.Component {
} + customComponent={} items={socialItems} col={2} showGroup needTigger={false}/> { !_.isEmpty(socialName) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { @@ -107,6 +110,7 @@ export default class SocialSecurityForm extends React.Component { return ({ com: SocialInputNumber({ + key: child["domkey"][0], label: child.label, value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "", onChange: this.handleFormChange @@ -226,36 +230,46 @@ export default class SocialSecurityForm extends React.Component { } } const SocialTitle = (props) => { - const { value, onChange } = props; - return ; + const { value, onChange, key } = props; + return onChange({ key, value: val })}/>; }; const SocialSelect = (props) => { - const { value, onChange, options, label, labelColSpan = 12, wrapperColSpan = 12 } = props; + const { key, value, onChange, options, label, labelColSpan = 12, wrapperColSpan = 12 } = props; return - + onChange({ key, value: val })}/> ; }; const SocialEditInput = (props) => { - const { value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; + const { key, value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; return ( - + onChange({ key, value: val })}/> ); }; const SocialInputNumber = (props) => { - const { value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; + const { key, value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; return ( - + onChange({ key, value: val })} min={0} precision={2}/> ); }; const SocialDatePicker = (props) => { - const { value, onChange, label, format = "YYYY-MM", viewAttr = 2, labelColSpan = 12, wrapperColSpan = 12 } = props; + const { + key, + value, + onChange, + label, + format = "YYYY-MM", + viewAttr = 2, + labelColSpan = 12, + wrapperColSpan = 12 + } = props; return ( - + onChange({ key, value: val })}/> ); }; From f2030e971fe901c4cb36568febfe7f3b5a475235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 15 Feb 2023 09:46:59 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../socialSecurityBenefits/archives/index.js | 7 +- .../archives/index.less | 5 + .../archives/socialSecurityForm.js | 138 +++--------------- 3 files changed, 27 insertions(+), 123 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js index b8f6c267..68876f0d 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js @@ -214,6 +214,7 @@ export default class Archives extends React.Component { const { archivesStore: { save, socialSecurityForm, accumulationFundForm, otherForm } } = this.props; if (selectedTab == 1) { const { data } = socialSecurityForm; + console.log(socialSecurityForm); if (data.socialSchemeId && !data.socialStartTime) { Modal.warning({ title: "信息确认", @@ -221,9 +222,9 @@ export default class Archives extends React.Component { }); return; } - save("SOCIAL_SECURITY").then(() => { - this.query(); - }); + // save("SOCIAL_SECURITY").then(() => { + // this.query(); + // }); } else if (selectedTab == 2) { const { data } = accumulationFundForm; if (data.fundSchemeId && !data.fundStartTime) { diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less index 348327f9..67111a4e 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.less @@ -20,6 +20,11 @@ } } + .welfareBaseWrapper { + .title { + margin-right: 10px; + } + } } .mySalaryBenefitsWrapper { diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index 461f542c..2c27a311 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -33,30 +33,21 @@ export default class SocialSecurityForm extends React.Component { getPaymentForm(employeeId, "SOCIAL_SECURITY", value, paymentOrganization); }; - //基数变化 - handlePaymentChange(params) { + handlePaymentChange = ({ key, value }) => { + const params = { [key]: value }; 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, data: socialData } = socialSecurityForm; const paymentData = socialSecurityPaymentForm.data; const paymentItems = socialSecurityPaymentForm.items; - // Integer数据转为string - // let socialData = { ...baseData }; - // if (!_.isNil(socialData)) { - // Object.keys(socialData).map(key => { - // if (!_.isNil(socialData[key])) { - // socialData[key] = socialData[key].toString(); - // } - // }); - // } const { nonPayment = "", schemeAccount = "", socialStartTime = "", socialEndTime = "", socialName = "" @@ -101,7 +92,7 @@ export default class SocialSecurityForm extends React.Component {
} items={socialItems} col={2} showGroup needTigger={false}/> { @@ -113,124 +104,31 @@ export default class SocialSecurityForm extends React.Component { key: child["domkey"][0], label: child.label, value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "", - onChange: this.handleFormChange + onChange: this.handlePaymentChange }) }))} + customComponent={} title={title} col={2} showGroup />; }) } - {/*
*/} - {/* {*/} - {/* this.handleFormChange({ nonPayment: value });*/} - {/* }}*/} - {/* />*/} - {/*
*/} - {/**/} - {/* */} - {/* 社保起始缴纳月:*/} - {/* */} - {/* {*/} - {/* this.handleFormChange({ socialStartTime: value });*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* 社保方案名称:*/} - {/* */} - {/* {*/} - {/* this.handleFormChange({ socialName: showName, socialSchemeId: value });*/} - {/* this.handleFetchPaymentForm(value);*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/* */} - {/* 社保最后缴纳月:*/} - {/* */} - {/* this.handleFormChange({ socialEndTime: value })}*/} - {/* />*/} - {/* */} - {/* 社保账号:*/} - {/* */} - {/* {*/} - {/* this.handleFormChange({ schemeAccount: value });*/} - {/* }}/>*/} - {/* */} - {/* */} - {/* */} - {/* 社保个人实际承担方:*/} - {/* */} - {/* {*/} - {/* this.handleFormChange({ underTake: value });*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/**/} - {/*{*/} - {/* data.socialSchemeId && paymentItems && paymentItems.map(group => (*/} - {/*
*/} - {/* {*/} - {/* group.items && group.items.length > 0 && */} - {/* */} - {/* {*/} - {/* group.items && group.items.map((item, idx) => (*/} - {/* */} - {/* */} - {/* {item.label}:*/} - {/* */} - {/* {*/} - {/* this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : '0' });*/} - {/* }}*/} - {/* />*/} - {/* */} - {/* */} - {/* */} - {/* ))*/} - {/* }*/} - {/* */} - {/* */} - {/* }*/} - {/*
*/} - {/* ))*/} - {/*}*/}
); } } -const SocialTitle = (props) => { +const ConsistentWelfare = (props) => { const { value, onChange, key } = props; + return
+ 各项福利基数一致: + onChange({ key, value: val })} + precision={2} + /> +
; +}; +const SocialTitle = (props) => { + const { value, onChange, keyname: key } = props; return onChange({ key, value: val })}/>; }; const SocialSelect = (props) => { From 03a432266bd037361be5719f27e4db579bef3e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 15 Feb 2023 10:13:34 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../socialSecurityBenefits/archives/index.js | 16 +++++++++------- pc4mobx/hrmSalary/stores/archives.js | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js index 68876f0d..717a4db0 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js @@ -214,20 +214,21 @@ export default class Archives extends React.Component { const { archivesStore: { save, socialSecurityForm, accumulationFundForm, otherForm } } = this.props; if (selectedTab == 1) { const { data } = socialSecurityForm; - console.log(socialSecurityForm); - if (data.socialSchemeId && !data.socialStartTime) { + const { socialName, socialStartTime } = data; + if (socialName && !socialStartTime) { Modal.warning({ title: "信息确认", content: "必要信息不完整,红色*为必填项!" }); return; } - // save("SOCIAL_SECURITY").then(() => { - // this.query(); - // }); + save("SOCIAL_SECURITY").then(() => { + this.query(); + }); } else if (selectedTab == 2) { const { data } = accumulationFundForm; - if (data.fundSchemeId && !data.fundStartTime) { + const { fundSchemeId, fundStartTime } = data; + if (fundSchemeId && !fundStartTime) { Modal.warning({ title: "信息确认", content: "必要信息不完整,红色*为必填项!" @@ -239,7 +240,8 @@ export default class Archives extends React.Component { }); } else if (selectedTab == 3) { const { data } = otherForm; - if (data.otherSchemeId && !data.otherStartTime) { + const { otherSchemeId, otherStartTime } = data; + if (otherSchemeId && !otherStartTime) { Modal.warning({ title: "信息确认", content: "必要信息不完整,红色*为必填项!" diff --git a/pc4mobx/hrmSalary/stores/archives.js b/pc4mobx/hrmSalary/stores/archives.js index b2df90d8..e7d6de24 100644 --- a/pc4mobx/hrmSalary/stores/archives.js +++ b/pc4mobx/hrmSalary/stores/archives.js @@ -207,7 +207,7 @@ export class ArchivesStore { let paymentForm = ""; if (welfareType == "SOCIAL_SECURITY") { baseForm = JSON.stringify(this.socialSecurityForm.data); - paymentForm = this.socialSecurityForm.data.socialSchemeId ? JSON.stringify(this.socialSecurityPaymentForm.data) : ""; + paymentForm = this.socialSecurityForm.data.socialName ? JSON.stringify(this.socialSecurityPaymentForm.data) : ""; } else if (welfareType == "ACCUMULATION_FUND") { baseForm = JSON.stringify(this.accumulationFundForm.data); paymentForm = this.accumulationFundForm.data.fundSchemeId ? JSON.stringify(this.accumulationFundPaymentForm.data) : ""; From 4e29ad25a2998ec1c9958b32c964ced731ed0c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 15 Feb 2023 11:37:13 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archives/accumulationFundForm.js | 240 +++++++----------- .../socialSecurityBenefits/archives/index.js | 4 +- .../archives/otherForm.js | 197 +++++--------- .../archives/socialSecurityForm.js | 21 +- pc4mobx/hrmSalary/stores/archives.js | 8 +- 5 files changed, 179 insertions(+), 291 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js index ff516018..edffd51d 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js @@ -1,9 +1,15 @@ 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 { toJS } from "mobx"; +import { WeaSearchGroup } from "ecCom"; +import { + ConsistentWelfare, + SocialDatePicker, + SocialEditInput, + SocialInputNumber, + SocialSelect, + SocialTitle +} from "./socialSecurityForm"; import "./index.less"; @inject("archivesStore") @@ -16,172 +22,110 @@ 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.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) { + }; + handlePaymentChange = ({ key, value }) => { + const params = { [key]: value }; 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(); - } - }); - } + 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 (
-
- { - this.handleFormChange({ nonPayment: value }); - }}/> -
- - - 公积金起始缴纳月: - - this.handleFormChange({ fundStartTime: value })} - /> - - - 公积金方案名称: - - { - this.handleFormChange({ fundSchemeId: value, fundName: showname }); - this.handleFetchPaymentForm(value); - }} - /> - - - - 公积金最后缴纳月: - - this.handleFormChange({ fundEndTime: value })} - /> - - 公积金账号: - - this.handleFormChange({ fundAccount: value })}/> - - - - 补充公积金账号: - - this.handleFormChange({ supplementFundAccount: value })}/> - - 公积金个人实际承担方: - - { - this.handleFormChange({ underTake: value }); - }} - /> - - - {/**/} - {/*公积金缴纳组织:*/} - {/**/} - {/* */} - {/**/} - {/**/} - + } + items={foundItems} col={2} showGroup needTigger={false}/> { - data.fundSchemeId && paymentItems && paymentItems.map(group => ( -
- { - group.items && group.items.length > 0 && - - { - group.items && group.items.map((item, idx) => ( - - - {item.label}: - - { - this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : '0' }); - }} - /> - - - - )) - } - - - } -
- - - )) + !_.isEmpty(fundSchemeId) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { + const { title, items } = item; + return ({ + com: SocialInputNumber({ + key: child["domkey"][0], + label: child.label, + value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "", + onChange: this.handlePaymentChange + }) + }))} + customComponent={} + title={title} col={2} showGroup + />; + }) }
); diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js index 717a4db0..4b9c73c6 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/index.js @@ -214,8 +214,8 @@ export default class Archives extends React.Component { const { archivesStore: { save, socialSecurityForm, accumulationFundForm, otherForm } } = this.props; if (selectedTab == 1) { const { data } = socialSecurityForm; - const { socialName, socialStartTime } = data; - if (socialName && !socialStartTime) { + const { socialSchemeId, socialStartTime } = data; + if (socialSchemeId && !socialStartTime) { Modal.warning({ title: "信息确认", content: "必要信息不完整,红色*为必填项!" diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js index 388c92b4..2247df1c 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js @@ -1,9 +1,14 @@ import React from "react"; import { inject, observer } from "mobx-react"; -import {toJS} from 'mobx'; -import { Col, Row } from "antd"; -import { WeaCheckbox, WeaDatePicker, WeaInputNumber, WeaSelect } from "ecCom"; -import GroupCard from "../../../components/groupCard"; +import { WeaSearchGroup } from "ecCom"; +import { toJS } from "mobx"; +import { + ConsistentWelfare, + SocialDatePicker, + SocialInputNumber, + SocialSelect, + SocialTitle +} from "./socialSecurityForm"; import "./index.less"; @inject("archivesStore") @@ -23,151 +28,89 @@ 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) { + }; + 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.handleFetchPaymentForm(value); + key === "otherSchemeId" && onChangeRecordOtherSchemeId(value); + }; + handlePaymentChange = ({ key, value }) => { + const params = { [key]: value }; 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 }; + const { items, data: otherData } = otherForm; 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(); - } - }); - } + 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 (
-
- { - this.handleFormChange({ nonPayment: value }); - }}/> -
- - - 其他福利起始缴纳月: - - this.handleFormChange({ otherStartTime: value })} - /> - - 其他福利方案名称: - - { - this.handleFormChange({ otherName: showname, otherSchemeId: value }); - this.handleFetchPaymentForm(value); - }}/> - - - - 其他福利最后缴纳月: - - this.handleFormChange({ otherEndTime: value })} - /> - - 其他福利个人实际承担方: - - { - this.handleFormChange({ underTake: value }); - }} - /> - - - {/**/} - {/*社保缴纳组织:*/} - {/**/} - {/* */} - {/* */} - {/**/} - {/**/} - - + } + items={otherItems} col={2} showGroup needTigger={false}/> { - data.otherSchemeId && paymentItems && paymentItems.map(group => ( -
- { - group.items && group.items.length > 0 && - - { - group.items && group.items.map(item => ( - - - {item.label}: - - { - this.handlePaymentChange({ [item.domkey[0]]: value ? String(value) : '0' }); - }} - /> - - - - )) - } - - - } -
- - )) + !_.isEmpty(otherSchemeId) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { + const { title, items } = item; + return ({ + com: SocialInputNumber({ + key: child["domkey"][0], + label: child.label, + value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "", + onChange: this.handlePaymentChange + }) + }))} + customComponent={} + title={title} col={2} showGroup + />; + }) }
); diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index 2c27a311..5b2a47cc 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -23,8 +23,8 @@ export default class SocialSecurityForm extends React.Component { let form = { ...socialSecurityForm }; form.data = request; setSocialSecurityForm(form); - key === "socialName" && this.handleFetchPaymentForm(value); - key === "socialName" && onChangeRecordSchemeId(value); + key === "socialSchemeId" && this.handleFetchPaymentForm(value); + key === "socialSchemeId" && onChangeRecordSchemeId(value); }; handleFetchPaymentForm = (value) => { @@ -50,7 +50,7 @@ export default class SocialSecurityForm extends React.Component { const paymentItems = socialSecurityPaymentForm.items; const { nonPayment = "", schemeAccount = "", socialStartTime = "", socialEndTime = "", - socialName = "" + socialSchemeId = "" } = socialData || {}; const socialItems = !_.isNil(toJS(items)) ? [ ..._.map(_.filter(toJS(items)[0].items, it => it.domkey[0] !== "paymentOrganization"), @@ -67,6 +67,7 @@ export default class SocialSecurityForm extends React.Component { com: SocialDatePicker({ key: "socialStartTime", label: "社保起始缴纳月", + viewAttr: socialSchemeId ? 3 : 2, value: socialStartTime, onChange: this.handleFormChange }) @@ -96,7 +97,7 @@ export default class SocialSecurityForm extends React.Component { onChange={this.handleFormChange}/>} items={socialItems} col={2} showGroup needTigger={false}/> { - !_.isEmpty(socialName) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { + !_.isEmpty(socialSchemeId) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { const { title, items } = item; return ({ @@ -116,7 +117,7 @@ export default class SocialSecurityForm extends React.Component { ); } } -const ConsistentWelfare = (props) => { +export const ConsistentWelfare = (props) => { const { value, onChange, key } = props; return
各项福利基数一致: @@ -127,17 +128,17 @@ const ConsistentWelfare = (props) => { />
; }; -const SocialTitle = (props) => { +export const SocialTitle = (props) => { const { value, onChange, keyname: key } = props; return onChange({ key, value: val })}/>; }; -const SocialSelect = (props) => { +export const SocialSelect = (props) => { const { key, value, onChange, options, label, labelColSpan = 12, wrapperColSpan = 12 } = props; return onChange({ key, value: val })}/> ; }; -const SocialEditInput = (props) => { +export const SocialEditInput = (props) => { const { key, value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; return ( @@ -145,7 +146,7 @@ const SocialEditInput = (props) => { ); }; -const SocialInputNumber = (props) => { +export const SocialInputNumber = (props) => { const { key, value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props; return ( @@ -153,7 +154,7 @@ const SocialInputNumber = (props) => { ); }; -const SocialDatePicker = (props) => { +export const SocialDatePicker = (props) => { const { key, value, diff --git a/pc4mobx/hrmSalary/stores/archives.js b/pc4mobx/hrmSalary/stores/archives.js index e7d6de24..02548e9b 100644 --- a/pc4mobx/hrmSalary/stores/archives.js +++ b/pc4mobx/hrmSalary/stores/archives.js @@ -205,13 +205,13 @@ 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.socialName ? JSON.stringify(this.socialSecurityPaymentForm.data) : ""; - } else if (welfareType == "ACCUMULATION_FUND") { + paymentForm = this.socialSecurityForm.data.socialSchemeId ? JSON.stringify(this.socialSecurityPaymentForm.data) : ""; + } 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") { + } else if (welfareType === "OTHER") { baseForm = JSON.stringify(this.otherForm.data); paymentForm = this.otherForm.data.otherSchemeId ? JSON.stringify(this.otherPaymentForm.data) : ""; } From c795325da4015442b8525b41cf385992ac50c20b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 15 Feb 2023 14:37:40 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../socialSecurityBenefits/archives/accumulationFundForm.js | 2 +- .../pages/socialSecurityBenefits/archives/otherForm.js | 2 +- .../pages/socialSecurityBenefits/archives/socialSecurityForm.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js index edffd51d..2125faa4 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js @@ -111,7 +111,7 @@ export default class AccumulationFundForm extends React.Component { onChange={this.handleFormChange}/>} items={foundItems} col={2} showGroup needTigger={false}/> { - !_.isEmpty(fundSchemeId) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { + !_.isEmpty(fundSchemeId.toString()) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { const { title, items } = item; return ({ diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js index 2247df1c..7afae69b 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js @@ -96,7 +96,7 @@ export default class OtherForm extends React.Component { onChange={this.handleFormChange}/>} items={otherItems} col={2} showGroup needTigger={false}/> { - !_.isEmpty(otherSchemeId) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { + !_.isEmpty(otherSchemeId.toString()) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { const { title, items } = item; return ({ diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index 5b2a47cc..90fc4d87 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -97,7 +97,7 @@ export default class SocialSecurityForm extends React.Component { onChange={this.handleFormChange}/>} items={socialItems} col={2} showGroup needTigger={false}/> { - !_.isEmpty(socialSchemeId) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { + !_.isEmpty(socialSchemeId.toString()) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { const { title, items } = item; return ({ From c789fd09d36b50fb0ecb06ab36a468f17d0aef9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 15 Feb 2023 15:02:14 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../socialSecurityBenefits/archives/accumulationFundForm.js | 2 +- .../pages/socialSecurityBenefits/archives/otherForm.js | 2 +- .../pages/socialSecurityBenefits/archives/socialSecurityForm.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js index 2125faa4..3dab92d0 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js @@ -111,7 +111,7 @@ export default class AccumulationFundForm extends React.Component { onChange={this.handleFormChange}/>} items={foundItems} col={2} showGroup needTigger={false}/> { - !_.isEmpty(fundSchemeId.toString()) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { + fundSchemeId && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { const { title, items } = item; return ({ diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js index 7afae69b..63156790 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js @@ -96,7 +96,7 @@ export default class OtherForm extends React.Component { onChange={this.handleFormChange}/>} items={otherItems} col={2} showGroup needTigger={false}/> { - !_.isEmpty(otherSchemeId.toString()) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { + otherSchemeId && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { const { title, items } = item; return ({ diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index 90fc4d87..fdb899b6 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -97,7 +97,7 @@ export default class SocialSecurityForm extends React.Component { onChange={this.handleFormChange}/>} items={socialItems} col={2} showGroup needTigger={false}/> { - !_.isEmpty(socialSchemeId.toString()) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { + socialSchemeId && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => { const { title, items } = item; return ({ From 4ee0165885e8923fa36384693f50b8322b370325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 15 Feb 2023 17:20:38 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../socialSecurityBenefits/archives/accumulationFundForm.js | 2 +- .../pages/socialSecurityBenefits/archives/otherForm.js | 2 +- .../pages/socialSecurityBenefits/archives/socialSecurityForm.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js index 3dab92d0..a70f164c 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js @@ -40,7 +40,7 @@ export default class AccumulationFundForm extends React.Component { getPaymentForm(this.props.employeeId, "ACCUMULATION_FUND", fundName, this.props.record.paymentOrganization); }; handlePaymentChange = ({ key, value }) => { - const params = { [key]: value }; + const params = { [key]: value.toString() }; const { archivesStore: { accumulationFundPaymentForm, setAccumulationFundPaymentForm } } = this.props; const { data } = accumulationFundPaymentForm; let request = { ...data, ...params }; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js index 63156790..d53870d0 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js @@ -44,7 +44,7 @@ export default class OtherForm extends React.Component { key === "otherSchemeId" && onChangeRecordOtherSchemeId(value); }; handlePaymentChange = ({ key, value }) => { - const params = { [key]: value }; + const params = { [key]: value.toString() }; const { archivesStore: { otherPaymentForm, setOtherPaymentForm } } = this.props; const { data } = otherPaymentForm; let request = { ...data, ...params }; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index fdb899b6..74bb20aa 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -34,7 +34,7 @@ export default class SocialSecurityForm extends React.Component { }; handlePaymentChange = ({ key, value }) => { - const params = { [key]: value }; + const params = { [key]: value.toString() }; const { archivesStore: { socialSecurityPaymentForm, setSocialSecurityPaymentForm } } = this.props; const { data } = socialSecurityPaymentForm; let request = { ...data, ...params }; From 3cbc12373a2f78fd187b1759c58444ba72e9c8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 16 Feb 2023 16:20:45 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archives/accumulationFundForm.js | 6 +- .../archives/otherForm.js | 6 +- .../archives/socialSecurityForm.js | 77 ++++++++++++++++--- pc4mobx/hrmSalary/stores/archives.js | 34 ++++++-- 4 files changed, 104 insertions(+), 19 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js index a70f164c..0551453c 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js @@ -40,7 +40,7 @@ export default class AccumulationFundForm extends React.Component { getPaymentForm(this.props.employeeId, "ACCUMULATION_FUND", fundName, this.props.record.paymentOrganization); }; handlePaymentChange = ({ key, value }) => { - const params = { [key]: value.toString() }; + const params = { [key]: !_.isNil(value) ? value.toString() : "" }; const { archivesStore: { accumulationFundPaymentForm, setAccumulationFundPaymentForm } } = this.props; const { data } = accumulationFundPaymentForm; let request = { ...data, ...params }; @@ -119,7 +119,9 @@ export default class AccumulationFundForm extends React.Component { key: child["domkey"][0], label: child.label, value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "", - onChange: this.handlePaymentChange + onChange: this.handlePaymentChange, + min: child.min, + max: child.max }) }))} customComponent={} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js index d53870d0..4e4a3119 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js @@ -44,7 +44,7 @@ export default class OtherForm extends React.Component { key === "otherSchemeId" && onChangeRecordOtherSchemeId(value); }; handlePaymentChange = ({ key, value }) => { - const params = { [key]: value.toString() }; + const params = { [key]: !_.isNil(value) ? value.toString() : "" }; const { archivesStore: { otherPaymentForm, setOtherPaymentForm } } = this.props; const { data } = otherPaymentForm; let request = { ...data, ...params }; @@ -104,7 +104,9 @@ export default class OtherForm extends React.Component { key: child["domkey"][0], label: child.label, value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "", - onChange: this.handlePaymentChange + onChange: this.handlePaymentChange, + min: child.min, + max: child.max }) }))} customComponent={} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index 74bb20aa..2fdd8f4a 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -1,5 +1,6 @@ import React from "react"; import { WeaCheckbox, WeaDatePicker, WeaFormItem, WeaInput, WeaInputNumber, WeaSearchGroup, WeaSelect } from "ecCom"; +import { message } from "antd"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; import "./index.less"; @@ -7,6 +8,13 @@ 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,12 +25,23 @@ export default class SocialSecurityForm extends React.Component { handleFormChange = ({ key, value }) => { const params = { [key]: value }; - const { archivesStore: { socialSecurityForm, setSocialSecurityForm }, onChangeRecordSchemeId } = this.props; + const { + archivesStore: { + socialSecurityForm, + setSocialSecurityForm, + socialSecurityPaymentForm, + setSocialSecurityPaymentForm + }, + onChangeRecordSchemeId + } = this.props; const { data } = socialSecurityForm; let request = { ...data, ...params }; let form = { ...socialSecurityForm }; form.data = request; setSocialSecurityForm(form); + console.log(toJS(socialSecurityPaymentForm)); + key === "socialSchemeId" && setSocialSecurityPaymentForm({ ...toJS(socialSecurityPaymentForm) }); + key === "socialSchemeId" && this.setState({ Welfare: "" }); key === "socialSchemeId" && this.handleFetchPaymentForm(value); key === "socialSchemeId" && onChangeRecordSchemeId(value); }; @@ -34,7 +53,7 @@ export default class SocialSecurityForm extends React.Component { }; handlePaymentChange = ({ key, value }) => { - const params = { [key]: value.toString() }; + const params = { [key]: !_.isNil(value) ? value.toString() : "" }; const { archivesStore: { socialSecurityPaymentForm, setSocialSecurityPaymentForm } } = this.props; const { data } = socialSecurityPaymentForm; let request = { ...data, ...params }; @@ -42,11 +61,39 @@ export default class SocialSecurityForm extends React.Component { form.data = request; setSocialSecurityPaymentForm(form); }; + 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 = socialSecurityPaymentForm.data; + const paymentData = toJS(socialSecurityPaymentForm.data); const paymentItems = socialSecurityPaymentForm.items; const { nonPayment = "", schemeAccount = "", socialStartTime = "", socialEndTime = "", @@ -105,10 +152,13 @@ export default class SocialSecurityForm extends React.Component { key: child["domkey"][0], label: child.label, value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "", - onChange: this.handlePaymentChange + onChange: this.handlePaymentChange, + min: child.min, + max: child.max }) }))} - customComponent={} + customComponent={ this.setState({ Welfare })} + onBlurChange={this.handleChangeWelfare}/>} title={title} col={2} showGroup />; }) @@ -118,12 +168,14 @@ export default class SocialSecurityForm extends React.Component { } } export const ConsistentWelfare = (props) => { - const { value, onChange, key } = props; + const { onChange, onBlurChange, value } = props; return
各项福利基数一致: onChange({ key, value: val })} + style={{ width: 100 }} + onBlur={onBlurChange} + value={value} + onChange={onChange} precision={2} />
; @@ -147,10 +199,15 @@ export const SocialEditInput = (props) => { ); }; export const SocialInputNumber = (props) => { - const { key, value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = 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 ( - onChange({ key, value: val })} min={0} precision={2}/> + onChange({ key, value: val })} precision={2} + min={minNum > 0 ? minNum : -999999999999999} + max={maxNum > 0 ? maxNum : 999999999999999} + /> ); }; diff --git a/pc4mobx/hrmSalary/stores/archives.js b/pc4mobx/hrmSalary/stores/archives.js index 02548e9b..db21b4e2 100644 --- a/pc4mobx/hrmSalary/stores/archives.js +++ b/pc4mobx/hrmSalary/stores/archives.js @@ -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"; @@ -176,7 +176,7 @@ export class ArchivesStore { _.map(baseList.items, item => { obj = { ...obj, - [item["domkey"][0]]: "0" + [item["domkey"][0]]: "" }; }); } @@ -207,13 +207,37 @@ export class ArchivesStore { let paymentForm = ""; if (welfareType === "SOCIAL_SECURITY") { baseForm = JSON.stringify(this.socialSecurityForm.data); - paymentForm = this.socialSecurityForm.data.socialSchemeId ? JSON.stringify(this.socialSecurityPaymentForm.data) : ""; + 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) : ""; + 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.fundSchemeId) { + 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 => { From 68ce529eff96ceb641ddc1192ff9c9acd981ba00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 16 Feb 2023 17:20:45 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archives/accumulationFundForm.js | 41 ++++++++++++++- .../archives/otherForm.js | 38 ++++++++++++-- .../archives/socialSecurityForm.js | 11 +--- pc4mobx/hrmSalary/stores/archives.js | 52 +++++++++++++++++-- 4 files changed, 123 insertions(+), 19 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js index 0551453c..57fbfa87 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/accumulationFundForm.js @@ -1,5 +1,6 @@ import React from "react"; import { inject, observer } from "mobx-react"; +import { message } from "antd"; import { toJS } from "mobx"; import { WeaSearchGroup } from "ecCom"; import { @@ -15,6 +16,12 @@ 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; @@ -30,6 +37,7 @@ export default class AccumulationFundForm extends React.Component { let form = { ...accumulationFundForm }; form.data = request; setAccumulationFundForm(form); + key === "fundSchemeId" && this.setState({ Welfare: "" }); key === "fundSchemeId" && this.handleFetchPaymentForm(value); key === "fundSchemeId" && onChangeRecordFundSchemeId(value); }; @@ -37,7 +45,7 @@ export default class AccumulationFundForm extends React.Component { // 获取基数表单 handleFetchPaymentForm = (fundName) => { const { archivesStore: { getPaymentForm } } = this.props; - getPaymentForm(this.props.employeeId, "ACCUMULATION_FUND", fundName, this.props.record.paymentOrganization); + getPaymentForm(this.props.employeeId, "ACCUMULATION_FUND", fundName, this.props.record.paymentOrganization, true); }; handlePaymentChange = ({ key, value }) => { const params = { [key]: !_.isNil(value) ? value.toString() : "" }; @@ -48,8 +56,36 @@ export default class AccumulationFundForm extends React.Component { form.data = request; setAccumulationFundPaymentForm(form); }; + 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; @@ -124,7 +160,8 @@ export default class AccumulationFundForm extends React.Component { max: child.max }) }))} - customComponent={} + customComponent={ this.setState({ Welfare })} + onBlurChange={this.handleChangeWelfare}/>} title={title} col={2} showGroup />; }) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js index 4e4a3119..7944b3f7 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/otherForm.js @@ -1,5 +1,6 @@ import React from "react"; import { inject, observer } from "mobx-react"; +import { message } from "antd"; import { WeaSearchGroup } from "ecCom"; import { toJS } from "mobx"; import { @@ -17,7 +18,7 @@ export default class OtherForm extends React.Component { constructor(props) { super(props); this.state = { - inited: false + Welfare: "" }; } @@ -30,7 +31,7 @@ export default class OtherForm extends React.Component { // 获取基数表单 handleFetchPaymentForm = (value) => { const { archivesStore: { getPaymentForm } } = this.props; - getPaymentForm(this.props.employeeId, "OTHER", value, this.props.record.paymentOrganization); + getPaymentForm(this.props.employeeId, "OTHER", value, this.props.record.paymentOrganization, true); }; handleFormChange = ({ key, value }) => { const params = { [key]: value }; @@ -40,6 +41,7 @@ export default class OtherForm extends React.Component { let form = { ...otherForm }; form.data = request; setOtherForm(form); + key === "otherSchemeId" && this.setState({ Welfare: "" }); key === "otherSchemeId" && this.handleFetchPaymentForm(value); key === "otherSchemeId" && onChangeRecordOtherSchemeId(value); }; @@ -53,7 +55,36 @@ export default class OtherForm extends React.Component { setOtherPaymentForm(form); }; + 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; @@ -109,7 +140,8 @@ export default class OtherForm extends React.Component { max: child.max }) }))} - customComponent={} + customComponent={ this.setState({ Welfare })} + onBlurChange={this.handleChangeWelfare}/>} title={title} col={2} showGroup />; }) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js index 2fdd8f4a..a378f168 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/archives/socialSecurityForm.js @@ -26,12 +26,7 @@ export default class SocialSecurityForm extends React.Component { handleFormChange = ({ key, value }) => { const params = { [key]: value }; const { - archivesStore: { - socialSecurityForm, - setSocialSecurityForm, - socialSecurityPaymentForm, - setSocialSecurityPaymentForm - }, + archivesStore: { socialSecurityForm, setSocialSecurityForm }, onChangeRecordSchemeId } = this.props; const { data } = socialSecurityForm; @@ -39,8 +34,6 @@ export default class SocialSecurityForm extends React.Component { let form = { ...socialSecurityForm }; form.data = request; setSocialSecurityForm(form); - console.log(toJS(socialSecurityPaymentForm)); - key === "socialSchemeId" && setSocialSecurityPaymentForm({ ...toJS(socialSecurityPaymentForm) }); key === "socialSchemeId" && this.setState({ Welfare: "" }); key === "socialSchemeId" && this.handleFetchPaymentForm(value); key === "socialSchemeId" && onChangeRecordSchemeId(value); @@ -49,7 +42,7 @@ export default class SocialSecurityForm extends React.Component { handleFetchPaymentForm = (value) => { const { archivesStore: { getPaymentForm }, employeeId, record } = this.props; const { paymentOrganization } = record; - getPaymentForm(employeeId, "SOCIAL_SECURITY", value, paymentOrganization); + getPaymentForm(employeeId, "SOCIAL_SECURITY", value, paymentOrganization, true); }; handlePaymentChange = ({ key, value }) => { diff --git a/pc4mobx/hrmSalary/stores/archives.js b/pc4mobx/hrmSalary/stores/archives.js index db21b4e2..7ba4e492 100644 --- a/pc4mobx/hrmSalary/stores/archives.js +++ b/pc4mobx/hrmSalary/stores/archives.js @@ -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 = {}; @@ -180,21 +180,63 @@ export class ArchivesStore { }; }); } - 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 } + }); + } } } }); @@ -229,7 +271,7 @@ export class ArchivesStore { } } else if (welfareType === "OTHER") { baseForm = JSON.stringify(this.otherForm.data); - if (this.otherForm.data.fundSchemeId) { + 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) => {