Нет описания

WorkDeal.js 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. /**
  2. * 工单处理
  3. * */
  4. $(document).ready(function() {
  5. var deptId = '';
  6. var ID = helper.request.queryString("str");
  7. laydate.render({
  8. elem: '#t_inqtime',
  9. theme: '#1ab394',
  10. calendar: 'true',
  11. });
  12. getDepartList($('#t_county')); //营业部
  13. getDepartList($('#clbmname')); //部门
  14. autosize($('textarea'));
  15. $('#t_investigator').val($.cookie("u_code")); //给调查员默认值;当前用户的账号
  16. helper.getDropList.getlistDropByDic($('#xl_boxs'), 'ZBDW'); //获取交办单位下拉
  17. helper.getDropList.getlistDropByDic($('#xl_box'), 'WTFL')
  18. .then(function() {
  19. if (ID) {
  20. getWorkOrderInfo(ID); //获取工单信息
  21. }
  22. }); //信息分类
  23. // helper.getDropList.getlistDropByDic($('#t_county'), 'JBDW')
  24. // .then(function() {
  25. // if(ID) {
  26. // getWorkOrderInfo(ID); //获取工单信息
  27. // }
  28. // });
  29. //点击确定
  30. $("#clgd").click(function() {
  31. dealWorkOrder(ID);
  32. });
  33. })
  34. //点击显示外呼
  35. $('.callout').click(function() {
  36. // if($("#top-search li",window.parent.document).find('i',window.parent.document).hasClass('active')){
  37. if ($(".WH", window.parent.parent.document).hasClass("fadeOutUp")) {
  38. $(".WH", window.parent.parent.document).removeClass("fadeOutUp").addClass("fadeInDown");
  39. }
  40. $('.WH', window.parent.parent.document).removeClass('hidens')
  41. $('.first', window.parent.parent.document).removeClass('first');
  42. $('.WH', window.parent.parent.document).addClass('first');
  43. $("#Result", window.parent.parent.document).val($('#cl_khdh').text());
  44. window.parent.parent.loadWH();
  45. // }
  46. })
  47. //获取工单信息
  48. function getWorkOrderInfo(oid) {
  49. $.ajax({
  50. type: "get",
  51. url: huayi.config.callcenter_url + "WorkOrder/GetWorkOrder",
  52. async: true,
  53. dataType: 'json',
  54. data: {
  55. orderid: oid,
  56. token: $.cookie("token")
  57. },
  58. success: function(data) {
  59. /*验证请求*/
  60. if (data.state == "success") {
  61. var con = data;
  62. var Str = con.data.data;
  63. $('#cl_gdbh').text(Str[0].WorkOrderID); //工单编号
  64. //$("#cl_gdlx").text(getTypeName(Str[0].Type)); //工单类型
  65. $("#cl_khxm").val(Str[0].Customer); //姓名
  66. $("#cl_khdh").text(Str[0].CustomerTel); //电话
  67. $("#t_county").val(Str[0].County); //营业部
  68. $("#t_address").val(Str[0].Address); //地址
  69. $("#t_inqtime").val(Str[0].Inqtime && Str[0].Inqtime.split(' ')[0]); //调查时间
  70. $("#t_inquser").val(Str[0].Inquser); //调查员
  71. $("#t_detail").val(Str[0].Detail); //string 是 反映问题
  72. $("#t_answer").val(Str[0].Answer); //string 否 回访反馈情况
  73. $("#t_remarks").val(Str[0].Remark); //string 否 备注
  74. $('#xl_box').val(Str[0].InfoTypeID); //问题分类
  75. $(".xl_boxs").val(Str[0].Unit); //交办单位
  76. $('#clbmname').val(Str[0].UnitID); //部门
  77. deptId = Str[0].UnitID
  78. if (deptId) {
  79. getUserListByDepartment($('#clidname'), deptId, con.data.item[0].ToUser)
  80. }
  81. if (Str[0].InfoType) {
  82. getInfotypedetail($('#xq_rdwt'), Str[0].InfoType, Str[0].InfoTypeDetailID)
  83. }
  84. // $("#clidname").val(Str[0].CreateUser); //处理人
  85. //$("#xl_box").val(Str[0].UnitID); //交办单位
  86. //$('.Message_box').find('input[value="' + Str[0].InfoTypeID + '"]').attr('checked', true); //信息分类
  87. var Files = data.data.data[0].File;
  88. console.log(data);
  89. $("#IMG_box").empty();
  90. if (Files && Files.length > 0) {
  91. $(Files).each(function(i, n) {
  92. var fileType = n.F_FileType;
  93. var fileType1 = n.F_FileType.split("\/")[0];
  94. if (fileType === '.jpg' || fileType === '.png' || fileType1 === 'image') {
  95. $('<div class="img-box">' +
  96. '<span class="img_mask"><span onclick=downloadFile("' + n
  97. .F_FileUrl + '","' + n.F_FileName + '","' + n.F_FileType +
  98. '") title="点击下载"><i class="fa fa-download" aria-hidden="true"></i></span></span>' +
  99. '<img layer-src="' + n.F_FileUrl + '" src="' + n.F_FileUrl +
  100. '" alt="' + n.F_FileName +
  101. '" class="image-item" /><div>').appendTo("#IMG_box");
  102. } else {
  103. $('<div class="img-box">' +
  104. '<span class="img_mask"><span href="javascript:;" onclick=downloadFile("' +
  105. n.F_FileUrl + '","' + n.F_FileName +
  106. '","' + n.F_FileType +
  107. '") title="点击下载"><i class="glyphicon glyphicon-download-alt" aria-hidden="true"></i></span></span>' +
  108. '<div class="noThumb" title="文件"><i class="glyphicon glyphicon-paperclip"></i><p class="file_list">无法预览</p></div>' +
  109. '</div>').appendTo("#IMG_box");
  110. }
  111. });
  112. layer.photos({
  113. photos: '#IMG_box',
  114. anim: 5, //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  115. title: '查看图片',
  116. move: '.layui-layer-title',
  117. shadeClose: false,
  118. closeBtn: 1,
  119. area: ['80%', '90%'],
  120. tab: function(pic, layero) {
  121. helper.methods.initLayerPhotos('#layui-layer-photos', pic, layero);
  122. },
  123. });
  124. }
  125. }
  126. }
  127. });
  128. }
  129. //处理
  130. function dealWorkOrder(oid) {
  131. var infotype = $('#xl_box').find('option:selected').text();
  132. var infotypedetail = $('#xq_rdwt').find('option:selected').text();
  133. if (infotype == '请选择') {
  134. infotype = ''
  135. }
  136. if (infotypedetail == '请选择') {
  137. infotypedetail = ''
  138. }
  139. if($('#cont').val() == '') {
  140. layer.confirm('请输入问题处理情况!', {
  141. icon: 2,
  142. btn: ['确定']
  143. });
  144. return;
  145. }
  146. $.post(huayi.config.callcenter_url + 'WorkOrder/DealWorkOrder', {
  147. orderid: oid, //string 是 工单编号
  148. customer: $('#cl_khxm').val(), //string 是 客户姓名
  149. country: $('#t_county').val(), //string 否 乡镇或单位
  150. //country: $("#t_county").find("option:selected").text(),
  151. address: $('#t_address').val(), //string 否 住址
  152. inqtime: $('#t_inqtime').val(), //string 否 调查时间
  153. inquser: $('#t_inquser').val(), //string 否 调查员
  154. detail: $('#t_detail').val(), //string 是 反映问题
  155. // answer: $('#t_answer').val(), //string 否 回访反馈情况
  156. cont: $('#cont').val(), //问题处理情况
  157. remark: $('#t_remarks').val(), //string 否 备注
  158. isend: $("input[name='ltype']:checked").val(), //int 是 是否结束 0否,1是
  159. isrestore: $("input[name='isT']:checked").val(), //是否修复
  160. unit: $("#clbmname").val(), //string 否 交办单位
  161. infotype: infotype, //string 否 信息分类
  162. infotypeid: $('#xl_box').val(),
  163. infotypedetail: infotypedetail,
  164. infotypedetailid: $('#xq_rdwt').val(),
  165. clbm: $("#clbmname").val(), //string 否 处理部门
  166. clgh: $("#clidname").val(), //string 否 处理人
  167. token: $.cookie("token")
  168. }, function(result) {
  169. result = $.parseJSON(result);
  170. if (result.state.toLowerCase() == "success") {
  171. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  172. parent.layer.close(index); //再执行关闭
  173. parent.initTable();
  174. parent.Hiden();
  175. parent.layer.msg("处理工单成功");
  176. }
  177. })
  178. }
  179. $('#xl_box').change(function() {
  180. getInfotypedetail($('#xq_rdwt'), $('#xl_box').find('option:selected').text())
  181. })
  182. function getInfotypedetail(obj, val, name) {
  183. $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByDescribe', {
  184. "token": $.cookie("token"),
  185. des: val
  186. }, function(result) {
  187. if (result.state.toLowerCase() == "success") {
  188. let str = '<option value="">请选择</option>'
  189. result.data.forEach(function(v, n) {
  190. str += '<option value="' + v.F_DictionaryValueId + '">' + v.F_Name + '</option>'
  191. })
  192. obj.html(str)
  193. if (name) {
  194. $('#xq_rdwt').val(name)
  195. }
  196. }
  197. })
  198. }
  199. //下拉选项
  200. //20180518byfanlongfei将处理部门、处理人、信息分类、交办单位修改为文本框;
  201. // getBM($("#zrbmtree"));
  202. // getBM($("#clbmtree"));
  203. //标签切换
  204. $(".ldtp-cr ul.ld-service li").click(function() {
  205. $(this).addClass("cr-click").siblings().removeClass("cr-click");
  206. var index = $(this).index();
  207. $(".gsxx").find(".sqzx").eq(index).addClass("Shows").siblings().removeClass("Shows");
  208. if (index == 2) {
  209. getLX($(".tslx"), "TSLX");
  210. getBM($("#zrbmtree"));
  211. getBM($("#clbmtree"));
  212. }
  213. });
  214. //tree下拉框效果
  215. $(".inpBox .tree").click(function() {
  216. if ($(this).parent().find(".addTree").is(":hidden")) {
  217. $(this).parent().find(".addTree").show();
  218. } else {
  219. $(this).parent().find(".addTree").hide();
  220. }
  221. });
  222. //普通下拉框效果
  223. $(".inpBox .select").click(function() {
  224. if ($(this).parent().find(".xl_common").is(":hidden")) {
  225. $(this).parent().find(".xl_common").show();
  226. } else {
  227. $(this).parent().find(".xl_common").hide();
  228. }
  229. });
  230. $(".xl").click(function() {
  231. if ($(this).parent().find(".addTree").is(":hidden")) {
  232. $(this).parent().find(".addTree").show();
  233. } else {
  234. $(this).parent().find(".addTree").hide();
  235. }
  236. if ($(this).parent().find(".xl_common").is(":hidden")) {
  237. $(this).parent().find(".xl_common").show();
  238. } else {
  239. $(this).parent().find(".xl_common").hide();
  240. }
  241. });
  242. $(".inpBox").mouseleave(function() {
  243. $(this).children(".xl_common").hide();
  244. $(this).children(".addTree").hide();
  245. })
  246. //删除
  247. $(".inpBox").hover(function(event) {
  248. $(this).children(".de_icon").show();
  249. event.stopPropagation();
  250. }, function() {
  251. $(this).children(".de_icon").hide();
  252. });
  253. $(".de_icon").click(function(event) {
  254. event.stopPropagation();
  255. $(this).siblings("input").eq(0).val("");
  256. $(this).siblings("input").eq(1).val("");
  257. if ($(this).siblings("div").find("ul").attr("id") == "zrbmtree") {
  258. getRY($(".zrid"), $("#zrbm").val());
  259. }
  260. if ($(this).siblings("div").find("ul").attr("id") == "clbmtree") {
  261. getRY($(".clid"), $("#clbm").val());
  262. }
  263. });
  264. //20180518byfanlongfei将处理部门、处理人、信息分类、交办单位修改为文本框;
  265. //获取部门
  266. //营业部(部门)
  267. function getDepartList(obj) {
  268. obj.empty();
  269. let str = '<option value="0">请选择</option>'
  270. $.getJSON(huayi.config.callcenter_url + 'CallOutPlan/GetDepartList', {
  271. "token": $.cookie("token")
  272. }, function(result) {
  273. if (result.state.toLowerCase() == "success") {
  274. result.data.forEach(function(v, n) {
  275. str += '<option value="' + v.F_DeptId + '">' + v.F_DeptName + '</option>'
  276. })
  277. obj.html(str)
  278. }
  279. })
  280. }
  281. //获取处理人员
  282. $('#clbmname').change(function() {
  283. getUserListByDepartment($('#clidname'), $('#clbmname').val())
  284. })
  285. function getUserListByDepartment(obj, deptid, name) {
  286. obj.empty();
  287. let str = ''
  288. $.getJSON(huayi.config.callcenter_url + 'CallInScreen/getUserListByDepartment', {
  289. "token": $.cookie("token"),
  290. deptid: deptid
  291. }, function(result) {
  292. if (result.state.toLowerCase() == "success") {
  293. result.data.forEach(function(v, n) {
  294. str += '<option value="' + v.F_UserCode + '">' + v.F_UserName + '</option>'
  295. })
  296. obj.html(str)
  297. if (name) {
  298. $("#clidname").val(name)
  299. }
  300. }
  301. })
  302. }
  303. //获取类型
  304. function getLX(obj, type) {
  305. obj.empty();
  306. $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  307. "flag": type,
  308. "token": $.cookie("token")
  309. }, function(result) {
  310. if (result.state.toLowerCase() == "success") {
  311. $(result.data).each(function(i, n) {
  312. obj.append('<li itemid="' + n.F_DictionaryValueId + '">' + n.F_Name + '</li>');
  313. })
  314. obj.find("li").click(function(event) {
  315. if (event) {
  316. event.stopPropagation();
  317. }
  318. $(this).parent().parent().parent().find("input").eq(0).val($(this).text());
  319. $(this).parent().parent().parent().find("input").eq(1).val($(this).attr("itemid"));
  320. $(this).parent().parent().hide();
  321. });
  322. }
  323. })
  324. }
  325. //下载
  326. function downloadFile(data, strFileName, strMimeType) {
  327. console.log(111)
  328. event.preventDefault();
  329. //详细见文档 http://danml.com/download.html
  330. var x = new XMLHttpRequest();
  331. x.open("GET", data, true);
  332. x.responseType = 'blob';
  333. x.onload = function(e) {
  334. download(x.response, strFileName, strMimeType);
  335. }
  336. x.send();
  337. }