You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
3.9 KiB

$(function () {
var visitType = window.parent.frames.getUrlParam('visitType');
$("#download").click(function () {
window.open($image.cropper("getDataURL"));
});
$("#zoomIn").click(function () {
$image.cropper("zoom", 0.1);
});
$("#zoomOut").click(function () {
$image.cropper("zoom", -0.1);
});
$("#rotateLeft").click(function () {
$image.cropper("rotate", 45);
});
$("#rotateRight").click(function () {
$image.cropper("rotate", -45);
});
$("#setDrag").click(function () {
$image.cropper("setDragMode", "crop");
});
// $("#sYear").chosen({
// no_results_text: "没有找到",
// allow_single_deselect: false,
// disable_search: true
// });
SetMonth($("#sYear").val());
$("#sYear").change(function () {
SetMonth($("#sYear").val());
});
})
var currentYear, currentMonth;
//获取url中的参数
function getUrlParam(key) {
var search = location.search.slice(1); //得到get方式提交的查询字符串
var arr = search.split("&");
for (var i = 0; i < arr.length; i++) {
var ar = arr[i].split("=");
if (ar[0] == key) {
if (unescape(ar[1]) == 'undefined') {
return "";
} else {
return unescape(ar[1]);
}
}
}
return "";
}
$(".btn-group .btn").click(function () {
$(this).addClass("active").siblings(".btn").removeClass("")
})
function msg(a, b) {
layer.msg(a, { shift: 0, time: 1500 }, function () {
b();
})
}
function SetMonth(year) {
$("#sMonth").empty();
$("#sMonth").append("<option value='0' hassubinfo='true'>所有月份</option>");
for (var i = 0; i < 12; i++) {
if (year == currentYear && i >= currentMonth) {
break;
}
$("#sMonth").append("<option value='" + (i + 1) + "' hassubinfo='true'>" + (i + 1) + "月</option>");
}
// $("#sMonth").trigger("chosen:updated")
// $("#sMonth").chosen({
// no_results_text: "没有找到",
// allow_single_deselect: false,
// disable_search: true
// });
}
//条码扫描仪前端驱动
//条码扫描仪按键处理函数
function barCode_Proc(e) {
var keyChar = String.fromCharCode(e.which);
if (keyChar == "\r") {
var scaner_buffer = $(this).data("barcode-scaner-buffer");
$(this).data("barcode-scaner-buffer", "");
var realVal = ''
if(scaner_buffer.split('').length>=8){
var rfidStr = scaner_buffer
for (let index = 0; index < parseInt((rfidStr.split('').length) / 2); index++) {
realVal = rfidStr.substr(index * 2, 2) + realVal
}
}else{
realVal=scaner_buffer
}
e.data.proc(realVal);
}
else {
var scaner_buffer = $(this).data("barcode-scaner-buffer");
if (scaner_buffer == undefined) {
scaner_buffer = "";
}
scaner_buffer += keyChar;
$(this).data("barcode-scaner-buffer", scaner_buffer);
}
}
//条码扫描仪jQuery拓展方法
jQuery.fn.extend({
barCodeScanerModeEnter: function (findBarCode_Event) {
$(this).data("barcode-scaner-buffer", "");
$(this).off("keypress", barCode_Proc);
$(this).on("keypress", { proc: findBarCode_Event }, barCode_Proc);
},
barCodeScanerModeExit: function () {
$(this).data("barcode-scaner-buffer", "");
$(this).off("keypress", barCode_Proc);
}
});
function uuid() {
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[8] = s[13] = s[18] = s[23] = "-";
var uuid = s.join("");
return uuid;
}