diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js index 5ea4e38e..dc79d451 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js @@ -21,21 +21,39 @@ export default class MobilePayroll extends React.Component { } componentWillMount() { + const type = getQueryString("type"); this.id = getQueryString("id"); const { mySalaryStore: { init } } = this.props; - init(); + type !== "phone" && init(false); this.getMySalaryBill(this.id); } - getMySalaryBill = (id) => { + getMySalaryBill = (salaryInfoId) => { const { mySalaryStore: { getMySalaryBill } } = this.props; - getMySalaryBill(id).then(result => { + const params = this.getUrlkey(); + const payload = { + salaryInfoId, + ..._.omit(params, ["id", "_key", "type"]) + }; + getMySalaryBill(payload).then(result => { this.setState({ mySalaryBillData: result }); }); }; - + getUrlkey = () => { + let url = window.location.href; + let params = {}, + arr = url.split("?"); + if (arr.length <= 1) + return params; + arr = arr[1].split("&"); + for (var i = 0, l = arr.length; i < l; i++) { + var a = arr[i].split("="); + params[a[0]] = a[1]; + } + return params; + }; render() { const { mySalaryBillData } = this.state; @@ -48,29 +66,33 @@ export default class MobilePayroll extends React.Component { overflowY: "hidden", paddingBottom: "20px" }}> - - -
-
- { - type === "phone" ? - : + { + type === "phone" ? +
+
+ +
+
+ : + +
+
- } -
-
-
+
+
+
+ } ); } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index ed2c9722..d09d92ab 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -2,7 +2,7 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { Button, Dropdown, Menu, message, Modal, Switch } from "antd"; import { WeaInputSearch, WeaSlideModal, WeaTop } from "ecCom"; -import { renderLoading } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import { renderLoading } from "../../util"; import CustomTab from "../../components/customTab"; import SystemSalaryItemModal from "./systemSalaryItemModal"; import { columns } from "./columns"; @@ -132,7 +132,7 @@ export default class SalaryItem extends React.Component { } }); { - showOperateBtn && + // showOperateBtn && columns.push({ title: "", key: "moreOperate", diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js index c134a812..4505e71e 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js @@ -47,6 +47,7 @@ export default class Programme extends React.Component { // 增加编辑功能,重写columns绑定事件 getColumns = columns => { + const { taxAgentStore: { showOperateBtn } } = this.props; let newColumns = columns.filter( item => item.dataIndex !== "id" && item.dataIndex !== "paymentArea" ); @@ -85,15 +86,16 @@ export default class Programme extends React.Component { render: (text, record) => { return ( { this.onEdit(record); }}> - 编辑 + {showOperateBtn ? "编辑" : "查看"} ); } }); - newColumns.push({ + showOperateBtn && newColumns.push({ key: "moreOperate", dataIndex: "moreOperate", render: (text, record) => { diff --git a/pc4mobx/hrmSalary/stores/mySalary.js b/pc4mobx/hrmSalary/stores/mySalary.js index f9ce5acf..d7a05f1b 100644 --- a/pc4mobx/hrmSalary/stores/mySalary.js +++ b/pc4mobx/hrmSalary/stores/mySalary.js @@ -37,27 +37,32 @@ export class MySalaryStore { this.loading = true; this.hasRight = false; }; - @action setMySalaryBill= (mySalaryBill)=> {this.mySalaryBill= mySalaryBill}; - @action init = async props => { + @action setMySalaryBill = (mySalaryBill) => { + this.mySalaryBill = mySalaryBill; + }; + @action init = async (isRoot = true) => { this.clear(); //1.check is need second verify if (window.doCheckSecondaryVerify4ec) { - window.doCheckSecondaryVerify4ec({ mouldCode: "HRM", itemCode: "SALARY" }, this.getData); + window.doCheckSecondaryVerify4ec({ mouldCode: "HRM", itemCode: "SALARY" }, (data) => this.getData({ + ...data, + isRoot + })); } else { //4.loaddata - this.getData({ status: "1", token: "" }); + this.getData({ status: "1", token: "", isRoot }); } }; @action getData = async (params = {}) => { if (_.isEmpty(params)) return; - const { status, token } = params; + const { status, isRoot, token } = params; if (status == "1") { // Object.assign(this._reqParams, { token }); // this.getFormData({ viewAttr: 1 }); this.hasRight = true; - this.mySalaryBillList() + isRoot && this.mySalaryBillList(); } else { this.hasRight = false; } @@ -148,17 +153,18 @@ export class MySalaryStore { // 我的工资单详情 @action getMySalaryBill = (salaryInfoId) => { - return new Promise((resolve, reject)=>{ - API.mySalaryBill({ salaryInfoId }).then(res => { + const payload = Object.prototype.toString.call(salaryInfoId) === "[object Number]" ? { salaryInfoId } : { ...salaryInfoId }; + return new Promise((resolve, reject) => { + API.mySalaryBill(payload).then(res => { if (res.status) { this.mySalaryBill = res.data; - resolve(res.data) + resolve(res.data); } else { message.error(res.errormsg || "获取失败"); - reject("获取失败") + reject("获取失败"); } }); - }) + }); }; @action