check.js 36 KB

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