封丘民意调查

WorkDeal.js 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. /**
  2. * 工单处理
  3. * */
  4. $(document).ready(function() {
  5. var ID = helper.request.queryString("str");
  6. laydate.render({
  7. elem: '#t_inqtime',
  8. theme: '#1ab394',
  9. calendar: 'true',
  10. });
  11. autosize($('textarea'));
  12. // helper.getDropList.getlistDropByDic($('#t_county'), 'JBDW'); //获取乡镇或单位下拉
  13. $('#t_investigator').val($.cookie("u_code"));//给调查员默认值;当前用户的账号
  14. helper.getDropList.getlistDropByDic($('#xl_boxs'), 'ZBDW'); //获取交办单位下拉
  15. helper.getDropList.getlistDropByDic($('#xl_box'), 'XXFL'); //信息分类
  16. //getDealDept(); //获取交办单位
  17. //获取乡镇或单位下拉//获取信息分类
  18. //$.when(helper.getDropList.getlistDropByDic($('#t_county'), 'JBDW'), getInfoClass())
  19. helper.getDropList.getlistDropByDic($('#t_county'), 'JBDW')
  20. .then(function() {
  21. if(ID) {
  22. getWorkOrderInfo(ID); //获取工单信息
  23. }
  24. });
  25. /* //tree下拉框效果
  26. $(".inpBox .tree").click(function() {
  27. if($(this).parent().find(".addTree").is(":hidden")) {
  28. $(this).parent().find(".addTree").show();
  29. } else {
  30. $(this).parent().find(".addTree").hide();
  31. }
  32. });
  33. //普通下拉框效果
  34. $(".inpBox .select").click(function() {
  35. if($(this).parent().find(".xl_common").is(":hidden")) {
  36. $(this).parent().find(".xl_common").show();
  37. } else {
  38. $(this).parent().find(".xl_common").hide();
  39. }
  40. });
  41. $(".xl").click(function() {
  42. if($(this).parent().find(".addTree").is(":hidden")) {
  43. $(this).parent().find(".addTree").show();
  44. } else {
  45. $(this).parent().find(".addTree").hide();
  46. }
  47. if($(this).parent().find(".xl_common").is(":hidden")) {
  48. $(this).parent().find(".xl_common").show();
  49. } else {
  50. $(this).parent().find(".xl_common").hide();
  51. }
  52. });
  53. $(".inpBox").mouseleave(function() {
  54. $(this).children(".addTree").hide();
  55. $(this).children(".xl_common").hide();
  56. })
  57. $(".xl_box").on("click", "li", function() {
  58. var obj = $(this).parent().parent().parent();
  59. obj.find("input").eq(0).val($(this).text());
  60. obj.find("input").eq(1).val($(this).attr("itemid"));
  61. obj.find(".xl_common").hide();
  62. })
  63. $("input[name='ltype']").click(function() {
  64. var val = $("input[name='ltype']:checked").val();
  65. if(val == '0') {
  66. $(".js").show();
  67. getBM($("#zrbmtree"));
  68. } else if(val == '1') {
  69. $(".js").hide();
  70. }
  71. })*/
  72. //点击确定
  73. $("#clgd").click(function() {
  74. /*var val = $("input[name='ltype']:checked").val();
  75. if(!val) {
  76. layer.confirm('请选择处理方式!', {
  77. btn: ['确定']
  78. });
  79. return;
  80. }
  81. if(val == '0') {
  82. if(!$("#clbm").val()) {
  83. layer.confirm('请选择接收部门!', {
  84. btn: ['确定']
  85. });
  86. return;
  87. }
  88. }
  89. if(!$("#cont").val()) {
  90. layer.confirm('请输入处理内容!', {
  91. btn: ['确定']
  92. });
  93. return;
  94. }*/
  95. dealWorkOrder(ID);
  96. });
  97. })
  98. /*//获取交办单位
  99. function getDealDept() {
  100. $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  101. flag: 'JBDW',
  102. token: $.cookie("token")
  103. }, function(result) {
  104. if(result.state.toLowerCase() == "success") {
  105. $('<option value="0">请选择</option>').appendTo("#xl_box");
  106. for(var i = 0; i < result.data.length; i++) {
  107. $('<option value="' + result.data[i].F_DictionaryValueId + '">' + result.data[i].F_Name + '</option>').appendTo("#xl_box");
  108. }
  109. }
  110. })
  111. }
  112. ////获取信息分类
  113. function getInfoClass() {
  114. var dtd = $.Deferred(); //在函数内部,新建一个Deferred对象
  115. $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  116. flag: 'XXFL',
  117. token: $.cookie("token")
  118. }, function(result) {
  119. if(result.state.toLowerCase() == "success") {
  120. for(var i = 0; i < result.data.length; i++) {
  121. var html = '<label class="radio-inline" style="font-weight: normal;">' +
  122. '<input type="radio" value="' + result.data[i].F_DictionaryValueId + '" name="ltypes" /> ' + result.data[i].F_Name + '' +
  123. '</label>';
  124. $(html).appendTo(".Message_box");
  125. }
  126. }
  127. dtd.resolve(); // 改变Deferred对象的执行状态
  128. });
  129. return dtd.promise(); // 返回promise对象
  130. }*/
  131. //点击显示外呼
  132. $('.callout').click(function(){
  133. // if($("#top-search li",window.parent.document).find('i',window.parent.document).hasClass('active')){
  134. if($(".WH",window.parent.parent.document).hasClass("fadeOutUp")) {
  135. $(".WH",window.parent.parent.document).removeClass("fadeOutUp").addClass("fadeInDown");
  136. }
  137. $('.WH', window.parent.parent.document).removeClass('hidens')
  138. $('.first', window.parent.parent.document).removeClass('first');
  139. $('.WH', window.parent.parent.document).addClass('first');
  140. $("#Result",window.parent.parent.document).val($('#cl_khdh').text());
  141. window.parent.parent.loadWH();
  142. // }
  143. })
  144. //获取工单信息
  145. function getWorkOrderInfo(oid) {
  146. $.ajax({
  147. type: "get",
  148. url: huayi.config.callcenter_url + "WorkOrder/GetWorkOrder",
  149. async: true,
  150. dataType: 'json',
  151. data: {
  152. orderid: oid,
  153. token: $.cookie("token")
  154. },
  155. success: function(data) {
  156. /*验证请求*/
  157. if(data.state == "success") {
  158. var con = data;
  159. var Str = con.data.data;
  160. $('#cl_gdbh').text(Str[0].WorkOrderID); //工单编号
  161. //$("#cl_gdlx").text(getTypeName(Str[0].Type)); //工单类型
  162. $("#cl_khxm").val(Str[0].Customer); //姓名
  163. $("#cl_khdh").text(Str[0].CustomerTel); //电话
  164. $("#t_county").val(Str[0].County); //乡镇或单位
  165. $("#t_address").val(Str[0].Address); //地址
  166. $("#t_inqtime").val(Str[0].Inqtime && Str[0].Inqtime.split(' ')[0]); //调查时间
  167. $("#t_inquser").val(Str[0].Inquser); //调查员
  168. $("#t_detail").val(Str[0].Detail); //string 是 反映问题
  169. $("#t_answer").val(Str[0].Answer); //string 否 回访反馈情况
  170. $("#t_remarks").val(Str[0].Remark); //string 否 备注
  171. $('#xl_box').val(Str[0].InfoType); //信息分类
  172. $(".xl_boxs").val(Str[0].Unit); //交办单位
  173. //$("#xl_box").val(Str[0].UnitID); //交办单位
  174. //$('.Message_box').find('input[value="' + Str[0].InfoTypeID + '"]').attr('checked', true); //信息分类
  175. var Files = data.data.data[0].File;
  176. console.log(data);
  177. $("#IMG_box").empty();
  178. if(Files && Files.length > 0) {
  179. $(Files).each(function(i, n) {
  180. var fileType = n.F_FileType;
  181. var fileType1 = n.F_FileType.split("\/")[0];
  182. if (fileType === '.jpg'||fileType === '.png'||fileType1==='image') {
  183. $('<div class="img-box">' +
  184. '<span class="img_mask"><span onclick=downloadFile("'+ n.F_FileUrl + '","' + n.F_FileName + '","' + n.F_FileType +
  185. '") title="点击下载"><i class="fa fa-download" aria-hidden="true"></i></span></span>' +
  186. '<img layer-src="' + n.F_FileUrl + '" src="' + n.F_FileUrl + '" alt="' + n.F_FileName +
  187. '" class="image-item" /><div>').appendTo("#IMG_box");
  188. } else {
  189. $('<div class="img-box">' +
  190. '<span class="img_mask"><span href="javascript:;" onclick=downloadFile("' + n.F_FileUrl + '","' + n.F_FileName +
  191. '","' + n.F_FileType +
  192. '") title="点击下载"><i class="glyphicon glyphicon-download-alt" aria-hidden="true"></i></span></span>' +
  193. '<div class="noThumb" title="文件"><i class="glyphicon glyphicon-paperclip"></i><p class="file_list">无法预览</p></div>' +
  194. '</div>').appendTo("#IMG_box");
  195. }
  196. });
  197. layer.photos({
  198. photos: '#IMG_box',
  199. anim: 5, //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  200. title: '查看图片',
  201. move: '.layui-layer-title',
  202. shadeClose: false,
  203. closeBtn: 1,
  204. area: ['80%', '90%'],
  205. tab: function(pic, layero) {
  206. // $('.layui-layer-content').on("mousewheel", function(e, d) {
  207. //
  208. // helper.methods.zoomImg($('#layui-layer-photos').find('img[alt="' + pic.alt + '"]'), d);
  209. // $('#layui-layer-photos').find('img[alt="' + pic.alt + '"]').dragging({
  210. // move: "both", //拖动方向,x y both
  211. // randomPosition: false //初始位置是否随机
  212. // });
  213. // return false;
  214. //
  215. // });
  216. helper.methods.initLayerPhotos('#layui-layer-photos', pic, layero);
  217. },
  218. });
  219. }
  220. // var Files = Str[0].Files;
  221. // if(Files) {
  222. // var a;
  223. // var b;
  224. // $(Files).each(function(i, n) {
  225. // a = n.F_FileType.split("\/")[0];
  226. // b = n.F_FileName.split(".")[1];
  227. // console.log(a);
  228. // if(a == 'image') {
  229. // $('<div class="img-box"><a href="+' + n.F_FileUrl + '" download="' + n.F_FileName + '"><img src="' + n.F_FileUrl + '" alt="" class="image-item" data-preview-group="1" /><span class="">' + b + '</span></a><div>').appendTo(".space");
  230. // } else {
  231. // $('<div class="img-box "><a href="+' + n.F_FileUrl + '" download="' + n.F_FileName + '"><span class="">' + b + '</span></a><div>').appendTo(".space");
  232. // }
  233. //
  234. // })
  235. // }
  236. }
  237. }
  238. });
  239. }
  240. /*
  241. //获取工单类型
  242. function getTypeName(val) {
  243. var str = '';
  244. switch(val + '') {
  245. case '1':
  246. str = "咨询";
  247. break;
  248. case '2':
  249. str = "报修服务";
  250. break;
  251. case '3':
  252. str = "投诉建议";
  253. break;
  254. }
  255. return str;
  256. }
  257. //获取部门
  258. var setting = {
  259. data: {
  260. key: {
  261. name: "F_DeptName"
  262. },
  263. simpleData: {
  264. enable: true,
  265. idKey: "F_DeptId",
  266. pIdKey: "F_ParentId",
  267. rootPId: 0
  268. }
  269. },
  270. callback: {
  271. onClick: zTreeOnClick
  272. }
  273. };
  274. function getBM(obj) {
  275. $.getJSON(huayi.config.callcenter_url + 'Department/GetAllList', {
  276. token: $.cookie("token")
  277. }, function(result) {
  278. if(result.state.toLowerCase() == "success") {
  279. $.fn.zTree.init(obj, setting, result.data);
  280. }
  281. })
  282. }
  283. function zTreeOnClick(event, treeId, treeNode) {
  284. if(event) {
  285. event.stopPropagation();
  286. }
  287. var obj = $("#" + event.data.treeId).parent();
  288. obj.parent().find("input").eq(0).val(treeNode.F_DeptName);
  289. obj.parent().find("input").eq(1).val(treeNode.F_DeptId);
  290. obj.hide();
  291. getRY($(".clid"), $("#clbm").val());
  292. };
  293. //获取人员
  294. function getRY(obj, deptid) {
  295. obj.empty();
  296. obj.append('<li itemid="">--请选择--</li>');
  297. obj.parent().parent().find("input").eq(0).val("--请选择--");
  298. obj.parent().parent().find("input").eq(1).val("");
  299. $.getJSON(huayi.config.callcenter_url + 'UserAccount/GetDeptUserList', {
  300. deptid: deptid,
  301. token: $.cookie("token")
  302. }, function(result) {
  303. if(result.state.toLowerCase() == "success") {
  304. $(result.data).each(function(i, n) {
  305. obj.append('<li itemid="' + n.F_UserId + '">' + n.F_UserName + '</li>');
  306. });
  307. obj.find("li").click(function(event) {
  308. if(event) {
  309. event.stopPropagation();
  310. }
  311. $(this).parent().parent().parent().find("input").eq(0).val($(this).text());
  312. $(this).parent().parent().parent().find("input").eq(1).val($(this).attr("itemid"));
  313. $(this).parent().parent().hide();
  314. });
  315. }
  316. })
  317. }*/
  318. //处理
  319. function dealWorkOrder(oid) {
  320. var infotype=$('#xl_box').find('option:selected').text();
  321. var unit=$('#xl_boxs').find('option:selected').text();
  322. if(infotype=='请选择'){
  323. infotype=''
  324. }
  325. if(unit=='请选择'){
  326. unit=''
  327. }
  328. $.post(huayi.config.callcenter_url + 'WorkOrder/DealWorkOrder', {
  329. orderid: oid, //string 是 工单编号
  330. customer: $('#cl_khxm').val(), //string 是 客户姓名
  331. country: $('#t_county').val(), //string 否 乡镇或单位
  332. //country: $("#t_county").find("option:selected").text(),
  333. address: $('#t_address').val(), //string 否 住址
  334. inqtime: $('#t_inqtime').val(), //string 否 调查时间
  335. inquser: $('#t_inquser').val(), //string 否 调查员
  336. detail: $('#t_detail').val(), //string 是 反映问题
  337. answer: $('#t_answer').val(), //string 否 回访反馈情况
  338. remark: $('#t_remarks').val(), //string 否 备注
  339. cont: $("#cont").val(), //string 否 问题处理情况
  340. isend: $("input[name='ltype']:checked").val(), //int 是 是否结束 0否,1是
  341. unit: unit, //string 否 交办单位
  342. infotype: infotype, //string 否 信息分类
  343. clbm: $("#t_unit").val(), //string 否 处理部门
  344. clgh: $("#t_clr").val(), //string 否 处理人
  345. /*clbm: $("#clbm").val(), //int 否 处理部门
  346. clid: $("#clid").val(), //int 否 处理人
  347. cont: $("#cont").val(), //string 否 问题处理情况
  348. infotypeid: $("input[name='ltypes']:checked").val(), //int 否 信息分类id,默认为0
  349. unitid: $("#xl_box").val(), //int 否 交办单位id,默认为0*/
  350. token: $.cookie("token")
  351. }, function(result) {
  352. result = $.parseJSON(result);
  353. if(result.state.toLowerCase() == "success") {
  354. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  355. parent.layer.close(index); //再执行关闭
  356. parent.initTable();
  357. parent.Hiden();
  358. parent.layer.msg("处理工单成功");
  359. }
  360. })
  361. }
  362. //下拉选项
  363. //20180518byfanlongfei将处理部门、处理人、信息分类、交办单位修改为文本框;
  364. getBM($("#zrbmtree"));
  365. getBM($("#clbmtree"));
  366. //标签切换
  367. $(".ldtp-cr ul.ld-service li").click(function() {
  368. $(this).addClass("cr-click").siblings().removeClass("cr-click");
  369. var index = $(this).index();
  370. $(".gsxx").find(".sqzx").eq(index).addClass("Shows").siblings().removeClass("Shows");
  371. if(index == 2) {
  372. getLX($(".tslx"), "TSLX");
  373. getBM($("#zrbmtree"));
  374. getBM($("#clbmtree"));
  375. }
  376. });
  377. //tree下拉框效果
  378. $(".inpBox .tree").click(function() {
  379. if($(this).parent().find(".addTree").is(":hidden")) {
  380. $(this).parent().find(".addTree").show();
  381. } else {
  382. $(this).parent().find(".addTree").hide();
  383. }
  384. });
  385. //普通下拉框效果
  386. $(".inpBox .select").click(function() {
  387. if($(this).parent().find(".xl_common").is(":hidden")) {
  388. $(this).parent().find(".xl_common").show();
  389. } else {
  390. $(this).parent().find(".xl_common").hide();
  391. }
  392. });
  393. $(".xl").click(function() {
  394. if($(this).parent().find(".addTree").is(":hidden")) {
  395. $(this).parent().find(".addTree").show();
  396. } else {
  397. $(this).parent().find(".addTree").hide();
  398. }
  399. if($(this).parent().find(".xl_common").is(":hidden")) {
  400. $(this).parent().find(".xl_common").show();
  401. } else {
  402. $(this).parent().find(".xl_common").hide();
  403. }
  404. });
  405. $(".inpBox").mouseleave(function() {
  406. $(this).children(".xl_common").hide();
  407. $(this).children(".addTree").hide();
  408. })
  409. //删除
  410. $(".inpBox").hover(function(event) {
  411. $(this).children(".de_icon").show();
  412. event.stopPropagation();
  413. }, function() {
  414. $(this).children(".de_icon").hide();
  415. });
  416. $(".de_icon").click(function(event) {
  417. event.stopPropagation();
  418. $(this).siblings("input").eq(0).val("");
  419. $(this).siblings("input").eq(1).val("");
  420. if($(this).siblings("div").find("ul").attr("id") == "zrbmtree") {
  421. getRY($(".zrid"), $("#zrbm").val());
  422. }
  423. if($(this).siblings("div").find("ul").attr("id") == "clbmtree") {
  424. getRY($(".clid"), $("#clbm").val());
  425. }
  426. });
  427. //20180518byfanlongfei将处理部门、处理人、信息分类、交办单位修改为文本框;
  428. //获取部门
  429. var setting = {
  430. data: {
  431. key: {
  432. name: "F_DeptName"
  433. },
  434. simpleData: {
  435. enable: true,
  436. idKey: "F_DeptId",
  437. pIdKey: "F_ParentId",
  438. rootPId: 0
  439. }
  440. },
  441. callback: {
  442. onClick: zTreeOnClick
  443. }
  444. };
  445. function getBM(obj) {
  446. $.getJSON(huayi.config.callcenter_url + 'Department/GetAllList', {
  447. "token": $.cookie("token")
  448. }, function(result) {
  449. if(result.state.toLowerCase() == "success") {
  450. $.fn.zTree.init(obj, setting, result.data);
  451. }
  452. })
  453. }
  454. var did; //部门id
  455. function zTreeOnClick(event, treeId, treeNode) {
  456. did = treeNode.F_DeptId;
  457. if(event) {
  458. event.stopPropagation();
  459. }
  460. var obj = $("#" + event.data.treeId).parent();
  461. obj.parent().find("input").eq(0).val(treeNode.F_DeptName);
  462. obj.parent().find("input").eq(1).val(treeNode.F_DeptId);
  463. obj.hide();
  464. if(event.data.treeId == "zrbmtree") {
  465. getRY($(".zrid"), $("#zrbm").val());
  466. }
  467. if(event.data.treeId == "clbmtree") {
  468. getRY($(".clid"), $("#clbm").val());
  469. }
  470. };
  471. //获取人员
  472. function getRY(obj, deptid) {
  473. obj.empty();
  474. obj.append('<li itemid="">--请选择--</li>');
  475. obj.parent().parent().find("input").eq(0).val("--请选择--");
  476. obj.parent().parent().find("input").eq(1).val("");
  477. $.getJSON(huayi.config.callcenter_url + 'UserAccount/GetDeptUserList', {
  478. "deptid": deptid,
  479. "token": $.cookie("token")
  480. }, function(result) {
  481. if(result.state.toLowerCase() == "success") {
  482. $(result.data).each(function(i, n) {
  483. obj.append('<li itemid="' + n.F_UserId + '">' + n.F_UserName + '</li>');
  484. })
  485. obj.find("li").click(function(event) {
  486. if(event) {
  487. event.stopPropagation();
  488. }
  489. $(this).parent().parent().parent().find("input").eq(0).val($(this).text());
  490. $(this).parent().parent().parent().find("input").eq(1).val($(this).attr("itemid"));
  491. $(this).parent().parent().hide();
  492. });
  493. }
  494. })
  495. }
  496. //获取类型
  497. function getLX(obj, type) {
  498. obj.empty();
  499. $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  500. "flag": type,
  501. "token": $.cookie("token")
  502. }, function(result) {
  503. if(result.state.toLowerCase() == "success") {
  504. $(result.data).each(function(i, n) {
  505. obj.append('<li itemid="' + n.F_DictionaryValueId + '">' + n.F_Name + '</li>');
  506. })
  507. obj.find("li").click(function(event) {
  508. if(event) {
  509. event.stopPropagation();
  510. }
  511. $(this).parent().parent().parent().find("input").eq(0).val($(this).text());
  512. $(this).parent().parent().parent().find("input").eq(1).val($(this).attr("itemid"));
  513. $(this).parent().parent().hide();
  514. });
  515. }
  516. })
  517. }
  518. //下载
  519. function downloadFile(data, strFileName, strMimeType) {
  520. console.log(111)
  521. event.preventDefault();
  522. //详细见文档 http://danml.com/download.html
  523. var x = new XMLHttpRequest();
  524. x.open("GET", data, true);
  525. x.responseType = 'blob';
  526. x.onload = function(e) {
  527. download(x.response, strFileName, strMimeType);
  528. }
  529. x.send();
  530. }