安图前端代码

xgWork.js 8.2KB

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