安图前端代码

xgWork.js 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. var ns;
  2. var id = helper.request.queryString("id");
  3. console.log(id)
  4. var phone = helper.request.queryString("phone");
  5. var objs = {};
  6. $.ajax({
  7. type: "get",
  8. url: huayi.config.callcenter_url + "CallInScreen/GetCurrUserDep",
  9. dataType: 'json',
  10. async: true,
  11. data: {
  12. token: $.cookie("token")
  13. },
  14. success: function(data) {
  15. if(data.state.toLowerCase() == 'success') {
  16. if(data.data.groname == '客服组') {
  17. $('.customerService').show();
  18. ns = 1;
  19. } else {
  20. $('.market').show();
  21. ns = 2;
  22. }
  23. }
  24. }
  25. });
  26. if(id) {
  27. $("#tel").val(phone);
  28. $("#tel_market").val(phone);
  29. $("#CallID").val(id);
  30. }
  31. $(document).ready(function() {
  32. //工单来源
  33. getOrderSource('#orderSource');
  34. //工单类型
  35. getOrderType();
  36. //工单状态
  37. getOrderState();
  38. //来电单位
  39. getAccount('#comeCall_dep');
  40. // getAccount('#comeCall_dep_market');
  41. getAccount('#feedbackDep');
  42. // getAccount('#feedbackDep_market');
  43. //保存
  44. $('.customerSubmit').click(function() {
  45. saveCustomer();
  46. })
  47. $('.marketSubmit').click(function() {
  48. saveMarket();
  49. })
  50. // })
  51. //编辑器配置
  52. KindEditor.ready(function(K) {
  53. window.changeEditor = K.create('#feedBackCon');//修改弹出框编辑器
  54. })
  55. })
  56. //工单类型
  57. function getOrderType() {
  58. $.get(huayi.config.callcenter_url + 'WorkType/GetTreeList', {
  59. "token": $.cookie("token"),
  60. }, function(result) {
  61. result = $.parseJSON(result);
  62. $.fn.zTree.init($("#TreeDemo"), setting3, result.data); //实例化树形图
  63. });
  64. }
  65. var setting3 = {
  66. data: {
  67. key: {
  68. name: "text"
  69. },
  70. simpleData: {
  71. enable: true,
  72. idKey: "id",
  73. rootPId: 0
  74. }
  75. },
  76. callback: {
  77. onClick: changeTreeClick
  78. }
  79. }
  80. function changeTreeClick(event, treeId, treeNode) {
  81. var chanId = treeNode.id;
  82. var changeName = treeNode.text;
  83. $('#typeclass').val(changeName);
  84. $('#typeclassId').val(chanId);
  85. var pidnode = treeNode.getParentNode();
  86. };
  87. $('.down').click(function() {
  88. if($('.treeList').css('display') == 'block') {
  89. $('.treeList').css('display', 'none')
  90. } else {
  91. $('.treeList').css('display', 'block')
  92. }
  93. })
  94. $('#typeclass').click(function() {
  95. $('.treeList').css('display', 'block')
  96. })
  97. $('.treeList').mouseleave(function() {
  98. $(this).css('display', 'none')
  99. })
  100. //工单状态
  101. function getOrderState() {
  102. $.ajax({
  103. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  104. type: 'get',
  105. async: true,
  106. data: {
  107. flag: 'GDZT',
  108. token: $.cookie("token")
  109. },
  110. dataType: "json",
  111. success: function(res) {
  112. if(res.state == "success") {
  113. console.log(res.data);
  114. $(res.data).each(function(i, n) {
  115. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#State"));
  116. })
  117. //
  118. }
  119. }
  120. })
  121. }
  122. //工单来源
  123. function getOrderSource(obj) {
  124. $.ajax({
  125. type: "get",
  126. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  127. dataType: 'json',
  128. async: true,
  129. data: {
  130. token: $.cookie("token"),
  131. flag: "GDLY"
  132. },
  133. success: function(data) {
  134. var Count = data.data;
  135. $(Count).each(function(i, n) {
  136. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
  137. })
  138. }
  139. });
  140. }
  141. //来电单位
  142. function getAccount(obj) {
  143. $.ajax({
  144. type: "get",
  145. url: huayi.config.callcenter_url + "Customer/BindLDdep",
  146. dataType: 'json',
  147. async: true,
  148. data: {
  149. token: $.cookie("token")
  150. },
  151. success: function(data) {
  152. var Count = data.data.dep;
  153. $(Count).each(function(i, n) {
  154. $("<option value='" + n + "'>" + n + "</option>").appendTo($(obj));
  155. })
  156. // $(obj).selectpicker('refresh');
  157. }
  158. });
  159. }
  160. function saveCustomer() {
  161. // $.ajax({
  162. // type: "post",
  163. // url: huayi.config.callcenter_url + "CallInScreen/AddWorkOrder",
  164. // dataType: 'json',
  165. // async: true,
  166. // data: {
  167. // token: $.cookie("token"),
  168. // callCustomer:$('#name').val(),//姓名
  169. // tel:$('#tel').val(),//号码
  170. // lddep:$('#testInput1').val(),//来电单位
  171. // fkdep:$('#testInput2').val(),//反馈单位
  172. // gdly:$('#DicValueList').val(),//工单来源
  173. // gdlx: $('#typeclassId').val(),//工单类型id
  174. // gdzt:$('#State').val(),//工单状态id
  175. // fkcont:$('#feedBackCon').val(),//反馈内容
  176. // sendmsg:$('#express').val() ,//快递信息
  177. // note1: $('#remark1').val(),//备注一
  178. // note2: $('#remark2').val(),//备注二
  179. // note3: $('#remark3').val(),//备注三
  180. // callid:$("#CallID").val()
  181. // },
  182. // success: function(data) {
  183. // if(data.state.toLowerCase()=='success'){
  184. // layer.msg("保存成功!");
  185. // clear();
  186. // }
  187. // }
  188. // });
  189. $.ajax({
  190. type: "get",
  191. url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrderDetail",
  192. dataType: 'json',
  193. async: true,
  194. data: {
  195. token: $.cookie("token"),
  196. orderid: id,
  197. customer: $('#name').val(), //姓名
  198. lddep: $('#testInput1').val(), //来电单位
  199. fkdep: $('#testInput2').val(), //反馈单位
  200. type: $('#DicValueList').val(), //工单来源
  201. typeclass: $('#typeclassId').val(), //工单类型id
  202. gdzt: $('#State').val(), //工单状态id
  203. detail: encodeURIComponent(changeEditor.html()), //反馈内容
  204. files: $('#express').val(), //快递信息
  205. remark1: $('#remark1').val(), //备注一
  206. remark2: $('#remark2').val(), //备注二
  207. remark3: $('#remark3').val() //备注三 callid:$("#CallID").val()
  208. },
  209. success: function(data) {
  210. if(data.state.toLowerCase() == 'success') {
  211. layer.msg("保存成功!");
  212. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  213. parent.layer.close(index); //再执行关闭
  214. parent.initTable();
  215. parent.layer.msg("修改成功!");
  216. clear();
  217. }
  218. }
  219. });
  220. }
  221. function saveMarket() {
  222. if($('#name_market').val() == '') {
  223. layer.confirm('请输入姓名!', {
  224. icon: 2,
  225. btn: ['确定']
  226. });
  227. return;
  228. }
  229. if($('#tel_market').val() == '') {
  230. layer.confirm('请输入电话!', {
  231. icon: 2,
  232. btn: ['确定']
  233. });
  234. return;
  235. }
  236. if($('#testInput3').val() == '') {
  237. layer.confirm('请选择来电单位!', {
  238. icon: 2,
  239. btn: ['确定']
  240. });
  241. return;
  242. }
  243. $.ajax({
  244. type: "post",
  245. url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrderDetail",
  246. dataType: 'json',
  247. async: true,
  248. data: {
  249. token: $.cookie("token"),
  250. callCustomer: $('#name_market').val(), //姓名
  251. tel: $('#tel_market').val(), //号码
  252. lddep: $('#testInput3').val(), //来电单位
  253. fkdep: $('#testInput4').val(), //反馈单位
  254. fkcont: encodeURIComponent(changeEditor.html()), //反馈内容
  255. callid: $("#CallID").val()
  256. },
  257. success: function(data) {
  258. if(data.state.toLowerCase() == 'success') {
  259. layer.msg("保存成功!");
  260. clear();
  261. }
  262. }
  263. });
  264. }
  265. function clear() {
  266. if(ns == 1) {
  267. $('#name').val('');
  268. $('#tel').val(''); //号码
  269. $('#testInput1').val(''); //来电单位
  270. $('#testInput2').val(''); //反馈单位
  271. $('#orderSource').val(''); //工单来源
  272. $('#typeclassId').val(''); //工单类型id
  273. $('#State').val(''); //工单状态id
  274. $('#feedBackCon').val(''); //反馈内容
  275. $('#express').val(''); //快递信息
  276. $('#remark1').val(''); //备注一
  277. $('#remark2').val(''); //备注二
  278. $('#remark3').val(''); //备注三
  279. } else {
  280. $('#name_market').val('');
  281. $('#tel_market').val(''); //号码
  282. $('#testInput3').val(''); //来电单位
  283. $('#testInput4').val(''); //反馈单位
  284. $('#remark_market').val(''); //备注内容
  285. }
  286. }
  287. //获取详情
  288. $.getJSON(huayi.config.callcenter_url + 'WorkOrder/GetWorkOrder', {
  289. "orderid": id,
  290. "token": $.cookie("token")
  291. }, function(result) {
  292. if(result.state.toLowerCase() == "success") {
  293. if(result.data.data.length > 0) {
  294. var data = result.data.data[0];
  295. var state = data.State;
  296. var state_;
  297. $("#xq_gdlx").text(data.GDLXName);
  298. $("#xq_cjsj").text(data.CreateTime);
  299. // $("#xq_gdzt").html(GetStateName(data.State));
  300. $("#name").val(data.Customer);
  301. $("#name_market").val(data.Customer);
  302. $("#tel_market").val(data.CustomerTel);
  303. $("#tel").val(data.CustomerTel);
  304. //
  305. $("#testInput1").val(data.Address);
  306. $("#testInput2").val(data.Source);
  307. $("#testInput3").val(data.Address);
  308. $("#testInput4").val(data.Source);
  309. $("#typeclass").val(data.GDLXName);
  310. $("#feedBackCon").text(data.Detail);
  311. changeEditor.html(decodeURIComponent(data.Detail));
  312. $("#remark_market").text(data.Detail);
  313. $("#express").text(data.Files);
  314. $("#remark1").text(data.City);
  315. $("#remark2").text(data.Province);
  316. $("#remark3").text(data.County);
  317. if(state == 0) {
  318. state_ = 471;
  319. } else {
  320. state_ = 472;
  321. }
  322. console.log(state_)
  323. $("#State").val(state_);
  324. console.log(data.Type)
  325. $("#DicValueList").val(data.Type);
  326. $("#typeclassId").val(data.TypeClass);
  327. $("#States").val(data.State);
  328. }
  329. }
  330. });