Sin descripción

AddWorkOrder.js 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. /**
  2. * 手制工单
  3. * */
  4. $(document).ready(function() {
  5. //var nDtime = helper.DateFormat.getNowDate(); //当前时间
  6. autosize($('textarea'));
  7. helper.getDropList.getlistDropByDic($('#t_county'), 'JBDW'); //获取乡镇或单位下拉
  8. $('#t_investigator').val($.cookie("u_code"));//给调查员默认值;当前用户的账号
  9. // helper.getDropList.getlistDropByDic($('#xl_boxs'), 'JBDW'); //获取交办单位下拉
  10. // helper.getDropList.getlistDropByDic($('#xl_box'), 'XXFL'); //信息分类
  11. laydate.render({
  12. elem: '#t_time',
  13. theme: '#1ab394',
  14. calendar: 'true',
  15. //value: nDtime
  16. //type: 'datetime'
  17. });
  18. /*
  19. * //20180518byfanlongfei将处理部门、处理人、信息分类、交办单位修改为文本框;
  20. getBM($("#zrbmtree"));
  21. getBM($("#clbmtree"));
  22. //标签切换
  23. $(".ldtp-cr ul.ld-service li").click(function() {
  24. $(this).addClass("cr-click").siblings().removeClass("cr-click");
  25. var index = $(this).index();
  26. $(".gsxx").find(".sqzx").eq(index).addClass("Shows").siblings().removeClass("Shows");
  27. if(index == 2) {
  28. getLX($(".tslx"), "TSLX");
  29. getBM($("#zrbmtree"));
  30. getBM($("#clbmtree"));
  31. }
  32. });
  33. //tree下拉框效果
  34. $(".inpBox .tree").click(function() {
  35. if($(this).parent().find(".addTree").is(":hidden")) {
  36. $(this).parent().find(".addTree").show();
  37. } else {
  38. $(this).parent().find(".addTree").hide();
  39. }
  40. });
  41. //普通下拉框效果
  42. $(".inpBox .select").click(function() {
  43. if($(this).parent().find(".xl_common").is(":hidden")) {
  44. $(this).parent().find(".xl_common").show();
  45. } else {
  46. $(this).parent().find(".xl_common").hide();
  47. }
  48. });
  49. $(".xl").click(function() {
  50. if($(this).parent().find(".addTree").is(":hidden")) {
  51. $(this).parent().find(".addTree").show();
  52. } else {
  53. $(this).parent().find(".addTree").hide();
  54. }
  55. if($(this).parent().find(".xl_common").is(":hidden")) {
  56. $(this).parent().find(".xl_common").show();
  57. } else {
  58. $(this).parent().find(".xl_common").hide();
  59. }
  60. });
  61. $(".inpBox").mouseleave(function() {
  62. $(this).children(".xl_common").hide();
  63. $(this).children(".addTree").hide();
  64. })
  65. //删除
  66. $(".inpBox").hover(function(event) {
  67. $(this).children(".de_icon").show();
  68. event.stopPropagation();
  69. }, function() {
  70. $(this).children(".de_icon").hide();
  71. });
  72. $(".de_icon").click(function(event) {
  73. event.stopPropagation();
  74. $(this).siblings("input").eq(0).val("");
  75. $(this).siblings("input").eq(1).val("");
  76. if($(this).siblings("div").find("ul").attr("id") == "zrbmtree") {
  77. getRY($(".zrid"), $("#zrbm").val());
  78. }
  79. if($(this).siblings("div").find("ul").attr("id") == "clbmtree") {
  80. getRY($(".clid"), $("#clbm").val());
  81. }
  82. });
  83. //创建咨询工单
  84. $(".Cj").click(function() {
  85. var tskh = $("#zxrs").val(); //咨询人:
  86. var tsdh = $("#zxdhs").val(); //咨询电话
  87. var cont = $("#zxnrs").val(); //咨询内容
  88. var clcont = $("#jdnrs").val(); //内容
  89. var type = "1";
  90. if(!telreg.test($.trim(tsdh))) {
  91. layer.confirm('请输入正确格式的咨询电话!', {
  92. icon: 2,
  93. btn: ['确定'] //按钮
  94. });
  95. return;
  96. }
  97. if(!clcont) {
  98. layer.confirm('请输入处理内容!', {
  99. icon: 2,
  100. btn: ['确定']
  101. });
  102. return;
  103. }
  104. $.post(huayi.config.callcenter_url + 'CallInScreen/AddWorkOrder', {
  105. tskh: tskh,
  106. tsdh: tsdh,
  107. cont: cont,
  108. clcont: clcont,
  109. type: type,
  110. "token": $.cookie("token")
  111. }, function(result) {
  112. result = $.parseJSON(result);
  113. if(result.state.toLowerCase() == "success") {
  114. $("#zxrs").val(''); //咨询人:
  115. $("#zxdhs").val(''); //咨询电话
  116. $("#zxnrs").val(''); //咨询内容
  117. $("#jdnrs").val(''); //内容
  118. layer.msg("咨询工单创建成功!");
  119. }
  120. })
  121. })
  122. */
  123. //创建工单
  124. $(".addts").click(function() {
  125. var telreg = /^\d{3,12}$/;
  126. var tskh = $("#tskh").val();
  127. var tsdh = $("#tsdh").val();
  128. // var clbm = $("#clbm").val();
  129. // var clid = $("#clid").val();
  130. var cont = $("#cont").val();
  131. // if(!tskh) {
  132. // layer.confirm('请输入客户姓名!', {
  133. // icon: 2,
  134. // btn: ['确定']
  135. // });
  136. // return;
  137. // }
  138. if(!telreg.test($.trim(tsdh))) {
  139. layer.confirm('请输入正确格式的电话!', {
  140. icon: 2,
  141. btn: ['确定'] //按钮
  142. });
  143. return;
  144. }
  145. // if(!$('#t_detail').val()) {
  146. // layer.confirm('请输入反映问题!', {
  147. // icon: 2,
  148. // btn: ['确定']
  149. // });
  150. // return;
  151. // }
  152. $.post(huayi.config.callcenter_url + 'CallInScreen/AddWorkOrder', {
  153. //file //string 否 附件
  154. khid: 0, //int 否 客户id
  155. callid: 0, //string 否
  156. source: 1, //string 是 工单来源
  157. customer: tskh, //string 是 客户姓名
  158. custel: tsdh, //string 是 电话
  159. country: $('#t_county').val(), //string 否 乡镇或单位
  160. address: $('#t_address').val(), //string 否 住址
  161. inqtime: $('#t_time').val(), //string 否 调查时间
  162. inquser: $('#t_investigator').val(), //string 否 调查员
  163. // clbm: clbm, //int 否 处理部门
  164. // clid: clid, //int 否 处理人
  165. // infotypeid: $("#xl_box").val(), //int 否 信息分类id,默认为0
  166. // unitid: $("#xl_boxs").val(), //int 否 交办单位id,默认为0
  167. clbm: $('#clbmname').val(), //string 否 处理部门
  168. clid: $('#clidname').val(), //string 否 处理人
  169. infotype: $("#xl_box").val(), //string 否 信息分类id,默认为0
  170. unit: $("#xl_boxs").val(), //string 否 交办单位id,默认为0
  171. detail: $('#t_detail').val(), //string 是 反映问题
  172. answer: $('#t_answer').val(), //string 否 回访反馈情况
  173. cont: cont, //string 否 问题处理情况
  174. remark: $('#t_remarks').val(), //string 否 备注
  175. token: $.cookie("token")
  176. }, function(result) {
  177. result = $.parseJSON(result);
  178. if(result.state.toLowerCase() == "success") {
  179. clean();
  180. layer.msg("创建工单成功");
  181. }
  182. })
  183. })
  184. });
  185. /*
  186. //20180518byfanlongfei将处理部门、处理人、信息分类、交办单位修改为文本框;
  187. //获取部门
  188. var setting = {
  189. data: {
  190. key: {
  191. name: "F_DeptName"
  192. },
  193. simpleData: {
  194. enable: true,
  195. idKey: "F_DeptId",
  196. pIdKey: "F_ParentId",
  197. rootPId: 0
  198. }
  199. },
  200. callback: {
  201. onClick: zTreeOnClick
  202. }
  203. };
  204. function getBM(obj) {
  205. $.getJSON(huayi.config.callcenter_url + 'Department/GetAllList', {
  206. "token": $.cookie("token")
  207. }, function(result) {
  208. if(result.state.toLowerCase() == "success") {
  209. $.fn.zTree.init(obj, setting, result.data);
  210. }
  211. })
  212. }
  213. function zTreeOnClick(event, treeId, treeNode) {
  214. if(event) {
  215. event.stopPropagation();
  216. }
  217. var obj = $("#" + event.data.treeId).parent();
  218. obj.parent().find("input").eq(0).val(treeNode.F_DeptName);
  219. obj.parent().find("input").eq(1).val(treeNode.F_DeptId);
  220. obj.hide();
  221. if(event.data.treeId == "zrbmtree") {
  222. getRY($(".zrid"), $("#zrbm").val());
  223. }
  224. if(event.data.treeId == "clbmtree") {
  225. getRY($(".clid"), $("#clbm").val());
  226. }
  227. };
  228. //获取人员
  229. function getRY(obj, deptid) {
  230. obj.empty();
  231. obj.append('<li itemid="">--请选择--</li>');
  232. obj.parent().parent().find("input").eq(0).val("--请选择--");
  233. obj.parent().parent().find("input").eq(1).val("");
  234. $.getJSON(huayi.config.callcenter_url + 'UserAccount/GetDeptUserList', {
  235. "deptid": deptid,
  236. "token": $.cookie("token")
  237. }, function(result) {
  238. if(result.state.toLowerCase() == "success") {
  239. $(result.data).each(function(i, n) {
  240. obj.append('<li itemid="' + n.F_UserId + '">' + n.F_UserName + '</li>');
  241. })
  242. obj.find("li").click(function(event) {
  243. if(event) {
  244. event.stopPropagation();
  245. }
  246. $(this).parent().parent().parent().find("input").eq(0).val($(this).text());
  247. $(this).parent().parent().parent().find("input").eq(1).val($(this).attr("itemid"));
  248. $(this).parent().parent().hide();
  249. });
  250. }
  251. })
  252. }
  253. //获取类型
  254. function getLX(obj, type) {
  255. obj.empty();
  256. $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  257. "flag": type,
  258. "token": $.cookie("token")
  259. }, function(result) {
  260. if(result.state.toLowerCase() == "success") {
  261. $(result.data).each(function(i, n) {
  262. obj.append('<li itemid="' + n.F_DictionaryValueId + '">' + n.F_Name + '</li>');
  263. })
  264. obj.find("li").click(function(event) {
  265. if(event) {
  266. event.stopPropagation();
  267. }
  268. $(this).parent().parent().parent().find("input").eq(0).val($(this).text());
  269. $(this).parent().parent().parent().find("input").eq(1).val($(this).attr("itemid"));
  270. $(this).parent().parent().hide();
  271. });
  272. }
  273. })
  274. }
  275. */
  276. //清空表单
  277. function clean() {
  278. $('.form-control').val('');
  279. $('input[readonly]').val('');
  280. }