ZZDianXin_UI - 郑州电信 演示

xgWork.js 14KB

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