安图前端代码

xgWork.js 7.8KB

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