Browse Source

红头文件审核

ts-red-header-file-review
xuesinan 4 years ago
parent
commit
b64510c479
  1. 205
      index.html

205
index.html

@ -44,87 +44,68 @@
<div data-tname="考勤" data-pid="1433332016270811136" data-uid="1217647686598135808" data-rid="rid333" data-tid="tid444" data-did="did555" style="height:5.375rem;width:100%">
<div data-root="p1449944565028233216" style="height:100%;width:100%;">
<div class="train-plan-check" style="display: none;">
<div class="title"></div>
<div class="flex justify-between">
<div class="text-sm">培训计划审核</div>
<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="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">
<div style="height: 13rem;overflow-y: auto;">
<p class="mt-8 text-center">驳回原因</p>
<div class="pl-6 pr-6">
<div class="mt-8 border-b pt-2 pb-2">
<input type="text" class="border-none outline-none reason" style="width: 100%;" placeholder="请输入驳回原因">
</div>
</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(2)">提交</div>
</div>
</div>
</div>
<div class="certificate-box mt-3 px-2 py-1.5 flex justify-between w-full border border-gray-200 rounded-sm text-sm">
<p class="w-20 flex-shrink-0 text-gray-400">红头文件</p>
<div class="certificate py-1 flex justify-end" style="max-width: 100px; max-height: 100px;">
<img style="max-width: 100%; max-height: 100%;" onclick="p1449944565028233216.bigImg()" src="http://test.tall.wiki/staticrec/plan.png" />
</div>
</div>
<div class="train-plan-reject" style="display: none;">
<div class="title"></div>
<div class="flex justify-between">
<div class="text-sm">培训计划审核</div>
<div class="text-sm">
<span class="text-red-500 reject-text">已驳回</span>
</div>
</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>
<div>
这里是驳回原因这里是驳回原因这里是驳回原因这里是驳回原因
</div>
</div>
<div class="img-preview fixed z-10 inset-0 bg-black bg-opacity-60 p-4 flex justify-center items-center" style="display: none;">
<img id="img" src="http://test.tall.wiki/staticrec/plan.png" />
</div>
<div class="reason-box mt-2.5 px-2 py-1.5 flex justify-between items-center w-full border border-gray-200 rounded-sm text-sm" style="display: none;">
<p class="w-20 flex-shrink-0 text-gray-400">驳回原因</p></p>
<div class="reason-content"></div>
</div>
<div class="btn-group mt-4 flex justify-between items-center w-full text-sm">
<button class="border border-blue-500 text-blue-500 rounded-sm" style="width: 45%; height: 34px;" onclick="p1449944565028233216.showReject()">驳回</button>
<button class="border border-blue-500 bg-blue-500 text-white rounded-sm" style="width: 45%; height: 34px;" onclick="p1449944565028233216.submit(1)">通过</button>
</div>
<div class="train-plan-hide">
<div class="title"></div>
<div class="flex justify-between">
<div class="text-sm">培训计划审核</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">
<div style="height: 13rem;overflow-y: auto;">
<p class="mt-8 text-center">驳回原因</p>
<div class="pl-6 pr-6">
<div class="mt-8 border-b pt-2 pb-2">
<input type="text" class="border-none outline-none reason" style="width: 100%;" placeholder="请输入驳回原因">
</div>
</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(2)">提交</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
document.querySelector('.img-preview').onclick = function(e){
e = window.event || e;
let parentApp = document.getElementById('img');
if(!parentApp.contains(e.target)){
document.querySelector('.img-preview').style.display = 'none';
}
}
var p1449944565028233216 = {
token: '',
projectId: '',
roleId: '',
dom: '',
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
// 获取父元素携带的参数
@ -174,48 +155,13 @@
.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;
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);
}
});
},
// 查看红头文件
checkFile(){
const pId = this.dom.parentNode.getAttribute('data-pid');
const uId = this.dom.parentNode.getAttribute('data-uid');
const rId = this.dom.parentNode.getAttribute('data-rid');
location.href=`https://test.tall.wiki/ts/file?pid=${pId}&uid=${uId}&rid=${rId}`
},
// 驳回弹框
showReject(){
var statusChoose = this.dom.querySelector('.statusChoose');
@ -233,46 +179,53 @@
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);
}
});
that.dom.querySelector('.btn-group').style.display = 'none';
if (type == 2) {
that.dom.querySelector('.reason-box').style.display = 'flex';
that.dom.querySelector('.reason-content').innerHTML = reason;
}
// 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) {
// that.dom.querySelector('.btn-group').style.display = 'none';
// if (type == 2) {
// that.dom.querySelector('.reason-box').style.display = 'flex';
// that.dom.querySelector('.reason-content').innerHTML = reason;
// }
// } else {
// console.log('msg: ', msg);
// }
// });
},
// 取消
hide(){
var statusChoose = this.dom.querySelector('.statusChoose');
statusChoose.style.display='none';
}
},
// 预览
bigImg() {
document.querySelector('.img-preview').style.display = 'flex';
},
}
p1449944565028233216.init()
</script>

Loading…
Cancel
Save