安图前端代码

xgWork.js 8.5KB

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