check.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864
  1. function initCheck() {
  2. addBreadMenu("/view/mytask/check.html", "视频稽查");
  3. $('#ex1').slider({ tooltip: 'hide' });
  4. $("#ex1").on("slideStop", function(slideEvt) {
  5. setVideoProcess(slideEvt.value);
  6. });
  7. $("#tabcontent").css("height", ($("#video_content").height() - 80) + "px");
  8. if (ISCLIENT) {
  9. event = document.createEvent('MessageEvent');
  10. var origin = window.location.protocol + '//' + window.location.host;
  11. event.initMessageEvent('setvideoposition', true, true, getVideoPosition(null), origin, 1234, window, null);
  12. document.dispatchEvent(event);
  13. }
  14. // 仅选择日期
  15. $("#start-time").datetimepicker({
  16. language: "zh-CN",
  17. weekStart: 1,
  18. todayBtn: 1,
  19. autoclose: 1,
  20. todayHighlight: 1,
  21. startView: 2,
  22. minView: 2,
  23. forceParse: 0,
  24. format: "yyyy-mm-dd"
  25. });
  26. // 仅选择日期
  27. $("#end-time").datetimepicker({
  28. language: "zh-CN",
  29. weekStart: 1,
  30. todayBtn: 1,
  31. autoclose: 1,
  32. todayHighlight: 1,
  33. startView: 2,
  34. minView: 2,
  35. forceParse: 0,
  36. format: "yyyy-mm-dd"
  37. });
  38. if ($.checkTask) {
  39. getUserCheckCount();
  40. initCheckAppealBtns();
  41. setFeSelect("#fsList", $.checkTask.checked_dept);
  42. $("#lane").val($.checkTask.checked_location);
  43. // setLaneSelect("#lane", $.checkTask.checked_location);
  44. get_common_service('user/getUserById/' + $.checkTask.checked_person, null, function(data) {
  45. changePersonContent(data);
  46. })
  47. //查询评分情况
  48. queryCheckScores();
  49. //查询录像播放列表
  50. var videos = $.checkTask.video_id.split(',');
  51. if (videos[0]) {
  52. curVideo = videos[0];
  53. queryVideoList();
  54. } else {
  55. callFunc("showvideoview", "false");
  56. layer.msg('该处暂无视屏!', {
  57. time: 2000, //20s后自动关闭
  58. });
  59. callFunc("stop", "");
  60. }
  61. }
  62. $("select#video_list").change(function() {
  63. playVideo($(this).val());
  64. });
  65. }
  66. function setfastorslow(type, speed) {
  67. if (type == 0) {
  68. $("#fast_info").html("");
  69. $("#slow_info").html("");
  70. if ($("#full_fast_info")) {
  71. $("#full_fast_info").html("");
  72. $("#full_slow_info").html("");
  73. }
  74. }
  75. if (type == 1) {
  76. $("#fast_info").html(speed + "x");
  77. $("#slow_info").html("");
  78. if ($("#full_fast_info")) {
  79. $("#full_fast_info").html(speed + "x");
  80. $("#full_slow_info").html("");
  81. }
  82. }
  83. if (type == 2) {
  84. $("#slow_info").html(speed + "x");
  85. $("#fast_info").html("");
  86. if ($("#full_fast_info")) {
  87. $("#full_fast_info").html("");
  88. $("#full_slow_info").html(speed + "x");
  89. }
  90. }
  91. }
  92. function normalscreen() {
  93. if (layer_full) {
  94. layer.close(layer_full)
  95. }
  96. }
  97. var layer_full = null;
  98. function fullscreen() {
  99. var height = window.innerWidth * 0.8 * 1 / 2.0 + 90
  100. var contenthtml = ' <div class="tab-content" id="full_tabcontent" style="height:400px;text-align: center;background:black;">' +
  101. ' <p style="padding-top:180px;font-size:20px">加载中...</p>' +
  102. ' <!--<i class="icon icon-spin icon-spinner icon-5x" style="margin-top:100px"></i>-->' +
  103. ' </div>' +
  104. ' <div class="row" class="col-md-12" style="padding:5px 10px 5px 10px;text-align:center;margin:0px">' +
  105. ' <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"' +
  106. ' />' +
  107. ' </div>' +
  108. ' <div class="row" style="padding:0px 5px 0px 5px;text-align:center;margin:0px">' +
  109. ' <select class="form-control" id="full_video_list" style="width:200px;float:left;display:none;"></select>' +
  110. ' <div class="col-md-4 " style="padding-left:0">' +
  111. ' <div class="input-group" style="padding-left:0">' +
  112. ' <input type="text" id="full_video_pos" style="height:42px" class="form-control" placeholder="时间偏移值">' +
  113. ' <span class="input-group-btn">' +
  114. ' <button class="btn btn-default" onclick="setVideoPos()" style="height:42px" type="button">校正</button>' +
  115. ' </span>' +
  116. ' </div>' +
  117. ' </div>' +
  118. ' <div class="btn-group" style="float:right;">' +
  119. ' <button type="button" class="btn btn-info" onclick="doAction(\'start\')"><i class="icon icon-play-circle icon-2x"></i></button>' +
  120. ' <button type="button" class="btn btn-info" onclick="doAction(\'stop\')"><i class="icon icon-pause icon-2x"></i></button>' +
  121. ' <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>' +
  122. ' <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>' +
  123. ' <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>' +
  124. ' <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>' +
  125. ' <button type="button" class="btn btn-success" onclick="doAction(\'screenshot\')"><i class="icon icon-camera icon-2x"></i></button>' +
  126. ' </div>' +
  127. ' </div>';
  128. layer_full = layer.open({
  129. area: ['80%', height + "px"],
  130. type: 1,
  131. title: false,
  132. anim: -1,
  133. closeBtn: 0,
  134. shadeClose: false,
  135. content: "<div id='layer_content' >" + contenthtml + "</div>",
  136. success: function(layero, index) {
  137. $("#full_video_pos").val($("#video_pos").val());
  138. $('#full_ex1').slider({ tooltip: 'hide' });
  139. $("#full_ex1").on("slideStop", function(slideEvt) {
  140. setVideoProcess(slideEvt.value);
  141. });
  142. $("#full_ex1").val($("#ex1").value)
  143. $("#full_ex1").slider({ step: 5, min: 0, max: maxVV });
  144. $("#full_fast_info").html($("#fast_info").html());
  145. $("#full_slow_info").html($("#slow_info").html());
  146. $("#full_tabcontent").css("height", (height - 90) + "px");
  147. $("#full_tabcontent").css("width", "100%");
  148. setTimeout(function() {
  149. callFunc("setvideoposition", getVideoPosition($("#full_tabcontent")))
  150. }, 800)
  151. }
  152. });
  153. }
  154. function getUserCheckCount() {
  155. var param = {
  156. "id": $.checkTask.id,
  157. "checked_person": $.checkTask.checked_person
  158. };
  159. post_common_service("/task/getUserCount/", param, function(userList) {
  160. if (userList) {
  161. $("#checked_count").html(userList.length);
  162. } else {
  163. $("#checked_count").html(0);
  164. }
  165. });
  166. }
  167. function checkUserCount() {
  168. var param = {
  169. "id": $.checkTask.id,
  170. "checked_person": $.checkTask.checked_person,
  171. "class_type": $.checkTask.class_type
  172. };
  173. post_common_service("/task/getUserCount/", param, function(data) {
  174. if (data >= 2) {
  175. layer.msg("本周期稽查次数已满,不能再被稽查!", {
  176. time: 2000 //20s后自动关闭
  177. });
  178. return false;
  179. }
  180. return true;
  181. });
  182. }
  183. function showCheckDetailCount() {
  184. }
  185. function initCheckAppealBtns() {
  186. if ($.checkTask.appeal) {
  187. $("#btn_appeal_task").show();
  188. $("#btn_task").hide();
  189. $("#appeal_div").show();
  190. $("#appeal_time").html($.checkTask.appeal.appeal_time);
  191. $("#appeal_reason").html($.checkTask.appeal.appeal_reason);
  192. $("#appeal_file_list").html(genAppeaFiles($.checkTask.appeal.file_src));
  193. $("#recheck_result").html($.checkTask.appeal.recheck_result);
  194. showAppealLayer();
  195. } else {
  196. $("#appeal_div").hide();
  197. $("#btn_appeal_task").hide();
  198. $("#btn_task").show();
  199. }
  200. }
  201. function showAppealLayer(){
  202. layer.open({
  203. type: 1,
  204. title: "申诉详情",
  205. closeBtn: 1,
  206. shade: false,
  207. maxmin: false,
  208. shadeClose: true,
  209. offset: 'rb',
  210. content: $('#appeal_div'), //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
  211. cancel:function(index){
  212. // layer.msg('', {
  213. // time: 0, //不自动关闭
  214. // offset: 'rb',
  215. // btn: ['申诉详情'],
  216. // yes: function(index){
  217. // layer.close(index);
  218. // showAppealLayer();
  219. // }
  220. // });
  221. layer.open({
  222. type: 1,
  223. title: "",
  224. closeBtn: 0,
  225. shade: false,
  226. maxmin: false,
  227. shadeClose: true,
  228. content:$('#hide_div'),
  229. offset: 'rb',
  230. btn: ['申诉详情'],
  231. yes:function(index){
  232. layer.close(index);
  233. showAppealLayer();
  234. }
  235. });
  236. }
  237. });
  238. }
  239. // 使用data参数更新数据:
  240. function queryCheckScores() {
  241. //$('#score_datatable').score_datatable("");
  242. console.log("任务id:" + $.checkTask.id);
  243. var data = {
  244. "task_id": $.checkTask.id
  245. }
  246. // alert("ff");
  247. var cols = [
  248. { width: 40, text: '序号', type: 'number', flex: true, colClass: 'text-center', field: 'num' },
  249. { width: 160, text: '评分记录', type: 'string', flex: true, sort: 'down', field: 'content' },
  250. { width: 50, text: '分数', type: 'string', flex: true, colClass: '', field: 'check_item_score' },
  251. { width: 100, text: '备注', type: 'string', flex: true, colClass: '', field: 'remark' },
  252. { width: 55, text: '考核人', type: 'string', flex: true, colClass: '', field: 'checked_person_name' },
  253. // {width: 80, text: '图片', type: 'imagedd', flex: true, colClass: '',field: 'pics'},
  254. {
  255. width: 110,
  256. text: '操作',
  257. type: 'string',
  258. flex: true,
  259. field: 'id',
  260. oper: [
  261. { func: 'showEditCheckScore', text: '修改', icon_class: 'icon-edit' },
  262. { func: 'showEditPic', text: '修改图片', icon_class: 'icon-edit' },
  263. { func: 'deleteCheckScore', text: '删除', icon_class: 'icon-remove-circle' }
  264. ]
  265. }
  266. ];
  267. // var pager = {
  268. // page_size:10
  269. // }
  270. $('#score_datatable').mytable({
  271. 'cols': cols,
  272. 'url': "/score/getScoreList/",
  273. 'param': data
  274. });
  275. }
  276. function showEditPic(id) {
  277. var rowData = getItemByIdFromArr(id, $('#score_datatable').mytable('getTableData'));
  278. showPics(rowData.pics);
  279. $("#saveEditBtn").show();
  280. editScoreId = id;
  281. }
  282. function showEditCheckScore(id) {
  283. // deleteItem4Common(id,"/score/delete/",queryCheckScores);
  284. var rowData = getItemByIdFromArr(id, $('#score_datatable').mytable('getTableData'));
  285. scoreDetailLayer = showPopup4Common('修改考核项', function(data) {
  286. saveScoreEdit();
  287. }, ['350px', '550px'], '#score-detail-div', 'r');
  288. $("#score_id_text").val(rowData.id);
  289. $("#check_item_text").val(rowData.content);
  290. $("#check_score_text").val(rowData.check_item_score);
  291. $("#check_remark_text").val(rowData.remark);
  292. setFeeUserSelect("#check_checked_person_select", rowData.checked_person);
  293. // $("#check_checked_person_select").val(rowData.checked_person);
  294. }
  295. function setFeeUserSelect(div, selectId) {
  296. var param = {
  297. 'organid': $.checkTask.checked_dept
  298. };
  299. post_common_service("/user/getUserList/", param, function(userList) {
  300. // setFeeUserSelect("#check_checked_person_select",rowData.checked_person,data);
  301. var optStr = '';
  302. for (var i in userList) {
  303. if (userList[i].id == selectId)
  304. optStr += '<option value="' + userList[i].id + '" selected="selected">' + userList[i].truename + '</option>';
  305. else
  306. optStr += '<option value="' + userList[i].id + '">' + userList[i].truename + '</option>';
  307. }
  308. $(div).html('');
  309. $(div).html(optStr);
  310. $('#check_checked_person_select').chosen({
  311. // width:'200px',
  312. height: '100px',
  313. no_results_text: '没有找到', // 当检索时没有找到匹配项时显示的提示文本
  314. disable_search_threshold: 10, // 10 个以下的选择项则不显示检索框
  315. search_contains: true // 从任意位置开始检索
  316. });
  317. });
  318. }
  319. function saveScoreEdit() {
  320. var param = {
  321. 'id': $("#score_id_text").val(),
  322. 'content': $("#check_item_text").val(),
  323. 'check_item_score': $("#check_score_text").val(),
  324. 'remark': $("#check_remark_text").val(),
  325. 'checked_person': $("#check_checked_person_select").val(),
  326. };
  327. editScoreId = null;
  328. $("#saveEditBtn").hide();
  329. no_return_common_service("/score/update", param, function(data) {
  330. if (scoreLayer) layer.close(scoreLayer);
  331. //查询评分情况
  332. queryCheckScores();
  333. // layer.msg(data, {
  334. // time: 2000//20s后自动关闭
  335. // });
  336. });
  337. }
  338. var editScoreId;
  339. function saveEdit() {
  340. if (editScoreId) {
  341. var imgArr = $("#img_container .pic-class");
  342. var picsStr = "";
  343. if (imgArr && imgArr.length > 0) {
  344. for (var i = 0; i < imgArr.length; i++) {
  345. picsStr += imgArr[i].attr("path") + ","
  346. }
  347. picsStr = picsStr.substr(0, picsStr.length - 1);
  348. }
  349. var param = {
  350. 'id': editScoreId,
  351. 'pics': picsStr
  352. };
  353. editScoreId = null;
  354. $("#saveEditBtn").hide();
  355. no_return_common_service("/score/update", param, function(data) {
  356. if (scoreLayer) layer.close(scoreLayer);
  357. //查询评分情况
  358. queryCheckScores();
  359. layer.msg(data, {
  360. time: 2000 //20s后自动关闭
  361. });
  362. });
  363. }
  364. }
  365. function deleteCheckScore(id) {
  366. deleteItem4Common(id, "/score/delete/", queryCheckScores, 'r');
  367. }
  368. function setVideoList(videos) {
  369. var videoArr;
  370. if (videos) {
  371. videoArr = videos.split("|");
  372. var selectStr = "";
  373. for (var i in videoArr) {
  374. if (i == 0)
  375. selectStr += '<option value="' + videoArr[i] + '" selected="selected">视频' + (videoArr[i] + 1) + '</option>'
  376. else
  377. selectStr += '<option value="' + videoArr[i] + '">视频' + (videoArr[i] + 1) + '</option>';
  378. }
  379. }
  380. $('#video_list').html(selectStr);
  381. }
  382. function addPic(pic) {
  383. if (pic) {
  384. var i = 0;
  385. // var imgArr = $("#img_container .pic-class");
  386. // if(imgArr && imgArr.length>0) i = imgArr.length;
  387. if (pic.startWith("http"))
  388. pic = pic.replace(base_image_server_url, "/");
  389. var picStr = genPicstr(pic);
  390. $('#img_container').append(picStr);
  391. $('a.lightbox-toggle').lightbox();
  392. }
  393. }
  394. function showPics(pics, divId) {
  395. var picStr = '';
  396. if (!divId) divId = '#img_container';
  397. $(divId).html(picStr);
  398. if (pics) {
  399. var picArr = pics.split(',');
  400. for (var i in picArr) {
  401. var pic = genPicstr(picArr[i]);
  402. picStr += pic;
  403. }
  404. $(divId).html(picStr);
  405. $('a.lightbox-toggle').lightbox();
  406. }
  407. }
  408. function genPicstr(imgSrc) {
  409. var src = imgSrc;
  410. if (!src.startWith("http"))
  411. src = base_image_server_url + src;
  412. var ispic = true;
  413. var videosrc = src;
  414. if (src.indexOf('.avi') != -1) {
  415. src = src.split('.avi')[0] + "_screen_0.png"
  416. ispic = false;
  417. }
  418. if (src.indexOf('.mov') != -1) {
  419. src = src.split('.mov')[0] + "_screen_0.png"
  420. ispic = false;
  421. }
  422. if (src.indexOf('.mp4') != -1) {
  423. src = src.split('.mp4')[0] + "_screen_0.png"
  424. ispic = false;
  425. }
  426. var pic = '<div class="img_item" style="width:100px;height:90px;float:left;">' +
  427. '<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>' +
  428. (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">') +
  429. '<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>') +
  430. '</a>' +
  431. '</div>';
  432. if (ISCLIENT) {
  433. pic = '<div class="img_item" style="width:100px;height:90px;float:left;">' +
  434. '<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>' +
  435. '<a class="card" onclick="' + (ispic ? 'showClientImg(\'' + src + '\')' : 'showClientVideo(\'' + videosrc + '\')') + '" href="javascript:void(0)" style="position:absolute">' +
  436. '<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>') +
  437. '</a>' +
  438. '</div>';
  439. }
  440. return pic;
  441. }
  442. function removeImg(this1) {
  443. $(this1).parent('.img_item').remove();
  444. }
  445. function clearAllImg() {
  446. $('#img_container').empty();
  447. }
  448. var changePersonLayer;
  449. function showChangeUser() {
  450. var param = {
  451. 'organid': $.checkTask.checked_dept
  452. };
  453. post_common_service("/user/getUserList/", param, function(data) {
  454. changePersonLayer = showPopup4Common('更改人员', null, ['550px', '600px'], null, 'r');
  455. $("#user_container").empty();
  456. var userStr = "";
  457. for (var i in data) {
  458. var name = data[i].truename;
  459. if (data[i].workno) name = name + " " + data[i].workno.substr(data[i].workno.length - 3);
  460. var pic = "../../images/body-bg.png";
  461. if (data[i].pic) pic = base_image_server_url + data[i].pic;
  462. str = '<div style="width:90px;float:left;margin:5px;">' +
  463. '<a class="card" href="javascript:void(0)">' +
  464. '<img src="' + pic + '" alt="" style="height:100px;width:90px;" onclick="showBigImg(\'' + pic + '\')">' +
  465. '<div class="card-heading"><strong>' + name + '</strong></div>' +
  466. '<div class="card-actions">' +
  467. '<button type="button" class="btn btn-mini btn-danger" onclick="changePerson(\'' + data[i].id + '\')">选择</button>' +
  468. '</div>' +
  469. '</a>' +
  470. '</div>';
  471. userStr += str;
  472. }
  473. $("#user_container").html(userStr);
  474. })
  475. }
  476. function changePerson(id) {
  477. var flag = true;
  478. var param = {
  479. "id": $.checkTask.id,
  480. "checked_person": id,
  481. "class_type": $.checkTask.class_type
  482. };
  483. post_common_service("/task/getUserCount/", param, function(data) {
  484. if (data && data.length >= 2) {
  485. layer.msg("本周期稽查次数已满,不能再被稽查!", {
  486. time: 2000, //20s后自动关闭
  487. offset: 'r'
  488. });
  489. } else {
  490. // $('#checked_person').html(id);
  491. var param1 = {
  492. "id": $.checkTask.id,
  493. "checked_person": id,
  494. }
  495. post_common_service("task/update/", param1, function(task_data) {
  496. //重置当前任务
  497. $.checkTask = task_data;
  498. //获取用户信息
  499. get_common_service('user/getUserById/' + id, null, function(data) {
  500. changePersonContent(data);
  501. })
  502. //更新用户次数表
  503. no_return_common_service('task/updateUserCount/', param, function(data) {
  504. // changePersonContent(data);
  505. })
  506. layer.close(changePersonLayer);
  507. }, function(error) {
  508. alert(error);
  509. });
  510. }
  511. });
  512. }
  513. function showBigImg(src) {
  514. $('#userBigImg').attr("src", src);
  515. layer.open({
  516. offset: 'r',
  517. type: 1,
  518. title: false,
  519. closeBtn: 1,
  520. area: '450px',
  521. skin: 'layui-layer-nobg', //没有背景色
  522. shadeClose: true,
  523. shade: 0,
  524. content: $('#userBigImg')
  525. });
  526. }
  527. function resetUserImgInfo() {
  528. $("#user_img_container").empty();
  529. var str = '<a id="person_img" href="../../images/img4.jpg" class="lightbox-toggle">' +
  530. '<img src="../../images/img4.jpg" class="img-thumbnail" style="width:50px;height:50px;margin-top:-10px;"></a>' +
  531. '<label id="checked_person"></label>' +
  532. '(次数:<a href="#"><label id="checked_count"></label></a>)';
  533. $("#user_img_container").html(str);
  534. }
  535. function changePersonContent(data) {
  536. resetUserImgInfo();
  537. var name = data.truename;
  538. if (data.workno) name = data.workno + " " + data.truename;
  539. $("#checked_person").html(name);
  540. var imgSrc = base_image_server_url + data.pic;
  541. $("#person_img > img").attr("src", imgSrc);
  542. if (ISCLIENT) {
  543. $("#person_img").attr("href", "javascript:void(0)");
  544. $("#person_img").removeClass("lightbox-toggle");
  545. $("#person_img").click(function() {
  546. showClientImg(imgSrc);
  547. });
  548. $("#person_img > img").attr("src", imgSrc);
  549. return;
  550. } else {
  551. $("#person_img").attr("href", imgSrc);
  552. $('a.lightbox-toggle').lightbox();
  553. }
  554. getUserCheckCount();
  555. }
  556. var scoreLayer;
  557. function showScore() {
  558. scoreLayer = showPopup4Common('选择考核项', null, ['400px', '500px'], '#items-div', 'r');
  559. buildTree();
  560. }
  561. function buildTree() {
  562. var zTreeObj;
  563. var zNodes = [];
  564. check_item_tree = $.fn.zTree.init($("#items_tree"), {}, zNodes);
  565. getCheckItems();
  566. }
  567. function getCheckItems() {
  568. function zTreeOnRename(event, treeId, treeNode, isCancel) {
  569. alert(treeNode.tId + ", " + treeNode.name);
  570. }
  571. function zTreeOnRemove(event, treeId, treeNode) {
  572. alert(treeNode.tId + ", " + treeNode.name);
  573. }
  574. var setting = {
  575. data: {
  576. simpleData: {
  577. enable: true,
  578. idKey: "id",
  579. pIdKey: "pId",
  580. rootPId: null
  581. }
  582. },
  583. view: { //表示tree的显示状态
  584. selectMulti: false //表示禁止多选
  585. },
  586. check: { //表示tree的节点在点击时的相关设置
  587. enable: false, //是否显示radio/checkbox
  588. chkStyle: "checkbox", //值为checkbox或者radio表示
  589. checkboxType: { p: "", s: "" }, //表示父子节点的联动效果
  590. radioType: "level" //设置tree的分组
  591. },
  592. callback: {
  593. onDblClick: zTreeOnClick
  594. },
  595. edit: {
  596. enable: true,
  597. drag: {
  598. autoExpandTrigger: true,
  599. isMove: true,
  600. prev: false,
  601. next: true,
  602. inner: true,
  603. autoOpenTime: 0
  604. },
  605. showRenameBtn: false,
  606. showRemoveBtn: false
  607. }
  608. };
  609. get_common_service('checkItem/getAll', null, function(data) {
  610. zdata = [];
  611. for (var i = 0; i < data.length; i++) {
  612. var m = data[i];
  613. zdata.push(genNode(m));
  614. }
  615. menu_tree = $.fn.zTree.init($("#items_tree"), setting, zdata)
  616. }, function(error) {
  617. });
  618. }
  619. function addobj(data) {
  620. var zdata = [];
  621. if (typeof(data.subCheckItem) != "undefinde" && data.subCheckItem != null &&
  622. data.subCheckItem.length > 0) {
  623. for (var i = 0; i < data.subCheckItem.length; i++) {
  624. var m = data.subCheckItem[i];
  625. zdata.push(genNode(m));
  626. }
  627. return zdata;
  628. } else {
  629. return [];
  630. }
  631. }
  632. function genNode(m) {
  633. var zdataItem = {};
  634. zdataItem["id"] = m.id;
  635. zdataItem["value"] = m.name;
  636. zdataItem["pId"] = m.parent_id;
  637. zdataItem["score"] = m.score;
  638. zdataItem["icon"] = "";
  639. zdataItem["name"] = m.name;
  640. //zdataItem["content"] = m.name;
  641. if (m.score) zdataItem["name"] = m.name + '(' + m.score + ')';
  642. zdataItem["open"] = true;
  643. zdataItem["children"] = addobj(m);
  644. return zdataItem;
  645. }
  646. function zTreeOnClick(event, treeId, treeNode) {
  647. var imgArr = $("#img_container .pic-class");
  648. var picsStr = "";
  649. if (imgArr && imgArr.length > 0) {
  650. for (var i = 0; i < imgArr.length; i++) {
  651. picsStr += $(imgArr[i]).attr("path") + ","
  652. }
  653. picsStr = picsStr.substr(0, picsStr.length - 1);
  654. }
  655. var param = {
  656. 'task_id': $.checkTask.id,
  657. 'pics': picsStr,
  658. 'name': treeNode.value,
  659. 'check_item_score': treeNode.score,
  660. 'content': treeNode.value,
  661. 'check_item_id': treeNode.id,
  662. 'checkman': treeNode.id,
  663. 'checked_person': $.checkTask.checked_person,
  664. 'checked_dept': $.checkTask.checked_dept
  665. };
  666. no_return_common_service("/score/add", param, function(data) {
  667. if (scoreLayer) layer.close(scoreLayer);
  668. clearAllImg();
  669. //查询评分情况
  670. queryCheckScores();
  671. layer.msg(data, {
  672. time: 2000 //20s后自动关闭
  673. });
  674. });
  675. }
  676. function submitCheck() {
  677. var param = {
  678. "id": $.checkTask.id,
  679. "check_status": 4
  680. }
  681. no_return_common_service("/task/taskEnd/", param, function(data) {
  682. layer.msg("提交成功", {
  683. time: 2000 //20s后自动关闭
  684. });
  685. changePage("/view/mytask/task_list.html?status=2");
  686. });
  687. }
  688. function showPre(id) {
  689. // $('#myModal').modal({name:"dd"});
  690. //预览提交把任务状态改为待提交
  691. no_return_common_service('/task/update', { "id": $.checkTask.id, "check_status": 7 })
  692. changePage("/view/mytask/taskDetail.html");
  693. }
  694. function showInvalid() {
  695. invalidLayer = showPopup4Common('申请无效', function() {
  696. saveValidReason();
  697. }, ['400px', '500px'], '#invalid_div', 'r');
  698. }
  699. function submitCheck4Appeal() {
  700. var param = {
  701. "id": $.checkTask.id,
  702. "check_status": 14
  703. }
  704. no_return_common_service("/task/taskEnd/", param, function(data) {
  705. layer.msg("提交成功", {
  706. time: 2000 //20s后自动关闭
  707. });
  708. changePage("/view/mytask/task_list.html?status=2");
  709. });
  710. }
  711. function showPre4Appeal(id) {
  712. // $('#myModal').modal({name:"dd"});
  713. //预览提交把任务状态改为待提交
  714. no_return_common_service('/task/update', { "id": $.checkTask.id, "check_status": 17 })
  715. changePage("/view/mytask/taskDetail.html");
  716. }
  717. function saveValidReason() {
  718. var param = {
  719. "task_id": $.checkTask.id,
  720. "apply_reason": $("#apply_reason").val()
  721. }
  722. no_return_common_service("/checkApply/add/", param, function(data) {
  723. layer.msg("申请提交成功", {
  724. time: 2000 //20s后自动关闭
  725. });
  726. changePage("/view/mytask/task_list.html?status=2");
  727. });
  728. }
  729. function score(score) {
  730. alert("扣分:" + score);
  731. $('#scoreWin').modal('toggle');
  732. }
  733. function refuseApply() {
  734. alert("拒绝申请");
  735. $('#refuseApplyWin').modal('toggle');
  736. }
  737. function agreeApply() {
  738. alert("同意申请");
  739. }
  740. function getVideoPosition(obj) {
  741. if (obj == null) obj = $('#tabcontent');
  742. var X = obj.offset().top;
  743. var Y = obj.offset().left;
  744. var width = obj.width();
  745. var height = obj.height();
  746. return parseInt(Y) + "|" + parseInt(X) + "|" + parseInt(width) + "|" + parseInt(height);
  747. }
  748. function initUpLoad() {
  749. var uploader = WebUploader.create({
  750. // swf文件路径
  751. swf: 'lib/webuploader/js/Uploader.swf',
  752. // 文件接收服务端。
  753. server: base_image_server_url + '/filesSrver/' + FILE_UPLOAD,
  754. // 选择文件的按钮。可选。
  755. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  756. pick: '#picker',
  757. // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
  758. resize: false
  759. });
  760. }
  761. function saveRecheckResult() {
  762. var param = {
  763. "id": $.checkTask.appeal.id,
  764. "recheck_result": $("#recheck_result").val()
  765. }
  766. post_common_service("/checkAppeal/update", param, function(data) {
  767. layer.msg("保存成功", {
  768. offset: 'r',
  769. time: 2000 //20s后自动关闭
  770. });
  771. });
  772. }