From 8a90d58196cfdfcd335653d09510adba687ce4e5 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, 14 Sep 2023 10:25:22 +0800 Subject: [PATCH 01/25] =?UTF-8?q?feature/2.9.42309.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E6=A0=B8=E7=AE=97=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=94=B9=E9=80=A0=EF=BC=88=E9=A1=B5=E9=9D=A2=E7=BC=96?= =?UTF-8?q?=E8=BE=91=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../importDialog/components/impStep1.js | 87 +++++++++ .../importDialog/components/impStep2.js | 49 +++++ .../importDialog/components/impStep3.js | 51 +++++ .../components/importDialog/index.js | 153 +++++++++++++++ .../components/importDialog/index.less | 143 ++++++++++++++ pc4mobx/hrmSalary/index.js | 3 + .../components/advanceInputBtn/index.js | 19 ++ .../components/advanceInputBtn/index.less | 28 +++ .../salaryCalcPersonConfirm/baseInfo.js | 75 ++++++++ .../salaryCalcPersonConfirm/condition.js | 104 ++++++++++ .../salaryCalcPersonConfirm/index.js | 177 ++++++++++++++++++ .../salaryCalcPersonConfirm/index.less | 42 +++++ .../doCalc/components/salaryMonthTip/index.js | 42 +++++ .../components/salaryMonthTip/index.less | 11 ++ .../hrmSalary/pages/calculate/doCalc/index.js | 105 +++++++++++ .../pages/calculate/doCalc/index.less | 15 ++ .../pages/calculate/doCalc/layout.js | 46 +++++ pc4mobx/hrmSalary/stores/calculate.js | 3 + pc4mobx/hrmSalary/stores/taxAgent.js | 5 +- 19 files changed, 1155 insertions(+), 3 deletions(-) create mode 100644 pc4mobx/hrmSalary/components/importDialog/components/impStep1.js create mode 100644 pc4mobx/hrmSalary/components/importDialog/components/impStep2.js create mode 100644 pc4mobx/hrmSalary/components/importDialog/components/impStep3.js create mode 100644 pc4mobx/hrmSalary/components/importDialog/index.js create mode 100644 pc4mobx/hrmSalary/components/importDialog/index.less create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.less create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/baseInfo.js create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/condition.js create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryMonthTip/index.js create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryMonthTip/index.less create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/index.js create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/index.less create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/layout.js diff --git a/pc4mobx/hrmSalary/components/importDialog/components/impStep1.js b/pc4mobx/hrmSalary/components/importDialog/components/impStep1.js new file mode 100644 index 00000000..6ab09b3e --- /dev/null +++ b/pc4mobx/hrmSalary/components/importDialog/components/impStep1.js @@ -0,0 +1,87 @@ +/* + * Author: 黎永顺 + * name: 导入-步骤一 + * Description: + * Date: 2023/8/11 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { Icon, message, Upload } from "antd"; + +const Dragger = Upload.Dragger; +const { getLabel } = WeaLocaleProvider; + +class ImpStep1 extends Component { + constructor(props) { + super(props); + this.state = { + fileList: [] + }; + } + + handleChange = (data) => { + const { fileList, file } = data; + if (file.response && typeof (file.response) != "undefined" && file.status !== "removed") message.success(getLabel(111, "上传成功")); + this.setState({ fileList: fileList.slice(-1) }); + }; + + render() { + const { fileList } = this.state; + const dragger = { + accept: ".xlsx", + name: "file", + multiple: false, + action: "/api/doc/upload/uploadFile", + fileList, + onChange: this.handleChange + }; + return ( +
+ {/* 导入选项 */} + { + this.props.importParams && +
+
{getLabel(543201, "导入选项")}
+ {this.props.importParams} +
+ } +
{getLabel(543202, "导入Excel")}
+

+ +

+

+

{getLabel(543203, "点击或将文件拖拽到此区域上传")}

+

{getLabel(543204, "支持单个或批量上传,严禁上传公司内部资料及其他违禁文件")}

+
+ +

+ +
+
{getLabel(27577, "操作步骤")}
+

+ {`1. ${getLabel(30907, "第一步")},${getLabel(543205, "请选择导出的Excel文件或")}`}   + {getLabel(543207, "点击这里下载模板")}   + {this.props.exportDataDom} +

+

{`2. ${getLabel(543211, "第二步")},${getLabel(543212, "请一定要确定Excel文档中的格式是模板中的格式")},${getLabel(543213, "没有被修改掉")};`}

+

{`3. ${getLabel(543216, "第三步")},${getLabel(543215, "选择填写好的Excel文档")},${getLabel(543214, "点击“下一步”按钮进行数据预览")};`}

+

+ {`4. ${getLabel(543217, "第四步")},${getLabel(543218, "如果以上步骤和Excel文档正确的话")},${getLabel(543219, "导入成功会有提示")},${getLabel(543220, "数据会被正确导入")}。${getLabel(543221, "如果有问题")},${getLabel(543222, "则会提示Excel文档的错误之处")}。`} +

+
+ +
+
{getLabel(543223, "Excel文件说明")}
+

{`1. ${getLabel(543224, "后缀名为xls或者xlsx")};`}

+

{`2. ${getLabel(543225, "数据请勿放在合并的单元格中")};`}

+

{`3. ${getLabel(543226, "账单月份格式必须为")}:YYYY-MM;`}

+
+ +
+ ); + } +} + +export default ImpStep1; diff --git a/pc4mobx/hrmSalary/components/importDialog/components/impStep2.js b/pc4mobx/hrmSalary/components/importDialog/components/impStep2.js new file mode 100644 index 00000000..8a7373d4 --- /dev/null +++ b/pc4mobx/hrmSalary/components/importDialog/components/impStep2.js @@ -0,0 +1,49 @@ +/* + * Author: 黎永顺 + * name: 导入-步骤二 + * Description: + * Date: 2023/9/5 + */ +import React, { Component } from "react"; +import { WeaTable } from "ecCom"; +import { postFetch } from "../../../util/request"; + +class ImpStep2 extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, columns: [], dataSource: [] + }; + } + + componentDidMount() { + this.init(); + } + + init = () => { + const { previewUrl, imageId } = this.props; + const payload = { imageId }; + this.setState({ loading: true }); + postFetch(previewUrl, payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { headers, list } = data; + this.setState({ + columns: _.map(headers, (item, index) => ({ title: item, dataIndex: index + "", width: 120 })), + dataSource: _.map(list, item => { + return _.reduce(item, (pre, cur, key) => (_.assign(pre, { [key]: cur })), {}); + }) + }); + } + }).catch(() => this.setState({ loading: false })); + }; + + render() { + const { dataSource, columns, loading } = this.state; + return ( + + ); + } +} + +export default ImpStep2; diff --git a/pc4mobx/hrmSalary/components/importDialog/components/impStep3.js b/pc4mobx/hrmSalary/components/importDialog/components/impStep3.js new file mode 100644 index 00000000..481813b4 --- /dev/null +++ b/pc4mobx/hrmSalary/components/importDialog/components/impStep3.js @@ -0,0 +1,51 @@ +/* + * Author: 黎永顺 + * name: 导入-步骤3 + * Description: + * Date: 2023/8/11 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTable } from "ecCom"; +import successImg from "../../importModal/success.svg"; + +const getLabel = WeaLocaleProvider.getLabel; + +class ImpStep3 extends Component { + render() { + const { importResult } = this.props; + return ( +
+ { + !_.isEmpty(importResult) ? +
+

+

+ {getLabel(389249, "已导入")} + {importResult.successCount}   + {`${getLabel(30690, "条数据")},${getLabel(25009, "失败")}`} + {importResult.errorCount}  {getLabel(30690, "条数据")} +

+
: +
+

{getLabel(111, "导入失败")}

+
+ } + { + !_.isEmpty(importResult.errorData) && + + } +
+ ); + } +} + +export default ImpStep3; diff --git a/pc4mobx/hrmSalary/components/importDialog/index.js b/pc4mobx/hrmSalary/components/importDialog/index.js new file mode 100644 index 00000000..b7eafd97 --- /dev/null +++ b/pc4mobx/hrmSalary/components/importDialog/index.js @@ -0,0 +1,153 @@ +/* + * Author: 黎永顺 + * name: 导入弹框-步骤条 + * Description: + * Date: 2023/8/11 + */ +import React, { Component } from "react"; +import { Button, message, Modal } from "antd"; +import { WeaDialog, WeaLocaleProvider, WeaSteps } from "ecCom"; +import ImpStep1 from "./components/impStep1"; +import ImpStep2 from "./components/impStep2"; +import ImpStep3 from "./components/impStep3"; +import "./index.less"; + +const { getLabel } = WeaLocaleProvider; +const Step = WeaSteps.Step; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + current: 0 + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (JSON.stringify(nextProps.importResult) !== JSON.stringify(this.props.importResult) && !_.isEmpty(nextProps.importResult)) { + this.setState({ + current: this.state.current + 1 + }); + } + if (nextProps.visible !== this.props.visible && !nextProps.visible) this.setState({ current: 0 }); + } + + renderChildren = () => { + const { current } = this.state; + const { importParams, link, excludeKey, importResult, exportDataDom = null } = this.props; + let CurrentDom = null; + switch (current) { + case 0: + CurrentDom = this.step1Ref = dom}/>; + break; + case 1: + CurrentDom = ; + if (excludeKey) { + CurrentDom = ; + } + break; + case 2: + CurrentDom = ; + break; + default: + CurrentDom = null; + break; + } + return CurrentDom; + }; + /* + * Author: 黎永顺 + * Description: 上一步 + * Params: + * Date: 2023/9/5 + */ + handlePreviousStep = () => { + Modal.confirm({ + title: getLabel(131329, "信息确认"), + content: getLabel(111, "是否放弃已上传的文件?"), + onOk: () => this.setState({ current: this.state.current - 1 }, () => this.props.onResetImportResult()) + }); + }; + /* + * Author: 黎永顺 + * Description: 下一步 + * Params: + * Date: 2023/8/11 + */ + handleNext = () => { + const { params, importResult } = this.props; + if (_.isEmpty(importResult)) { + const { fileList } = this.step1Ref.state; + if (!_.isEmpty(params)) { + if (!Object.values(params).every(o => !!o)) { + Modal.warning({ + title: getLabel(131329, "信息确认"), + content: getLabel(518702, "必要信息不完整,红色*为必填项!") + }); + return; + } + } + if (_.isEmpty(fileList)) { + message.warning(getLabel(111, "请先上传EXCEL文件")); + return; + } + const [file] = fileList; + const { response } = file; + this.props.nextCallback(response.data.fileid); + } else { + this.setState({ current: this.state.current + 1 }); + } + }; + + render() { + const { current } = this.state; + const stepData = [ + { key: 0, label: getLabel(543202, "上传EXCEL") }, + { key: 1, label: getLabel(543200, "数据预览") }, + { key: 2, label: getLabel(502835, "导入数据") } + ]; + const btns = [ + , + , + + ]; + return ( + +
+
+ + {/*this.props.key: 不需要展示的步骤*/} + { + _.map(_.filter(stepData, item => item.key !== this.props.excludeKey), it => ( + )) + } + +
+
+ { + this.renderChildren() + } +
+
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/components/importDialog/index.less b/pc4mobx/hrmSalary/components/importDialog/index.less new file mode 100644 index 00000000..95cee40b --- /dev/null +++ b/pc4mobx/hrmSalary/components/importDialog/index.less @@ -0,0 +1,143 @@ +.importBox { + .importCont { + padding: 16px 8px; + + .weapp-batch-impsteps-picker-content-imp-steps { + width: 80%; + margin: 0 auto; + } + + .weapp-batch-impsteps-picker { + margin: 16px auto; + + .weapp-batch-impsteps-picker-content-imp-step1 { + width: 98%; + background-color: #fff; + margin: 8px auto; + border-radius: 3px; + padding: 1px 12px; + + .weapp-batch-impsteps-picker-content-imp-step1 div { + color: #111; + line-height: 22px; + } + + .weapp-salary-tb-border-bottom .weapp-salary-tb-filter.weapp-salary-import-param { + box-sizing: border-box; + padding: 16px; + height: auto; + flex-wrap: wrap; + width: 100%; + } + + .weapp-salary-import-param { + border: 1px solid #ebedf0; + padding: 8px; + margin: 4px 0 14px; + } + + .weapp-salary-tb-filter { + display: flex; + flex-wrap: wrap; + align-items: center; + height: 46px; + } + + .weapp-salary-tb-border-bottom .weapp-salary-tb-filter.weapp-salary-import-param .tbf-item { + display: flex; + justify-content: flex-start !important; + } + + .weapp-salary-tb-filter .tbf-item { + padding: 0 20px 0 0; + display: flex; + align-items: center; + font-size: 12px; + color: #111; + height: 40px; + } + + .weapp-salary-tb-filter .tbf-item > .tbfi-label { + flex-basis: 100px; + flex-shrink: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + padding-right: 10px; + color: #666; + } + + .draggerUploadWrapper { + margin: 16px 0 0; + + .ant-upload-drag-container { + padding: 24px 0 16px; + + .iconUpload { + i { + color: #5d9cec; + font-size: 43px; + } + } + + .uplaod-title { + font-size: 14px; + color: #333; + height: 24px; + line-height: 24px; + margin-top: 8px; + } + + .uplaod-subTitle { + height: 22px; + font-size: 12px; + color: #666; + text-align: center; + line-height: 22px; + } + } + } + + .bottom-border, .description { + margin-top: 12px; + + p { + font-size: 12px; + color: #666; + line-height: 15px; + margin: 12px 0; + } + } + + .bottom-border { + border-bottom: 1px solid #e5e5e5; + + .weapp-salary-link { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: #5d9cec; + } + } + + } + } + + .weapp-batch-impsteps-picker-content-imp-step3 { + .weapp-batch-impsteps-picker-spinText { + position: relative; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + text-align: center; + + p { + margin: 14px 0; + } + } + } + + } +} diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index bd2d3c12..7f0f110d 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -25,6 +25,7 @@ import TaxAgent from "./pages/taxAgent"; import CalculateDetail from "./pages/calculateDetail"; import PlaceOnFileDetail from "./pages/calculateDetail/placeOnFileDetail"; import CompareDetail from "./pages/calculateDetail/compareDetail"; +import DoCalcDetail from "./pages/calculate/doCalc"; import GenerateDeclarationDetail from "./pages/declare/generateDeclarationDetail"; import TemplatePreview from "./pages/payroll/templatePreview"; import MobilePayroll from "./pages/mobilePayroll"; @@ -73,6 +74,7 @@ const DataAcquisition = (props) => props.children; // ledger 薪资账套 // calculate 薪资核算 // calculateDetail 核算详情 +// DoCalcDetail 新核算详情页面 // placeOnFileDetail 核算归档详情 // compareDetail 线下线上对比 // payroll 工资单发放 @@ -130,6 +132,7 @@ const Routes = ( + diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js new file mode 100644 index 00000000..654756d7 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js @@ -0,0 +1,19 @@ +import React, { Component } from "react"; +import { WeaInputSearch, WeaLocaleProvider } from "ecCom"; +import { Button } from "antd"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + render() { + return ( +
+ + +
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.less b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.less new file mode 100644 index 00000000..1a3d7283 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.less @@ -0,0 +1,28 @@ +.advance-search { + display: flex; + align-items: center; + position: relative; + top: -2.5px; + + .wea-advanced-search { + top: 2px; + left: -1px; + height: 28px; + line-height: 1; + border-radius: 0; + position: relative; + color: #474747; + padding: 4px 15px; + } + + .wea-advanced-search:hover { + border: 1px solid #dadada; + color: #474747; + } + + .text-elli { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } +} diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/baseInfo.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/baseInfo.js new file mode 100644 index 00000000..c12b35e7 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/baseInfo.js @@ -0,0 +1,75 @@ +/* + * Author: 黎永顺 + * name: 人员信息确认-基础信息 + * Description: + * Date: 2023/9/13 + */ +import React, { Component } from "react"; +import { WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup } from "ecCom"; +import SalaryMonthTip from "../salaryMonthTip"; +import { getSalarySobCycle, salaryacctGetForm } from "../../../../../apis/calculate"; +import { Col, Row } from "antd"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +class BaseInfo extends Component { + constructor(props) { + super(props); + this.state = { + salaryInfo: {}, salarySobCycle: {} + }; + } + + componentDidMount() { + const promise = this.init(); + } + + init = async () => { + const { routeParams: { salaryAcctRecordId } } = this.props; + const [salaryInfo, salarySobCycle] = await Promise.all([salaryacctGetForm({ id: salaryAcctRecordId }), getSalarySobCycle({ salaryAcctRecordId })]); + if (salaryInfo.status && salarySobCycle.status) { + this.setState({ + salaryInfo: salaryInfo.data, salarySobCycle: salarySobCycle.data + }); + } + }; + + render() { + const { salaryInfo, salarySobCycle } = this.state; + const { formDTO } = salaryInfo || {}; + return ( + + + + + + {getLabel(542604, "薪资所属月")} + } + style={{ marginLeft: 10 }} + /> + + {formDTO && formDTO.salaryMonth} + + + + + {getLabel(519146, "核算账套")} + {formDTO && formDTO.salarySobName} + + + + + {getLabel(536726, "备注")} + {formDTO && formDTO.description} + + + + + ); + } +} + +export default BaseInfo; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/condition.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/condition.js new file mode 100644 index 00000000..a92c43df --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/condition.js @@ -0,0 +1,104 @@ +export const personConfirmSearchConditions = [ + { + items: [ + { + colSpan: 2, + conditionType: "INPUT", + domkey: ["employeeName"], + fieldcol: 12, + label: "姓名", + lanId: 25034, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + colSpan: 2, + conditionType: "INPUT", + domkey: ["workcode"], + fieldcol: 12, + label: "工号", + lanId: 1933, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + icon: "icon-coms-hrm", + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "", + type: "57", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["departmentIds"], + fieldcol: 12, + label: "部门", + lanId: 27511, + labelcol: 6, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + icon: "icon-coms-hrm", + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "", + type: "24", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["positionIds"], + fieldcol: 12, + label: "岗位", + lanId: 6086, + labelcol: 6, + viewAttr: 2 + }, + { + colSpan: 2, + conditionType: "SELECT", + domkey: ["statuses"], + fieldcol: 12, + multiple: true, + label: "状态", + lanId: 535101, + labelcol: 6, + options: [], + viewAttr: 2 + } + ], + defaultshow: true, + title: "常用条件" + } +]; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js new file mode 100644 index 00000000..944304a1 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js @@ -0,0 +1,177 @@ +/* + * Author: 黎永顺 + * name: 人员确认 + * Description: + * Date: 2023/9/13 + */ +import React, { Component } from "react"; +import { WeaButtonIcon, WeaHelpfulTip, WeaLocaleProvider, WeaTab, WeaTools } from "ecCom"; +import { inject, observer } from "mobx-react"; +import { Button } from "antd"; +import BaseInfo from "./baseInfo"; +import { acctemployeeList } from "../../../../../apis/calculate"; +import { personConfirmSearchConditions } from "./condition"; +import { getSearchs } from "../../../../../util"; + +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("calculateStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "range", showSearchAd: false, + searchConditions: [], loading: false, + pageInfo: { current: 1, pageSize: 10, total: 0 }, + selectedRowKeys: [] + }; + } + + componentDidMount() { + if ($) { + const domTabInnerList = $(".salary-calculate-do-calc-content .ant-tabs-tab-inner"); + domTabInnerList[0].setAttribute("title", ""); + domTabInnerList[1].setAttribute("title", ""); + domTabInnerList[2].setAttribute("title", ""); + } + this.setState({ + searchConditions: _.map(personConfirmSearchConditions, item => { + return { + ...item, + items: _.map(item.items, o => { + if (getKey(o) === "statuses") { + return { + ...o, + options: [ + { key: "0", showname: getLabel(18883, "试用") }, { key: "1", showname: getLabel(15711, "正式") }, + { key: "2", showname: getLabel(480, "临时") }, { key: "3", showname: getLabel(15844, "试用延期") }, + { key: "4", showname: getLabel(542707, "解雇") }, { key: "5", showname: getLabel(6091, "离职") }, + { key: "6", showname: getLabel(6092, "退休") } + ] + }; + } + return { ...o }; + }), + title: getLabel(32905, "常用条件") + }; + }) + }, () => { + const { calculateStore: { PCSearchForm } } = this.props; + PCSearchForm.initFormFields(this.state.searchConditions); + this.acctemployeeList(); + }); + } + + renderTabBtns = () => { + const { selectedKey } = this.state; + let tabBtns = []; + switch (selectedKey) { + case "range": + tabBtns = [ + , + , + + ]; + break; + case "add": + case "sub": + tabBtns = [ + + ]; + break; + default: + break; + } + return tabBtns; + }; + acctemployeeList = () => { + const { pageInfo } = this.state; + const { calculateStore: { PCSearchForm }, routeParams: { salaryAcctRecordId } } = this.props; + const { departmentIds, positionIds, statuses, ...extra } = PCSearchForm.getFormParams(); + const payload = { + salaryAcctRecordId, ...pageInfo, ...extra, + departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [], + positionIds: !_.isEmpty(positionIds) ? positionIds.split(",") : [], + statuses: !_.isEmpty(statuses) ? statuses.split(",") : [] + }; + acctemployeeList(payload).then(({ status, data }) => { + if (status) { + console.log(data); + } + }); + }; + + render() { + const { calculateStore: { PCSearchForm } } = this.props; + const { selectedKey, showSearchAd, searchConditions, pageInfo, loading, selectedRowKeys } = this.state; + const tabDatas = [ + { + title: + {getLabel(542307, "核算人员范围")} + + , viewcondition: "range" + }, + { + title: + {getLabel(542308, "环比上月减少人员")} + + , viewcondition: "sub" + }, + { + title: + {getLabel(542308, "环比上月增加人员")} + + , viewcondition: "add" + } + ]; + const pagination = { + ...pageInfo, + showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, + showQuickJumper: true, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + onShowSizeChange: (current, pageSize) => { + this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () => this.queryList()); + }, + onChange: current => { + this.setState({ pageInfo: { ...pageInfo, current } }, () => this.queryList()); + } + }; + const rowSelection = { + selectedRowKeys, + onChange: selectedRowKeys => this.setState({ selectedRowKeys }) + }; + return ( +
+ + this.setState({ selectedKey: v })} advanceHeight={220} + buttons={this.renderTabBtns()} searchType={["base", "advanced"]} + showSearchAd={showSearchAd} setShowSearchAd={bool => this.setState({ showSearchAd: bool })} + searchsAd={getSearchs(PCSearchForm, searchConditions, 2, false)} + onSearchChange={(v) => PCSearchForm.updateFields({ employeeName: v })} + searchsBaseValue={PCSearchForm.getFormParams().employeeName} + onSearch={this.acctemployeeList} onAdSearch={this.acctemployeeList} + onAdReset={() => PCSearchForm.resetForm()} + /> +
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less new file mode 100644 index 00000000..18bcbc29 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less @@ -0,0 +1,42 @@ +.person-confirm-layout { + .wea-tab .wea-tab-right, .wea-input-focus { + background: transparent; + } +} + +.docalc-baseinfo-layout { + padding: 0; + + .wea-title { + border-bottom: none; + } + + .wea-content.pt15 { + padding-top: 0; + } + + .docalc-baseinfo { + background: #fff; + border: 1px solid #e5e5e5; + border-right: none; + + .ant-col-24 { + border-top: 1px solid #e5e5e5; + } + + .label { + color: #666; + } + + .value { + color: #111; + } + + & > div { + border-right: 1px solid #e5e5e5; + line-height: 30px; + padding: 5px 16px; + + } + } +} diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryMonthTip/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryMonthTip/index.js new file mode 100644 index 00000000..a230b83e --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryMonthTip/index.js @@ -0,0 +1,42 @@ +/* + * Author: 黎永顺 + * name: 薪资所属月提示语 + * Description: + * Date: 2023/9/13 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + render() { + const { attendCycle, salaryCycle, salaryMonth, socialSecurityCycle } = this.props; + const { fromDate: attendFromDate, endDate: attendEndDate } = attendCycle, + { fromDate: salaryFromDate, endDate: salaryEndDate } = salaryCycle; + return ( +
+
+
{getLabel(543375, "薪资周期")}
+
{`${salaryFromDate}${getLabel(15322, "至")}${salaryEndDate}`}
+
+
+
{getLabel(542240, "税款所属期")}
+
{salaryMonth}
+
+
+
{getLabel(543475, "考勤取值周期")}
+
{`${attendFromDate}${getLabel(15322, "至")}${attendEndDate}`}
+
+
+
{getLabel(543466, "福利台账月份")}
+
{`${getLabel(19422, "引用")}${socialSecurityCycle}${getLabel(543476, "的福利台账数据")}`}
+
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryMonthTip/index.less b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryMonthTip/index.less new file mode 100644 index 00000000..436f6a0d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryMonthTip/index.less @@ -0,0 +1,11 @@ +.salary-month-tip { + .line { + .label { + color: #666; + } + + .value { + color: #111; + } + } +} diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js new file mode 100644 index 00000000..2508d0dc --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js @@ -0,0 +1,105 @@ +/* + * Author: 黎永顺 + * name: 薪资核算详情 + * Description: + * Date: 2023/9/13 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaReqTop } from "ecCom"; +import { Button, Dropdown, Menu } from "antd"; +import Layout from "./layout"; +import AdvanceInputBtn from "./components/advanceInputBtn"; +import SalaryCalcPersonConfirm from "./components/salaryCalcPersonConfirm"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "person" + }; + } + + componentDidMount() { + console.log(this.props); + } + + handleButtonClick = () => { + console.log("核算所有人"); + }; + handleMenuClick = ({ key }) => { + console.log(key); + }; + handleMoreMenuClick = ({ key }) => { + console.log(key); + }; + renderReqBtns = () => { + const { selectedKey } = this.state; + let reqBtns = []; + switch (selectedKey) { + case "calc": + const menu = ( + + {getLabel(543546, "核算所选人员")} + + ); + const moreMenu = ( + + {getLabel(32935, "导入")} + {getLabel(81272, "导出全部")} + {getLabel(544270, "自定义导出")} + {getLabel(543249, "线下对比")} + + ); + reqBtns = [ + + {getLabel(543545, "核算所有人")} + , + , + + ]; + break; + default: + break; + } + return reqBtns; + }; + renderContent = () => { + const { selectedKey } = this.state; + let dom = null; + switch (selectedKey) { + case "person": + dom = ; + break; + default: + break; + } + return dom; + }; + + render() { + const tabs = [ + { key: "person", title: getLabel(543547, "人员确认") }, + { key: "calc", title: getLabel(538011, "薪资核算") } + ]; + const { selectedKey } = this.state; + return ( + +
+ } iconBgcolor="#F14A2D" + onChange={key => this.setState({ selectedKey: key })} + buttons={this.renderReqBtns()} + > +
{this.renderContent()}
+
+
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.less b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.less new file mode 100644 index 00000000..d15f409a --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.less @@ -0,0 +1,15 @@ +.salary-calculate-do-calc { + min-width: 1000px; + overflow: auto; + width: 100%; + height: 100%; + background: #f6f6f6; + + .wea-new-top-req-wapper .wea-new-top-req-title > div:last-child { + right: 16px; + } + + .salary-calculate-do-calc-content { + padding: 8px 16px; + } +} diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/layout.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/layout.js new file mode 100644 index 00000000..9a802bfb --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/layout.js @@ -0,0 +1,46 @@ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import Authority from "../../mySalary/authority"; +import { salaryacctAcctresultCheckAuth } from "../../../apis/calculate"; + +@inject("taxAgentStore") +@observer +class Layout extends Component { + constructor(props) { + super(props); + this.state = { + store: { loading: false, hasRight: false } + }; + } + + componentDidMount() { + this.salaryacctAcctresultCheckAuth(); + } + + salaryacctAcctresultCheckAuth = () => { + const { taxAgentStore: { getPermission } } = this.props; + this.setState({ store: { ...this.state.store, loading: true } }); + getPermission().then(({ data }) => { + const { isOpenDevolution } = data; + if (isOpenDevolution) { + const { routeParams: { salaryAcctRecordId } } = this.props; + salaryacctAcctresultCheckAuth({ salaryAcctRecordId }).then(({ status, data }) => { + this.setState({ store: { ...this.state.store, loading: false, hasRight: status && data } }); + }); + } else { + this.setState({ store: { ...this.state.store, loading: false, hasRight: true } }); + } + }).catch(() => this.setState({ store: { ...this.state.store, loading: false } })); + }; + + render() { + return ( + + {this.props.children} + + ); + } +} + +export default Layout; diff --git a/pc4mobx/hrmSalary/stores/calculate.js b/pc4mobx/hrmSalary/stores/calculate.js index 5b270ddf..97102665 100644 --- a/pc4mobx/hrmSalary/stores/calculate.js +++ b/pc4mobx/hrmSalary/stores/calculate.js @@ -8,6 +8,9 @@ import { toDecimal_n } from "../util"; const { TableStore } = WeaTableNew; export class calculateStore { + @observable PCSearchForm = new WeaForm(); //人员确认-form + + @observable tableStore = new TableStore(); // new table @observable form = new WeaForm(); // nrew 一个form @observable condition = []; // 存储后台得到的form数据 diff --git a/pc4mobx/hrmSalary/stores/taxAgent.js b/pc4mobx/hrmSalary/stores/taxAgent.js index 2f555120..ef5cfe2d 100644 --- a/pc4mobx/hrmSalary/stores/taxAgent.js +++ b/pc4mobx/hrmSalary/stores/taxAgent.js @@ -4,7 +4,6 @@ import { WeaForm, WeaTableNew } from "comsMobx"; import * as API from "../apis/taxAgent"; // 引入API接口文件 import { decentralizationConditions, editConditions } from "../pages/taxAgent/editConditions"; -import { taxAgentRangeExtDelete } from "../apis/taxAgent"; const { TableStore } = WeaTableNew; @@ -149,12 +148,12 @@ export class TaxAgentStore { //薪酬统计报表权限 this.setStatisticsReportBtn(!isOpenDevolution ? true : !!(isAdminEnable || isChief)); //薪资核算详情页面查看权限 - this.setPayrollPermission(isAdminEnable && isOpenDevolution || !isOpenDevolution); + this.setPayrollPermission((isOpenDevolution && isAdminEnable) || !isOpenDevolution); resolve({ status, data }); } else { reject(); } - }); + }).catch(() => reject()); }); }; // 人员范围列表 From ef16acd6387d3c6c2e54950ed01dea0c0a85ae27 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, 14 Sep 2023 11:41:29 +0800 Subject: [PATCH 02/25] =?UTF-8?q?feature/2.9.42309.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E6=A0=B8=E7=AE=97=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=94=B9=E9=80=A0=EF=BC=88=E9=A1=B5=E9=9D=A2=E7=BC=96?= =?UTF-8?q?=E8=BE=91=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/calculate.js | 195 +----------------- .../salaryCalcPersonConfirm/index.js | 67 ++++-- .../salaryCalcPersonConfirm/index.less | 4 + 3 files changed, 68 insertions(+), 198 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/calculate.js b/pc4mobx/hrmSalary/apis/calculate.js index b14015a7..28067063 100644 --- a/pc4mobx/hrmSalary/apis/calculate.js +++ b/pc4mobx/hrmSalary/apis/calculate.js @@ -1,141 +1,5 @@ import { WeaTools } from "ecCom"; -//薪资核算-薪资核算列表 -export const getCalcList = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/list", "POST", params); -}; - - -//薪资核算-删除薪资核算记录 -export const deleteCalc = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/delete", "POST", params); -}; - -//薪资核算-归档薪资核算记录 -export const fileCalc = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/file", "POST", params); -}; - -//薪资核算-薪资核算详情 -export const getCalcForm = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/getForm", "get", params); -}; - -//薪资核算-保存薪资核算的基本信息 -export const saveCalc = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/basic/save", "POST", params); -}; - -//薪资核算-获取薪资核算提示信息 -export const getCalcInfo = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/getSalarySobCycle", "get", params); -}; - -//薪资核算-薪资核算人员确认列表 -export const getCalcPersonList = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctEmployee/list", "POST", params); -}; - -//薪资核算-薪资核算人员高级搜索 -export const getCalcPersonSa = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctEmployee/getSearchCondition", "get", params); -}; - -//薪资核算-删除薪资核算人员 -export const deleteCalcPerson = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctEmployee/delete", "POST", params); -}; - -//薪资核算-添加薪资核算人员 -export const saveCalcPerson = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctEmployee/save", "POST", params); -}; - -//薪资核算-导出人员范围 -export const exportCalcPerson = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctEmployee/export", "POST", params); -}; - -//薪资核算-薪资核算环比上期减少人员列表 -export const getCalcPersonSubList = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/reducedEmployee/list", "POST", params); -}; - -//薪资核算-导出环比减少人员 -export const exportCalcPersonSub = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/reducedEmployee/export", "POST", params); -}; - - -//薪资核算-执行薪资核算 -export const doScCalc = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctResult/accounting", "POST", params); -}; - - -//薪资核算-获取薪资核算结果高级搜索 -export const getScSa = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctResult/getSearchCondition", "get", params); -}; - -//薪资核算-薪资核算结果列表 -export const getScList = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctResult/list", "post", params); -}; - - -//薪资核算-导出薪资核算 -export const exportSc = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctResult/export", "post", params); -}; - -//薪资核算-导出线下对比结果 -export const exportOc = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/comparisonResult/export", "post", params); -}; - - -//薪资核算-薪资核算结果详情 -export const getScDetail = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctResult/detail", "get", params); -}; - -//薪资核算-薪资核算合并计税详情 -export const getScMergeTaxDetail = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctResult/getConsolidatedTaxDetail", "get", params); -}; - -//薪资核算-编辑薪资核算结果 -export const editScResult = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctResult/save", "post", params); -}; - -//薪资核算-薪资核算结果校验 -export const checkScResult = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/acctResult/check", "post", params); -}; - - -//薪资核算-获取校验结果(异常)总数 -export const getScResultExceptionCount = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/checkResult/getCount", "get", params); -}; - -//薪资核算-校验结果列表 -export const getCheckResultList = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/checkResult/list", "POST", params); -}; - -//薪资核算-校验结果明细列表 -export const getCheckResultDetailList = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/checkResultRecord/list", "POST", params); -}; - -//薪资核算-获取导入组件前置参数 -export const getImportParams = params => { - return WeaTools.callApi("/api/bs/hrmsalary/salaryAcct/checkResultRecord/list", "POST", params); -}; - // 薪资记录--薪资核算列表 export const getSalaryAcctList = params => { return fetch("/api/bs/hrmsalary/salaryacct/list", { @@ -176,6 +40,17 @@ export const reducedemployeeList = params => { body: JSON.stringify(params) }).then(res => res.json()); }; +// 核算人员--薪资核算环比上月增加人员 +export const addedemployeeList = params => { + return fetch("/api/bs/hrmsalary/salaryacct/addedemployee/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 核算人员--薪资核算人员确认列表 export const acctemployeeList = params => { @@ -206,7 +81,6 @@ export const getSalarySobCycle = params => { return WeaTools.callApi("/api/bs/hrmsalary/salaryacct/getSalarySobCycle", "GET", params); }; - // 核算人员--添加薪资核算人员 export const saveAcctemployee = params => { return fetch("/api/bs/hrmsalary/salaryacct/acctemployee/save", { @@ -232,7 +106,6 @@ export const exportReducedEmployee = (id) => { })); }; - // 核算人员--导出人员范围 export const exportAcctEmployee = (id) => { fetch("/api/bs/hrmsalary/salaryacct/acctemployee/export?salaryAcctRecordId=" + id).then(res => res.blob().then(blob => { @@ -374,7 +247,6 @@ export const getImportField = (params) => { return WeaTools.callApi("/api/bs/hrmsalary/salaryacct/acctresult/importField", "GET", params); }; - // 核算结果-导入模板 export const getImportTemplate = (salaryItemIds, salaryAcctRecordId) => { fetch("/api/bs/hrmsalary/salaryacct/acctresult/importtemplate/export?salaryItemIds=" + salaryItemIds + "&salaryAcctRecordId=" + salaryAcctRecordId).then(res => res.blob().then(blob => { @@ -412,7 +284,6 @@ export const importAcctResult = (params) => { }).then(res => res.json()); }; - // 核算结果-导出全部 export const exportAcctResult = (salaryAcctRecordId, ids) => { fetch("/api/bs/hrmsalary/salaryacct/acctresult/export?salaryAcctRecordId=" + salaryAcctRecordId + "&ids=" + ids).then(res => res.blob().then(blob => { @@ -509,50 +380,6 @@ export const updateLockStatus = (params) => { body: JSON.stringify(params) }).then(res => res.json()); }; -// 社保福利台账合计接口 -export const siaccountDetailCommonListSum = (params) => { - return fetch("/api/bs/hrmsalary/siaccount/detail/common/list/sum", { - method: "POST", - mode: "cors", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify(params) - }).then(res => res.json()); -}; -// 社保福利台账补缴合计接口 -export const siaccountDetailSupplementaryListSum = (params) => { - return fetch("/api/bs/hrmsalary/siaccount/detail/supplementary/list/sum", { - method: "POST", - mode: "cors", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify(params) - }).then(res => res.json()); -}; -// 社保福利台账退差合计接口 -export const siaccountDetailRecessionListSum = (params) => { - return fetch("/api/bs/hrmsalary/siaccount/detail/recession/list/sum", { - method: "POST", - mode: "cors", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify(params) - }).then(res => res.json()); -}; -// 社保福利台账补差合计接口 -export const siaccountDetailBalanceListSum = (params) => { - return fetch("/api/bs/hrmsalary/siaccount/detail/balance/list/sum", { - method: "POST", - mode: "cors", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify(params) - }).then(res => res.json()); -}; // 导入薪资核算添加表头字段缓存 export const cacheImportField = (params) => { return fetch("/api/bs/hrmsalary/salaryacct/acctresult/cacheImportField", { diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js index 944304a1..3cf9643b 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js @@ -5,16 +5,21 @@ * Date: 2023/9/13 */ import React, { Component } from "react"; -import { WeaButtonIcon, WeaHelpfulTip, WeaLocaleProvider, WeaTab, WeaTools } from "ecCom"; +import { WeaButtonIcon, WeaHelpfulTip, WeaLocaleProvider, WeaTab, WeaTable, WeaTools } from "ecCom"; import { inject, observer } from "mobx-react"; import { Button } from "antd"; import BaseInfo from "./baseInfo"; -import { acctemployeeList } from "../../../../../apis/calculate"; +import { acctemployeeList, addedemployeeList, reducedemployeeList } from "../../../../../apis/calculate"; import { personConfirmSearchConditions } from "./condition"; import { getSearchs } from "../../../../../util"; const getKey = WeaTools.getKey; const getLabel = WeaLocaleProvider.getLabel; +const api = { + range: acctemployeeList, + sub: reducedemployeeList, + add: addedemployeeList +}; @inject("calculateStore") @observer @@ -25,7 +30,7 @@ class Index extends Component { selectedKey: "range", showSearchAd: false, searchConditions: [], loading: false, pageInfo: { current: 1, pageSize: 10, total: 0 }, - selectedRowKeys: [] + selectedRowKeys: [], dataSource: [], columns: [] }; } @@ -60,7 +65,7 @@ class Index extends Component { }, () => { const { calculateStore: { PCSearchForm } } = this.props; PCSearchForm.initFormFields(this.state.searchConditions); - this.acctemployeeList(); + this.queryPCList(); }); } @@ -86,8 +91,8 @@ class Index extends Component { } return tabBtns; }; - acctemployeeList = () => { - const { pageInfo } = this.state; + queryPCList = () => { + const { pageInfo, selectedKey } = this.state; const { calculateStore: { PCSearchForm }, routeParams: { salaryAcctRecordId } } = this.props; const { departmentIds, positionIds, statuses, ...extra } = PCSearchForm.getFormParams(); const payload = { @@ -96,16 +101,22 @@ class Index extends Component { positionIds: !_.isEmpty(positionIds) ? positionIds.split(",") : [], statuses: !_.isEmpty(statuses) ? statuses.split(",") : [] }; - acctemployeeList(payload).then(({ status, data }) => { + api[selectedKey](payload).then(({ status, data }) => { if (status) { - console.log(data); + const { columns, list: dataSource = [], pageNum: current, pageSize, total } = data; + this.setState({ + columns, dataSource, pageInfo: { ...pageInfo, current, pageSize, total } + }); } }); }; render() { const { calculateStore: { PCSearchForm } } = this.props; - const { selectedKey, showSearchAd, searchConditions, pageInfo, loading, selectedRowKeys } = this.state; + const { + selectedKey, showSearchAd, searchConditions, pageInfo, loading, selectedRowKeys, + columns, dataSource + } = this.state; const tabDatas = [ { title: @@ -145,13 +156,14 @@ class Index extends Component { showSizeChanger: true, pageSizeOptions: ["10", "20", "50", "100"], onShowSizeChange: (current, pageSize) => { - this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () => this.queryList()); + this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () => this.queryPCList()); }, onChange: current => { - this.setState({ pageInfo: { ...pageInfo, current } }, () => this.queryList()); + this.setState({ pageInfo: { ...pageInfo, current } }, () => this.queryPCList()); } }; const rowSelection = { + columnWidth: 80, selectedRowKeys, onChange: selectedRowKeys => this.setState({ selectedRowKeys }) }; @@ -160,15 +172,42 @@ class Index extends Component { this.setState({ selectedKey: v })} advanceHeight={220} - buttons={this.renderTabBtns()} searchType={["base", "advanced"]} + onChange={v => this.setState({ selectedKey: v }, () => this.queryPCList())} + buttons={this.renderTabBtns()} searchType={["base", "advanced"]} advanceHeight={220} showSearchAd={showSearchAd} setShowSearchAd={bool => this.setState({ showSearchAd: bool })} searchsAd={getSearchs(PCSearchForm, searchConditions, 2, false)} onSearchChange={(v) => PCSearchForm.updateFields({ employeeName: v })} searchsBaseValue={PCSearchForm.getFormParams().employeeName} - onSearch={this.acctemployeeList} onAdSearch={this.acctemployeeList} + onSearch={this.queryPCList} onAdSearch={this.queryPCList} onAdReset={() => PCSearchForm.resetForm()} /> + { + let width = ""; + const { dataIndex } = item; + switch (dataIndex) { + case "taxAgentName": + case "departmentName": + width = "15%"; + break; + default: + width = "10%"; + break; + } + return { ...item, width }; + }), + { + dataIndex: "operate", + title: getLabel(30585, "操作"), + width: 120, + render: (_, record) => ( + {getLabel(535052, "删除")} + ) + } + ]} + /> ); } diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less index 18bcbc29..3dfa69f0 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less @@ -2,6 +2,10 @@ .wea-tab .wea-tab-right, .wea-input-focus { background: transparent; } + + .wea-new-table { + background: #fff; + } } .docalc-baseinfo-layout { From 4769df4cfd72c2c4c55f8c11c9eac79bdea13fb4 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, 14 Sep 2023 14:05:40 +0800 Subject: [PATCH 03/25] =?UTF-8?q?feature/2.9.42309.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E6=A0=B8=E7=AE=97=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=94=B9=E9=80=A0=EF=BC=88=E9=A1=B5=E9=9D=A2=E7=BC=96?= =?UTF-8?q?=E8=BE=91=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salaryCalcPersonConfirm/index.js | 91 +++++++++++++++++-- 1 file changed, 81 insertions(+), 10 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js index 3cf9643b..31fbfe42 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.js @@ -5,13 +5,20 @@ * Date: 2023/9/13 */ import React, { Component } from "react"; -import { WeaButtonIcon, WeaHelpfulTip, WeaLocaleProvider, WeaTab, WeaTable, WeaTools } from "ecCom"; +import { WeaBrowser, WeaButtonIcon, WeaHelpfulTip, WeaLocaleProvider, WeaTab, WeaTable, WeaTools } from "ecCom"; import { inject, observer } from "mobx-react"; -import { Button } from "antd"; +import { Button, message, Modal } from "antd"; import BaseInfo from "./baseInfo"; -import { acctemployeeList, addedemployeeList, reducedemployeeList } from "../../../../../apis/calculate"; +import { + acctemployeeList, + addedemployeeList, + deleteAcctemployee, + reducedemployeeList, + saveAcctemployee +} from "../../../../../apis/calculate"; import { personConfirmSearchConditions } from "./condition"; import { getSearchs } from "../../../../../util"; +import { convertToUrlString } from "../../../../../util/url"; const getKey = WeaTools.getKey; const getLabel = WeaLocaleProvider.getLabel; @@ -70,20 +77,26 @@ class Index extends Component { } renderTabBtns = () => { - const { selectedKey } = this.state; + const { selectedKey, selectedRowKeys } = this.state; let tabBtns = []; switch (selectedKey) { case "range": tabBtns = [ - , - , - + this.handleDeletePCitem()}/>, + ids && this.handleUserBrowserChange(ids.split(","))} + > + + , + ]; break; case "add": case "sub": tabBtns = [ - + ]; break; default: @@ -101,13 +114,70 @@ class Index extends Component { positionIds: !_.isEmpty(positionIds) ? positionIds.split(",") : [], statuses: !_.isEmpty(statuses) ? statuses.split(",") : [] }; + this.setState({ loading: true }); api[selectedKey](payload).then(({ status, data }) => { + this.setState({ loading: false }); if (status) { const { columns, list: dataSource = [], pageNum: current, pageSize, total } = data; this.setState({ columns, dataSource, pageInfo: { ...pageInfo, current, pageSize, total } }); } + }).catch(() => this.setState({ loading: false })); + }; + handleDeletePCitem = (ids) => { + Modal.confirm({ + title: getLabel(131329, "信息确认"), + content: getLabel(388758, "确认要删除吗?"), + onOk: () => { + const { selectedRowKeys } = this.state; + const { routeParams: { salaryAcctRecordId } } = this.props; + deleteAcctemployee({ salaryAcctRecordId, ids: !_.isEmpty(ids) ? ids : selectedRowKeys }) + .then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(502230, "删除成功!")); + this.queryPCList(); + _.isNil(ids) && this.setState({ selectedRowKeys: [] }); + } else { + message.error(errormsg || getLabel(20462, "删除失败!")); + } + }); + } + }); + }; + /* + * Author: 黎永顺 + * Description: 人员确认导出 + * Params: + * Date: 2023/9/14 + */ + handleExport = () => { + let url = ""; + const { routeParams: { salaryAcctRecordId }, calculateStore: { PCSearchForm } } = this.props; + if (this.state.selectedKey === "range") { + url = `${window.location.origin}/api/bs/hrmsalary/salaryacct/acctemployee/export?salaryAcctRecordId=${salaryAcctRecordId}&${convertToUrlString(PCSearchForm.getFormParams())}`; + } else if (this.state.selectedKey === "sub") { + url = `${window.location.origin}/api/bs/hrmsalary/salaryacct/reducedemployee/export?salaryAcctRecordId=${salaryAcctRecordId}&${convertToUrlString(PCSearchForm.getFormParams())}`; + } else { + url = `${window.location.origin}/api/bs/hrmsalary/salaryacct/addedemployee/export?salaryAcctRecordId=${salaryAcctRecordId}&${convertToUrlString(PCSearchForm.getFormParams())}`; + } + window.open(url, "_blank"); + }; + /* + * Author: 黎永顺 + * Description: 添加人员确认 + * Params: + * Date: 2023/9/14 + */ + handleUserBrowserChange = (employeeIds) => { + const { routeParams: { salaryAcctRecordId } } = this.props; + saveAcctemployee({ salaryAcctRecordId, employeeIds }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(541531, "添加成功!")); + this.queryPCList(); + } else { + message.error(errormsg || getLabel(111, "添加失败!")); + } }); }; @@ -183,7 +253,7 @@ class Index extends Component { /> { let width = ""; const { dataIndex } = item; @@ -203,7 +273,8 @@ class Index extends Component { title: getLabel(30585, "操作"), width: 120, render: (_, record) => ( - {getLabel(535052, "删除")} + this.handleDeletePCitem([record.id])}>{getLabel(535052, "删除")} ) } ]} From d008654bf82bee25d1ca5ded73f6f302a8456840 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, 14 Sep 2023 15:50:24 +0800 Subject: [PATCH 04/25] hotfix/2.9.42309.01 --- .../doCalc/components/salaryEditCalc/index.js | 19 +++++++++++++++++++ .../components/salaryEditCalc/index.less | 0 .../hrmSalary/pages/calculate/doCalc/index.js | 3 +++ 3 files changed, 22 insertions(+) create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.less diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js new file mode 100644 index 00000000..926fb06f --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.js @@ -0,0 +1,19 @@ +/* + * Author: 黎永顺 + * name: 薪资核算 + * Description: + * Date: 2023/9/14 + */ +import React, { Component } from "react"; + +class Index extends Component { + render() { + return ( +
+ +
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.less b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/index.less new file mode 100644 index 00000000..e69de29b diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js index 2508d0dc..dc25caf4 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/index.js @@ -73,6 +73,9 @@ class Index extends Component { case "person": dom = ; break; + case "calc": + dom = ; + break; default: break; } From 707ca40f054a5c1175d8588a141c42935066dfc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 15 Sep 2023 11:14:39 +0800 Subject: [PATCH 05/25] =?UTF-8?q?feature/2.9.42309.01-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E6=A0=B8=E7=AE=97=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=94=B9=E9=80=A0=EF=BC=88=E9=A1=B5=E9=9D=A2=E7=BC=96?= =?UTF-8?q?=E8=BE=91=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/advanceInputBtn/index.js | 3 +- .../salaryCalcPersonConfirm/index.less | 1 + .../components/salaryEditCalc/condition.js | 145 ++++++++++++++++++ .../editCalcAdvanceSearchPannel.js | 76 +++++++++ .../salaryEditCalc/editCalcTable.js | 120 +++++++++++++++ .../doCalc/components/salaryEditCalc/index.js | 62 +++++++- .../components/salaryEditCalc/index.less | 56 +++++++ .../hrmSalary/pages/calculate/doCalc/index.js | 8 +- .../pages/calculate/doCalc/index.less | 1 + pc4mobx/hrmSalary/stores/calculate.js | 1 + 10 files changed, 466 insertions(+), 7 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcAdvanceSearchPannel.js create mode 100644 pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js index 654756d7..f9a10027 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/advanceInputBtn/index.js @@ -10,7 +10,8 @@ class Index extends Component { return (
- +
); } diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less index 3dfa69f0..eb4fb73b 100644 --- a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryCalcPersonConfirm/index.less @@ -13,6 +13,7 @@ .wea-title { border-bottom: none; + padding-left: 0; } .wea-content.pt15 { diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js new file mode 100644 index 00000000..59fcb015 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/condition.js @@ -0,0 +1,145 @@ +export const editCalcSearchConditions = [ + { + items: [ + { + colSpan: 2, + conditionType: "INPUT", + domkey: ["employeeName"], + fieldcol: 12, + label: "姓名", + lanId: 25034, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + colSpan: 2, + conditionType: "INPUT", + domkey: ["workcode"], + fieldcol: 12, + label: "工号", + lanId: 1933, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + icon: "icon-coms-hrm", + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "", + type: "164", + viewAttr: 2 + }, + colSpan: 1, + conditionType: "BROWSER", + domkey: ["subcompanyIds"], + fieldcol: 12, + label: "分部", + lanId: 33553, + labelcol: 6, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + icon: "icon-coms-hrm", + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "", + type: "57", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["departmentIds"], + fieldcol: 12, + label: "部门", + lanId: 27511, + labelcol: 6, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + icon: "icon-coms-hrm", + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "", + type: "24", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["positionIds"], + fieldcol: 12, + label: "岗位", + lanId: 6086, + labelcol: 6, + viewAttr: 2 + }, + { + colSpan: 2, + conditionType: "SELECT", + domkey: ["statuses"], + fieldcol: 12, + multiple: true, + label: "状态", + lanId: 535101, + labelcol: 6, + options: [], + viewAttr: 2 + }, + { + colSpan: 2, + conditionType: "CHECKBOX", + domkey: ["consolidatedTaxation"], + fieldcol: 12, + isQuickSearch: false, + label: "合并计税", + labelcol: 6, + viewAttr: 2 + } + ], + defaultshow: true, + title: "常用条件" + } +]; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcAdvanceSearchPannel.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcAdvanceSearchPannel.js new file mode 100644 index 00000000..392a42d1 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcAdvanceSearchPannel.js @@ -0,0 +1,76 @@ +/* + * Author: 黎永顺 + * name: 薪资核算-高级搜索面板 + * Description: + * Date: 2023/9/14 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTools } from "ecCom"; +import { Button } from "antd"; +import { inject, observer } from "mobx-react"; +import { editCalcSearchConditions } from "./condition"; +import { getSearchs } from "../../../../../util"; + +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("calculateStore") +@observer +class EditCalcAdvanceSearchPannel extends Component { + constructor(props) { + super(props); + this.state = { + searchConditions: [] + + }; + } + + componentDidMount() { + this.setState({ + searchConditions: _.map(editCalcSearchConditions, item => { + return { + ...item, + items: _.map(item.items, o => { + if (getKey(o) === "statuses") { + return { + ...o, + options: [ + { key: "0", showname: getLabel(18883, "试用") }, { key: "1", showname: getLabel(15711, "正式") }, + { key: "2", showname: getLabel(480, "临时") }, { key: "3", showname: getLabel(15844, "试用延期") }, + { key: "4", showname: getLabel(542707, "解雇") }, { key: "5", showname: getLabel(6091, "离职") }, + { key: "6", showname: getLabel(6092, "退休") } + ] + }; + } + return { ...o }; + }), + title: getLabel(32905, "常用条件") + }; + }) + }, () => { + const { calculateStore: { ECSearchForm } } = this.props; + ECSearchForm.initFormFields(this.state.searchConditions); + }); + } + + render() { + const { searchConditions } = this.state; + const { calculateStore: { ECSearchForm } } = this.props; + return ( + + {getSearchs(ECSearchForm, searchConditions, 2, false)} +
+
+ + + +
+
+
+ ); + } +} + +export default EditCalcAdvanceSearchPannel; diff --git a/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js new file mode 100644 index 00000000..00d33cd1 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/calculate/doCalc/components/salaryEditCalc/editCalcTable.js @@ -0,0 +1,120 @@ +/* + * Author: 黎永顺 + * name: 薪资核算-列表数据 + * Description: + * Date: 2023/9/14 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { inject, observer } from "mobx-react"; +import { Spin } from "antd"; +import { acctResultList } from "../../../../../apis/calculate"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("calculateStore") +@observer +class EditCalcTable extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, pageInfo: { current: 1, pageSize: 10, total: 0 }, + selectedRowKeys: [] + }; + } + + componentDidMount() { + window.addEventListener("message", this.handleReceive, false); + } + + handleReceive = async ({ data }) => { + const { type, payload: { id, params } = {} } = data; + if (type === "init") { + this.queryCalcResultList(); + } else if (type === "turn") { + switch (id) { + case "PAGEINFO": + const { size: pageSize, pageNum: current } = params; + this.setState({ pageInfo: { ...this.state.pageInfo, current, pageSize } }, () => this.queryCalcResultList()); + break; + case "CHECKBOX": + const { selectedRowKeys } = params; + this.setState({ selectedRowKeys }); + break; + default: + break; + } + } + }; + + componentWillUnmount() { + window.removeEventListener("message", this.handleReceive, false); + } + + postMessageToChild = (payload = {}) => { + const childFrameObj = document.getElementById("atdTable"); + childFrameObj.contentWindow.postMessage(JSON.stringify(payload), "*"); + }; + queryCalcResultList = () => { + const { pageInfo } = this.state; + const { calculateStore: { ECSearchForm }, routeParams: { salaryAcctRecordId } } = this.props; + const { subcompanyIds, departmentIds, positionIds, statuses, ...extra } = ECSearchForm.getFormParams(); + const payload = { + salaryAcctRecordId, ...pageInfo, ...extra, + departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : [], + positionIds: !_.isEmpty(positionIds) ? positionIds.split(",") : [], + subcompanyIds: !_.isEmpty(subcompanyIds) ? subcompanyIds.split(",") : [], + statuses: !_.isEmpty(statuses) ? statuses.split(",") : [] + }; + this.setState({ loading: true }); + acctResultList(payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { columns, pageInfo: list } = data; + const { list: dataSource, pageNum: current, pageSize, total } = list; + this.setState({ pageInfo: { ...pageInfo, current, pageSize, total } }, () => { + const { pageInfo, selectedRowKeys } = this.state; + console.log(selectedRowKeys); + this.postMessageToChild({ + dataSource, pageInfo, selectedRowKeys, + columns: _.map(traverse(columns), (it, idx) => ({ ...it, fixed: idx < 2 ? "left" : false })) + }); + }); + } + }).catch(() => this.setState({ loading: false })); + }; + + render() { + const { loading } = this.state; + return ( +
+ +