Aucune description

Work-Add.js 13KB

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