From c01c03f1b0eceada0231663734f226e3b21aa0c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 8 Jan 2024 16:05:00 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feature/2.9.10.2312.02-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/index.js | 8 +- .../components/advanceInputBtn/index.js | 33 ++ .../components/advanceInputBtn/index.less | 29 ++ .../salaryFileAdvanceSearchPannel/index.js | 87 ++++++ .../pages/payrollFiles/config/index.js | 284 ++++++++++++++++++ .../hrmSalary/pages/payrollFiles/index.less | 75 +++++ .../pages/payrollFiles/salaryFiles.js | 63 ++++ pc4mobx/hrmSalary/stores/salaryFile.js | 3 + 8 files changed, 579 insertions(+), 3 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/payrollFiles/components/advanceInputBtn/index.js create mode 100644 pc4mobx/hrmSalary/pages/payrollFiles/components/advanceInputBtn/index.less create mode 100644 pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileAdvanceSearchPannel/index.js create mode 100644 pc4mobx/hrmSalary/pages/payrollFiles/salaryFiles.js diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index d246f2ed..743b5cfc 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -4,13 +4,14 @@ import { WeaLocaleProvider } from "ecCom"; import MySalaryMobile from "./pages/mySalaryMobile"; import MySalary from "./pages/mySalaryBenefits"; import Programme from "./pages/socialSecurityBenefits/programme"; -import Archivess from "./pages/socialSecurityBenefits/archives"; +// import Archivess from "./pages/socialSecurityBenefits/archives"; import Archives from "./pages/socialSecurityBenefits/welfareArchive"; //社保福利档案重构页面 import StandingBook from "./pages/socialSecurityBenefits/standingBook"; import StandingBookDetail from "./pages/socialSecurityBenefits/standingBookDetail"; import StandingBookOfflineComparison from "./pages/socialSecurityBenefits/standingBookOfflineComparison"; import SalaryItem from "./pages/salaryItem"; import PayrollFiles from "./pages/payrollFiles"; +import SalaryFiles from "./pages/payrollFiles/salaryFiles"; import CumDeduct from "./pages/dataAcquisition/cumDeduct"; import OtherDeduct from "./pages/dataAcquisition/otherDeduct"; import CumSituation from "./pages/dataAcquisition/cumSituation"; @@ -120,7 +121,7 @@ const Routes = ( component={SocialSecurityBenefits}> - + {/**/} - + + + salaryFileQueryForm.updateFields({ username: v })} + onSearch={this.props.onAdvanceSearch} + /> + + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/components/advanceInputBtn/index.less b/pc4mobx/hrmSalary/pages/payrollFiles/components/advanceInputBtn/index.less new file mode 100644 index 00000000..9081d39f --- /dev/null +++ b/pc4mobx/hrmSalary/pages/payrollFiles/components/advanceInputBtn/index.less @@ -0,0 +1,29 @@ +.achrive-advance-search { + display: flex; + align-items: center; + position: relative; + top: -1.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; + top: 1px; + } +} diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileAdvanceSearchPannel/index.js b/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileAdvanceSearchPannel/index.js new file mode 100644 index 00000000..32ba200e --- /dev/null +++ b/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileAdvanceSearchPannel/index.js @@ -0,0 +1,87 @@ +/* + * Author: 黎永顺 + * name: 薪资档案页面重构-高级查询 + * Description: + * Date: 2024/1/8 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTools } from "ecCom"; +import { Button } from "antd"; +import { inject, observer } from "mobx-react"; +import { getSearchs } from "../../../../util"; +import * as API from "../../../../apis/payrollFiles"; +import { salaryFileSearchConditions } from "../../config"; +import { getTaxAgentSelectList } from "../../../../apis/taxAgent"; + +const getLabel = WeaLocaleProvider.getLabel; +const getKey = WeaTools.getKey; + +@inject("salaryFileStore") +@observer +class salaryFileAdvanceSearchPannel extends Component { + constructor(props) { + super(props); + this.state = { + searchConditions: [] + }; + } + + async componentDidMount() { + const [{ data: userStatusList }, { data: taxAgentList }] = await Promise.all([ + API.commonEnumList({ enumClass: "com.engine.salary.enums.UserStatusEnum" }), + getTaxAgentSelectList() + ]); + this.setState({ + searchConditions: _.map(salaryFileSearchConditions, item => { + return { + ...item, + items: _.map(item.items, child => { + if (getKey(child) === "statuses") { + return { + ...child, + options: _.map(userStatusList, o => ({ key: String(o.value), showname: o.defaultLabel })) + }; + } else if (getKey(child) === "statuses") { + return { + ...child, + options: _.map(taxAgentList, o => ({ key: o.id, showname: o.content })) + }; + } + return { ...child }; + }) + }; + }) + }, () => { + const { salaryFileStore: { salaryFileQueryForm } } = this.props; + salaryFileQueryForm.initFormFields(this.state.searchConditions); + }); + } + + render() { + const { searchConditions } = this.state; + const { salaryFileStore: { salaryFileQueryForm } } = this.props; + return ( + +
+ {getSearchs(salaryFileQueryForm, searchConditions, 2, false)} +
+
+
+ + + + + + + + + +
+
+
+ ); + } +} + +export default salaryFileAdvanceSearchPannel; + diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/config/index.js b/pc4mobx/hrmSalary/pages/payrollFiles/config/index.js index 22a80218..8695409f 100644 --- a/pc4mobx/hrmSalary/pages/payrollFiles/config/index.js +++ b/pc4mobx/hrmSalary/pages/payrollFiles/config/index.js @@ -1,3 +1,11 @@ +import React from "react"; +import { WeaHelpfulTip, WeaLocaleProvider, WeaTools } from "ecCom"; +import { Button } from "antd"; +import AdvanceInputBtn from "../components/advanceInputBtn"; + +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; + export const tabCondition = [ { color: "#000000", @@ -35,3 +43,279 @@ export const tabCondition = [ viewcondition: "ext" } ]; +export const tabList = [ + { viewcondition: "pending", lanId: 542689, title: "待定薪", showcount: true, groupid: "PENDING" }, + { viewcondition: "fixed", lanId: 544638, title: "发薪员工", showcount: true, groupid: "FIXED" }, + { viewcondition: "suspend", lanId: 542691, title: "待停薪", showcount: true, groupid: "SUSPEND" }, + { viewcondition: "stop", lanId: 544637, title: "停薪员工", showcount: true, groupid: "STOP" }, + { viewcondition: "ext", lanId: 542679, title: "非系统人员", showcount: true, groupid: "EXT" } +]; +export const renderReqBtns = (selectedKey, onOpenAdvanceSearch, onAdvanceSearch) => { + let reqBtns = [ + , + + ]; + switch (selectedKey) { + case "pending": + reqBtns.splice(1, 0, ); + break; + case "fixed": + case "ext": + reqBtns.unshift(} + />); + break; + case "stop": + reqBtns.shift(); + reqBtns.unshift(); + break; + default: + break; + } + return reqBtns; +}; +export const renderDropMenuDatas = (selectedKey) => { + let menus = [{ + key: "custom_cols", + icon: , + content: getLabel(32535, "显示列定制") + }]; + switch (selectedKey) { + case "pending": + menus = [ + { + key: "batchSet", + icon: , + content: getLabel(543305, "批量设为发薪员工") + }, + { + key: "batchDelete", + icon: , + content: getLabel(543186, "批量删除待办") + }, + { + key: "exportAll", + icon: , + content: getLabel(81272, "导出全部") + }, + { + key: "exportSelected", + icon: , + content: getLabel(512938, "导出选中") + }, + ...menus + ]; + break; + case "fixed": + menus = [ + { + key: "exportAll", + icon: , + content: getLabel(81272, "导出全部") + }, + { + key: "exportSelected", + icon: , + content: getLabel(512938, "导出选中") + }, + ...menus + ]; + break; + case "suspend": + menus = [ + { + key: "allWithoutpay", + icon: , + content: getLabel(543326, "全部停薪") + }, + { + key: "batchWithoutpay", + icon: , + content: getLabel(543724, "批量停薪") + }, + { + key: "batchDelete", + icon: , + content: getLabel(543186, "批量删除待办") + }, + { + key: "exportAll", + icon: , + content: getLabel(81272, "导出全部") + }, + { + key: "exportSelected", + icon: , + content: getLabel(512938, "导出选中") + }, + ...menus + ]; + break; + case "stop": + menus = [ + { + key: "exportAll", + icon: , + content: getLabel(81272, "导出全部") + }, + { + key: "exportSelected", + icon: , + content: getLabel(512938, "导出选中") + }, + ...menus + ]; + break; + default: + break; + } + return menus; +}; + +export const salaryFileSearchConditions = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["username"], + fieldcol: 16, + label: getLabel(25034, "姓名"), + labelcol: 8, + 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: 16, + label: getLabel(33553, "分部"), + labelcol: 8, + 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 + }, + conditionType: "BROWSER", + domkey: ["departmentIds"], + fieldcol: 16, + label: getLabel(27511, "部门"), + labelcol: 8, + 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 + }, + conditionType: "BROWSER", + domkey: ["positionIds"], + fieldcol: 16, + label: getLabel(6086, "岗位"), + labelcol: 8, + viewAttr: 2 + }, + { + conditionType: "SELECT", + domkey: ["statuses"], + fieldcol: 16, + label: getLabel(382300, "人员状态"), + labelcol: 8, + options: [], + viewAttr: 2 + }, + { + conditionType: "SELECT", + domkey: ["taxAgentId"], + fieldcol: 16, + label: getLabel(537996, "个税扣缴义务人"), + labelcol: 8, + options: [], + viewAttr: 2 + }, + { + conditionType: "INPUT", + domkey: ["workcode"], + fieldcol: 16, + label: getLabel(1933, "工号"), + labelcol: 8, + value: "", + viewAttr: 2 + } + ], + defaultshow: true, + title: getLabel(1361, "基本信息"), + col: 2 + } +]; +const HelpfulDiv = () => { + return
+ {getLabel(544742, "导入按钮使用场景说明:")} + {getLabel(544743, "1.档案初始化:")} + + {getLabel(544744, "a.初次使用薪酬模块,全量导入员工的薪资档案数据;")} + {getLabel(544745, "b.员工入职,导入新入职的员工的薪资档案数据(若导入表格中的人员已存在在薪资档案中,初始化导入会将档案中该人员的数据清除再导入);")} + {getLabel(544746, "c.返聘人员使用调薪功能调整薪资档案值或使用调整个税扣缴;")} + + {getLabel(545755, "2.调薪:档案中已存在的人员批量调整薪资项目值(包括返聘人员的情况);")} + {getLabel(545756, "3.调整个税扣缴义务人:档案中已存在的人员批量调整个税扣缴义务人(包括返聘人员的情况);")} +
; +}; diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/index.less b/pc4mobx/hrmSalary/pages/payrollFiles/index.less index 3ca1c22b..cc9f9cee 100644 --- a/pc4mobx/hrmSalary/pages/payrollFiles/index.less +++ b/pc4mobx/hrmSalary/pages/payrollFiles/index.less @@ -111,3 +111,78 @@ } } } + +//薪资档案页面重构 +.salary-files-wrapper { + min-width: 1000px; + overflow: auto; + width: 100%; + height: 100%; + background: #f6f6f6; + + .wea-new-top-req-title > div:first-child > div > div { + padding-left: 0 !important; + + .wea-tab { + border-bottom: none; + } + } + + .salary-files-content { + padding: 8px 16px; + display: flex; + flex-direction: column; + + .table-layout { + .ant-spin-nested-loading, .ant-spin-container { + height: 100%; + } + } + + .searchAdvanced-condition-hide { + display: none; + } + + .searchAdvanced-condition-container { + background: #FFF; + margin-bottom: 10px; + border: 1px solid #e5e5e5; + + .wea-search-buttons { + border-top: 1px solid #dadada; + padding: 15px 0; + } + + .wea-advanced-searchsAd { + height: 246px; + overflow: hidden auto; + + .formItem-delete { + position: absolute; + top: 0; + right: -40px; + } + + .searchAdvanced-commonSelect { + border-top: 1px solid #ebebeb; + margin: 0 25px; + padding: 10px 0; + } + + .custom-advance-largeSpacing { + padding-left: 26px; + + .link { + border: none; + border-radius: 0; + padding: 12px 10px 12px 26px; + color: #2db7f5 + } + } + + } + } + } +} + + diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/salaryFiles.js b/pc4mobx/hrmSalary/pages/payrollFiles/salaryFiles.js new file mode 100644 index 00000000..e1c5f76d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/payrollFiles/salaryFiles.js @@ -0,0 +1,63 @@ +/* + * Author: 黎永顺 + * name: 薪资档案页面-重构 + * Description: + * Date: 2024/1/8 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaReqTop, WeaTab } from "ecCom"; +import { inject, observer } from "mobx-react"; +import { renderDropMenuDatas, renderReqBtns, tabList } from "./config"; +import SalaryFileAdvanceSearchPannel from "./components/salaryFileAdvanceSearchPannel"; +import cs from "classnames"; +import "./index.less"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("salaryFileStore", "taxAgentStore") +@observer +class SalaryFiles extends Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "pending", showSearchAd: false, isQuery: false, logDialogVisible: false, + topTabCount: { stayAdd: 0, paying: 0, stayDel: 0, stopPay: 0, ext: 0 }, + welfareImpDialog: { visible: false, title: getLabel(24023, "数据导入"), runStatuses: "" } + }; + } + + handleOpenAdvanceSearch = () => this.setState({ showSearchAd: true }); + handleAdvanceSearch = () => this.setState({ isQuery: !this.state.isQuery }); + + render() { + const { selectedKey, topTabCount, showSearchAd, isQuery, logDialogVisible, welfareImpDialog } = this.state; + const { taxAgentStore: { showOperateBtn } } = this.props; + return ( +
+ } + iconBgcolor="#F14A2D" showDropIcon dropMenuDatas={renderDropMenuDatas(selectedKey)} + buttons={renderReqBtns(selectedKey, this.handleOpenAdvanceSearch, this.handleAdvanceSearch)} + replaceTab={ + ({ ...o, title: getLabel(o.lanId, o.title) }))} autoCalculateWidth + keyParam="viewcondition" selectedKey={selectedKey} counts={topTabCount} countParam="groupid" + onChange={key => this.setState({ selectedKey: key })} + /> + } + > +
+
+ this.setState({ showSearchAd: false })} + /> +
+
+
+
+ ); + } +} + +export default SalaryFiles; diff --git a/pc4mobx/hrmSalary/stores/salaryFile.js b/pc4mobx/hrmSalary/stores/salaryFile.js index de262e8f..4b07f7f6 100644 --- a/pc4mobx/hrmSalary/stores/salaryFile.js +++ b/pc4mobx/hrmSalary/stores/salaryFile.js @@ -10,6 +10,9 @@ const { TableStore } = WeaTableNew; export class salaryFileStore { @observable adjForm = new WeaForm(); // 调薪form + /*薪资档案页面重构*/ + @observable salaryFileQueryForm = new WeaForm(); // 薪资档案查询form + /*薪资档案页面重构*/ @observable tableStore = new TableStore(); // new table From 252d4e0ff7d1105a35de56719f8e231b5edb0ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 9 Jan 2024 17:42:40 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feature/2.9.10.2312.02-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E6=A1=A3=E6=A1=88=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/advanceInputBtn/index.js | 4 +- .../salaryFileAdvanceSearchPannel/index.js | 8 +- .../salaryFileImportDialog/index.js | 117 ++++++++ .../components/salaryFileList/index.js | 203 +++++++++++++ .../pages/payrollFiles/config/index.js | 60 ++-- .../pages/payrollFiles/salaryFiles.js | 233 ++++++++++++++- .../welfareArchive/config.js | 272 +++++++++--------- .../welfareArchive/index.js | 21 +- pc4mobx/hrmSalary/stores/payrollFiles.js | 3 + pc4mobx/hrmSalary/stores/salaryFile.js | 3 - 10 files changed, 748 insertions(+), 176 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileImportDialog/index.js create mode 100644 pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileList/index.js diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/components/advanceInputBtn/index.js b/pc4mobx/hrmSalary/pages/payrollFiles/components/advanceInputBtn/index.js index b3260f1b..3163fd29 100644 --- a/pc4mobx/hrmSalary/pages/payrollFiles/components/advanceInputBtn/index.js +++ b/pc4mobx/hrmSalary/pages/payrollFiles/components/advanceInputBtn/index.js @@ -12,11 +12,11 @@ import "./index.less"; const getLabel = WeaLocaleProvider.getLabel; -@inject("salaryFileStore") +@inject("payrollFilesStore") @observer class Index extends Component { render() { - const { salaryFileStore: { salaryFileQueryForm } } = this.props; + const { payrollFilesStore: { salaryFileQueryForm } } = this.props; return (
({ key: String(o.value), showname: o.defaultLabel })) }; - } else if (getKey(child) === "statuses") { + } else if (getKey(child) === "taxAgentId") { return { ...child, options: _.map(taxAgentList, o => ({ key: o.id, showname: o.content })) @@ -52,14 +52,14 @@ class salaryFileAdvanceSearchPannel extends Component { }; }) }, () => { - const { salaryFileStore: { salaryFileQueryForm } } = this.props; + const { payrollFilesStore: { salaryFileQueryForm } } = this.props; salaryFileQueryForm.initFormFields(this.state.searchConditions); }); } render() { const { searchConditions } = this.state; - const { salaryFileStore: { salaryFileQueryForm } } = this.props; + const { payrollFilesStore: { salaryFileQueryForm } } = this.props; return (
diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileImportDialog/index.js b/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileImportDialog/index.js new file mode 100644 index 00000000..c9a7d295 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileImportDialog/index.js @@ -0,0 +1,117 @@ +/* + * Author: 黎永顺 + * name: 薪资档案页面重构-导入弹窗 + * Description: + * Date: 2024/1/9 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaCheckbox, WeaLocaleProvider } from "ecCom"; +import ImportDialog from "../../../.././components/importDialog"; +import { convertToUrlString, getURLParameters } from "../../../../util/url"; +import { importSalaryArchive } from "../../../../apis/payrollFiles"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("payrollFilesStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + importDialog: { + nextloading: false, link: "", importResult: {}, imageId: "", + previewUrl: "/api/bs/hrmsalary/salaryArchive/preview", + extraPreview: {} + } + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + const { payrollFilesStore: { salaryFileQueryForm }, importType, isExtEmp } = nextProps; + let payload = {}, extraPreview = {}; + if (importType !== "init" && importType !== "salaryItemAdjust") { + extraPreview = { + importType: "", listType: importType + }; + payload = { + importType: "", listType: importType, + ...salaryFileQueryForm.getFormParams() + }; + } else { + extraPreview = { + importType: importType, listType: "FIXED" + }; + payload = { + importType: importType, listType: "FIXED", + ...salaryFileQueryForm.getFormParams() + }; + } + if (isExtEmp) payload = { ...payload, extSalaryArchiveList: true }; + this.setState({ + importDialog: { + ...this.state.importDialog, extraPreview, + link: `/api/bs/hrmsalary/salaryArchive/downloadTemplate?${convertToUrlString(payload)}` + } + }); + } else { + this.setState({ + importDialog: { + nextloading: false, link: "", importResult: {}, imageId: "", + previewUrl: "/api/bs/hrmsalary/salaryArchive/preview", + extraPreview: {} + } + }); + } + } + + handleImport = (payload) => { + const { importDialog } = this.state, { isExtEmp } = this.props; + const { extraPreview } = importDialog; + this.setState({ importDialog: { ...importDialog, nextloading: true } }); + importSalaryArchive({ ...payload, ...extraPreview, isExtEmp }).then(({ data, status }) => { + this.setState({ importDialog: { ...importDialog, nextloading: false } }); + if (status) { + this.setState({ + importDialog: { ...importDialog, ...payload, importResult: data } + }); + } + }).catch(() => this.setState({ importDialog: { ...importDialog, nextloading: false } })); + }; + + render() { + const { importDialog } = this.state; + const { link } = importDialog; + return ( + this.setState({ + importDialog: { + ...importDialog, importResult: {}, imageId: "", link: "" + } + })} + exportDataDom={ + { + let payload = { ...getURLParameters(link), hasData: val === "1" }; + this.setState({ + importDialog: { + ...importDialog, + link: `/api/bs/hrmsalary/salaryArchive/downloadTemplate?${convertToUrlString(payload)}` + } + }); + }} + /> + } + nextCallback={imageId => this.setState({ importDialog: { ...importDialog, imageId } })} + nextUplaodCallback={imageId => this.handleImport({ imageId })} + /> + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileList/index.js b/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileList/index.js new file mode 100644 index 00000000..1c3f7c89 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/payrollFiles/components/salaryFileList/index.js @@ -0,0 +1,203 @@ +/* + * Author: 黎永顺 + * name: 薪资档案页面重构-列表 + * Description: + * Date: 2024/1/8 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaLoadingGlobal, WeaLocaleProvider } from "ecCom"; +import { WeaTableNew } from "comsMobx"; +import { toJS } from "mobx"; +import { message, Spin } from "antd"; +import * as API from "../../../../apis/payrollFiles"; + +const WeaTableComx = WeaTableNew.WeaTable; +const getLabel = WeaLocaleProvider.getLabel; +const URLLIST = { + pending: "/api/bs/hrmsalary/salaryArchive/pendingList", + fixed: "/api/bs/hrmsalary/salaryArchive/fixedList", + suspend: "/api/bs/hrmsalary/salaryArchive/suspendList", + stop: "/api/bs/hrmsalary/salaryArchive/stopList", + ext: "/api/bs/hrmsalary/salaryArchive/extList" +}; +const APILIST = { + addToSalarypayment: API.gotoFixed, //设为发薪员工 + delPenditngToDo: API.deletePendingTodo, //待定薪删除待办 + delSalaryFiles: API.deleteSalaryArchive, //删除薪资档案 + salarySuspension: API.gotoStop, //停薪 + delSuspendToDo: API.deleteSuspendTodo, //待停薪删除待办 + cancelSalarySuspension: API.cancelStop //取消停薪 +}; + +@inject("payrollFilesStore", "taxAgentStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + dataSource: [], columns: [], loading: false, selectedRowKeys: [], + pageInfo: { current: 1, pageSize: 10, total: 0 } + }; + } + + componentDidMount() { + this.getSalaryFileList(this.props); + window.addEventListener("message", this.handleReceive, false); + window.addEventListener("resize", this.handleResize, false); + } + + handleResize = () => { + this.forceUpdate(); + }; + + componentWillReceiveProps(nextProps, nextContext) { + if ((nextProps.selectedKey !== this.props.selectedKey) || (nextProps.isQuery !== this.props.isQuery)) { + this.setState({ + pageInfo: { ...this.state.pageInfo, current: 1, pageSize: 10, total: 0 } + }, () => this.getSalaryFileList(nextProps)); + } + if ((nextProps.selectedKey !== this.props.selectedKey)) { + this.setState({ + dataSource: [], columns: [], loading: false, selectedRowKeys: [], + welfareEditSlide: { ...this.state.welfareEditSlide, visible: false } + }); + } + } + + componentWillUnmount() { + window.removeEventListener("message", this.handleReceive, false); + window.removeEventListener("resize", this.handleResize, false); + } + + handleReceive = async ({ data }) => { + const { type, payload: { id, params } = {} } = data; + if (type === "init") { + this.getColumns(); + } else if (type === "turn") { + console.log(data); + switch (id) { + case "PAGEINFO": + this.setState({ + pageInfo: { ...this.state.pageInfo, ...params } + }, () => this.getSalaryFileList(this.props)); + break; + case "ROWSELECTION": + const { selectedRowKeys } = params; + this.setState({ selectedRowKeys }); + break; + case "ADD-TO-SALARYPAYMENT": + case "DEL-PENDITNG-TO-DO": + case "DEL-SALARY-FILES": + case "SALARY-SUSPENSION": + case "DEL-SUSPEND-TO-DO": + case "CANCEL-SALARY-SUSPENSION": + const { interfaceParams } = params; + this.handleSalaryOpts(_.camelCase(id), interfaceParams); + break; + default: + break; + } + } + }; + handleSalaryOpts = (type, payload) => { + WeaLoadingGlobal.start(); + APILIST[type](payload).then(({ status, data = {}, errormsg }) => { + WeaLoadingGlobal.destroy(); + if (status) { + const { msg, type } = data; + if (type === "fail" || type === "info") { + message.error(msg); + } else if (type === "success") { + message.success(msg); + this.getSalaryFileList(this.props); + this.setState({ selectedRowKeys: [] }); + } else { + message.success(getLabel(30700, "操作成功!")); + this.getSalaryFileList(this.props); + this.setState({ selectedRowKeys: [] }); + } + } else { + message.error(errormsg); + } + }); + }; + postMessageToChild = (payload = {}) => { + const i18n = { + "操作": getLabel(30585, "操作"), "调薪": getLabel(542686, "调薪"), + "增员": getLabel(543180, "增员"), "删除档案": getLabel(23238, "删除档案"), + "删除待办": getLabel(543181, "删除待办"), "查看": getLabel(33564, "查看"), + "取消停薪": getLabel(543309, "取消停薪"), "共": getLabel(18609, "共"), + "条": getLabel(18256, "条"), "设为发薪人员": getLabel(543308, "设为发薪人员"), + "停薪": getLabel(542692, "停薪"), "编辑": getLabel(501169, "编辑") + }; + const childFrameObj = document.getElementById("atdTable"); + childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); + }; + getSalaryFileList = (props) => { + const { pageInfo } = this.state; + const { + payrollFilesStore: { salaryFileQueryForm, queryList }, selectedKey, onChangeTopTabCount + } = props; + this.setState({ loading: true }); + queryList(pageInfo, salaryFileQueryForm.getFormParams(), URLLIST[selectedKey]).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { pageInfo: result } = data; + const { list: dataSource, total, pageNum: current, pageSize } = result; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, dataSource + }, () => { + onChangeTopTabCount(selectedKey, total); + }); + } + }).catch(() => this.setState({ loading: false })); + }; + getColumns = () => { + const { payrollFilesStore: { tableStore }, taxAgentStore: { showOperateBtn } } = this.props; + const columns = _.map(_.filter(toJS(tableStore.columns), (item) => item.display === "true"), (it, idx) => ({ + dataIndex: it.dataIndex, title: it.title, align: "left", + width: (it.dataIndex === "taxAgentName" || it.dataIndex === "operate") ? 185 : 150, + fixed: it.dataIndex === "username" ? "left" : it.dataIndex === "operate" ? "right" : "", + ellipsis: true + })); + if (!_.isEmpty(columns)) { + this.postMessageToChild({ + columns, showOperateBtn, selectedKey: this.props.selectedKey, + showDelSalaryFileBtn: this.props.showDelSalaryFileBtn, + dataSource: this.state.dataSource, selectedRowKeys: this.state.selectedRowKeys, + showSum: false, pageInfo: this.state.pageInfo + }); + } + }; + + render() { + const { loading, dataSource } = this.state; + const { payrollFilesStore: { tableStore } } = this.props; + const dom = document.querySelector(".wea-new-top-req-content"); + let height = 280; + if (dom && dataSource.length > 0) { + height = (parseFloat(dom.style.height) > 620 && dataSource.length === 10) ? dataSource.length * 39 + 113 : dataSource.length < 10 ? dataSource.length * 39 + 113 : parseFloat(dom.style.height) - 16; + } + return ( +
+ +