From a4dbd0cc4b5edaf95a2de28c85643a1b52334474 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, 2 Dec 2022 14:27:39 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=95=E5=8F=91?= =?UTF-8?q?=E6=94=BE=E9=83=A8=E5=88=86=E5=8F=91=E6=94=BE=E5=92=8C=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=92=A4=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/pages/payroll/SalarySendList.js | 79 ++----- pc4mobx/hrmSalary/pages/payroll/index.js | 199 +++++------------- .../pages/payroll/payrollGrant/index.js | 198 +++++++++-------- .../pages/payroll/stepForm/baseInformForm.js | 2 +- .../pages/payroll/templateSettingList.js | 19 +- pc4mobx/hrmSalary/stores/payroll.js | 30 +-- 6 files changed, 210 insertions(+), 317 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/payroll/SalarySendList.js b/pc4mobx/hrmSalary/pages/payroll/SalarySendList.js index 114890b4..8839fdbd 100644 --- a/pc4mobx/hrmSalary/pages/payroll/SalarySendList.js +++ b/pc4mobx/hrmSalary/pages/payroll/SalarySendList.js @@ -1,6 +1,6 @@ import React from "react"; import { inject, observer } from "mobx-react"; -import { Dropdown, Menu, message } from "antd"; +import { message } from "antd"; import moment from "moment"; import CustomPaginationTable from "../../components/customPaginationTable"; @@ -30,12 +30,12 @@ export default class SalarySendList extends React.Component { handleShowDetail(record) { window.open( "/spa/hrmSalary/static/index.html#/main/hrmSalary/payrollDetail?id=" + - record.id + record.id ); } // 更新模板 - handleUpdateTemplate(record) { + handleUpdateTemplate = (record) => { let templateRecord = {}; templateRecord.id = record.templateId; if (!record.templateId) { @@ -43,22 +43,18 @@ export default class SalarySendList extends React.Component { return; } this.props.onEditTemplate && this.props.onEditTemplate(templateRecord); - } + }; // 获取表头数据 - getColumns() { - const { - payrollStore: { salarySendTableStore }, - taxAgentStore: { showOperateBtn } - } = this.props; + getColumns = () => { + const { payrollStore: { salarySendTableStore }, taxAgentStore: { showOperateBtn } } = this.props; const { columns } = salarySendTableStore; if (!columns) { return []; } - - let result = columns.filter(item => item.hide == "false"); + let result = columns.filter(item => item.hide === "false"); result.map(item => { - if (item.dataIndex == "salaryYearMonth") { + if (item.dataIndex === "salaryYearMonth") { item.render = (text, record) => { return ( @@ -66,7 +62,7 @@ export default class SalarySendList extends React.Component { ); }; - } else if (item.dataIndex == "lastSendTime") { + } else if (item.dataIndex === "lastSendTime") { item.render = (text, record) => { return ( @@ -82,68 +78,37 @@ export default class SalarySendList extends React.Component { { title: "操作", key: "operate", - render: (text, record) => { - return ( - { - this.handleGrant(record); - }}> - 发放 - - ); - } - }, - { - title: "", - key: "moreOperate", - dataIndex: "moreOperate", render: (text, record) => { const { sendNum, sendTotal } = record; return ( - { - if(key === "1"){ - this.handleShowDetail(record) - }else{ - this.handleUpdateTemplate(record); - } - }}> - 查看详情 - 更新模板 - : - { - this.handleShowDetail(record) - }}> - 查看详情 - - }> - - + + this.handleGrant(record)} + style={{ marginRight: 10 }}>发放 + this.handleShowDetail(record)} + style={{ marginRight: 10 }}>查看详情 + { + sendNum !== sendTotal && + this.handleUpdateTemplate(record)}>更新模板 + } + ); } } ])) : - (result = result.concat([ + (result = result.concat([ { title: "操作", key: "operate", render: (text, record) => { return ( - { - this.handleShowDetail(record); - }}> - 查看详情 - + this.handleShowDetail(record)}>查看详情 ); } } ])); return result; - } + }; render() { const { payrollStore } = this.props; diff --git a/pc4mobx/hrmSalary/pages/payroll/index.js b/pc4mobx/hrmSalary/pages/payroll/index.js index 83a1c169..f96aacc7 100644 --- a/pc4mobx/hrmSalary/pages/payroll/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/index.js @@ -6,8 +6,6 @@ import moment from "moment"; import { WeaHelpfulTip, WeaInputSearch, WeaSelect, WeaSlideModal, WeaTop } from "ecCom"; import { renderLoading } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 import CustomTab from "../../components/customTab"; - -import { columns, tempateColumns } from "./columns"; import StepSlide from "../../components/stepSlide"; import BaseInformForm from "./stepForm/baseInformForm"; import ShowSettingForm from "./stepForm/showSettingForm"; @@ -30,7 +28,7 @@ export default class Payroll extends React.Component { selectedKey: "0", currentStep: 0, stepSlideVisible: false, - selectedTab: 0, + selectedTab: "0", editSlideVisible: false, initSelected: false, ledgerOptions: [], @@ -44,44 +42,6 @@ export default class Payroll extends React.Component { this.recordId = ""; this.salaryYearMonth = []; this.listPageInfo = { current: 1, pageSize: 10 }; - columns.map(item => { - if (item.dataIndex == "cz") { - item.render = (text, record) => { - return ( -
- { - window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/payrollGrant"); - }}>工资单发放 - 查看详情 - 更新模板 -
- ); - }; - } - }); - - tempateColumns.map(item => { - if (item.dataIndex == "username") { - item.render = (text) => { - return ( - { - this.setState({ editSlideVisible: true }); - }}>{text} - ); - }; - } else if (item.dataIndex == "cz") { - item.render = () => { - return ( -
- 编辑 - 复制 - 删除 - {/* 操作日志 */} -
- ); - }; - } - }); } // 更新模板 @@ -95,19 +55,19 @@ export default class Payroll extends React.Component { } // 工资单模板-新建表单变化监听 - handleBaseInfoChange(request) { + handleBaseInfoChange = (request) => { const { payrollStore: { setTemplateBaseData } } = this.props; setTemplateBaseData(request); - } + }; // 新建保存 - handleSave() { + handleSave = () => { const { payrollStore } = this.props; const { fetchSavePayroll } = payrollStore; fetchSavePayroll().then(() => { this.setState({ currentStep: 0, stepSlideVisible: false }); }); - } + }; componentWillMount() { const { payrollStore } = this.props; @@ -142,7 +102,7 @@ export default class Payroll extends React.Component { const { getPayrollShowForm } = payrollStore; this.recordId = record.id; getPayrollShowForm(record.id); - this.setState({ templateCurrentId: record.id, selectedTab: 0 }, () => { + this.setState({ templateCurrentId: record.id, selectedTab: "0" }, () => { this.setState({ editSlideVisible: true }); }); } @@ -197,16 +157,16 @@ export default class Payroll extends React.Component { } // 预览 - handlePreview() { + handlePreview = () => { const { payrollStore: { templateBaseData, salaryTemplateShowSet, salaryItemSet } } = this.props; window.localStorage.setItem("templateBaseData", JSON.stringify(templateBaseData)); window.localStorage.setItem("salaryTemplateShowSet", JSON.stringify(salaryTemplateShowSet)); window.localStorage.setItem("salaryItemSet", JSON.stringify(salaryItemSet)); window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/templatePreview"); - } + }; // 更新保存 - handleUpdateSave() { + handleUpdateSave = () => { const { payrollStore } = this.props; const { fetchUpdatePayroll } = payrollStore; fetchUpdatePayroll(this.recordId).then(() => { @@ -215,7 +175,7 @@ export default class Payroll extends React.Component { selectedTab: 0 }); }); - } + }; // 发放页面页码跳转 handleListDataPageChange(value, pageInfo) { @@ -233,52 +193,23 @@ export default class Payroll extends React.Component { render() { const { payrollStore, taxAgentStore: { showOperateBtn } } = this.props; - const { - loading, - hasRight, - form, - doSearch, - setShowSearchAd, - templateStore, - deletePayroll - } = payrollStore; + const { loading, hasRight, templateStore, deletePayroll } = payrollStore; const { currentStep, selectedTab, templateSearchValue, templateSelect, startDate, endDate } = this.state; if (!hasRight && !loading) { // 无权限处理 return renderLoading(); } - - const rightMenu = [// 右键菜单 - // { - // key: 'BTN_COLUMN', - // icon: , - // content: '显示列定制', - // onClick: this.showColumn - // }, - ]; - const collectParams = { // 收藏功能配置 - favname: "工资单发放", - favouritetype: 1, - objid: 0, - link: "wui/index.html#/ns_demo03/index", - importantlevel: 1 - }; - const adBtn = [ // 高级搜索内部按钮 - , - , - - ]; - - const topTab = [{ - title: "工资单发放", - viewcondition: "0" - }, + const topTab = [ + { + title: "工资单发放", + viewcondition: "0" + }, { title: "工资单模板设置", viewcondition: "1" - }]; - + } + ]; const renderRightOperation = () => { - if (this.state.selectedKey == "0") { + if (this.state.selectedKey === "0") { return
; - } else if (this.state.selectedKey == "1") { + } else if (this.state.selectedKey === "1") { return (
{ @@ -354,29 +285,20 @@ export default class Payroll extends React.Component { ); } }; - - const steps = [ - "基础设置", - "显示设置" - ]; - + const steps = ["基础设置", "显示设置"]; const validateStep1 = () => { const { payrollStore: { templateBaseData } } = this.props; - if (!notNull(templateBaseData.name)) { - message.warning("工资单模板名称不能为空"); - return false; - } - - if (!notNull(templateBaseData.salarySob)) { - message.warning("薪资账套不能为空"); + if (!notNull(templateBaseData.name) || !notNull(templateBaseData.salarySob)) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); return false; } return true; }; const nextStep = () => { - if (!validateStep1()) { - return; - } + if (!validateStep1()) return; this.setState({ currentStep: this.state.currentStep + 1 }); @@ -395,20 +317,14 @@ export default class Payroll extends React.Component { icon={} // 左侧图标 iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={false} // 是否显示下拉按钮 - dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) - dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 > - { - this.setState({ selectedKey: v, stepSlideVisible: false, editSlideVisible: false }); - }} + { + this.setState({ selectedKey: v, stepSlideVisible: false, editSlideVisible: false }); + }} /> { - this.state.selectedKey == 0 && + this.state.selectedKey === "0" && { this.handleTemplateListEdit(record); @@ -424,7 +340,7 @@ export default class Payroll extends React.Component { } { - this.state.selectedKey == 1 && + this.state.selectedKey === "1" && { this.handleTemplateListEdit(record); @@ -437,7 +353,6 @@ export default class Payroll extends React.Component { /> } - { this.state.stepSlideVisible && { nextStep(); }}>下一步 - ] : currentStep == 1 ? [ - , - , - + , + ] : [] } title="新建工资单模板" content={
{ - currentStep == 0 && { - this.handleBaseInfoChange(request); - }}/> + currentStep === 0 && + } { - currentStep == 1 && + currentStep === 1 && }
- } /> } @@ -493,22 +402,16 @@ export default class Payroll extends React.Component { title={ { - this.handleUpdateSave(); - }}>保存 - ] : selectedTab == 1 ? [ - , - + selectedTab === "0" ? [ + + ] : selectedTab === "1" ? [ + , + ] : [] } subItemChange={ @@ -520,13 +423,11 @@ export default class Payroll extends React.Component { } content={
{ - selectedTab == 0 && - { - this.handleBaseInfoChange(request); - }}/> + selectedTab === "0" && + } { - selectedTab == 1 && + selectedTab === "1" && }
} onClose={() => this.setState({ editSlideVisible: false }, () => this.setState({ selectedTab: 0 }))} diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js index 9e0b0aa2..101a31b1 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js @@ -19,12 +19,14 @@ export default class PayrollGrant extends React.Component { selectedRowKeys: [], payrollGrantVisible: false, payrollWithdrawVisible: false, - currentId: "" + currentId: "", + selectedKey: "0" }; this.pageInfo = { current: 1, pageSize: 10 }; } componentWillMount() { + const { selectedKey } = this.state; let id = getQueryString("id"); this.setState({ currentId: id }); const { @@ -32,35 +34,40 @@ export default class PayrollGrant extends React.Component { } = this.props; getPayrollInfo(id); getInfoList({ - salarySendId: id + salarySendId: id, + isGranted: selectedKey !== "0" }); getPaySa(); } // 撤回 - handleWithdraw(record) { + handleWithdraw = (record) => { const { payrollStore } = this.props; + const { currentId, selectedKey } = this.state; const { withdrawPayroll, getInfoList } = payrollStore; withdrawPayroll({ ids: [record.id], - salarySendId: this.state.currentId + salarySendId: currentId }).then(() => { getInfoList({ - salarySendId: this.state.currentId + salarySendId: this.state.currentId, + isGranted: selectedKey !== "0" }); }); - } + }; // 发送 handleGrant(record) { const { payrollStore } = this.props; + const { currentId, selectedKey } = this.state; const { grantPayroll, getInfoList } = payrollStore; grantPayroll({ ids: [record.id], - salarySendId: this.state.currentId + salarySendId: currentId }).then(() => { getInfoList({ - salarySendId: this.state.currentId + salarySendId: currentId, + isGranted: selectedKey !== "0" }); }); } @@ -68,13 +75,15 @@ export default class PayrollGrant extends React.Component { // 全部发送 handleGrantAll() { const { payrollStore } = this.props; + const { currentId, selectedKey } = this.state; const { grantPayroll, getInfoList } = payrollStore; grantPayroll({ ids: [], - salarySendId: this.state.currentId + salarySendId: currentId }).then(() => { getInfoList({ - salarySendId: this.state.currentId + salarySendId: currentId, + isGranted: selectedKey !== "0" }); }); } @@ -82,29 +91,30 @@ export default class PayrollGrant extends React.Component { // 全部撤回 handleWithdrawAll() { const { payrollStore } = this.props; + const { currentId, selectedKey } = this.state; const { withdrawPayroll, getInfoList } = payrollStore; withdrawPayroll({ ids: [], - salarySendId: this.state.currentId + salarySendId: currentId }).then(() => { getInfoList({ - salarySendId: this.state.currentId + salarySendId: currentId, + isGranted: selectedKey !== "0" }); }); } - getColumns() { + getColumns = () => { const { payrollStore } = this.props; const { salaryGrantTableStore: columns } = payrollStore; - - let result = [ + return [ ...columns, { title: "操作", key: "operation", dataIndex: "operation" } ].map(item => { item = { ...item }; - if (item.dataIndex == "operation") { + if (item.dataIndex === "operation") { item.render = (text, record) => { - if (record.sendStatus == "已发放") { + if (record.sendStatus === "已发放") { return ( { @@ -127,8 +137,7 @@ export default class PayrollGrant extends React.Component { } return item; }); - return result; - } + }; getSearchsAdQuick() { const handleMenuClick = e => { @@ -149,36 +158,32 @@ export default class PayrollGrant extends React.Component { break; } }; - const menu = ( 批量发放 批量撤回 全部导出 导出选中 - {/* 自定义列 */} ); return [ - , - , - - 更多 - + , + , + + 更多 + ]; } @@ -192,7 +197,7 @@ export default class PayrollGrant extends React.Component { handleExportSelect = () => { const { selectedRowKeys, currentId } = this.state; const { payrollStore: { exportPayroll } } = this.props; - if (selectedRowKeys.length == 0) { + if (selectedRowKeys.length === 0) { message.warning("未选择条目"); return; } @@ -203,30 +208,36 @@ export default class PayrollGrant extends React.Component { }; // 分页 - handleDataPageChange(value) { + handleDataPageChange = (value) => { const { payrollStore: { getInfoList } } = this.props; + const { currentId, selectedKey } = this.state; getInfoList({ - salarySendId: this.state.currentId, + salarySendId: currentId, + isGranted: selectedKey !== "0", ...this.pageInfo }); - } + }; handleShowSizeChange(pageInfo) { const { payrollStore: { getInfoList } } = this.props; + const { currentId, selectedKey } = this.state; getInfoList({ - salarySendId: this.state.currentId, + salarySendId: currentId, + isGranted: selectedKey !== "0", ...pageInfo }); } - handleSearch=()=> { + handleSearch = () => { const { payrollStore: { getInfoList, setGrantListShowSearchAd } } = this.props; + const { currentId, selectedKey } = this.state; setGrantListShowSearchAd(false); getInfoList({ - salarySendId: this.state.currentId, + salarySendId: currentId, + isGranted: selectedKey !== "0", ...this.pageInfo }); - } + }; onSelectChange = value => { this.setState({ @@ -239,21 +250,21 @@ export default class PayrollGrant extends React.Component { const { salarySendDetailBaseInfo, salaryGrantDataSource, - getInfoList, grantListShowSearchAd, grantListConditionForm, grantListCondition, setGrantListShowSearchAd, - salaryGrantPageInfo + salaryGrantPageInfo, + getInfoList } = payrollStore; - const { selectedRowKeys } = this.state; + const { selectedRowKeys, selectedKey, currentId } = this.state; const rowSelection = { selectedRowKeys, onChange: this.onSelectChange }; const adBtn = [ // 高级搜索内部按钮 - , ]; + const topTab = [ + { + title: "未发送", + viewcondition: "0" + }, + { + title: "已发送", + viewcondition: "1" + } + ]; return (
+ this.setState({ selectedKey: v }, () => { + getInfoList({ + salarySendId: currentId, + isGranted: v !== "0" + }); + }) + } searchType={["base", "advanced"]} // base:基础搜索框 advanced:显示高级搜索按钮 searchsBasePlaceHolder="请输入姓名" showSearchAd={grantListShowSearchAd} // 是否展开高级搜索面板 setShowSearchAd={bool => setGrantListShowSearchAd(bool)} //高级搜索面板受控 - searchsAd={getSearchs( - grantListConditionForm, - toJS(grantListCondition), - 2 - )} // 高级搜索内部数据 + searchsAd={getSearchs(grantListConditionForm, toJS(grantListCondition), 2)} // 高级搜索内部数据 buttonsAd={adBtn} // 高级搜索内部按钮 onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 - // searchsAdQuick={this.getSearchsAdQuick()} - onSearchChange={v => - grantListConditionForm.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 + onSearchChange={v => grantListConditionForm.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 searchsBaseValue={grantListConditionForm.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 />
@@ -301,32 +327,7 @@ export default class PayrollGrant extends React.Component { } placement="topLeft" /> @@ -343,7 +344,6 @@ export default class PayrollGrant extends React.Component {
-
{ + const { salarySobCycle } = props; + const { salaryCycle = {}, attendCycle = {} } = salarySobCycle; + return
+
+

薪资周期

+

{salaryCycle.fromDate}{salaryCycle.endDate}

+
+
+

税款所属期

+

{salarySobCycle.taxCycle}

+
+
+

考勤取值周期

+

{attendCycle.fromDate}{attendCycle.endDate}

+
+
+

福利台账月份

+

{`引用${salarySobCycle.socialSecurityCycle}的福利台账数据`}

+
+
; +}; diff --git a/pc4mobx/hrmSalary/pages/payroll/stepForm/baseInformForm.js b/pc4mobx/hrmSalary/pages/payroll/stepForm/baseInformForm.js index dca4447e..ad172aed 100644 --- a/pc4mobx/hrmSalary/pages/payroll/stepForm/baseInformForm.js +++ b/pc4mobx/hrmSalary/pages/payroll/stepForm/baseInformForm.js @@ -60,7 +60,7 @@ export default class BaseInformForm extends React.Component { viewAttr={3} options={options} value={salarySob ? salarySob : ""} - style={{ width: "200px" }} + style={{ width: 200 }} onChange={value => this.hanldeChange({ salarySob: value })}/> } diff --git a/pc4mobx/hrmSalary/pages/payroll/templateSettingList.js b/pc4mobx/hrmSalary/pages/payroll/templateSettingList.js index a38b073f..1711e103 100644 --- a/pc4mobx/hrmSalary/pages/payroll/templateSettingList.js +++ b/pc4mobx/hrmSalary/pages/payroll/templateSettingList.js @@ -2,6 +2,7 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { Radio, Spin } from "antd"; import { WeaTableNew } from "comsMobx"; + const WeaTable = WeaTableNew.WeaTable; @inject("payrollStore") @@ -76,7 +77,7 @@ export default class TemplateSettingList extends React.Component { /> ); default: - return
; + return
; } }; return newColumn; @@ -91,15 +92,15 @@ export default class TemplateSettingList extends React.Component {
{loading ?
- -
+ +
: } + comsWeaTableStore={templateStore} // table store + hasOrder={true} // 是否启用排序 + needScroll={true} // 是否启用table内部列表滚动,将自适应到父级高度 + getColumns={this.getColumns} + onOperatesClick={this.onOperatesClick.bind(this)} + />}
); } diff --git a/pc4mobx/hrmSalary/stores/payroll.js b/pc4mobx/hrmSalary/stores/payroll.js index f5afac84..c54f25bb 100644 --- a/pc4mobx/hrmSalary/stores/payroll.js +++ b/pc4mobx/hrmSalary/stores/payroll.js @@ -1,4 +1,4 @@ -import { observable, action, toJS } from "mobx"; +import { action, observable } from "mobx"; import { message } from "antd"; import { WeaForm, WeaTableNew } from "comsMobx"; @@ -160,12 +160,12 @@ export class payrollStore { this.salarySobOptions = response.salarySobOptions ? response.salarySobOptions.map(item => { - let result = {}; - result.showname = item.name; - result.key = item.id + ""; - result.selected = false; - return result; - }) + let result = {}; + result.showname = item.name; + result.key = item.id + ""; + result.selected = false; + return result; + }) : []; resolve({ templateBaseData: this.templateBaseData, @@ -249,11 +249,12 @@ export class payrollStore { // 工资单模板-新建工资单模板 @action fetchSavePayroll = () => { - if (!this.validateSalaryTemplateShowSet()) { - return false; - } let params = this.convertParams(); return new Promise((resolve, reject) => { + if (!this.validateSalaryTemplateShowSet()) { + reject(); + return false; + } API.savePayroll(params).then(res => { if (res.status) { message.success("保存成功"); @@ -270,12 +271,13 @@ export class payrollStore { // 工资单模板-更新工资单模板 @action fetchUpdatePayroll = id => { - if (!this.validateSalaryTemplateShowSet()) { - return false; - } let params = this.convertParams(); params.id = id; return new Promise((resolve, reject) => { + if (!this.validateSalaryTemplateShowSet()) { + reject(); + return false; + } API.updatePayroll(params).then(res => { if (res.status) { message.success("保存成功"); @@ -453,7 +455,7 @@ export class payrollStore { API.exportDetailList(params); }; // 工资单发放-导出-工资单发放列表 - + @action exportPayroll = (params = {}) => { API.exportPayroll(params); From 5e23404b32ffb659cd798b345994d481ff5f75fe 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, 2 Dec 2022 16:12:11 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/customPaginationTable/index.js | 3 +- .../pages/payroll/payrollGrant/index.js | 192 +++++++++----- .../payrollGrant/payrollGrantDetail.js | 62 ----- .../payroll/payrollGrant/payrollGrantModal.js | 248 ------------------ .../payrollGrant/payrollWithdrawModal.js | 247 ----------------- 5 files changed, 131 insertions(+), 621 deletions(-) delete mode 100644 pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantDetail.js delete mode 100644 pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js delete mode 100644 pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js diff --git a/pc4mobx/hrmSalary/components/customPaginationTable/index.js b/pc4mobx/hrmSalary/components/customPaginationTable/index.js index c7192db2..72fcddd5 100644 --- a/pc4mobx/hrmSalary/components/customPaginationTable/index.js +++ b/pc4mobx/hrmSalary/components/customPaginationTable/index.js @@ -3,8 +3,7 @@ import CustomTable from "../../components/customTable"; class CustomPaginationTable extends PureComponent { shouldComponentUpdate(nextProps, nextState, nextContext) { - if (nextProps.columnIndex && this.props.columnIndex !== nextProps.columnIndex) return false; - return true; + return !(nextProps.columnIndex && this.props.columnIndex !== nextProps.columnIndex); } render() { diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js index 101a31b1..1a6092ca 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js @@ -1,15 +1,15 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; -import { WeaHelpfulTip, WeaTab, WeaTop } from "ecCom"; +import { WeaDropdown, WeaHelpfulTip, WeaTab, WeaTop } from "ecCom"; import { Button, Dropdown, Menu, message } from "antd"; import "./index.less"; -import PayrollGrantModal from "./payrollGrantModal"; -import PayrollWithdrawModal from "./payrollWithdrawModal"; import { getQueryString } from "../../../util/url"; import { getSearchs } from "../../../util"; import CustomPaginationTable from "../../../components/customPaginationTable"; +const { ButtonSelect } = WeaDropdown; + @inject("payrollStore") @observer export default class PayrollGrant extends React.Component { @@ -17,8 +17,6 @@ export default class PayrollGrant extends React.Component { super(props); this.state = { selectedRowKeys: [], - payrollGrantVisible: false, - payrollWithdrawVisible: false, currentId: "", selectedKey: "0" }; @@ -56,7 +54,7 @@ export default class PayrollGrant extends React.Component { }); }; - // 发送 + // 发放 handleGrant(record) { const { payrollStore } = this.props; const { currentId, selectedKey } = this.state; @@ -72,8 +70,64 @@ export default class PayrollGrant extends React.Component { }); } + /* + * Author: 黎永顺 + * Description:工资单发放 + * Params: + * Date: 2022/12/2 + */ + sendPayroll = (key) => { + const { selectedRowKeys, currentId } = this.state; + switch (key) { + case "ALL": + this.handleGrantAll(); + break; + case "SELECT": + if (selectedRowKeys.length === 0) { + message.warning("未选择发放条目"); + return; + } + this.fetchGrantPayRoll({ + ids: selectedRowKeys, + salarySendId: currentId + }); + break; + case "PART": + break; + default: + break; + } + }; + /* + * Author: 黎永顺 + * Description:工资单撤回 + * Params: + * Date: 2022/12/2 + */ + withdrawalPayroll = (key) => { + const { selectedRowKeys, currentId } = this.state; + switch (key) { + case "withdrawAll": + this.handleWithdrawAll(); + break; + case "recallSelected": + if (selectedRowKeys.length === 0) { + message.warning("未选择撤回条目"); + return; + } + this.fetchWithdrawPayroll({ + ids: selectedRowKeys, + salarySendId: currentId + }); + break; + case "partialWithdrawal": + break; + default: + break; + } + }; // 全部发送 - handleGrantAll() { + handleGrantAll = () => { const { payrollStore } = this.props; const { currentId, selectedKey } = this.state; const { grantPayroll, getInfoList } = payrollStore; @@ -86,7 +140,19 @@ export default class PayrollGrant extends React.Component { isGranted: selectedKey !== "0" }); }); - } + }; + // 发放所选 + fetchGrantPayRoll = (payload) => { + const { selectedKey, currentId } = this.state; + const { payrollStore: { grantPayroll, getInfoList } } = this.props; + grantPayroll(payload).then(() => { + getInfoList({ + salarySendId: currentId, + isGranted: selectedKey !== "0" + }); + this.setState({ selectedRowKeys: [] }); + }); + }; // 全部撤回 handleWithdrawAll() { @@ -104,19 +170,34 @@ export default class PayrollGrant extends React.Component { }); } + // 撤回所选 + fetchWithdrawPayroll = (payload) => { + const { payrollStore: { withdrawPayroll, getInfoList } } = this.props; + const { currentId, selectedKey } = this.state; + withdrawPayroll(payload).then(() => { + getInfoList({ + salarySendId: currentId, + isGranted: selectedKey !== "0" + }); + this.setState({ selectedRowKeys: [] }); + }); + }; + getColumns = () => { const { payrollStore } = this.props; const { salaryGrantTableStore: columns } = payrollStore; return [ - ...columns, - { title: "操作", key: "operation", dataIndex: "operation" } - ].map(item => { - item = { ...item }; - if (item.dataIndex === "operation") { - item.render = (text, record) => { + ...toJS(columns), + { + title: "操作", + key: "", + dataIndex: "", + display: true, + render: (text, record) => { if (record.sendStatus === "已发放") { return (
{ this.handleWithdraw(record); }}> @@ -126,28 +207,23 @@ export default class PayrollGrant extends React.Component { } else { return ( { this.handleGrant(record); }}> - 发送 + 发放 ); } - }; + } } - return item; - }); + ]; }; getSearchsAdQuick() { + const { selectedKey } = this.state; const handleMenuClick = e => { switch (e.key) { - case "1": - this.setState({ payrollGrantVisible: true }); - break; - case "2": - this.setState({ payrollWithdrawVisible: true }); - break; case "3": this.handleExportAll(); break; @@ -160,31 +236,43 @@ export default class PayrollGrant extends React.Component { }; const menu = ( - 批量发放 - 批量撤回 全部导出 导出选中 ); - return [ - , - , + let btnDom = [ 更多 ]; + if (selectedKey === "0") { + btnDom = [ + this.sendPayroll(key)} + />, + ...btnDom + ]; + } else { + btnDom = [ + this.withdrawalPayroll(key)} + />, + ...btnDom + ]; + } + return btnDom; } handleExportAll = () => { @@ -193,7 +281,6 @@ export default class PayrollGrant extends React.Component { salarySendId: this.state.currentId }); }; - handleExportSelect = () => { const { selectedRowKeys, currentId } = this.state; const { payrollStore: { exportPayroll } } = this.props; @@ -206,7 +293,6 @@ export default class PayrollGrant extends React.Component { salarySendId: currentId }); }; - // 分页 handleDataPageChange = (value) => { const { payrollStore: { getInfoList } } = this.props; @@ -363,30 +449,12 @@ export default class PayrollGrant extends React.Component { }} />
- {this.state.payrollGrantVisible && - { - this.setState({ payrollGrantVisible: false }); - }} - />} - - {this.state.payrollWithdrawVisible && - { - this.setState({ payrollWithdrawVisible: false }); - }} - />}
); } } - -const TitleHelp = (props) => { +export const TitleHelp = (props) => { const { salarySobCycle } = props; const { salaryCycle = {}, attendCycle = {} } = salarySobCycle; return
diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantDetail.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantDetail.js deleted file mode 100644 index abe3003f..00000000 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantDetail.js +++ /dev/null @@ -1,62 +0,0 @@ -import React from 'react' -import { payrollGrantDetailColumns, dataSource} from '../columns' - -export default class PayrollGrantDeatail extends React.Component { - - - render() { - const handleMenuClick = () => { - - } - const menu = ( - - 导出选中 - - ); - const renderRightOperation = () => { - return ( -
- 导出全部 - -
- ) - } - return ( -
- -
-
- 薪资所属月:2021-11 - - 工资单模板:上海泛微工资单1 -
- -
- 已发放:111/1111 - 未确认:111 -
-
- -
- - - - ) - } -} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js deleted file mode 100644 index afb49d94..00000000 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js +++ /dev/null @@ -1,248 +0,0 @@ -import React from "react"; -import { WeaDialog, WeaHelpfulTip, WeaInputSearch, WeaTable } from "ecCom"; -import { Dropdown, Menu, message } from "antd"; -import { inject, observer } from "mobx-react"; -import "./index.less"; - -@inject("payrollStore") -@observer -export default class payrollGrantModal extends React.Component { - constructor(props) { - super(props); - this.state = { - selectedRowKeys: [], - current: 1, - searchValue: "" - }; - } - - // 撤回 - handleWithdraw(record) { - const { payrollStore } = this.props; - const { withdrawPayroll, batchSendInfoList } = payrollStore; - withdrawPayroll({ - ids: [record.id], - salarySendId: this.props.sendId - }).then(() => { - batchSendInfoList({ salarySendId: this.props.sendId }); - }); - } - - // 发送 - handleGrant(record) { - const { payrollStore } = this.props; - const { grantPayroll, batchSendInfoList } = payrollStore; - grantPayroll({ - ids: [record.id], - salarySendId: this.props.sendId - }).then(() => { - batchSendInfoList({ salarySendId: this.props.sendId }); - }); - } - - componentWillMount() { - const { payrollStore: { batchSendInfoList } } = this.props; - batchSendInfoList({ salarySendId: this.props.sendId }); - } - - getColumns() { - const { payrollStore } = this.props; - const { canGrantColumns } = payrollStore; - return [ - ...canGrantColumns, - { title: "操作", key: "operation", dataIndex: "operation" } - ].map(item => { - if (item.key == "operation") { - item.render = (text, record) => { - if (record.sendStatus == "已发放") { - return ( - { - this.handleWithdraw(record); - }}> - 撤回 - - ); - } else { - return ( - { - this.handleGrant(record); - }}> - 发送 - - ); - } - }; - } - return item; - }); - } - - onSelectChange = value => { - this.setState({ - selectedRowKeys: value - }); - }; - - // 发放 - fetchGrantPayRoll(payload) { - const { payrollStore: { grantPayroll } } = this.props; - grantPayroll(payload).then(() => { - const { payrollStore: { getInfoList } } = this.props; - getInfoList({ - salarySendId: this.props.sendId - }); - this.props.onCancel && this.props.onCancel(); - }); - } - - handleMenuClick(e) { - const { selectedRowKeys } = this.state; - const { payrollStore: { grantPayroll } } = this.props; - if (selectedRowKeys.length == 0) { - message.warning("未选择条目"); - return; - } - this.fetchGrantPayRoll({ - ids: selectedRowKeys, - salarySendId: this.props.sendId - }); - } - - handleGrantAll() { - this.fetchGrantPayRoll({ salarySendId: this.props.sendId }); - } - - handleSearch(value) { - const { payrollStore: { batchSendInfoList } } = this.props; - batchSendInfoList({ - salarySendId: this.props.sendId, - keyword: value, - current: this.state.current - }); - } - - // 分页 - handleDataPageChange(value) { - this.setState({ current: value }); - const { payrollStore: { batchSendInfoList } } = this.props; - batchSendInfoList({ salarySendId: this.props.sendId, current: value }); - } - - render() { - const menu = ( - this.handleMenuClick(e)}> - 发放所选 - - ); - - const { payrollStore } = this.props; - const { - salarySendDetailBaseInfo, - canGrantDataSource, - canGrantPageInfo - } = payrollStore; - const { selectedRowKeys } = this.state; - - const rowSelection = { - selectedRowKeys, - onChange: this.onSelectChange.bind(this) - }; - - return ( - { - this.handleGrantAll(); - }}> - 全部发放 - - ]} - onCancel={() => { - this.props.onCancel(); - }}> -
-
-
- - 薪资所属月:{salarySendDetailBaseInfo.salaryMonth && - salarySendDetailBaseInfo.salaryMonth - .year}-{salarySendDetailBaseInfo.salaryMonth && - salarySendDetailBaseInfo.salaryMonth.monthValue} - - - - 工资单模板:{salarySendDetailBaseInfo.template} - -
- { - this.setState({ searchValue: value }); - }} - placeholder="请输入姓名" - onSearch={value => { - this.handleSearch(value); - }} - /> -
-
- { - this.handleDataPageChange(value); - }, - total: canGrantPageInfo.total, - current: canGrantPageInfo.pageNum, - showTotal: total => `共 ${total} 条` - }} - /> -
-
-
- ); - } -} diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js deleted file mode 100644 index 5553b78a..00000000 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js +++ /dev/null @@ -1,247 +0,0 @@ -import React from "react"; -import { WeaDialog, WeaHelpfulTip, WeaInputSearch, WeaTable } from "ecCom"; -import { Dropdown, Menu } from "antd"; -import { inject, observer } from "mobx-react"; - -@inject("payrollStore") -@observer -export default class PayrollWithdrawModal extends React.Component { - constructor(props) { - super(props); - this.state = { - selectedRowKeys: [], - current: 1 - }; - } - - componentWillMount() { - const { payrollStore } = this.props; - const { batchWithdrawInfoList } = payrollStore; - batchWithdrawInfoList({ salarySendId: this.props.sendId }); - } - - // 撤回 - handleWithdraw(record) { - const { payrollStore } = this.props; - const { withdrawPayroll, batchWithdrawInfoList } = payrollStore; - withdrawPayroll({ - ids: [record.id], - salarySendId: this.props.sendId - }).then(() => { - batchWithdrawInfoList({ salarySendId: this.props.sendId }); - }); - } - - // 发送 - handleGrant(record) { - const { payrollStore } = this.props; - const { grantPayroll, batchWithdrawInfoList } = payrollStore; - grantPayroll({ - ids: [record.id], - salarySendId: this.props.sendId - }).then(() => { - batchWithdrawInfoList({ salarySendId: this.props.sendId }); - }); - } - - getColumns() { - const { payrollStore } = this.props; - const { canWidthdrawColumns } = payrollStore; - return [ - ...canWidthdrawColumns, - { title: "操作", key: "operation", dataIndex: "operation" } - ].map(item => { - if (item.key == "operation") { - item.render = (text, record) => { - if (record.sendStatus == "已发放") { - return ( - { - this.handleWithdraw(record); - }}> - 撤回 - - ); - } else { - return ( - { - this.handleGrant(record); - }}> - 发送 - - ); - } - }; - } - return item; - }); - } - - onSelectChange = value => { - this.setState({ - selectedRowKeys: value - }); - }; - - // 撤回 - fetchWithdrawPayroll(payload) { - const { payrollStore: { grantPayroll, withdrawPayroll } } = this.props; - withdrawPayroll(payload).then(() => { - const { payrollStore: { getInfoList } } = this.props; - getInfoList({ - salarySendId: this.props.sendId - }); - this.props.onCancel && this.props.onCancel(); - }); - } - - handleMenuClick(e) { - const { selectedRowKeys } = this.state; - const { payrollStore: { grantPayroll } } = this.props; - if (selectedRowKeys.length == 0) { - message.warning("未选择条目"); - return; - } - this.fetchWithdrawPayroll({ - ids: selectedRowKeys, - salarySendId: this.props.sendId - }); - } - - handleWithdrawAll() { - this.fetchWithdrawPayroll({ salarySendId: this.props.sendId }); - } - - // 分页 - handleDataPageChange(value) { - this.setState({ current: value }); - const { payrollStore } = this.props; - const { batchWithdrawInfoList } = payrollStore; - batchWithdrawInfoList({ salarySendId: this.props.sendId, current: value }); - } - - handleSearch(value) { - const { payrollStore: { batchWithdrawInfoList } } = this.props; - batchWithdrawInfoList({ - salarySendId: this.props.sendId, - keyword: value, - current: this.state.current - }); - } - - render() { - const menu = ( - this.handleMenuClick(e)}> - 撤回所选 - - ); - const { payrollStore } = this.props; - const { - salarySendDetailBaseInfo, - canWidthdrawColumns, - canWithdrawDataSource, - canWithdrawPageInfo - } = payrollStore; - const { selectedRowKeys } = this.state; - const rowSelection = { - selectedRowKeys, - onChange: this.onSelectChange.bind(this) - }; - - return ( - { - this.handleWithdrawAll(); - }}> - 全部撤回 - - ]} - onCancel={() => { - this.props.onCancel(); - }}> -
-
-
- - 薪资所属月:{salarySendDetailBaseInfo.salaryMonth && - salarySendDetailBaseInfo.salaryMonth - .year}-{salarySendDetailBaseInfo.salaryMonth && - salarySendDetailBaseInfo.salaryMonth.monthValue} - - - - 工资单模板:{salarySendDetailBaseInfo.template} - -
- { - this.setState({ searchValue: value }); - }} - onSearch={value => { - this.handleSearch(value); - }} - /> -
-
-
- { - this.handleDataPageChange(value); - }, - total: canWithdrawPageInfo.total, - current: canWithdrawPageInfo.pageNum, - showTotal: total => `共 ${total} 条` - }} - /> -
-
- ); - } -} From 41c400c329f075a1f77664f2e6a46221105c4959 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, 2 Dec 2022 16:42:58 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/payroll/payrollGrant/index.js | 38 +++- .../pages/payroll/payrollGrant/index.less | 46 ++++- .../payroll/payrollGrant/payrollPartModal.js | 191 ++++++++++++++++++ .../payroll/payrollGrant/payrollPartTable.js | 44 ++++ 4 files changed, 311 insertions(+), 8 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartModal.js create mode 100644 pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js index 1a6092ca..00e7e9cd 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js @@ -7,6 +7,7 @@ import "./index.less"; import { getQueryString } from "../../../util/url"; import { getSearchs } from "../../../util"; import CustomPaginationTable from "../../../components/customPaginationTable"; +import PayrollPartTable from "./payrollPartTable"; const { ButtonSelect } = WeaDropdown; @@ -18,7 +19,11 @@ export default class PayrollGrant extends React.Component { this.state = { selectedRowKeys: [], currentId: "", - selectedKey: "0" + selectedKey: "0", + payrollPartModalParams: { + visible: false, + title: "工资单发放" + } }; this.pageInfo = { current: 1, pageSize: 10 }; } @@ -77,7 +82,7 @@ export default class PayrollGrant extends React.Component { * Date: 2022/12/2 */ sendPayroll = (key) => { - const { selectedRowKeys, currentId } = this.state; + const { selectedRowKeys, currentId, payrollPartModalParams } = this.state; switch (key) { case "ALL": this.handleGrantAll(); @@ -93,6 +98,12 @@ export default class PayrollGrant extends React.Component { }); break; case "PART": + this.setState({ + payrollPartModalParams: { + ...payrollPartModalParams, + visible: true + } + }); break; default: break; @@ -105,7 +116,7 @@ export default class PayrollGrant extends React.Component { * Date: 2022/12/2 */ withdrawalPayroll = (key) => { - const { selectedRowKeys, currentId } = this.state; + const { selectedRowKeys, currentId, payrollPartModalParams } = this.state; switch (key) { case "withdrawAll": this.handleWithdrawAll(); @@ -121,6 +132,13 @@ export default class PayrollGrant extends React.Component { }); break; case "partialWithdrawal": + this.setState({ + payrollPartModalParams: { + ...payrollPartModalParams, + visible: true, + title: "工资单撤回" + } + }); break; default: break; @@ -331,6 +349,17 @@ export default class PayrollGrant extends React.Component { }); }; + handleClose = () => { + const { payrollPartModalParams } = this.state; + this.setState({ + payrollPartModalParams: { + ...payrollPartModalParams, + visible: false, + title: "工资单发放" + } + }); + }; + render() { const { payrollStore } = this.props; const { @@ -343,7 +372,7 @@ export default class PayrollGrant extends React.Component { salaryGrantPageInfo, getInfoList } = payrollStore; - const { selectedRowKeys, selectedKey, currentId } = this.state; + const { selectedRowKeys, selectedKey, currentId, payrollPartModalParams } = this.state; const rowSelection = { selectedRowKeys, onChange: this.onSelectChange @@ -449,6 +478,7 @@ export default class PayrollGrant extends React.Component { }} /> + ); } diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.less b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.less index 1d96b7c2..9699454a 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.less +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.less @@ -3,31 +3,69 @@ height: 47px; line-height: 47px; padding: 0 10px; + .titleBarLeft { float: left; } + .titleBarRight { float: right; } } + .tableWrapper { height: calc(100vh - 180.22px); overflow: auto; } } -.batchReleaseWrapper{ - .ant-modal-footer button{ +.batchReleaseWrapper { + .ant-modal-footer button { margin-right: 0 !important; } - .searchWrapper{ + + .searchWrapper { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; } - .tableWrpper{ + + .tableWrpper { max-height: 500px; overflow-y: auto; } } + +.payrollPartModalWrapper { + .wea-select, .ant-select-selection, .ant-select { + width: 100%; + } + + .wea-select { + display: inline-block; + position: relative; + } + + .ant-select-selection { + height: 30px; + border-radius: 0; + } +} + +.payrollPartTableModalWrapper { + .titleWrapper { + display: flex; + align-items: center; + justify-content: space-between; + + .rightBtnlist { + display: flex; + align-items: center; + + button { + margin-right: 10px; + } + } + } +} diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartModal.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartModal.js new file mode 100644 index 00000000..09325d3a --- /dev/null +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartModal.js @@ -0,0 +1,191 @@ +/* + * Author: 黎永顺 + * name: 工资单部分发放和撤回 + * Description: + * Date: 2022/12/2 + */ +import React, { Component } from "react"; +import { WeaBrowser, WeaDialog, WeaFormItem, WeaSearchGroup, WeaSelect } from "ecCom"; +import { Button, message, Modal } from "antd"; +import { getTaxAgentRangeForm, taxAgentRangeSave } from "../../../apis/taxAgent"; +import { SelectWithAll } from "../../socialSecurityBenefits/standingBookDetail/components/regAddEmployee"; +import "./index.less"; + +class PayrollPartModal extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + employeeStatus: [], + targetTypeList: [], + targetType: "EMPLOYEE", + targetTypeIds: "", + targetTypeIdsNames: "", + status: "", + statusAll: "" + }; + } + + componentDidMount() { + this.getTaxAgentRangeForm(); + } + + getTaxAgentRangeForm = () => { + getTaxAgentRangeForm().then(({ status, data }) => { + if (status) { + const { employeeStatus, targetTypeList } = data; + this.setState({ + targetTypeList: _.map(targetTypeList, it => ({ key: it.id, showname: it.name })), + employeeStatus: _.map(employeeStatus, it => ({ key: it.id, showname: it.name })) + }); + } + }); + }; + taxAgentRangeSave = () => { + const { status, targetTypeIds, targetType } = this.state; + const { includeType, taxAgentId, onSuccess, onCancel } = this.props; + if (_.isEmpty(status) || _.isEmpty(targetTypeIds)) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); + return; + } + const payload = { + employeeStatus: status.split(","), + includeType, + targetParams: _.map(targetTypeIds.split(","), it => ({ targetType, targetId: it })), + taxAgentId + }; + this.setState({ loading: true }); + taxAgentRangeSave(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success("保存成功"); + this.handleReset(); + onSuccess(); + onCancel(); + } else { + message.error(errormsg || "保存失败"); + } + }).catch(() => this.setState({ loading: true })); + }; + renderBrowser = () => { + const { targetType, targetTypeIds, targetTypeIdsNames } = this.state; + let browserType = {}; + switch (targetType) { + case "EMPLOYEE": + browserType = { ...browserType, type: 17, title: "人员选择" }; + break; + case "DEPT": + browserType = { ...browserType, type: 57, title: "部门选择" }; + break; + case "SUBCOMPANY": + browserType = { ...browserType, type: 164, title: "分部选择" }; + break; + case "POSITION": + browserType = { ...browserType, type: 278, title: "岗位选择" }; + break; + default: + break; + } + return { + this.setState({ targetTypeIds, targetTypeIdsNames }); + }} + />; + }; + handleReset = () => { + this.setState({ + targetType: "EMPLOYEE", + targetTypeIds: "", + status: "", + statusAll: "" + }); + }; + + render() { + const { onCancel, title, visible } = this.props; + const { employeeStatus, targetTypeList, targetType, status, statusAll, loading } = this.state; + const buttons = [ + , + + ]; + return ( + { + this.handleReset(); + onCancel(); + }} + > + + +
+ this.setState({ targetType })} + /> + {this.renderBrowser()} +
+
+ { + SelectWithAll({ + label: "选择员工状态", + options: employeeStatus, + detailtype: 2, + valueAll: statusAll, + value: status, + onChangeAll: ({ selected }) => { + if (selected) { + this.setState({ + status: _.map(employeeStatus, it => it.key).join(","), + statusAll: selected + }); + } else { + this.setState({ + status: "", + statusAll: selected + }); + } + }, + onChange: ({ selected }) => { + const bool = _.every(_.map(employeeStatus, it => it.key), item => selected.split(",").includes(item)); + if (bool) { + this.setState({ + status: selected, + statusAll: "0" + }); + } else { + this.setState({ + status: selected, + statusAll: "" + }); + } + } + }) + } +
+
+ ); + } +} + +export default PayrollPartModal; diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js new file mode 100644 index 00000000..52d66f54 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js @@ -0,0 +1,44 @@ +/* + * Author: 黎永顺 + * name: 工资单发放撤回弹框列表 + * Description: + * Date: 2022/12/2 + */ +import React, { Component } from "react"; +import { Button } from "antd"; +import { WeaDialog } from "ecCom"; + +// import PayrollPartModal from "./payrollPartModal"; + +class PayrollPartTable extends Component { + renderTitle = () => { + const { title } = this.props; + return
+
{title}
+
+ +
+
; + }; + + render() { + const { onCancel, visible } = this.props; + return ( + + {/**/} + + ); + } +} + +export default PayrollPartTable; From 29abd303af042c8616bcd2cf7c09ff118f395952 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, 2 Dec 2022 16:52:35 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=951?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../payroll/payrollGrant/payrollPartTable.js | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js index 52d66f54..1e3c6e8f 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js @@ -6,17 +6,39 @@ */ import React, { Component } from "react"; import { Button } from "antd"; -import { WeaDialog } from "ecCom"; +import { WeaButtonIcon, WeaDialog, WeaInputSearch } from "ecCom"; // import PayrollPartModal from "./payrollPartModal"; - class PayrollPartTable extends Component { + constructor(props) { + super(props); + this.state = { + searchValue: "", + dialogVisible: false + }; + } + renderTitle = () => { const { title } = this.props; + const { searchValue } = this.state; return
{title}
- + + + + this.setState({ searchValue })} + placeholder="请输入方案名称" + onSearch={() => { + }} + />
; }; @@ -30,11 +52,10 @@ class PayrollPartTable extends Component { onCancel={onCancel} title={this.renderTitle()} visible={visible} - style={{ width: 1500, height: 800 }} + style={{ width: 700 }} hasScroll - url="http://localhost:8999/spa/coms/index-demo.html#/coms?id=WeaDialog&_key=tzsm8d" - // url='http://localhost:8999/#/coms?id=WeaForm&_key=ejvf84' > + {/**/} ); From 479cea2967e7c4ce8f17c8611688086fc2ed78a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Sat, 3 Dec 2022 17:23:43 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=95=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=8F=91=E6=94=BE=E5=92=8C=E9=83=A8=E5=88=86=E6=92=A4?= =?UTF-8?q?=E5=9B=9E=E5=8A=9F=E8=83=BD=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/payroll.js | 14 + .../pages/payroll/payrollGrant/index.js | 39 ++- .../payroll/payrollGrant/payrollPartModal.js | 304 ++++++++++++------ .../payroll/payrollGrant/payrollPartTable.js | 202 ++++++++++-- 4 files changed, 405 insertions(+), 154 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/payroll.js b/pc4mobx/hrmSalary/apis/payroll.js index 954050e9..c4182a0a 100644 --- a/pc4mobx/hrmSalary/apis/payroll.js +++ b/pc4mobx/hrmSalary/apis/payroll.js @@ -1,4 +1,5 @@ import { WeaTools } from "ecCom"; +import { postFetch } from "../util/request"; //工资单-工资单发放列表 export const getPayrollList = params => { @@ -313,3 +314,16 @@ export const grantProxy = params => { body: JSON.stringify(params) }).then(res => res.json()); }; + +//添加发送和撤回人员范围列表 +export const sendRangeList = (params) => { + return postFetch('/api/bs/hrmsalary/salaryBill/send/range/list', params); +} +//创建范围 +export const sendRangeSave = (params) => { + return postFetch('/api/bs/hrmsalary/salaryBill/send/range/save', params); +} +//刪除范围 +export const sendRangeDelete = (params) => { + return postFetch('/api/bs/hrmsalary/salaryBill/send/range/delete', params); +} diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js index 00e7e9cd..6bf91113 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js @@ -22,7 +22,9 @@ export default class PayrollGrant extends React.Component { selectedKey: "0", payrollPartModalParams: { visible: false, - title: "工资单发放" + title: "工资单发放", + grantType: "", + salarySendId: "" } }; this.pageInfo = { current: 1, pageSize: 10 }; @@ -49,31 +51,33 @@ export default class PayrollGrant extends React.Component { const { currentId, selectedKey } = this.state; const { withdrawPayroll, getInfoList } = payrollStore; withdrawPayroll({ - ids: [record.id], + ...record, salarySendId: currentId }).then(() => { getInfoList({ salarySendId: this.state.currentId, isGranted: selectedKey !== "0" }); + this.handleClose(); }); }; // 发放 - handleGrant(record) { + handleGrant = (record) => { const { payrollStore } = this.props; const { currentId, selectedKey } = this.state; const { grantPayroll, getInfoList } = payrollStore; grantPayroll({ - ids: [record.id], + ...record, salarySendId: currentId }).then(() => { getInfoList({ salarySendId: currentId, isGranted: selectedKey !== "0" }); + this.handleClose(); }); - } + }; /* * Author: 黎永顺 @@ -101,6 +105,8 @@ export default class PayrollGrant extends React.Component { this.setState({ payrollPartModalParams: { ...payrollPartModalParams, + salarySendId: currentId, + grantType: "grant", visible: true } }); @@ -136,7 +142,9 @@ export default class PayrollGrant extends React.Component { payrollPartModalParams: { ...payrollPartModalParams, visible: true, - title: "工资单撤回" + title: "工资单撤回", + salarySendId: currentId, + grantType: "withdraw" } }); break; @@ -216,9 +224,7 @@ export default class PayrollGrant extends React.Component { return ( { - this.handleWithdraw(record); - }}> + onClick={() => this.handleWithdraw({ ids: [record.id] })}> 撤回 ); @@ -226,9 +232,7 @@ export default class PayrollGrant extends React.Component { return ( { - this.handleGrant(record); - }}> + onClick={() => this.handleGrant({ ids: [record.id] })}> 发放 ); @@ -355,7 +359,9 @@ export default class PayrollGrant extends React.Component { payrollPartModalParams: { ...payrollPartModalParams, visible: false, - title: "工资单发放" + title: "工资单发放", + grantType: "", + salarySendId: "" } }); }; @@ -478,7 +484,12 @@ export default class PayrollGrant extends React.Component { }} /> - + ); } diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartModal.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartModal.js index 09325d3a..766fc73f 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartModal.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartModal.js @@ -5,114 +5,234 @@ * Date: 2022/12/2 */ import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; import { WeaBrowser, WeaDialog, WeaFormItem, WeaSearchGroup, WeaSelect } from "ecCom"; import { Button, message, Modal } from "antd"; -import { getTaxAgentRangeForm, taxAgentRangeSave } from "../../../apis/taxAgent"; -import { SelectWithAll } from "../../socialSecurityBenefits/standingBookDetail/components/regAddEmployee"; +import { commonEnumList } from "../../../apis/ruleconfig"; +import { sendRangeSave } from "../../../apis/payroll"; import "./index.less"; +@inject("taxAgentStore") +@observer class PayrollPartModal extends Component { constructor(props) { super(props); this.state = { loading: false, - employeeStatus: [], targetTypeList: [], - targetType: "EMPLOYEE", - targetTypeIds: "", - targetTypeIdsNames: "", - status: "", - statusAll: "" + personalAddItem: [ + { + viewAttr: 3, + key: "include", + label: "对象", + targetType: "1", + targetTypeIds: "", + targetTypeIdsNames: "" + }, + { + viewAttr: 2, + key: "exclude", + label: "对象中排除", + targetType: "1", + targetTypeIds: "", + targetTypeIdsNames: "" + } + ] }; } componentDidMount() { - this.getTaxAgentRangeForm(); + const { taxAgentStore } = this.props; + const { getTaxAgentSelectListAsAdmin } = taxAgentStore; + getTaxAgentSelectListAsAdmin(); } - getTaxAgentRangeForm = () => { - getTaxAgentRangeForm().then(({ status, data }) => { + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible) { + nextProps.visible && this.orderRuleEnum(); + } + } + + orderRuleEnum = () => { + const payload = { + enumClass: "com.engine.salary.enums.salarysend.SalarySendRangeTargetTypeEnum" + }; + commonEnumList(payload).then(({ status, data }) => { if (status) { - const { employeeStatus, targetTypeList } = data; this.setState({ - targetTypeList: _.map(targetTypeList, it => ({ key: it.id, showname: it.name })), - employeeStatus: _.map(employeeStatus, it => ({ key: it.id, showname: it.name })) + targetTypeList: _.map(data, item => { + return { + key: item.value.toString(), + showname: item.defaultLabel + }; + }) }); } }); }; taxAgentRangeSave = () => { - const { status, targetTypeIds, targetType } = this.state; - const { includeType, taxAgentId, onSuccess, onCancel } = this.props; - if (_.isEmpty(status) || _.isEmpty(targetTypeIds)) { + const { grantType, salarySendId, onCancel } = this.props; + const { personalAddItem } = this.state; + let excludeObjParams = [], includeObjParams = []; + if ( + _.find(personalAddItem, item => item.viewAttr === 3).targetType !== "0" && + _.isEmpty(_.find(personalAddItem, item => item.viewAttr === 3).targetTypeIds) + ) { Modal.warning({ title: "信息确认", content: "必要信息不完整,红色*为必填项!" }); return; } + _.map(personalAddItem, it => { + const { key, targetType, targetTypeIds } = it; + if (key === "include") { + if (targetType === "0") { + includeObjParams = [{ targetType, targetId: "" }]; + } else { + if (targetTypeIds) { + includeObjParams = _.map(targetTypeIds.split(","), child => ({ + targetType, targetId: child + })); + } + } + } else if (key === "exclude") { + if (targetType === "0") { + excludeObjParams = [{ targetType, targetId: "" }]; + } else { + if (targetTypeIds) { + excludeObjParams = _.map(targetTypeIds.split(","), child => ({ + targetType, targetId: child + })); + } + } + } + }); const payload = { - employeeStatus: status.split(","), - includeType, - targetParams: _.map(targetTypeIds.split(","), it => ({ targetType, targetId: it })), - taxAgentId + grantType, salarySendId, + excludeObjParams, includeObjParams }; this.setState({ loading: true }); - taxAgentRangeSave(payload).then(({ status, errormsg }) => { + sendRangeSave(payload).then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { message.success("保存成功"); this.handleReset(); - onSuccess(); onCancel(); } else { message.error(errormsg || "保存失败"); } - }).catch(() => this.setState({ loading: true })); + }).catch(() => this.setState({ loading: false })); }; - renderBrowser = () => { - const { targetType, targetTypeIds, targetTypeIdsNames } = this.state; + handleChange = (type, value) => { + const { personalAddItem } = this.state; + this.setState({ + personalAddItem: _.map(personalAddItem, it => { + if (it.key === type) { + return { + ...it, + targetType: value, + targetTypeIds: "" + }; + } + return { ...it }; + }) + }); + }; + renderBrowser = (item) => { + const { personalAddItem } = this.state; + const { taxAgentStore } = this.props; + const { targetType, targetTypeIds, targetTypeIdsNames, key, viewAttr } = item; let browserType = {}; - switch (targetType) { - case "EMPLOYEE": - browserType = { ...browserType, type: 17, title: "人员选择" }; - break; - case "DEPT": - browserType = { ...browserType, type: 57, title: "部门选择" }; - break; - case "SUBCOMPANY": - browserType = { ...browserType, type: 164, title: "分部选择" }; - break; - case "POSITION": - browserType = { ...browserType, type: 278, title: "岗位选择" }; - break; - default: - break; + if (targetType === "5") { + return { + this.setState({ + personalAddItem: _.map(personalAddItem, it => { + if (it.key === key) { + return { + ...it, + targetTypeIds, targetTypeIdsNames + }; + } + return { ...it }; + }) + }); + }} + />; + } else if (targetType === "0") { + return null; + } else { + switch (targetType) { + case "1": + browserType = { ...browserType, type: 17, title: "人员选择" }; + break; + case "2": + browserType = { ...browserType, type: 57, title: "部门选择" }; + break; + case "3": + browserType = { ...browserType, type: 164, title: "分部选择" }; + break; + case "4": + browserType = { ...browserType, type: 278, title: "岗位选择" }; + break; + default: + break; + } + return { + this.setState({ + personalAddItem: _.map(personalAddItem, it => { + if (it.key === key) { + return { + ...it, + targetTypeIds, targetTypeIdsNames + }; + } + return { ...it }; + }) + }); + }} + />; } - return { - this.setState({ targetTypeIds, targetTypeIdsNames }); - }} - />; }; handleReset = () => { this.setState({ - targetType: "EMPLOYEE", - targetTypeIds: "", - status: "", - statusAll: "" + personalAddItem: [ + { + viewAttr: 3, + key: "include", + label: "对象", + targetType: "1", + targetTypeIds: "", + targetTypeIdsNames: "" + }, + { + viewAttr: 2, + key: "exclude", + label: "对象中排除", + targetType: "1", + targetTypeIds: "", + targetTypeIdsNames: "" + } + ] }); }; render() { - const { onCancel, title, visible } = this.props; - const { employeeStatus, targetTypeList, targetType, status, statusAll, loading } = this.state; + const { onCancel, visible } = this.props; + const { targetTypeList, personalAddItem, loading } = this.state; const buttons = [ , @@ -121,7 +241,7 @@ class PayrollPartModal extends Component { - -
- this.setState({ targetType })} - /> - {this.renderBrowser()} -
-
{ - SelectWithAll({ - label: "选择员工状态", - options: employeeStatus, - detailtype: 2, - valueAll: statusAll, - value: status, - onChangeAll: ({ selected }) => { - if (selected) { - this.setState({ - status: _.map(employeeStatus, it => it.key).join(","), - statusAll: selected - }); - } else { - this.setState({ - status: "", - statusAll: selected - }); - } - }, - onChange: ({ selected }) => { - const bool = _.every(_.map(employeeStatus, it => it.key), item => selected.split(",").includes(item)); - if (bool) { - this.setState({ - status: selected, - statusAll: "0" - }); - } else { - this.setState({ - status: selected, - statusAll: "" - }); - } - } + _.map(personalAddItem, it => { + const { targetType, key, label } = it; + return +
+ this.handleChange(key, v)} + /> + {this.renderBrowser(it)} +
+
; }) }
diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js index 1e3c6e8f..e7b6588d 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollPartTable.js @@ -5,61 +5,197 @@ * Date: 2022/12/2 */ import React, { Component } from "react"; -import { Button } from "antd"; -import { WeaButtonIcon, WeaDialog, WeaInputSearch } from "ecCom"; +import { Button, message, Modal } from "antd"; +import { WeaButtonIcon, WeaDialog, WeaInputSearch, WeaTable } from "ecCom"; +import { sendRangeDelete, sendRangeList } from "../../../apis/payroll"; +import { calcPageNo } from "../../../util"; +import PayrollPartModal from "./payrollPartModal"; -// import PayrollPartModal from "./payrollPartModal"; class PayrollPartTable extends Component { constructor(props) { super(props); this.state = { searchValue: "", - dialogVisible: false + dialogVisible: false, + loading: { + query: false + }, + dataSource: [], + columns: [], + selectedRowKeys: [], + pageInfo: { + current: 1, + pageSize: 10, + total: 0 + } }; } - renderTitle = () => { - const { title } = this.props; - const { searchValue } = this.state; - return
-
{title}
-
- - - - this.setState({ searchValue })} - placeholder="请输入方案名称" - onSearch={() => { - }} - /> -
-
; + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible) { + nextProps.visible && this.sendRangeList(nextProps); + this.setState({ selectedRowKeys: [] }); + } + } + + sendRangeList = (props) => { + const { grantType, salarySendId, pageCurrent = {} } = props; + const { pageInfo, loading, searchValue: targetName } = this.state; + const payload = { + grantType, + salarySendId, + targetName, + ...pageInfo, + ...pageCurrent + }; + this.setState({ loading: { ...loading, query: true } }); + sendRangeList(payload).then(({ status, data }) => { + this.setState({ loading: { ...loading, query: false } }); + if (status) { + const { pageNum: current, pageSize, total, columns, list: dataSource } = data; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, + dataSource: _.map(dataSource, it => ({ + ...it, + includeObj: _.map(it.includeObj, child => child.targetName).join(","), + excludeObj: _.map(it.excludeObj, child => child.targetName).join(",") + })), + columns + }); + } + }); + }; + sendRangeDelete = () => { + const { selectedRowKeys, pageInfo } = this.state; + const { grantType, salarySendId } = this.props; + Modal.confirm({ + title: "信息确认", + content: "确认要删除吗?", + onOk: () => { + sendRangeDelete(selectedRowKeys).then(({ status, errormsg }) => { + if (status) { + message.success("刪除成功"); + this.setState({ selectedRowKeys: [] }, () => { + this.sendRangeList({ + grantType, salarySendId, + pageCurrent: { + current: calcPageNo(pageInfo.total, pageInfo.current, 10, selectedRowKeys.length) + } + }); + }); + } else { + message.error(errormsg || "刪除失败"); + } + }); + }, + onCancel: () => { + } + }); + }; + handleOperate = () => { + const { grantType, salarySendId, onWithdraw, onGrant } = this.props; + const { selectedRowKeys } = this.state; + if (_.isEmpty(selectedRowKeys)) { + message.warning("您没有需要处理的对象!"); + return; + } + Modal.confirm({ + title: "信息确认", + content: `您共选择${selectedRowKeys.length}个对象,确定要${grantType === "grant" ? "发放" : "撤回"}吗?`, + onCancel: () => { + }, + onOk: () => { + if (grantType === "grant") { + onGrant({ ids: [salarySendId], salarySendRangeIds: selectedRowKeys }); + } else if (grantType === "withdraw") { + onWithdraw({ ids: [salarySendId], salarySendRangeIds: selectedRowKeys }); + } + } + }); }; render() { - const { onCancel, visible } = this.props; + const { dataSource, columns, pageInfo, loading, selectedRowKeys, dialogVisible, searchValue } = this.state; + const { onCancel, visible, grantType, salarySendId, title } = this.props; + const pagination = { + ...pageInfo, + showTotal: total => `共 ${total} 条`, + showQuickJumper: true, + pageSizeOptions: ["10", "20", "50", "100"], + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => { + }); + } + }; + const rowSelection = { + selectedRowKeys, + onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) + }; return ( this.setState({ selectedRowKeys: [] }, () => onCancel())} + title={ + this.setState({ dialogVisible: true })} + onDelete={this.sendRangeDelete} + onSave={this.handleOperate} + /> + } visible={visible} - style={{ width: 700 }} + style={{ width: 700, height: 600 }} hasScroll > - - {/**/} +
+ this.setState({ searchValue })} + onSearch={() => this.sendRangeList({ grantType, salarySendId })} + placeholder="请输入方案名称" + /> +
+ + this.setState({ dialogVisible: false }, () => { + this.sendRangeList({ grantType, salarySendId }); + })} + />
); } } export default PayrollPartTable; + +const RenderTitle = (props) => { + const { title, selectedRowKeys, onAdd, onDelete, onSave } = props; + return
+
{title}
+
+ + + +
+
; +}; From 0e531839588679106e33202de677329d2b5e88bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 7 Dec 2022 17:43:39 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=95=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=8F=91=E6=94=BE=E5=92=8C=E9=83=A8=E5=88=86=E6=92=A4?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/payroll/payrollGrant/index.js | 48 +++++++++++-------- .../payroll/payrollGrant/payrollPartTable.js | 4 +- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js index 6bf91113..f20f1570 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js @@ -5,7 +5,7 @@ import { WeaDropdown, WeaHelpfulTip, WeaTab, WeaTop } from "ecCom"; import { Button, Dropdown, Menu, message } from "antd"; import "./index.less"; import { getQueryString } from "../../../util/url"; -import { getSearchs } from "../../../util"; +import { getSearchs, renderLoading } from "../../../util"; import CustomPaginationTable from "../../../components/customPaginationTable"; import PayrollPartTable from "./payrollPartTable"; @@ -56,7 +56,9 @@ export default class PayrollGrant extends React.Component { }).then(() => { getInfoList({ salarySendId: this.state.currentId, - isGranted: selectedKey !== "0" + isGranted: selectedKey !== "0", + current: this.pageInfo.current, + pageSize: this.pageInfo.pageSize }); this.handleClose(); }); @@ -73,7 +75,10 @@ export default class PayrollGrant extends React.Component { }).then(() => { getInfoList({ salarySendId: currentId, - isGranted: selectedKey !== "0" + isGranted: selectedKey !== "0", + current: this.pageInfo.current, + pageSize: this.pageInfo.pageSize + }); this.handleClose(); }); @@ -466,23 +471,26 @@ export default class PayrollGrant extends React.Component {
- { - this.pageInfo.current = value; - this.handleDataPageChange(value); - }} - onShowSizeChange={(current, pageSize) => { - this.pageInfo = { current, pageSize }; - this.handleShowSizeChange(this.pageInfo); - }} - /> + { + !_.isEmpty(this.getColumns()) ? + { + this.pageInfo.current = value; + this.handleDataPageChange(value); + }} + onShowSizeChange={(current, pageSize) => { + this.pageInfo = { current, pageSize }; + this.handleShowSizeChange(this.pageInfo); + }} + /> : renderLoading() + }
({ ...it, - includeObj: _.map(it.includeObj, child => child.targetName).join(","), - excludeObj: _.map(it.excludeObj, child => child.targetName).join(",") + includeObj: _.map(it.includeObj, child => child.targetName || child.targetTypeName).join(","), + excludeObj: _.map(it.excludeObj, child => child.targetName || child.targetTypeName).join(",") })), columns });