Merge branch 'feature/2.9.42310.01-社保福利台账详情页面的导入下载模板接口更换' into develop

This commit is contained in:
黎永顺 2023-10-12 15:52:44 +08:00
commit 9f4e8468e7
9 changed files with 171 additions and 74 deletions

View File

@ -1,4 +1,5 @@
import { WeaTools } from "ecCom";
import { formHeaderPost } from "../util/request";
import { convertToUrlString } from "../util/url";
// 工资单列表
@ -26,23 +27,25 @@ export const recordList = params => {
// 工资查看详情
export const mySalaryBill = params => {
return fetch(`/api/bs/hrmsalary/salaryBill/mySalaryBill?${convertToUrlString(params)}`, {
const { header, ...payload } = params;
return fetch(`/api/bs/hrmsalary/salaryBill/mySalaryBill?${convertToUrlString(payload)}`, {
method: "GET",
mode: "cors",
headers: {
"Content-Type": "application/json"
}
headers: { "Content-Type": "application/json", ...header }
}).then(res => res.json());
};
export const isNeedSecondPwdVerify = params => {
return WeaTools.callApi("/api/encrypt/secondauthsetting/isNeedSecondAuth", "POST", params);
export const isNeedSecondPwdVerify = (params, headers) => {
return formHeaderPost("/api/encrypt/secondauthsetting/isNeedSecondAuth", "POST", params, headers);
// return WeaTools.callApi("/api/encrypt/secondauthsetting/isNeedSecondAuth", "POST", params);
};
export const getSecondAuthForm = params => {
return WeaTools.callApi("/api/encrypt/secondauthsetting/getSecondAuthForm", "POST", params);
export const getSecondAuthForm = (params, headers) => {
return formHeaderPost("/api/encrypt/secondauthsetting/getSecondAuthForm", "POST", params, headers);
// return WeaTools.callApi("/api/encrypt/secondauthsetting/getSecondAuthForm", "POST", params);
};
export const doSecondAuth = params => {
return WeaTools.callApi("/api/encrypt/secondauthsetting/doSecondAuth", "POST", params);
export const doSecondAuth = (params, headers) => {
return formHeaderPost("/api/encrypt/secondauthsetting/doSecondAuth", "POST", params, headers);
// return WeaTools.callApi("/api/encrypt/secondauthsetting/doSecondAuth", "POST", params);
};
export const checkPassword = params => {
return WeaTools.callApi("/api/hrm/secondarypwd/checkPassword", "POST", params);
@ -50,3 +53,6 @@ export const checkPassword = params => {
export const saveSecondaryPwd = params => {
return WeaTools.callApi("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params);
};
export const salaryBillGetToken = params => {
return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/getToken", "GET", params);
};

View File

@ -1,5 +1,6 @@
import { WeaTools } from "ecCom";
import { postFetch } from "../util/request";
import { convertToUrlString } from "../util/url";
//工资单-工资单发放列表
export const getPayrollList = params => {
@ -377,7 +378,13 @@ export const payrollCheckType = params => {
};
//工资单-反馈验证
export const feedBackSalaryBill = params => {
return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/feedBackSalaryBill", "GET", params);
const { header, ...payload } = params;
return fetch(`/api/bs/hrmsalary/salaryBill/feedBackSalaryBill?${convertToUrlString(payload)}`, {
method: "GET",
mode: "cors",
headers: { "Content-Type": "application/json", ...header }
}).then(res => res.json());
// return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/feedBackSalaryBill", "GET", params);
};
//工资单-确认
export const confirmSalaryBill = params => {

View File

@ -1,5 +1,5 @@
import { WeaTools } from "ecCom";
import { postFetch } from "../util/request";
import { postExportFetch, postFetch } from "../util/request";
//社会福利台账-获取正常缴纳列表
export const getCommonList = (params) => {
@ -339,3 +339,15 @@ export const compensationConfigSave = (params) => {
export const compensationBack = (params) => {
return postFetch("/api/bs/hrmsalary/siaccount/compensationBack", params);
};
export const exportSiaccountWelfareImporttemplate = params => {
return postExportFetch("/api/bs/hrmsalary/siaccount/welfare/importtemplate/export", params);
};
export const exportSiaccountWelfaresupplyimporttemplatetemplate = params => {
return postExportFetch("/api/bs/hrmsalary/siaccount/welfare/supplyimporttemplate/export", params);
};
export const exportSiaccountWelfarebalanceimporttemplatetetemplate = params => {
return postExportFetch("/api/bs/hrmsalary/siaccount/welfare/balanceimporttemplate/export", params);
};

View File

@ -6,6 +6,11 @@ import SelectFieldModal from "./selectFieldModal";
import { getQueryString } from "../../../../util/url";
import AddHeaderFieldsModal from "./addHeaderFieldsModal";
import { cacheImportField } from "../../../../apis/calculate";
import {
exportSiaccountWelfarebalanceimporttemplatetetemplate,
exportSiaccountWelfareImporttemplate,
exportSiaccountWelfaresupplyimporttemplatetemplate
} from "../../../../apis/standingBook";
@inject("calculateStore", "standingBookStore")
@observer
@ -76,11 +81,23 @@ export default class AcctResultImportModal extends React.Component {
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
if (standingBookTabKey === "1") {
url = `${window.location.origin}/api/bs/hrmsalary/siaccount/welfare/importtemplate/export?welfareNames=${this.state.modalParam.salaryItemIds}&billMonth=${billMonth}&paymentOrganization=${paymentOrganization}`;
const promise = exportSiaccountWelfareImporttemplate({
billMonth,
welfareNames: this.state.modalParam.salaryItemIds.split(","),
paymentOrganization: Number(paymentOrganization)
});
} else if (standingBookTabKey === "3") {
url = `${window.location.origin}/api/bs/hrmsalary/siaccount/welfare/supplyimporttemplate/export?welfareNames=${this.state.modalParam.salaryItemIds}&billMonth=${billMonth}&paymentOrganization=${paymentOrganization}`;
const promise = exportSiaccountWelfaresupplyimporttemplatetemplate({
billMonth,
welfareNames: this.state.modalParam.salaryItemIds.split(","),
paymentOrganization: Number(paymentOrganization)
});
} else if (standingBookType === "difference") {
url = `${window.location.origin}/api/bs/hrmsalary/siaccount/welfare/balanceimporttemplate/export?welfareNames=${this.state.modalParam.salaryItemIds}&billMonth=${billMonth}&paymentOrganization=${paymentOrganization}`;
const promise = exportSiaccountWelfarebalanceimporttemplatetetemplate({
billMonth,
welfareNames: this.state.modalParam.salaryItemIds.split(","),
paymentOrganization: Number(paymentOrganization)
});
}
}
window.open(url, "_self");

View File

@ -37,7 +37,7 @@ class Index extends Component {
super(props);
this.state = {
year: moment(new Date()).format("YYYY"),
declareMonth: moment(new Date()).month() + 1 > 10 ? (moment(new Date()).month() + 1) + "" : "0" + (moment(new Date()).month() + 1),
declareMonth: moment(new Date()).month() + 1 >= 10 ? (moment(new Date()).month() + 1) + "" : "0" + (moment(new Date()).month() + 1),
taxAgentId: "",
innerWidth: window.innerWidth,
addAllLoading: false,

View File

@ -8,6 +8,7 @@ import ComputerTemplate from "../payroll/templatePreview/computerTemplate";
import PhoneTemplate from "../payroll/templatePreview/phoneTemplate";
import "../payroll/templatePreview/index.less";
import * as API from "../../apis/mySalaryBenefits";
import { salaryBillGetToken } from "../../apis/mySalaryBenefits";
import { confirmSalaryBill, feedBackSalaryBill, payrollCheckType } from "../../apis/payroll";
import CaptchaModal from "../../components/captchaModal";
import PassSetDialog from "./passSetDialog";
@ -30,7 +31,8 @@ export default class MobilePayroll extends React.Component {
mySalaryBillData: {
employeeInformation: {},
salaryTemplate: []
}
},
salaryBillToken: {}
};
this.id = "";
}
@ -39,37 +41,57 @@ export default class MobilePayroll extends React.Component {
const type = getQueryString("type");
this.id = getQueryString("id");
const { mySalaryStore: { init } } = this.props;
const { data, status } = await payrollCheckType();
if (type !== "phone") {
const { data, status } = await payrollCheckType();
if (status && data === "PWD") {
init(false, () => this.getMySalaryBill(this.id));
} else {
this.setState({ captchaVisible: true });
}
}
type === "phone" && this.initMobile();
type === "phone" && await this.initMobile();
}
initMobile = () => {
initMobile = async () => {
const { mySalaryStore: { setInitEmVerify } } = this.props;
// if (window.em) {
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }).then(({ status, isNeedSecondAuth }) => {
if (status && isNeedSecondAuth) {
this.setState({ visible: true }, () => {
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }).then(({ status, notSetting }) => {
this.setState({ notSetting });
});
if (window.em) {
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, isNeedSecondAuth }) => {
if (status && isNeedSecondAuth) {
this.setState({ visible: true }, () => {
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, notSetting }) => {
this.setState({ notSetting });
});
});
} else {
this.getMySalaryBill(getQueryString("id"));
setInitEmVerify();
}
});
} else {
this.getMySalaryBill(getQueryString("id"));
setInitEmVerify();
}
});
// } else {
// setInitEmVerify();
// }
} else {
const params = this.getUrlkey();
const { data } = await salaryBillGetToken({ uid: _.pick(params, ["recipient"]).recipient });
this.setState({ salaryBillToken: data }, () => {
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, isNeedSecondAuth }) => {
if (status && isNeedSecondAuth) {
this.setState({ visible: true }, () => {
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, notSetting }) => {
this.setState({ notSetting });
});
});
} else {
this.getMySalaryBill(getQueryString("id"));
setInitEmVerify();
}
});
});
}
};
doSecondAuth = () => {
const { salaryBillToken } = this.state;
const { mySalaryStore: { setInitEmVerify } } = this.props;
if (!this.state.authCode) {
this.refs.weaError.showError();
@ -77,7 +99,7 @@ export default class MobilePayroll extends React.Component {
}
API.doSecondAuth({
authCode: this.state.authCode, mouldCode: "HRM", itemCode: "SALARY"
}).then(({ status, checkStatus, checkMsg }) => {
}, salaryBillToken).then(({ status, checkStatus, checkMsg }) => {
if (status && checkStatus === "1") {
message.success(checkMsg);
setInitEmVerify();
@ -89,10 +111,11 @@ export default class MobilePayroll extends React.Component {
});
};
getMySalaryBill = (salaryInfoId) => {
const { salaryBillToken } = this.state;
const { mySalaryStore: { getMySalaryBill } } = this.props;
const params = this.getUrlkey();
const payload = {
salaryInfoId,
salaryInfoId, header: salaryBillToken,
..._.pick(params, ["recipient"])
};
getMySalaryBill(payload).then(result => {
@ -129,17 +152,20 @@ export default class MobilePayroll extends React.Component {
title: getLabel(131329, "信息确认"),
content: getLabel(111, "请确认薪资信息是有误,进行反馈并发起反馈流程。"),
onOk: () => {
feedBackSalaryBill({ salaryInfoId: getQueryString("id") }).then(({ status, errorMsg }) => {
if (status) {
const { mySalaryBillData } = this.state;
const { salaryTemplate } = mySalaryBillData;
const { feedbackUrl } = salaryTemplate;
this.getMySalaryBill(getQueryString("id"));
window.open(`${window.ecologyContentPath || ""}${feedbackUrl}`);
} else {
message.error(errorMsg);
}
});
const { salaryBillToken } = this.state;
feedBackSalaryBill({ salaryInfoId: getQueryString("id"), header: salaryBillToken })
.then(({ status, errorMsg }) => {
if (status) {
const { mySalaryBillData } = this.state;
const { salaryTemplate } = mySalaryBillData;
const { feedbackUrl } = salaryTemplate;
this.getMySalaryBill(getQueryString("id"));
window.location.href = `${window.ecologyContentPath || ""}${feedbackUrl}`;
// window.open(`${window.ecologyContentPath || ""}${feedbackUrl}`);
} else {
message.error(errorMsg);
}
});
}
});
};
@ -165,7 +191,8 @@ export default class MobilePayroll extends React.Component {
]}
>
<WeaError tipPosition="bottom" ref="weaError" error="此项必填">
<WeaInput value={this.state.authCode} viewAttr={3} onChange={authCode => this.setState({ authCode })}/>
<WeaInput value={this.state.authCode} type="password" viewAttr={3}
onChange={authCode => this.setState({ authCode })}/>
</WeaError>
{
notSetting &&

View File

@ -312,7 +312,7 @@ export default class FormalFormModal extends React.Component {
// validateType: this.props.dataType || this.state.returnType,
// extendParam: JSON.stringify(this.state.extendParam),
// formula: this.state.value,
parameters: this.parameters,
parameters: _.map(this.parameters, o => ({ ...o, content: o.content || "" })),
id: this.props.formulaId
// referenceType: this.referenceType == "" ? this.props.valueType == "2" ? "formula" : this.props.valueType == "3" ? "sql" : "" : this.referenceType
};

View File

@ -1,26 +1,54 @@
export const formPost = (url, params) => {
url = url + "?__random__=" + (new Date()).valueOf();
let formdata = new URLSearchParams();
Object.keys(params).map(key => {
formdata.append(key, params[key])
})
return fetch(url, {
method:"POST",
headers:{
"Content-Type":'application/x-www-form-urlencoded'
},
body:formdata
}).then(res => res.json())
}
export const formHeaderPost = (url, method, params, header) => {
url = url + "?__random__=" + (new Date()).valueOf();
let formdata = new URLSearchParams();
Object.keys(params).map(key => {
formdata.append(key, params[key]);
});
return fetch(url, {
method, mode: "cors",
headers: { "Content-Type": "application/x-www-form-urlencoded", ...header },
body: formdata
}).then(res => res.json());
};
export const postFetch = (url, params) => {
url = url + "?__random__=" + (new Date()).valueOf();
return fetch(url, {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
url = url + "?__random__=" + (new Date()).valueOf();
return fetch(url, {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
export const headerRequestFetch = (url, method, params, header) => {
url = url + "?__random__=" + (new Date()).valueOf();
return fetch(url, {
method, mode: "cors",
headers: { "Content-Type": "application/json", ...header },
body: JSON.stringify(params)
}).then(res => res.json());
};
export const postExportFetch = (url, params) => {
url = url + "?__random__=" + (new Date()).valueOf();
return fetch(url, {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => {
const filename = res.headers.get("Content-Disposition").split("filename=")[1];
res.blob().then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = decodeURI(filename);
a.click();
window.URL.revokeObjectURL(url);
});
});
};