From f51b63f582be1681d126a0475408d48107c2d2ea Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Fri, 11 Mar 2022 10:04:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=AF=E8=AE=A1=E4=B8=93=E9=A1=B9=E9=99=84?= =?UTF-8?q?=E5=8A=A0=E6=89=A3=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/cumDeduct.js | 12 ++++- .../cumDeduct/editSlideContent.js | 47 ++++++++++++++--- .../cumDeduct/editSlideContent.less | 1 + .../pages/dataAcquisition/cumDeduct/index.js | 52 +++++++++++++++---- pc4mobx/hrmSalary/stores/cumDeduct.js | 18 ++++++- 5 files changed, 108 insertions(+), 22 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/cumDeduct.js b/pc4mobx/hrmSalary/apis/cumDeduct.js index 46595f9f..d51c5f4a 100644 --- a/pc4mobx/hrmSalary/apis/cumDeduct.js +++ b/pc4mobx/hrmSalary/apis/cumDeduct.js @@ -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); + })) } // 数据采集-获取累计专项附加扣除-导入 diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js index 014a70bf..f6106d94 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js @@ -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 (
- 姓名 + {currentRecord.username} 申报月份
- + { + let startDate = moment(v).format("YYYY-MM") + this.setState({startDate}) + this.fetchCumDeductDetailList({ + declareMonth: [startDate, endDate], + taxAgentId: taxAgentId + }) + }} + />
- + { + let endDate = moment(v).format("YYYY-MM") + this.setState({endDate}) + this.fetchCumDeductDetailList({ + declareMonth: [startDate, endDate], + taxAgentId: taxAgentId + }) + }} + />
@@ -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 + }) }} /> diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.less b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.less index b688e4ea..14f22326 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.less @@ -3,6 +3,7 @@ padding: 10px 20px; height: 40px; line-height: 40px; + margin-bottom: 10px; } .formLabel { margin-right: 10px; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index ea965191..098b0e1f 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -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 (
@@ -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 }) }} />
@@ -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]}) }} />
@@ -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 {this.onEdit(record)}} dangerouslySetInnerHTML={{ __html: valueSpan }} /> + case "operate": + return {this.onEdit(record)}}>查看明细 default: return
} @@ -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 = [ , ] + 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 ( - + 导出选中 } 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)} /> diff --git a/pc4mobx/hrmSalary/stores/cumDeduct.js b/pc4mobx/hrmSalary/stores/cumDeduct.js index 98ffd57f..560e59b2 100644 --- a/pc4mobx/hrmSalary/stores/cumDeduct.js +++ b/pc4mobx/hrmSalary/stores/cumDeduct.js @@ -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) + } + + } \ No newline at end of file