累计专项附加扣除

This commit is contained in:
MustangDeng 2022-03-11 10:04:16 +08:00
parent 7491713ffc
commit f51b63f582
5 changed files with 108 additions and 22 deletions

View File

@ -48,8 +48,16 @@ export const getCumDeductDetailList = params => {
}
//数据采集-累计专项附加扣除-导出明细
export const exportCumDeductDetailList = params => {
return WeaTools.callApi('/api/bs/hrmsalary/addUpDeduction/exportDetail', 'POST', params);
export const exportCumDeductDetailList = ids => {
fetch('/api/bs/hrmsalary/addUpDeduction/exportDetail?ids=' + ids).then(res => res.blob().then(blob => {
var filename=`累计专项附加扣除.xlsx`
var a = document.createElement('a');
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(url);
}))
}
// 数据采集-获取累计专项附加扣除-导入

View File

@ -6,6 +6,7 @@ import { slideColumns} from './columns';
import "./editSlideContent.less"
import { WeaTableNew } from "comsMobx"
const WeaTable = WeaTableNew.WeaTable;
import moment from 'moment'
const { MonthPicker } = DatePicker;
@ -28,7 +29,9 @@ export default class EditSlideContent extends React.Component {
constructor(props) {
super(props);
this.state = {
taxAgentId: ""
taxAgentId: "",
startDate: moment(new Date()).format("YYYY-MM"),
endDate: moment(new Date()).format("YYYY-MM"),
}
}
@ -53,29 +56,54 @@ export default class EditSlideContent extends React.Component {
setDataSource(dataSource)
}
fetchCumDeductDetailList(param) {
const { cumDeductStore} = this.props;
const { getCumDeductDetailList, currentRecord } = cumDeductStore;
getCumDeductDetailList(currentRecord.id, param);
}
render() {
const { taxAgentStore: {taxAgentOption}} = this.props;
const { cumDeductStore } = this.props;
const { taxAgentId} = this.state;
const { slideTableStore } = cumDeductStore;
const { slideTableStore, currentRecord } = cumDeductStore;
const { startDate, endDate, taxAgentId } = this.state;
return (
<div className="cumDeductSlide">
<Row className="topLabelBar">
<Col span={4}>
<span className="username">姓名</span>
<span className="username">{currentRecord.username}</span>
</Col>
<Col span={12}>
<span className="formLabel">申报月份</span>
<div className="weaRangePickerWrapper">
<div className="monthPickerWrapper">
<MonthPicker width={100} />
<MonthPicker width={100} format="YYYY-MM" value={startDate}
onChange={(v) => {
let startDate = moment(v).format("YYYY-MM")
this.setState({startDate})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: taxAgentId
})
}}
/>
</div>
<span className="betweenLable">
</span>
<div className="monthPickerWrapper">
<MonthPicker width={100}/>
<MonthPicker width={100}
value={endDate}
onChange={(v) => {
let endDate = moment(v).format("YYYY-MM")
this.setState({endDate})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: taxAgentId
})
}}
/>
</div>
</div>
</Col>
@ -87,8 +115,11 @@ export default class EditSlideContent extends React.Component {
options={taxAgentOption}
value={taxAgentId}
onChange={v => {
this.setState({taxAgentId: v})
getTableDatas({ taxAgentId: v })
this.setState({taxAgentId: v})
this.fetchCumDeductDetailList({
declareMonth: [startDate, endDate],
taxAgentId: v
})
}}
/>
</Col>

View File

@ -3,6 +3,7 @@
padding: 10px 20px;
height: 40px;
line-height: 40px;
margin-bottom: 10px;
}
.formLabel {
margin-right: 10px;

View File

@ -6,6 +6,7 @@ import { Button, Table, DatePicker, Dropdown, Menu, Modal, message } from 'antd'
import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaDatePicker, WeaSelect, WeaHelpfulTip, WeaSlideModal } from 'ecCom';
import { WeaTableNew } from "comsMobx"
import moment from 'moment';
const WeaTable = WeaTableNew.WeaTable;
@ -15,6 +16,7 @@ import ContentWrapper from '../../../components/contentWrapper';
import ImportModal from '../../../components/importModal'
import { columns, dataSource } from './columns';
const { MonthPicker } = DatePicker;
import "./index.less"
@ -32,7 +34,7 @@ export default class CumDeduct extends React.Component {
value: "",
selectedKey: "0",
visiable: false,
monthValue: "",
monthValue: moment(new Date()).format("YYYY-MM"),
taxAgentId: ""
}
}
@ -45,7 +47,6 @@ export default class CumDeduct extends React.Component {
getSearchsAdQuick() {
const { monthValue, taxAgentId } = this.state;
const { taxAgentStore: { taxAgentOption }, cumDeductStore: {form, getTableDatas} } = this.props;
return (
<div className="searchConditionWrapper">
@ -57,7 +58,7 @@ export default class CumDeduct extends React.Component {
width={200}
onChange={v => {
this.setState({monthValue: v})
getTableDatas({ declareMonth: [v] })
getTableDatas({ declareMonth: [v], taxAgentId })
}}
/>
</div>
@ -79,7 +80,7 @@ export default class CumDeduct extends React.Component {
value={taxAgentId}
onChange={v => {
this.setState({taxAgentId: v})
getTableDatas({ taxAgentId: v })
getTableDatas({ taxAgentId: v, declareMonth: [monthValue]})
}}
/>
</div>
@ -88,9 +89,10 @@ export default class CumDeduct extends React.Component {
}
onEdit = (record) => {
const { cumDeductStore: { slideVisiable, setSlideVisiable, getCumDeductDetailList } } = this.props;
const { cumDeductStore: { slideVisiable, setSlideVisiable, getCumDeductDetailList, setCurrentRecord } } = this.props;
setSlideVisiable(true)
getCumDeductDetailList(record.id)
setCurrentRecord(record)
getCumDeductDetailList(record.id);
}
// 增加编辑功能重写columns绑定事件
@ -104,6 +106,8 @@ export default class CumDeduct extends React.Component {
case "username":
return <a onClick={() => {this.onEdit(record)}}
dangerouslySetInnerHTML={{ __html: valueSpan }} />
case "operate":
return <a onClick={() => {this.onEdit(record)}}>查看明细</a>
default:
return <div dangerouslySetInnerHTML={{ __html: valueSpan }} />
}
@ -118,15 +122,25 @@ export default class CumDeduct extends React.Component {
const { modalVisiable, setModalVisiable, setStep } = cumDeductStore
setModalVisiable(false);
setStep(0);
}
onOperatesClick = (record, index, operate, flag) => {
switch(operate.index.toString()){
case '0': // 查看明细
this.onEdit(record);
break;
}
};
render() {
const { cumDeductStore, taxAgentStore } = this.props;
const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = cumDeductStore;
const { taxAgentOption, step } = taxAgentStore
const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable } = cumDeductStore
const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable, slideTableStore } = cumDeductStore
const selectedRowKeys = toJS(tableStore.selectedRowKeys) || [];
const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || [];
if (!hasRight && !loading) { // 无权限处理
return renderNoright();
}
@ -179,6 +193,8 @@ export default class CumDeduct extends React.Component {
setModalVisiable(true)
}
const btns = [
<Button type="primary" onClick={() => { handleBtnImport() }}>导入</Button>,
<Dropdown.Button onClick={handleButtonClick} overlay={
@ -190,10 +206,25 @@ export default class CumDeduct extends React.Component {
</Dropdown.Button>
]
const handleExportAllDetailClick = () => {
const {cumDeductStore: {exportCumDeductDetailList} } =this.props;
exportCumDeductDetailList();
}
const handleExportSelectedDetailClick = () => {
if(detailSelectedRowKeys.length == 0) {
message.warning("未选择条目")
return
}
const { cumDeductStore: { exportCumDeductDetailList } } = this.props;
exportCumDeductList(detailSelectedRowKeys.join(","))
}
const renderBtns = () => {
return (
<Dropdown.Button onClick={handleButtonClick} overlay={
<Menu onClick={handleMenuClick}>
<Dropdown.Button onClick={handleExportAllDetailClick} overlay={
<Menu onClick={handleExportSelectedDetailClick}>
<Menu.Item key="1">导出选中</Menu.Item>
</Menu>
} type="ghost">
@ -236,6 +267,7 @@ export default class CumDeduct extends React.Component {
hasOrder={true} // 是否启用排序
needScroll={true} // 是否启用table内部列表滚动将自适应到父级高度
getColumns={this.getColumns}
onOperatesClick={this.onOperatesClick.bind(this)}
/>
</WeaTop>
</WeaRightMenu>

View File

@ -23,6 +23,11 @@ export class CumDeductStore {
@observable importResult = {}
@observable modalVisiable = false; // 模态框显示
@observable currentRecord = {}; // 当前record
@action
setCurrentRecord = currentRecord => this.currentRecord = currentRecord;
@action
setModalVisiable = visiable => this.modalVisiable = visiable
@ -103,8 +108,10 @@ export class CumDeductStore {
}
// 查询明细
@action getCumDeductDetailList = (id) => {
API.getCumDeductDetailList({"accumulatedSpecialAdditionalDeductionId": id}).then(res => {
@action getCumDeductDetailList = (id, param = {}) => {
let requestParams = {"accumulatedSpecialAdditionalDeductionId": id};
requestParams = {...requestParams, ...param}
API.getCumDeductDetailList(requestParams).then(res => {
if(res.status) {
if (res.status) { // 接口请求成功/失败处理
this.slideTableStore.getDatas(res.data.datas); // table 请求数据
@ -114,4 +121,11 @@ export class CumDeductStore {
}
})
}
// 导出明细
@action exportCumDeductDetailList = (ids = "") => {
API.exportCumDeductDetailList(ids)
}
}