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);