安图前端代码

AddWorkOrder.js 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. var ns;
  2. var id=helper.request.queryString("id");
  3. var phone=helper.request.queryString("phone");
  4. var objs={};
  5. $.ajax({
  6. type:"get",
  7. url: huayi.config.callcenter_url + "CallInScreen/GetCurrUserDep",
  8. dataType: 'json',
  9. async: true,
  10. data: {
  11. token: $.cookie("token")
  12. },
  13. success: function(data) {
  14. if(data.state.toLowerCase()=='success'){
  15. if(data.data.groname=='客服组'){
  16. //console.log(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. $("#CallID").val(id);
  28. getOrderDetail(id);
  29. }
  30. $(document).ready(function(){
  31. //工单来源
  32. getOrderSource('#orderSource');
  33. //工单类型
  34. getOrderType();
  35. //工单状态
  36. getOrderState();
  37. //来电单位
  38. getAccount('#comeCall_dep');
  39. // getAccount('#comeCall_dep_market');
  40. getAccount('#feedbackDep');
  41. // getAccount('#feedbackDep_market');
  42. //编辑器配置
  43. KindEditor.ready(function(K) {
  44. window.changeEditor = K.create('#feedBackCon');//修改弹出框编辑器
  45. })
  46. //保存
  47. $('.customerSubmit').click(function(){
  48. saveCustomer();
  49. })
  50. $('.marketSubmit').click(function(){
  51. saveMarket();
  52. })
  53. })
  54. //工单类型
  55. function getOrderType() {
  56. $.get(huayi.config.callcenter_url + 'WorkType/GetTreeList', {
  57. "token": $.cookie("token"),
  58. }, function(result) {
  59. result = $.parseJSON(result);
  60. $.fn.zTree.init($("#TreeDemo"), setting3, result.data); //实例化树形图
  61. });
  62. }
  63. var setting3 = {
  64. data: {
  65. key: {
  66. name: "text"
  67. },
  68. simpleData: {
  69. enable: true,
  70. idKey: "id",
  71. rootPId: 0
  72. }
  73. },
  74. callback: {
  75. onClick: changeTreeClick
  76. }
  77. }
  78. function changeTreeClick(event, treeId, treeNode) {
  79. var chanId = treeNode.id;
  80. var changeName = treeNode.text;
  81. $('#typeclass').val(changeName);
  82. $('#typeclassId').val(chanId);
  83. var pidnode = treeNode.getParentNode();
  84. $('.addTree').hide();
  85. };
  86. $('.down').click(function(){
  87. if($('.treeList').css('display') == 'block') {
  88. $('.treeList').css('display', 'none')
  89. } else {
  90. $('.treeList').css('display', 'block')
  91. }
  92. })
  93. $('#typeclass').click(function() {
  94. $('.treeList').css('display', 'block')
  95. })
  96. $('.treeList').mouseleave(function() {
  97. $(this).css('display', 'none')
  98. })
  99. //ids为通话记录列表获取 获取工单详情
  100. function getOrderDetail(ids){
  101. $.ajax({
  102. type:"get",
  103. url: huayi.config.callcenter_url +"Callrecords/GetModel",
  104. async:true,
  105. data: {
  106. token: $.cookie("token"),
  107. callid:ids
  108. },
  109. dataType: "json",
  110. success: function (res) {
  111. if(res.state.toLowerCase()=="success"){
  112. $("#tel").val(res.data.mobile);
  113. $("#tel_market").val(res.data.mobile);
  114. $("#name_market").val(res.data.CusName);
  115. $("#name").val(res.data.CusName);
  116. $("#testInput1").val(res.data.CusDepName);
  117. $("#testInput3").val(res.data.CusDepName);
  118. }
  119. }
  120. });
  121. }
  122. //工单状态
  123. function getOrderState(){
  124. $.ajax({
  125. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  126. type:'get',
  127. async:true,
  128. data: {
  129. flag:'GDZT',
  130. token: $.cookie("token")
  131. },
  132. dataType: "json",
  133. success: function (res) {
  134. if(res.state=="success"){
  135. //console.log(res.data);
  136. $('<option value="">全部</option>').appendTo($("#State"));
  137. $(res.data).each(function(i,n){
  138. if(n.F_DictionaryValueId=='472'){
  139. $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#State"));
  140. }else{
  141. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#State"));
  142. }
  143. })
  144. //
  145. }
  146. }
  147. })
  148. }
  149. //工单来源
  150. function getOrderSource(obj) {
  151. $.ajax({
  152. type: "get",
  153. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  154. dataType: 'json',
  155. async: true,
  156. data: {
  157. token: $.cookie("token"),
  158. flag :"GDLY"
  159. },
  160. success: function(data) {
  161. var Count = data.data;
  162. $('<option value="">全部</option>').appendTo($("#DicValueList"));
  163. $(Count).each(function(i,n){
  164. if(n.F_DictionaryValueId=="468"){
  165. $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
  166. }else{
  167. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
  168. }
  169. })
  170. }
  171. });
  172. }
  173. //来电单位
  174. function getAccount(obj) {
  175. $.ajax({
  176. type: "get",
  177. url: huayi.config.callcenter_url + "Customer/BindLDdep",
  178. dataType: 'json',
  179. async: true,
  180. data: {
  181. token: $.cookie("token")
  182. },
  183. success: function(data) {
  184. var Count = data.data.dep;
  185. $(Count).each(function(i,n){
  186. $("<option value='" + n + "'>" + n + "</option>").appendTo($(obj));
  187. })
  188. // $(obj).selectpicker('refresh');
  189. }
  190. });
  191. }
  192. function saveCustomer(){
  193. if($('#name').val()==''){
  194. layer.confirm('请输入姓名!', {
  195. icon: 2,
  196. btn: ['确定']
  197. });
  198. return;
  199. }
  200. if($('#tel').val()==''){
  201. layer.confirm('请输入电话!', {
  202. icon: 2,
  203. btn: ['确定']
  204. });
  205. return;
  206. }
  207. if($.trim($('#testInput1').val())==''){
  208. layer.confirm('请选择来电单位!', {
  209. icon: 2,
  210. btn: ['确定']
  211. });
  212. return;
  213. }
  214. if($.trim($('#testInput2').val())==''){
  215. layer.confirm('请选择反馈单位!', {
  216. icon: 2,
  217. btn: ['确定']
  218. });
  219. return;
  220. }
  221. if($('#orderSource').val()==''){
  222. layer.confirm('请选择工单来源!', {
  223. icon: 2,
  224. btn: ['确定']
  225. });
  226. return;
  227. }
  228. if($('#State').val()==''){
  229. layer.confirm('请选择工单状态!', {
  230. icon: 2,
  231. btn: ['确定']
  232. });
  233. return;
  234. }
  235. if($('#typeclassId').val()==''){
  236. layer.confirm('请选择工单类型!', {
  237. icon: 2,
  238. btn: ['确定']
  239. });
  240. return;
  241. }
  242. $.ajax({
  243. type: "post",
  244. url: huayi.config.callcenter_url + "CallInScreen/AddWorkOrder",
  245. dataType: 'json',
  246. async: true,
  247. data: {
  248. token: $.cookie("token"),
  249. callCustomer:$('#name').val(),//姓名
  250. tel:$('#tel').val(),//号码
  251. lddep:$('#testInput1').val(),//来电单位
  252. fkdep:$('#testInput2').val(),//反馈单位
  253. gdly:$('#DicValueList').val(),//工单来源
  254. gdlx: $('#typeclassId').val(),//工单类型id
  255. gdzt:$('#State').val(),//工单状态id
  256. province:$("#Province").val(),
  257. fkcont:encodeURIComponent(changeEditor.html()),//反馈内容
  258. sendmsg:$('#express').val() ,//快递信息
  259. note1: $('#remark1').val(),//备注一
  260. note2: $('#remark2').val(),//备注二
  261. note3: $('#remark3').val(),//备注三
  262. callid:$("#CallID").val()
  263. },
  264. success: function(data) {
  265. if(data.state.toLowerCase()=='success'){
  266. layer.msg("保存成功!");
  267. clear();
  268. }
  269. }
  270. });
  271. }
  272. function saveMarket(){
  273. if($('#name_market').val()==''){
  274. layer.confirm('请输入姓名!', {
  275. icon: 2,
  276. btn: ['确定']
  277. });
  278. return;
  279. }
  280. if($('#tel_market').val()==''){
  281. layer.confirm('请输入电话!', {
  282. icon: 2,
  283. btn: ['确定']
  284. });
  285. return;
  286. }
  287. if($.trim($('#LDunit_').val())==''){
  288. layer.confirm('请选择来电单位!', {
  289. icon: 2,
  290. btn: ['确定']
  291. });
  292. return;
  293. }
  294. $.ajax({
  295. type: "post",
  296. url: huayi.config.callcenter_url + "CallInScreen/AddWorkOrder",
  297. dataType: 'json',
  298. async: true,
  299. data: {
  300. token: $.cookie("token"),
  301. callCustomer:$('#name_market').val(),//姓名
  302. tel:$('#tel_market').val(),//号码
  303. lddep:$('#LDunit_').val(),//来电单位
  304. fkdep:$('#FKunit_').val(),//反馈单位
  305. fkcont:$('#remark_market').val(),//反馈内容
  306. callid:$("#CallID").val()
  307. },
  308. success: function(data) {
  309. if(data.state.toLowerCase()=='success'){
  310. layer.msg("保存成功!");
  311. clear();
  312. }
  313. }
  314. });
  315. }
  316. function clear(){
  317. if(ns==1){
  318. $('#name').val('');
  319. $('#tel').val('');//号码
  320. $('#testInput1').val('');//来电单位
  321. $('#testInput2').val('');//反馈单位
  322. $('#orderSource').val('');//工单来源
  323. $('#typeclassId').val('');//工单类型id
  324. $('#State').val('');//工单状态id
  325. $('#feedBackCon').val('');//反馈内容
  326. $('#express').val('');//快递信息
  327. $('#remark1').val('');//备注一
  328. $('#remark2').val('');//备注二
  329. $('#remark3').val('');//备注三
  330. $('#typeclass').val('');
  331. changeEditor.html('');
  332. }else{
  333. $('#name_market').val('');
  334. $('#tel_market').val('');//号码
  335. $('#testInput3').val('');//来电单位
  336. $('#testInput4').val('');//反馈单位
  337. $('#remark_market').val('');//备注内容
  338. }
  339. }