Nav apraksta

Work-Add.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. mui.init({
  2. swipeBack: false,
  3. beforeback: function() {    
  4. var list = plus.webview.currentWebview().opener();    
  5. //refresh是A页面自定义事件
  6. mui.fire(list, 'refreshPer');
  7. //返回true,继续页面关闭逻辑
  8. return true;
  9. }
  10. })
  11. mui.plusReady(function() {
  12. var wv = plus.webview.currentWebview();
  13. var usercode = localStorage.getItem("user"); //获取本地存储
  14. var files;
  15. var Str = '';
  16. var str_ary;
  17. var reg = /,$/gi;
  18. //提交按钮
  19. $('#submit').on('tap', function() {
  20. $(".image-box").each(function(i, n) {
  21. var a = $(n).attr("indexs");
  22. if(a) {
  23. Str += a + ',';
  24. }
  25. })
  26. var addresText=$("#choworder_rengin").val()+'-'
  27. +$("#shouorder_shi").val()+'-'
  28. +$("#chouorder_xian").val()+'-'
  29. +$("#textarea").val();
  30. if($('#F_CusName').val() == '') {
  31. mui.alert('请输入姓名!')
  32. } else if($('#F_CusPhone').val() == '') {
  33. mui.alert('请输入联系电话!')
  34. } else if($('#F_QualityProblem').val() == '') {
  35. mui.alert('请输入质量问题!')
  36. } else {
  37. $.ajax({
  38. type: "post",
  39. dataType: 'json',
  40. url: huayi.config.callcenter_url + '/WorkorderApp/AddWorkOrder',
  41. async: true,
  42. data: {
  43. F_Type: $('#F_Type').attr('data-index'), //工单类型
  44. F_CusName: $('#F_CusName').val(), //姓名
  45. F_CusPhone: $('#F_CusPhone').val(), //电话
  46. F_AddRess:addresText,//地址
  47. F_ProductType:$('#F_ProductType').val(), //产品代码
  48. F_ProductName:$('#F_ProductName').val(), //产品名称
  49. F_Specifications:$('#F_Specifications').val(), //规格
  50. F_ProductDate:$('#F_ProductDate').val(), //生产日期
  51. F_BatchNumber:$('#F_BatchNumber').val(), //产品编码
  52. F_Manufacturer:$('#F_Manufacturer').val(), //生产厂家
  53. F_ProblemCode:$('#F_ProblemCode').val(), //问题代码
  54. F_QualityProblem:$('#F_QualityProblem').val(), //质量问题
  55. F_DealTimely:$('#F_DealTimely').val(), //工单等级
  56. F_DealTimelyyy:$('#F_DealTimelyyy').val(), //工单等级原因
  57. IsAssign:0,
  58. //F_QualityProblem: $('input[name="opinion"]:checked').val(), //=(1普通2紧急)
  59. //F_Area:$('#F_Area').val(), //大区
  60. //clid:$('#F_Clid').val(), //提交人
  61. F_Content:$('#F_Content').val(), //备注
  62. token:localStorage.getItem("token")
  63. },
  64. success: function(data) {
  65. if(data.state == "success") {
  66. mui.toast('投诉成功!');
  67. $("#name").val('');
  68. $("#phone").val('');
  69. $("#title").val('');
  70. $(".content").val('');
  71. $("#cityResult3").val('');
  72. $("#zhuTiResult").val('');
  73. $("#F_Type").val('');
  74. $('#detail_address').val('');
  75. $('input[name="secret"][value="0"]').prop("checked", "checked");
  76. window.location.reload();
  77. } else {
  78. mui.toast(data.message);
  79. }
  80. }
  81. });
  82. }
  83. })
  84. //工单类型
  85. var typeList = [{
  86. value: '1',
  87. text: '咨询'
  88. }, {
  89. value: '2',
  90. text: '投诉'
  91. }, {
  92. value: '3',
  93. text: '重复'
  94. }]
  95. // 产品代码
  96. var Product = [];
  97. $.ajax({
  98. type: "get",
  99. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag',
  100. async: false,
  101. data: {
  102. flag: "CPDM",
  103. token:localStorage.getItem("token")
  104. },
  105. dataType: 'json',
  106. success: function(res) {
  107. if(res.state.toLowerCase() === "success") {
  108. res = res.data;
  109. if(res && res.length > 0) {
  110. res.forEach(function(v, i) {
  111. var obj = {};
  112. obj.value = v.F_DictionaryValueId;
  113. obj.text = v.F_Name;
  114. Product.push(obj);
  115. });
  116. }
  117. }
  118. }
  119. });
  120. // 问题代码
  121. var Problem = [];
  122. $.ajax({
  123. type: "get",
  124. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag',
  125. async: false,
  126. data: {
  127. flag: "WTDM",
  128. token:localStorage.getItem("token")
  129. },
  130. dataType: 'json',
  131. success: function(res) {
  132. if(res.state.toLowerCase() === "success") {
  133. res = res.data;
  134. if(res && res.length > 0) {
  135. res.forEach(function(v, i) {
  136. var obj = {};
  137. obj.value = v.F_DictionaryValueId;
  138. obj.text = v.F_Name;
  139. Problem.push(obj);
  140. });
  141. }
  142. }
  143. }
  144. });
  145. // 工单等级
  146. var DealTimely = [];
  147. $.ajax({
  148. type: "get",
  149. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag',
  150. async: false,
  151. data: {
  152. flag: "GDDJ",
  153. token:localStorage.getItem("token")
  154. },
  155. dataType: 'json',
  156. success: function(res) {
  157. if(res.state.toLowerCase() === "success") {
  158. res = res.data;
  159. if(res && res.length > 0) {
  160. res.forEach(function(v, i) {
  161. var obj = {};
  162. obj.value = v.F_DictionaryValueId;
  163. obj.text = v.F_Name;
  164. DealTimely.push(obj);
  165. });
  166. }
  167. }
  168. }
  169. });
  170. function gddjyy(){
  171. var DealTimelyyy = []
  172. var flagDJ;
  173. if ($("#F_DealTimely").val()=="普通工单") {
  174. flagDJ="PGYY"
  175. } else if ($("#F_DealTimely").val()=="Ⅰ级") {
  176. flagDJ="YJYY"
  177. } else if ($("#F_DealTimely").val()=="Ⅱ级") {
  178. flagDJ="EJYY"
  179. }
  180. $.ajax({
  181. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag',
  182. type: 'get',
  183. data: {
  184. flag: flagDJ,
  185. token:localStorage.getItem("token")
  186. },
  187. dataType: "json",
  188. async: true,
  189. success: function(res) {
  190. if(res.state.toLowerCase() === "success") {
  191. res = res.data;
  192. if(res && res.length >0) {
  193. res.forEach(function(v, i) {
  194. var obj = {};
  195. obj.value = v.F_DictionaryValueId;
  196. obj.text = v.F_Name;
  197. DealTimelyyy.push(obj);
  198. //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
  199. });
  200. userPicker5.setData(DealTimelyyy);
  201. }
  202. }
  203. },
  204. });
  205. }
  206. // 大区
  207. var Area = [];
  208. $.ajax({
  209. type: "get",
  210. url: huayi.config.callcenter_url + 'Department/GetCusAreaList',
  211. async: false,
  212. data: {
  213. pid: 1,
  214. F_Layer: 1,
  215. token:localStorage.getItem("token")
  216. },
  217. dataType: 'json',
  218. success: function(res) {
  219. if(res.state.toLowerCase() === "success") {
  220. res = res.data;
  221. if(res && res.length > 0) {
  222. res.forEach(function(v, i) {
  223. var obj = {};
  224. obj.value = v.F_DeptId;
  225. obj.text = v.F_DeptName;
  226. Area.push(obj);
  227. });
  228. }
  229. }
  230. }
  231. });
  232. //市
  233. function getClid(){
  234. var Clid = []
  235. $.ajax({
  236. url: huayi.config.callcenter_url + 'UserAccount/GetList',
  237. type: 'get',
  238. data: {
  239. type: 1,
  240. dptid: $('#F_Area').attr('data-index'),
  241. token:localStorage.getItem("token")
  242. },
  243. dataType: "json",
  244. async: true,
  245. success: function(res) {
  246. res = res.rows;
  247. if(res && res.length >0) {
  248. res.forEach(function(v, i) {
  249. var obj = {};
  250. obj.value = v.F_UserName;
  251. obj.text = v.F_UserName;
  252. Clid.push(obj);
  253. });
  254. userPicker7.setData(Clid);
  255. }
  256. },
  257. });
  258. }
  259. // 咨询省市县乡
  260. var recives = [];
  261. $.ajax({
  262. type: "get",
  263. url: huayi.config.callcenter_url + 'RegionCategory/GetCountyList',
  264. async: false,
  265. data: {
  266. pid:0,
  267. token:localStorage.getItem("token")
  268. },
  269. dataType: 'json',
  270. success: function(res) {
  271. if(res.state.toLowerCase() === "success") {
  272. res = res.data;
  273. if(res && res.length > 0) {
  274. res.forEach(function(v, i) {
  275. var obj = {};
  276. obj.value = v.F_RegionId;
  277. obj.text = v.F_RegionName;
  278. recives.push(obj);
  279. });
  280. }
  281. }
  282. }
  283. });
  284. //市
  285. function getRece(){
  286. var renyuann = []
  287. $.ajax({
  288. url: huayi.config.callcenter_url + 'RegionCategory/GetCountyList',
  289. type: 'get',
  290. data: {
  291. pid:$('#choworder_rengin').attr('data-index'),
  292. token:localStorage.getItem("token")
  293. },
  294. dataType: "json",
  295. async: true,
  296. success: function(res) {
  297. if(res.state.toLowerCase() === "success") {
  298. res = res.data;
  299. if(res && res.length >0) {
  300. res.forEach(function(v, i) {
  301. var obj = {};
  302. obj.value = v.F_RegionId;
  303. obj.text = v.F_RegionName;
  304. renyuann.push(obj);
  305. //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
  306. });
  307. RCiPickee1.setData(renyuann);
  308. }
  309. }
  310. },
  311. });
  312. }
  313. //区/县
  314. function getReee(){
  315. var rennn = []
  316. $.ajax({
  317. url: huayi.config.callcenter_url + 'RegionCategory/GetCountyList',
  318. type: 'get',
  319. data: {
  320. pid:$('#shouorder_shi').attr('data-index'),
  321. token:localStorage.getItem("token")
  322. },
  323. dataType: "json",
  324. async: true,
  325. success: function(res) {
  326. if(res.state.toLowerCase() === "success") {
  327. res = res.data;
  328. if(res && res.length >0) {
  329. res.forEach(function(v, i) {
  330. var obj = {};
  331. obj.value = v.F_RegionId;
  332. obj.text = v.F_RegionName;
  333. rennn.push(obj);
  334. //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
  335. });
  336. RCiPi1.setData(rennn);
  337. }
  338. }
  339. },
  340. });
  341. }
  342. (function($, doc) {
  343. $.init();
  344. $.ready(function() {
  345. //工单类型
  346. var userPicker1 = new $.PopPicker();
  347. userPicker1.setData(typeList);
  348. var showUserPickerButton1 = doc.getElementById('showUserPicker');
  349. var F_Type = doc.getElementById('F_Type');
  350. showUserPickerButton1.addEventListener('tap', function(event) {
  351. userPicker1.show(function(items) {
  352. console.log(items)
  353. F_Type.value = items[0].text;
  354. F_Type.setAttribute("data-index", items[0].value);
  355. //返回 false 可以阻止选择框的关闭
  356. //return false;
  357. });
  358. }, false);
  359. //产品代码
  360. var userPicker2 = new $.PopPicker();
  361. userPicker2.setData(Product);
  362. var showUserPickerButton2 = doc.getElementById('showUserPickerProduct');
  363. var F_Product = doc.getElementById('F_ProductType');
  364. showUserPickerButton2.addEventListener('tap', function(event) {
  365. userPicker2.show(function(items) {
  366. F_Product.value = items[0].text;
  367. F_Product.setAttribute("data-index", items[0].value);
  368. });
  369. }, false);
  370. //问题代码
  371. var userPicker3 = new $.PopPicker();
  372. userPicker3.setData(Problem);
  373. var showUserPickerButton3 = doc.getElementById('showUserPickerProblem');
  374. var F_Problem = doc.getElementById('F_ProblemCode');
  375. showUserPickerButton3.addEventListener('tap', function(event) {
  376. userPicker3.show(function(items) {
  377. F_Problem.value = items[0].text;
  378. F_Problem.setAttribute("data-index", items[0].value);
  379. });
  380. }, false);
  381. //工单等级
  382. var userPicker4 = new $.PopPicker();
  383. userPicker4.setData(DealTimely);
  384. var showUserPickerButton4 = doc.getElementById('showUserPickerDealTimely');
  385. var F_DealTimely = doc.getElementById('F_DealTimely');
  386. showUserPickerButton4.addEventListener('tap', function(event) {
  387. userPicker4.show(function(items) {
  388. F_DealTimely.value = items[0].text;
  389. F_DealTimely.setAttribute("data-index", items[0].value);
  390. });
  391. }, false);
  392. //工单等级原因
  393. userPicker5 = new $.PopPicker({
  394. F_Layer: 1,
  395. });
  396. var showUserPickerButton5 = doc.getElementById('showUserPickerDealTimelyyy');
  397. var F_DealTimelyyy = doc.getElementById('F_DealTimelyyy');
  398. showUserPickerButton5.addEventListener('tap', function(event) {
  399. gddjyy();
  400. userPicker5.show(function(items) {
  401. doc.getElementById('chouorder_xian').value="";
  402. if (items[0].text!=undefined) {
  403. F_DealTimelyyy.value =items[0].text
  404. F_DealTimelyyy.setAttribute("data-index", items[0].value);
  405. }
  406. });
  407. }, false);
  408. //大区
  409. var userPicker6 = new $.PopPicker({
  410. F_Layer: 1,
  411. });
  412. userPicker6.setData(Area);
  413. var showUserPickerButton6 = doc.getElementById('showUserPickerArea');
  414. var F_Area = doc.getElementById('F_Area');
  415. showUserPickerButton6.addEventListener('tap', function(event) {
  416. userPicker6.show(function(items) {
  417. F_Area.value =items[0].text
  418. F_Area.setAttribute("data-index", items[0].value);
  419. });
  420. }, false);
  421. //提交人
  422. userPicker7 = new $.PopPicker({
  423. F_Layer: 1,
  424. });
  425. var showUserPickerButton7 = doc.getElementById('showUserPickeClid');
  426. var F_Clid = doc.getElementById('F_Clid');
  427. showUserPickerButton7.addEventListener('tap', function(event) {
  428. getClid();
  429. userPicker7.show(function(items) {
  430. if (items[0].text!=undefined) {
  431. F_Clid.value =items[0].text
  432. F_Clid.setAttribute("data-index", items[0].value);
  433. }
  434. });
  435. }, false);
  436. //咨询省
  437. var RCiP = new $.PopPicker({
  438. F_Layer: 1,
  439. });
  440. RCiP.setData(recives);
  441. var RCss1 = doc.getElementById('chouhuTi');
  442. var RCResultss = doc.getElementById('choworder_rengin');
  443. RCss1.addEventListener('tap', function(event) {
  444. doc.getElementById('shouorder_shi').value="";
  445. doc.getElementById('chouorder_xian').value="";
  446. RCiP.show(function(items) {
  447. RCResultss.value =items[0].text
  448. RCResultss.setAttribute("data-index", items[0].value);
  449. });
  450. }, false);
  451. //市
  452. RCiPickee1 = new $.PopPicker({
  453. F_Layer: 1,
  454. });
  455. var RCss2 = doc.getElementById('chowZhuTiPicker');
  456. var RCResultss2 = doc.getElementById('shouorder_shi');
  457. RCss2.addEventListener('tap', function(event) {
  458. getRece();
  459. RCiPickee1.show(function(items) {
  460. doc.getElementById('chouorder_xian').value="";
  461. if (items[0].text!=undefined) {
  462. RCResultss2.value =items[0].text
  463. RCResultss2.setAttribute("data-index", items[0].value);
  464. }
  465. });
  466. }, false);
  467. //区/县
  468. RCiPi1 = new $.PopPicker({
  469. F_Layer: 1,
  470. });
  471. var RCs22 = doc.getElementById('chowcounty');
  472. var RCResults22 = doc.getElementById('chouorder_xian');
  473. RCs22.addEventListener('tap', function(event) {
  474. getReee();
  475. RCiPi1.show(function(items) {
  476. if (items[0].text!=undefined) {
  477. RCResults22.value =items[0].text
  478. RCResults22.setAttribute("data-index", items[0].value);
  479. }
  480. });
  481. }, false);
  482. })
  483. })(mui, document);
  484. });