check.js 35 KB

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