From 70a5d3ae7bf1509afab3dcffe7de68710fa8c089 Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Thu, 16 Jun 2022 20:58:54 +0800 Subject: [PATCH 1/5] fix bug 48 - 56 --- .../components/importModal/modalStep1.js | 46 ++++++++++++++----- .../programme/defaultSlideForm.js | 4 +- .../socialSecurityBenefits/programme/index.js | 6 --- pc4mobx/hrmSalary/stores/programme.js | 17 ++++--- 4 files changed, 46 insertions(+), 27 deletions(-) diff --git a/pc4mobx/hrmSalary/components/importModal/modalStep1.js b/pc4mobx/hrmSalary/components/importModal/modalStep1.js index 567d5b6c..ee1d23f8 100644 --- a/pc4mobx/hrmSalary/components/importModal/modalStep1.js +++ b/pc4mobx/hrmSalary/components/importModal/modalStep1.js @@ -14,7 +14,8 @@ export default class ModalStep1 extends React.Component { this.state = { datetime: "", taxAgentId: "", - hasData: "0" + hasData: "0", + fileList: [] } } @@ -23,6 +24,36 @@ export default class ModalStep1 extends React.Component { fetchTaxAgentOption(); } + handleChange(info) { + let fileList = info.fileList; + + // 1. 上传列表数量的限制 + // 只显示最近上传的一个,旧的会被新的顶掉 + fileList = fileList.slice(-1); + // 2. 读取远程路径并显示链接 + fileList = fileList.map((file) => { + if (file.response) { + // 组件会将 file.url 作为链接进行展示 + file.url = file.response.url; + } + return file; + }); + + // 3. 按照服务器返回信息筛选成功上传的文件 + fileList = fileList.filter((file) => { + if (file.response) { + return file.response.status === 1; + } + return true; + }); + + if(fileList && fileList.length > 0 && fileList[0].response && fileList[0].response.status === 1) { + this.props.onFileIdChange(fileList[0].response.data.fileid) + } + + this.setState({ fileList }); + } + render() { const { datetime, taxAgentId, hasData } = this.state const { taxAgentStore: {taxAgentOption}, isInit } = this.props; @@ -35,16 +66,7 @@ export default class ModalStep1 extends React.Component { multiple: false, action: "/api/doc/upload/uploadFile", //上传地址 onChange: (info) => { - const { status } = info.file; - if (status !== 'uploading') { - //获得服务端返回的资源url - console.log(info.file.response.data); - } - if (status === 'done') { - this.props.onFileIdChange(info.file.response.data.fileid) - } else if (status === 'error') { - message.error(`${info.file.name} file upload failed.`); - } + this.handleChange(info) }, }; return ( @@ -66,7 +88,7 @@ export default class ModalStep1 extends React.Component { 导入excel
- +

diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js index ba827ba3..86bbacb4 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js @@ -222,9 +222,9 @@ export default class DefaultSlideForm extends React.Component {

{ this.state.selectItem == "个人" ? - +
: -
+
} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js index b84932c4..beacd85c 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js @@ -204,12 +204,6 @@ export default class Programme extends React.Component { } const rightMenu = [// 右键菜单 - { - key: 'BTN_COLUMN', - icon: , - content: '显示列定制', - onClick: this.showColumn - }, ]; const collectParams = { // 收藏功能配置 favname: '社保福利方案', diff --git a/pc4mobx/hrmSalary/stores/programme.js b/pc4mobx/hrmSalary/stores/programme.js index d8614d19..11754e24 100644 --- a/pc4mobx/hrmSalary/stores/programme.js +++ b/pc4mobx/hrmSalary/stores/programme.js @@ -224,14 +224,17 @@ export class ProgrammeStore { validateCustomRequest() { let flag = true; - this.formCondition.forEach(item => { - if(item.rules == "required") { - if(!notNull(this.customRequest[item.domkey[0]])) { - message.warning(item.label + "不能为空") - flag = false + 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 + "不能为空") + } } - } - }) + }) + } catch(e) { + flag = false } return flag; } From 1837f512a3a73fb55d206c257287b5808d7466c0 Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Thu, 16 Jun 2022 21:42:08 +0800 Subject: [PATCH 2/5] fix bug 36 --- .../pages/calculateDetail/salaryDetail.js | 2 ++ .../pages/dataAcquisition/attendance/index.js | 6 ------ .../attendance/itemMangeFormModal.js | 14 +++++++++++++- .../pages/dataAcquisition/cumSituation/index.js | 4 ++-- .../hrmSalary/pages/ledger/slideRefereUser.js | 13 +++++++++++-- pc4mobx/hrmSalary/pages/salaryFile/index.js | 16 ++++++++-------- 6 files changed, 36 insertions(+), 19 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js b/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js index a08140a7..a7b1a74f 100644 --- a/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js +++ b/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js @@ -80,12 +80,14 @@ export default class SalaryDetail extends React.Component { if(result.dataIndex === "taxAgentName" || result.dataIndex === "username" || result.dataIndex === "departmentName") { result.fixed = "left" } + return result; }) columns.push({ title: '操作', key: "cz", width: '100px', + fixed: 'right', render: (text, record) => { return {this.handleEdit(record)}}>编辑 } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index 85f8819a..4bb32205 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -243,12 +243,6 @@ export default class Attendance extends React.Component { } const rightMenu = [// 右键菜单 - { - key: 'BTN_COLUMN', - icon: , - content: '显示列定制', - onClick: this.showColumn - }, { key: 'BTN_DEL', icon: , diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/itemMangeFormModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/itemMangeFormModal.js index a889b67b..ca3209ad 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/itemMangeFormModal.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/itemMangeFormModal.js @@ -31,6 +31,17 @@ export default class ItemMangeFormModal extends React.Component { this.setState({request: result}) } + convertFieldType(fileTypeStr) { + if(fileTypeStr == "数值") { + return "1" + } else if(fileTypeStr == "文本"){ + return "2" + } else if(fileTypeStr == "1" || fileTypeStr == "2") { + return fileTypeStr; + } + return "" + } + render() { const options = [ { @@ -46,6 +57,7 @@ export default class ItemMangeFormModal extends React.Component { ] const { request } = this.state; const {fieldName, fieldType, enableStatus, description} = request + let fileTypeKey = convertFieldType(fieldType) const { attendanceStore : {currentItemOperate}} = this.props; return ( - this.handleChange({fieldType: v})} /> diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index a910fd64..6e048dd1 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -352,9 +352,9 @@ export default class CumSituation extends React.Component { const handleButtonClick = () => { const { - cumSituationStore: { exportCumDeductList }, + cumSituationStore: { exportCumSituationList }, } = this.props; - exportCumDeductList(); + exportCumSituationList(); }; const handleMenuClick = () => { diff --git a/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js b/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js index 6d8e660c..0f07ed77 100644 --- a/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js +++ b/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js @@ -1,6 +1,6 @@ import React from 'react'; import { inject, observer } from 'mobx-react'; -import { Icon, Table } from 'antd'; +import { Icon, Table, message, Modal } from 'antd'; import { WeaInputSearch } from "ecCom" import { slideStep2Columns, dataSource } from './columns' import AddUserModal from './addUserModal' @@ -43,7 +43,16 @@ export default class SlideRefereUser extends React.Component { message.warning("未选择条目") return } - deleteLedgerPersonRange(this.state.selectedRowKeys) + Modal.confirm({ + title: '信息确认', + content: '确认删除', + onOk:() => { + deleteLedgerPersonRange(this.state.selectedRowKeys) + }, + onCancel: () => { + }, + }); + } handleSearch = (value) => { diff --git a/pc4mobx/hrmSalary/pages/salaryFile/index.js b/pc4mobx/hrmSalary/pages/salaryFile/index.js index 0bc0f1c0..360941b0 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/index.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/index.js @@ -357,14 +357,14 @@ export default class SalaryFile extends React.Component { className="salaryFileTabWrapper"> Date: Thu, 16 Jun 2022 21:59:29 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix=20bug=20=E9=BB=98=E8=AE=A4=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js | 6 +++--- .../hrmSalary/pages/dataAcquisition/cumSituation/index.js | 6 +++--- .../hrmSalary/pages/dataAcquisition/otherDeduct/index.js | 6 +++--- pc4mobx/hrmSalary/stores/cumDeduct.js | 4 ++-- pc4mobx/hrmSalary/stores/cumSituation.js | 4 ++-- pc4mobx/hrmSalary/stores/otherDeduct.js | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index d9b14d66..643c37a3 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -37,8 +37,8 @@ export default class CumDeduct extends React.Component { selectedKey: [], slideSelectedKey: [], //详情表格的选中项 visiable: false, - monthValue: "", - taxAgentId: "", + monthValue: moment(new Date()).format("YYYY-MM"), + taxAgentId: "All", datetime: "", inited: false, modalParam: { @@ -54,7 +54,7 @@ export default class CumDeduct extends React.Component { cumDeductStore: { doInit }, taxAgentStore: { fetchTaxAgentOption }, } = this.props; - doInit(); + doInit({declareMonth: [this.state.monthValue], taxAgentId: ""}); fetchTaxAgentOption().then((res) => { this.setState({ inited: true, diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index 6e048dd1..944f47f0 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -52,8 +52,8 @@ export default class CumSituation extends React.Component { slideSelectedKey: [], //详情表格的选中项 visiable: false, inited: false, - monthValue: "", - taxAgentId: "", + monthValue: moment(new Date()).format("YYYY-MM"), + taxAgentId: "All", modalParam: { taxYearMonth: "", }, @@ -66,7 +66,7 @@ export default class CumSituation extends React.Component { cumSituationStore: { doInit }, taxAgentStore: { fetchTaxAgentOption }, } = this.props; - doInit(); + doInit({taxYearMonth: [this.state.monthValue], taxAgentId: ""}); fetchTaxAgentOption().then(() => { this.setState({ inited: true, diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js index 444c9af0..756e9389 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js @@ -48,8 +48,8 @@ export default class OtherDeduct extends React.Component { selectedKey: [], slideSelectedKey: [], //详情表格的选中项 visiable: false, - monthValue: "", - taxAgentId: "", + monthValue: moment(new Date()).format("YYYY-MM"), + taxAgentId: "All", inited: false, modalParam: { declareMonth: "", @@ -63,7 +63,7 @@ export default class OtherDeduct extends React.Component { otherDeductStore: { doInit }, taxAgentStore: { fetchTaxAgentOption }, } = this.props; - doInit(); + doInit({declareMonth: [this.state.monthValue],taxAgentId:"" }); fetchTaxAgentOption().then(() => { this.setState({ inited: true, diff --git a/pc4mobx/hrmSalary/stores/cumDeduct.js b/pc4mobx/hrmSalary/stores/cumDeduct.js index 6803d625..f1e7e539 100644 --- a/pc4mobx/hrmSalary/stores/cumDeduct.js +++ b/pc4mobx/hrmSalary/stores/cumDeduct.js @@ -76,9 +76,9 @@ export class CumDeductStore { // 初始化操作 @action - doInit = () => { + doInit = (params = {}) => { this.getCondition(); - this.getTableDatas(); + this.getTableDatas(params); }; // 获得高级搜索表单数据 diff --git a/pc4mobx/hrmSalary/stores/cumSituation.js b/pc4mobx/hrmSalary/stores/cumSituation.js index 999a367a..4798c062 100644 --- a/pc4mobx/hrmSalary/stores/cumSituation.js +++ b/pc4mobx/hrmSalary/stores/cumSituation.js @@ -75,9 +75,9 @@ export class CumSituationStore { // 初始化操作 @action - doInit = () => { + doInit = (params = {}) => { this.getCondition(); - this.getTableDatas(); + this.getTableDatas(params); }; // 获得高级搜索表单数据 diff --git a/pc4mobx/hrmSalary/stores/otherDeduct.js b/pc4mobx/hrmSalary/stores/otherDeduct.js index 4555ff78..b656815b 100644 --- a/pc4mobx/hrmSalary/stores/otherDeduct.js +++ b/pc4mobx/hrmSalary/stores/otherDeduct.js @@ -77,9 +77,9 @@ export class OtherDeductStore { // 初始化操作 @action - doInit = () => { + doInit = (params = {}) => { this.getCondition(); - this.getTableDatas(); + this.getTableDatas(params); }; // 获得高级搜索表单数据 From 78adb5cf0d6b2bb4ccdefc2227a45367d44a37f8 Mon Sep 17 00:00:00 2001 From: liyongshun <971387674@qq.com> Date: Fri, 17 Jun 2022 16:53:27 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=B5=8B=E8=AF=95bug=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/archive.js | 2 +- pc4mobx/hrmSalary/apis/item.js | 9 +- pc4mobx/hrmSalary/apis/ledger.js | 374 +++++---- pc4mobx/hrmSalary/apis/welfareArchive.js | 2 +- .../components/customPaginationTable/index.js | 50 +- .../components/importModal/modalStep3.js | 113 ++- .../pages/calculate/baseFormModal.js | 4 +- pc4mobx/hrmSalary/pages/calculate/index.js | 389 +++++---- .../hrmSalary/pages/calculateDetail/index.js | 385 ++++----- .../pages/calculateDetail/index.less | 1 + .../pages/calculateDetail/userSure.js | 756 +++++++++++------- .../pages/dataAcquisition/attendance/index.js | 19 +- pc4mobx/hrmSalary/pages/ledger/index.js | 2 +- .../hrmSalary/pages/ledger/salaryItemForm.js | 336 ++++---- .../hrmSalary/pages/ledger/slideBaseForm.js | 46 +- .../hrmSalary/pages/ledger/slideRefereUser.js | 273 ++++--- .../pages/ledger/step3/canMoveItem.js | 443 +++++----- pc4mobx/hrmSalary/pages/salaryFile/index.js | 2 +- .../programme/defaultSlideForm.js | 477 ++++++----- .../socialSecurityBenefits/programme/index.js | 658 +++++++++------ pc4mobx/hrmSalary/stores/ledger.js | 271 ++++--- pc4mobx/hrmSalary/stores/programme.js | 5 + pc4mobx/hrmSalary/stores/salaryItem.js | 2 +- 23 files changed, 2618 insertions(+), 2001 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/archive.js b/pc4mobx/hrmSalary/apis/archive.js index 3fd8ea55..e581e07d 100644 --- a/pc4mobx/hrmSalary/apis/archive.js +++ b/pc4mobx/hrmSalary/apis/archive.js @@ -76,7 +76,7 @@ export const saveTaxAgent = params => { //薪资档案-删除个税扣缴义务人调整 export const deleteTaxAgent = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryArchive/deleteTaxAgent', 'POST', params); + return WeaTools.callApi('/api/bs/hrmsalary/salaryArchive/deleteTaxAgent', 'GET', params); } //薪资档案操作记录-薪资项目操作记录列表 diff --git a/pc4mobx/hrmSalary/apis/item.js b/pc4mobx/hrmSalary/apis/item.js index c8648ad5..7859e16f 100644 --- a/pc4mobx/hrmSalary/apis/item.js +++ b/pc4mobx/hrmSalary/apis/item.js @@ -82,14 +82,7 @@ export const updateItem = params => { //薪资项目-薪资项目详情 export const getItemForm = params => { - return fetch('/api/bs/hrmsalary/salaryitem/getSalaryForm', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) + return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/getSalaryForm', 'GET', params); } //薪资项目-添加系统薪资项目 diff --git a/pc4mobx/hrmSalary/apis/ledger.js b/pc4mobx/hrmSalary/apis/ledger.js index 59e62d18..2d411cd3 100644 --- a/pc4mobx/hrmSalary/apis/ledger.js +++ b/pc4mobx/hrmSalary/apis/ledger.js @@ -1,242 +1,270 @@ -import { WeaTools } from 'ecCom'; -import {postFetch} from '../util/request' +import { WeaTools } from "ecCom"; +import { postFetch } from "../util/request"; //薪资帐套列表 export const getLedgerList = params => { - return postFetch("/api/bs/hrmsalary/salarysob/list", params) -} + return postFetch("/api/bs/hrmsalary/salarysob/list", params); +}; //启用/禁用薪资帐套 export const changeLedgerStatus = params => { - return fetch('/api/bs/hrmsalary/salarysob/disable', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/disable", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //复制薪资帐套 export const duplicateLedger = params => { - return fetch('/api/bs/hrmsalary/salarysob/duplicate', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - + return fetch("/api/bs/hrmsalary/salarysob/duplicate", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //删除薪资帐套 export const deleteLedger = params => { - return fetch('/api/bs/hrmsalary/salarysob/delete', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/delete", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //薪资帐套基本信息表单 export const getLedgerBasicForm = params => { - return fetch('/api/bs/hrmsalary/salarysob/basic/getForm', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salarysob/basic/getForm", + "get", + params + ); + // return fetch('/api/bs/hrmsalary/salarysob/basic/getForm', { + // method: 'POST', + // mode: 'cors', + // headers: { + // 'Content-Type': 'application/json' + // }, + // body: JSON.stringify(params) + // }).then(res => res.json()) +}; //保存薪资帐套基本信息 export const saveLedgerBasic = params => { - return fetch('/api/bs/hrmsalary/salarysob/basic/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/basic/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //薪资帐套人员范围(包含)列表 export const getLedgerPersonRangeInclude = params => { - return fetch('/api/bs/hrmsalary/salarysob/range/listInclude', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/range/listInclude", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //薪资帐套人员范围(排除)列表 export const getLedgerPersonRangeExclude = params => { - return fetch('/api/bs/hrmsalary/salarysob/range/listExclude', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/range/listExclude", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //薪资帐套人员范围表单 export const getLedgerPersonRangeForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salarysob/range/getForm', 'get', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salarysob/range/getForm", + "get", + params + ); +}; //保存薪资帐套人员范围 export const saveLedgerPersonRange = params => { - return fetch('/api/bs/hrmsalary/salarysob/range/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/range/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //删除薪资帐套人员范围 export const deleteLedgerPersonRange = params => { - return fetch('/api/bs/hrmsalary/salarysob/range/delete', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/range/delete", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //薪资帐套项目分组的详情 export const getLedgerItemGroupForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salarysob/item/group/getForm', 'get', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salarysob/item/group/getForm", + "get", + params + ); +}; //保存薪资帐套薪资项目 export const saveLedgerItem = params => { - return fetch('/api/bs/hrmsalary/salarysob/item/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/item/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //薪资帐套薪资项目详情 export const getLedgerItemForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salarysob/item/getForm', 'get', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salarysob/item/getForm", + "get", + params + ); +}; //薪资帐套校验规则列表 export const getLedgerRuleList = params => { - return fetch('/api/bs/hrmsalary/salarysob/checkrule/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/checkrule/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //薪资帐套校验规则表单 export const getLedgerRuleForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salarysob/checkrule/getForm', 'get', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salarysob/checkrule/getForm", + "get", + params + ); +}; //保存薪资帐套校验规则 export const saveLedgerRule = params => { - return fetch('/api/bs/hrmsalary/salarysob/checkrule/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/checkrule/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //编辑薪资帐套校验规则公式 export const updateLedgerRuleFormula = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salarysob/checkrule/formula/update', 'POST', params); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salarysob/checkrule/formula/update", + "POST", + params + ); +}; //删除薪资帐套校验规则 export const deleteLedgerRule = params => { - return fetch('/api/bs/hrmsalary/salarysob/checkrule/delete', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/checkrule/delete", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; -// 薪资项目可选列表 +// 薪资项目可选列表 export const listSalaryItem = params => { - return fetch('/api/bs/hrmsalary/salarysob/item/listSalaryItem', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/item/listSalaryItem", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 员工信息字段列表 export const empFieldList = () => { - return WeaTools.callApi('/api/bs/hrmsalary/salarysob/empField/list', 'GET', {}); -} + return WeaTools.callApi( + "/api/bs/hrmsalary/salarysob/empField/list", + "GET", + {} + ); +}; // 调薪计薪规则可选的薪资项目列表 -export const listSalarySobItem = (params) => { - return fetch('/api/bs/hrmsalary/salarysob/adjustmentrule/listSalarySobItem', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const listSalarySobItem = params => { + return fetch("/api/bs/hrmsalary/salarysob/adjustmentrule/listSalarySobItem", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 调薪计薪规则保存 -export const saveAdjustmentRule = (params) => { - return fetch('/api/bs/hrmsalary/salarysob/adjustmentrule/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const saveAdjustmentRule = params => { + return fetch("/api/bs/hrmsalary/salarysob/adjustmentrule/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 调薪计薪规则列表 export const listAdjustmentRule = params => { - return fetch('/api/bs/hrmsalary/salarysob/adjustmentrule/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salarysob/adjustmentrule/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; diff --git a/pc4mobx/hrmSalary/apis/welfareArchive.js b/pc4mobx/hrmSalary/apis/welfareArchive.js index 2cabd8bb..f5446fa6 100644 --- a/pc4mobx/hrmSalary/apis/welfareArchive.js +++ b/pc4mobx/hrmSalary/apis/welfareArchive.js @@ -59,7 +59,7 @@ export const exportCurData = params => { }, body: JSON.stringify(params) }).then(res => res.blob().then(blob => { - var filename=`福利档案模板.xlsx` + var filename=`社保福利档案模板.xlsx` var a = document.createElement('a'); var url = window.URL.createObjectURL(blob); a.href = url; diff --git a/pc4mobx/hrmSalary/components/customPaginationTable/index.js b/pc4mobx/hrmSalary/components/customPaginationTable/index.js index 8b265977..b903f388 100644 --- a/pc4mobx/hrmSalary/components/customPaginationTable/index.js +++ b/pc4mobx/hrmSalary/components/customPaginationTable/index.js @@ -1,25 +1,29 @@ -import React from 'react' -import { WeaTable } from 'ecCom' -import CustomTable from '../../components/customTable' +import React from "react"; +import { WeaTable } from "ecCom"; +import CustomTable from "../../components/customTable"; export default class CustomPaginationTable extends React.Component { - render() { - return ( - {this.props.onPageChange(value)}, - total: this.props.total, - showTotal: (total) => `共 ${total} 条`, - current: this.props.current, - showSizeChanger: true, - showQuickJumper: true, - pageSize: this.props.pageSize, - onShowSizeChange: (current, pageSize) => { - this.props.onShowSizeChange && this.props.onShowSizeChange(current, pageSize); - } - }} - /> - ) - } -} \ No newline at end of file + render() { + return ( + { + this.props.onPageChange(value); + }, + total: this.props.total, + showTotal: total => `共 ${total} 条`, + current: this.props.current, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + showQuickJumper: true, + pageSize: this.props.pageSize, + onShowSizeChange: (current, pageSize) => { + this.props.onShowSizeChange && + this.props.onShowSizeChange(current, pageSize); + } + }} + /> + ); + } +} diff --git a/pc4mobx/hrmSalary/components/importModal/modalStep3.js b/pc4mobx/hrmSalary/components/importModal/modalStep3.js index 238d09e6..12600f8b 100644 --- a/pc4mobx/hrmSalary/components/importModal/modalStep3.js +++ b/pc4mobx/hrmSalary/components/importModal/modalStep3.js @@ -1,47 +1,76 @@ -import React from "react" -import successImg from "./success.svg" -import { Button, Table, Spin } from "antd" -import { WeaTable } from 'ecCom' +import React from "react"; +import successImg from "./success.svg"; +import { Button, Table, Spin } from "antd"; +import { WeaTable } from "ecCom"; export default class ModalStep3 extends React.Component { + componentWillMount() { + this.columns = [ + { + title: "错误信息", + dataIndex: "message", + key: "message" + } + ]; + } - componentWillMount() { - this.columns = [ + render() { + const { importResult } = this.props; + return ( +
+
+ {importResult.successCount === undefined + ?
+ + 正在导入请稍后... +
+ :
+ +
+ 数据导入完成 +
+
+ 已导入{" "} + + {" "}{importResult.successCount}{" "} + {" "} + 条数据,失败 + {" "}{importResult.errorCount}{" "} + 条数据 +
+
} +
{ - title: "错误信息", - dataIndex: 'message', - key: 'message', + } - ] - } - - render() { - const { importResult } = this.props; - return ( -
-
- { - importResult.successCount === undefined ? -
- - 正在导入请稍后... -
- :
- -
数据导入完成
-
已导入 {importResult.successCount} 条数据,失败 {importResult.errorCount} 条数据
-
- } -
- { - - } -
-
-
- -
-
- ) - } -} \ No newline at end of file +
+
+
+ +
+
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/calculate/baseFormModal.js b/pc4mobx/hrmSalary/pages/calculate/baseFormModal.js index 1deacd94..c3a1ed45 100644 --- a/pc4mobx/hrmSalary/pages/calculate/baseFormModal.js +++ b/pc4mobx/hrmSalary/pages/calculate/baseFormModal.js @@ -81,7 +81,7 @@ export default class baseFormModal extends React.Component {
薪酬所属月 {this.setState({ @@ -96,7 +96,7 @@ export default class baseFormModal extends React.Component { { this.state.inited &&
`共 ${total} 条`, + current: userTableStore.pageNum + }} + /> + - render() { - const { ledgerStore: {includeType, userTableStore, addUserModalVisible, setAddUserModalVisible, baseInfoRequest}} = this.props; - const { canEdit="true" } = baseInfoRequest; - let { columns, list} = userTableStore - const { selectedRowKeys } = this.state - columns = columns || [] - list = list || [] - - list.map(item => item.key = item.id) - - const rowSelection = { - selectedRowKeys, - onChange: this.onSelectChange, - }; - - return ( -
-
-
{this.handleTabClick(1)}}>关联人员范围 {' '} | {' '} {this.handleTabClick(0)}}>从范围中排除
- {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/> - { - canEdit === 'true' && -
- {this.handleTabDelete()}}/> - {setAddUserModalVisible(true)}}/> -
- } -
-
-
`共 ${total} 条`, - current: userTableStore.pageNum - }}/> - - - { - addUserModalVisible && {setAddUserModalVisible(false)}} - /> - } - - - ) - } -} \ No newline at end of file + {addUserModalVisible && + { + setAddUserModalVisible(false); + }} + />} + + ); + } +} diff --git a/pc4mobx/hrmSalary/pages/ledger/step3/canMoveItem.js b/pc4mobx/hrmSalary/pages/ledger/step3/canMoveItem.js index 39a45e56..d5666ea8 100644 --- a/pc4mobx/hrmSalary/pages/ledger/step3/canMoveItem.js +++ b/pc4mobx/hrmSalary/pages/ledger/step3/canMoveItem.js @@ -1,216 +1,259 @@ -import React,{ Fragment } from 'react' -import { Icon, Table, message, Modal } from 'antd' -import { WeaTable } from 'ecCom' -import { slideStep3Columns } from '../columns' -import AddSalaryItemModal from './AddSalaryItemModal' -import { inject, observer } from 'mobx-react'; -import FormalFormModal from '../../salaryItem/formalFormModal' -import AddCategoryModal from '../step3/AddCategoryModal' -import { toJS } from 'mobx'; +import React, { Fragment } from "react"; +import { Icon, Table, message, Modal } from "antd"; +import { WeaTable } from "ecCom"; +import { slideStep3Columns } from "../columns"; +import AddSalaryItemModal from "./AddSalaryItemModal"; +import { inject, observer } from "mobx-react"; +import FormalFormModal from "../../salaryItem/formalFormModal"; +import AddCategoryModal from "../step3/AddCategoryModal"; +import { toJS } from "mobx"; -@inject('ledgerStore') +@inject("ledgerStore") @observer export default class CanMoveItem extends React.Component { - constructor(props) { - super(props) - let columns = slideStep3Columns - .map(item => { - item = {...item} - if(item.key == "formulaContent") { - item.render = (text, record) => { - if(record.canEdit) { - return ( - { - this.handleFormulaClick(record.formulaId, record) - }}>{text} - ) - } else { - return ( - {text} - ) - } - } - } - return item; - }) - this.state = { - addItemVisible: false, - showContent: true, - selectedRowKeys: [], - columns, - formalModalVisible: false, - addCategoryVisible: false - } - - this.formulaId = "" - this.record = {} - this.title = "" - } - - // 编辑公式 - handleFormulaClick(formulaId, record) { - this.formulaId = formulaId - this.record = record - this.setState({ - formalModalVisible: true - }) - } - - - handleTiggleContent() { - this.setState({showContent: !this.state.showContent}) - } - - onSelectChange = selectedRowKeys => { - this.setState({ selectedRowKeys }); + constructor(props) { + super(props); + let columns = slideStep3Columns.map(item => { + item = { ...item }; + if (item.key == "formulaContent") { + item.render = (text, record) => { + if (record.canEdit) { + return ( + + { + this.handleFormulaClick(record.formulaId, record); + }}> + {text} + + + ); + } else { + return ( + + {text} + + ); + } + }; + } + return item; + }); + this.state = { + addItemVisible: false, + showContent: true, + selectedRowKeys: [], + columns, + formalModalVisible: false, + addCategoryVisible: false }; - // 删除 - handleDelete = () => { - const { selectedRowKeys } = this.state; - if(selectedRowKeys.length == 0) { - message.warning("为选择任何条目") - return - } - Modal.confirm({ - title: '信息确认', - content: '确认删除', - onOk:() => { - const {dataSource} = this.props; - let result = [...dataSource] - this.props.onChange(result.filter(item => selectedRowKeys.indexOf(item.key) < 0)) - }, - onCancel: () => { + this.formulaId = ""; + this.record = {}; + this.title = ""; + } - }, - }); + // 编辑公式 + handleFormulaClick(formulaId, record) { + this.formulaId = formulaId; + this.record = record; + this.setState({ + formalModalVisible: true + }); + } + + handleTiggleContent() { + this.setState({ showContent: !this.state.showContent }); + } + + onSelectChange = selectedRowKeys => { + this.setState({ selectedRowKeys }); + }; + + // 删除 + handleDelete = () => { + const { selectedRowKeys } = this.state; + if (selectedRowKeys.length == 0) { + message.warning("为选择任何条目"); + return; } + Modal.confirm({ + title: "信息确认", + content: "确认删除", + onOk: () => { + const { dataSource } = this.props; + let result = [...dataSource]; + this.props.onChange( + result.filter(item => selectedRowKeys.indexOf(item.key) < 0) + ); + }, + onCancel: () => {} + }); + }; - // 保存 - handleSaveFormal(data) { - let record = {...this.record} - record.formulaId = data.id - let dataSource = [...this.props.dataSource] - dataSource.map(item => { - if(item.id == record.id) { - item.formulaId = data.id - item.formulaContent = data.formula - } - }) - this.props.onDataSourceChange(dataSource) - } + // 保存 + handleSaveFormal(data) { + let record = { ...this.record }; + record.formulaId = data.id; + let dataSource = [...this.props.dataSource]; + dataSource.map(item => { + if (item.id == record.id) { + item.formulaId = data.id; + item.formulaContent = data.formula; + } + }); + this.props.onDataSourceChange(dataSource); + } - // 编辑分类名称 - handleUpdateCategorySave(name) { - this.props.onTitleChange && this.props.onTitleChange(name) - this.setState({ - addCategoryVisible: false - }) - } + // 编辑分类名称 + handleUpdateCategorySave(name) { + this.props.onTitleChange && this.props.onTitleChange(name); + this.setState({ + addCategoryVisible: false + }); + } - // 修改分类名称,弹出修改弹出 - handleEditGroupIconClick(title) { - this.title = title - this.setState({addCategoryVisible : true}) - } + // 修改分类名称,弹出修改弹出 + handleEditGroupIconClick(title) { + this.title = title; + this.setState({ addCategoryVisible: true }); + } - // 删除分类回调 - handleDeleteGroupIconClick() { - Modal.confirm({ - title: '信息确认', - content: '确认删除', - onOk:() => { - this.props.onGroupDelete && this.props.onGroupDelete() - }, - onCancel: () => { - }, - }); - } + // 删除分类回调 + handleDeleteGroupIconClick() { + Modal.confirm({ + title: "信息确认", + content: "确认删除", + onOk: () => { + this.props.onGroupDelete && this.props.onGroupDelete(); + }, + onCancel: () => {} + }); + } - render() { - const {disabled, ledgerStore: {setAddItemVisible, addItemVisible}} = this.props; - const { selectedRowKeys, formalModalVisible, addCategoryVisible } = this.state; - const rowSelection = { - selectedRowKeys, - onChange: this.onSelectChange, - getCheckboxProps: (record) => ({ - disabled: !record.canDelete, - }), - }; + render() { + const { + disabled, + ledgerStore: { setAddItemVisible, addItemVisible } + } = this.props; + const { + selectedRowKeys, + formalModalVisible, + addCategoryVisible + } = this.state; + const rowSelection = { + selectedRowKeys, + onChange: this.onSelectChange, + getCheckboxProps: record => ({ + disabled: !record.canDelete + }) + }; - return ( -
-
- {this.props.title} - { - this.props.title !== "未分类" && - { - !disabled && - - {this.handleEditGroupIconClick(this.props.title)}}/> - {this.handleDeleteGroupIconClick()}}/> - - } - - } - - - - { - !disabled && - - {this.handleDelete()}}/> - { this.setState({addItemVisible: true}) }}/> - - } - {this.handleTiggleContent()}}/> - -
- { - this.state.showContent && ({ - index, - moveRow: record, - })} - pagination={false} - onDrop={(datas) => this.props.onDataSourceChange(datas)} - draggable={true} - + return ( +
+
+ + {this.props.title} + {this.props.title !== "未分类" && + + {!disabled && + + { + this.handleEditGroupIconClick(this.props.title); + }} /> - } - { - this.state.addItemVisible && { this.setState({addItemVisible: false})}} + { + this.handleDeleteGroupIconClick(); + }} /> - } + } + } + + + {!disabled && + + { + this.handleDelete(); + }} + /> + { + this.setState({ addItemVisible: true }); + }} + /> + } + { + this.handleTiggleContent(); + }} + /> + +
+ {this.state.showContent && + ({ + index, + moveRow: record + })} + pagination={false} + onDrop={datas => this.props.onDataSourceChange(datas)} + draggable={true} + />} + {this.state.addItemVisible && + { + this.setState({ addItemVisible: false }); + }} + />} - { - formalModalVisible && - { - this.handleSaveFormal(data) - }} - onCancel={() => this.setState({ - formalModalVisible: false - })} - /> - } - - {/* 编辑分类名称 */} - { - addCategoryVisible && - {this.handleUpdateCategorySave(value)}} visible={addCategoryVisible} onCancel={() => { - this.setState({addCategoryVisible: false}) - }} /> - } -
- ) - } -} \ No newline at end of file + {formalModalVisible && + { + this.handleSaveFormal(data); + }} + onCancel={() => + this.setState({ + formalModalVisible: false + })} + />} + + {/* 编辑分类名称 */} + {addCategoryVisible && + { + this.handleUpdateCategorySave(value); + }} + visible={addCategoryVisible} + onCancel={() => { + this.setState({ addCategoryVisible: false }); + }} + />} +
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/salaryFile/index.js b/pc4mobx/hrmSalary/pages/salaryFile/index.js index 360941b0..5c5644cc 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/index.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/index.js @@ -319,7 +319,7 @@ export default class SalaryFile extends React.Component { onCancel() {}, }); } else { - this.setState({ importType: e.key, isInit: false, modalVisiable: true, step: 0 }); + this.setState({ importType: e.key, isInit: true, modalVisiable: true, step: 0 }); } }; diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js index 86bbacb4..3f0ea667 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/defaultSlideForm.js @@ -1,234 +1,267 @@ -import React from 'react' -import { WeaSelect, WeaInput } from 'ecCom' -import { Table, Row, Col, Switch } from 'antd' -import { insertUpdateColumns } from './columns' -import { inject, observer } from 'mobx-react'; -import SmallTab from '../../../components/smallTab' -import "./index.less" -import RequiredLabelTip from '../../../components/requiredLabelTip'; +import React from "react"; +import { WeaSelect, WeaInput } from "ecCom"; +import { Table, Row, Col, Switch } from "antd"; +import { insertUpdateColumns } from "./columns"; +import { inject, observer } from "mobx-react"; +import SmallTab from "../../../components/smallTab"; +import "./index.less"; +import RequiredLabelTip from "../../../components/requiredLabelTip"; -@inject('programmeStore') +@inject("programmeStore") @observer export default class DefaultSlideForm extends React.Component { - constructor(props) { - super(props) - this.state = { - value: "SCHEME_TOWN", - selectItem: "个人", - dataSource: {} - } - insertUpdateColumns.map(item => { - if(item.dataIndex == "isPayment") { - item.render = (text, record) => { - return ( { - this.updateDataSource(record, e, "isPayment") - }}/>) - } - } else if(item.dataIndex == "validNum") { - let options = [ - { - key: "0", - selected: false, - showname: "0" - }, - { - key: "1", - selected: false, - showname: "1" - }, - { - key: "2", - selected: true, - showname: "2" - } - ] - item.render = (text, record) => { - return ( - { - this.updateDataSource(record, v, "validNum") - }} - /> - ) - } - } else if(item.dataIndex == "rententionRule") { - let options = [ - { - key: "1", - selected: false, - showname: "原始数据" - }, - { - key: "2", - selected: false, - showname: "四舍五入" - }, - { - key: "3", - selected: false, - showname: "向上舍入" - }, - { - key: "4", - selected: false, - showname: "向下舍入" - }, - ] - item.render = (text, record) => { - return ( - { - this.updateDataSource(record, v, "rententionRule") - }} - /> - ) - } - } else if(item.dataIndex == "paymentProportion") { - item.render = (text, record) => { - return ( - { - this.updateDataSource(record, v, "paymentProportion") - }}/> - ) - } - } else if(item.dataIndex == "fixedCost") { - item.render = (text, record) => { - return ( - { - this.updateDataSource(record, v, "fixedCost") - }} /> - ) - } - } - }) - + constructor(props) { + super(props); + this.state = { + value: "SCHEME_TOWN", + selectItem: "个人", + dataSource: {} + }; + insertUpdateColumns.map(item => { + if (item.dataIndex == "isPayment") { + item.render = (text, record) => { + return ( + { + this.updateDataSource(record, e, "isPayment"); + }} + /> + ); + }; + } else if (item.dataIndex == "validNum") { + let options = [ + { + key: "0", + selected: false, + showname: "0" + }, + { + key: "1", + selected: false, + showname: "1" + }, + { + key: "2", + selected: true, + showname: "2" + } + ]; + item.render = (text, record) => { + return ( + { + this.updateDataSource(record, v, "validNum"); + }} + /> + ); + }; + } else if (item.dataIndex == "rententionRule") { + let options = [ + { + key: "1", + selected: false, + showname: "原始数据" + }, + { + key: "2", + selected: false, + showname: "四舍五入" + }, + { + key: "3", + selected: false, + showname: "向上舍入" + }, + { + key: "4", + selected: false, + showname: "向下舍入" + } + ]; + item.render = (text, record) => { + return ( + { + this.updateDataSource(record, v, "rententionRule"); + }} + /> + ); + }; + } else if (item.dataIndex == "paymentProportion") { + item.render = (text, record) => { + return ( + { + this.updateDataSource(record, v, "paymentProportion"); + }} + /> + ); + }; + } else if (item.dataIndex == "fixedCost") { + item.render = (text, record) => { + return ( + { + this.updateDataSource(record, v, "fixedCost"); + }} + /> + ); + }; + } + }); + } + + updateDataSource(record, e, key) { + const { + programmeStore: { + defaultCompanyDataSource, + defaultPersonDataSource, + setDefaultPersonDataSource, + setDefaultCompanyDataSource + } + } = this.props; + let result = { ...record }; + result[key] = e; + if (this.state.selectItem == "个人") { + let dataSource = [...defaultPersonDataSource]; + dataSource = dataSource.map(item => { + if (item.id == result.id) return result; + else return item; + }); + setDefaultPersonDataSource(dataSource); + } else { + let dataSource = [...defaultCompanyDataSource]; + dataSource = dataSource.map(item => { + if (item.id == result.id) return result; + else return item; + }); + setDefaultCompanyDataSource(dataSource); } + } - updateDataSource(record, e, key) { - const { programmeStore: {defaultCompanyDataSource, defaultPersonDataSource, setDefaultPersonDataSource, setDefaultCompanyDataSource}} = this.props; - let result = {...record} - result[key] = e - if(this.state.selectItem == "个人") { - let dataSource = [...defaultPersonDataSource]; - dataSource = dataSource.map(item => { - if(item.id == result.id) - return result; - else - return item; - }) - setDefaultPersonDataSource(dataSource) - } else { - let dataSource = [...defaultCompanyDataSource]; - dataSource = dataSource.map(item => { - if(item.id == result.id) - return result; - else - return item; - }) - setDefaultCompanyDataSource(dataSource) - } - } + componentWillMount() { + const { programmeStore } = this.props; + const { getForm, selectedKey, defaultPersonDataSource } = programmeStore; + } - componentWillMount() { - const { programmeStore } = this.props; - const { getForm, selectedKey, defaultPersonDataSource } = programmeStore - } + render() { + const { programmeStore } = this.props; + const { + defaultPersonDataSource, + defaultCompanyDataSource, + selectedKey + } = programmeStore; + const { dataSource } = this.state; + const options = [ + { + key: "SCHEME_TOWN", + selected: true, + showname: "城镇" + }, + { + key: "SCHEME_VILLAGE", + selected: false, + showname: "农村" + } + ]; - render() { - const { programmeStore } = this.props; - const { defaultPersonDataSource, defaultCompanyDataSource, selectedKey } = programmeStore - const { dataSource } = this.state; - const options = [ - { - key: "SCHEME_TOWN", - selected: true, - showname: "城镇" - }, - { - key: "SCHEME_VILLAGE", - selected: false, - showname: "农村" - } - ] + const handleSmallTabChange = item => { + // let paymentArea = item == "paymentArea" ? "1": "2" + // let requestParams = {...this.props.requestParams} + // requestParams.paymentArea = paymentArea + this.setState({ + selectItem: item.value + }); + // this.props.onChange(requestParams) + }; - const handleSmallTabChange = (item) => { - // let paymentArea = item == "paymentArea" ? "1": "2" - // let requestParams = {...this.props.requestParams} - // requestParams.paymentArea = paymentArea - this.setState({ - selectItem: item.value, - }) - // this.props.onChange(requestParams) - } + return ( +
+
+ +
+ 缴纳类型 + + + { + let requestParams = { ...this.props.requestParams }; + requestParams.paymentType = v; + this.props.onChange(requestParams); + }} + /> + + - return ( -
-
- -
- 缴纳类型 - - - { - 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} - requestParams.schemeName = value - this.props.onChange(requestParams) - }}/> - - + + 备注 + + { + let requestParams = { ...this.props.requestParams }; + requestParams.remarks = value; + this.props.onChange(requestParams); + }} + /> + + + - - - 备注 - - - { - let requestParams = {...this.props.requestParams} - requestParams.remarks = value - this.props.onChange(requestParams) - }}/> - - - +
+
+ { + handleSmallTabChange(item); + }} + /> +
-
-
- {handleSmallTabChange(item)}} /> -
- -
- { - this.state.selectItem == "个人" ? -
- : -
- } - - - - ) - } -} \ No newline at end of file +
+ {this.state.selectItem == "个人" + ?
+ :
} + + + + ); + } +} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js index beacd85c..8b6c7935 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js @@ -1,40 +1,59 @@ -import React from 'react'; -import { inject, observer } from 'mobx-react'; -import { toJS } from 'mobx'; +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; -import { Button, Table, DatePicker, Row, Col, Switch, Modal, Dropdown, Menu } from 'antd'; +import { + Button, + Table, + DatePicker, + Row, + Col, + Switch, + Modal, + Dropdown, + Menu +} from "antd"; -import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaInputSearch, WeaSlideModal, WeaSelect, WeaTable } from 'ecCom'; +import { + WeaTop, + WeaTab, + WeaRightMenu, + WeaRangePicker, + WeaInputSearch, + WeaSlideModal, + WeaSelect, + WeaTable +} from "ecCom"; -import { WeaTableNew } from "comsMobx" -import CustomTable from '../../../components/customTable' +import { WeaTableNew } from "comsMobx"; +import CustomTable from "../../../components/customTable"; import "./index.less"; const WeaMobxTable = WeaTableNew.WeaTable; -import { renderNoright, getSearchs } from '../../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import CustomTab from '../../../components/customTab'; -import ContentWrapper from '../../../components/contentWrapper'; -import SlideModalTitle from '../../../components/slideModalTitle'; -import TipLabel from '../../../components/TipLabel' -import DefaultSlideForm from './defaultSlideForm' -import CustomNewModal from './customNewModal' -import { welfareTypeEnum, paymentScopeEnum } from './enum'; -import CustomPaginationTable from '../../../components/customPaginationTable' - +import { renderNoright, getSearchs } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import CustomTab from "../../../components/customTab"; +import ContentWrapper from "../../../components/contentWrapper"; +import SlideModalTitle from "../../../components/slideModalTitle"; +import TipLabel from "../../../components/TipLabel"; +import DefaultSlideForm from "./defaultSlideForm"; +import CustomNewModal from "./customNewModal"; +import { welfareTypeEnum, paymentScopeEnum } from "./enum"; +import CustomPaginationTable from "../../../components/customPaginationTable"; import { socialSecurityColumns, accumulationFundColumns, otherBenefitsColumns, - CustomBenefitsColumns, dataSource -} from './columns'; + CustomBenefitsColumns, + dataSource +} from "./columns"; const { MonthPicker } = DatePicker; -import TwoColContent from '../../../components/twoColContent'; -import CopySchemaModal from './copySchemaModal'; +import TwoColContent from "../../../components/twoColContent"; +import CopySchemaModal from "./copySchemaModal"; -@inject('programmeStore') +@inject("programmeStore") @observer export default class Programme extends React.Component { constructor(props) { @@ -48,35 +67,48 @@ export default class Programme extends React.Component { copyId: "", customNewVisible: false, customEdit: false - } + }; - this.pageInfo = {current: 1, pageSize: 10} + this.pageInfo = { current: 1, pageSize: 10 }; } componentWillMount() { const { programmeStore } = this.props; - const {doInit} = programmeStore; + const { doInit } = programmeStore; doInit(); } // 增加编辑功能,重写columns绑定事件 - getColumns = (columns) => { - let newColumns = columns.filter(item => item.dataIndex !== "id" && item.dataIndex !== "paymentArea") - + getColumns = columns => { + let newColumns = columns.filter( + item => item.dataIndex !== "id" && item.dataIndex !== "paymentArea" + ); + newColumns = newColumns.map(column => { let newColumn = column; - newColumn.render = (text, record, index) => { //前端元素转义 - let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; - if(newColumn.dataIndex == "id") { - newColumn.display = false + newColumn.render = (text, record, index) => { + //前端元素转义 + let valueSpan = + record[newColumn.dataIndex + "span"] !== undefined + ? record[newColumn.dataIndex + "span"] + : record[newColumn.dataIndex]; + if (newColumn.dataIndex == "id") { + newColumn.display = false; } - switch(newColumn.dataIndex) { + switch (newColumn.dataIndex) { case "operate": - return {this.onEdit(record)}}>编辑 + return ( + { + this.onEdit(record); + }}> + 编辑 + + ); default: - return
+ return
; } - } + }; return newColumn; }); @@ -84,138 +116,202 @@ export default class Programme extends React.Component { title: "操作", dataIndex: "operate", render: (text, record) => { - return {this.onEdit(record)}}>编辑 + return ( + { + this.onEdit(record); + }}> + 编辑 + + ); } - }) - newColumns.push( - { - title : '', - key: "moreOperate", - dataIndex: "moreOperate", - render: (text, record) => { - return ( - - - { - this.onCopy(record); - }}>复制 - - }> - - - - ); - } - }) + }); + newColumns.push({ + title: "", + key: "moreOperate", + dataIndex: "moreOperate", + render: (text, record) => { + return ( + + + { + this.onCopy(record); + }}> + 复制 + + + + }> + + + ); + } + }); return newColumns; - } + }; handleCategoryStatusChange(record, value) { - const {programmeStore: { updateCustomCategoryStatus }} = this.props; + const { programmeStore: { updateCustomCategoryStatus } } = this.props; Modal.confirm({ - title: '信息确认', - content: `确认要${value ? '启用' : '停用'}吗`, - onOk:() => { - updateCustomCategoryStatus(record.id, value) - }, - onCancel: () => { - + title: "信息确认", + content: `确认要${value ? "启用" : "停用"}吗`, + onOk: () => { + updateCustomCategoryStatus(record.id, value); }, + onCancel: () => {} }); } - getCustomColumns = (columns) => { - let newColumns = ''; + getCustomColumns = columns => { + let newColumns = ""; newColumns = columns.map(column => { let newColumn = column; - newColumn.render = (text, record, index) => { //前端元素转义 - let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; - switch(newColumn.dataIndex) { + newColumn.render = (text, record, index) => { + //前端元素转义 + let valueSpan = + record[newColumn.dataIndex + "span"] !== undefined + ? record[newColumn.dataIndex + "span"] + : record[newColumn.dataIndex]; + switch (newColumn.dataIndex) { case "operate": - return {this.onCustomEdit(record)}}>编辑 + return ( + { + this.onCustomEdit(record); + }}> + 编辑 + + ); case "is_use": - return {this.handleCategoryStatusChange(record, value)}}/> + return ( + { + this.handleCategoryStatusChange(record, value); + }} + /> + ); default: - return
+ return
; } - } + }; return newColumn; }); return newColumns; - } + }; onEdit(record) { let id = record.id; - const { programmeStore } = this.props - const { getForm, selectedKey } = programmeStore + const { programmeStore } = this.props; + const { getForm, selectedKey } = programmeStore; getForm({ welfareTypeEnum: selectedKey, id - }) - this.setState({slideVisiable: true, currentOperate: "update"}) + }); + this.setState({ slideVisiable: true, currentOperate: "update" }); } onCopy(record) { this.setState({ copyId: record.id, copyModalVisible: true - }) + }); } onCustomOperatesClick(record, index, operate, flag) { - switch(operate.text.toString()){ - case '编辑': // 编辑 + switch (operate.text.toString()) { + case "编辑": // 编辑 this.onCustomEdit(record); break; } } - onCustomEdit(record) { - const { programmeStore: {getCustomForm, setCustomNewVisible, setCustomRequest}} = this.props; - getCustomForm() - setCustomNewVisible(true) + onCustomEdit(record) { + const { + programmeStore: { getCustomForm, setCustomNewVisible, setCustomRequest } + } = this.props; + getCustomForm(); + setCustomNewVisible(true); this.setState({ customEdit: true - }) + }); setCustomRequest({ - insuranceName: record['insurance_name'], + insuranceName: record["insurance_name"], id: record.id, isUse: record.is_use, - paymentScope: record.payment_scope.split(",").map(item => paymentScopeEnum[item]), + paymentScope: record.payment_scope + .split(",") + .map(item => paymentScopeEnum[item]), welfareType: welfareTypeEnum[record.welfare_type] - }) + }); } - // 页面跳转 - handlePageChange(value) { - const { programmeStore: {form, getTableDatas, selectedKey} } = this.props; - this.pageInfo.current = value - getTableDatas(selectedKey, this.pageInfo) + // 页面跳转 + handlePageChange(value) { + const { programmeStore: { form, getTableDatas, selectedKey } } = this.props; + this.pageInfo.current = value; + getTableDatas(selectedKey, this.pageInfo); } render() { const { programmeStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = programmeStore; - const { selectedKey, setSelectedKey, getCustomCategoryList, customTableStore, - customSelectkey, setCustomSelectkey, requestParams, setRequestParams, formCondition, - setCustomNewVisible, customNewVisible, tableDataSource, tableColumns, tablePageInfo } = programmeStore; - if (!hasRight && !loading) { // 无权限处理 + const { + loading, + hasRight, + form, + condition, + tableStore, + showSearchAd, + getTableDatas, + doSearch, + setShowSearchAd + } = programmeStore; + const { + selectedKey, + setSelectedKey, + getCustomCategoryList, + customTableStore, + customSelectkey, + setCustomSelectkey, + requestParams, + setRequestParams, + formCondition, + setCustomNewVisible, + customNewVisible, + tableDataSource, + tableColumns, + tablePageInfo + } = programmeStore; + if (!hasRight && !loading) { + // 无权限处理 return renderNoright(); } - const rightMenu = [// 右键菜单 + const rightMenu = [ + // 右键菜单 ]; - const collectParams = { // 收藏功能配置 - favname: '社保福利方案', + const collectParams = { + // 收藏功能配置 + favname: "社保福利方案", favouritetype: 1, objid: 0, - link: 'wui/index.html#/ns_demo03/index', - importantlevel: 1, + link: "wui/index.html#/ns_demo03/index", + importantlevel: 1 }; - const adBtn = [ // 高级搜索内部按钮 - , - , - , + const adBtn = [ + // 高级搜索内部按钮 + , + , + ]; const topTab = [ @@ -237,51 +333,66 @@ export default class Programme extends React.Component { } ]; - const options = [ + const options = [ { showname: "全部", key: "" }, { showname: "社保", - key: "SOCIAL_SECURITY" + key: "SOCIAL_SECURITY" }, { showname: "公积金", - key: "ACCUMULATION_FUND" + key: "ACCUMULATION_FUND" }, { showname: "企业年金及其他福利", key: "OTHER" } - ] + ]; const handleNewClick = () => { - const { programmeStore: {initSlideParms, getForm, selectedKey}} = this.props; + const { + programmeStore: { initSlideParms, getForm, selectedKey } + } = this.props; initSlideParms(); - this.setState({ slideVisiable: true, currentOperate: "add" }) - getForm({welfareTypeEnum: selectedKey}) - } + this.setState({ slideVisiable: true, currentOperate: "add" }); + getForm({ welfareTypeEnum: selectedKey }); + }; const handleCustomNewClick = () => { - const { programmeStore : { getCustomForm, getCumCustomForm, setCustomNewVisible, setCustomRequest }} = this.props; - getCustomForm() - setCustomRequest({}) - setCustomNewVisible(true) - this.setState({customEdit: false}) - - } + const { + programmeStore: { + getCustomForm, + getCumCustomForm, + setCustomNewVisible, + setCustomRequest + } + } = this.props; + getCustomForm(); + setCustomRequest({}); + setCustomNewVisible(true); + this.setState({ customEdit: false }); + }; // const renderSearchOperationItem = () => { // const { programmeStore: {setCustomSelectkey, getCustomCategoryList}} = this.props; - // return + // return // } const handleOnSave = () => { - const { programmeStore } = this.props - const { currentOperate } = this.state - const { selectedKey, defaultPersonDataSource, defaultCompanyDataSource, createScheme, requestParams, updateScheme } = programmeStore - let { schemeName, remarks, paymentArea, paymentType } = requestParams + const { programmeStore } = this.props; + const { currentOperate } = this.state; + const { + selectedKey, + defaultPersonDataSource, + defaultCompanyDataSource, + createScheme, + requestParams, + updateScheme + } = programmeStore; + let { schemeName, remarks, paymentArea, paymentType } = requestParams; let request = { insuranceScheme: { paymentType, @@ -290,174 +401,195 @@ export default class Programme extends React.Component { remarks, paymentArea }, - insuranceSchemeDetailList: [...defaultPersonDataSource, ...defaultCompanyDataSource] + insuranceSchemeDetailList: [ + ...defaultPersonDataSource, + ...defaultCompanyDataSource + ] + }; + + if (currentOperate == "add") { + createScheme(request); + } else if (currentOperate == "update") { + request.insuranceScheme.id = requestParams.id; + updateScheme(request); } - - if(currentOperate == "add") { - createScheme(request) - } else if(currentOperate == "update"){ - request.insuranceScheme.id = requestParams.id - updateScheme(request) - } - this.setState({slideVisiable: false}) - } + this.setState({ slideVisiable: false }); + }; const renderCustomRightContent = () => { let tipList = [ "1、可以为社保、公积金、企业年金及其他福利新增自定义的福利项,如:残疾保险等", "2、新增自定义福利默认启用,社保福利方案中的自定义福利项均未开启缴纳,当前页面的自定义福利项才可以停用;停用后再新增方案时没有该福利项", "3、自定义福利若要缴纳,需要在方案里填写缴纳相关数据" - ] - return () - } + ]; + return ; + }; const handleCopyModalSave = () => { - const { programmeStore: {copyScheme}} = this.props; + const { programmeStore: { copyScheme } } = this.props; const { copyId, copyModalValue } = this.state; - copyScheme({id:copyId, schemeName: copyModalValue}) - this.setState({copyModalVisible : false}) - } + copyScheme({ id: copyId, schemeName: copyModalValue }); + this.setState({ copyModalVisible: false }); + }; const handleSlideClose = () => { - this.setState({ slideVisiable: false }) - const { programmeStore: {initSlideParms} } = this.props; - initSlideParms() - } + this.setState({ slideVisiable: false }); + const { programmeStore: { initSlideParms } } = this.props; + initSlideParms(); + }; return (
+ collectParams={collectParams}> + {/* 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 */} } // 左侧图标 - iconBgcolor='#F14A2D' // 左侧图标背景色 + icon={} // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) - dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 - > - + {/* 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 */} + - - - { - selectedKey == "custom" && { + if (selectedKey == "custom") { + handleCustomNewClick(); + } else { + handleNewClick(); + } + }}> + 新建 + + + {selectedKey == "custom" && + { - setCustomSelectkey(v) - getCustomCategoryList(v) - console.log("v:", v) + style={{ width: "150px" }} + onChange={v => { + setCustomSelectkey(v); + getCustomCategoryList(v); + console.log("v:", v); }} - /> - } + />}
} - onChange={(v) => { - setSelectedKey(v) - if(v == "custom") { // 自定义福利 - getCustomCategoryList() + onChange={v => { + setSelectedKey(v); + if (v == "custom") { + // 自定义福利 + getCustomCategoryList(); } else { - getTableDatas(v) + getTableDatas(v); } }} /> - { - selectedKey == "custom" ? - - } - rightContent={ - renderCustomRightContent() - } - /> : - - - { - this.handlePageChange(value) - }} - onShowSizeChange={(current,pageSize) => { - this.pageInfo = {current, pageSize} - const { programmeStore: {form, getTableDatas, selectedKey} } = this.props; - getTableDatas(selectedKey, this.pageInfo) - }} - /> - - } + {selectedKey == "custom" + ? + } + rightContent={renderCustomRightContent()} + /> + : { + this.handlePageChange(value); + }} + onShowSizeChange={(current, pageSize) => { + this.pageInfo = { current, pageSize }; + const { + programmeStore: { form, getTableDatas, selectedKey } + } = this.props; + getTableDatas(selectedKey, this.pageInfo); + }} + />} - { - this.state.slideVisiable && { - handleOnSave(); - }} - /> - } - content={( { - console.log("requestParams:", requestParams); - setRequestParams(requestParams) - }}/>)} - onClose={() => {handleSlideClose()}} - showMask={true} - closeMaskOnClick={() => {handleSlideClose()}} - onAnimationEnd={() => console.log('onAnimationEnd')} /> - } - - { - this.state.copyModalVisible && this.setState({copyModalValue: value})} - onCancel={() => {this.setState({copyModalVisible: false})}} - footer={ + {this.state.slideVisiable && + { + handleOnSave(); + }} + /> } - /> - } + content={ + { + setRequestParams(requestParams); + }} + /> + } + onClose={() => { + handleSlideClose(); + }} + showMask={true} + closeMaskOnClick={() => { + handleSlideClose(); + }} + onAnimationEnd={() => console.log("onAnimationEnd")} + />} - { - customNewVisible && {setCustomNewVisible(false)}} - /> - } + {this.state.copyModalVisible && + this.setState({ copyModalValue: value })} + onCancel={() => { + this.setState({ copyModalVisible: false }); + }} + footer={ + + } + />} + + {customNewVisible && + { + setCustomNewVisible(false); + }} + />}
- ) + ); } } diff --git a/pc4mobx/hrmSalary/stores/ledger.js b/pc4mobx/hrmSalary/stores/ledger.js index eb05162d..38276392 100644 --- a/pc4mobx/hrmSalary/stores/ledger.js +++ b/pc4mobx/hrmSalary/stores/ledger.js @@ -19,12 +19,13 @@ export class LedgerStore { @observable includeType = 1; // 0:排除、1:包含 @observable userTableStore = {}; @observable addUserModalVisible = false; - @observable itemGroups = [ + @observable + itemGroups = [ { id: "default", name: "未分类", - items: [], - }, + items: [] + } ]; @observable salaryItemTableStore = new TableStore(); @observable empBrowserList = []; @@ -54,8 +55,8 @@ export class LedgerStore { { id: "default", name: "未分类", - items: [], - }, + items: [] + } ]; this.empBrowserList = []; this.empFields = []; @@ -70,66 +71,61 @@ export class LedgerStore { @observable pageObj = {}; //列表数据 @observable dataSource = []; //列表数据 - @action - setColumns = (columns) => (this.columns = columns); + @action setColumns = columns => (this.columns = columns); - @action - setPageObj = (pageObj) => (this.pageObj = pageObj); + @action setPageObj = pageObj => (this.pageObj = pageObj); - @action - setDataSource = (dataSource) => (this.dataSource = dataSource); + @action setDataSource = dataSource => (this.dataSource = dataSource); // 设置员工字段 - @action - setEmpFields = (empFields) => (this.empFields = empFields); + @action setEmpFields = empFields => (this.empFields = empFields); @action - setUserSelectedList = (userSelectedList) => + setUserSelectedList = userSelectedList => (this.userSelectedList = userSelectedList); @action - setBaseInfoRequest = (baseInfoRequest) => + setBaseInfoRequest = baseInfoRequest => (this.baseInfoRequest = baseInfoRequest); @action - setSobItemRuleDataSource = (sobItemRuleDataSource) => + setSobItemRuleDataSource = sobItemRuleDataSource => (this.sobItemRuleDataSource = sobItemRuleDataSource); @action - setAddCategoryVisible = (addCategoryVisible) => + setAddCategoryVisible = addCategoryVisible => (this.addCategoryVisible = addCategoryVisible); - @action - setExcludeIds = (excludeIds) => (this.excludeIds = excludeIds); + @action setExcludeIds = excludeIds => (this.excludeIds = excludeIds); @action - addExcludeIds = (id) => { + addExcludeIds = id => { let excludeIds = [...this.excludeIds]; excludeIds.push(id); this.excludeIds = excludeIds; }; @action - addEmpFields = (fieldId) => { + addEmpFields = fieldId => { let sortedIndex = 1; if (this.empFields.length > 0) { - let lastSortedIndex = - this.empFields[this.empFields.length - 1].sortedIndex; + let lastSortedIndex = this.empFields[this.empFields.length - 1] + .sortedIndex; sortedIndex = parseInt(lastSortedIndex) + 1; } let item = { fieldId, sortedIndex, - canDelete: true, + canDelete: true }; let result = [...this.empFields]; result.push(item); this.empFields = result; - this.userSelectedList = this.empFields.map((item) => { + this.userSelectedList = this.empFields.map(item => { item = { ...item }; item.key = item.fieldId; if (!item.showname || item.showname == "") { - this.empBrowserList.map((bitem) => { + this.empBrowserList.map(bitem => { if (bitem.key == item.fieldId) { item.showname = bitem.showname; } @@ -140,25 +136,29 @@ export class LedgerStore { }; @action - setItemGroups = (itemGroups) => { - itemGroups = itemGroups ? [...itemGroups] : [] - itemGroups && itemGroups.map(item => { - if(item.items) { - item.items && item.items.map(i => {i.key = i.id}) - } - }) - this.itemGroups = itemGroups + setItemGroups = itemGroups => { + itemGroups = itemGroups ? [...itemGroups] : []; + itemGroups && + itemGroups.map(item => { + if (item.items) { + item.items && + item.items.map(i => { + i.key = i.id; + }); + } + }); + this.itemGroups = itemGroups; }; @action - addItemGroup = (name) => { + addItemGroup = name => { if (!name || name == "" || name.trim() == "") { message.warning("分类名称不能为空"); return; } let itemGroups = [...this.itemGroups]; let flag = false; - itemGroups.map((item) => { + itemGroups.map(item => { if (item.name == name) { flag = true; } @@ -176,7 +176,7 @@ export class LedgerStore { @action addItemsToGroup = (title, list) => { let itemGroups = [...this.itemGroups]; - itemGroups.map((item) => { + itemGroups.map(item => { if (item.name == title) { item.items = item.items ? item.items.concat(list) : list; } @@ -186,32 +186,29 @@ export class LedgerStore { }; @action - addCategoryList = (item) => { + addCategoryList = item => { let list = [...this.categoryList]; list.push(item); this.categoryList = list; }; @action - removeCategoryList = (item) => { + removeCategoryList = item => { let list = [...this.categoryList]; - list.filter((i) => item.name != i.name); + list.filter(i => item.name != i.name); this.categoryList = list; }; @action - setAddUserModalVisible = (addUserModalVisible) => + setAddUserModalVisible = addUserModalVisible => (this.addUserModalVisible = addUserModalVisible); @action - setUserTableStore = (userTableStore) => - (this.userTableStore = userTableStore); + setUserTableStore = userTableStore => (this.userTableStore = userTableStore); - @action - setIncludeType = (includeType) => (this.includeType = includeType); + @action setIncludeType = includeType => (this.includeType = includeType); - @action - setSalarySobId = (salarySobId) => (this.salarySobId = salarySobId); + @action setSalarySobId = salarySobId => (this.salarySobId = salarySobId); // 初始化操作 @action @@ -222,13 +219,13 @@ export class LedgerStore { this.setBaseInfoRequest({ name: "", taxableItems: "1", - salaryCycleType: "1", + salaryCycleType: "3", salaryCycleFromDay: "1", - taxCycleType: "1", - attendCycleType: "1", + taxCycleType: "3", + attendCycleType: "3", attendCycleFromDay: "1", - socialSecurityCycleType: "1", - description: "", + socialSecurityCycleType: "3", + description: "" }); }; @@ -237,13 +234,13 @@ export class LedgerStore { this.setBaseInfoRequest({ name: "", taxableItems: "1", - salaryCycleType: "1", + salaryCycleType: "3", salaryCycleFromDay: "1", - taxCycleType: "1", - attendCycleType: "1", + taxCycleType: "3", + attendCycleType: "3", attendCycleFromDay: "1", - socialSecurityCycleType: "1", - description: "", + socialSecurityCycleType: "3", + description: "" }); }; @@ -251,7 +248,7 @@ export class LedgerStore { @action getCondition = () => { API.getCondition().then( - action((res) => { + action(res => { if (res.api_status) { // 接口请求成功/失败处理 this.condition = res.condition; @@ -265,7 +262,7 @@ export class LedgerStore { // 渲染table数据 @action - getTableDatas = (params) => { + getTableDatas = params => { this.loading = true; API.getLedgerList(params).then( action(({ status, data, errormsg }) => { @@ -278,13 +275,13 @@ export class LedgerStore { this.setPageObj({ total, current, - pageSize, + pageSize }); } else { this.setDataSource([]); this.setPageObj({ ...this.pageObj, - total: 0, + total: 0 }); message.error(errormsg || "接口调用失败!"); } @@ -292,19 +289,20 @@ export class LedgerStore { ); }; - @action - setShowSearchAd = (bool) => (this.showSearchAd = bool); + @action setShowSearchAd = bool => (this.showSearchAd = bool); // 高级搜索 - 搜索 - @action doSearch = () => { + @action + doSearch = () => { this.getTableDatas(); this.showSearchAd = false; }; // 复制 - @action doCopy = (id, name) => { + @action + doCopy = (id, name) => { return new Promise((resolve, reject) => { - API.duplicateLedger({ id, name }).then((res) => { + API.duplicateLedger({ id, name }).then(res => { if (res.status) { message.success("复制成功"); this.getTableDatas({}); @@ -320,7 +318,7 @@ export class LedgerStore { //启用/禁用薪资帐套 @action changeLedgerStatus = (id, disable) => { - API.changeLedgerStatus({ id, disable }).then((res) => { + API.changeLedgerStatus({ id, disable }).then(res => { if (res.status) { this.getTableDatas({}); message.success("修改成功"); @@ -376,12 +374,12 @@ export class LedgerStore { //保存薪资帐套基本信息 @action - saveLedgerBasic = (params) => { + saveLedgerBasic = params => { if (!this.validateBaseFrom(params)) { return; } return new Promise((resolve, reject) => { - API.saveLedgerBasic(params).then((res) => { + API.saveLedgerBasic(params).then(res => { if (res.status) { this.salarySobId = res.data; resolve(); @@ -397,8 +395,8 @@ export class LedgerStore { //删除薪资帐套 @action - deleteLedger = (params) => { - API.deleteLedger(params).then((res) => { + deleteLedger = params => { + API.deleteLedger(params).then(res => { if (res.status) { message.success("删除成功"); this.getTableDatas({}); @@ -428,11 +426,11 @@ export class LedgerStore { //保存薪资帐套人员范围 @action - saveLedgerPersonRange = (params) => { + saveLedgerPersonRange = params => { if (!this.validateLedgerPersonRange(params)) { return; } - API.saveLedgerPersonRange(params).then((res) => { + API.saveLedgerPersonRange(params).then(res => { if (res.status) { if (this.includeType == 1) { this.getLedgerPersonRangeInclude({ salarySobId: this.salarySobId }); @@ -448,8 +446,8 @@ export class LedgerStore { }; //薪资帐套人员范围(包含)列表 - getLedgerPersonRangeInclude = (params) => { - API.getLedgerPersonRangeInclude(params).then((res) => { + getLedgerPersonRangeInclude = params => { + API.getLedgerPersonRangeInclude(params).then(res => { if (res.status) { this.setUserTableStore(res.data); } else { @@ -459,8 +457,8 @@ export class LedgerStore { }; //薪资帐套人员范围(排除)列表 - getLedgerPersonRangeExclude = (params) => { - API.getLedgerPersonRangeExclude(params).then((res) => { + getLedgerPersonRangeExclude = params => { + API.getLedgerPersonRangeExclude(params).then(res => { if (res.status) { this.setUserTableStore(res.data); } else { @@ -470,8 +468,8 @@ export class LedgerStore { }; //删除薪资帐套人员范围 - deleteLedgerPersonRange = (params) => { - API.deleteLedgerPersonRange(params).then((res) => { + deleteLedgerPersonRange = params => { + API.deleteLedgerPersonRange(params).then(res => { if (res.status) { if (this.includeType == 1) { this.getLedgerPersonRangeInclude({ salarySobId: this.salarySobId }); @@ -489,41 +487,41 @@ export class LedgerStore { @action listSalaryItem = (searchValue = "", current = 1) => { let excludeIds = []; - this.itemGroups && this.itemGroups.map((item) => { - item.items && item.items.map((i) => { - excludeIds.push(i.salaryItemId); + this.itemGroups && + this.itemGroups.map(item => { + item.items && + item.items.map(i => { + excludeIds.push(i.salaryItemId); + }); }); - }); this.loading = true; - API.listSalaryItem({ name: searchValue, excludeIds, current }).then( - (res) => { - if (res.status) { - if (res.data.list) { - this.addSalaryItemDataSource = res.data.list.map((item) => { - item = { ...item }; - item.key = item.id; - return item; - }); - } else { - this.addSalaryItemDataSource = []; - } - - this.addSalaryItemColumns = res.data.columns; - this.addSalaryItemPageInfo = res.data; - // this.salaryItemTableStore.getDatas(res.data.datas); + API.listSalaryItem({ name: searchValue, excludeIds, current }).then(res => { + if (res.status) { + if (res.data.list) { + this.addSalaryItemDataSource = res.data.list.map(item => { + item = { ...item }; + item.key = item.id; + return item; + }); } else { - message.error(res.errormsg || "获取数据失败"); + this.addSalaryItemDataSource = []; } - this.loading = false; + + this.addSalaryItemColumns = res.data.columns; + this.addSalaryItemPageInfo = res.data; + // this.salaryItemTableStore.getDatas(res.data.datas); + } else { + message.error(res.errormsg || "获取数据失败"); } - ); + this.loading = false; + }); }; @action empFieldList = () => { - API.empFieldList().then((res) => { + API.empFieldList().then(res => { if (res.status) { - this.empBrowserList = res.data.map((item) => { + this.empBrowserList = res.data.map(item => { return { showname: item.name, key: item.id, selected: false }; }); } else { @@ -536,27 +534,27 @@ export class LedgerStore { saveLedgerItem = () => { let itemGroups = [...this.itemGroups]; itemGroups = itemGroups - .map((item) => { + .map(item => { let result = { ...item }; if (result.items) { result.items = result.items.map((i, index) => ({ salaryItemId: i.salaryItemId, sortedIndex: index + 1, - formulaId: i.formulaId, + formulaId: i.formulaId })); return result; } }) - .filter((item) => item); + .filter(item => item); let params = { salarySobId: this.salarySobId, empFields: this.empFields, - itemGroups: itemGroups.filter((item) => item.id != "default"), - items: itemGroups.filter((item) => item.id == "default")[0].items, + itemGroups: itemGroups.filter(item => item.id != "default"), + items: itemGroups.filter(item => item.id == "default")[0].items }; return new Promise((resolve, reject) => { - API.saveLedgerItem(params).then((res) => { + API.saveLedgerItem(params).then(res => { if (res.status) { resolve(); message.success("保存成功"); @@ -574,17 +572,17 @@ export class LedgerStore { let params = { salarySobId: this.salarySobId, excludeSalaryItemIds: this.sobItemRuleDataSource.map( - (item) => item.salaryItemId - ), + item => item.salaryItemId + ) }; return new Promise((resolve, reject) => { - API.listSalarySobItem(params).then((res) => { + API.listSalarySobItem(params).then(res => { if (res.status) { - this.ruleOptionList = res.data.map((item) => { + this.ruleOptionList = res.data.map(item => { return { key: item.salaryItemId.toString(), showname: item.salaryItemName, - selected: false, + selected: false }; }); resolve(); @@ -601,10 +599,10 @@ export class LedgerStore { saveAdjustmentRule = () => { let params = { salarySobId: this.salarySobId, - ruleParams: this.sobItemRuleDataSource, + ruleParams: this.sobItemRuleDataSource }; return new Promise((resolve, reject) => { - API.saveAdjustmentRule(params).then((res) => { + API.saveAdjustmentRule(params).then(res => { if (res.status) { resolve(); message.success("保存成功"); @@ -619,9 +617,9 @@ export class LedgerStore { @action listAdjustmentRule = () => { let params = { - salarySobId: this.salarySobId, + salarySobId: this.salarySobId }; - API.listAdjustmentRule(params).then((res) => { + API.listAdjustmentRule(params).then(res => { if (res.status) { this.sobItemRuleDataSource = res.data; } @@ -630,9 +628,9 @@ export class LedgerStore { // 保存薪资帐套校验规则 @action - saveLedgerRule = (params) => { + saveLedgerRule = params => { params.salarySobId = this.salarySobId; - API.saveLedgerRule(params).then((res) => { + API.saveLedgerRule(params).then(res => { if (res.status) { this.getLedgerRuleList(); message.success("保存成功"); @@ -647,9 +645,9 @@ export class LedgerStore { getLedgerRuleList = (name = "") => { let params = { salarySobId: this.salarySobId, - name, + name }; - API.getLedgerRuleList(params).then((res) => { + API.getLedgerRuleList(params).then(res => { if (res.status) { this.ledgerRuleList = res.data; } else { @@ -660,8 +658,8 @@ export class LedgerStore { //删除薪资帐套校验规则 @action - deleteLedgerRule = (ids) => { - API.deleteLedgerRule(ids).then((res) => { + deleteLedgerRule = ids => { + API.deleteLedgerRule(ids).then(res => { if (res.status) { message.success("删除成功"); this.getLedgerRuleList(); @@ -674,11 +672,11 @@ export class LedgerStore { // 获取基本信息 @action getLedgerBasicForm = () => { - API.getLedgerBasicForm(this.salarySobId).then((res) => { + API.getLedgerBasicForm({ id: this.salarySobId }).then(res => { if (res.status) { let basicForm = res.data.basicForm; - Object.keys(basicForm).map((key) => { - if (basicForm[key]) { + Object.keys(basicForm).map(key => { + if (basicForm[key] || typeof basicForm[key] === "boolean") { basicForm[key] = basicForm[key].toString(); } }); @@ -692,33 +690,32 @@ export class LedgerStore { //薪资帐套薪资项目详情 @action getLedgerItemForm = () => { - API.getLedgerItemForm({ salarySobId: this.salarySobId }).then((res) => { + API.getLedgerItemForm({ salarySobId: this.salarySobId }).then(res => { if (res.status) { this.empFields = res.data.empFields; let itemGroups = res.data.itemGroups; let defaultItems = { id: "default", name: "未分类", - items: res.data.items, + items: res.data.items }; - itemGroups.unshift(defaultItems); - this.setItemGroups(itemGroups) - API.empFieldList().then((ires) => { + itemGroups.push(defaultItems); + this.setItemGroups(itemGroups); + API.empFieldList().then(ires => { if (res.status) { - this.empBrowserList = ires.data.map((item) => { + this.empBrowserList = ires.data.map(item => { return { showname: item.name, key: item.id, selected: false }; }); - this.userSelectedList = this.empFields.map((item) => { + this.userSelectedList = this.empFields.map(item => { item = { ...item }; item.key = item.fieldId; - this.empBrowserList.map((bitem) => { + this.empBrowserList.map(bitem => { if (bitem.key == item.fieldId) { item.showname = bitem.showname; } }); return item; }); - console.log("this.userSelectedList: ", toJS(this.userSelectedList)); } else { message.error(res.errormsg || "获取失败"); } diff --git a/pc4mobx/hrmSalary/stores/programme.js b/pc4mobx/hrmSalary/stores/programme.js index 11754e24..eac6325e 100644 --- a/pc4mobx/hrmSalary/stores/programme.js +++ b/pc4mobx/hrmSalary/stores/programme.js @@ -138,6 +138,11 @@ export class ProgrammeStore { 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: it.validNum ? it.validNum : "2" + })) this.defaultPersonDataSource = resultList.filter(item => item.paymentScope == "个人") this.defaultCompanyDataSource = resultList.filter(item => item.paymentScope == "公司") let defaultRequest = { diff --git a/pc4mobx/hrmSalary/stores/salaryItem.js b/pc4mobx/hrmSalary/stores/salaryItem.js index 4fa2e24f..7370f582 100644 --- a/pc4mobx/hrmSalary/stores/salaryItem.js +++ b/pc4mobx/hrmSalary/stores/salaryItem.js @@ -149,7 +149,7 @@ export class SalaryItemStore { //薪资项目-薪资项目详情 @action getItemForm = (id) => { - API.getItemForm(id).then(res => { + API.getItemForm({id}).then(res => { if(res.status) { let data = res.data; Object.keys(data).map(key => { From bbb41897005b77604a9bfe9a291d8091b4020528 Mon Sep 17 00:00:00 2001 From: liyongshun <971387674@qq.com> Date: Fri, 17 Jun 2022 17:12:21 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=96=AA=E8=B5=84=E8=B4=A6=E5=A5=97?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E6=B7=BB=E5=8A=A0=E4=B8=AA=E7=A8=8E=E6=89=A3?= =?UTF-8?q?=E7=BC=B4=E4=B9=89=E5=8A=A1=E4=BA=BA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/pages/ledger/copyFormModal.js | 89 +++++++++++++------ pc4mobx/hrmSalary/pages/ledger/index.js | 5 +- pc4mobx/hrmSalary/stores/ledger.js | 4 +- 3 files changed, 66 insertions(+), 32 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/ledger/copyFormModal.js b/pc4mobx/hrmSalary/pages/ledger/copyFormModal.js index c74667e7..231feb79 100644 --- a/pc4mobx/hrmSalary/pages/ledger/copyFormModal.js +++ b/pc4mobx/hrmSalary/pages/ledger/copyFormModal.js @@ -1,30 +1,63 @@ -import React from 'react' -import { Modal, Button, Row, Col } from 'antd' -import { WeaInput } from 'ecCom' +import React from "react"; +import { Modal, Button, Row, Col } from "antd"; +import { WeaInput, WeaSelect } from "ecCom"; export default class CopyFormModal extends React.Component { - constructor(props) { - super(props) - this.state = { - name: "" - } - } - render() { - return ( - this.props.onCancel()} - footer={} - > - -
账套名称 - - {this.setState({name: value})}} /> - - - - ) - } -} \ No newline at end of file + constructor(props) { + super(props); + this.state = { + name: "", + taxAgentId: "" + }; + } + render() { + const { taxAgentStore } = this.props; + const { taxAgentOption } = taxAgentStore; + return ( + this.props.onCancel()} + footer={ + + }> + + 账套名称 + + { + this.setState({ name: value }); + }} + /> + + + + 个税扣缴义务人 + + { + this.setState({ taxAgentId: value }); + }} + /> + + + + ); + } +} diff --git a/pc4mobx/hrmSalary/pages/ledger/index.js b/pc4mobx/hrmSalary/pages/ledger/index.js index 44d5dd88..8d3e464f 100644 --- a/pc4mobx/hrmSalary/pages/ledger/index.js +++ b/pc4mobx/hrmSalary/pages/ledger/index.js @@ -200,7 +200,7 @@ export default class Ledger extends React.Component { const { ledgerStore: { doCopy }, } = this.props; - doCopy(this.state.currentReocrd.id, value).then(() => { + doCopy({id:this.state.currentReocrd.id, ...value}).then(() => { this.setState({ copyFormVisible: false }); }); }; @@ -214,7 +214,7 @@ export default class Ledger extends React.Component { }; render() { - const { ledgerStore } = this.props; + const { ledgerStore, taxAgentStore } = this.props; const { loading, dataSource, @@ -608,6 +608,7 @@ export default class Ledger extends React.Component { {this.state.copyFormVisible && ( this.handleCopySave(value)} onCancel={() => { diff --git a/pc4mobx/hrmSalary/stores/ledger.js b/pc4mobx/hrmSalary/stores/ledger.js index 38276392..cf9a0d38 100644 --- a/pc4mobx/hrmSalary/stores/ledger.js +++ b/pc4mobx/hrmSalary/stores/ledger.js @@ -300,9 +300,9 @@ export class LedgerStore { // 复制 @action - doCopy = (id, name) => { + doCopy = params => { return new Promise((resolve, reject) => { - API.duplicateLedger({ id, name }).then(res => { + API.duplicateLedger({ ...params }).then(res => { if (res.status) { message.success("复制成功"); this.getTableDatas({});