鑫苑新版本前端代码

xgWork.js 8.6KB

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