提交 232526a8 authored 作者: 钟是志's avatar 钟是志

批量签章函数 发起.

使用async await 封装
上级 4b5173f1
const initSignFunc = () => {
window.stuSigningAuditXueShengChu = (props) => { // 在这里搞事情
const initSignFunc = () => {
window.stuSigningAuditXueShengChu = (props) => {
// 在这里搞事情
//console.log(props);
const { selectRows, setSubmitLoading,uaaRequest,examineMap } = props;
const { selectRows, setSubmitLoading, uaaRequest, examineMap, message, setVisible, callback } = props;
let total = selectRows.length;
let success = 0;
let fail = 0;
/**
*
* 第一步 获取选择的每一条审核数据需要盖章的图片
* 一旦开始调接口 就需要 setSubmitLoading(true) 转圈圈
*/
const selectList = selectRows.map((g) => {
const selectList =
selectRows.map((g) => {
let json = {};
json.signaturePicture = g["LLMbGiXIkvE"];
json.setUp = g["LLtAdXHnnVM"] ? JSON.parse(g["LLtAdXHnnVM"]):{};
json.enclosure = g["LHfENWqbwZs"];
json.code = g["code"];
json.taskId = g["taskId"];
json.appId = g["appId"];
json.signaturePicture = g['LLMbGiXIkvE'];
json.setUp = g['LLtAdXHnnVM'] ? JSON.parse(g['LLtAdXHnnVM']) : {};
json.enclosure = g['LHfENWqbwZs'];
json.code = g['code'];
json.taskId = g['taskId'];
json.appId = g['appId'];
return json;
}) || [];
//console.log("selectList",selectList);
setSubmitLoading(true); // 显示为加载中
uaaRequest("/DataColumnApi/getSqlColumn", { token:1,json: "LLyJBlByfFM",param:"{}", type: 1 } ).then((result,com)=>{
let {XAxisOffset,YAxisOffset} = result;
uaaRequest('/DataColumnApi/getSqlColumn', {
token: 1,
json: 'LLyJBlByfFM',
param: '{}',
type: 1,
}).then((result, com) => {
let { XAxisOffset, YAxisOffset } = result;
for(var selectI in selectList){
let promiseArray = [];
// 姚
for (var selectI in selectList) {
let selectData = selectList[selectI];
let {setUp,enclosure,signaturePicture,taskId,code,appId} = selectData;
let background = enclosure.files[enclosure.files.length-1].path;
let { setUp, enclosure, signaturePicture, taskId, code, appId } = selectData;
let background = enclosure.files[enclosure.files.length - 1].path;
setUp.objs.forEach((sv,si)=>{
setUp.objs.forEach((sv, si) => {
sv.x += XAxisOffset;
sv.y += YAxisOffset;
if(sv.key === "photo"){
if (sv.key === 'photo') {
sv.path = signaturePicture.obtainEmploymentSeal;
}
});
uaaRequest("/ImageLibApi/merge", { background:background ,content:JSON.stringify(setUp) }).then((merge) =>{
if("errMsg" in merge){
console.log("->>>>>>>>>","印章失败");
return
const oneStudentTask = async () => {
let resOneStudentRes = await uaaRequest('/ImageLibApi/merge', {
background: background,
content: JSON.stringify(setUp),
}).then((merge) =>
{
if (!merge) {
console.log('->>>>>>>>>', '印章失败');
return false;
}
if(enclosure.files == [] && enclosure.files.length == 0){
console.log("->>>>>>>>>","没有签章图片");
return
if (enclosure.files == [] && enclosure.files.length == 0) {
console.log('->>>>>>>>>', '没有签章图片');
return false;
}
enclosure.files[enclosure.files.length-1].originPath = background;
enclosure.files[enclosure.files.length-1].path = merge.path;
let taskForm = {"LLIZZkKNsdc":enclosure};//就业处审核表单
let examineMaps = {"reason":"",...JSON.parse(examineMap),code};//审核意见
enclosure.files[enclosure.files.length - 1].originPath = background;
enclosure.files[enclosure.files.length - 1].path = merge.path;
let taskForm = { LLIZZkKNsdc: enclosure }; //就业处审核表单
let examineMaps = { reason: '', ...JSON.parse(examineMap), code }; //审核意见
let examineJson = {
level:"" ,
code:code,
level: '',
code: code,
taskIds: taskId,
examineMap: JSON.stringify(examineMaps),
taskForm:JSON.stringify(taskForm)
taskForm: JSON.stringify(taskForm),
};
console.log("examineJson",examineJson);
// uaaRequest("/UnifiedAppFormApi/examineProcess", examineJson).then((merge) =>{
// if("errMsg" in merge){
// console.log("->>>>>>>>>","审核失败");
// return
// }
// console.log("->>>>>>>>>","审核成功");
// });
console.log('examineJson', examineJson);
return uaaRequest('/UnifiedAppFormApi/examineProcess', examineJson).then((resProcess) => {
if (!resProcess) {
console.log('->>>>>>>>>', '审核失败');
return false;
}
return true;
console.log('->>>>>>>>>', '审核成功');
});
});
if(resOneStudentRes){
success++;
}else{
fail++;
}
message.destroy();
message.info(`正在进行批量签章审核,请耐心等待, 当前共审核成功${success}条, 失败${fail}条.共需审核${total}条`, 2);
return true;
};
promiseArray.push(oneStudentTask);
}
// 钟
let taskFunc = async () => {
for(let i = 0; i < promiseArray.length; i++){
let res1 = await promiseArray[i]();
console.log(res1);
}
return true;
}
taskFunc().then((g) =>{
if(g){
message.success('审核完成');
setSubmitLoading(false);
setVisible(false);
callback(true);
}
})
});
/**
* 第二步 (执行签章 + 审批接口) * 审核条数.
......@@ -88,7 +136,7 @@ const initSignFunc = () => {
// examineMap: {"examine":"0","reason":"","code":"1474735810300354560","sign":""}
// taskForm: {"LLIZZkKNsdc":{"files":[{"path":"/u/202112/25213627whnv.jpg","name":"1.jpg","originPath":"/u/202112/25213627whnv.jpg"},{"path":"/u/202112/2811544509gm_m.png","name":"2.jpg","originPath":"/u/202112/2811544509gm_m.png"}]}}
// token: 62d75935-6a06-4cd4-82aa-ee9cf9a22790
}
}
};
};
export default initSignFunc;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论