check.js 34 KB

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