diff --git a/pc4mobx/hrmSalary/components/customTable/index.js b/pc4mobx/hrmSalary/components/customTable/index.js index cef3295f..c40122dd 100644 --- a/pc4mobx/hrmSalary/components/customTable/index.js +++ b/pc4mobx/hrmSalary/components/customTable/index.js @@ -1,20 +1,32 @@ -import React from 'react' -import { WeaTable } from 'ecCom' -import { Spin } from 'antd' +/* + * Author: 黎永顺 + * Description: + * Date: 2022-06-21 14:27:29 + * LastEditTime: 2022-06-21 15:05:12 + */ +import React from "react"; +import { WeaTable } from "ecCom"; +import { Spin, Table } from "antd"; +import "./index.less"; export default class CustomTable extends React.Component { - render() { - return ( -
- { - this.props.loading ? -
- -
- : - - } + render() { + const { loading, isWeaTable = true } = this.props; + return ( +
+ {loading + ?
+
- ) - } -} \ No newline at end of file + : isWeaTable + ? + : } + + ); + } +} diff --git a/pc4mobx/hrmSalary/components/customTable/index.less b/pc4mobx/hrmSalary/components/customTable/index.less new file mode 100644 index 00000000..02565090 --- /dev/null +++ b/pc4mobx/hrmSalary/components/customTable/index.less @@ -0,0 +1,11 @@ +.antd-wrap { + .ant-table-tbody { + tr { + td { + white-space: nowrap; + height: 41px !important; + border-bottom: 1px solid #e2e2e2 !important; + } + } + } +} diff --git a/pc4mobx/hrmSalary/components/slideModalTitle/index.js b/pc4mobx/hrmSalary/components/slideModalTitle/index.js index c4b6f7dd..aca9a78e 100644 --- a/pc4mobx/hrmSalary/components/slideModalTitle/index.js +++ b/pc4mobx/hrmSalary/components/slideModalTitle/index.js @@ -38,7 +38,7 @@ export default class SlideModalTitle extends React.Component {
{this.props.btns} { - this.state.editable && + this.props.showOperateBtn && this.state.editable && } {this.props.customOperate}
diff --git a/pc4mobx/hrmSalary/pages/calculate/index.js b/pc4mobx/hrmSalary/pages/calculate/index.js index 782396f0..03b53fb1 100644 --- a/pc4mobx/hrmSalary/pages/calculate/index.js +++ b/pc4mobx/hrmSalary/pages/calculate/index.js @@ -26,7 +26,7 @@ import CustomPaginationTable from "../../components/customPaginationTable"; const { RangePicker } = DatePicker; -@inject("calculateStore") +@inject("calculateStore", "taxAgentStore") @observer export default class Calculate extends React.Component { constructor(props) { @@ -111,7 +111,7 @@ export default class Calculate extends React.Component { handleDeleteItem(record) { Modal.confirm({ title: "信息确认", - content: "确认删除", + content: "确认删除本条数据吗?", onOk: () => { const { calculateStore: { deleteSalaryacct } } = this.props; deleteSalaryacct([record.id]).then(() => { @@ -148,10 +148,10 @@ export default class Calculate extends React.Component { // 获取列表 getColumns() { - const { calculateStore: { salaryListColumns } } = this.props; + const { calculateStore: { salaryListColumns }, taxAgentStore: { showOperateBtn } } = this.props; let columns = [...salaryListColumns]; columns.map(item => { - if (item.title == "操作") { + if (item.title == "操作" && showOperateBtn ) { item.render = (text, record) => { const accountBtn = _.filter(record.operate, it => it.text == "核算"); const notAccountBtn = _.filter(record.operate, it => it.text != "核算"); @@ -205,7 +205,7 @@ export default class Calculate extends React.Component { )} }> - + ); } @@ -242,7 +242,7 @@ export default class Calculate extends React.Component { } render() { - const { calculateStore } = this.props; + const { calculateStore, taxAgentStore: { showOperateBtn } } = this.props; const { salaryListDataSource, salaryListColumns, @@ -303,15 +303,18 @@ export default class Calculate extends React.Component { const { startDate, endDate } = this.state; return (
- + { + showOperateBtn && + + }
@@ -162,6 +162,7 @@ export default class SalaryDetail extends React.Component { this.pageInfo.current = value this.handleDataPageChange(value) }} + isWeaTable={false} onShowSizeChange={(current, pageSize) => { this.pageInfo = {current, pageSize} this.handleShowSizeChange(this.pageInfo) @@ -180,6 +181,7 @@ export default class SalaryDetail extends React.Component { this.handleEditSlideSave()} /> } diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/userSure.js b/pc4mobx/hrmSalary/pages/calculateDetail/userSure.js index a9bb78b0..4812ed30 100644 --- a/pc4mobx/hrmSalary/pages/calculateDetail/userSure.js +++ b/pc4mobx/hrmSalary/pages/calculateDetail/userSure.js @@ -449,6 +449,7 @@ export default class UserSure extends React.Component { this.pageInfo.current = value; this.handleUserListPageChange(value); }} + isWeaTable={false} onShowSizeChange={(current, pageSize) => { this.pageInfo = { current, pageSize }; this.handleShowSizeChange(this.pageInfo); @@ -456,6 +457,7 @@ export default class UserSure extends React.Component { />} {this.state.selectedKey == 1 && item.hide == "false"); + } - getColumns(columns) { - let result = [...columns] - return result.filter(item => item.hide == "false") - } + getScrollWidth() { + const { attendanceStore } = this.props; + const { attendQuoteDetailTableStore } = attendanceStore; + return ( + this.getColumns( + attendQuoteDetailTableStore.columns + ? attendQuoteDetailTableStore.columns + : [] + ).length * 150 + ); + } - getScrollWidth() { - const { attendanceStore } = this.props; - const { attendQuoteDetailTableStore} = attendanceStore; - return this.getColumns(attendQuoteDetailTableStore.columns ? attendQuoteDetailTableStore.columns : []).length * 150 - } + render() { + const { + attendanceStore, + attendanceStore: { viewAttendQuote } + } = this.props; + const { + attendQuoteDetailPageInfo, + attendQuoteDetailTableStore + } = attendanceStore; - - render() { - const { attendanceStore } = this.props; - const { attendQuoteDetailPageInfo, attendQuoteDetailTableStore} = attendanceStore; - return ( -
-
- { - this.props.salaryYearMonth != "" && -
考勤周期: {this.props.salaryYearMonth}
- } -
-
- -
-
- ) - } -} \ No newline at end of file + const pagination = { + total: attendQuoteDetailPageInfo.total, + showTotal: total => `共 ${total} 条`, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + onShowSizeChange: (current, pageSize) => { + viewAttendQuote({ attendQuoteId: this.props.id, current, pageSize }); + }, + onChange: current => { + viewAttendQuote({ + attendQuoteId: this.props.id, + current, + pageSize: attendQuoteDetailPageInfo.pageSize + }); + } + }; + return ( +
+
+ {this.props.salaryYearMonth != "" && +
+ 考勤周期: {this.props.salaryYearMonth} +
} +
+
+ +
+
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index 2253f5d8..40c9dca3 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -30,7 +30,7 @@ const { RangePicker } = DatePicker; const { Option } = Select -@inject('attendanceStore') +@inject('attendanceStore', 'taxAgentStore') @observer export default class Attendance extends React.Component { constructor(props) { @@ -223,8 +223,13 @@ export default class Attendance extends React.Component { viewAttendQuote(request) } + handleExportAttendQuote= ()=>{ + const url= `${window.location.origin}/api/bs/hrmsalary/attendQuote/export?attendQuoteId=${this.recordId}` + window.open(url, '_self'); + } + render() { - const { attendanceStore } = this.props; + const { attendanceStore, taxAgentStore: {showOperateBtn} } = this.props; const { modalParam } = this.state; const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = attendanceStore; const { step, setStep, setSlideVisiable, slideVisiable, doBatchDelete, attendTableStore, fieldSettingAttendList, fieldSettingCustomList, setFieldSettingAttendList, setFieldSettingCustomList, searchFieldSettingList } = attendanceStore; @@ -274,10 +279,11 @@ export default class Attendance extends React.Component { }]; const renderSearchOperationItem = () => { - return
+ const { taxAgentStore: { showOperateBtn } } = this.props; + return showOperateBtn ?
-
+
: null } @@ -351,8 +357,13 @@ export default class Attendance extends React.Component { const renderCustomOperate = () => { return (
- 导出 + { + showOperateBtn && + + // 导出全部 + } {this.setState({searchValue: v})}} onSearch={(v) => {this.handleSearch({keyword: v})}} @@ -376,7 +387,10 @@ export default class Attendance extends React.Component { const renderRightOperation = () => { return (
- + { + showOperateBtn && + + } {this.setState({fieldName: value})}} onSearch={(value) => { this.setState({fieldSettingSearchValue: value}) handleItemSearch(value) @@ -387,7 +401,7 @@ export default class Attendance extends React.Component { const menu = ( - 导出全部 + 导出选中 ); @@ -431,7 +445,7 @@ export default class Attendance extends React.Component { return {this.onItemEdit(record)}} dangerouslySetInnerHTML={{ __html: valueSpan }} /> case "enableStatus": - return {handleSwitchItemChange(record, value)}}/> + return {handleSwitchItemChange(record, value)}}/> default: return
} @@ -663,6 +677,7 @@ export default class Attendance extends React.Component { { if(fileTypeStr == "数值") { return "1" } else if(fileTypeStr == "文本"){ @@ -57,7 +57,7 @@ export default class ItemMangeFormModal extends React.Component { ] const { request } = this.state; const {fieldName, fieldType, enableStatus, description} = request - let fileTypeKey = convertFieldType(fieldType) + let fileTypeKey = this.convertFieldType(fieldType) const { attendanceStore : {currentItemOperate}} = this.props; return ( `共 ${total} 条`, + pageSizeOptions: ["10", "20", "50", "100"], showSizeChanger: true, onShowSizeChange(current, pageSize) { setPageObj({ ...pageObj, current, pageSize }); getTableDatas({ current, pageSize, - taxAgentId, + taxAgentId: taxAgentId==='All' ? '' : taxAgentId, declareMonth: monthValue && [monthValue], }); }, @@ -444,7 +445,7 @@ export default class CumDeduct extends React.Component { getTableDatas({ current, pageSize: pageObj.pageSize, - taxAgentId, + taxAgentId: taxAgentId==='All' ? '' : taxAgentId, declareMonth: monthValue && [monthValue], }); }, @@ -487,7 +488,7 @@ export default class CumDeduct extends React.Component { ), }; } else { - return { ...item }; + return { ...item, width: 150 }; } }); @@ -502,7 +503,7 @@ export default class CumDeduct extends React.Component { iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) - buttons={btns}> + buttons={showOperateBtn ? btns : []}>
} content={ diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less index ef51e77f..ca63e917 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less @@ -43,5 +43,15 @@ text-decoration: none; } } +} -} \ No newline at end of file +.wea-new-table { + .ant-table-tbody { + tr { + td { + height: 41px !important; + border-bottom: 1px solid #e2e2e2 !important; + } + } + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index 944f47f0..8d0a954f 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -293,7 +293,7 @@ export default class CumSituation extends React.Component { previewImport, importFile, } = cumSituationStore; - const { taxAgentOption } = taxAgentStore; + const { taxAgentOption, showOperateBtn } = taxAgentStore; const { slideVisiable, setSlideVisiable, @@ -436,12 +436,13 @@ export default class CumSituation extends React.Component { total: pageObj.total, showTotal: (total) => `共 ${total} 条`, showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], onShowSizeChange(current, pageSize) { setPageObj({ ...pageObj, current, pageSize }); getTableDatas({ current, pageSize, - taxAgentId, + taxAgentId:taxAgentId==='All' ? '' : taxAgentId, declareMonth: monthValue && [monthValue], }); }, @@ -450,7 +451,7 @@ export default class CumSituation extends React.Component { getTableDatas({ current, pageSize: pageObj.pageSize, - taxAgentId, + taxAgentId:taxAgentId==='All' ? '' : taxAgentId, declareMonth: monthValue && [monthValue], }); }, @@ -509,7 +510,7 @@ export default class CumSituation extends React.Component { showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 - buttons={btns}> + buttons={showOperateBtn ? btns : []}>
} content={ diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js index 756e9389..e7bf3332 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js @@ -284,7 +284,7 @@ export default class OtherDeduct extends React.Component { previewImport, importFile, } = otherDeductStore; - const { taxAgentOption } = taxAgentStore; + const { taxAgentOption, showOperateBtn } = taxAgentStore; const { slideVisiable, setSlideVisiable, @@ -432,12 +432,13 @@ export default class OtherDeduct extends React.Component { total: pageObj.total, showTotal: (total) => `共 ${total} 条`, showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], onShowSizeChange(current, pageSize) { setPageObj({ ...pageObj, current, pageSize }); getTableDatas({ current, pageSize, - taxAgentId, + taxAgentIdL:taxAgentId==='All' ? '' : taxAgentId, declareMonth: monthValue && [monthValue], }); }, @@ -446,7 +447,7 @@ export default class OtherDeduct extends React.Component { getTableDatas({ current, pageSize: pageObj.pageSize, - taxAgentId, + taxAgentId:taxAgentId==='All' ? '' : taxAgentId, declareMonth: monthValue && [monthValue], }); }, @@ -502,7 +503,7 @@ export default class OtherDeduct extends React.Component { showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 - buttons={btns}> + buttons={showOperateBtn ? btns : []}>
} content={ diff --git a/pc4mobx/hrmSalary/pages/declare/index.js b/pc4mobx/hrmSalary/pages/declare/index.js index aa81e718..9475d502 100644 --- a/pc4mobx/hrmSalary/pages/declare/index.js +++ b/pc4mobx/hrmSalary/pages/declare/index.js @@ -160,7 +160,7 @@ export default class Declare extends React.Component { } render() { - const { declareStore } = this.props; + const { declareStore, taxAgentStore: { showOperateBtn } } = this.props; const { loading, hasRight, @@ -222,15 +222,17 @@ export default class Declare extends React.Component { defaultValue={[this.state.startDate, this.state.endDate]} onChange={(value) => this.handleRangePickerChange(value)} /> - - + { + showOperateBtn && + + }
); }; diff --git a/pc4mobx/hrmSalary/pages/ledger/copyFormModal.js b/pc4mobx/hrmSalary/pages/ledger/copyFormModal.js index 231feb79..c9954361 100644 --- a/pc4mobx/hrmSalary/pages/ledger/copyFormModal.js +++ b/pc4mobx/hrmSalary/pages/ledger/copyFormModal.js @@ -1,6 +1,12 @@ +/* + * Author: 黎永顺 + * Description: + * Date: 2022-06-20 13:53:14 + * LastEditTime: 2022-06-21 13:30:00 + */ import React from "react"; import { Modal, Button, Row, Col } from "antd"; -import { WeaInput, WeaSelect } from "ecCom"; +import { WeaInput, WeaSelect, WeaError } from "ecCom"; export default class CopyFormModal extends React.Component { constructor(props) { @@ -23,6 +29,14 @@ export default class CopyFormModal extends React.Component {
账套名称 - { - this.setState({ name: value }); - }} - /> + + { + this.setState({ name: value }); + !value && this.refs.weaNameError.showError(); + }} + /> + 个税扣缴义务人 - { - this.setState({ taxAgentId: value }); - }} - /> + + { + this.setState({ taxAgentId: value }); + !value && this.refs.weaTaxAgentError.showError(); + }} + /> + diff --git a/pc4mobx/hrmSalary/pages/ledger/index.js b/pc4mobx/hrmSalary/pages/ledger/index.js index 8d3e464f..eb1a61b1 100644 --- a/pc4mobx/hrmSalary/pages/ledger/index.js +++ b/pc4mobx/hrmSalary/pages/ledger/index.js @@ -231,6 +231,7 @@ export default class Ledger extends React.Component { setShowSearchAd, baseInfoRequest, } = ledgerStore; + const { showOperateBtn }= taxAgentStore; const { canEdit } = baseInfoRequest; const { currentStep, selectedTab } = this.state; if (!hasRight && !loading) { @@ -273,12 +274,15 @@ export default class Ledger extends React.Component { const renderRightOperation = () => { return (
- + { + showOperateBtn && + + } { @@ -359,6 +363,7 @@ export default class Ledger extends React.Component { total: pageObj.total, showTotal: (total) => `共 ${total} 条`, showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], onShowSizeChange: (current, pageSize) => { setPageObj({ ...pageObj, current, pageSize }); getTableDatas({ current, pageSize, name: this.state.searchValue }); @@ -394,13 +399,14 @@ export default class Ledger extends React.Component { render: (text, record) => ( { this.handleItemStatusChange(value, record); }} /> ), }; - } else if (item.dataIndex === "operate") { + } else if (item.dataIndex === "operate" && showOperateBtn) { return { ...item, render: (text, record) => ( @@ -577,6 +583,7 @@ export default class Ledger extends React.Component { { title: "薪资项目", key: 2 }, { title: "调薪计薪规则", key: 3 }, ]} + showOperateBtn={showOperateBtn} editable={canEdit === "true"} selectedTab={selectedTab} onSave={() => this.handleEditSlideSave()} diff --git a/pc4mobx/hrmSalary/pages/mySalary/index.js b/pc4mobx/hrmSalary/pages/mySalary/index.js index 2fc76f76..ed4d1c6f 100644 --- a/pc4mobx/hrmSalary/pages/mySalary/index.js +++ b/pc4mobx/hrmSalary/pages/mySalary/index.js @@ -81,8 +81,13 @@ export default class MySalary extends React.Component { // 区间改变事件 handleSalaryRangePickerChange(range) { const { mySalaryStore : {mySalaryBillList}} = this.props; - this.range = range.map(item => moment(item).format("YYYY-MM")) - mySalaryBillList(this.range, this.pageInfo) + const isNull= _.every(range, it=> !!it) + if(!_.isEmpty(range) && isNull){ + this.range = range.map(item => moment(item).format("YYYY-MM")) + mySalaryBillList(this.range, this.pageInfo) + }else{ + mySalaryBillList([], this.pageInfo) + } } diff --git a/pc4mobx/hrmSalary/pages/payroll/SalarySendList.js b/pc4mobx/hrmSalary/pages/payroll/SalarySendList.js index fd074126..4572c2ad 100644 --- a/pc4mobx/hrmSalary/pages/payroll/SalarySendList.js +++ b/pc4mobx/hrmSalary/pages/payroll/SalarySendList.js @@ -1,131 +1,180 @@ -import React from 'react' -import { inject, observer } from 'mobx-react'; -import { Table, Menu, Dropdown, message } from 'antd' -import { WeaTable } from 'ecCom' -import moment from 'moment' +import React from "react"; +import { inject, observer } from "mobx-react"; +import { Table, Menu, Dropdown, message } from "antd"; +import { WeaTable } from "ecCom"; +import moment from "moment"; +import CustomTable from "../../components/customTable"; +import CustomPaginationTable from "../../components/customPaginationTable"; -import CustomTable from '../../components/customTable'; -import CustomPaginationTable from '../../components/customPaginationTable' - -@inject('payrollStore') +@inject("payrollStore", "taxAgentStore") @observer export default class SalarySendList extends React.Component { - constructor(props) { - super(props) - this.searchParams = {salaryYearMonth: this.props.salaryYearMonth} - this.pageInfo = {current: 1, pageSize: 10} + constructor(props) { + super(props); + this.searchParams = { salaryYearMonth: this.props.salaryYearMonth }; + this.pageInfo = { current: 1, pageSize: 10 }; + } + + componentWillMount() { + const { payrollStore: { getPayrollList } } = this.props; + getPayrollList(); + } + + // 发放回调 + handleGrant(record) { + window.open( + "/spa/hrmSalary/static/index.html#/main/hrmSalary/payrollGrant?id=" + + record.id + ); + } + + // 查看详情 + handleShowDetail(record) { + window.open( + "/spa/hrmSalary/static/index.html#/main/hrmSalary/payrollDetail?id=" + + record.id + ); + } + + // 更新模板 + handleUpdateTemplate(record) { + let templateRecord = {}; + templateRecord.id = record.templateId; + if (!record.templateId) { + message.warning("请设置默认模板"); + return; + } + this.props.onEditTemplate && this.props.onEditTemplate(templateRecord); + } + + // 获取表头数据 + getColumns() { + const { + payrollStore: { salarySendTableStore }, + taxAgentStore: { showOperateBtn } + } = this.props; + const { columns } = salarySendTableStore; + if (!columns) { + return []; } - componentWillMount() { - const { payrollStore: {getPayrollList} } = this.props; - getPayrollList() - } - - // 发放回调 - handleGrant(record) { - window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/payrollGrant?id=" + record.id) - } - - // 查看详情 - handleShowDetail(record) { - window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/payrollDetail?id=" + record.id) - } - - // 更新模板 - handleUpdateTemplate(record) { - let templateRecord = {} - templateRecord.id = record.templateId; - if(!record.templateId) { - message.warning("请设置默认模板") - return - } - this.props.onEditTemplate && this.props.onEditTemplate(templateRecord) - } - - - - // 获取表头数据 - getColumns() { - const {payrollStore : {salarySendTableStore}} = this.props; - const{ columns } = salarySendTableStore - if(!columns) { - return []; - } - - let result = columns.filter(item => item.hide == "false") - result.map(item => { - if(item.dataIndex == "salaryYearMonth") { - item.render = (text, record) => { - return {moment(parseInt(text)).format("YYYY-MM")} - } - } else if(item.dataIndex == "lastSendTime") { - item.render = (text, record) => { - return {moment(parseInt(text)).format("YYYY-MM-DD HH:mm:ss")} - } + let result = columns.filter(item => item.hide == "false"); + result.map(item => { + if (item.dataIndex == "salaryYearMonth") { + item.render = (text, record) => { + return ( + + {moment(parseInt(text)).format("YYYY-MM")} + + ); + }; + } else if (item.dataIndex == "lastSendTime") { + item.render = (text, record) => { + return ( + + {moment(parseInt(text)).format("YYYY-MM-DD HH:mm:ss")} + + ); + }; + } + }); + showOperateBtn + ? (result = result.concat([ + { + title: "操作", + key: "operate", + render: (text, record) => { + return ( + { + this.handleGrant(record); + }}> + 发放 + + ); } - }) - return result - .concat([ - { - title: "操作", - key: "operate", - render: (text, record) => { - return ( - {this.handleGrant(record)}}>发放 - ) - } - }, - { - title : '', - key: "moreOperate", - dataIndex: "moreOperate", - render: (text, record) => { - return ( - - - { - this.handleShowDetail(record) - }}>查看详情 - - - { - this.handleUpdateTemplate(record) - }}>更新模板 - - }> - - - - ); - } - } - ]) - } + }, + { + title: "", + key: "moreOperate", + dataIndex: "moreOperate", + render: (text, record) => { + return ( + + + { + this.handleShowDetail(record); + }}> + 查看详情 + + - render() { - const { payrollStore } = this.props; - const { salarySendTableStore, salarySendDataSource, pageInfo, loading } = payrollStore; - return ( -
- { - this.pageInfo.current = value - this.props.handleListDataPageChange(value, this.pageInfo) - }} - onShowSizeChange={(current, pageSize) => { - this.pageInfo = {current, pageSize} - this.props.handleListShowSizeChange(this.pageInfo) - }} - /> - -
- ) - } -} \ No newline at end of file + + { + this.handleUpdateTemplate(record); + }}> + 更新模板 + + + + }> + +
+ ); + } + } + ])) + : (result = result.concat([ + { + title: "操作", + key: "operate", + render: (text, record) => { + return ( + { + this.handleShowDetail(record); + }}> + 查看详情 + + ); + } + } + ])); + return result; + } + + render() { + const { payrollStore } = this.props; + const { + salarySendTableStore, + salarySendDataSource, + pageInfo, + loading + } = payrollStore; + return ( +
+ { + this.pageInfo.current = value; + this.props.handleListDataPageChange(value, this.pageInfo); + }} + onShowSizeChange={(current, pageSize) => { + this.pageInfo = { current, pageSize }; + this.props.handleListShowSizeChange(this.pageInfo); + }} + /> +
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/payroll/index.js b/pc4mobx/hrmSalary/pages/payroll/index.js index fd12a3cd..b7430b14 100644 --- a/pc4mobx/hrmSalary/pages/payroll/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/index.js @@ -23,7 +23,7 @@ import SalarySendList from './SalarySendList' const { RangePicker } = DatePicker; -@inject('payrollStore') +@inject('payrollStore', 'taxAgentStore') @observer export default class Payroll extends React.Component { constructor(props) { @@ -225,7 +225,7 @@ export default class Payroll extends React.Component { } render() { - const { payrollStore } = this.props; + const { payrollStore, taxAgentStore: { showOperateBtn } } = this.props; const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = payrollStore; const { currentStep, selectedTab, templateSearchValue, templateSelect } = this.state if (!hasRight && !loading) { // 无权限处理 @@ -279,7 +279,10 @@ export default class Payroll extends React.Component { } else if(this.state.selectedKey == "1") { return (
- + { + showOperateBtn && + + } { this.state.initSelected && {this.handleTemplateSelectChange(value)}}/> } @@ -372,7 +375,7 @@ export default class Payroll extends React.Component { onCopy={(record) => { this.handleTemplateListCopy(record) }} - + showOperateBtn={showOperateBtn} onDelete={(record)=> this.handleTemplateListDelete(record)} /> } @@ -428,6 +431,7 @@ export default class Payroll extends React.Component { tabs={[{title: '基础设置', key: 0}, {title: "显示设置", key: 1}]} editable={false} selectedTab={selectedTab} + showOperateBtn={showOperateBtn} customOperate={ { selectedTab == 0 && diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollDetail/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollDetail/index.js index be353c75..e64933e2 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollDetail/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollDetail/index.js @@ -92,10 +92,12 @@ export default class PayrollDetail extends React.Component { } // 导出全部 - handleExportAll() { - const { payrollStore } = this.props; - const { exportDetailList } = payrollStore - exportDetailList({salarySendId: this.state.currentId}) + handleExportAll=()=> { + // const { payrollStore } = this.props; + // const { exportDetailList } = payrollStore + // exportDetailList({salarySendId: this.state.currentId}) + const url= `${window.location.origin}/api/bs/hrmsalary/salaryBill/send/exportDetailList?salarySendId=${this.state.currentId}` + window.open(url, '_self'); } getSearchsAdQuick() { @@ -112,7 +114,8 @@ export default class PayrollDetail extends React.Component { ); return ( - {this.handleExportAll()}}>导出全部 + // {this.handleExportAll()}}>导出全部 + ) // return (
) } diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js index 75fc6b7d..df174de6 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js @@ -113,17 +113,13 @@ export default class PayrollGrant extends React.Component { getColumns() { const { payrollStore } = this.props; - const { salaryGrantTableStore } = payrollStore - const { columns } = salaryGrantTableStore; - if(!columns) { - return [] - } + const { salaryGrantTableStore: columns } = payrollStore - let result = columns.filter(item => item.hide == "false").map(item => { + let result = [...columns, {title: "操作",key: "operation",dataIndex: "operation"}].map(item => { item = {...item} if(item.dataIndex == "operation") { item.render = (text,record) => { - if(text == 'ALREADYSEND') { + if(record.sendStatus == '已发放') { return ( {this.handleWithdraw(record)}}>撤回 ) @@ -162,13 +158,9 @@ export default class PayrollGrant extends React.Component { ); return (
- - - { - this.state.btnStatus.show_workflow_status && - } - - 更多 + + + 更多
) } @@ -236,7 +228,7 @@ export default class PayrollGrant extends React.Component {
薪资所属月:{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.year}-{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.monthValue} { - batchSendInfoList({salarySendId: this.props.sendId}) - }) - } + 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}) - }) - } + // 发送 + 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}) - } + componentWillMount() { + const { payrollStore: { batchSendInfoList } } = this.props; + batchSendInfoList({ salarySendId: this.props.sendId }); + } - getColumns() { - const { payrollStore } = this.props; - const { canGrantColumns } = payrollStore - if(!canGrantColumns) { - return [] - } - return canGrantColumns.map(item => { - let result = {} - result.title = item.text; - result.dataIndex = item.column; - result.key = item.column; - result.width = item.width; - if(result.key == "operation") { - result.render = (text,record) => { - if(text == 'ALREADYSEND') { - return ( - {this.handleWithdraw(record)}}>撤回 - ) - } else { - return ( - {this.handleGrant(record)}}>发送 - ) - } - } - } else { - result.dataIndex = item.column; - } - return result; - }) - } - - 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), + 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 ( - {this.props.onCancel()}}> -
- 批量发放 -
- {this.handleGrantAll()}}>全部发放 - {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/> -
-
-
-
- 薪资所属月:{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.year}-{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.monthValue} - - 工资单模板:{salarySendDetailBaseInfo.template} -
-
-
- {this.handleDataPageChange(value)}, - total: canGrantPageInfo.total, - current: canGrantPageInfo.pageNum, - showTotal: (total) => `共 ${total} 条`, - }} - /> -
-
- ) + } + 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; } -} \ No newline at end of file + 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.props.onCancel(); + }}> +
+ 批量发放 +
+ { + this.handleGrantAll(); + }}> + 全部发放 + + { + this.setState({ searchValue: value }); + }} + onSearch={value => { + this.handleSearch(value); + }} + /> +
+
+
+
+ + 薪资所属月:{salarySendDetailBaseInfo.salaryMonth && + salarySendDetailBaseInfo.salaryMonth + .year}-{salarySendDetailBaseInfo.salaryMonth && + salarySendDetailBaseInfo.salaryMonth.monthValue} + + + + 工资单模板:{salarySendDetailBaseInfo.template} + +
+
+
+ { + 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 index 7e8d8f99..7a2cba87 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js @@ -1,188 +1,245 @@ -import React from 'react' -import { WeaInputSearch, WeaHelpfulTip, WeaTable } from "ecCom" -import { payrollGrantColumns, dataSource } from "../columns" -import { Menu, Button,Table, Modal, Dropdown } from "antd" -import { inject, observer } from 'mobx-react'; +import React from "react"; +import { WeaInputSearch, WeaHelpfulTip, WeaTable } from "ecCom"; +import { payrollGrantColumns, dataSource } from "../columns"; +import { Menu, Button, Table, Modal, Dropdown } from "antd"; +import { inject, observer } from "mobx-react"; - -@inject('payrollStore') +@inject("payrollStore") @observer export default class PayrollWithdrawModal extends React.Component { - constructor(props) { - super(props); - this.state = { - selectedRowKeys: [], - current: 1, - } - } + constructor(props) { + super(props); + this.state = { + selectedRowKeys: [], + current: 1 + }; + } - componentWillMount() { - const { payrollStore } = this.props - const { batchWithdrawInfoList } = payrollStore - batchWithdrawInfoList({salarySendId:this.props.sendId}) - } + 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}) - }) - } + // 撤回 + 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}) - }) - } + // 发送 + 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 - if(!canWidthdrawColumns) { - return [] - } - return canWidthdrawColumns.map(item => { - let result = {} - result.title = item.text; - result.key = item.column; - result.dataIndex = item.column; - result.width = item.width; - if(result.key == "operation") { - result.render = (text,record) => { - if(text == 'ALREADYSEND') { - return ( - {this.handleWithdraw(record)}}>撤回 - ) - } else { - return ( - {this.handleGrant(record)}}>发送 - ) - } - } - } else { - result.dataIndex = item.column; - } - return result; - }) - } - - 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), + 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 + }); + }; - return ( - {this.props.onCancel()}}> -
- 批量撤回 -
- {this.handleWithdrawAll()}}>全部撤回 - {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/> -
-
-
-
- 薪资所属月:{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.year}-{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.monthValue} - - 工资单模板:{salarySendDetailBaseInfo.template} -
-
-
- {this.handleDataPageChange(value)}, - total: canWithdrawPageInfo.total, - current: canWithdrawPageInfo.pageNum, - showTotal: (total) => `共 ${total} 条`, - }} - /> -
-
- ) + // 撤回 + 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; } -} \ No newline at end of file + 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.props.onCancel(); + }}> +
+ 批量撤回 +
+ { + this.handleWithdrawAll(); + }}> + 全部撤回 + + { + this.setState({ searchValue: value }); + }} + onSearch={value => { + this.handleSearch(value); + }} + /> +
+
+
+
+ + 薪资所属月:{salarySendDetailBaseInfo.salaryMonth && + salarySendDetailBaseInfo.salaryMonth + .year}-{salarySendDetailBaseInfo.salaryMonth && + salarySendDetailBaseInfo.salaryMonth.monthValue} + + + + 工资单模板:{salarySendDetailBaseInfo.template} + +
+
+
+ { + this.handleDataPageChange(value); + }, + total: canWithdrawPageInfo.total, + current: canWithdrawPageInfo.pageNum, + showTotal: total => `共 ${total} 条` + }} + /> +
+
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/payroll/templateSettingList.js b/pc4mobx/hrmSalary/pages/payroll/templateSettingList.js index cbd384c1..a38b073f 100644 --- a/pc4mobx/hrmSalary/pages/payroll/templateSettingList.js +++ b/pc4mobx/hrmSalary/pages/payroll/templateSettingList.js @@ -1,96 +1,106 @@ -import React from 'react' -import { inject, observer } from 'mobx-react'; -import { Radio, Spin } from 'antd' -import { WeaTableNew } from 'comsMobx'; +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') +@inject("payrollStore") @observer export default class TemplateSettingList extends React.Component { - componentWillMount() { - const { payrollStore } = this.props; - const { getPayrollTemplateList } = payrollStore; - getPayrollTemplateList(); - } + componentWillMount() { + const { payrollStore } = this.props; + const { getPayrollTemplateList } = payrollStore; + getPayrollTemplateList(); + } - // 编辑操作按钮 - onEdit(record) { - this.props.onEdit && this.props.onEdit(record) - } + // 编辑操作按钮 + onEdit(record) { + this.props.onEdit && this.props.onEdit(record); + } - // 复制操作按钮 - onCopy(record) { - this.props.onCopy && this.props.onCopy(record) - } + // 复制操作按钮 + onCopy(record) { + this.props.onCopy && this.props.onCopy(record); + } - // 删除操作按钮 - onDelete(record) { - this.props.onDelete && this.props.onDelete(record) - } + // 删除操作按钮 + onDelete(record) { + this.props.onDelete && this.props.onDelete(record); + } - // 操作按钮 - onOperatesClick = (record, index, operate, flag) => { - switch(operate.index.toString()){ - case '0': // 编辑 - this.onEdit(record); - break; - case "1": // 复制 - this.onCopy(record); - break; - case "2": // 删除 - this.onDelete(record); - break; + // 操作按钮 + onOperatesClick = (record, index, operate, flag) => { + switch (operate.index.toString()) { + case "0": // 编辑 + this.onEdit(record); + break; + case "1": // 复制 + this.onCopy(record); + break; + case "2": // 删除 + this.onDelete(record); + break; + } + }; + + // 默认使用配置 + recordItemChange(record) { + const { payrollStore } = this.props; + const { changePayrollDefaultUse, getPayrollTemplateList } = payrollStore; + changePayrollDefaultUse(record.id).then(() => { + getPayrollTemplateList(); + }); + } + + // 增加编辑功能,重写columns绑定事件 + getColumns = columns => { + const { showOperateBtn } = this.props; + let newColumns = ""; + newColumns = columns.map(column => { + let newColumn = column; + newColumn.render = (text, record, index) => { + //前端元素转义 + let valueSpan = + record[newColumn.dataIndex + "span"] !== undefined + ? record[newColumn.dataIndex + "span"] + : record[newColumn.dataIndex]; + switch (newColumn.dataIndex) { + case "useType": + return ( + { + this.recordItemChange(record); + }} + /> + ); + default: + return
; } - }; + }; + return newColumn; + }); + return newColumns; + }; - // 默认使用配置 - recordItemChange(record) { - const { payrollStore } = this.props; - const { changePayrollDefaultUse, getPayrollTemplateList } = payrollStore; - changePayrollDefaultUse(record.id).then(() => { - getPayrollTemplateList() - }) - } - - // 增加编辑功能,重写columns绑定事件 - getColumns = (columns) => { - let newColumns = ''; - newColumns = columns.map(column => { - let newColumn = column; - newColumn.render = (text, record, index) => { //前端元素转义 - let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; - switch(newColumn.dataIndex) { - case "useType": - return {this.recordItemChange(record)}}/> - default: - return
- } - } - return newColumn; - }); - return newColumns; - } - - render() { - const { payrollStore } = this.props; - const { templateStore, loading } = payrollStore; - return ( -
- { loading ? -
- -
- : - - } - + render() { + const { payrollStore } = this.props; + const { templateStore, loading } = payrollStore; + return ( +
+ {loading + ?
+
- ) - } -} \ No newline at end of file + : } +
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/salaryFile/index.js b/pc4mobx/hrmSalary/pages/salaryFile/index.js index 5c5644cc..0ca3f2ea 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/index.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/index.js @@ -1,4 +1,4 @@ -import React from "react"; +import React, { Fragment } from "react"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; import { WeaTableNew } from "comsMobx"; @@ -47,7 +47,7 @@ const { MonthPicker } = DatePicker; import "./index.less"; import CustomTable from "../../components/customTable"; -@inject("salaryFileStore") +@inject("salaryFileStore", "taxAgentStore") @observer export default class SalaryFile extends React.Component { constructor(props) { @@ -174,20 +174,24 @@ export default class SalaryFile extends React.Component { // 查看 Slide 头部操作按钮 renderEditSlideOperate() { + const { taxAgentStore: { showOperateBtn } } = this.props; return (
- - 调整个税扣缴义务人 - - } - onClick={() => { - this.setState({ changeSalaryVisible: true }); - }}> - 调薪 - + { + showOperateBtn && + + 调整个税扣缴义务人 + + } + onClick={() => { + this.setState({ changeSalaryVisible: true }); + }}> + 调薪 + + }
); } @@ -244,7 +248,7 @@ export default class SalaryFile extends React.Component { } render() { - const { salaryFileStore } = this.props; + const { salaryFileStore, taxAgentStore: { showOperateBtn } } = this.props; const { loading, hasRight, @@ -355,32 +359,37 @@ export default class SalaryFile extends React.Component {
- - - 导入 - - { - this.handleExportAll(); - }}> - 导出全部 - + { + showOperateBtn && + + + + 导入 + + { + this.handleExportAll(); + }}> + 导出全部 + + + } + showOperateBtn && selectedTab != 0 && }
} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js index 8b6c7935..fa82e777 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js @@ -11,7 +11,7 @@ import { Switch, Modal, Dropdown, - Menu + Menu,message } from "antd"; import { @@ -53,7 +53,7 @@ const { MonthPicker } = DatePicker; import TwoColContent from "../../../components/twoColContent"; import CopySchemaModal from "./copySchemaModal"; -@inject("programmeStore") +@inject("programmeStore", "taxAgentStore") @observer export default class Programme extends React.Component { constructor(props) { @@ -166,8 +166,9 @@ export default class Programme extends React.Component { } getCustomColumns = columns => { - let newColumns = ""; - newColumns = columns.map(column => { + const { taxAgentStore: { showOperateBtn } } = this.props; + let newColumns = []; + newColumns = _.filter(columns, it => it.dataIndex !='operate').map(column => { let newColumn = column; newColumn.render = (text, record, index) => { //前端元素转义 @@ -188,6 +189,7 @@ export default class Programme extends React.Component { case "is_use": return ( { this.handleCategoryStatusChange(record, value); @@ -231,8 +233,13 @@ export default class Programme extends React.Component { onCustomEdit(record) { const { - programmeStore: { getCustomForm, setCustomNewVisible, setCustomRequest } + programmeStore: { getCustomForm, setCustomNewVisible, setCustomRequest }, + taxAgentStore: { showOperateBtn } } = this.props; + if(!showOperateBtn){ + message.warning("请设置编辑权限!"); + return; + } getCustomForm(); setCustomNewVisible(true); this.setState({ @@ -257,7 +264,7 @@ export default class Programme extends React.Component { } render() { - const { programmeStore } = this.props; + const { programmeStore, taxAgentStore: { showOperateBtn } } = this.props; const { loading, hasRight, @@ -456,18 +463,20 @@ export default class Programme extends React.Component { topTab={topTab} searchOperationItem={
- + {/* 操作按钮权限 */} + {showOperateBtn && + } {selectedKey == "custom" && { setCustomSelectkey(v); getCustomCategoryList(v); - console.log("v:", v); }} />}
@@ -537,6 +545,7 @@ export default class Programme extends React.Component { subtitle={this.state.customEdit ? "修改" : "新增"} subTabs={[{ title: "基础设置" }]} editable={true} + showOperateBtn={showOperateBtn} onSave={() => { handleOnSave(); }} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js index f8580d31..3862e5a1 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js @@ -62,7 +62,6 @@ export default class StandingBook extends React.Component { const { taxAgentStore: {getPermission}, standingBookStore: {getAdminTaxAgentList}} = this.props getPermission().then(({status, data}) => { if(status) { - console.log("data:", data); this.setState({adminData : data}) if(data.isAdminEnable) { getAdminTaxAgentList().then((data) => { @@ -328,7 +327,7 @@ export default class StandingBook extends React.Component { } render() { - const { standingBookStore } = this.props; + const { standingBookStore, taxAgentStore: { showOperateBtn } } = this.props; const { inspectLoading, loading, @@ -353,7 +352,7 @@ export default class StandingBook extends React.Component { return renderNoright(); } - const rightBtns = (!this.state.adminData.isDefaultOpen || this.state.adminData.isDefaultOpen && this.state.adminData.isAdminEnable) ? [ + const rightBtns = [ // 右键菜单 - ] : []; + ]; const rightMenu = [ // 右键菜单 { @@ -428,7 +427,7 @@ export default class StandingBook extends React.Component { title="社保福利台账" // 文字 icon={} // 左侧图标 iconBgcolor="#F14A2D" // 左侧图标背景色 - buttons={rightBtns} + buttons={showOperateBtn ? rightBtns : []} // showDropIcon={true} // 是否显示下拉按钮 // dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) // dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 diff --git a/pc4mobx/hrmSalary/pages/taxAgent/index.js b/pc4mobx/hrmSalary/pages/taxAgent/index.js index c74f1a73..c7c34293 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/index.js @@ -305,6 +305,7 @@ export default class TaxAgent extends React.Component { total: pageObj.total, showTotal: total => `共 ${total} 条`, showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], onShowSizeChange(current, pageSize) { doInit({ current, pageSize }); }, @@ -374,7 +375,6 @@ export default class TaxAgent extends React.Component { icon={} // 左侧图标 iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true}> - {" "}// 是否显示下拉按钮 diff --git a/pc4mobx/hrmSalary/single.js b/pc4mobx/hrmSalary/single.js index 06f68823..396ff1e7 100644 --- a/pc4mobx/hrmSalary/single.js +++ b/pc4mobx/hrmSalary/single.js @@ -29,7 +29,8 @@ const Home = props => props.children; class Root extends React.Component { componentWillMount() { - top.$(".ant-message").remove() + top.$(".ant-message").remove(); + allStore.taxAgentStore.getPermission(); } render() { return ( diff --git a/pc4mobx/hrmSalary/stores/payroll.js b/pc4mobx/hrmSalary/stores/payroll.js index 3694a57f..0e914a82 100644 --- a/pc4mobx/hrmSalary/stores/payroll.js +++ b/pc4mobx/hrmSalary/stores/payroll.js @@ -1,10 +1,10 @@ -import { observable, action, toJS } from 'mobx'; -import { message } from 'antd'; -import { WeaForm, WeaTableNew } from 'comsMobx'; +import { observable, action, toJS } from "mobx"; +import { message } from "antd"; +import { WeaForm, WeaTableNew } from "comsMobx"; -import * as API from '../apis/payroll'; // 引入API接口文件 -import { notNull } from '../util/validate'; -import { removePropertyCondition } from '../util/response'; +import * as API from "../apis/payroll"; // 引入API接口文件 +import { notNull } from "../util/validate"; +import { removePropertyCondition } from "../util/response"; const { TableStore } = WeaTableNew; @@ -16,20 +16,19 @@ export class payrollStore { @observable showSearchAd = false; // 高级搜索面板显示 @observable loading = true; // 数据加载状态 - // **** 模板页面 **** + // **** 模板页面 **** @observable templateStore = new TableStore(); // 模板设置列表 // 基础设置表单 - @observable templateBaseData = {} // 基础信息表单数据 - @observable salarySobOptions = [] // 账套列表 + @observable templateBaseData = {}; // 基础信息表单数据 + @observable salarySobOptions = []; // 账套列表 // 显示设置表单 - @observable salaryTemplateShowSet = {} // 显示设置基础表单 - @observable salaryItemSet = [] // 显示设置薪资项 - + @observable salaryTemplateShowSet = {}; // 显示设置基础表单 + @observable salaryItemSet = []; // 显示设置薪资项 // **** 工资单页面 **** @observable salarySendTableStore = new TableStore(); // 工资单列表 @observable salarySendDataSource = []; - @observable pageInfo = {} + @observable pageInfo = {}; // **** 工资单详情页 **** @observable salarySendDetailBaseInfo = {}; // 工资单详情基础信息 @@ -38,513 +37,503 @@ export class payrollStore { @observable detailListConditionForm = new WeaForm(); // 详情页搜索条件 @observable detailListShowSearchAd = false; // 详情页是否展开搜索面板 @observable detailListCondition = []; // 详情页搜索条件 - @observable salarySendDetailPageInfo ={} + @observable salarySendDetailPageInfo = {}; // **** 工资单发放页 **** @observable salaryGrantDataSource = []; - @observable salaryGrantPageInfo ={}; - @observable salaryGrantTableStore = new TableStore(); + @observable salaryGrantPageInfo = {}; + @observable salaryGrantTableStore = []; @observable grantListConditionForm = new WeaForm(); // 详情页搜索条件 @observable grantListShowSearchAd = false; // 详情页是否展开搜索面板 @observable grantListCondition = []; // 详情页搜索条件 @observable canGrantDataSource = []; // 可以发送的列表 - @observable canGrantColumns = []; // 可以发送的列名 + @observable canGrantColumns = []; // 可以发送的列名 @observable canGrantPageInfo = {}; // 可以发送列表分页对象 @observable canWithdrawDataSource = []; // 可以撤回的列表 @observable canWidthdrawColumns = []; // 可以撤回的列表列名 @observable canWithdrawPageInfo = {}; // 可以撤回列表分页对象 @action - setGrantListShowSearchAd = (grantListShowSearchAd) => this.grantListShowSearchAd = grantListShowSearchAd + setGrantListShowSearchAd = grantListShowSearchAd => + (this.grantListShowSearchAd = grantListShowSearchAd); // 详情页是否展开搜索面板 @action - setDetailListShowSearchAd = (detailListShowSearchAd) => this.detailListShowSearchAd = detailListShowSearchAd + setDetailListShowSearchAd = detailListShowSearchAd => + (this.detailListShowSearchAd = detailListShowSearchAd); // 基础信息表单数据 @action - setTemplateBaseData = (templateBaseData) => this.templateBaseData = templateBaseData + setTemplateBaseData = templateBaseData => + (this.templateBaseData = templateBaseData); // 显示设置基础表单 @action - setSalaryTemplateShowSet = (salaryTemplateShowSet) => this.salaryTemplateShowSet = salaryTemplateShowSet + setSalaryTemplateShowSet = salaryTemplateShowSet => + (this.salaryTemplateShowSet = salaryTemplateShowSet); @action - setSalaryItemSet = (salaryItemSet) => this.salaryItemSet = salaryItemSet + setSalaryItemSet = salaryItemSet => (this.salaryItemSet = salaryItemSet); // 初始化操作 @action doInit = () => { // this.getCondition(); // this.getTableDatas(); - } + }; // 获得高级搜索表单数据 @action getCondition = () => { - API.getCondition().then(action(res => { - if (res.api_status) { // 接口请求成功/失败处理 - let condition = removePropertyCondition(res.condition); - this.form.initFormFields(condition); // 渲染高级搜索form表单 - } else { - message.error(res.msg || '接口调用失败!') - } - })); - } + API.getCondition().then( + action(res => { + if (res.api_status) { + // 接口请求成功/失败处理 + let condition = removePropertyCondition(res.condition); + this.form.initFormFields(condition); // 渲染高级搜索form表单 + } else { + message.error(res.msg || "接口调用失败!"); + } + }) + ); + }; // 渲染table数据 @action - getTableDatas = (params) => { + getTableDatas = params => { this.loading = true; const formParams = this.form.getFormParams() || {}; params = params || formParams; - API.getTableDatas(params).then(action(res => { - if (res.api_status) { // 接口请求成功/失败处理 - this.tableStore.getDatas(res.datas); // table 请求数据 - this.hasRight = res.hasRight; - } else { - message.error(res.msg || '接口调用失败!') - } - this.loading = false; - })); - } + API.getTableDatas(params).then( + action(res => { + if (res.api_status) { + // 接口请求成功/失败处理 + this.tableStore.getDatas(res.datas); // table 请求数据 + this.hasRight = res.hasRight; + } else { + message.error(res.msg || "接口调用失败!"); + } + this.loading = false; + }) + ); + }; - @action - setShowSearchAd = bool => this.showSearchAd = bool; + @action setShowSearchAd = bool => (this.showSearchAd = bool); // 高级搜索 - 搜索 - @action doSearch = () => { + @action + doSearch = () => { this.getTableDatas(); this.showSearchAd = false; - } + }; // 工资单模板-工资单模板列表 @action getPayrollTemplateList = (params = {}) => { - this.loading = true + this.loading = true; API.getPayrollTemplateList(params).then(res => { - if(res.status) { + if (res.status) { this.templateStore.getDatas(res.data.datas); } else { message.error(res.errormsg || "获取失败"); } this.loading = false; - }) - } + }); + }; // 工资单模板-获取工资单模板基础设置表单 @action getPayrollBaseForm = (id = "") => { let params = { id - } + }; return new Promise((resolve, reject) => { API.getPayrollBaseForm(params).then(res => { - if(res.status) { - let response = res.data.salaryTemplateBaseSet - let templateBaseData = response.data - templateBaseData.salarySob = templateBaseData.salarySob != undefined ? templateBaseData.salarySob + "": null; - this.templateBaseData = templateBaseData // 基础信息表单数据 - - this.salarySobOptions = response.salarySobOptions ? - response.salarySobOptions.map(item => { - let result = {} - result.showname = item.name; - result.key = item.id + ""; - result.selected = false; - return result; - }) : [] + if (res.status) { + let response = res.data.salaryTemplateBaseSet; + let templateBaseData = response.data; + templateBaseData.salarySob = + templateBaseData.salarySob != undefined + ? templateBaseData.salarySob + "" + : null; + this.templateBaseData = templateBaseData; // 基础信息表单数据 + + this.salarySobOptions = response.salarySobOptions + ? response.salarySobOptions.map(item => { + let result = {}; + result.showname = item.name; + result.key = item.id + ""; + result.selected = false; + return result; + }) + : []; resolve({ templateBaseData: this.templateBaseData, salarySobOptions: this.salarySobOptions }); } else { message.errro(res.errormsg || "获取失败"); - reject() + reject(); } - }) - }) - } - + }); + }); + }; // 工资单模板-获取工资单模板显示设置表单 @action getPayrollShowForm = (id = "") => { let params = { id - } + }; API.getPayrollShowForm(params).then(res => { - if(res.status) { - if(id !== "") { - this.salaryItemSet = res.data.salaryTemplateSalaryItemSet + if (res.status) { + if (id !== "") { + this.salaryItemSet = res.data.salaryTemplateSalaryItemSet; } - this.salaryTemplateShowSet = res.data.salaryTemplateShowSet.data + this.salaryTemplateShowSet = res.data.salaryTemplateShowSet.data; } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; // 工资单模板-获取薪资项目设置 @action getPayrollItemList = (salarySobId = "") => { let params = { salarySobId - } + }; API.getPayrollItemList(params).then(res => { - if(res.status) { - this.salaryItemSet = res.data + if (res.status) { + this.salaryItemSet = res.data; } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; // 初始化显示设置表单 @action initShowSettingForm = (id = "") => { this.getPayrollShowForm(id); - if(id == "") { - this.getPayrollItemList(this.templateBaseData.salarySob) + if (id == "") { + this.getPayrollItemList(this.templateBaseData.salarySob); } - } - + }; + // 校验显示设置表单 validateSalaryTemplateShowSet = () => { - if(!notNull(this.salaryTemplateShowSet.theme)) { + if (!notNull(this.salaryTemplateShowSet.theme)) { message.warning("工资单主题不能为空"); return false; } return true; - } + }; // 拼装保存参数 convertParams = () => { - let params = {...this.templateBaseData, ...this.salaryTemplateShowSet} - params.salarySobId = params.salarySob + let params = { ...this.templateBaseData, ...this.salaryTemplateShowSet }; + params.salarySobId = params.salarySob; params.emailStatus = params.emailStatus ? params.emailStatus : false; - params.msgStatus = params.msgStatus ? params.msgStatus : false - params.salaryItemNullStatus = params.salaryItemNullStatus ? params.salaryItemNullStatus : false; - params.salaryItemZeroStatus = params.salaryItemZeroStatus ? params.salaryItemZeroStatus : false; - params.salaryItemSetting = this.salaryItemSet - return params - } - + params.msgStatus = params.msgStatus ? params.msgStatus : false; + params.salaryItemNullStatus = params.salaryItemNullStatus + ? params.salaryItemNullStatus + : false; + params.salaryItemZeroStatus = params.salaryItemZeroStatus + ? params.salaryItemZeroStatus + : false; + params.salaryItemSetting = this.salaryItemSet; + return params; + }; // 工资单模板-新建工资单模板 @action fetchSavePayroll = () => { - if(!(this.validateSalaryTemplateShowSet())) { - return false + if (!this.validateSalaryTemplateShowSet()) { + return false; } - let params = this.convertParams() + let params = this.convertParams(); return new Promise((resolve, reject) => { API.savePayroll(params).then(res => { - if(res.status) { + if (res.status) { message.success("保存成功"); this.getPayrollTemplateList(); resolve(); - } else { - message.error(res.errormsg || "保存失败") - reject() + } else { + message.error(res.errormsg || "保存失败"); + reject(); } - }) - }) - } + }); + }); + }; // 工资单模板-更新工资单模板 @action - fetchUpdatePayroll = (id) => { - if(!(this.validateSalaryTemplateShowSet())) { - return false + fetchUpdatePayroll = id => { + if (!this.validateSalaryTemplateShowSet()) { + return false; } - let params = this.convertParams() - params.id = id + let params = this.convertParams(); + params.id = id; return new Promise((resolve, reject) => { API.updatePayroll(params).then(res => { - if(res.status) { + if (res.status) { message.success("保存成功"); this.getPayrollTemplateList(); resolve(); - } else { - message.error(res.errormsg || "保存失败") - reject() + } else { + message.error(res.errormsg || "保存失败"); + reject(); } - }) - }) - } + }); + }); + }; //工资单-获取薪资账套下拉列表 @action getPayrollTemplateLedgerList = () => { return new Promise((resolve, reject) => { API.getPayrollTemplateLedgerList().then(res => { - if(res.status) { + if (res.status) { this.payrollTemplateLedgerList = res.data.map(item => { - let result = {} + let result = {}; result.showname = item.content; result.selected = false; - result.key = item.id + result.key = item.id; return result; - }) - resolve(this.payrollTemplateLedgerList) + }); + resolve(this.payrollTemplateLedgerList); } else { message.error(res.errormsg || "获取失败"); - reject() + reject(); } - }) - }) - } + }); + }); + }; // 工资单模板-工资单模板默认使用 @action changePayrollDefaultUse(id = "") { - if(id == "") { + if (id == "") { message.warning("id必填"); - return + return; } let params = { id - } + }; return new Promise((resolve, reject) => { API.changePayrollDefaultUse(params).then(res => { - if(res.status) { + if (res.status) { message.success("设置成功"); - resolve() + resolve(); } else { - message.success(res.errormsg || "设置失败") - reject() + message.success(res.errormsg || "设置失败"); + reject(); } - }) - }) + }); + }); } // 工资单模板-复制工资单模板 @action duplicatePayroll = (id, name) => { let params = { - id, name - } + id, + name + }; return new Promise((resolve, reject) => { API.duplicatePayroll(params).then(res => { - if(res.status) { - message.success("复制成功") - this.getPayrollTemplateList() - resolve() + if (res.status) { + message.success("复制成功"); + this.getPayrollTemplateList(); + resolve(); } else { - message.error(res.errormsg || "复制失败") + message.error(res.errormsg || "复制失败"); reject(); } - }) - }) - } + }); + }); + }; // 工资单模板-删除工资单模板 @action - deletePayroll = (ids) => { + deletePayroll = ids => { API.deletePayroll(ids).then(res => { - if(res.status) { + if (res.status) { message.success("删除成功"); - this.getPayrollTemplateList() + this.getPayrollTemplateList(); } else { message.error(res.errormsg || "删除失败"); } - }) - } + }); + }; // 工资单-工资单发放列表 @action - getPayrollList = (parmas = {salaryYearMonth: []}) => { - this.loading = true + getPayrollList = (parmas = { salaryYearMonth: [] }) => { + this.loading = true; API.getPayrollList(parmas).then(res => { - if(res.status) { - this.salarySendDataSource = res.data.datas - this.salarySendTableStore.getDatas(res.data.dataKey.datas) - this.pageInfo = res.data.pageInfo + if (res.status) { + this.salarySendDataSource = res.data.datas; + this.salarySendTableStore.getDatas(res.data.dataKey.datas); + this.pageInfo = res.data.pageInfo; } else { message.error(res.errormsg || "获取失败"); } - this.loading = false - }) - } - + this.loading = false; + }); + }; + // 工资单发放-工资单发放基本信息 @action - getPayrollInfo = (id) => { - API.getPayrollInfo({id}).then(res => { - if(res.status) { - this.salarySendDetailBaseInfo = res.data + getPayrollInfo = id => { + API.getPayrollInfo({ id }).then(res => { + if (res.status) { + this.salarySendDetailBaseInfo = res.data; } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; // 工资单发放-工资单发放信息列表 @action getInfoList = (params = {}) => { let form = this.grantListConditionForm.getFormParams(); - params = {...form, ...params} + params = { ...form, ...params }; API.getInfoList(params).then(res => { - if(res.status) { - this.salaryGrantTableStore.getDatas(res.data.dataKey.datas) - this.salaryGrantDataSource = res.data.datas - this.salaryGrantPageInfo = res.data.pageInfo + if (res.status) { + this.salaryGrantTableStore = res.data.columns; + this.salaryGrantDataSource = res.data.list; + this.salaryGrantPageInfo = { + total: res.data.total, + pageNum: res.data.pageNum + }; + this.getPayrollInfo(params.salarySendId); } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; // 工资单-工资单发放详情列表 @action - getPayrollDetailList = (params) => { - let form = this.detailListConditionForm.getFormParams() || {} - params = {...form, ...params} + getPayrollDetailList = params => { + let form = this.detailListConditionForm.getFormParams() || {}; + params = { ...form, ...params }; API.getPayrollDetailList(params).then(res => { - if(res.status) { - this.salarySendDetailTableStore.getDatas(res.data.dataKey.datas) - this.salarySendDetailDataSource = res.data.datas - this.salarySendDetailPageInfo = res.data.pageInfo + if (res.status) { + this.salarySendDetailTableStore.getDatas(res.data.dataKey.datas); + this.salarySendDetailDataSource = res.data.datas; + this.salarySendDetailPageInfo = res.data.pageInfo; } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } - + }); + }; // 工资单详情页 - 获得高级搜索表单数据 @action getPayrollDetailSa = (params = {}) => { API.getPayrollDetailSa(params).then(res => { - if (res.status) { // 接口请求成功/失败处理 + if (res.status) { + // 接口请求成功/失败处理 let condition = removePropertyCondition(res.data.condition); - this.detailListCondition = condition + this.detailListCondition = condition; this.detailListConditionForm.initFormFields(condition); // 渲染高级搜索form表单 } else { - message.error(res.errormsg || '接口调用失败!') + message.error(res.errormsg || "接口调用失败!"); } }); - } + }; // 工资单发放-导出-工资单发放详情列表 @action exportDetailList = (params = {}) => { - API.exportDetailList(params) - } + API.exportDetailList(params); + }; // 工资单-获取工资单发放高级搜索 @action getPaySa = (params = {}) => { API.getPaySa(params).then(res => { - if(res.status) { - let condition = removePropertyCondition(res.data.condition) + if (res.status) { + let condition = removePropertyCondition(res.data.condition); this.grantListCondition = condition; - this.grantListConditionForm.initFormFields(condition); + this.grantListConditionForm.initFormFields(condition); } else { - message.error(res.errormsg || "接口调用失败") + message.error(res.errormsg || "接口调用失败"); } - }) - } + }); + }; // 工资单发放-工资单批量发放信息列表 @action batchSendInfoList = (params = {}) => { API.batchSendInfoList(params).then(res => { - if(res.status) { - let datas = res.data.datas || []; - datas.map(item => { - item.key = item.id - }) - this.canGrantDataSource = datas + if (res.status) { + this.canGrantDataSource = res.data.list; this.canGrantColumns = res.data.columns; - this.canGrantPageInfo = res.data.pageInfo - // alert("this.canGrantColumns:" + JSON.stringify(this.canGrantColumns)) + this.canGrantPageInfo = { + total: res.data.total, + pageNum: res.data.pageNum + }; } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; // 工资单发放-工资单批量撤回信息列表 @action batchWithdrawInfoList = (params = {}) => { API.batchWithdrawInfoList(params).then(res => { - if(res.status) { - let datas = res.data.datas || []; + if (res.status) { + let datas = res.data.list || []; datas.map(item => { - item.key = item.id - }) - this.canWithdrawDataSource = datas - this.canWidthdrawColumns = res.data.columns - this.canWithdrawPageInfo = res.data.pageInfo + item.key = item.id; + }); + this.canWithdrawDataSource = datas; + this.canWidthdrawColumns = res.data.columns; + this.canWithdrawPageInfo = { + total: res.data.total, + pageNum: res.data.pageNum + }; } else { message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; //工资单-工资单发放 @action grantPayroll = (params = {}) => { return new Promise((resolve, reject) => { API.grantPayroll(params).then(res => { - if(res.status) { + if (res.status) { message.success("发送成功"); resolve(); } else { - message.error(res.errormsg || "发送失败") + message.error(res.errormsg || "发送失败"); reject(); } - }) - }) - } + }); + }); + }; // 工资单-工资单撤回 @action withdrawPayroll = (params = {}) => { return new Promise((resolve, reject) => { API.withdrawPayroll(params).then(res => { - if(res.status) { + if (res.status) { message.success("撤回成功"); - resolve() + resolve(); } else { - message.error(res.errormsg || "撤回失败") + message.error(res.errormsg || "撤回失败"); reject(); } - }) - }) - } - - // 工资单-按钮状态 - @action - getSendBtnStatus = (params = {}) => { - return new Promise((resolve, reject) => { - API.getSendBtnStatus(params).then(res => { - if(res.status) { - resolve(res.data) - } else { - reject() - } - }) - }) - } - - // 工资单-扩展按钮点击 - @action - grantProxy = (params = {}) => { - return new Promise((resolve, reject) => { - API.grantProxy(params).then(res => { - if(res.status) { - message.success("发起流程") - resolve(res.data) - } else { - message.error(res.errormsg || "发起失败") - reject() - } - }) - }) - } - - -} \ No newline at end of file + }); + }); + }; +} diff --git a/pc4mobx/hrmSalary/stores/taxAgent.js b/pc4mobx/hrmSalary/stores/taxAgent.js index abe89476..b1c23142 100644 --- a/pc4mobx/hrmSalary/stores/taxAgent.js +++ b/pc4mobx/hrmSalary/stores/taxAgent.js @@ -16,6 +16,7 @@ export class TaxAgentStore { @observable condition = []; // 存储后台得到的form数据 @observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据 @observable showSearchAd = false; // 高级搜索面板显示 + @observable showOperateBtn = false; // 页面操作按钮显示权限 @observable loading = false; // 数据加载状态 @observable modalVisiable = false; // EditModal 模态框 @observable columns = []; @@ -31,6 +32,8 @@ export class TaxAgentStore { @action setDataSource = dataSource => (this.dataSource = dataSource); + @action setShowOperateBtn = bool => (this.showOperateBtn = bool); + // 初始化操作 @action doInit = params => { @@ -118,6 +121,10 @@ export class TaxAgentStore { return new Promise((resolve, reject) => { API.getPermission(params).then(({ status, data }) => { if (status) { + const { isAdminEnable, isOpenDevolution } = data; + this.setShowOperateBtn( + !isOpenDevolution ? true : isAdminEnable ? true : false + ); resolve({ status, data }); } else { reject();