| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110 |
- 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 pos = $("#video_pos").val();
- if ($("#full_video_pos").length > 0) {
- pos = $("#full_video_pos").val();
- }
- var c_time = time.add(sender.value.newValue, "s");
- if (/^(\+|-)?\d+($|\.\d+$)/.test(pos)) {
- if (pos > 0) {
- c_time = time.add(Math.abs(pos), "s");
- } else {
- c_time = time.subtract(Math.abs(pos), "s");
- }
- }
- $("#ex1_span").html(c_time.format("YYYY-MM-DD HH:mm:ss"))
- }
- });
- $("#tabcontent").css("height", ($("#video_content").height() - 80) + "px");
- $("#score_datatable").css("height", ($("#video_content").height() - 120) + "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);
- $("#taskName").html($.checkTask.name);
- $("#ex1_span").html($.checkTask.start_time)
- $("#full_ex1_span").html($.checkTask.start_time)
- $("#lane").val($.checkTask.checked_location);
- $("#check_time").html($.checkTask.check_period);
- $("#monitor").html($.checkTask.monitor_user_name);
- // 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)
- $("#video_pos").val($("#full_video_pos").val());
- }
- }
- 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"/>' +
- ' <br/> <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-group1" style="float:right;">' +
- ' <button type="button" class="btn btn-info1" style="width:41px;height:41px" onclick="doAction(\'start\')"><i class="icon icon-play-circle icon-2x"></i></button>' +
- ' <button type="button" class="btn btn-info1" style="width:41px;height:41px" onclick="doAction(\'stop\')"><i class="icon icon-pause icon-2x"></i></button>' +
- ' <button type="button" class="btn btn-info1" style="width:41px;height:41px" onclick="doAction(\'fast\')"><i class="icon icon-forward icon-2x"></i><span id=\"full_fast_info\"></span></button>' +
- ' <button type="button" class="btn btn-info1" style="width:41px;height:41px" onclick="doAction(\'slow\')"><span id=\"full_slow_info\"></span><i class="icon icon-backward icon-2x"></i></button>' +
- ' <button type="button" class="btn btn-info1" style="width:41px;height:41px" style="width:51px;height:42px" id="full_video_btn_start" onclick="doAction(\'video_start\')"><img id="full_video_btn_start_img" style="width:30px" src="/images/video.png"></img></i></button>' +
- ' <button type="button" class="btn btn-info1 hidden" style="width:41px;height:41px" id="full_video_btn_stop" onclick="doAction(\'video_stop\')"><i class="icon icon-stop icon-2x"></i></button>' +
- ' <button type="button" class="btn btn-info1" style="width:41px;height:41px" 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_video_btn_start").mouseover(function() {
- $("#full_video_btn_start_img").attr("src", "/images/movie.png");
- });
- $("#full_video_btn_start").mouseout(function() {
- $("#full_video_btn_start_img").attr("src", "/images/video.png");
- });
- $("#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 pos = $("#video_pos").val();
- if ($("#full_video_pos").length > 0) {
- pos = $("#full_video_pos").val();
- }
- var c_time = time.add(sender.value.newValue, "s");
- if (/^(\+|-)?\d+($|\.\d+$)/.test(pos)) {
- if (pos > 0) {
- c_time = time.add(Math.abs(pos), "s");
- } else {
- c_time = time.subtract(Math.abs(pos), "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,
- area: ['400px', "400px"],
- 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: 100, text: '评分记录', type: 'string', flex: true, sort: 'down', field: 'content' },
- { width: 40, text: '分数', type: 'string', flex: true, colClass: '', field: 'check_item_score' },
- { width: 100, text: '备注', type: 'string', flex: true, colClass: '', field: 'remark' },
- { width: 50, text: '考核人', type: 'string', flex: true, colClass: '', field: 'checked_person_name' },
- // {width: 80, text: '图片', type: 'imagedd', flex: true, colClass: '',field: 'pics'},
- // {
- // width: 150,
- // 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 colFunc = { width: 120, text: '操作', type: 'string', flex: true, field: 'id' };
- colFunc.oper = [
- { func: 'showEditCheckScore', text: '修改', icon_class: 'icon-edit' },
- { func: 'showEditPic', text: '图片', icon_class: 'icon-edit' }
- ];
- if ($.checkTask.appeal) {
- colFunc.oper.push({ func: 'backoutCheckScore', text: '撤销', icon_class: 'icon-reply' });
- } else {
- colFunc.oper.push({ func: 'deleteCheckScore', text: '删除', icon_class: 'icon-remove-circle' });
- }
- cols.push(colFunc);
- // 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 backoutCheckScore(id) {
- layer.confirm('是否要撤销扣分?', {
- btn: ['是', '否'], //按钮
- shadeClose: true,
- shade: 0, //不显示遮罩
- offset: 'r'
- }, function() {
- var param = {
- "id": id,
- "check_item_score": 0
- };
- post_common_service("/score/backoutScore/", param, function(data) {
- layer.msg('撤销成功!', {
- offset: 'r',
- time: 2000, //20s后自动关闭
- });
- queryCheckScores();
- });
- }, function() {
- });
- }
- 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);
- // console.log($("#user_container").html());
- })
- }
- function changePerson(id) {
- layer.confirm('是否要更改考核人?', {
- btn: ['是', '否'], //按钮
- shadeClose: true,
- shade: 0, //不显示遮罩
- offset: 'r'
- }, function(index) {
- layer.close(index);
- 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() {
- });
- }
- 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()"><span class="label label-primary" id="checked_count">Primary</span></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
- }
- };
- var param = { "rule_type": 1 };
- console.log(param);
- post_common_service('checkRule/getItemListByRuleType', param, function(data) {
- // console.log(data);
- zdata = [];
- for (var i = 0; i < data.length; i++) {
- var m = data[i];
- zdata.push(genNode(m));
- }
- // console.log(zdata);
- menu_tree = $.fn.zTree.init($("#items_tree"), setting, zdata)
- }, function(error) {
- });
- }
- function addobj_checkitem(data) {
- // console.log(data.subCheckItem);
- var zdata = [];
- if (typeof(data.subCheckItem) != "undefined" && 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;
- // console.log(m.subCheckItem);
- zdataItem["children"] = addobj_checkitem(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");
- }
- var isappeal = false;
- function appeal_showInvalid() {
- isappeal = true;
- showInvalidView();
- }
- function showInvalid() {
- isappeal = false;
- showInvalidView();
- }
- function showInvalidView() {
- invalidLayer = showPopup4Common('申请无效', function() {
- saveValidReason();
- }, ['400px', '500px'], '#invalid_div', 'r');
- $('#apply_reason').tagsInput({ 'defaultText': '添加原因' });
- getTags("checkApply/getTopReason", "#top_reason_div", '#apply_reason', 'apply_reason');
- }
- function submitCheck4AppealDirect() {
- var appeal_result = 1;
- //询问框
- layer.confirm('该申诉是否成功?', {
- offset: 'r',
- btn: ['成功', '失败'], //按钮
- // shadeClose: true,
- shade: 0 //不显示遮罩
- }, 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(),
- "isappeal": isappeal
- };
- 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);
- // }
- // });
- // }
|