薪资项目列表操作权限修改

This commit is contained in:
黎永顺 2023-02-15 14:18:20 +08:00
parent 570493267e
commit 4e6f727727
4 changed files with 66 additions and 36 deletions

View File

@ -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"
}}>
<Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
store={this.props.mySalaryStore}>
<div className="templatePreview">
<div className="contentWrapper">
{
type === "phone" ?
<PhoneTemplate
isPreview
isMsgPreview
salaryTemplateShowSet={JSON.stringify(mySalaryBillData.salaryTemplate)}
salaryItemSet={!_.isEmpty(salaryGroups) ? JSON.stringify([employeeInformation, ...salaryGroups]) : []}
/> :
{
type === "phone" ?
<div className="templatePreview">
<div className="contentWrapper">
<PhoneTemplate
isPreview
isMsgPreview
salaryTemplateShowSet={JSON.stringify(mySalaryBillData.salaryTemplate)}
salaryItemSet={!_.isEmpty(salaryGroups) ? JSON.stringify([employeeInformation, ...salaryGroups]) : []}
/>
</div>
</div>
:
<Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
store={this.props.mySalaryStore}>
<div className="templatePreview">
<div className="contentWrapper">
<ComputerTemplate
isPreview
isMsgPreview
salaryTemplateShowSet={JSON.stringify(mySalaryBillData.salaryTemplate)}
salaryItemSet={!_.isEmpty(salaryGroups) ? JSON.stringify([employeeInformation, ...salaryGroups]) : JSON.stringify([])}
/>
}
</div>
</div>
</Authority>
</div>
</div>
</Authority>
}
</div>
);
}

View File

@ -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",

View File

@ -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 (
<a
href="javascript:void(0);"
onClick={() => {
this.onEdit(record);
}}>
编辑
{showOperateBtn ? "编辑" : "查看"}
</a>
);
}
});
newColumns.push({
showOperateBtn && newColumns.push({
key: "moreOperate",
dataIndex: "moreOperate",
render: (text, record) => {

View File

@ -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