| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986 |
- var videoPlayer;
- var isfullscreen = false;
- var videoid;
- function dbclick() {
- if (isfullscreen) {
- if (layer_full) {
- layer.close(layer_full)
- }
- isfullscreen = false;
- $("#tabcontent").css("height", '400px');
- } else {
- fullscreen();
- }
- }
- var startTimec = 0;
- var endTimec = 0;
- function videorecordstart(type) {
- if (type == "video_start") {
- $("#video_btn_start").addClass("hidden");
- $("#video_btn_stop").removeClass("hidden");
- startTimec = currentTime;
- }
- if (type == "video_stop") {
- $("#video_btn_stop").addClass("hidden");
- $("#video_btn_start").removeClass("hidden");
- endTimec = currentTime;
- var idss = videoid.split("/");
- var filename = idss[idss.length - 1];
- //开始截取视屏
- post_common_service_nohead(base_image_server_url + 'fileServer/file/videocut', {
- "targetfilename": filename,
- "filename": filename.split(".")[0],
- "startTime": startTimec,
- "endtime": endTimec
- }, function(data) {
- addPic(data.path)
- });
- }
- if (type == "screenshot") {
- var idss = videoid.split("/");
- var filename = idss[idss.length - 1];
- //开始截取视屏
- post_common_service_nohead(base_image_server_url + 'fileServer/file/videopiccut', {
- "targetfilename": filename,
- "filename": filename.split(".")[0],
- "startTime": currentTime,
- }, function(data) {
- addPic(data.path)
- });
- }
- }
- var currentTime = 0;
- function timeHandler(time) {
- //'当前播放时间(秒):' + time;
- // console.log(time)
- currentTime = time;
- }
- function initCheck() {
- addBreadMenu("/qzd/view/task/check.html", "清障队视频稽查");
- $("#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);
- // }
- if ($.checkTask) {
- // console.log($.checkTask);
- getAreaCheckCount();
- initCheckAppealBtns();
- $("#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);
- //TODO 获取分数
- queryCheckScores();
- videos = $.checkTask.recordVideos;
- if (videos.split(",").length > 0) {
- var vlist = videos.split(",");
- var htmlo = "";
- for (var v in vlist) {
- var vv = vlist[v];
- console.log(vv.split("/")[0]);
- var o = "<option val='" + vv + "' " + (v == 0 ? "selected" : "") + " >" + vv.split("/")[0] + "</option>"
- htmlo += o;
- }
- $("#videoslist").html(htmlo);
- }
- videoid = videos.split(",")[0];
- var videoObject = {
- container: '.video', //“#”代表容器的ID,“.”或“”代表容器的class
- variable: 'player', //该属性必需设置,值等于下面的new chplayer()的对象
- //poster: 'pic/wdm.jpg', //封面图片
- autoplay: true,
- video: base_image_server_url + videoid //视频地址
- };
- videoPlayer = new ckplayer(videoObject);
- videoPlayer.addListener('time', timeHandler);
- }
- }
- function onvideoselect(obj) {
- videoid = (obj.value);
- var videoObject = {
- container: '.video', //“#”代表容器的ID,“.”或“”代表容器的class
- variable: 'player', //该属性必需设置,值等于下面的new chplayer()的对象
- //poster: 'pic/wdm.jpg', //封面图片
- autoplay: true,
- video: base_image_server_url + videoid //视频地址
- };
- videoPlayer = new ckplayer(videoObject);
- videoPlayer.addListener('time', timeHandler);
- }
- 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 = $('#video_content');
- layer_full = layer.open({
- area: ['80%', height + "px"],
- type: 1,
- title: false,
- anim: -1,
- closeBtn: 0,
- shadeClose: false,
- content: contenthtml,
- success: function(layero, index) {
- isfullscreen = true;
- $("#tabcontent").css("height", (height - 60) + 'px');
- }
- });
- }
- function getAreaCheckCount() {
- var index = layer.load(1, {
- shade: [0.1, '#fff'] //0.1透明度的白色背景
- });
- //var html = '';
- var userids = $.checkTask.checked_users.split(",");
- var usernames = $.checkTask.checked_users_name.split(",");
- var param = {
- "period_id": $.checkTask.period_id,
- "checked_users": $.checkTask.checked_users
- };
- var url = base_server_url + "/q/task/getTasks/0/0";
- ajaxPost(url, param, function(response) {
- for (var i in userids) {
- // console.log(response);
- var html = '<label id="' + userids[i] + '"></label>' + usernames[i] + '(次数:' +
- '<a href="javascript:void(0)" onclick="showCheckDetailCount(\'' + userids[i] + '\')"><span class="label label-primary" id="">' + response[i].length + '</span></a>)';
- $("#checked_area").append(html);
- }
- }, function(error) {
- if (fail)
- fail("网络错误");
- else
- console.log("网络错误");
- });
- }
- //显示考核次数
- function showCheckDetailCount(id) {
- scoreDetailLayer = showPopup4Common('本周期已考核任务', null, ['450px', '350px'], '#checked_task_list_div', 'r', '确定');
- var param = {
- "period_id": $.checkTask.period_id,
- "checked_users": id
- };
- 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_users_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': "/q/task/getall/",
- '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_area_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: 170, 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': "/q/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');
- var list = new Array();
- var userids = $.checkTask.checked_users.split(",");
- var usernames = $.checkTask.checked_users_name.split(",");
- console.log(rowData);
- var optStr = '';
- for (var i in userids) {
- if (userids[i] == rowData.checked_area)
- optStr += '<option value="' + userids[i] + '" selected="selected">' + usernames[i] + '</option>';
- else
- optStr += '<option value="' + userids[i] + '">' + usernames[i] + '</option>';
- }
- $("#check_checked_person_select").html('');
- $("#check_checked_person_select").html(optStr);
- $("#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").importTags('');
- $("#check_remark_text").addTag(rowData.remark);
- getTags("/q/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_area': $("#check_checked_person_select").val(),
- };
- editScoreId = null;
- $("#saveEditBtn").hide();
- console.log(param);
- no_return_common_service("/q/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].attributes.getNamedItem("path").textContent + ","
- }
- picsStr = picsStr.substr(0, picsStr.length - 1);
- }
- var param = {
- 'id': editScoreId,
- 'pics': picsStr
- };
- editScoreId = null;
- $("#saveEditBtn").hide();
- no_return_common_service("/q/score/update", param, function(data) {
- if (scoreLayer) layer.close(scoreLayer);
- //查询评分情况
- queryCheckScores();
- layer.msg(data, {
- offset: 'r',
- time: 2000 //20s后自动关闭
- });
- });
- }
- }
- function deleteCheckScore(id) {
- deleteItem4Common(id, "/q/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("/q/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 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 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('选择考核项', function(data) {
- var nodes = check_item_tree.getSelectedNodes()[0];
- console.log(nodes);
- var data = {
- "content": nodes.value,
- "check_item_score": nodes.score,
- "checked_person_name": $.checkTask.checkman_name
- }
- console.log(data);
- }, ['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": 6 };
- 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_area': $.checkTask.checked_users.split(",")[0],
- 'checked_dept': $.checkTask.checked_dept
- };
- no_return_common_service("/q/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("/q/task/update/", param, function(data) {
- layer.msg("提交成功", {
- offset: 'r',
- time: 2000 //20s后自动关闭
- });
- redirectLastPage();
- });
- }
- function showPre(id) {
- // $('#myModal').modal({name:"dd"});
- //预览提交把任务状态改为待提交
- no_return_common_service('/q/task/update', { "id": $.checkTask.id, "check_status": 7 })
- changePage("/qzd/view/task/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("/q/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("/q/task/update/", param, function(data) {
- layer.msg("提交成功", {
- offset: 'r',
- time: 2000 //20s后自动关闭
- });
- redirectLastPage();
- });
- }
- function showPre4Appeal(id) {
- // $('#myModal').modal({name:"dd"});
- //预览提交把任务状态改为待提交
- no_return_common_service('/q/task/update', { "id": $.checkTask.id, "check_status": 17 })
- changePage("/qzd/view/task/taskDetail.html");
- }
- function saveValidReason() {
- var param = {
- "task_id": $.checkTask.id,
- "apply_reason": $('#apply_reason').val(),
- "isappeal": isappeal
- };
- no_return_common_service("/q/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("/q/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);
- // }
- // });
- // }
|