check.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921
  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. scoreDetailLayer = showPopup4Common('本周已考核任务', null, ['450px', '350px'], '#checked_task_list_div', 'r');
  185. var param = {
  186. "period_id": $.checkTask.period_id,
  187. "checked_person": $.checkTask.checked_person,
  188. "status_search_type":1
  189. };
  190. var cols = [
  191. {width: 40, text: '序号', type: 'number', flex: true, colClass: 'text-center',field: 'num'},
  192. {width: 80, text: '任务名称', type: 'string', flex: true, sort: 'down',field: 'name'},
  193. {width: 50, text: '考核人员', type: 'string', flex: true, colClass: '',field: 'checked_person_name'},
  194. {width: 80, text: '考核部门', type: 'string', flex: true, sort: 'down',field: 'checked_dept_name'},
  195. {width: 40, text: '稽查人员', type: 'string', flex: true, hide:'false',colClass: '',field: 'checkman_name'},
  196. {width: 70, text: '稽查时间段', type: 'string', flex: true, sort: 'down',field: 'check_period'}
  197. ];
  198. $('#checked_user_task_datatable').mytable({
  199. 'cols': cols,
  200. 'url': "/task/getUserCheckedTaskByPage/",
  201. 'param': param,
  202. 'isShoWPager':false
  203. });
  204. }
  205. function initCheckAppealBtns() {
  206. if ($.checkTask.appeal) {
  207. $("#btn_appeal_task").show();
  208. $("#btn_task").hide();
  209. // $("#appeal_div").show();
  210. $("#appeal_time").html($.checkTask.appeal.appeal_time);
  211. $("#appeal_reason").html($.checkTask.appeal.appeal_reason);
  212. $("#appeal_file_list").html(genAppeaFiles($.checkTask.appeal.file_src));
  213. $("#recheck_result").html($.checkTask.appeal.recheck_result);
  214. showAppealLayer();
  215. } else {
  216. // $("#appeal_div").hide();
  217. $("#btn_appeal_task").hide();
  218. $("#btn_task").show();
  219. }
  220. }
  221. function showAppealLayer(){
  222. layer.open({
  223. type: 1,
  224. title: "申诉详情",
  225. closeBtn: 1,
  226. shade: false,
  227. maxmin: false,
  228. shadeClose: true,
  229. offset: 'rb',
  230. content: $('#appeal_div'), //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
  231. cancel:function(index){
  232. layer.close(index);
  233. layer.open({
  234. type: 1,
  235. title: "",
  236. closeBtn: 0,
  237. shade: false,
  238. maxmin: false,
  239. shadeClose: true,
  240. content:$('#hide_div'),
  241. offset: 'rb',
  242. btn: ['申诉详情'],
  243. yes:function(index){
  244. layer.close(index);
  245. showAppealLayer();
  246. }
  247. });
  248. return false;
  249. }
  250. });
  251. }
  252. // 使用data参数更新数据:
  253. function queryCheckScores() {
  254. //$('#score_datatable').score_datatable("");
  255. console.log("任务id:" + $.checkTask.id);
  256. var data = {
  257. "task_id": $.checkTask.id
  258. }
  259. // alert("ff");
  260. var cols = [
  261. { width: 40, text: '序号', type: 'number', flex: true, colClass: 'text-center', field: 'num' },
  262. { width: 160, text: '评分记录', type: 'string', flex: true, sort: 'down', field: 'content' },
  263. { width: 50, text: '分数', type: 'string', flex: true, colClass: '', field: 'check_item_score' },
  264. { width: 100, text: '备注', type: 'string', flex: true, colClass: '', field: 'remark' },
  265. { width: 55, text: '考核人', type: 'string', flex: true, colClass: '', field: 'checked_person_name' },
  266. // {width: 80, text: '图片', type: 'imagedd', flex: true, colClass: '',field: 'pics'},
  267. {
  268. width: 110,
  269. text: '操作',
  270. type: 'string',
  271. flex: true,
  272. field: 'id',
  273. oper: [
  274. { func: 'showEditCheckScore', text: '修改', icon_class: 'icon-edit' },
  275. { func: 'showEditPic', text: '修改图片', icon_class: 'icon-edit' },
  276. { func: 'deleteCheckScore', text: '删除', icon_class: 'icon-remove-circle' }
  277. ]
  278. }
  279. ];
  280. // var pager = {
  281. // page_size:10
  282. // }
  283. $('#score_datatable').mytable({
  284. 'cols': cols,
  285. 'url': "/score/getScoreList/",
  286. 'param': data
  287. });
  288. }
  289. function showEditPic(id) {
  290. var rowData = getItemByIdFromArr(id, $('#score_datatable').mytable('getTableData'));
  291. showPics(rowData.pics);
  292. $("#saveEditBtn").show();
  293. editScoreId = id;
  294. }
  295. function showEditCheckScore(id) {
  296. // deleteItem4Common(id,"/score/delete/",queryCheckScores);
  297. var rowData = getItemByIdFromArr(id, $('#score_datatable').mytable('getTableData'));
  298. scoreDetailLayer = showPopup4Common('修改考核项', function(data) {
  299. saveScoreEdit();
  300. }, ['350px', '550px'], '#score-detail-div', 'r');
  301. $("#score_id_text").val(rowData.id);
  302. $("#check_item_text").val(rowData.content);
  303. $("#check_score_text").val(rowData.check_item_score);
  304. setFeeUserSelect("#check_checked_person_select", rowData.checked_person);
  305. // $("#check_checked_person_select").val(rowData.checked_person);
  306. $("#check_remark_text").tagsInput({'defaultText':'添加备注','width':'240px'});
  307. $("#check_remark_text").addTag(rowData.remark);
  308. getTags("/score/getTopRemark",'#score_remark_div','#check_remark_text','remark');
  309. }
  310. function setFeeUserSelect(div, selectId) {
  311. var param = {
  312. 'organid': $.checkTask.checked_dept
  313. };
  314. post_common_service("/user/getUserList/", param, function(userList) {
  315. // setFeeUserSelect("#check_checked_person_select",rowData.checked_person,data);
  316. var optStr = '';
  317. for (var i in userList) {
  318. if (userList[i].id == selectId)
  319. optStr += '<option value="' + userList[i].id + '" selected="selected">' + userList[i].truename + '</option>';
  320. else
  321. optStr += '<option value="' + userList[i].id + '">' + userList[i].truename + '</option>';
  322. }
  323. $(div).html('');
  324. $(div).html(optStr);
  325. $('#check_checked_person_select').chosen({
  326. // width:'200px',
  327. height: '100px',
  328. no_results_text: '没有找到', // 当检索时没有找到匹配项时显示的提示文本
  329. disable_search_threshold: 10, // 10 个以下的选择项则不显示检索框
  330. search_contains: true // 从任意位置开始检索
  331. });
  332. });
  333. }
  334. function saveScoreEdit() {
  335. var param = {
  336. 'id': $("#score_id_text").val(),
  337. 'content': $("#check_item_text").val(),
  338. 'check_item_score': $("#check_score_text").val(),
  339. 'remark': $("#check_remark_text").val(),
  340. 'checked_person': $("#check_checked_person_select").val(),
  341. };
  342. editScoreId = null;
  343. $("#saveEditBtn").hide();
  344. no_return_common_service("/score/update", param, function(data) {
  345. if (scoreLayer) layer.close(scoreLayer);
  346. //查询评分情况
  347. queryCheckScores();
  348. // layer.msg(data, {
  349. // time: 2000//20s后自动关闭
  350. // });
  351. });
  352. }
  353. var editScoreId;
  354. function saveEdit() {
  355. if (editScoreId) {
  356. var imgArr = $("#img_container .pic-class");
  357. var picsStr = "";
  358. if (imgArr && imgArr.length > 0) {
  359. for (var i = 0; i < imgArr.length; i++) {
  360. picsStr += imgArr[i].attr("path") + ","
  361. }
  362. picsStr = picsStr.substr(0, picsStr.length - 1);
  363. }
  364. var param = {
  365. 'id': editScoreId,
  366. 'pics': picsStr
  367. };
  368. editScoreId = null;
  369. $("#saveEditBtn").hide();
  370. no_return_common_service("/score/update", param, function(data) {
  371. if (scoreLayer) layer.close(scoreLayer);
  372. //查询评分情况
  373. queryCheckScores();
  374. layer.msg(data, {
  375. time: 2000 //20s后自动关闭
  376. });
  377. });
  378. }
  379. }
  380. function deleteCheckScore(id) {
  381. deleteItem4Common(id, "/score/delete/", queryCheckScores, 'r');
  382. }
  383. function setVideoList(videos) {
  384. var videoArr;
  385. if (videos) {
  386. videoArr = videos.split("|");
  387. var selectStr = "";
  388. for (var i in videoArr) {
  389. if (i == 0)
  390. selectStr += '<option value="' + videoArr[i] + '" selected="selected">视频' + (videoArr[i] + 1) + '</option>'
  391. else
  392. selectStr += '<option value="' + videoArr[i] + '">视频' + (videoArr[i] + 1) + '</option>';
  393. }
  394. }
  395. $('#video_list').html(selectStr);
  396. }
  397. function addPic(pic) {
  398. if (pic) {
  399. var i = 0;
  400. // var imgArr = $("#img_container .pic-class");
  401. // if(imgArr && imgArr.length>0) i = imgArr.length;
  402. if (pic.startWith("http"))
  403. pic = pic.replace(base_image_server_url, "/");
  404. var picStr = genPicstr(pic);
  405. $('#img_container').append(picStr);
  406. $('a.lightbox-toggle').lightbox();
  407. }
  408. }
  409. function showPics(pics, divId) {
  410. var picStr = '';
  411. if (!divId) divId = '#img_container';
  412. $(divId).html(picStr);
  413. if (pics) {
  414. var picArr = pics.split(',');
  415. for (var i in picArr) {
  416. var pic = genPicstr(picArr[i]);
  417. picStr += pic;
  418. }
  419. $(divId).html(picStr);
  420. $('a.lightbox-toggle').lightbox();
  421. }
  422. }
  423. function genPicstr(imgSrc) {
  424. var src = imgSrc;
  425. if (!src.startWith("http"))
  426. src = base_image_server_url + src;
  427. var ispic = true;
  428. var videosrc = src;
  429. if (src.indexOf('.avi') != -1) {
  430. src = src.split('.avi')[0] + "_screen_0.png"
  431. ispic = false;
  432. }
  433. if (src.indexOf('.mov') != -1) {
  434. src = src.split('.mov')[0] + "_screen_0.png"
  435. ispic = false;
  436. }
  437. if (src.indexOf('.mp4') != -1) {
  438. src = src.split('.mp4')[0] + "_screen_0.png"
  439. ispic = false;
  440. }
  441. var pic = '<div class="img_item" style="width:100px;height:90px;float:left;">' +
  442. '<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>' +
  443. (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">') +
  444. '<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>') +
  445. '</a>' +
  446. '</div>';
  447. if (ISCLIENT) {
  448. pic = '<div class="img_item" style="width:100px;height:90px;float:left;">' +
  449. '<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>' +
  450. '<a class="card" onclick="' + (ispic ? 'showClientImg(\'' + src + '\')' : 'showClientVideo(\'' + videosrc + '\')') + '" href="javascript:void(0)" style="position:absolute">' +
  451. '<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>') +
  452. '</a>' +
  453. '</div>';
  454. }
  455. return pic;
  456. }
  457. function removeImg(this1) {
  458. $(this1).parent('.img_item').remove();
  459. }
  460. function clearAllImg() {
  461. $('#img_container').empty();
  462. }
  463. var changePersonLayer;
  464. function showChangeUser() {
  465. var param = {
  466. 'organid': $.checkTask.checked_dept
  467. };
  468. post_common_service("/user/getUserList/", param, function(data) {
  469. changePersonLayer = showPopup4Common('更改人员', null, ['550px', '600px'], null, 'r');
  470. $("#user_container").empty();
  471. var userStr = "";
  472. for (var i in data) {
  473. var name = data[i].truename;
  474. if (data[i].workno) name = name + " " + data[i].workno.substr(data[i].workno.length - 3);
  475. var pic = "../../images/body-bg.png";
  476. if (data[i].pic) pic = base_image_server_url + data[i].pic;
  477. str = '<div style="width:90px;float:left;margin:5px;">' +
  478. '<a class="card" href="javascript:void(0)">' +
  479. '<img src="' + pic + '" alt="" style="height:100px;width:90px;" onclick="showBigImg(\'' + pic + '\')">' +
  480. '<div class="card-heading"><strong>' + name + '</strong></div>' +
  481. '<div class="card-actions">' +
  482. '<button type="button" class="btn btn-mini btn-danger" onclick="changePerson(\'' + data[i].id + '\')">选择</button>' +
  483. '</div>' +
  484. '</a>' +
  485. '</div>';
  486. userStr += str;
  487. }
  488. $("#user_container").html(userStr);
  489. })
  490. }
  491. function changePerson(id) {
  492. var flag = true;
  493. var param = {
  494. "id": $.checkTask.id,
  495. "checked_person": id,
  496. "class_type": $.checkTask.class_type
  497. };
  498. post_common_service("/task/getUserCount/", param, function(data) {
  499. if (data && data.length >= 2) {
  500. layer.msg("本周期稽查次数已满,不能再被稽查!", {
  501. time: 2000, //20s后自动关闭
  502. offset: 'r'
  503. });
  504. } else {
  505. // $('#checked_person').html(id);
  506. var param1 = {
  507. "id": $.checkTask.id,
  508. "checked_person": id,
  509. }
  510. post_common_service("task/update/", param1, function(task_data) {
  511. //重置当前任务
  512. $.checkTask = task_data;
  513. //获取用户信息
  514. get_common_service('user/getUserById/' + id, null, function(data) {
  515. changePersonContent(data);
  516. })
  517. //更新用户次数表
  518. no_return_common_service('task/updateUserCount/', param, function(data) {
  519. // changePersonContent(data);
  520. })
  521. layer.close(changePersonLayer);
  522. }, function(error) {
  523. alert(error);
  524. });
  525. }
  526. });
  527. }
  528. function showBigImg(src) {
  529. $('#userBigImg').attr("src", src);
  530. layer.open({
  531. offset: 'r',
  532. type: 1,
  533. title: false,
  534. closeBtn: 1,
  535. area: '450px',
  536. skin: 'layui-layer-nobg', //没有背景色
  537. shadeClose: true,
  538. shade: 0,
  539. content: $('#userBigImg')
  540. });
  541. }
  542. function resetUserImgInfo() {
  543. $("#user_img_container").empty();
  544. var str = '<a id="person_img" href="../../images/img4.jpg" class="lightbox-toggle">' +
  545. '<img src="../../images/img4.jpg" class="img-thumbnail" style="width:50px;height:50px;margin-top:-10px;"></a>' +
  546. '<label id="checked_person"></label>' +
  547. '(次数:<a href="javascript:void(0)" onclick="showCheckDetailCount()"><label id="checked_count"></label></a>)';
  548. $("#user_img_container").html(str);
  549. }
  550. function changePersonContent(data) {
  551. resetUserImgInfo();
  552. var name = data.truename;
  553. if (data.workno) name = data.workno + " " + data.truename;
  554. $("#checked_person").html(name);
  555. var imgSrc = base_image_server_url + data.pic;
  556. $("#person_img > img").attr("src", imgSrc);
  557. if (ISCLIENT) {
  558. $("#person_img").attr("href", "javascript:void(0)");
  559. $("#person_img").removeClass("lightbox-toggle");
  560. $("#person_img").click(function() {
  561. showClientImg(imgSrc);
  562. });
  563. $("#person_img > img").attr("src", imgSrc);
  564. return;
  565. } else {
  566. $("#person_img").attr("href", imgSrc);
  567. $('a.lightbox-toggle').lightbox();
  568. }
  569. getUserCheckCount();
  570. }
  571. var scoreLayer;
  572. function showScore() {
  573. scoreLayer = showPopup4Common('选择考核项', null, ['400px', '500px'], '#items-div', 'r');
  574. buildTree();
  575. }
  576. function buildTree() {
  577. var zTreeObj;
  578. var zNodes = [];
  579. check_item_tree = $.fn.zTree.init($("#items_tree"), {}, zNodes);
  580. getCheckItems();
  581. }
  582. function getCheckItems() {
  583. function zTreeOnRename(event, treeId, treeNode, isCancel) {
  584. alert(treeNode.tId + ", " + treeNode.name);
  585. }
  586. function zTreeOnRemove(event, treeId, treeNode) {
  587. alert(treeNode.tId + ", " + treeNode.name);
  588. }
  589. var setting = {
  590. data: {
  591. simpleData: {
  592. enable: true,
  593. idKey: "id",
  594. pIdKey: "pId",
  595. rootPId: null
  596. }
  597. },
  598. view: { //表示tree的显示状态
  599. selectMulti: false //表示禁止多选
  600. },
  601. check: { //表示tree的节点在点击时的相关设置
  602. enable: false, //是否显示radio/checkbox
  603. chkStyle: "checkbox", //值为checkbox或者radio表示
  604. checkboxType: { p: "", s: "" }, //表示父子节点的联动效果
  605. radioType: "level" //设置tree的分组
  606. },
  607. callback: {
  608. onDblClick: zTreeOnClick
  609. },
  610. edit: {
  611. enable: true,
  612. drag: {
  613. autoExpandTrigger: true,
  614. isMove: true,
  615. prev: false,
  616. next: true,
  617. inner: true,
  618. autoOpenTime: 0
  619. },
  620. showRenameBtn: false,
  621. showRemoveBtn: false
  622. }
  623. };
  624. get_common_service('checkItem/getAll', null, function(data) {
  625. zdata = [];
  626. for (var i = 0; i < data.length; i++) {
  627. var m = data[i];
  628. zdata.push(genNode(m));
  629. }
  630. menu_tree = $.fn.zTree.init($("#items_tree"), setting, zdata)
  631. }, function(error) {
  632. });
  633. }
  634. function addobj(data) {
  635. var zdata = [];
  636. if (typeof(data.subCheckItem) != "undefinde" && data.subCheckItem != null &&
  637. data.subCheckItem.length > 0) {
  638. for (var i = 0; i < data.subCheckItem.length; i++) {
  639. var m = data.subCheckItem[i];
  640. zdata.push(genNode(m));
  641. }
  642. return zdata;
  643. } else {
  644. return [];
  645. }
  646. }
  647. function genNode(m) {
  648. var zdataItem = {};
  649. zdataItem["id"] = m.id;
  650. zdataItem["value"] = m.name;
  651. zdataItem["pId"] = m.parent_id;
  652. zdataItem["score"] = m.score;
  653. zdataItem["icon"] = "";
  654. zdataItem["name"] = m.name;
  655. //zdataItem["content"] = m.name;
  656. if (m.score) zdataItem["name"] = m.name + '(' + m.score + ')';
  657. zdataItem["open"] = true;
  658. zdataItem["children"] = addobj(m);
  659. return zdataItem;
  660. }
  661. function zTreeOnClick(event, treeId, treeNode) {
  662. var imgArr = $("#img_container .pic-class");
  663. var picsStr = "";
  664. if (imgArr && imgArr.length > 0) {
  665. for (var i = 0; i < imgArr.length; i++) {
  666. picsStr += $(imgArr[i]).attr("path") + ","
  667. }
  668. picsStr = picsStr.substr(0, picsStr.length - 1);
  669. }
  670. var param = {
  671. 'task_id': $.checkTask.id,
  672. 'pics': picsStr,
  673. 'name': treeNode.value,
  674. 'check_item_score': treeNode.score,
  675. 'content': treeNode.value,
  676. 'check_item_id': treeNode.id,
  677. 'checkman': treeNode.id,
  678. 'checked_person': $.checkTask.checked_person,
  679. 'checked_dept': $.checkTask.checked_dept
  680. };
  681. no_return_common_service("/score/add", param, function(data) {
  682. if (scoreLayer) layer.close(scoreLayer);
  683. clearAllImg();
  684. //查询评分情况
  685. queryCheckScores();
  686. layer.msg(data, {
  687. time: 2000 //20s后自动关闭
  688. });
  689. });
  690. }
  691. function submitCheck() {
  692. var param = {
  693. "id": $.checkTask.id,
  694. "check_status": 4
  695. }
  696. no_return_common_service("/task/taskEnd/", param, function(data) {
  697. layer.msg("提交成功", {
  698. time: 2000 //20s后自动关闭
  699. });
  700. var currentpage = $.zui.store.get("currentpage");
  701. getPageInfo(currentpage);
  702. // changePage("/view/mytask/task_list.html?status=2");
  703. });
  704. }
  705. function showPre(id) {
  706. // $('#myModal').modal({name:"dd"});
  707. //预览提交把任务状态改为待提交
  708. no_return_common_service('/task/update', { "id": $.checkTask.id, "check_status": 7 })
  709. changePage("/view/mytask/taskDetail.html");
  710. }
  711. function showInvalid() {
  712. invalidLayer = showPopup4Common('申请无效', function() {
  713. saveValidReason();
  714. }, ['400px', '500px'], '#invalid_div', 'r');
  715. $('#apply_reason').tagsInput({'defaultText':'添加原因'});
  716. getTags("/checkApply/getTopReason","#top_reason_div",'#apply_reason','apply_reason');
  717. }
  718. function submitCheck4Appeal() {
  719. var appeal_result=1;
  720. //询问框
  721. layer.confirm('该申诉是否成功?', {
  722. btn: ['成功','失败'] //按钮
  723. }, function(){
  724. appeal_result=1;
  725. submitCheck4AppealResult(appeal_result);
  726. }, function(){
  727. appeal_result=2;
  728. submitCheck4AppealResult(appeal_result);
  729. });
  730. }
  731. function submitCheck4AppealResult(appeal_result){
  732. var param = {
  733. "id": $.checkTask.id,
  734. "check_status": 14,
  735. "appeal_id":$.checkTask.appeal.id,
  736. "appeal_result":appeal_result
  737. }
  738. no_return_common_service("/task/taskEnd/", param, function(data) {
  739. layer.msg("提交成功", {
  740. time: 2000 //20s后自动关闭
  741. });
  742. var currentpage = $.zui.store.get("currentpage");
  743. getPageInfo(currentpage);
  744. // changePage("/view/appeal_management/appeal_list.html?status=12");
  745. });
  746. }
  747. function showPre4Appeal(id) {
  748. // $('#myModal').modal({name:"dd"});
  749. //预览提交把任务状态改为待提交
  750. no_return_common_service('/task/update', { "id": $.checkTask.id, "check_status": 17})
  751. changePage("/view/mytask/taskDetail.html");
  752. }
  753. function saveValidReason() {
  754. var param = {
  755. "task_id": $.checkTask.id,
  756. "apply_reason": $('#apply_reason').val()
  757. }
  758. no_return_common_service("/checkApply/add/", param, function(data) {
  759. layer.msg("申请提交成功", {
  760. time: 2000 //20s后自动关闭
  761. });
  762. var currentpage = $.zui.store.get("currentpage");
  763. getPageInfo(currentpage);
  764. // changePage("/view/mytask/task_list.html?status=2");
  765. });
  766. }
  767. function score(score) {
  768. alert("扣分:" + score);
  769. $('#scoreWin').modal('toggle');
  770. }
  771. function refuseApply() {
  772. alert("拒绝申请");
  773. $('#refuseApplyWin').modal('toggle');
  774. }
  775. function agreeApply() {
  776. alert("同意申请");
  777. }
  778. function getVideoPosition(obj) {
  779. if (obj == null) obj = $('#tabcontent');
  780. var X = obj.offset().top;
  781. var Y = obj.offset().left;
  782. var width = obj.width();
  783. var height = obj.height();
  784. return parseInt(Y) + "|" + parseInt(X) + "|" + parseInt(width) + "|" + parseInt(height);
  785. }
  786. function initUpLoad() {
  787. var uploader = WebUploader.create({
  788. // swf文件路径
  789. swf: 'lib/webuploader/js/Uploader.swf',
  790. // 文件接收服务端。
  791. server: base_image_server_url + '/filesSrver/' + FILE_UPLOAD,
  792. // 选择文件的按钮。可选。
  793. // 内部根据当前运行是创建,可能是input元素,也可能是flash.
  794. pick: '#picker',
  795. // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
  796. resize: false
  797. });
  798. }
  799. function saveRecheckResult() {
  800. var param = {
  801. "id": $.checkTask.appeal.id,
  802. "recheck_result": $("#recheck_result").val()
  803. }
  804. post_common_service("/checkAppeal/update", param, function(data) {
  805. layer.msg("保存成功", {
  806. offset: 'r',
  807. time: 2000 //20s后自动关闭
  808. });
  809. $.checkTask.appeal = data;
  810. });
  811. }
  812. function addTag(text,tagDiv){
  813. if (!$(tagDiv).tagExist(text)) {
  814. $(tagDiv).addTag(text);
  815. }
  816. }
  817. // function getTags(){
  818. // post_common_service("/checkApply/getTopReason", null, function(data) {
  819. // if(data){
  820. // var str="";
  821. // for(var i=0;i<data.length;i++){
  822. // 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>';
  823. // }
  824. // $("#top_reason_div").html(str);
  825. // }
  826. // });
  827. // }