ZZDianXin_UI - 郑州电信 演示

xgWork.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. var typeSmall;
  2. var id = helper.request.queryString("id");
  3. $(document).ready(function () {
  4. $.ajax({
  5. type: "get",
  6. url: huayi.config.callcenter_url + "CallInScreen/GetCurrUserDep",
  7. dataType: 'json',
  8. async: false,
  9. data: {
  10. token: $.cookie("token")
  11. },
  12. success: function(data) {
  13. if(data.state.toLowerCase() == 'success') {
  14. if(data.data.groname == '思念组') {
  15. $(".snRmove").remove();
  16. $(".dkRmove").show();
  17. } else {
  18. $(".snRmove").show();
  19. $(".complainDiv2").hide();
  20. $(".dkRmove").remove();
  21. $(".ns-2").remove();
  22. }
  23. }
  24. }
  25. });
  26. $.ajax({
  27. type: "get",
  28. url: huayi.config.callcenter_url + "UserAccount/GetNowUser",
  29. dataType: 'json',
  30. async: true,
  31. data: {
  32. token: $.cookie("token")
  33. },
  34. success: function(data) {
  35. if(data.state.toLowerCase() == 'success') {
  36. if(data.data.user.F_SeartGroup == '楼下组') {
  37. $('.up_floor').css('display','none')
  38. }
  39. }
  40. }
  41. });
  42. var groupcode = $('#groupcode', top.document).val();
  43. if (groupcode == 'SCZ') {
  44. $("#usedate").text("饮用日期:");
  45. $("#vipid").text("对接人:");
  46. $("#vipphone").text("对接人电话:");
  47. }
  48. laydate.render({
  49. elem: '.userDate',
  50. theme: '#1ab394',
  51. calendar: 'true'
  52. });
  53. laydate.render({
  54. elem: '.buyDate',
  55. theme: '#1ab394',
  56. calendar: 'true'
  57. });
  58. laydate.render({
  59. elem: '#productDate',
  60. theme: '#1ab394',
  61. calendar: 'true'
  62. });
  63. $.ajaxSettings.async = false;
  64. //工单来源
  65. // getOrderSource();
  66. //工单类型
  67. getOrderType();
  68. //定责
  69. complaintType();
  70. //派单类型
  71. consultType();
  72. //客户类别
  73. getProductType();
  74. //营业厅名称
  75. getAreaType();
  76. //客诉专员
  77. // ComplaintVip();
  78. //保存
  79. $('.customerSubmit').click(function() {
  80. saveCustomer();
  81. });
  82. $.ajaxSettings.async = true;
  83. var id = helper.request.queryString("id");
  84. $.ajax({
  85. type: "get",
  86. url: huayi.config.callcenter_url + "WorkOrder/GetWorkOrder",
  87. dataType: 'json',
  88. async: true,
  89. cache: false,
  90. data: {
  91. "workid": id,
  92. "token": $.cookie("token")
  93. },
  94. success: function(result) {
  95. if (result.data.data.length > 0) {
  96. var data = result.data.data[0];
  97. $('#name').val(data.F_CusName); //姓名
  98. $('#tel').val(data.F_CusPhone); //号码
  99. $('#typeclass').val(data.F_Definition)//营业厅名称
  100. $('#productType').val(data.F_Customertype)//客户类别
  101. $('.orderType').val(data.F_Typeof)//工单类型
  102. $('#complaintType1').val(data.F_Fixduty)//定责
  103. $('#complaintType2').val(data.F_Pietype)//派单类型
  104. $('#dealing').val(data.F_Dealing)//处理人姓名
  105. $('#dealingtel').val(data.F_Dealingtel)//处理人姓名
  106. $('#DicValueList').val(data.F_Source + ''); //工单来源
  107. $('#content').val(data.F_Content); //事件描述
  108. $('#replycontent').val(data.F_Replycontent); //事件描述
  109. $('#remark').val(data.F_Remark); //备注
  110. $("#disposeST").text(data.DealStateName); //处理状态
  111. $("#dealCont").text(data.F_DealResult); //处理结果
  112. $("#cont").text(data.F_DealDes); //客诉进展详述
  113. }
  114. }
  115. });
  116. $(".complaintType2").change(function () {
  117. typeSmall=$(".complaintType2").val();
  118. });
  119. $(".complaintType1").change(function () {
  120. typeSmall=$(".complaintType1").val();
  121. });
  122. $('.areaDown').click(function() {
  123. if ($('.treeList1').css('display') == 'block') {
  124. $('.treeList1').css('display', 'none')
  125. } else {
  126. $('.treeList1').css('display', 'block')
  127. }
  128. })
  129. $('#typeclass').click(function() {
  130. $('.treeList1').css('display', 'block')
  131. })
  132. $('.treeList1').mouseleave(function() {
  133. $(this).css('display', 'none')
  134. })
  135. //获取专员手机号
  136. // $("#vipName").change(function() {
  137. // $("#vipTel").val($("#vipName option:selected").attr("index"));
  138. // //$("#areaInps").val($("#vipName option:selected").attr("areaText"));
  139. // $("#typeclass").val($("#vipName option:selected").attr("province") + "/" + $("#vipName option:selected").attr("city"));
  140. // $(".inps2").val($("#vipName option:selected").attr("province"));
  141. // $(".inps3").val($("#vipName option:selected").attr("city"));
  142. // });
  143. })
  144. //处理状态
  145. dealState();
  146. function dealState() {
  147. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  148. "token": $.cookie("token"),
  149. flag: "CLZT"
  150. }, function(result) {
  151. result = $.parseJSON(result);
  152. var Count = result.data;
  153. $(Count).each(function(i, n) {
  154. $('<label style="font-weight: normal; margin-right: 15px;">'+
  155. '<input type="radio" value="' + n.F_DictionaryValueId
  156. + '" name="ltype"/>' + n.F_Name
  157. + '</label>').appendTo($(".disposeST"));
  158. })
  159. $('.disposeST input:radio:first').attr('checked', 'checked');
  160. });
  161. }
  162. //响应状态
  163. //responseState();
  164. //function responseState() {
  165. // $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  166. // "token": $.cookie("token"),
  167. // flag: "XYZT"
  168. // }, function(result) {
  169. // result = $.parseJSON(result);
  170. // var Count = result.data;
  171. // $(Count).each(function(i, n) {
  172. // $('<label style="font-weight: normal; margin-right: 15px;">'+
  173. // '<input type="radio" value="' + n.F_DictionaryValueId
  174. // + '" name="response"/>' + n.F_Name
  175. // + '</label>').appendTo($(".responseST"));
  176. // })
  177. // $('.responseST input:radio:first').attr('checked', 'checked');
  178. // });
  179. //}
  180. //工单类型
  181. function getOrderType() {
  182. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  183. "token": $.cookie("token"),
  184. flag: "GDLX"
  185. }, function(result) {
  186. result = $.parseJSON(result);
  187. var Count = result.data;
  188. $(Count).each(function(i, n) {
  189. $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($(".orderType"));
  190. })
  191. });
  192. }
  193. //定责
  194. function complaintType() {
  195. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  196. "token": $.cookie("token"),
  197. flag: "DYZE"
  198. }, function(result) {
  199. result = $.parseJSON(result);
  200. var Count = result.data;
  201. $(Count).each(function(i, n) {
  202. $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($(".complaintType1"));
  203. })
  204. });
  205. }
  206. //派单类型
  207. function consultType() {
  208. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  209. "token": $.cookie("token"),
  210. flag: "PDLX"
  211. }, function(result) {
  212. result = $.parseJSON(result);
  213. var Count = result.data;
  214. $(Count).each(function(i, n) {
  215. $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#complaintType2"));
  216. })
  217. });
  218. }
  219. //客户类别
  220. function getProductType() {
  221. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  222. "token": $.cookie("token"),
  223. flag: "KHLX"
  224. }, function(result) {
  225. result = $.parseJSON(result);
  226. var Count = result.data;
  227. $(Count).each(function(i, n) {
  228. $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#productType"));
  229. })
  230. });
  231. }
  232. //区域
  233. function getAreaType() {
  234. $.get(huayi.config.callcenter_url + 'Customer/GetList', {
  235. "token": $.cookie("token"),
  236. type:1,
  237. }, function(result) {
  238. result = $.parseJSON(result);
  239. $.fn.zTree.init($("#TreeDemo1"), setting, result.rows); //实例化树形图
  240. });
  241. }
  242. var setting = {
  243. data: {
  244. key: {
  245. name: "F_Definition"
  246. },
  247. simpleData: {
  248. enable: true,
  249. idKey: "F_Id",
  250. pIdKey: "F_ParentId",
  251. rootPId: 0
  252. }
  253. },
  254. callback: {
  255. onClick: changeTreeClick
  256. }
  257. }
  258. function changeTreeClick(event, treeId, treeNode) {
  259. $('#typeclass').val(treeNode.F_Definition);
  260. $('#dealing').val(treeNode.F_Name);
  261. $('#dealingtel').val(treeNode.F_Phone);
  262. $('.addTree1').hide();
  263. };
  264. //工单来源
  265. function getOrderSource(obj) {
  266. $.ajax({
  267. type: "get",
  268. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  269. dataType: 'json',
  270. async: true,
  271. data: {
  272. token: $.cookie("token"),
  273. flag: "GDLY"
  274. },
  275. success: function(data) {
  276. var Count = data.data;
  277. $(Count).each(function(i, n) {
  278. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
  279. })
  280. }
  281. });
  282. }
  283. //客诉专员
  284. function ComplaintVip() {
  285. $.ajax({
  286. type: "get",
  287. url: huayi.config.callcenter_url + "Customer/GetAllList",
  288. dataType: 'json',
  289. async: true,
  290. data: {
  291. token: $.cookie("token"),
  292. type: 2,
  293. province: $('.inps2').val(), //省
  294. city: $('.inps3').val() //市
  295. },
  296. success: function(data) {
  297. $("#vipName").empty();
  298. var Count = data.data;
  299. $('<option value="">请选择专员</option>').appendTo($("#vipName"));
  300. $(Count).each(function(i, n) {
  301. $('<option value="' + n.F_Id
  302. + '" index="' + n.F_Phone
  303. + '" areaText="' + n.F_Area
  304. + '" province="' + n.F_Province
  305. + '" city="' + n.F_City + '">' + n.F_Name
  306. + '</option>').appendTo($("#vipName"));
  307. })
  308. }
  309. });
  310. }
  311. //保存
  312. function saveCustomer() {
  313. var val = $("input[name='ltype']:checked").val();
  314. var valRes = $("input[name='response']:checked").val();
  315. var dealCost;
  316. if (isNaN($("#dealCost").val())) {
  317. dealCost="";
  318. }else{
  319. dealCost=$("#dealCost").val();
  320. }
  321. if (!$('#name').val()) {
  322. layer.confirm('请输入姓名!', {
  323. icon: 2,
  324. btn: ['确定']
  325. });
  326. return;
  327. }
  328. if (!$('#tel').val()) {
  329. layer.confirm('请输入电话!', {
  330. icon: 2,
  331. btn: ['确定']
  332. });
  333. return;
  334. }
  335. if (!$('.orderType').val()) {
  336. layer.confirm('请选择工单类型!', {
  337. icon: 2,
  338. btn: ['确定']
  339. });
  340. return;
  341. }
  342. $.ajax({
  343. type: "post",
  344. url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrder",
  345. dataType: 'json',
  346. async: true,
  347. beforeSend: function() { //触发ajax请求开始时执行
  348. $('.customerSubmit').attr("disabled", true);
  349. $('.customerSubmit').text('保存中...');
  350. },
  351. data: {
  352. token: $.cookie("token"),
  353. workid: id,
  354. cusname: $('#name').val(), //姓名
  355. cusphone: $('#tel').val(), //号码
  356. dealing:$('#dealing').val(),//处理人姓名
  357. dealingtel:$('#dealingtel').val(),//处理人电话
  358. definition: $('#typeclass').val(), //营业厅名称
  359. customertype: $('#productType').val(), //客户类型
  360. fixduty: $('.complaintType1').val(), //定责
  361. pietype: $('#complaintType2').val(), //派单类型
  362. Typeof: $('.orderType').val(), //工单类型id
  363. content:$('#content').val(), //事件描述
  364. remark:$('#remark').val(),
  365. replycontent:$('#replycontent').val(),
  366. callid: $("#CallID").val()
  367. },
  368. success: function(data) {
  369. if (data.state.toLowerCase() == 'success') {
  370. $('.customerSubmit').attr("disabled", false);
  371. $('.customerSubmit').text('保存');
  372. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  373. parent.layer.close(index); //再执行关闭
  374. parent.layer.msg("保存成功!");
  375. parent.$('#workorderlist').bootstrapTable('refresh');
  376. parent.$('#workorderlist_').bootstrapTable('refresh');
  377. parent.$('#orderlist').bootstrapTable('refresh');
  378. }
  379. }
  380. });
  381. }