操作菜单权限得bug修复

This commit is contained in:
liyongshun 2022-06-22 17:14:53 +08:00
parent 60a97f9736
commit e3d30694c3
15 changed files with 756 additions and 615 deletions

View File

@ -31,7 +31,7 @@ export default class ItemMangeFormModal extends React.Component {
this.setState({request: result}) this.setState({request: result})
} }
convertFieldType(fileTypeStr) { convertFieldType=(fileTypeStr)=> {
if(fileTypeStr == "数值") { if(fileTypeStr == "数值") {
return "1" return "1"
} else if(fileTypeStr == "文本"){ } else if(fileTypeStr == "文本"){
@ -57,7 +57,7 @@ export default class ItemMangeFormModal extends React.Component {
] ]
const { request } = this.state; const { request } = this.state;
const {fieldName, fieldType, enableStatus, description} = request const {fieldName, fieldType, enableStatus, description} = request
let fileTypeKey = convertFieldType(fieldType) let fileTypeKey = this.convertFieldType(fieldType)
const { attendanceStore : {currentItemOperate}} = this.props; const { attendanceStore : {currentItemOperate}} = this.props;
return ( return (
<Modal width={600} visible={this.props.visible} onCancel={this.props.onCancel} <Modal width={600} visible={this.props.visible} onCancel={this.props.onCancel}

View File

@ -435,7 +435,7 @@ export default class CumDeduct extends React.Component {
getTableDatas({ getTableDatas({
current, current,
pageSize, pageSize,
taxAgentId, taxAgentId: taxAgentId==='All' ? '' : taxAgentId,
declareMonth: monthValue && [monthValue], declareMonth: monthValue && [monthValue],
}); });
}, },
@ -444,7 +444,7 @@ export default class CumDeduct extends React.Component {
getTableDatas({ getTableDatas({
current, current,
pageSize: pageObj.pageSize, pageSize: pageObj.pageSize,
taxAgentId, taxAgentId: taxAgentId==='All' ? '' : taxAgentId,
declareMonth: monthValue && [monthValue], declareMonth: monthValue && [monthValue],
}); });
}, },

View File

@ -441,7 +441,7 @@ export default class CumSituation extends React.Component {
getTableDatas({ getTableDatas({
current, current,
pageSize, pageSize,
taxAgentId, taxAgentId:taxAgentId==='All' ? '' : taxAgentId,
declareMonth: monthValue && [monthValue], declareMonth: monthValue && [monthValue],
}); });
}, },
@ -450,7 +450,7 @@ export default class CumSituation extends React.Component {
getTableDatas({ getTableDatas({
current, current,
pageSize: pageObj.pageSize, pageSize: pageObj.pageSize,
taxAgentId, taxAgentId:taxAgentId==='All' ? '' : taxAgentId,
declareMonth: monthValue && [monthValue], declareMonth: monthValue && [monthValue],
}); });
}, },

View File

@ -437,7 +437,7 @@ export default class OtherDeduct extends React.Component {
getTableDatas({ getTableDatas({
current, current,
pageSize, pageSize,
taxAgentId, taxAgentIdL:taxAgentId==='All' ? '' : taxAgentId,
declareMonth: monthValue && [monthValue], declareMonth: monthValue && [monthValue],
}); });
}, },
@ -446,7 +446,7 @@ export default class OtherDeduct extends React.Component {
getTableDatas({ getTableDatas({
current, current,
pageSize: pageObj.pageSize, pageSize: pageObj.pageSize,
taxAgentId, taxAgentId:taxAgentId==='All' ? '' : taxAgentId,
declareMonth: monthValue && [monthValue], declareMonth: monthValue && [monthValue],
}); });
}, },

View File

@ -582,6 +582,7 @@ export default class Ledger extends React.Component {
{ title: "薪资项目", key: 2 }, { title: "薪资项目", key: 2 },
{ title: "调薪计薪规则", key: 3 }, { title: "调薪计薪规则", key: 3 },
]} ]}
showOperateBtn={showOperateBtn}
editable={canEdit === "true"} editable={canEdit === "true"}
selectedTab={selectedTab} selectedTab={selectedTab}
onSave={() => this.handleEditSlideSave()} onSave={() => this.handleEditSlideSave()}

View File

@ -7,7 +7,7 @@ import moment from "moment";
import CustomTable from "../../components/customTable"; import CustomTable from "../../components/customTable";
import CustomPaginationTable from "../../components/customPaginationTable"; import CustomPaginationTable from "../../components/customPaginationTable";
@inject("payrollStore") @inject("payrollStore", "taxAgentStore")
@observer @observer
export default class SalarySendList extends React.Component { export default class SalarySendList extends React.Component {
constructor(props) { constructor(props) {
@ -52,7 +52,7 @@ export default class SalarySendList extends React.Component {
getColumns() { getColumns() {
const { const {
payrollStore: { salarySendTableStore }, payrollStore: { salarySendTableStore },
showOperateBtn taxAgentStore: { showOperateBtn }
} = this.props; } = this.props;
const { columns } = salarySendTableStore; const { columns } = salarySendTableStore;
if (!columns) { if (!columns) {
@ -80,7 +80,7 @@ export default class SalarySendList extends React.Component {
} }
}); });
showOperateBtn showOperateBtn
? result.concat([ ? (result = result.concat([
{ {
title: "操作", title: "操作",
key: "operate", key: "operate",
@ -128,8 +128,8 @@ export default class SalarySendList extends React.Component {
); );
} }
} }
]) ]))
: result.concat([ : (result = result.concat([
{ {
title: "操作", title: "操作",
key: "operate", key: "operate",
@ -144,7 +144,7 @@ export default class SalarySendList extends React.Component {
); );
} }
} }
]); ]));
return result; return result;
} }

View File

@ -352,7 +352,6 @@ export default class Payroll extends React.Component {
{ {
this.state.selectedKey == 0 && this.state.selectedKey == 0 &&
<SalarySendList <SalarySendList
showOperateBtn={showOperateBtn}
onEditTemplate={(record) => { onEditTemplate={(record) => {
this.handleTemplateListEdit(record) this.handleTemplateListEdit(record)
}} }}
@ -432,6 +431,7 @@ export default class Payroll extends React.Component {
tabs={[{title: '基础设置', key: 0}, {title: "显示设置", key: 1}]} tabs={[{title: '基础设置', key: 0}, {title: "显示设置", key: 1}]}
editable={false} editable={false}
selectedTab={selectedTab} selectedTab={selectedTab}
showOperateBtn={showOperateBtn}
customOperate={<span> customOperate={<span>
{ {
selectedTab == 0 && <Button type="primary" onClick={() => {this.handleUpdateSave()}}>保存</Button> selectedTab == 0 && <Button type="primary" onClick={() => {this.handleUpdateSave()}}>保存</Button>

View File

@ -95,17 +95,13 @@ export default class PayrollGrant extends React.Component {
getColumns() { getColumns() {
const { payrollStore } = this.props; const { payrollStore } = this.props;
const { salaryGrantTableStore } = payrollStore const { salaryGrantTableStore: columns } = payrollStore
const { columns } = salaryGrantTableStore;
if(!columns) {
return []
}
let result = columns.filter(item => item.hide == "false").map(item => { let result = [...columns, {title: "操作",key: "operation",dataIndex: "operation"}].map(item => {
item = {...item} item = {...item}
if(item.dataIndex == "operation") { if(item.dataIndex == "operation") {
item.render = (text,record) => { item.render = (text,record) => {
if(text == 'ALREADYSEND') { if(record.sendStatus == '已发放') {
return ( return (
<a onClick={() => {this.handleWithdraw(record)}}>撤回</a> <a onClick={() => {this.handleWithdraw(record)}}>撤回</a>
) )
@ -144,9 +140,9 @@ export default class PayrollGrant extends React.Component {
); );
return ( return (
<div style={{display: "inline-block"}}> <div style={{display: "inline-block"}}>
<Button type="primary" style={{marginRight: "10px"}} onClick={() => {this.handleGrantAll()}}>全部发放</Button> <Button type="primary" style={{marginRight: "1rem"}} onClick={() => {this.handleGrantAll()}}>全部发放</Button>
<Button type="default" style={{marginRight: "10px"}} onClick={() => {this.handleWithdrawAll()}}>全部撤回</Button> <Button type="default" style={{marginRight: "1rem"}} onClick={() => {this.handleWithdrawAll()}}>全部撤回</Button>
<Dropdown.Button style={{marginRight: "10px"}} overlay={menu}>更多</Dropdown.Button> <Dropdown.Button style={{marginRight: "1rem"}} overlay={menu}>更多</Dropdown.Button>
</div> </div>
) )
} }
@ -205,7 +201,7 @@ export default class PayrollGrant extends React.Component {
<div className="titleBarLeft"> <div className="titleBarLeft">
<span>薪资所属月{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.year}-{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.monthValue}</span> <span>薪资所属月{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.year}-{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.monthValue}</span>
<WeaHelpfulTip <WeaHelpfulTip
style={{marginLeft: '10px', marginRight: "10px"}} style={{marginLeft: '1rem', marginRight: "1rem"}}
width={200} width={200}
title={`薪资周期\n title={`薪资周期\n
${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle.fromDate} ${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle.endDate}\n ${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle.fromDate} ${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle.endDate}\n

View File

@ -1,181 +1,246 @@
import React from 'react' import React from "react";
import { WeaInputSearch, WeaHelpfulTip, WeaTable } from "ecCom" import { WeaInputSearch, WeaHelpfulTip, WeaTable } from "ecCom";
import { payrollGrantColumns, dataSource } from "../columns" import { payrollGrantColumns, dataSource } from "../columns";
import { Menu, Button,Table, Modal, Dropdown,message } from "antd" import { Menu, Button, Table, Modal, Dropdown, message } from "antd";
import { inject, observer } from 'mobx-react'; import { inject, observer } from "mobx-react";
@inject('payrollStore') @inject("payrollStore")
@observer @observer
export default class payrollGrantModal extends React.Component { export default class payrollGrantModal extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
selectedRowKeys: [], selectedRowKeys: [],
current: 1, current: 1,
searchValue: "" searchValue: ""
} };
} }
// 撤回 // 撤回
handleWithdraw(record) { handleWithdraw(record) {
const { payrollStore } = this.props; const { payrollStore } = this.props;
const { withdrawPayroll, batchSendInfoList } = payrollStore; const { withdrawPayroll, batchSendInfoList } = payrollStore;
withdrawPayroll({ withdrawPayroll({
ids: [record.id], ids: [record.id],
salarySendId: this.props.sendId salarySendId: this.props.sendId
}).then(() => { }).then(() => {
batchSendInfoList({salarySendId: this.props.sendId}) batchSendInfoList({ salarySendId: this.props.sendId });
}) });
} }
// 发送 // 发送
handleGrant(record) { handleGrant(record) {
const { payrollStore } = this.props; const { payrollStore } = this.props;
const { grantPayroll, batchSendInfoList } = payrollStore; const { grantPayroll, batchSendInfoList } = payrollStore;
grantPayroll({ grantPayroll({
ids: [record.id], ids: [record.id],
salarySendId: this.props.sendId salarySendId: this.props.sendId
}).then(() => { }).then(() => {
batchSendInfoList({salarySendId: this.props.sendId}) batchSendInfoList({ salarySendId: this.props.sendId });
}) });
} }
componentWillMount() { componentWillMount() {
const { payrollStore: { batchSendInfoList } } = this.props; const { payrollStore: { batchSendInfoList } } = this.props;
batchSendInfoList({salarySendId: this.props.sendId}) batchSendInfoList({ salarySendId: this.props.sendId });
} }
getColumns() { getColumns() {
const { payrollStore } = this.props; const { payrollStore } = this.props;
const { canGrantColumns } = payrollStore const { canGrantColumns } = payrollStore;
if(!canGrantColumns) { return [
return [] ...canGrantColumns,
} { title: "操作", key: "operation", dataIndex: "operation" }
return canGrantColumns.map(item => { ].map(item => {
let result = {} if (item.key == "operation") {
result.title = item.text; item.render = (text, record) => {
result.dataIndex = item.column; if (record.sendStatus == "已发放") {
result.key = item.column; return (
result.width = item.width; <a
if(result.key == "operation") { onClick={() => {
result.render = (text,record) => { this.handleWithdraw(record);
if(text == 'ALREADYSEND') { }}>
return ( 撤回
<a onClick={() => {this.handleWithdraw(record)}}>撤回</a> </a>
) );
} else { } else {
return ( return (
<a onClick={() => {this.handleGrant(record)}}>发送</a> <a
) onClick={() => {
} this.handleGrant(record);
} }}>
} else { 发送
result.dataIndex = item.column; </a>
} );
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 = (
<Menu onClick={(e) => this.handleMenuClick(e)}>
<Menu.Item key="1">发放所选</Menu.Item>
</Menu>
);
const {payrollStore} = this.props;
const { salarySendDetailBaseInfo, canGrantDataSource, canGrantPageInfo } = payrollStore;
const { selectedRowKeys } = this.state;
const rowSelection = {
selectedRowKeys,
onChange: this.onSelectChange.bind(this),
}; };
}
return ( return item;
<Modal width={800} visible={this.props.visible} onCancel={() => {this.props.onCancel()}}> });
<div style={{padding: "0px 10px", height: "47px", lineHeight: "47px"}}> }
<span style={{fontSize: "14px", color: '#666'}}>批量发放</span>
<div style={{float: "right", marginRight: "40px"}}> onSelectChange = value => {
<Dropdown.Button type="primary" style={{marginRight: "10px"}} overlay={menu} onClick={() => {this.handleGrantAll()}}>全部发放</Dropdown.Button> this.setState({
<WeaInputSearch value={this.state.searchValue} onChange={(value) => {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/> selectedRowKeys: value
</div> });
</div> };
<div style={{height: "40px", lineHeight: "40px"}}>
<div className="titleBarLeft"> // 发放
<span>薪资所属月{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.year}-{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.monthValue}</span> fetchGrantPayRoll(payload) {
<WeaHelpfulTip const { payrollStore: { grantPayroll } } = this.props;
style={{marginLeft: '10px', marginRight: "10px"}} grantPayroll(payload).then(() => {
width={200} const { payrollStore: { getInfoList } } = this.props;
title={`薪资周期\n getInfoList({
${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle.fromDate} ${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle.endDate}\n salarySendId: this.props.sendId
税款所属期\n });
${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.taxCycle}\n this.props.onCancel && this.props.onCancel();
考勤取值周期\n });
${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.attendCycle && salarySendDetailBaseInfo.salarySobCycle.attendCycle.fromDate}至${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.attendCycle && salarySendDetailBaseInfo.salarySobCycle.attendCycle.endDate}\n }
福利台账月份\n
引用${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.socialSecurityCycle}的福利台账数据`} handleMenuClick(e) {
placement="topLeft" const { selectedRowKeys } = this.state;
/> const { payrollStore: { grantPayroll } } = this.props;
<span>工资单模板{salarySendDetailBaseInfo.template}</span> if (selectedRowKeys.length == 0) {
</div> message.warning("未选择条目");
</div> return;
<div style={{marginTop: "10px", height: "500px", overflowY: "scroll"}}>
<WeaTable rowSelection={rowSelection} dataSource={canGrantDataSource} columns={this.getColumns()}
pagination={{
onChange: (value) => {this.handleDataPageChange(value)},
total: canGrantPageInfo.total,
current: canGrantPageInfo.pageNum,
showTotal: (total) => `${total}`,
}}
/>
</div>
</Modal>
)
} }
} 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 = (
<Menu onClick={e => this.handleMenuClick(e)}>
<Menu.Item key="1">发放所选</Menu.Item>
</Menu>
);
const { payrollStore } = this.props;
const {
salarySendDetailBaseInfo,
canGrantDataSource,
canGrantPageInfo
} = payrollStore;
const { selectedRowKeys } = this.state;
const rowSelection = {
selectedRowKeys,
onChange: this.onSelectChange.bind(this)
};
return (
<Modal
width={800}
visible={this.props.visible}
onCancel={() => {
this.props.onCancel();
}}>
<div
style={{ padding: "0px 10px", height: "47px", lineHeight: "47px" }}>
<span style={{ fontSize: "14px", color: "#666" }}>批量发放</span>
<div style={{ float: "right", marginRight: "40px" }}>
<Dropdown.Button
type="primary"
style={{ marginRight: "10px" }}
overlay={menu}
onClick={() => {
this.handleGrantAll();
}}>
全部发放
</Dropdown.Button>
<WeaInputSearch
value={this.state.searchValue}
onChange={value => {
this.setState({ searchValue: value });
}}
onSearch={value => {
this.handleSearch(value);
}}
/>
</div>
</div>
<div style={{ height: "40px", lineHeight: "40px" }}>
<div className="titleBarLeft">
<span>
薪资所属月{salarySendDetailBaseInfo.salaryMonth &&
salarySendDetailBaseInfo.salaryMonth
.year}-{salarySendDetailBaseInfo.salaryMonth &&
salarySendDetailBaseInfo.salaryMonth.monthValue}
</span>
<WeaHelpfulTip
style={{ marginLeft: "10px", marginRight: "10px" }}
width={200}
title={`薪资周期\n
${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle
.salaryCycle &&
salarySendDetailBaseInfo.salarySobCycle
.salaryCycle
.fromDate} ${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle.salaryCycle &&
salarySendDetailBaseInfo.salarySobCycle.salaryCycle.endDate}\n
税款所属期\n
${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle
.taxCycle}\n
考勤取值周期\n
${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle
.attendCycle &&
salarySendDetailBaseInfo.salarySobCycle
.attendCycle
.fromDate}至${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle.attendCycle &&
salarySendDetailBaseInfo.salarySobCycle.attendCycle.endDate}\n
福利台账月份\n
引用${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle
.socialSecurityCycle}的福利台账数据`}
placement="topLeft"
/>
<span>
工资单模板{salarySendDetailBaseInfo.template}
</span>
</div>
</div>
<div
style={{ marginTop: "10px", height: "500px", overflowY: "scroll" }}>
<WeaTable
rowSelection={rowSelection}
dataSource={canGrantDataSource}
columns={this.getColumns()}
pagination={{
onChange: value => {
this.handleDataPageChange(value);
},
total: canGrantPageInfo.total,
current: canGrantPageInfo.pageNum,
showTotal: total => `${total}`
}}
/>
</div>
</Modal>
);
}
}

View File

@ -1,188 +1,245 @@
import React from 'react' import React from "react";
import { WeaInputSearch, WeaHelpfulTip, WeaTable } from "ecCom" import { WeaInputSearch, WeaHelpfulTip, WeaTable } from "ecCom";
import { payrollGrantColumns, dataSource } from "../columns" import { payrollGrantColumns, dataSource } from "../columns";
import { Menu, Button,Table, Modal, Dropdown } from "antd" import { Menu, Button, Table, Modal, Dropdown } from "antd";
import { inject, observer } from 'mobx-react'; import { inject, observer } from "mobx-react";
@inject("payrollStore")
@inject('payrollStore')
@observer @observer
export default class PayrollWithdrawModal extends React.Component { export default class PayrollWithdrawModal extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
selectedRowKeys: [], selectedRowKeys: [],
current: 1, current: 1
} };
} }
componentWillMount() { componentWillMount() {
const { payrollStore } = this.props const { payrollStore } = this.props;
const { batchWithdrawInfoList } = payrollStore const { batchWithdrawInfoList } = payrollStore;
batchWithdrawInfoList({salarySendId:this.props.sendId}) batchWithdrawInfoList({ salarySendId: this.props.sendId });
} }
// 撤回 // 撤回
handleWithdraw(record) { handleWithdraw(record) {
const { payrollStore } = this.props; const { payrollStore } = this.props;
const { withdrawPayroll, batchWithdrawInfoList } = payrollStore; const { withdrawPayroll, batchWithdrawInfoList } = payrollStore;
withdrawPayroll({ withdrawPayroll({
ids: [record.id], ids: [record.id],
salarySendId: this.props.sendId salarySendId: this.props.sendId
}).then(() => { }).then(() => {
batchWithdrawInfoList({salarySendId:this.props.sendId}) batchWithdrawInfoList({ salarySendId: this.props.sendId });
}) });
} }
// 发送 // 发送
handleGrant(record) { handleGrant(record) {
const { payrollStore } = this.props; const { payrollStore } = this.props;
const { grantPayroll,batchWithdrawInfoList } = payrollStore; const { grantPayroll, batchWithdrawInfoList } = payrollStore;
grantPayroll({ grantPayroll({
ids: [record.id], ids: [record.id],
salarySendId: this.props.sendId salarySendId: this.props.sendId
}).then(() => { }).then(() => {
batchWithdrawInfoList({salarySendId:this.props.sendId}) batchWithdrawInfoList({ salarySendId: this.props.sendId });
}) });
} }
getColumns() { getColumns() {
const { payrollStore } = this.props; const { payrollStore } = this.props;
const { canWidthdrawColumns } = payrollStore const { canWidthdrawColumns } = payrollStore;
if(!canWidthdrawColumns) { return [
return [] ...canWidthdrawColumns,
} { title: "操作", key: "operation", dataIndex: "operation" }
return canWidthdrawColumns.map(item => { ].map(item => {
let result = {} if (item.key == "operation") {
result.title = item.text; item.render = (text, record) => {
result.key = item.column; if (record.sendStatus == "已发放") {
result.dataIndex = item.column; return (
result.width = item.width; <a
if(result.key == "operation") { onClick={() => {
result.render = (text,record) => { this.handleWithdraw(record);
if(text == 'ALREADYSEND') { }}>
return ( 撤回
<a onClick={() => {this.handleWithdraw(record)}}>撤回</a> </a>
) );
} else { } else {
return ( return (
<a onClick={() => {this.handleGrant(record)}}>发送</a> <a
) onClick={() => {
} this.handleGrant(record);
} }}>
} else { 发送
result.dataIndex = item.column; </a>
} );
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 = (
<Menu onClick={(e) => this.handleMenuClick(e)}>
<Menu.Item key="1">撤回所选</Menu.Item>
</Menu>
);
const {payrollStore} = this.props;
const { salarySendDetailBaseInfo, canWidthdrawColumns, canWithdrawDataSource, canWithdrawPageInfo } = payrollStore;
const { selectedRowKeys } = this.state;
const rowSelection = {
selectedRowKeys,
onChange: this.onSelectChange.bind(this),
}; };
}
return item;
});
}
onSelectChange = value => {
this.setState({
selectedRowKeys: value
});
};
return ( // 撤回
<Modal width={800} visible={this.props.visible} onCancel={() => {this.props.onCancel()}}> fetchWithdrawPayroll(payload) {
<div style={{padding: "0px 10px", height: "47px", lineHeight: "47px"}}> const { payrollStore: { grantPayroll, withdrawPayroll } } = this.props;
<span style={{fontSize: "14px", color: '#666'}}>批量撤回</span> withdrawPayroll(payload).then(() => {
<div style={{float: "right", marginRight: "40px"}}> const { payrollStore: { getInfoList } } = this.props;
<Dropdown.Button style={{marginRight: "10px"}} overlay={menu} onClick={() => {this.handleWithdrawAll()}}>全部撤回</Dropdown.Button> getInfoList({
<WeaInputSearch value={this.state.searchValue} onChange={(value) => {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/> salarySendId: this.props.sendId
</div> });
</div> this.props.onCancel && this.props.onCancel();
<div style={{height: "40px", lineHeight: "40px"}}> });
<div className="titleBarLeft"> }
<span>薪资所属月{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.year}-{salarySendDetailBaseInfo.salaryMonth && salarySendDetailBaseInfo.salaryMonth.monthValue}</span>
<WeaHelpfulTip handleMenuClick(e) {
style={{marginLeft: '10px', marginRight: "10px"}} const { selectedRowKeys } = this.state;
width={200} const { payrollStore: { grantPayroll } } = this.props;
title={`薪资周期\n if (selectedRowKeys.length == 0) {
${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle.fromDate} ${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle && salarySendDetailBaseInfo.salarySobCycle.salaryCycle.endDate}\n message.warning("未选择条目");
税款所属期\n return;
${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.taxCycle}\n
考勤取值周期\n
${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.attendCycle && salarySendDetailBaseInfo.salarySobCycle.attendCycle.fromDate}至${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.attendCycle && salarySendDetailBaseInfo.salarySobCycle.attendCycle.endDate}\n
福利台账月份\n
引用${salarySendDetailBaseInfo.salarySobCycle && salarySendDetailBaseInfo.salarySobCycle.socialSecurityCycle}的福利台账数据`}
placement="topLeft"
/>
<span>工资单模板{salarySendDetailBaseInfo.template}</span>
</div>
</div>
<div style={{marginTop: "10px", height: "500px", scrollY: "scroll"}}>
<WeaTable
rowSelection={rowSelection}
dataSource={canWithdrawDataSource}
columns={this.getColumns()}
pagination={{
onChange: (value) => {this.handleDataPageChange(value)},
total: canWithdrawPageInfo.total,
current: canWithdrawPageInfo.pageNum,
showTotal: (total) => `${total}`,
}}
/>
</div>
</Modal>
)
} }
} 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 = (
<Menu onClick={e => this.handleMenuClick(e)}>
<Menu.Item key="1">撤回所选</Menu.Item>
</Menu>
);
const { payrollStore } = this.props;
const {
salarySendDetailBaseInfo,
canWidthdrawColumns,
canWithdrawDataSource,
canWithdrawPageInfo
} = payrollStore;
const { selectedRowKeys } = this.state;
const rowSelection = {
selectedRowKeys,
onChange: this.onSelectChange.bind(this)
};
return (
<Modal
width={800}
visible={this.props.visible}
onCancel={() => {
this.props.onCancel();
}}>
<div
style={{ padding: "0px 10px", height: "47px", lineHeight: "47px" }}>
<span style={{ fontSize: "14px", color: "#666" }}>批量撤回</span>
<div style={{ float: "right", marginRight: "40px" }}>
<Dropdown.Button
style={{ marginRight: "10px" }}
overlay={menu}
onClick={() => {
this.handleWithdrawAll();
}}>
全部撤回
</Dropdown.Button>
<WeaInputSearch
value={this.state.searchValue}
onChange={value => {
this.setState({ searchValue: value });
}}
onSearch={value => {
this.handleSearch(value);
}}
/>
</div>
</div>
<div style={{ height: "40px", lineHeight: "40px" }}>
<div className="titleBarLeft">
<span>
薪资所属月{salarySendDetailBaseInfo.salaryMonth &&
salarySendDetailBaseInfo.salaryMonth
.year}-{salarySendDetailBaseInfo.salaryMonth &&
salarySendDetailBaseInfo.salaryMonth.monthValue}
</span>
<WeaHelpfulTip
style={{ marginLeft: "10px", marginRight: "10px" }}
width={200}
title={`薪资周期\n
${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle
.salaryCycle &&
salarySendDetailBaseInfo.salarySobCycle
.salaryCycle
.fromDate} ${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle.salaryCycle &&
salarySendDetailBaseInfo.salarySobCycle.salaryCycle.endDate}\n
税款所属期\n
${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle
.taxCycle}\n
考勤取值周期\n
${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle
.attendCycle &&
salarySendDetailBaseInfo.salarySobCycle
.attendCycle
.fromDate}至${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle.attendCycle &&
salarySendDetailBaseInfo.salarySobCycle.attendCycle.endDate}\n
福利台账月份\n
引用${salarySendDetailBaseInfo.salarySobCycle &&
salarySendDetailBaseInfo.salarySobCycle
.socialSecurityCycle}的福利台账数据`}
placement="topLeft"
/>
<span>
工资单模板{salarySendDetailBaseInfo.template}
</span>
</div>
</div>
<div style={{ marginTop: "10px", height: "500px", scrollY: "scroll" }}>
<WeaTable
rowSelection={rowSelection}
dataSource={canWithdrawDataSource}
columns={this.getColumns()}
pagination={{
onChange: value => {
this.handleDataPageChange(value);
},
total: canWithdrawPageInfo.total,
current: canWithdrawPageInfo.pageNum,
showTotal: total => `${total}`
}}
/>
</div>
</Modal>
);
}
}

View File

@ -248,7 +248,7 @@ export default class SalaryFile extends React.Component {
} }
render() { render() {
const { salaryFileStore } = this.props; const { salaryFileStore, taxAgentStore: { showOperateBtn } } = this.props;
const { const {
loading, loading,
hasRight, hasRight,
@ -355,7 +355,6 @@ export default class SalaryFile extends React.Component {
); );
const renderRightOperation = () => { const renderRightOperation = () => {
const { taxAgentStore: { showOperateBtn } } = this.props;
return ( return (
<div <div
style={{ display: "inline-block", position: "relative" }} style={{ display: "inline-block", position: "relative" }}
@ -555,6 +554,7 @@ export default class SalaryFile extends React.Component {
{ title: "个税扣缴义务人", key: 1 }, { title: "个税扣缴义务人", key: 1 },
]} ]}
editable={false} editable={false}
showOperateBtn={showOperateBtn}
selectedTab={selectedTab} selectedTab={selectedTab}
customOperate={() => { customOperate={() => {
renderCustomOperate(); renderCustomOperate();

View File

@ -352,6 +352,7 @@ export default class SalaryItem extends React.Component {
<SlideModalTitle <SlideModalTitle
subtitle={(this.state.isAdd ? "新建" : "修改") + "自定义薪资项目"} subtitle={(this.state.isAdd ? "新建" : "修改") + "自定义薪资项目"}
editable={false} editable={false}
showOperateBtn={showOperateBtn}
customOperate={showOperateBtn ? renderCustomOperate() : null} customOperate={showOperateBtn ? renderCustomOperate() : null}
subItemChange={ subItemChange={
(item) => {this.setState({selectedTab: item.key})} (item) => {this.setState({selectedTab: item.key})}

View File

@ -300,6 +300,7 @@ export default class Archives extends React.Component {
tabs={[{title: '基础设置', key: 0}, {title: "社保", key: 1}, {title: "公积金", key: 2}, {title: '企业年金及其他福利', key: 3}]} tabs={[{title: '基础设置', key: 0}, {title: "社保", key: 1}, {title: "公积金", key: 2}, {title: '企业年金及其他福利', key: 3}]}
editable={false} editable={false}
selectedTab={selectedTab} selectedTab={selectedTab}
showOperateBtn={showOperateBtn}
customOperate={ customOperate={
<div> <div>
{ {

View File

@ -545,6 +545,7 @@ export default class Programme extends React.Component {
subtitle={this.state.customEdit ? "修改" : "新增"} subtitle={this.state.customEdit ? "修改" : "新增"}
subTabs={[{ title: "基础设置" }]} subTabs={[{ title: "基础设置" }]}
editable={true} editable={true}
showOperateBtn={showOperateBtn}
onSave={() => { onSave={() => {
handleOnSave(); handleOnSave();
}} }}

View File

@ -1,10 +1,10 @@
import { observable, action, toJS } from 'mobx'; import { observable, action, toJS } from "mobx";
import { message } from 'antd'; import { message } from "antd";
import { WeaForm, WeaTableNew } from 'comsMobx'; import { WeaForm, WeaTableNew } from "comsMobx";
import * as API from '../apis/payroll'; // 引入API接口文件 import * as API from "../apis/payroll"; // 引入API接口文件
import { notNull } from '../util/validate'; import { notNull } from "../util/validate";
import { removePropertyCondition } from '../util/response'; import { removePropertyCondition } from "../util/response";
const { TableStore } = WeaTableNew; const { TableStore } = WeaTableNew;
@ -16,20 +16,19 @@ export class payrollStore {
@observable showSearchAd = false; // 高级搜索面板显示 @observable showSearchAd = false; // 高级搜索面板显示
@observable loading = true; // 数据加载状态 @observable loading = true; // 数据加载状态
// **** 模板页面 **** // **** 模板页面 ****
@observable templateStore = new TableStore(); // 模板设置列表 @observable templateStore = new TableStore(); // 模板设置列表
// 基础设置表单 // 基础设置表单
@observable templateBaseData = {} // 基础信息表单数据 @observable templateBaseData = {}; // 基础信息表单数据
@observable salarySobOptions = [] // 账套列表 @observable salarySobOptions = []; // 账套列表
// 显示设置表单 // 显示设置表单
@observable salaryTemplateShowSet = {} // 显示设置基础表单 @observable salaryTemplateShowSet = {}; // 显示设置基础表单
@observable salaryItemSet = [] // 显示设置薪资项 @observable salaryItemSet = []; // 显示设置薪资项
// **** 工资单页面 **** // **** 工资单页面 ****
@observable salarySendTableStore = new TableStore(); // 工资单列表 @observable salarySendTableStore = new TableStore(); // 工资单列表
@observable salarySendDataSource = []; @observable salarySendDataSource = [];
@observable pageInfo = {} @observable pageInfo = {};
// **** 工资单详情页 **** // **** 工资单详情页 ****
@observable salarySendDetailBaseInfo = {}; // 工资单详情基础信息 @observable salarySendDetailBaseInfo = {}; // 工资单详情基础信息
@ -38,483 +37,503 @@ export class payrollStore {
@observable detailListConditionForm = new WeaForm(); // 详情页搜索条件 @observable detailListConditionForm = new WeaForm(); // 详情页搜索条件
@observable detailListShowSearchAd = false; // 详情页是否展开搜索面板 @observable detailListShowSearchAd = false; // 详情页是否展开搜索面板
@observable detailListCondition = []; // 详情页搜索条件 @observable detailListCondition = []; // 详情页搜索条件
@observable salarySendDetailPageInfo ={} @observable salarySendDetailPageInfo = {};
// **** 工资单发放页 **** // **** 工资单发放页 ****
@observable salaryGrantDataSource = []; @observable salaryGrantDataSource = [];
@observable salaryGrantPageInfo ={}; @observable salaryGrantPageInfo = {};
@observable salaryGrantTableStore = new TableStore(); @observable salaryGrantTableStore = [];
@observable grantListConditionForm = new WeaForm(); // 详情页搜索条件 @observable grantListConditionForm = new WeaForm(); // 详情页搜索条件
@observable grantListShowSearchAd = false; // 详情页是否展开搜索面板 @observable grantListShowSearchAd = false; // 详情页是否展开搜索面板
@observable grantListCondition = []; // 详情页搜索条件 @observable grantListCondition = []; // 详情页搜索条件
@observable canGrantDataSource = []; // 可以发送的列表 @observable canGrantDataSource = []; // 可以发送的列表
@observable canGrantColumns = []; // 可以发送的列名 @observable canGrantColumns = []; // 可以发送的列名
@observable canGrantPageInfo = {}; // 可以发送列表分页对象 @observable canGrantPageInfo = {}; // 可以发送列表分页对象
@observable canWithdrawDataSource = []; // 可以撤回的列表 @observable canWithdrawDataSource = []; // 可以撤回的列表
@observable canWidthdrawColumns = []; // 可以撤回的列表列名 @observable canWidthdrawColumns = []; // 可以撤回的列表列名
@observable canWithdrawPageInfo = {}; // 可以撤回列表分页对象 @observable canWithdrawPageInfo = {}; // 可以撤回列表分页对象
@action @action
setGrantListShowSearchAd = (grantListShowSearchAd) => this.grantListShowSearchAd = grantListShowSearchAd setGrantListShowSearchAd = grantListShowSearchAd =>
(this.grantListShowSearchAd = grantListShowSearchAd);
// 详情页是否展开搜索面板 // 详情页是否展开搜索面板
@action @action
setDetailListShowSearchAd = (detailListShowSearchAd) => this.detailListShowSearchAd = detailListShowSearchAd setDetailListShowSearchAd = detailListShowSearchAd =>
(this.detailListShowSearchAd = detailListShowSearchAd);
// 基础信息表单数据 // 基础信息表单数据
@action @action
setTemplateBaseData = (templateBaseData) => this.templateBaseData = templateBaseData setTemplateBaseData = templateBaseData =>
(this.templateBaseData = templateBaseData);
// 显示设置基础表单 // 显示设置基础表单
@action @action
setSalaryTemplateShowSet = (salaryTemplateShowSet) => this.salaryTemplateShowSet = salaryTemplateShowSet setSalaryTemplateShowSet = salaryTemplateShowSet =>
(this.salaryTemplateShowSet = salaryTemplateShowSet);
@action @action
setSalaryItemSet = (salaryItemSet) => this.salaryItemSet = salaryItemSet setSalaryItemSet = salaryItemSet => (this.salaryItemSet = salaryItemSet);
// 初始化操作 // 初始化操作
@action @action
doInit = () => { doInit = () => {
// this.getCondition(); // this.getCondition();
// this.getTableDatas(); // this.getTableDatas();
} };
// 获得高级搜索表单数据 // 获得高级搜索表单数据
@action @action
getCondition = () => { getCondition = () => {
API.getCondition().then(action(res => { API.getCondition().then(
if (res.api_status) { // 接口请求成功/失败处理 action(res => {
let condition = removePropertyCondition(res.condition); if (res.api_status) {
this.form.initFormFields(condition); // 渲染高级搜索form表单 // 接口请求成功/失败处理
} else { let condition = removePropertyCondition(res.condition);
message.error(res.msg || '接口调用失败!') this.form.initFormFields(condition); // 渲染高级搜索form表单
} } else {
})); message.error(res.msg || "接口调用失败!");
} }
})
);
};
// 渲染table数据 // 渲染table数据
@action @action
getTableDatas = (params) => { getTableDatas = params => {
this.loading = true; this.loading = true;
const formParams = this.form.getFormParams() || {}; const formParams = this.form.getFormParams() || {};
params = params || formParams; params = params || formParams;
API.getTableDatas(params).then(action(res => { API.getTableDatas(params).then(
if (res.api_status) { // 接口请求成功/失败处理 action(res => {
this.tableStore.getDatas(res.datas); // table 请求数据 if (res.api_status) {
this.hasRight = res.hasRight; // 接口请求成功/失败处理
} else { this.tableStore.getDatas(res.datas); // table 请求数据
message.error(res.msg || '接口调用失败!') this.hasRight = res.hasRight;
} } else {
this.loading = false; message.error(res.msg || "接口调用失败!");
})); }
} this.loading = false;
})
);
};
@action @action setShowSearchAd = bool => (this.showSearchAd = bool);
setShowSearchAd = bool => this.showSearchAd = bool;
// 高级搜索 - 搜索 // 高级搜索 - 搜索
@action doSearch = () => { @action
doSearch = () => {
this.getTableDatas(); this.getTableDatas();
this.showSearchAd = false; this.showSearchAd = false;
} };
// 工资单模板-工资单模板列表 // 工资单模板-工资单模板列表
@action @action
getPayrollTemplateList = (params = {}) => { getPayrollTemplateList = (params = {}) => {
this.loading = true this.loading = true;
API.getPayrollTemplateList(params).then(res => { API.getPayrollTemplateList(params).then(res => {
if(res.status) { if (res.status) {
this.templateStore.getDatas(res.data.datas); this.templateStore.getDatas(res.data.datas);
} else { } else {
message.error(res.errormsg || "获取失败"); message.error(res.errormsg || "获取失败");
} }
this.loading = false; this.loading = false;
}) });
} };
// 工资单模板-获取工资单模板基础设置表单 // 工资单模板-获取工资单模板基础设置表单
@action @action
getPayrollBaseForm = (id = "") => { getPayrollBaseForm = (id = "") => {
let params = { let params = {
id id
} };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
API.getPayrollBaseForm(params).then(res => { API.getPayrollBaseForm(params).then(res => {
if(res.status) { if (res.status) {
let response = res.data.salaryTemplateBaseSet let response = res.data.salaryTemplateBaseSet;
let templateBaseData = response.data let templateBaseData = response.data;
templateBaseData.salarySob = templateBaseData.salarySob != undefined ? templateBaseData.salarySob + "": null; templateBaseData.salarySob =
this.templateBaseData = templateBaseData // 基础信息表单数据 templateBaseData.salarySob != undefined
? templateBaseData.salarySob + ""
this.salarySobOptions = response.salarySobOptions ? : null;
response.salarySobOptions.map(item => { this.templateBaseData = templateBaseData; // 基础信息表单数据
let result = {}
result.showname = item.name; this.salarySobOptions = response.salarySobOptions
result.key = item.id + ""; ? response.salarySobOptions.map(item => {
result.selected = false; let result = {};
return result; result.showname = item.name;
}) : [] result.key = item.id + "";
result.selected = false;
return result;
})
: [];
resolve({ resolve({
templateBaseData: this.templateBaseData, templateBaseData: this.templateBaseData,
salarySobOptions: this.salarySobOptions salarySobOptions: this.salarySobOptions
}); });
} else { } else {
message.errro(res.errormsg || "获取失败"); message.errro(res.errormsg || "获取失败");
reject() reject();
} }
}) });
}) });
} };
// 工资单模板-获取工资单模板显示设置表单 // 工资单模板-获取工资单模板显示设置表单
@action @action
getPayrollShowForm = (id = "") => { getPayrollShowForm = (id = "") => {
let params = { let params = {
id id
} };
API.getPayrollShowForm(params).then(res => { API.getPayrollShowForm(params).then(res => {
if(res.status) { if (res.status) {
if(id !== "") { if (id !== "") {
this.salaryItemSet = res.data.salaryTemplateSalaryItemSet this.salaryItemSet = res.data.salaryTemplateSalaryItemSet;
} }
this.salaryTemplateShowSet = res.data.salaryTemplateShowSet.data this.salaryTemplateShowSet = res.data.salaryTemplateShowSet.data;
} else { } else {
message.error(res.errormsg || "获取失败") message.error(res.errormsg || "获取失败");
} }
}) });
} };
// 工资单模板-获取薪资项目设置 // 工资单模板-获取薪资项目设置
@action @action
getPayrollItemList = (salarySobId = "") => { getPayrollItemList = (salarySobId = "") => {
let params = { let params = {
salarySobId salarySobId
} };
API.getPayrollItemList(params).then(res => { API.getPayrollItemList(params).then(res => {
if(res.status) { if (res.status) {
this.salaryItemSet = res.data this.salaryItemSet = res.data;
} else { } else {
message.error(res.errormsg || "获取失败") message.error(res.errormsg || "获取失败");
} }
}) });
} };
// 初始化显示设置表单 // 初始化显示设置表单
@action @action
initShowSettingForm = (id = "") => { initShowSettingForm = (id = "") => {
this.getPayrollShowForm(id); this.getPayrollShowForm(id);
if(id == "") { if (id == "") {
this.getPayrollItemList(this.templateBaseData.salarySob) this.getPayrollItemList(this.templateBaseData.salarySob);
} }
} };
// 校验显示设置表单 // 校验显示设置表单
validateSalaryTemplateShowSet = () => { validateSalaryTemplateShowSet = () => {
if(!notNull(this.salaryTemplateShowSet.theme)) { if (!notNull(this.salaryTemplateShowSet.theme)) {
message.warning("工资单主题不能为空"); message.warning("工资单主题不能为空");
return false; return false;
} }
return true; return true;
} };
// 拼装保存参数 // 拼装保存参数
convertParams = () => { convertParams = () => {
let params = {...this.templateBaseData, ...this.salaryTemplateShowSet} let params = { ...this.templateBaseData, ...this.salaryTemplateShowSet };
params.salarySobId = params.salarySob params.salarySobId = params.salarySob;
params.emailStatus = params.emailStatus ? params.emailStatus : false; params.emailStatus = params.emailStatus ? params.emailStatus : false;
params.msgStatus = params.msgStatus ? params.msgStatus : false params.msgStatus = params.msgStatus ? params.msgStatus : false;
params.salaryItemNullStatus = params.salaryItemNullStatus ? params.salaryItemNullStatus : false; params.salaryItemNullStatus = params.salaryItemNullStatus
params.salaryItemZeroStatus = params.salaryItemZeroStatus ? params.salaryItemZeroStatus : false; ? params.salaryItemNullStatus
params.salaryItemSetting = this.salaryItemSet : false;
return params params.salaryItemZeroStatus = params.salaryItemZeroStatus
} ? params.salaryItemZeroStatus
: false;
params.salaryItemSetting = this.salaryItemSet;
return params;
};
// 工资单模板-新建工资单模板 // 工资单模板-新建工资单模板
@action @action
fetchSavePayroll = () => { fetchSavePayroll = () => {
if(!(this.validateSalaryTemplateShowSet())) { if (!this.validateSalaryTemplateShowSet()) {
return false return false;
} }
let params = this.convertParams() let params = this.convertParams();
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
API.savePayroll(params).then(res => { API.savePayroll(params).then(res => {
if(res.status) { if (res.status) {
message.success("保存成功"); message.success("保存成功");
this.getPayrollTemplateList(); this.getPayrollTemplateList();
resolve(); resolve();
} else { } else {
message.error(res.errormsg || "保存失败") message.error(res.errormsg || "保存失败");
reject() reject();
} }
}) });
}) });
} };
// 工资单模板-更新工资单模板 // 工资单模板-更新工资单模板
@action @action
fetchUpdatePayroll = (id) => { fetchUpdatePayroll = id => {
if(!(this.validateSalaryTemplateShowSet())) { if (!this.validateSalaryTemplateShowSet()) {
return false return false;
} }
let params = this.convertParams() let params = this.convertParams();
params.id = id params.id = id;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
API.updatePayroll(params).then(res => { API.updatePayroll(params).then(res => {
if(res.status) { if (res.status) {
message.success("保存成功"); message.success("保存成功");
this.getPayrollTemplateList(); this.getPayrollTemplateList();
resolve(); resolve();
} else { } else {
message.error(res.errormsg || "保存失败") message.error(res.errormsg || "保存失败");
reject() reject();
} }
}) });
}) });
} };
//工资单-获取薪资账套下拉列表 //工资单-获取薪资账套下拉列表
@action @action
getPayrollTemplateLedgerList = () => { getPayrollTemplateLedgerList = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
API.getPayrollTemplateLedgerList().then(res => { API.getPayrollTemplateLedgerList().then(res => {
if(res.status) { if (res.status) {
this.payrollTemplateLedgerList = res.data.map(item => { this.payrollTemplateLedgerList = res.data.map(item => {
let result = {} let result = {};
result.showname = item.content; result.showname = item.content;
result.selected = false; result.selected = false;
result.key = item.id result.key = item.id;
return result; return result;
}) });
resolve(this.payrollTemplateLedgerList) resolve(this.payrollTemplateLedgerList);
} else { } else {
message.error(res.errormsg || "获取失败"); message.error(res.errormsg || "获取失败");
reject() reject();
} }
}) });
}) });
} };
// 工资单模板-工资单模板默认使用 // 工资单模板-工资单模板默认使用
@action @action
changePayrollDefaultUse(id = "") { changePayrollDefaultUse(id = "") {
if(id == "") { if (id == "") {
message.warning("id必填"); message.warning("id必填");
return return;
} }
let params = { let params = {
id id
} };
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
API.changePayrollDefaultUse(params).then(res => { API.changePayrollDefaultUse(params).then(res => {
if(res.status) { if (res.status) {
message.success("设置成功"); message.success("设置成功");
resolve() resolve();
} else { } else {
message.success(res.errormsg || "设置失败") message.success(res.errormsg || "设置失败");
reject() reject();
} }
}) });
}) });
} }
// 工资单模板-复制工资单模板 // 工资单模板-复制工资单模板
@action @action
duplicatePayroll = (id, name) => { duplicatePayroll = (id, name) => {
let params = { let params = {
id, name id,
} name
};
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
API.duplicatePayroll(params).then(res => { API.duplicatePayroll(params).then(res => {
if(res.status) { if (res.status) {
message.success("复制成功") message.success("复制成功");
this.getPayrollTemplateList() this.getPayrollTemplateList();
resolve() resolve();
} else { } else {
message.error(res.errormsg || "复制失败") message.error(res.errormsg || "复制失败");
reject(); reject();
} }
}) });
}) });
} };
// 工资单模板-删除工资单模板 // 工资单模板-删除工资单模板
@action @action
deletePayroll = (ids) => { deletePayroll = ids => {
API.deletePayroll(ids).then(res => { API.deletePayroll(ids).then(res => {
if(res.status) { if (res.status) {
message.success("删除成功"); message.success("删除成功");
this.getPayrollTemplateList() this.getPayrollTemplateList();
} else { } else {
message.error(res.errormsg || "删除失败"); message.error(res.errormsg || "删除失败");
} }
}) });
} };
// 工资单-工资单发放列表 // 工资单-工资单发放列表
@action @action
getPayrollList = (parmas = {salaryYearMonth: []}) => { getPayrollList = (parmas = { salaryYearMonth: [] }) => {
this.loading = true this.loading = true;
API.getPayrollList(parmas).then(res => { API.getPayrollList(parmas).then(res => {
if(res.status) { if (res.status) {
this.salarySendDataSource = res.data.datas this.salarySendDataSource = res.data.datas;
this.salarySendTableStore.getDatas(res.data.dataKey.datas) this.salarySendTableStore.getDatas(res.data.dataKey.datas);
this.pageInfo = res.data.pageInfo this.pageInfo = res.data.pageInfo;
} else { } else {
message.error(res.errormsg || "获取失败"); message.error(res.errormsg || "获取失败");
} }
this.loading = false this.loading = false;
}) });
} };
// 工资单发放-工资单发放基本信息 // 工资单发放-工资单发放基本信息
@action @action
getPayrollInfo = (id) => { getPayrollInfo = id => {
API.getPayrollInfo({id}).then(res => { API.getPayrollInfo({ id }).then(res => {
if(res.status) { if (res.status) {
this.salarySendDetailBaseInfo = res.data this.salarySendDetailBaseInfo = res.data;
} else { } else {
message.error(res.errormsg || "获取失败") message.error(res.errormsg || "获取失败");
} }
}) });
} };
// 工资单发放-工资单发放信息列表 // 工资单发放-工资单发放信息列表
@action @action
getInfoList = (params = {}) => { getInfoList = (params = {}) => {
let form = this.grantListConditionForm.getFormParams(); let form = this.grantListConditionForm.getFormParams();
params = {...form, ...params} params = { ...form, ...params };
API.getInfoList(params).then(res => { API.getInfoList(params).then(res => {
if(res.status) { if (res.status) {
this.salaryGrantTableStore.getDatas(res.data.dataKey.datas) this.salaryGrantTableStore = res.data.columns;
this.salaryGrantDataSource = res.data.datas this.salaryGrantDataSource = res.data.list;
this.salaryGrantPageInfo = res.data.pageInfo this.salaryGrantPageInfo = {
total: res.data.total,
pageNum: res.data.pageNum
};
this.getPayrollInfo(params.salarySendId);
} else { } else {
message.error(res.errormsg || "获取失败") message.error(res.errormsg || "获取失败");
} }
}) });
} };
// 工资单-工资单发放详情列表 // 工资单-工资单发放详情列表
@action @action
getPayrollDetailList = (params) => { getPayrollDetailList = params => {
let form = this.detailListConditionForm.getFormParams() || {} let form = this.detailListConditionForm.getFormParams() || {};
params = {...form, ...params} params = { ...form, ...params };
API.getPayrollDetailList(params).then(res => { API.getPayrollDetailList(params).then(res => {
if(res.status) { if (res.status) {
this.salarySendDetailTableStore.getDatas(res.data.dataKey.datas) this.salarySendDetailTableStore.getDatas(res.data.dataKey.datas);
this.salarySendDetailDataSource = res.data.datas this.salarySendDetailDataSource = res.data.datas;
this.salarySendDetailPageInfo = res.data.pageInfo this.salarySendDetailPageInfo = res.data.pageInfo;
} else { } else {
message.error(res.errormsg || "获取失败") message.error(res.errormsg || "获取失败");
} }
}) });
} };
// 工资单详情页 - 获得高级搜索表单数据 // 工资单详情页 - 获得高级搜索表单数据
@action @action
getPayrollDetailSa = (params = {}) => { getPayrollDetailSa = (params = {}) => {
API.getPayrollDetailSa(params).then(res => { API.getPayrollDetailSa(params).then(res => {
if (res.status) { // 接口请求成功/失败处理 if (res.status) {
// 接口请求成功/失败处理
let condition = removePropertyCondition(res.data.condition); let condition = removePropertyCondition(res.data.condition);
this.detailListCondition = condition this.detailListCondition = condition;
this.detailListConditionForm.initFormFields(condition); // 渲染高级搜索form表单 this.detailListConditionForm.initFormFields(condition); // 渲染高级搜索form表单
} else { } else {
message.error(res.errormsg || '接口调用失败!') message.error(res.errormsg || "接口调用失败!");
} }
}); });
} };
// 工资单发放-导出-工资单发放详情列表 // 工资单发放-导出-工资单发放详情列表
@action @action
exportDetailList = (params = {}) => { exportDetailList = (params = {}) => {
API.exportDetailList(params) API.exportDetailList(params);
} };
// 工资单-获取工资单发放高级搜索 // 工资单-获取工资单发放高级搜索
@action @action
getPaySa = (params = {}) => { getPaySa = (params = {}) => {
API.getPaySa(params).then(res => { API.getPaySa(params).then(res => {
if(res.status) { if (res.status) {
let condition = removePropertyCondition(res.data.condition) let condition = removePropertyCondition(res.data.condition);
this.grantListCondition = condition; this.grantListCondition = condition;
this.grantListConditionForm.initFormFields(condition); this.grantListConditionForm.initFormFields(condition);
} else { } else {
message.error(res.errormsg || "接口调用失败") message.error(res.errormsg || "接口调用失败");
} }
}) });
} };
// 工资单发放-工资单批量发放信息列表 // 工资单发放-工资单批量发放信息列表
@action @action
batchSendInfoList = (params = {}) => { batchSendInfoList = (params = {}) => {
API.batchSendInfoList(params).then(res => { API.batchSendInfoList(params).then(res => {
if(res.status) { if (res.status) {
let datas = res.data.datas || []; this.canGrantDataSource = res.data.list;
datas.map(item => {
item.key = item.id
})
this.canGrantDataSource = datas
this.canGrantColumns = res.data.columns; this.canGrantColumns = res.data.columns;
this.canGrantPageInfo = res.data.pageInfo this.canGrantPageInfo = {
// alert("this.canGrantColumns:" + JSON.stringify(this.canGrantColumns)) total: res.data.total,
pageNum: res.data.pageNum
};
} else { } else {
message.error(res.errormsg || "获取失败") message.error(res.errormsg || "获取失败");
} }
}) });
} };
// 工资单发放-工资单批量撤回信息列表 // 工资单发放-工资单批量撤回信息列表
@action @action
batchWithdrawInfoList = (params = {}) => { batchWithdrawInfoList = (params = {}) => {
API.batchWithdrawInfoList(params).then(res => { API.batchWithdrawInfoList(params).then(res => {
if(res.status) { if (res.status) {
let datas = res.data.datas || []; let datas = res.data.list || [];
datas.map(item => { datas.map(item => {
item.key = item.id item.key = item.id;
}) });
this.canWithdrawDataSource = datas this.canWithdrawDataSource = datas;
this.canWidthdrawColumns = res.data.columns this.canWidthdrawColumns = res.data.columns;
this.canWithdrawPageInfo = res.data.pageInfo this.canWithdrawPageInfo = {
total: res.data.total,
pageNum: res.data.pageNum
};
} else { } else {
message.error(res.errormsg || "获取失败"); message.error(res.errormsg || "获取失败");
} }
}) });
} };
//工资单-工资单发放 //工资单-工资单发放
@action @action
grantPayroll = (params = {}) => { grantPayroll = (params = {}) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
API.grantPayroll(params).then(res => { API.grantPayroll(params).then(res => {
if(res.status) { if (res.status) {
message.success("发送成功"); message.success("发送成功");
resolve(); resolve();
} else { } else {
message.error(res.errormsg || "发送失败") message.error(res.errormsg || "发送失败");
reject(); reject();
} }
}) });
}) });
} };
// 工资单-工资单撤回 // 工资单-工资单撤回
@action @action
withdrawPayroll = (params = {}) => { withdrawPayroll = (params = {}) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
API.withdrawPayroll(params).then(res => { API.withdrawPayroll(params).then(res => {
if(res.status) { if (res.status) {
message.success("撤回成功"); message.success("撤回成功");
resolve() resolve();
} else { } else {
message.error(res.errormsg || "撤回失败") message.error(res.errormsg || "撤回失败");
reject(); reject();
} }
}) });
}) });
} };
}
}