Нет описания

WorkDeal.js 12KB

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