check.js 28 KB

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