From 7491713ffca6dad695b33eece24e36d3c778be45 Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Thu, 10 Mar 2022 19:28:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=B8=BB=E8=A1=A8=E6=98=8E?= =?UTF-8?q?=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/cumDeduct.js | 13 ++++++-- .../cumDeduct/editSlideContent.js | 12 +++++++ .../pages/dataAcquisition/cumDeduct/index.js | 33 +++++++++++-------- pc4mobx/hrmSalary/stores/cumDeduct.js | 22 ++++++++++--- 4 files changed, 59 insertions(+), 21 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/cumDeduct.js b/pc4mobx/hrmSalary/apis/cumDeduct.js index 6c9a9053..46595f9f 100644 --- a/pc4mobx/hrmSalary/apis/cumDeduct.js +++ b/pc4mobx/hrmSalary/apis/cumDeduct.js @@ -18,8 +18,8 @@ export const getCumDeductSaCondition = params => { } //数据采集-累计专项附加扣除-导出 -export const exportCumDeductList = params => { - fetch('/api/bs/hrmsalary/addUpDeduction/export').then(res => res.blob().then(blob => { +export const exportCumDeductList = (ids = "") => { + fetch('/api/bs/hrmsalary/addUpDeduction/export?ids=' + ids).then(res => res.blob().then(blob => { var filename=`累计专项附加扣除.xlsx` var a = document.createElement('a'); var url = window.URL.createObjectURL(blob); @@ -37,7 +37,14 @@ export const getImportCumDeductParam = params => { //数据采集-获取累计专项附加扣除记录 export const getCumDeductDetailList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/addUpDeduction/getDetailList', 'get', params); + return fetch('/api/bs/hrmsalary/addUpDeduction/getDetailList', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) } //数据采集-累计专项附加扣除-导出明细 diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js index 3228e479..014a70bf 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js @@ -4,6 +4,8 @@ import { inject, observer } from 'mobx-react'; import { WeaInput, WeaTextarea, WeaSearchGroup, WeaSelect } from "ecCom"; import { slideColumns} from './columns'; import "./editSlideContent.less" +import { WeaTableNew } from "comsMobx" +const WeaTable = WeaTableNew.WeaTable; const { MonthPicker } = DatePicker; @@ -54,7 +56,9 @@ export default class EditSlideContent extends React.Component { render() { const { taxAgentStore: {taxAgentOption}} = this.props; + const { cumDeductStore } = this.props; const { taxAgentId} = this.state; + const { slideTableStore } = cumDeductStore; return (
@@ -89,6 +93,14 @@ export default class EditSlideContent extends React.Component { /> + +
+ +
) } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 23d2e43f..ea965191 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -2,7 +2,7 @@ import React from 'react'; import { inject, observer } from 'mobx-react'; import { toJS } from 'mobx'; -import { Button, Table, DatePicker, Dropdown, Menu, Modal } from 'antd'; +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" @@ -88,8 +88,9 @@ export default class CumDeduct extends React.Component { } onEdit = (record) => { - const { cumDeductStore: { slideVisiable, setSlideVisiable } } = this.props; + const { cumDeductStore: { slideVisiable, setSlideVisiable, getCumDeductDetailList } } = this.props; setSlideVisiable(true) + getCumDeductDetailList(record.id) } // 增加编辑功能,重写columns绑定事件 @@ -125,7 +126,7 @@ export default class CumDeduct extends React.Component { const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = cumDeductStore; const { taxAgentOption, step } = taxAgentStore const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable } = cumDeductStore - + const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; if (!hasRight && !loading) { // 无权限处理 return renderNoright(); } @@ -164,7 +165,12 @@ export default class CumDeduct extends React.Component { } const handleMenuClick = () => { - + if(selectedRowKeys.length == 0) { + message.warning("未选择条目") + return + } + const { cumDeductStore: { exportCumDeductList } } = this.props; + exportCumDeductList(selectedRowKeys.join(",")) } const handleBtnImport = () => { @@ -173,23 +179,24 @@ export default class CumDeduct extends React.Component { setModalVisiable(true) } - - const menu = ( - - 导出选中 - - ); - const btns = [ , - + + 导出选中 + + } type="ghost"> 导出全部 ] const renderBtns = () => { return ( - + + 导出选中 + + } type="ghost"> 导出全部 ) diff --git a/pc4mobx/hrmSalary/stores/cumDeduct.js b/pc4mobx/hrmSalary/stores/cumDeduct.js index d47334fb..98ffd57f 100644 --- a/pc4mobx/hrmSalary/stores/cumDeduct.js +++ b/pc4mobx/hrmSalary/stores/cumDeduct.js @@ -9,6 +9,7 @@ const { TableStore } = WeaTableNew; export class CumDeductStore { @observable tableStore = new TableStore(); // new table + @observable slideTableStore = new TableStore(); @observable form = new WeaForm(); // nrew 一个form @observable condition = []; // 存储后台得到的form数据 @observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据 @@ -31,6 +32,7 @@ export class CumDeductStore { @action setSlideVisiable = slideVisiable => this.slideVisiable = slideVisiable; + // 初始化操作 @action doInit = () => { @@ -96,10 +98,20 @@ export class CumDeductStore { } // 导出 - @action exportCumDeductList = (params ={}) => { - API.exportCumDeductList(params).then(action(res => { - - })) + @action exportCumDeductList = (ids = "") => { + API.exportCumDeductList(ids) + } + + // 查询明细 + @action getCumDeductDetailList = (id) => { + API.getCumDeductDetailList({"accumulatedSpecialAdditionalDeductionId": id}).then(res => { + if(res.status) { + if (res.status) { // 接口请求成功/失败处理 + this.slideTableStore.getDatas(res.data.datas); // table 请求数据 + } else { + message.error(res.msg || '接口调用失败!') + } + } + }) } - } \ No newline at end of file