安图前端代码

AddWorkOrder.js 8.8KB

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