Nessuna descrizione

Work-Add.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  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. alert($('#F_Area').attr('data-index'))
  236. $.ajax({
  237. url: huayi.config.callcenter_url + 'UserAccount/GetList',
  238. type: 'get',
  239. data: {
  240. type: 1,
  241. dptid: $('#F_Area').attr('data-index'),
  242. token:localStorage.getItem("token")
  243. },
  244. dataType: "json",
  245. async: true,
  246. success: function(res) {
  247. res = res.rows;
  248. if(res && res.length >0) {
  249. res.forEach(function(v, i) {
  250. var obj = {};
  251. obj.value = v.F_UserName;
  252. obj.text = v.F_UserName;
  253. Clid.push(obj);
  254. });
  255. userPicker7.setData(Clid);
  256. }
  257. },
  258. });
  259. }
  260. // 咨询省市县乡
  261. var recives = [];
  262. $.ajax({
  263. type: "get",
  264. url: huayi.config.callcenter_url + 'RegionCategory/GetCountyList',
  265. async: false,
  266. data: {
  267. pid:0,
  268. token:localStorage.getItem("token")
  269. },
  270. dataType: 'json',
  271. success: function(res) {
  272. if(res.state.toLowerCase() === "success") {
  273. res = res.data;
  274. if(res && res.length > 0) {
  275. res.forEach(function(v, i) {
  276. var obj = {};
  277. obj.value = v.F_RegionId;
  278. obj.text = v.F_RegionName;
  279. recives.push(obj);
  280. });
  281. }
  282. }
  283. }
  284. });
  285. //市
  286. function getRece(){
  287. var renyuann = []
  288. $.ajax({
  289. url: huayi.config.callcenter_url + 'RegionCategory/GetCountyList',
  290. type: 'get',
  291. data: {
  292. pid:$('#choworder_rengin').attr('data-index'),
  293. token:localStorage.getItem("token")
  294. },
  295. dataType: "json",
  296. async: true,
  297. success: function(res) {
  298. if(res.state.toLowerCase() === "success") {
  299. res = res.data;
  300. if(res && res.length >0) {
  301. res.forEach(function(v, i) {
  302. var obj = {};
  303. obj.value = v.F_RegionId;
  304. obj.text = v.F_RegionName;
  305. renyuann.push(obj);
  306. //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
  307. });
  308. RCiPickee1.setData(renyuann);
  309. }
  310. }
  311. },
  312. });
  313. }
  314. //区/县
  315. function getReee(){
  316. var rennn = []
  317. $.ajax({
  318. url: huayi.config.callcenter_url + 'RegionCategory/GetCountyList',
  319. type: 'get',
  320. data: {
  321. pid:$('#shouorder_shi').attr('data-index'),
  322. token:localStorage.getItem("token")
  323. },
  324. dataType: "json",
  325. async: true,
  326. success: function(res) {
  327. if(res.state.toLowerCase() === "success") {
  328. res = res.data;
  329. if(res && res.length >0) {
  330. res.forEach(function(v, i) {
  331. var obj = {};
  332. obj.value = v.F_RegionId;
  333. obj.text = v.F_RegionName;
  334. rennn.push(obj);
  335. //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
  336. });
  337. RCiPi1.setData(rennn);
  338. }
  339. }
  340. },
  341. });
  342. }
  343. (function($, doc) {
  344. $.init();
  345. $.ready(function() {
  346. //工单类型
  347. var userPicker1 = new $.PopPicker();
  348. userPicker1.setData(typeList);
  349. var showUserPickerButton1 = doc.getElementById('showUserPicker');
  350. var F_Type = doc.getElementById('F_Type');
  351. showUserPickerButton1.addEventListener('tap', function(event) {
  352. userPicker1.show(function(items) {
  353. console.log(items)
  354. F_Type.value = items[0].text;
  355. F_Type.setAttribute("data-index", items[0].value);
  356. //返回 false 可以阻止选择框的关闭
  357. //return false;
  358. });
  359. }, false);
  360. //产品代码
  361. var userPicker2 = new $.PopPicker();
  362. userPicker2.setData(Product);
  363. var showUserPickerButton2 = doc.getElementById('showUserPickerProduct');
  364. var F_Product = doc.getElementById('F_ProductType');
  365. showUserPickerButton2.addEventListener('tap', function(event) {
  366. userPicker2.show(function(items) {
  367. F_Product.value = items[0].text;
  368. F_Product.setAttribute("data-index", items[0].value);
  369. });
  370. }, false);
  371. //问题代码
  372. var userPicker3 = new $.PopPicker();
  373. userPicker3.setData(Problem);
  374. var showUserPickerButton3 = doc.getElementById('showUserPickerProblem');
  375. var F_Problem = doc.getElementById('F_ProblemCode');
  376. showUserPickerButton3.addEventListener('tap', function(event) {
  377. userPicker3.show(function(items) {
  378. F_Problem.value = items[0].text;
  379. F_Problem.setAttribute("data-index", items[0].value);
  380. });
  381. }, false);
  382. //工单等级
  383. var userPicker4 = new $.PopPicker();
  384. userPicker4.setData(DealTimely);
  385. var showUserPickerButton4 = doc.getElementById('showUserPickerDealTimely');
  386. var F_DealTimely = doc.getElementById('F_DealTimely');
  387. showUserPickerButton4.addEventListener('tap', function(event) {
  388. userPicker4.show(function(items) {
  389. F_DealTimely.value = items[0].text;
  390. F_DealTimely.setAttribute("data-index", items[0].value);
  391. });
  392. }, false);
  393. //工单等级原因
  394. userPicker5 = new $.PopPicker({
  395. F_Layer: 1,
  396. });
  397. var showUserPickerButton5 = doc.getElementById('showUserPickerDealTimelyyy');
  398. var F_DealTimelyyy = doc.getElementById('F_DealTimelyyy');
  399. showUserPickerButton5.addEventListener('tap', function(event) {
  400. gddjyy();
  401. userPicker5.show(function(items) {
  402. doc.getElementById('chouorder_xian').value="";
  403. if (items[0].text!=undefined) {
  404. F_DealTimelyyy.value =items[0].text
  405. F_DealTimelyyy.setAttribute("data-index", items[0].value);
  406. }
  407. });
  408. }, false);
  409. //大区
  410. var userPicker6 = new $.PopPicker({
  411. F_Layer: 1,
  412. });
  413. userPicker6.setData(Area);
  414. var showUserPickerButton6 = doc.getElementById('showUserPickerArea');
  415. var F_Area = doc.getElementById('F_Area');
  416. showUserPickerButton6.addEventListener('tap', function(event) {
  417. userPicker6.show(function(items) {
  418. F_Area.value =items[0].text
  419. F_Area.setAttribute("data-index", items[0].value);
  420. });
  421. }, false);
  422. //提交人
  423. userPicker7 = new $.PopPicker({
  424. F_Layer: 1,
  425. });
  426. var showUserPickerButton7 = doc.getElementById('showUserPickeClid');
  427. var F_Clid = doc.getElementById('F_Clid');
  428. showUserPickerButton7.addEventListener('tap', function(event) {
  429. getClid();
  430. userPicker7.show(function(items) {
  431. if (items[0].text!=undefined) {
  432. F_Clid.value =items[0].text
  433. F_Clid.setAttribute("data-index", items[0].value);
  434. }
  435. });
  436. }, false);
  437. //咨询省
  438. var RCiP = new $.PopPicker({
  439. F_Layer: 1,
  440. });
  441. RCiP.setData(recives);
  442. var RCss1 = doc.getElementById('chouhuTi');
  443. var RCResultss = doc.getElementById('choworder_rengin');
  444. RCss1.addEventListener('tap', function(event) {
  445. doc.getElementById('shouorder_shi').value="";
  446. doc.getElementById('chouorder_xian').value="";
  447. RCiP.show(function(items) {
  448. RCResultss.value =items[0].text
  449. RCResultss.setAttribute("data-index", items[0].value);
  450. });
  451. }, false);
  452. //市
  453. RCiPickee1 = new $.PopPicker({
  454. F_Layer: 1,
  455. });
  456. var RCss2 = doc.getElementById('chowZhuTiPicker');
  457. var RCResultss2 = doc.getElementById('shouorder_shi');
  458. RCss2.addEventListener('tap', function(event) {
  459. getRece();
  460. RCiPickee1.show(function(items) {
  461. doc.getElementById('chouorder_xian').value="";
  462. if (items[0].text!=undefined) {
  463. RCResultss2.value =items[0].text
  464. RCResultss2.setAttribute("data-index", items[0].value);
  465. }
  466. });
  467. }, false);
  468. //区/县
  469. RCiPi1 = new $.PopPicker({
  470. F_Layer: 1,
  471. });
  472. var RCs22 = doc.getElementById('chowcounty');
  473. var RCResults22 = doc.getElementById('chouorder_xian');
  474. RCs22.addEventListener('tap', function(event) {
  475. getReee();
  476. RCiPi1.show(function(items) {
  477. if (items[0].text!=undefined) {
  478. RCResults22.value =items[0].text
  479. RCResults22.setAttribute("data-index", items[0].value);
  480. }
  481. });
  482. }, false);
  483. })
  484. })(mui, document);
  485. });