| ¶Ô±ÈÐÂÎļþ |
| | |
| | | var layer; |
| | | var form; |
| | | var snapData;//ç»è®°ç
§ç |
| | | |
| | | $(function () { |
| | | layui.use(['layer', 'form'], function () { |
| | | layer = layui.layer; |
| | | form = layui.form; |
| | | |
| | | // çå¬ç±»åéæ© |
| | | form.on('select(select_type)', function (obj) { |
| | | return changeProgress(); |
| | | }); |
| | | }); |
| | | |
| | | initData(); |
| | | |
| | | var rightH = $(".rkbk-left-wrap").height(); |
| | | $(".rkbk-right-wrap").height(rightH); |
| | | |
| | | $(window).resize(function () { |
| | | var rightH = $(".rkbk-left-wrap").height(); |
| | | $(".rkbk-right-wrap").height(rightH); |
| | | }); |
| | | |
| | | }); |
| | | |
| | | window.onload = function () { |
| | | // å è½½è§é¢ |
| | | initVideo(lprDto, null, null); |
| | | }; |
| | | |
| | | |
| | | |
| | | function initData() { |
| | | if (type) { |
| | | $("#type").val(type); |
| | | var actualVal = $("#type").val(); |
| | | console.log("èµå¼åå®é
éä¸å¼ï¼", actualVal); |
| | | console.log("æ¯å¦ä¸ç®æ å¼ä¸è´ï¼", actualVal === type); |
| | | } |
| | | |
| | | showProgress(); |
| | | } |
| | | |
| | | /** |
| | | * æ§å¶æµç¨ç¯èæ¾ç¤º |
| | | */ |
| | | function showProgress() { |
| | | if (!inoutProgress) { |
| | | return; |
| | | } |
| | | if (inoutProgress.indexOf("REGISTER") === -1) { |
| | | $("#rk-progress-register").css("display", "none"); |
| | | $("#ck-progress-register").css("display", "none"); |
| | | } |
| | | if (inoutProgress.indexOf("WEIGHT_FULL") === -1) { |
| | | $("#rk-progress-fullWeight").css("display", "none"); |
| | | $("#ck-progress-fullWeight").css("display", "none"); |
| | | } |
| | | if (inoutProgress.indexOf("HANDLE") === -1) { |
| | | $("#rk-progress-hand").css("display", "none"); |
| | | $("#ck-progress-hand").css("display", "none"); |
| | | } |
| | | if (inoutProgress.indexOf("WEIGHT_EMPTY") === -1) { |
| | | $("#rk-progress-emptyWeight").css("display", "none"); |
| | | $("#ck-progress-emptyWeight").css("display", "none"); |
| | | } |
| | | if (inoutProgress.indexOf("CARD_BACK") === -1) { |
| | | $("#rk-progress-cardBack").css("display", "none"); |
| | | $("#ck-progress-cardBack").css("display", "none"); |
| | | } |
| | | |
| | | if (type === "IN") { |
| | | $("#rk_progress").css("display", "block"); |
| | | $("#ck_progress").css("display", "none"); |
| | | } |
| | | if (type === "OUT") { |
| | | $("#ck_progress").css("display", "block"); |
| | | $("#rk_progress").css("display", "none"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 忢æµç¨ |
| | | * @param obj |
| | | */ |
| | | function changeProgress() { |
| | | type = $("#type").val(); |
| | | showProgress(); |
| | | } |
| | | |
| | | /** |
| | | * 读åèº«ä»½è¯ |
| | | */ |
| | | function flushIdCard() { |
| | | var index = layer.load(); |
| | | $.ajax({ |
| | | type: "GET", |
| | | async: true, |
| | | url: "http://127.0.0.1:9111/IDCARD", |
| | | data: {}, |
| | | dataType: "json", |
| | | success: function (json) { |
| | | layer.close(index); |
| | | var data = json; |
| | | if (data.code === "200" || data.code == 200) { |
| | | // 临æ¶èµå¼ |
| | | $("#userName").val(data.cnName); |
| | | $("#userAddress").val(data.address); |
| | | $("#userId").val(data.idNum); |
| | | if (data.Image) { |
| | | $("#id_img_pers").attr("src", data.Image); |
| | | } |
| | | }else{ |
| | | alertError("没æè·åå°èº«ä»½è¯ä¿¡æ¯ï¼"); |
| | | return; |
| | | } |
| | | }, |
| | | error: function () { |
| | | layer.alert("身份è¯è¯»å失败ï¼", { |
| | | offset: ['300px', '300px'] |
| | | }); |
| | | layer.close(index); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 读å车çå· |
| | | */ |
| | | function flushPlateNum() { |
| | | var param = JSON.stringify(lprDto); |
| | | var index = layer.load(); |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "/inout/api/get-plateNum", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: param, |
| | | success: function (result) { |
| | | if (result.code != "0000") { |
| | | alertError(result.msg); |
| | | } else { |
| | | $("#plateNum").val(result.data.plateNum); |
| | | } |
| | | layer.close(index); |
| | | }, |
| | | error: function () { |
| | | layer.close(index); |
| | | alertError("车çè¯å«å¤±è´¥ï¼"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * é置表å |
| | | */ |
| | | function resetForm() { |
| | | $("#form-data")[0].reset(); |
| | | form.render(); |
| | | // 身份è¯éç½® |
| | | $("#id_img_pers").attr("src", "/img/web/inout/rkbk-photo_03.png"); |
| | | $("#pz-img").removeClass("kccz-r-img-red"); |
| | | $("#pz-text").text("èªå¨ææ"); |
| | | } |
| | | |
| | | /** |
| | | * 宿æäº¤æå¾ |
| | | */ |
| | | function submit() { |
| | | var data = form.val("form-data"); |
| | | if (!data.type) { |
| | | alertError("åºå
¥åºç±»åä¸è½ä¸ºç©º"); |
| | | return; |
| | | } |
| | | if (!data.plateNum) { |
| | | alertError("车çå·ä¸è½ä¸ºç©º"); |
| | | return; |
| | | } |
| | | if (!data.userName) { |
| | | alertError("æ¿è¿äººå§åä¸è½ä¸ºç©º"); |
| | | return; |
| | | } |
| | | |
| | | //ç³»ç»ææ |
| | | layer.msg("ç³»ç»èªå¨ææè®°å½â¦â¦"); |
| | | snapData = { |
| | | companyId: companyId, |
| | | deptId: deptId, |
| | | progress: progress, |
| | | bizType: type, |
| | | plateNum: data.plateNum, |
| | | id1: (null != lprDto) ? lprDto.id : null, |
| | | id2: (null != lprDto) ? lprDto.id : null, |
| | | }; |
| | | $.ajax({ |
| | | sync: false, |
| | | type: "POST", |
| | | url: "../../inout/api/snap-img", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify(snapData), |
| | | success: function (result) { |
| | | if (result.code != "0000") { |
| | | layer.alert(result.msg); |
| | | submitData(data); |
| | | } else { |
| | | snapData = result.data; |
| | | |
| | | $("#pz-img").addClass("kccz-r-img-red"); |
| | | $("#pz-text").text("å·²æç
§"); |
| | | |
| | | submitData(data); |
| | | } |
| | | }, |
| | | error: function () { |
| | | layer.msg("åå°è°ç¨æªå¾å¤±è´¥ï¼è¯·éæ°å°è¯ï¼ï¼"); |
| | | submitData(data); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * æäº¤æ°æ® |
| | | * @param data |
| | | */ |
| | | function submitData(data) { |
| | | var index = layer.load(); |
| | | |
| | | var files = [{ |
| | | fileName: snapData.fileName1 |
| | | },{ |
| | | fileName: snapData.fileName2 |
| | | }]; |
| | | data.files = files; |
| | | |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "../../basic/inout/submit-register", |
| | | dataType: "json", |
| | | contentType: "application/json;charset=UTF-8", |
| | | data: JSON.stringify(data), |
| | | success: function (result) { |
| | | layer.close(index); |
| | | if (result.code != "0000") { |
| | | notify(result.msg, result.data); |
| | | } else { |
| | | notify("æ°æ®æäº¤æå", result.data); |
| | | // éç½®é¡µé¢ |
| | | resetForm(); |
| | | } |
| | | }, |
| | | error: function () { |
| | | layer.close(index); |
| | | layer.alert("æäº¤å¤±è´¥ï¼è¯·éæ°å°è¯ï¼ï¼"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * å¼¹åºæéæ¡ |
| | | * @param msg æéä¿¡æ¯ |
| | | * @param data æ°æ®ä¿¡æ¯ï¼å¯è½ä¸ºç©º |
| | | */ |
| | | function notify(msg, data) { |
| | | if (data) { |
| | | //èµå¼ |
| | | $("#resultMsg").text(msg); |
| | | $("#resultUserName").text(data.userName); |
| | | $("#resultPlateNum").text(data.plateNum); |
| | | if ("IN" == data.type) { |
| | | $("#resultType").text("å
¥åº-" + INOUT_PROGRESS_MSG(data.progress)); |
| | | } else { |
| | | $("#resultType").text("åºåº-" + INOUT_PROGRESS_MSG(data.progress)); |
| | | } |
| | | $("#resultIntelCard").text(data.intelCard); |
| | | |
| | | layer.open({ |
| | | type: 1, |
| | | offset: ['150px', '200px'], |
| | | area: '450px;', |
| | | shade: 0.8, |
| | | id: 'dialog_notify_info', |
| | | btn: ['ç¡®å®'], |
| | | content: $('#dialog-from-notify'), |
| | | yes: function (index) { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } else { |
| | | layer.alert(msg, {offset: ['300px', '300px']}); |
| | | } |
| | | } |