YNICTE/BO/Views/croom/examdatareg.cshtml

144 lines
6.1 KiB
Plaintext
Raw Normal View History

2020-10-12 14:39:23 +09:00
@model NP.Model.VMCM
@{
Layout = "~/Views/Shared/_PopupLayout.cshtml";
}
<form id="mform" method="post" enctype="multipart/form-data" class="form-horizontal">
<section class="panel panel-default" style="border-top: 1px solid #ddd; margin-top: 5px;">
<header class="panel-heading"><strong><i class="fa fa-bars"></i> 엑셀일괄등록 (시스템에 등록된 회원만 추가 가능합니다)<span class=""></span></strong></header>
<div class="panel-body">
<div class="form-group">
<label class="col-sm-4 col-md-2 control-label">첨부파일</label>
<div class="col-sm-8 col-md-10">
<input id="uploadfile" type="file" /><br />
<a href="~/Content/file/EXAMDATA.xlsx" class="btn btn-info">양식다운로드</a>
<a href="#" class="btn btn-primary" onclick="checkfile();">파일검증</a>
</div>
</div>
<div class="text-right">
<a href="#" class="btn btn-danger" onclick="delall();">불량DATA 일괄삭제</a>
<a href="#" class="btn btn-primary" onclick="save2();">등록</a>
<a href="#" class="btn btn-default" onclick="self.close();">닫기</a>
</div>
</div>
<div class="table-responsive" id="excel2">
<table class="table table-striped b-t b-light">
<thead>
<tr>
<th width="20">No</th>
<th>이름</th>
<th>ID</th>
<th>컴플라이언스경영</th>
<th>사회적책임경영</th>
<th>리스트관리경영</th>
<th>합격여부</th>
<th>검증결과</th>
<th>삭제</th>
</tr>
</thead>
<tbody class="data" id="tbody2"></tbody>
</table>
</div>
</section>
</form>
<div class="botfixempty">&nbsp;</div>
<div class="botfix islayer">
<a href="#" class="btn btn-default" onclick="self.close();">닫기</a>
</div>
@section scriptsHeader{
<style type="text/css">
#layertable td {
padding: 2px 4px;
}
tbody th.cm {
padding: 0 10px;
}
tr.error {
color: red;
}
</style>
}
@section scripts{
<script>
$(document).ready(function () {
$("#uploadfile").on("change", function () {
if ($(this).val() != "") {
$("#tbody2 tr").remove();
}
});
$("body").on("click", "#tbody2 tr td a.btn-danger", function () {
if (confirm("삭제하시겠습니까?")) {
$(this).closest("tr").remove();
}
});
});
function checkfile() {
if ($("#uploadfile").val() == "") {
msg2("파일을 선택해주세요.");
}
else {
var thumbext = $("#uploadfile").val();
thumbext = thumbext.slice(thumbext.indexOf(".") + 1).toLowerCase();
if ("xlsx".indexOf(thumbext) < 0) {
msg("xlsx 확장자만 가능합니다.", 0, true);
}
$("#tbody2 tr").remove();
//else if (confirm("파일을 검증하시겠습니까?")) {
var formData = new FormData();
formData.append("uploadfile", $("#uploadfile")[0].files[0]);
formData.append("uploadjob", "examuserbatch");
formData.append("intval",@Model.Exam.exno);
capfile("/acommon/uploadexcel", formData, "cbcheckfile", true, false, true, true);
//}
}
}
function cbcheckfile() {
if (capResult.code != 1000) {
msg2(capResult.msg);
}
else {
$.each(capResult.obj, function (i, d) {
$("#tbody2").append("<tr data-val=\"" + @Model.Exam.exno + ":" + getdb(d.userno) + ":" + getdb(d.epoint1) + ":" + getdb(d.epoint2) + ":" + getdb(d.epoint3) + ":" + d.ispass + "\" class=\"" + (d.value == "정상" ? "data" : "error") + "\">" +
"<td>" + d.rno + "</td>" +
"<td>" + getdb(d.username) + "</td>" +
"<td>" + getdb(d.userid) + "</td>" +
"<td>" + getdb(d.epoint21) + "</td>" +
"<td>" + getdb(d.epoint22) + "</td>" +
"<td>" + getdb(d.epoint23) + "</td>" +
"<td>" + d.ispass2 + "</td>" +
"<td>" + getdb(d.value) + "<td class=\"link text-center\"><a href=\"#\" class=\"btn-xxs btn btn-danger\">X</a></td></tr>");
});
}
}
function delall() {
if (confirm("불량DATA를 일괄삭제하시겠습니까?")) {
$("#tbody2 tr.error").remove();
}
}
function save2() {
if ($("#tbody2 tr.error").length > 0) {
msg("불량DATA가 있어 등록할 수 없습니다.");
}
else if ($("#tbody2 tr.data").length < 1) {
msg("등록할 데이터가 없습니다.");
}
else if (confirm("시험 응시결과를 일괄 등록하시겠습니까?")) {
var d = "";
$.each($("#tbody2 tr.data"), function (i, r) {
d += ";" + $(r).attr("data-val");
});
capp("/acommon/examuserbatch", { datas: d.substr(1) , intval : @Model.Exam.exno }, "cbsave2");
}
}
function cbsave2() {
if (capResult.code == 1000) {
msg2("저장되었습니다.", 0, null, "self.close();");
opener.parent.gotab(2);
}
else {
msgdev();
}
}
</script>
}