check.js 34 KB

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