|
|
@ -48,19 +48,17 @@ |
|
|
|
<div class="title"></div> |
|
|
|
<div class="flex justify-between"> |
|
|
|
<div class="text-sm">培训计划审核</div> |
|
|
|
<div class="text-sm train-pass-btn"> |
|
|
|
<button class="text-xs text-blue-400 border rounded w-10 h-5" onclick="p1449944565028233216.showReject()">驳回</button> |
|
|
|
<button class="text-xs text-white bg-blue-500 border rounded w-10 h-5" onclick="p1449944565028233216.passTrain()">通过</button> |
|
|
|
<div class="train-pass-btn text-sm flex"> |
|
|
|
<button class="mr-2 text-sm text-gray-400 border border-gray-400 rounded w-12 h-6" onclick="p1449944565028233216.showReject()">驳回</button> |
|
|
|
<button class="bg-blue-500 text-sm rounded w-12 h-6 text-white" onclick="p1449944565028233216.submit(1)">通过</button> |
|
|
|
</div> |
|
|
|
<div class="text-sm train-pass-status" style="display: none;"> |
|
|
|
<span class="text-green-500 pass-text">已通过</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="border-2 w-full mt-2.5 flex justify-between p-2 text-sm"> |
|
|
|
<p style="color: #999999;">山西跳协**培训红头文件</p> |
|
|
|
<div> |
|
|
|
<button class="text-xs border rounded-full w-10 h-5" onclick="p1449944565028233216.checkFile()">查看</button> |
|
|
|
</div> |
|
|
|
<div class="mt-2.5 px-2 flex justify-between items-center w-full h-8 border border-gray-200 rounded-sm text-sm"> |
|
|
|
<p class="file-name text-gray-400 truncate" style="width: calc(100vw - 9rem)"></p> |
|
|
|
<button class="text-xs text-blue-400 border border-blue-400 rounded-full w-10 h-5" onclick="p1449944565028233216.checkFile()">查看</button> |
|
|
|
</div> |
|
|
|
<div class="pl-7 pr-7 pt fixed z-10 statusChoose bg-black bg-opacity-50" style="display: none; top: 0; bottom: 0; left: 0; right: 0; padding-top: calc((100vh - 250px) / 2);"> |
|
|
|
<div class="bg-white"> |
|
|
@ -73,7 +71,7 @@ |
|
|
|
</div> |
|
|
|
<div class="border-t btn mt-6 flex justify-between"> |
|
|
|
<div class="flex-1 text-center border-r h-full" style="line-height: 3.375rem;" onclick="p1449944565028233216.hide()">取消</div> |
|
|
|
<div class="flex-1 text-center h-full" style="line-height: 3.375rem;" onclick="p1449944565028233216.submit()">提交</div> |
|
|
|
<div class="flex-1 text-center h-full" style="line-height: 3.375rem;" onclick="p1449944565028233216.submit(2)">提交</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -88,11 +86,9 @@ |
|
|
|
<span class="text-red-500 reject-text">已驳回</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="border-2 w-full mt-2.5 flex justify-between p-2 text-sm"> |
|
|
|
<p style="color: #999999;">山西跳协**培训红头文件</p> |
|
|
|
<div> |
|
|
|
<button class="text-xs border rounded-full w-10 h-5" onclick="p1449944565028233216.checkFile()">查看</button> |
|
|
|
</div> |
|
|
|
<div class="mt-2.5 px-2 flex justify-between items-center w-full h-8 border border-gray-200 rounded-sm text-sm"> |
|
|
|
<p class="file-name text-gray-400 truncate" style="width: calc(100vw - 9rem)">山西跳协**培训红头文件</p> |
|
|
|
<button class="text-xs text-blue-400 border border-blue-400 rounded-full w-10 h-5" onclick="p1449944565028233216.checkFile()">查看</button> |
|
|
|
</div> |
|
|
|
<div class="border-2 w-full mt-2.5 flex justify-between p-2 text-sm reason-box"> |
|
|
|
<p class="w-20 flex-shrink-0" style="color: #999999;">驳回原因</p></p> |
|
|
@ -117,18 +113,20 @@ |
|
|
|
projectId: '', |
|
|
|
roleId: '', |
|
|
|
dom: '', |
|
|
|
lists: [], |
|
|
|
currentIndex: '', |
|
|
|
memberId: '', // 打卡人id |
|
|
|
checkerId: '', // 审核员id |
|
|
|
checkerName: '', // 审核员 |
|
|
|
id: '', // 记录id |
|
|
|
planId: '', // 计划ID |
|
|
|
trainPlanCheck: '', // 培训计划待审核div |
|
|
|
trainPlanReject: '', // 培训计划已驳回div |
|
|
|
trainPlanHide: '', // 培训计划未加载完div |
|
|
|
|
|
|
|
init() { |
|
|
|
this.dom = document.querySelector("div[data-root=p1449944565028233216]"); |
|
|
|
var domBox = this.dom.parentNode; |
|
|
|
var title = this.dom.querySelector('.title'); |
|
|
|
|
|
|
|
this.trainPlanCheck = document.querySelector('.train-plan-check'); // 培训计划待审核div |
|
|
|
this.trainPlanHide = document.querySelector('.train-plan-hide'); // 培训计划已驳回div |
|
|
|
this.trainPlanReject = document.querySelector('.train-plan-reject'); // 培训计划未加载完div |
|
|
|
|
|
|
|
// 获取父元素携带的参数 |
|
|
|
var userId = domBox.getAttribute("data-uid"); |
|
|
|
this.projectId = domBox.getAttribute("data-pid"); |
|
|
@ -148,7 +146,7 @@ |
|
|
|
const { success, code, data, msg } = res; |
|
|
|
if (success && code === 200) { |
|
|
|
that.token = data.token; |
|
|
|
// 查询考勤信息 |
|
|
|
// 获取当前是否有培训计划 |
|
|
|
that.getTrainPlan() |
|
|
|
} else { |
|
|
|
console.log('msg: ', msg); |
|
|
@ -156,59 +154,58 @@ |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取当前审核状态 |
|
|
|
// 获取当前是否有培训计划 |
|
|
|
getTrainPlan(){ |
|
|
|
var that = this; |
|
|
|
var trainPlanCheck = that.dom.querySelector('.train-plan-check'); |
|
|
|
var trainPlanHide = that.dom.querySelector('.train-plan-hide'); |
|
|
|
var trainPlanReject = that.dom.querySelector('.train-plan-reject'); |
|
|
|
trainPlanHide.style.display = 'none'; |
|
|
|
trainPlanCheck.style.display = 'block'; |
|
|
|
trainPlanReject.style.display = 'none'; |
|
|
|
|
|
|
|
// fetch(`https://test.tall.wiki/gateway/sports/training/get`, { |
|
|
|
// headers: new Headers({ |
|
|
|
// 'Authorization': 'Bearer ' + that.token, |
|
|
|
// 'Content-Type': 'application/json; charset=utf-8' |
|
|
|
// }), |
|
|
|
// method: 'POST', |
|
|
|
// body: JSON.stringify({ |
|
|
|
// param: {projectId: that.projectId} |
|
|
|
// }) |
|
|
|
// }) |
|
|
|
// .then(function(response) { |
|
|
|
// return response.json(); |
|
|
|
// }) |
|
|
|
// .then(function(res) { |
|
|
|
// const { success, code, data, msg } = res; |
|
|
|
// if (success && code === 200) { |
|
|
|
// if (data && data.checkStatus === 0) { |
|
|
|
// trainPlanHide.style.display = 'none' |
|
|
|
// trainPlanCheck.style.display = 'block' |
|
|
|
// trainPlanReject.style.display = 'none' |
|
|
|
// } else if (data && data.checkStatus === 1 || data && data.checkStatus === 2) { |
|
|
|
// trainPlanHide.style.display = 'none' |
|
|
|
// trainPlanCheck.style.display = 'none' |
|
|
|
// trainPlanReject.style.display = 'block' |
|
|
|
fetch(`https://test.tall.wiki/gateway/sports/training/get`, { |
|
|
|
headers: new Headers({ |
|
|
|
'Authorization': 'Bearer ' + that.token, |
|
|
|
'Content-Type': 'application/json; charset=utf-8' |
|
|
|
}), |
|
|
|
method: 'POST', |
|
|
|
body: JSON.stringify({ |
|
|
|
param: {projectId: that.projectId} |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(function(response) { |
|
|
|
return response.json(); |
|
|
|
}) |
|
|
|
.then(function(res) { |
|
|
|
const { success, code, data, msg } = res; |
|
|
|
if (success && code === 200) { |
|
|
|
if (!data) { |
|
|
|
that.trainPlanHide.style.display = 'block'; |
|
|
|
that.trainPlanCheck.style.display = 'none'; |
|
|
|
that.trainPlanReject.style.display = 'none'; |
|
|
|
} else { |
|
|
|
that.dom.querySelector('.file-name').innerHTML = data.name; |
|
|
|
that.planId = data.id; |
|
|
|
|
|
|
|
// var trainPlanStatusReject = that.dom.querySelector('.reject-text'); |
|
|
|
// var trainPlanStatusPass = that.dom.querySelector('.pass-text'); |
|
|
|
// if (data.checkStatus === 1) { |
|
|
|
// trainPlanStatusReject.style.display = 'none'; |
|
|
|
// trainPlanStatusPass.style.display = 'block'; |
|
|
|
// } else { |
|
|
|
// trainPlanStatusReject.style.display = 'block'; |
|
|
|
// trainPlanStatusPass.style.display = 'none'; |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// trainPlanHide.style.display = 'block' |
|
|
|
// trainPlanCheck.style.display = 'none' |
|
|
|
// trainPlanReject.style.display = 'none' |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// console.log('msg: ', msg); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
if (data.checkStatus === 0) { |
|
|
|
that.trainPlanHide.style.display = 'none'; |
|
|
|
that.trainPlanCheck.style.display = 'block'; |
|
|
|
that.trainPlanReject.style.display = 'none'; |
|
|
|
} else if (data.checkStatus === 1 && data.checkStatus === 2) { |
|
|
|
that.trainPlanHide.style.display = 'none'; |
|
|
|
that.trainPlanCheck.style.display = 'none'; |
|
|
|
that.trainPlanReject.style.display = 'block'; |
|
|
|
|
|
|
|
var trainPlanStatusReject = that.dom.querySelector('.reject-text'); |
|
|
|
var trainPlanStatusPass = that.dom.querySelector('.pass-text'); |
|
|
|
if (data.checkStatus === 1) { |
|
|
|
trainPlanStatusReject.style.display = 'none'; |
|
|
|
trainPlanStatusPass.style.display = 'block'; |
|
|
|
} else { |
|
|
|
trainPlanStatusReject.style.display = 'block'; |
|
|
|
trainPlanStatusPass.style.display = 'none'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
console.log('msg: ', msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 查看红头文件 |
|
|
@ -219,22 +216,6 @@ |
|
|
|
location.href=`https://test.tall.wiki/ts/file?pid=${pId}&uid=${uId}&rid=${rId}` |
|
|
|
}, |
|
|
|
|
|
|
|
// 通过 |
|
|
|
passTrain() { |
|
|
|
var that = this; |
|
|
|
var trainPlanCheck = that.dom.querySelector('.train-plan-check'); |
|
|
|
var trainPlanHide = that.dom.querySelector('.train-plan-hide'); |
|
|
|
var trainPlanReject = that.dom.querySelector('.train-plan-reject'); |
|
|
|
trainPlanHide.style.display = 'none'; |
|
|
|
trainPlanCheck.style.display = 'block'; |
|
|
|
trainPlanReject.style.display = 'none'; |
|
|
|
|
|
|
|
var trainBtn = that.dom.querySelector('.train-pass-btn'); |
|
|
|
trainBtn.style.display = 'none'; |
|
|
|
var passStatus = that.dom.querySelector('.train-pass-status'); |
|
|
|
passStatus.style.display = 'block'; |
|
|
|
}, |
|
|
|
|
|
|
|
// 驳回弹框 |
|
|
|
showReject(){ |
|
|
|
var statusChoose = this.dom.querySelector('.statusChoose'); |
|
|
@ -242,38 +223,49 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
// 提交 |
|
|
|
submit(){ |
|
|
|
submit(type){ |
|
|
|
var that = this; |
|
|
|
that.hide(); |
|
|
|
var trainPlanReject = that.dom.querySelector('.train-plan-reject'); |
|
|
|
trainPlanReject.style.display = 'block'; |
|
|
|
var trainPlanCheck = that.dom.querySelector('.train-plan-check'); |
|
|
|
trainPlanCheck.style.display = 'none'; |
|
|
|
// fetch(`https://test.tall.wiki/gateway/sports/training/audit`, { |
|
|
|
// headers: new Headers({ |
|
|
|
// 'Authorization': 'Bearer ' + that.token, |
|
|
|
// 'Content-Type': 'application/json; charset=utf-8' |
|
|
|
// }), |
|
|
|
// method: 'POST', |
|
|
|
// body: JSON.stringify({ |
|
|
|
// param: { |
|
|
|
// id: id, |
|
|
|
// type: 2, |
|
|
|
// remark: that.dom.querySelector(".reason").value |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// }) |
|
|
|
// .then(function(response) { |
|
|
|
// return response.json(); |
|
|
|
// }) |
|
|
|
// .then(function(res) { |
|
|
|
// const { success, code, data, msg } = res; |
|
|
|
// if (success && code === 200) { |
|
|
|
// that.hide(); |
|
|
|
// } else { |
|
|
|
// console.log('msg: ', msg); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
let reason = that.dom.querySelector(".reason").value; |
|
|
|
if (type === 2 && !reason) { |
|
|
|
window.alert("请填写驳回原因"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
fetch(`https://test.tall.wiki/gateway/sports/training/audit`, { |
|
|
|
headers: new Headers({ |
|
|
|
'Authorization': 'Bearer ' + that.token, |
|
|
|
'Content-Type': 'application/json; charset=utf-8' |
|
|
|
}), |
|
|
|
method: 'POST', |
|
|
|
body: JSON.stringify({ |
|
|
|
param: { |
|
|
|
id: that.planId, |
|
|
|
type: type, |
|
|
|
remark: type === 1 ? '' : reason |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(function(response) { |
|
|
|
return response.json(); |
|
|
|
}) |
|
|
|
.then(function(res) { |
|
|
|
const { success, code, data, msg } = res; |
|
|
|
if (success && code === 200) { |
|
|
|
var trainPlanReject = that.dom.querySelector('.train-plan-reject'); |
|
|
|
var trainPlanCheck = that.dom.querySelector('.train-plan-check'); |
|
|
|
if (type == 2) { |
|
|
|
trainPlanReject.style.display = 'block'; |
|
|
|
trainPlanCheck.style.display = 'none'; |
|
|
|
} else { |
|
|
|
trainPlanReject.style.display = 'none'; |
|
|
|
trainPlanCheck.style.display = 'block'; |
|
|
|
} |
|
|
|
} else { |
|
|
|
console.log('msg: ', msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 取消 |
|
|
|