diff --git a/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js b/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js index e9d5111a..fcf7f20b 100644 --- a/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js +++ b/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js @@ -1,6 +1,28 @@ -import { postFetch } from "../../../util/request"; +import { postExportFetch, postFetch } from "../../../util/request"; // 薪资项目调整记录列表 export const getLYSalaryReportList = (params) => { return postFetch("/api/bs/hrmsalary/ly/salaryReport/list", params); }; +export const getLYSalaryReportListSum = (params) => { + return postFetch("/api/bs/hrmsalary/ly/salaryReport/sum", params); +}; +export const batchDeleteSalaryReport = (params) => { + return postFetch("/api/bs/hrmsalary/ly/salaryReport/batchDelete", params); +}; +export const exportSalaryReport = (params) => { + return postExportFetch("/api/bs/hrmsalary/ly/salaryReport/export", params); +}; +export const getLYSIReportGenerateList = (params) => { + return postFetch("/api/bs/hrmsalary/ly/SIReport/generate", params); +}; +export const getLYSIReportGenerateListSum = (params) => { + return postFetch("/api/bs/hrmsalary/ly/SIReport/sum", params); +}; +export const batchDeleteSIReport = (params) => { + return postFetch("/api/bs/hrmsalary/ly/SIReport/batchDelete", params); +}; +export const exportSIReport = (params) => { + return postExportFetch("/api/bs/hrmsalary/ly/socialReport/export", params); +}; + diff --git a/pc4mobx/hrmSalary/pages/custom-pages/index.js b/pc4mobx/hrmSalary/pages/custom-pages/index.js index fb99e300..7902a67b 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/index.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/index.js @@ -1,9 +1,13 @@ import React from "react"; import Route from "react-router/lib/Route"; -import CustomPageLingYue from "./lingyue"; +import CustomSalarySummary from "./lingyue/salarySummary"; +import CustomSocialFundSummary from "./lingyue/socialFundSummary"; const CustomRoutes = [ - + , + ]; export default CustomRoutes; diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js index 32dd213a..ddc2208c 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js @@ -14,12 +14,27 @@ import { getIframeParentHeight } from "../../../../util"; import * as API from "../../../../apis/custom-apis/lingyue"; const getLabel = WeaLocaleProvider.getLabel; +const interfaceType = { + "salarySum": { + list: API.getLYSalaryReportList, + sum: API.getLYSalaryReportListSum, + export: API.exportSalaryReport, + batchDel: API.batchDeleteSalaryReport + }, + "socialFundSum": { + list: API.getLYSIReportGenerateList, + sum: API.getLYSIReportGenerateListSum, + export: API.exportSIReport, + batchDel: API.batchDeleteSIReport + } +}; class List extends Component { constructor(props) { super(props); this.state = { - dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false + dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, + selectedRowKeys: [], sumDataSource: {}, payload: {} }; this.handleDebounce = null; } @@ -33,18 +48,22 @@ class List extends Component { } componentWillReceiveProps(nextProps, nextContext) { - if (nextProps.isQuery !== this.props.isQuery) this.getLYSalaryReportList(); + if (nextProps.isQuery !== this.props.isQuery) this.getLYList(); } handleReceive = ({ data }) => { const { pageInfo } = this.state; const { type, payload: { id, params } = {} } = data; if (type === "init") { - this.getLYSalaryReportList(); + this.getLYList(); } else if (type === "turn") { switch (id) { case "PAGEINFO": - this.setState({ pageInfo: { ...pageInfo, ...params } }, () => this.getLYSalaryReportList()); + this.setState({ pageInfo: { ...pageInfo, ...params } }, () => this.getLYList(false)); + break; + case "CHECKBOX": + const { selectedRowKeys } = params; + this.setState({ selectedRowKeys }); break; default: break; @@ -60,29 +79,46 @@ class List extends Component { childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); }; - getLYSalaryReportList = () => { - const { query } = this.props, { pageInfo } = this.state; + getLYList = (isSum = true) => { + const { query, type } = this.props, { pageInfo, selectedRowKeys } = this.state; const payload = { ...pageInfo, ...query }; - API.getLYSalaryReportList(payload).then(({ status, data }) => { + this.setState({ loading: true }); + interfaceType[type]["list"](payload).then(async ({ status, data }) => { + this.setState({ loading: false }); if (status) { + const { data: { sumRow: sumDataSource } } = isSum ? + await interfaceType[type]["sum"](payload) : { data: this.state.sumDataSource }; const { columns, data: result } = data; const { list: dataSource, pageNum: current, pageSize, total } = result; this.setState({ pageInfo: { ...pageInfo, current, pageSize, total }, - dataSource, columns - }, () => this.postMessageToChild({ - scrollHeight: 108, dataSource, pageInfo: this.state.pageInfo, - unitTableType: "custom_lingyue", columns: traverseCols(columns) - })); + dataSource, columns, sumDataSource, payload + }, () => { + this.postMessageToChild({ + scrollHeight: 108, dataSource, pageInfo: this.state.pageInfo, selectedRowKeys, + unitTableType: "custom_lingyue", columns: traverseCols(columns), showTotalCell: true, + sumDataSource: this.state.sumDataSource + }); + }); } }); }; + handleOperate = (key) => { + const { payload } = this.state; + switch (key) { + case "EXPORTALL": + console.log(payload); + break; + default: + break; + } + }; render() { const { loading, dataSource } = this.state; return (
+ style={{ height: getIframeParentHeight(".wea-new-top-content", dataSource.length, 0) + 43.84 + "px" }}>