安图前端代码

xgWork.js 7.9KB

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. function saveCustomer() {
  210. $.ajax({
  211. type: "post",
  212. url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrderDetail",
  213. dataType: 'json',
  214. async: true,
  215. data: {
  216. token: $.cookie("token"),
  217. orderid: id,
  218. customer: $('#name').val(), //姓名
  219. lddep: $('#testInput1').val(), //来电单位
  220. fkdep: $('#testInput2').val(), //反馈单位
  221. type: $('#DicValueList').val(), //工单来源
  222. typeclass: $('#typeclassId').val(), //工单类型id
  223. gdzt: $('#State').val(), //工单状态id
  224. detail: encodeURIComponent(changeEditor.html()), //反馈内容
  225. files: $('#express').val(), //快递信息
  226. remark1: $('#remark1').val(), //备注一
  227. remark2: $('#remark2').val(), //备注二
  228. remark3: $('#remark3').val() //备注三 callid:$("#CallID").val()
  229. },
  230. success: function(data) {
  231. if(data.state.toLowerCase() == 'success') {
  232. layer.msg("保存成功!");
  233. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  234. parent.layer.close(index); //再执行关闭
  235. parent.$('#workorderlist').bootstrapTable('refresh');
  236. parent.layer.msg("修改成功!");
  237. clear();
  238. }
  239. }
  240. });
  241. }
  242. function saveMarket() {
  243. if($('#name_market').val() == '') {
  244. layer.confirm('请输入姓名!', {
  245. icon: 2,
  246. btn: ['确定']
  247. });
  248. return;
  249. }
  250. if($('#tel_market').val() == '') {
  251. layer.confirm('请输入电话!', {
  252. icon: 2,
  253. btn: ['确定']
  254. });
  255. return;
  256. }
  257. if($('#testInput3').val() == '') {
  258. layer.confirm('请选择来电单位!', {
  259. icon: 2,
  260. btn: ['确定']
  261. });
  262. return;
  263. }
  264. $.ajax({
  265. type: "post",
  266. url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrderDetail",
  267. dataType: 'json',
  268. async: true,
  269. data: {
  270. token: $.cookie("token"),
  271. orderid: $("#CallID").val(),
  272. customer: $('#name_market').val(), //姓名
  273. lddep: $('#testInput3').val(), //来电单位
  274. fkdep: $('#testInput4').val(), //反馈单位
  275. detail:$('#remark_market').val(), //备注
  276. },
  277. success: function(data) {
  278. if(data.state.toLowerCase() == 'success') {
  279. layer.msg("保存成功!");
  280. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  281. parent.layer.close(index); //再执行关闭
  282. parent.$('#workorderlist_').bootstrapTable('refresh');
  283. parent.layer.msg("修改成功!");
  284. clear();
  285. }
  286. }
  287. });
  288. }
  289. function clear() {
  290. if(ns == 1) {
  291. $('#name').val('');
  292. $('#tel').val(''); //号码
  293. $('#testInput1').val(''); //来电单位
  294. $('#testInput2').val(''); //反馈单位
  295. $('#orderSource').val(''); //工单来源
  296. $('#typeclassId').val(''); //工单类型id
  297. $('#State').val(''); //工单状态id
  298. changeEditor.html('') //反馈内容
  299. $('#express').val(''); //快递信息
  300. $('#remark1').val(''); //备注一
  301. $('#remark2').val(''); //备注二
  302. $('#remark3').val(''); //备注三
  303. } else {
  304. $('#name_market').val('');
  305. $('#tel_market').val(''); //号码
  306. $('#testInput3').val(''); //来电单位
  307. $('#testInput4').val(''); //反馈单位
  308. $('#remark_market').val(''); //备注内容
  309. }
  310. }