安图前端代码

xgWork.js 7.7KB

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