| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006 |
- function initCheck() {
- addBreadMenu("/view/mytask/check.html", "视频稽查");
- $('#ex1').slider({ tooltip: 'hide' });
- $("#ex1").on("slideStop", function(slideEvt) {
- setVideoProcess(slideEvt.value);
- });
- $("#ex1").on("change", function(sender) {
- var width = $("#ex1").siblings(".slider").children(".slider-track").children(".slider-selection").width();
- var total_width = $("#ex1").siblings(".slider").children(".slider-track").width();
- var sp_width = $("#ex1_span").width();
- var left = ((total_width - width) < (sp_width / 2.0)) ? (total_width - sp_width / 2.0 - 25) : (width - sp_width / 2.0) + 25
- $("#ex1_span").css("left", ((left > 25 ? left : 25)) + "px")
- if ($.checkTask) {
- var time = moment($.checkTask.start_time);
- var c_time = time.add(sender.value.newValue, "s");
- $("#ex1_span").html(c_time.format("YYYY-MM-DD HH:mm:ss"))
- }
- });
- $("#tabcontent").css("height", ($("#video_content").height() - 80) + "px");
- if (ISCLIENT) {
- event = document.createEvent('MessageEvent');
- var origin = window.location.protocol + '//' + window.location.host;
- event.initMessageEvent('setvideoposition', true, true, getVideoPosition(null), origin, 1234, window, null);
- document.dispatchEvent(event);
- }
- // 仅选择日期
- $("#start-time").datetimepicker({
- language: "zh-CN",
- weekStart: 1,
- todayBtn: 1,
- autoclose: 1,
- todayHighlight: 1,
- startView: 2,
- minView: 2,
- forceParse: 0,
- format: "yyyy-mm-dd"
- });
- // 仅选择日期
- $("#end-time").datetimepicker({
- language: "zh-CN",
- weekStart: 1,
- todayBtn: 1,
- autoclose: 1,
- todayHighlight: 1,
- startView: 2,
- minView: 2,
- forceParse: 0,
- format: "yyyy-mm-dd"
- });
- if ($.checkTask) {
- getUserCheckCount();
- initCheckAppealBtns();
- setFeSelect("#fsList", $.checkTask.checked_dept);
- $("#ex1_span").html($.checkTask.start_time)
- $("#full_ex1_span").html($.checkTask.start_time)
- $("#lane").val($.checkTask.checked_location);
- $("#check_time").val($.checkTask.check_period);
- // setLaneSelect("#lane", $.checkTask.checked_location);
- get_common_service('user/getUserById/' + $.checkTask.checked_person, null, function(data) {
- changePersonContent(data);
- })
- //查询评分情况
- queryCheckScores();
- //查询录像播放列表
- var videos = $.checkTask.video_id.split(',');
- if (videos[0]) {
- curVideo = videos[0];
- queryVideoList();
- } else {
- callFunc("showvideoview", "false");
- layer.msg('该处暂无视屏!', {
- offset: 'r',
- time: 2000, //20s后自动关闭
- });
- callFunc("stop", "");
- }
- }
- $("select#video_list").change(function() {
- playVideo($(this).val());
- });
- }
- function setfastorslow(type, speed) {
- if (type == 0) {
- $("#fast_info").html("");
- $("#slow_info").html("");
- if ($("#full_fast_info")) {
- $("#full_fast_info").html("");
- $("#full_slow_info").html("");
- }
- }
- if (type == 1) {
- $("#fast_info").html(speed + "x");
- $("#slow_info").html("");
- if ($("#full_fast_info")) {
- $("#full_fast_info").html(speed + "x");
- $("#full_slow_info").html("");
- }
- }
- if (type == 2) {
- $("#slow_info").html(speed + "x");
- $("#fast_info").html("");
- if ($("#full_fast_info")) {
- $("#full_fast_info").html("");
- $("#full_slow_info").html(speed + "x");
- }
- }
- }
- function normalscreen() {
- if (layer_full) {
- layer.close(layer_full)
- }
- }
- var layer_full = null;
- function fullscreen() {
- var height = window.innerWidth * 0.8 * 1 / 2.0 + 110
- var contenthtml = ' <div class="tab-content" id="full_tabcontent" style="height:400px;text-align: center;background:black;">' +
- ' <p style="padding-top:180px;font-size:20px">加载中...</p>' +
- ' <!--<i class="icon icon-spin icon-spinner icon-5x" style="margin-top:100px"></i>-->' +
- ' </div>' +
- ' <div class="row" class="col-md-12" style="padding:5px 10px 25px 10px;text-align:center;margin:0px">' +
- ' <input id="full_ex1" class="col-md-12" type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="0"/>' +
- ' <span id="full_ex1_span" style="position: absolute;left: 25px;">2017-06-12 23:00:00</span>' +
- ' ' +
- ' </div>' +
- ' <div class="row" style="padding:0px 5px 0px 5px;text-align:center;margin:0px">' +
- ' <select class="form-control" id="full_video_list" style="width:200px;float:left;display:none;"></select>' +
- ' <div class="col-md-4 " style="padding-left:0">' +
- ' <div class="input-group" style="padding-left:0">' +
- ' <input type="text" id="full_video_pos" style="height:42px" class="form-control" placeholder="时间偏移值">' +
- ' <span class="input-group-btn">' +
- ' <button class="btn btn-default" onclick="setVideoPos()" style="height:42px" type="button">校正</button>' +
- ' </span>' +
- ' </div>' +
- ' </div>' +
- ' <div class="btn-group" style="float:right;">' +
- ' <button type="button" class="btn btn-info" onclick="doAction(\'start\')"><i class="icon icon-play-circle icon-2x"></i></button>' +
- ' <button type="button" class="btn btn-info" onclick="doAction(\'stop\')"><i class="icon icon-pause icon-2x"></i></button>' +
- ' <button type="button" class="btn btn-info" onclick="doAction(\'fast\')"><i class="icon icon-forward icon-2x"></i><span id=\"full_fast_info\"></span></button>' +
- ' <button type="button" class="btn btn-info" onclick="doAction(\'slow\')"><span id=\"full_slow_info\"></span><i class="icon icon-backward icon-2x"></i></button>' +
- ' <button type="button" class="btn btn-danger " style="width:51px;height:42px" id="full_video_btn_start" onclick="doAction(\'video_start\')"><img style="width:30px" src="/images/movie.png"></img></i></button>' +
- ' <button type="button" class="btn btn-danger hidden" style="width:51px;height:42px" id="full_video_btn_stop" onclick="doAction(\'video_stop\')"><i class="icon icon-stop icon-2x"></i></button>' +
- ' <button type="button" class="btn btn-success" onclick="doAction(\'screenshot\')"><i class="icon icon-camera icon-2x"></i></button>' +
- ' </div>' +
- ' </div>';
- layer_full = layer.open({
- area: ['80%', height + "px"],
- type: 1,
- title: false,
- anim: -1,
- closeBtn: 0,
- shadeClose: false,
- content: "<div id='layer_content' style='padding-bottom:10px' >" + contenthtml + "</div>",
- success: function(layero, index) {
- // slider_current_value = 90;
- $("#full_video_pos").val($("#video_pos").val());
- $('#full_ex1').slider({ tooltip: 'hide' });
- $("#full_ex1").on("slideStop", function(slideEvt) {
- setVideoProcess(slideEvt.value);
- });
- $("#full_ex1").on("change", function(sender) {
- var width = $("#full_ex1").siblings(".slider").children(".slider-track").children(".slider-selection").width();
- var total_width = $("#full_ex1").siblings(".slider").children(".slider-track").width();
- var sp_width = $("#full_ex1_span").width();
- var left = ((total_width - width) < (sp_width / 2.0)) ? (total_width - sp_width + 10) : (width - sp_width / 2.0) + 10
- $("#full_ex1_span").css("left", ((left > 0 ? left : 10)) + "px")
- if ($.checkTask) {
- var time = moment($.checkTask.start_time);
- var c_time = time.add(sender.value.newValue, "s");
- $("#full_ex1_span").html(c_time.format("YYYY-MM-DD HH:mm:ss"))
- }
- });
- $("#full_ex1").slider({ step: 5, min: 0, max: maxVV });
- $("#full_ex1").slider('setValue', slider_current_value);
- $("#full_fast_info").html($("#fast_info").html());
- $("#full_slow_info").html($("#slow_info").html());
- $("#full_tabcontent").css("height", (height - 110) + "px");
- $("#full_tabcontent").css("width", "100%");
- setTimeout(function() {
- callFunc("setvideoposition", getVideoPosition($("#full_tabcontent")))
- }, 800)
- }
- });
- }
- function getUserCheckCount() {
- var param = {
- "id": $.checkTask.id,
- "checked_person": $.checkTask.checked_person
- };
- post_common_service("/task/getUserCount/", param, function(userList) {
- if (userList) {
- $("#checked_count").html(userList.length);
- } else {
- $("#checked_count").html(0);
- }
- });
- }
- function checkUserCount() {
- var param = {
- "id": $.checkTask.id,
- "checked_person": $.checkTask.checked_person,
- "class_type": $.checkTask.class_type
- };
- post_common_service("/task/getUserCount/", param, function(data) {
- if (data >= 2) {
- layer.msg("本周期稽查次数已满,不能再被稽查!", {
- offset: 'r',
- time: 2000 //20s后自动关闭
- });
- return false;
- }
- return true;
- });
- }
- function showCheckDetailCount() {
- scoreDetailLayer = showPopup4Common('本周已考核任务', null, ['450px', '350px'], '#checked_task_list_div', 'r');
- var param = {
- "period_id": $.checkTask.period_id,
- "checked_person": $.checkTask.checked_person,
- "status_search_type": 1
- };
- var cols = [
- { width: 40, text: '序号', type: 'number', flex: true, colClass: 'text-center', field: 'num' },
- { width: 80, text: '任务名称', type: 'string', flex: true, sort: 'down', field: 'name' },
- { width: 50, text: '考核人员', type: 'string', flex: true, colClass: '', field: 'checked_person_name' },
- { width: 80, text: '扣分情况', type: 'string', flex: true, sort: 'down', field: 'score_details' },
- { width: 70, text: '稽查时间段', type: 'string', flex: true, sort: 'down', field: 'check_period' }
- ];
- $('#checked_user_task_datatable').mytable({
- 'cols': cols,
- 'url': "/task/getUserCheckedTaskByPage/",
- 'param': param,
- 'isShoWPager': false
- });
- }
- function initCheckAppealBtns() {
- if ($.checkTask.appeal) {
- $("#btn_appeal_task").show();
- $("#btn_task").hide();
- // $("#appeal_div").show();
- $("#appeal_time").html($.checkTask.appeal.appeal_time);
- $("#appeal_reason").html($.checkTask.appeal.appeal_reason);
- $("#appeal_file_list").html(genAppeaFiles($.checkTask.appeal.file_src));
- $("#recheck_result").html($.checkTask.appeal.recheck_result);
- showAppealLayer();
- } else {
- // $("#appeal_div").hide();
- $("#btn_appeal_task").hide();
- $("#btn_task").show();
- }
- }
- function showAppealLayer() {
- layer.open({
- type: 1,
- title: "申诉详情",
- closeBtn: 1,
- shade: false,
- maxmin: false,
- shadeClose: true,
- offset: 'rb',
- content: $('#appeal_div'), //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
- cancel: function(index) {
- layer.close(index);
- layer.open({
- type: 1,
- title: "",
- closeBtn: 0,
- shade: false,
- maxmin: false,
- shadeClose: true,
- content: $('#hide_div'),
- offset: 'rb',
- btn: ['申诉详情'],
- yes: function(index) {
- layer.close(index);
- showAppealLayer();
- }
- });
- return false;
- }
- });
- }
- // 使用data参数更新数据:
- function queryCheckScores() {
- //$('#score_datatable').score_datatable("");
- console.log("任务id:" + $.checkTask.id);
- var data = {
- "task_id": $.checkTask.id
- }
- // alert("ff");
- var cols = [
- { width: 40, text: '序号', type: 'number', flex: true, colClass: 'text-center', field: 'num' },
- { width: 160, text: '评分记录', type: 'string', flex: true, sort: 'down', field: 'content' },
- { width: 50, text: '分数', type: 'string', flex: true, colClass: '', field: 'check_item_score' },
- { width: 100, text: '备注', type: 'string', flex: true, colClass: '', field: 'remark' },
- { width: 55, text: '考核人', type: 'string', flex: true, colClass: '', field: 'checked_person_name' },
- // {width: 80, text: '图片', type: 'imagedd', flex: true, colClass: '',field: 'pics'},
- {
- width: 110,
- text: '操作',
- type: 'string',
- flex: true,
- field: 'id',
- oper: [
- { func: 'showEditCheckScore', text: '修改', icon_class: 'icon-edit' },
- { func: 'showEditPic', text: '修改图片', icon_class: 'icon-edit' },
- { func: 'deleteCheckScore', text: '删除', icon_class: 'icon-remove-circle' }
- ]
- }
- ];
- // var pager = {
- // page_size:10
- // }
- $('#score_datatable').mytable({
- 'cols': cols,
- 'url': "/score/getScoreList/",
- 'param': data
- });
- }
- function showEditPic(id) {
- var rowData = getItemByIdFromArr(id, $('#score_datatable').mytable('getTableData'));
- showPics(rowData.pics);
- $("#saveEditBtn").show();
- editScoreId = id;
- }
- function showEditCheckScore(id) {
- // deleteItem4Common(id,"/score/delete/",queryCheckScores);
- var rowData = getItemByIdFromArr(id, $('#score_datatable').mytable('getTableData'));
- scoreDetailLayer = showPopup4Common('修改考核项', function(data) {
- saveScoreEdit();
- }, ['350px', '550px'], '#score-detail-div', 'r');
- $("#score_id_text").val(rowData.id);
- $("#check_item_text").val(rowData.content);
- $("#check_score_text").val(rowData.check_item_score);
- setFeeUserSelect("#check_checked_person_select", rowData.checked_person);
- // $("#check_checked_person_select").val(rowData.checked_person);
- $("#check_remark_text").tagsInput({ 'defaultText': '添加备注', 'width': '240px' });
- $("#check_remark_text").addTag(rowData.remark);
- getTags("/score/getTopRemark", '#score_remark_div', '#check_remark_text', 'remark');
- }
- function setFeeUserSelect(div, selectId) {
- var param = {
- 'organid': $.checkTask.checked_dept
- };
- post_common_service("/user/getUserList/", param, function(userList) {
- // setFeeUserSelect("#check_checked_person_select",rowData.checked_person,data);
- var optStr = '';
- for (var i in userList) {
- if (userList[i].id == selectId)
- optStr += '<option value="' + userList[i].id + '" selected="selected">' + userList[i].truename + '</option>';
- else
- optStr += '<option value="' + userList[i].id + '">' + userList[i].truename + '</option>';
- }
- $(div).html('');
- $(div).html(optStr);
- $('#check_checked_person_select').chosen({
- // width:'200px',
- height: '100px',
- no_results_text: '没有找到', // 当检索时没有找到匹配项时显示的提示文本
- disable_search_threshold: 10, // 10 个以下的选择项则不显示检索框
- search_contains: true // 从任意位置开始检索
- });
- });
- }
- function saveScoreEdit() {
- var param = {
- 'id': $("#score_id_text").val(),
- 'content': $("#check_item_text").val(),
- 'check_item_score': $("#check_score_text").val(),
- 'remark': $("#check_remark_text").val(),
- 'checked_person': $("#check_checked_person_select").val(),
- };
- editScoreId = null;
- $("#saveEditBtn").hide();
- no_return_common_service("/score/update", param, function(data) {
- if (scoreLayer) layer.close(scoreLayer);
- //查询评分情况
- queryCheckScores();
- // layer.msg(data, {
- // time: 2000//20s后自动关闭
- // });
- });
- }
- var editScoreId;
- function saveEdit() {
- if (editScoreId) {
- var imgArr = $("#img_container .pic-class");
- var picsStr = "";
- if (imgArr && imgArr.length > 0) {
- for (var i = 0; i < imgArr.length; i++) {
- picsStr += imgArr[i].attr("path") + ","
- }
- picsStr = picsStr.substr(0, picsStr.length - 1);
- }
- var param = {
- 'id': editScoreId,
- 'pics': picsStr
- };
- editScoreId = null;
- $("#saveEditBtn").hide();
- no_return_common_service("/score/update", param, function(data) {
- if (scoreLayer) layer.close(scoreLayer);
- //查询评分情况
- queryCheckScores();
- layer.msg(data, {
- offset: 'r',
- time: 2000 //20s后自动关闭
- });
- });
- }
- }
- function deleteCheckScore(id) {
- deleteItem4Common(id, "/score/delete/", queryCheckScores, 'r');
- }
- function setVideoList(videos) {
- var videoArr;
- if (videos) {
- videoArr = videos.split("|");
- var selectStr = "";
- for (var i in videoArr) {
- if (i == 0)
- selectStr += '<option value="' + videoArr[i] + '" selected="selected">视频' + (videoArr[i] + 1) + '</option>'
- else
- selectStr += '<option value="' + videoArr[i] + '">视频' + (videoArr[i] + 1) + '</option>';
- }
- }
- $('#video_list').html(selectStr);
- }
- function addPic(pic) {
- if (pic) {
- var i = 0;
- // var imgArr = $("#img_container .pic-class");
- // if(imgArr && imgArr.length>0) i = imgArr.length;
- if (pic.startWith("http"))
- pic = pic.replace(base_image_server_url, "/");
- var picStr = genPicstr(pic);
- $('#img_container').append(picStr);
- $('a.lightbox-toggle').lightbox();
- }
- }
- function showPics(pics, divId) {
- var picStr = '';
- if (!divId) divId = '#img_container';
- $(divId).html(picStr);
- if (pics) {
- var picArr = pics.split(',');
- for (var i in picArr) {
- var pic = genPicstr(picArr[i]);
- picStr += pic;
- }
- $(divId).html(picStr);
- $('a.lightbox-toggle').lightbox();
- }
- }
- function genPicstr(imgSrc) {
- var src = imgSrc;
- if (!src.startWith("http"))
- src = base_image_server_url + src;
- var ispic = true;
- var videosrc = src;
- if (src.indexOf('.avi') != -1) {
- src = src.split('.avi')[0] + "_screen_0.png"
- ispic = false;
- }
- if (src.indexOf('.mov') != -1) {
- src = src.split('.mov')[0] + "_screen_0.png"
- ispic = false;
- }
- if (src.indexOf('.mp4') != -1) {
- src = src.split('.mp4')[0] + "_screen_0.png"
- ispic = false;
- }
- var pic = '<div class="img_item" style="width:100px;height:90px;float:left;">' +
- '<a href="javascript:void(0)" onclick="removeImg(this)" style="float:right;position:relative;z-index:100;"><span class="label label-danger"><i class="icon icon-remove-circle"></i> 删除</span></a>' +
- (ispic ? '<a class="card lightbox-toggle" data-group="image-group-1" data-lightbox-group="example-3" href="' + src + '" style="position:absolute">' : '<a class="card" onclick="video_paly(\'' + videosrc + '\')" href="javascript:void(0)" style="position:absolute">') +
- '<img class="pic-class img-thumbnail" path="' + imgSrc + '" style="width:100px;height:70px;" src="' + src + '" alt="">' + (ispic ? '' : '<i class="icon icon-play-circle" style=" font-size: 30px;position: absolute;top: 20px;left: 40px;color: white;"></i>') +
- '</a>' +
- '</div>';
- if (ISCLIENT) {
- pic = '<div class="img_item" style="width:100px;height:90px;float:left;">' +
- '<a href="javascript:void(0)" onclick="removeImg(this)" style="float:right;position:relative;z-index:100;"><span class="label label-danger"><i class="icon icon-remove-circle"></i> 删除</span></a>' +
- '<a class="card" onclick="' + (ispic ? 'showClientImg(\'' + src + '\')' : 'showClientVideo(\'' + videosrc + '\')') + '" href="javascript:void(0)" style="position:absolute">' +
- '<img class="pic-class img-thumbnail" path="' + imgSrc + '" style="width:100px;height:70px;" src="' + src + '" alt="">' + (ispic ? '' : '<i class="icon icon-play-circle" style=" font-size: 30px;position: absolute;top: 20px;left: 40px;color: white;"></i>') +
- '</a>' +
- '</div>';
- }
- return pic;
- }
- function removeImg(this1) {
- $(this1).parent('.img_item').remove();
- }
- function clearAllImg() {
- $('#img_container').empty();
- }
- var changePersonLayer;
- function showChangeUser() {
- var param = {
- 'organid': $.checkTask.checked_dept
- };
- post_common_service("/user/getUserList/", param, function(data) {
- changePersonLayer = showPopup4Common('更改人员', null, ['550px', '600px'], null, 'r');
- $("#user_container").empty();
- var userStr = "";
- for (var i in data) {
- var name = data[i].truename;
- if (data[i].workno) name = name + " " + data[i].workno.substr(data[i].workno.length - 3);
- var pic = "../../images/body-bg.png";
- if (data[i].pic) pic = base_image_server_url + data[i].pic;
- str = '<div style="width:90px;float:left;margin:5px;">' +
- '<a class="card" href="javascript:void(0)">' +
- '<img src="' + pic + '" alt="" style="height:100px;width:90px;" onclick="showBigImg(\'' + pic + '\')">' +
- '<div class="card-heading"><strong>' + name + '</strong></div>' +
- '<div class="card-actions">' +
- '<button type="button" class="btn btn-mini btn-danger" onclick="changePerson(\'' + data[i].id + '\')">选择</button>' +
- '</div>' +
- '</a>' +
- '</div>';
- userStr += str;
- }
- $("#user_container").html(userStr);
- })
- }
- function changePerson(id) {
- var flag = true;
- var param = {
- "id": $.checkTask.id,
- "checked_person": id,
- "class_type": $.checkTask.class_type
- };
- post_common_service("/task/getUserCount/", param, function(data) {
- if (data && data.length >= 2) {
- layer.msg("本周期稽查次数已满,不能再被稽查!", {
- time: 2000, //20s后自动关闭
- offset: 'r'
- });
- } else {
- // $('#checked_person').html(id);
- var param1 = {
- "id": $.checkTask.id,
- "checked_person": id,
- }
- post_common_service("task/update/", param1, function(task_data) {
- checkHasScore(id, $.checkTask.checked_person);
- //重置当前任务
- $.checkTask = task_data;
- //获取用户信息
- get_common_service('user/getUserById/' + id, null, function(data) {
- changePersonContent(data);
- })
- //更新用户次数表
- no_return_common_service('task/updateUserCount/', param, function(data) {
- // changePersonContent(data);
- })
- layer.close(changePersonLayer);
- }, function(error) {
- // alert(error);
- });
- }
- });
- }
- function checkHasScore(id, old_person) {
- var param = {
- "task_id": $.checkTask.id,
- "checked_person": old_person
- };
- post_common_service("/score/getScoreList/1/10", param, function(data) {
- if (data.list && data.list.length > 0) {
- layer.confirm('是否要同步更改扣分人?', {
- btn: ['是', '否'], //按钮
- shadeClose: true,
- shade: 0, //不显示遮罩
- offset: 'r'
- }, function() {
- var param = {
- "task_id": $.checkTask.id,
- "checked_person": old_person,
- "new_checked_person": id
- };
- post_common_service("/score/updateByTaskIdAndPerson/", param, function(data) {
- layer.msg('更改成功!', {
- offset: 'r',
- time: 2000, //20s后自动关闭
- });
- queryCheckScores();
- });
- }, function() {
- });
- }
- });
- }
- function showBigImg(src) {
- $('#userBigImg').attr("src", src);
- layer.open({
- offset: 'r',
- type: 1,
- title: false,
- closeBtn: 1,
- area: '450px',
- skin: 'layui-layer-nobg', //没有背景色
- shadeClose: true,
- shade: 0,
- content: $('#userBigImg')
- });
- }
- function resetUserImgInfo() {
- $("#user_img_container").empty();
- var str = '<a id="person_img" href="../../images/img4.jpg" class="lightbox-toggle">' +
- '<img src="../../images/img4.jpg" class="img-thumbnail" style="width:50px;height:50px;margin-top:-10px;"></a>' +
- '<label id="checked_person"></label>' +
- '(次数:<a href="javascript:void(0)" onclick="showCheckDetailCount()"><label id="checked_count"></label></a>)';
- $("#user_img_container").html(str);
- }
- function changePersonContent(data) {
- resetUserImgInfo();
- var name = data.truename;
- if (data.workno) name = data.workno + " " + data.truename;
- $("#checked_person").html(name);
- var imgSrc = base_image_server_url + data.pic;
- $("#person_img > img").attr("src", imgSrc);
- if (ISCLIENT) {
- $("#person_img").attr("href", "javascript:void(0)");
- $("#person_img").removeClass("lightbox-toggle");
- $("#person_img").click(function() {
- showClientImg(imgSrc);
- });
- $("#person_img > img").attr("src", imgSrc);
- return;
- } else {
- $("#person_img").attr("href", imgSrc);
- $('a.lightbox-toggle').lightbox();
- }
- getUserCheckCount();
- }
- var scoreLayer;
- function showScore() {
- scoreLayer = showPopup4Common('选择考核项', null, ['400px', '500px'], '#items-div', 'r');
- buildTree();
- }
- function buildTree() {
- var zTreeObj;
- var zNodes = [];
- check_item_tree = $.fn.zTree.init($("#items_tree"), {}, zNodes);
- getCheckItems();
- }
- function getCheckItems() {
- function zTreeOnRename(event, treeId, treeNode, isCancel) {
- alert(treeNode.tId + ", " + treeNode.name);
- }
- function zTreeOnRemove(event, treeId, treeNode) {
- alert(treeNode.tId + ", " + treeNode.name);
- }
- var setting = {
- data: {
- simpleData: {
- enable: true,
- idKey: "id",
- pIdKey: "pId",
- rootPId: null
- }
- },
- view: { //表示tree的显示状态
- selectMulti: false //表示禁止多选
- },
- check: { //表示tree的节点在点击时的相关设置
- enable: false, //是否显示radio/checkbox
- chkStyle: "checkbox", //值为checkbox或者radio表示
- checkboxType: { p: "", s: "" }, //表示父子节点的联动效果
- radioType: "level" //设置tree的分组
- },
- callback: {
- onDblClick: zTreeOnClick
- },
- edit: {
- enable: true,
- drag: {
- autoExpandTrigger: true,
- isMove: true,
- prev: false,
- next: true,
- inner: true,
- autoOpenTime: 0
- },
- showRenameBtn: false,
- showRemoveBtn: false
- }
- };
- get_common_service('checkItem/getAll', null, function(data) {
- zdata = [];
- for (var i = 0; i < data.length; i++) {
- var m = data[i];
- zdata.push(genNode(m));
- }
- menu_tree = $.fn.zTree.init($("#items_tree"), setting, zdata)
- }, function(error) {
- });
- }
- function addobj(data) {
- var zdata = [];
- if (typeof(data.subCheckItem) != "undefinde" && data.subCheckItem != null &&
- data.subCheckItem.length > 0) {
- for (var i = 0; i < data.subCheckItem.length; i++) {
- var m = data.subCheckItem[i];
- zdata.push(genNode(m));
- }
- return zdata;
- } else {
- return [];
- }
- }
- function genNode(m) {
- var zdataItem = {};
- zdataItem["id"] = m.id;
- zdataItem["value"] = m.name;
- zdataItem["pId"] = m.parent_id;
- zdataItem["score"] = m.score;
- zdataItem["icon"] = "";
- zdataItem["name"] = m.name;
- //zdataItem["content"] = m.name;
- if (m.score) zdataItem["name"] = m.name + '(' + m.score + ')';
- zdataItem["open"] = true;
- zdataItem["children"] = addobj(m);
- return zdataItem;
- }
- function zTreeOnClick(event, treeId, treeNode) {
- var imgArr = $("#img_container .pic-class");
- var picsStr = "";
- if (imgArr && imgArr.length > 0) {
- for (var i = 0; i < imgArr.length; i++) {
- picsStr += $(imgArr[i]).attr("path") + ","
- }
- picsStr = picsStr.substr(0, picsStr.length - 1);
- }
- var param = {
- 'task_id': $.checkTask.id,
- 'pics': picsStr,
- 'name': treeNode.value,
- 'check_item_score': treeNode.score,
- 'content': treeNode.value,
- 'check_item_id': treeNode.id,
- 'checkman': $.checkTask.checkman,
- 'checked_person': $.checkTask.checked_person,
- 'checked_dept': $.checkTask.checked_dept
- };
- no_return_common_service("/score/add", param, function(data) {
- if (scoreLayer) layer.close(scoreLayer);
- clearAllImg();
- //查询评分情况
- queryCheckScores();
- layer.msg(data, {
- offset: 'r',
- time: 2000 //20s后自动关闭
- });
- });
- }
- function submitCheck() {
- var param = {
- "id": $.checkTask.id,
- "check_status": 4
- }
- no_return_common_service("/task/taskEnd/", param, function(data) {
- layer.msg("提交成功", {
- offset: 'r',
- time: 2000 //20s后自动关闭
- });
- // var currentpage = $.zui.store.get("currentpage");
- // getPageInfo(currentpage);
- redirectLastPage();
- });
- }
- function showPre(id) {
- // $('#myModal').modal({name:"dd"});
- //预览提交把任务状态改为待提交
- no_return_common_service('/task/update', { "id": $.checkTask.id, "check_status": 7 })
- changePage("/view/mytask/taskDetail.html");
- }
- function showInvalid() {
- invalidLayer = showPopup4Common('申请无效', function() {
- saveValidReason();
- }, ['400px', '500px'], '#invalid_div', 'r');
- $('#apply_reason').tagsInput({ 'defaultText': '添加原因' });
- getTags("/checkApply/getTopReason", "#top_reason_div", '#apply_reason', 'apply_reason');
- }
- function submitCheck4Appeal() {
- var appeal_result = 1;
- //询问框
- layer.confirm('该申诉是否成功?', {
- btn: ['成功', '失败'], //按钮
- shadeClose: true,
- shade: 0, //不显示遮罩
- offset: 'r'
- }, function() {
- appeal_result = 1;
- submitCheck4AppealResult(appeal_result);
- }, function() {
- appeal_result = 2;
- submitCheck4AppealResult(appeal_result);
- });
- }
- function submitCheck4AppealResult(appeal_result) {
- var param = {
- "id": $.checkTask.id,
- "check_status": 14,
- "appeal_id": $.checkTask.appeal.id,
- "appeal_result": appeal_result
- }
- no_return_common_service("/task/taskEnd/", param, function(data) {
- layer.msg("提交成功", {
- offset: 'r',
- time: 2000 //20s后自动关闭
- });
- redirectLastPage();
- });
- }
- function showPre4Appeal(id) {
- // $('#myModal').modal({name:"dd"});
- //预览提交把任务状态改为待提交
- no_return_common_service('/task/update', { "id": $.checkTask.id, "check_status": 17 })
- changePage("/view/mytask/taskDetail.html");
- }
- function saveValidReason() {
- var param = {
- "task_id": $.checkTask.id,
- "apply_reason": $('#apply_reason').val()
- }
- no_return_common_service("/checkApply/add/", param, function(data) {
- layer.msg("申请提交成功", {
- offset: 'r',
- time: 2000 //20s后自动关闭
- });
- redirectLastPage();
- });
- }
- function score(score) {
- alert("扣分:" + score);
- $('#scoreWin').modal('toggle');
- }
- function refuseApply() {
- alert("拒绝申请");
- $('#refuseApplyWin').modal('toggle');
- }
- function agreeApply() {
- alert("同意申请");
- }
- function getVideoPosition(obj) {
- if (obj == null) obj = $('#tabcontent');
- var X = obj.offset().top;
- var Y = obj.offset().left;
- var width = obj.width();
- var height = obj.height();
- return parseInt(Y) + "|" + parseInt(X) + "|" + parseInt(width) + "|" + parseInt(height);
- }
- function initUpLoad() {
- var uploader = WebUploader.create({
- // swf文件路径
- swf: 'lib/webuploader/js/Uploader.swf',
- // 文件接收服务端。
- server: base_image_server_url + '/filesSrver/' + FILE_UPLOAD,
- // 选择文件的按钮。可选。
- // 内部根据当前运行是创建,可能是input元素,也可能是flash.
- pick: '#picker',
- // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
- resize: false
- });
- }
- function saveRecheckResult() {
- var param = {
- "id": $.checkTask.appeal.id,
- "recheck_result": $("#recheck_result").val()
- }
- post_common_service("/checkAppeal/update", param, function(data) {
- layer.msg("保存成功", {
- offset: 'r',
- time: 2000 //20s后自动关闭
- });
- $.checkTask.appeal = data;
- });
- }
- function addTag(text, tagDiv) {
- if (!$(tagDiv).tagExist(text)) {
- $(tagDiv).addTag(text);
- }
- }
- // function getTags(){
- // post_common_service("/checkApply/getTopReason", null, function(data) {
- // if(data){
- // var str="";
- // for(var i=0;i<data.length;i++){
- // str+='<a href="javascript:void(0)" onclick="addTag(\''+data[i].apply_reason+'\')" style="float:left;margin:5px;"><span class="label label-success" style="padding:5px;">'+data[i].apply_reason+'</span></a>';
- // }
- // $("#top_reason_div").html(str);
- // }
- // });
- // }
|