Ei kuvausta

AddWorkolder.js 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. mui.init({})
  2. var FullName = helper.cookies.get("fullname");
  3. var UserCode = helper.cookies.get("usercode");
  4. var UserType = helper.cookies.get("usertype");
  5. var openid = helper.cookies.get("openid");
  6. $(function () {
  7. $('#order_name').val(FullName);
  8. $('#order_tel').val(UserCode);
  9. // 投诉咨询切换
  10. $('.order_type').find('input[type="radio"]').on('change', function() {
  11. if($(this).val() === "108") { //投诉
  12. $('.complaintOrder').show(); //receive
  13. $('.receive').hide();
  14. } else {
  15. $('.receive').show();
  16. $('.complaintOrder').hide();
  17. }
  18. });
  19. //工单有效性
  20. $('#order_valid').find('input[type="radio"]').on('change', function() {
  21. //是否有效工单项(0有效,1无效)
  22. if($(this).val() === "1") { //无效
  23. $('.order_note').show();
  24. } else {
  25. $('.order_note').hide();
  26. }
  27. });
  28. Ajax();
  29. function Ajax() {
  30. $.ajax({
  31. url: huayi.config.callcenter_url + '/WxLogin/GetCustomer',
  32. data: {
  33. openid: openid, //微信openid,
  34. },
  35. async: true,
  36. dataType: 'json',
  37. type: 'get', //HTTP请求类型
  38. success: function(data) {
  39. if(data.state.toLowerCase()== "success") {
  40. var con=data.data;
  41. var CustomerNature;
  42. if(con.F_CustomerNatureID=="473"){
  43. CustomerNature="租赁"
  44. }else if(con.F_CustomerNatureID=="474"){
  45. CustomerNature="自用"
  46. }
  47. $("#order_name").val(con.F_CustomerName); //客户姓名
  48. $('#order_tel').val(con.F_Mobile); //电话 F_Layer
  49. $('#order_rengin').val(con.areaname+con.proname+con.stagename);//项目名称
  50. $("#order_rengin").attr('data-index',con.F_Layer); //区域id
  51. $("#order_pro").attr('data-index',con.F_CategoryId) //项目id
  52. $("#order_floor").attr('data-index',con.F_CustomerType) //期号id
  53. $('#order_tower').val(con.F_CustomerNature); //楼号
  54. $('#order_unit').val(con.F_CustomerClass); //单元号
  55. $('#order_room').val(con.roomname);//房间号
  56. $('#ower_relationship').val(CustomerNature);//房主关系
  57. $('#ower_relationship').attr('data-index',con.F_CustomerNatureID);//房主ids
  58. }
  59. }
  60. })
  61. }
  62. //提交按钮
  63. $('#submit').on('tap', function() {
  64. var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
  65. var myreg11 = /^(([0\+]\d{2,3}-)?((0\d{2,3}))?(-)?)?(\d{7,8})(-(\d{3,}))?$/;
  66. var str = $("#order_tel").val();
  67. if($('#order_type').val() == '') {
  68. mui.alert('请输入工单类型!') //请输入工单类型
  69. } else if($('#order_name').val() == '') {
  70. mui.alert('请输入客户姓名!') //请输入客户姓名
  71. } else if($('#order_tel').val() == '') {
  72. mui.alert('请输入电话!') //请输入客户姓名
  73. } else if (!myreg.test(str)&&!myreg11.test(str)) {
  74. mui.alert('手机号格式不正确!')
  75. } else if($('#order_rengin').val() == '') {
  76. mui.alert('请输入项目名称!') //请输入项目名称
  77. } else if($('#order_room').val() == '') {
  78. mui.alert('请输入房间号!') //请输入房间号
  79. } else if($('#ower_relationship').val() == '') {
  80. mui.alert('请输入房东关系!') //房东关系
  81. } else if($('#order_reception').val() == '') {
  82. mui.alert('请填写详细描述!') //填写详细描述
  83. } else {
  84. $.ajax({
  85. type: "post",
  86. dataType: 'json',
  87. url: huayi.config.callcenter_url + '/WxLogin/AddWorkOrder',
  88. async: true,
  89. data: {
  90. gdly: $('#order_source').attr('data-index'), //工单来源
  91. gdlx: $('.order_type').find('input[type="radio"]:checked').val(), //工单类型
  92. callCustomer: $('#order_name').val(), //客户姓名
  93. tel: $('#order_tel').val(), //否 string 联系电话
  94. areaid: $("#order_rengin").attr('data-index'), //区域名称
  95. proid: $("#order_pro").attr('data-index'), //项目名称
  96. buildingnum: $('#order_tower').val(),// 否 string 楼号
  97. unitnum: $('#order_unit').val(),// 否 string 单元
  98. buildingid: $("#order_floor").attr('data-index'), //楼号
  99. roomno: $('#order_room').val(), //房间号
  100. //OwnerRelations: $('#ower_relationship').attr('data-index'), //房东关系
  101. ownerrelationsid: $('#ower_relationship').attr('data-index'), //房东关系
  102. customerresponseid: $('#order_response').find('input[type="radio"]:checked').val(), //否 int 客户反应
  103. fkdep: $('#complaintOrder_type').attr('data-index'), //否 int 处理部门(投诉类型)
  104. kfdepid: $('#serviceOrder_type').attr('data-index'), //否int 客服类类型
  105. isquality: $('#is_quality_assurance').attr('data-index'), //否 int 是,//否过质保
  106. fkcont: $('#order_reception').val(), //描述详情
  107. auditusercode: $('#order_responsible').val(), //否 string 受理人
  108. iseffective: $('#order_valid').find('input[type="radio"]:checked').val(), // 否 int 是否有效工单项(0有效,1无效)
  109. note: $('#order_note').val(), // 无效原因 否 string 备注 (iseffective,1无效时填写备注)
  110. clbm: $('#recive_type').attr('data-index'), //否 int 咨询类工单指派部门id
  111. clid: $('#ower_recive').attr('data-index'), // 否 string 接收人id $(this)
  112. //$('#order_receiveUser option').find("option:selected").val(),
  113. openid: openid,
  114. },
  115. success: function(data) {
  116. if(data.state == "success") {
  117. debugger
  118. // alert($('#order_reception').val()), //描述详情
  119. mui.toast('创建成功');
  120. $('#order_type').val(''); //工单类型
  121. $('#order_name').val(''), //客户姓名
  122. $('#order_tel').val(''), //否 string 联系电话
  123. $("#order_rengin").attr(''), //区域名称
  124. $("#order_pro").attr(''), //项目名称
  125. $("#order_floor").attr(''), //楼号
  126. $('#order_room').val(''), //房间号
  127. $('#ower_relationship').attr(''), //房东关系
  128. $('#order_response').find('input[type="radio"]:checked').val(), //否 int 客户反应
  129. $('#complaintOrder_type').attr(''), //否 int 处理部门(投诉类型)
  130. $('#serviceOrder_type').attr(''), //否int 客服类类型
  131. $('#is_quality_assurance').attr(''), //否 int 是,//否过质保
  132. $('#order_reception').val(''), //描述详情
  133. $('#order_responsible').val(''), //否 string 受理人
  134. $('#order_valid').find('input[type="radio"]:checked').val(), // 否 int 是否有效工单项(0有效,1无效)
  135. $('#order_note').val(''), // 无效原因 否 string 备注 (iseffective,1无效时填写备注)
  136. $('#recive_type').attr(''), //$('#order_transfer_dept').attr('data-id') 否 int 咨询类工单指派部门id
  137. $('#ower_recive').attr(''), // 否 string 接收人id $(this)
  138. window.location.href = "client_index.html";
  139. } else {
  140. mui.toast(data.message);
  141. }
  142. }
  143. });
  144. }
  145. })
  146. // 接收部门
  147. // function getDepts() {}
  148. // var recive = [];
  149. // $.ajax({
  150. // type: "get",
  151. // url: huayi.config.callcenter_url + 'Department/GetAssignDeptList',
  152. // async: false,
  153. // data: {},
  154. // dataType: 'json',
  155. // success: function(data) {
  156. // console.log(data)
  157. // recive = data.data;
  158. // //alert(JSON.stringify(data));
  159. // }
  160. // });
  161. //项目名称
  162. var areaList = [];
  163. console.log(areaList);
  164. $.ajax({
  165. type: "get",
  166. url: huayi.config.callcenter_url + 'CusRegionCategory/GetListTreeDrop',
  167. async: false,
  168. data: {},
  169. dataType: 'json',
  170. success: function(data) {
  171. console.log(data)
  172. areaList = data.data;
  173. //alert(JSON.stringify(data));
  174. }
  175. });
  176. //接收人员
  177. //function getReceiveUser() {
  178. // renyuan=[]
  179. // console.log(renyuan);
  180. // $.ajax({
  181. // url: huayi.config.callcenter_url + 'UserAccount/GetDeptUserList',
  182. // type: 'get',
  183. // data: {
  184. // deptid: $('#recive_type').attr('data-index'),
  185. // },
  186. // dataType: "json",
  187. // async: true,
  188. // success: function(res) {
  189. //
  190. // if(res.state.toLowerCase() === "success") {
  191. // res = res.data;
  192. // if(res && res.length > 0) {
  193. // res.forEach(function(v, i) {
  194. // var obj1 = {};
  195. // obj1.value = v.F_UserId;
  196. // obj1.text = v.F_UserName;
  197. //// alert(obj1.text);
  198. // renyuan.push(obj1);
  199. // //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
  200. // });
  201. // cityPicker5.setData(renyuan);
  202. // }
  203. // }
  204. // },
  205. // });
  206. //}
  207. // 受理人
  208. function getOrderResponsible() {
  209. shouli = [];
  210. $.ajax({
  211. url: huayi.config.callcenter_url + 'CallInScreen/GetUserListByBuildingidDrop',
  212. type: 'get',
  213. data: {
  214. depid: $('#complaintOrder_type').attr('data-index'), // 否 int 部门id
  215. arearid: $('#order_rengin').attr('data-index'), // 否 int 区域id
  216. proid: $('#order_pro').attr('data-index'), // 是 int 姓名/项目id
  217. buildingid: $('#order_floor').attr('data-index') // 否 int 楼号id
  218. },
  219. dataType: "json",
  220. async: true,
  221. success: function(res) {
  222. if(res.state.toLowerCase() === "success") {
  223. res = res.data;
  224. if(res && res.length > 0) {
  225. res.forEach(function(v, i) {
  226. var obj = {};
  227. obj.value = v.F_UserCode;
  228. obj.text = v.F_UserName;
  229. shouli.push(obj);
  230. //$('<option value="' + v.F_UserCode + '">' + v.F_UserName + '</option>').appendTo('#order_responsible');
  231. });
  232. zhuTiPicker7.setData(shouli);
  233. }
  234. }
  235. },
  236. });
  237. }
  238. //房东关系
  239. var keyList = [];
  240. console.log(keyList);
  241. $.ajax({
  242. type: "get",
  243. url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlagWx',
  244. async: false,
  245. data: {
  246. flag: 'FZGX'
  247. },
  248. dataType: 'json',
  249. success: function(data) {
  250. var key_data = data.data;
  251. console.log(data.data);
  252. $(key_data).each(function(i, n) {
  253. var obj = {};
  254. obj.value = n.F_DictionaryValueId;
  255. obj.text = n.F_Name;
  256. keyList.push(obj)
  257. })
  258. }
  259. });
  260. (function($, doc) {
  261. $.init();
  262. $.ready(function() {
  263. // //项目名称
  264. var ZTiPickers = new $.PopPicker({
  265. layer: 3
  266. });
  267. var ZXs = doc.getElementById('showZhuTiPicker');
  268. var ZXResults = doc.getElementById('order_rengin');
  269. var ZXResults2 = doc.getElementById('order_pro');
  270. var ZXResults3 = doc.getElementById('order_floor');
  271. ZXs.addEventListener('tap', function(event) {
  272. ZTiPickers.setData(areaList);
  273. ZTiPickers.show(function(items) {
  274. console.log(items)
  275. if (items[1].text==undefined) {
  276. ZXResults.value = items[0].text;
  277. } else if (items[2].text==undefined) {
  278. ZXResults.value =items[0].text + "-" +items[1].text;
  279. } else {
  280. ZXResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
  281. }
  282. ZXResults.setAttribute("data-index", items[0].id);
  283. ZXResults2.setAttribute("data-index", items[1].id);
  284. ZXResults3.setAttribute("data-index", items[2].id);
  285. //返回 false 可以阻止选择框的关闭
  286. //return false;
  287. });
  288. }, false);
  289. //接收部门
  290. // var RCiPickers = new $.PopPicker({
  291. // layer: 3
  292. // });
  293. // RCiPickers.setData(recive);
  294. // var RCs = doc.getElementById('showUserPicker1');
  295. // var RCResults = doc.getElementById('recive_type');
  296. // var RCResults2 = doc.getElementById('recive_type1');
  297. // var RCResults3 = doc.getElementById('recive_type2');
  298. // RCs.addEventListener('tap', function(event) {
  299. // RCiPickers.show(function(items) {
  300. // console.log(items)
  301. // if (items[2].text==undefined) {
  302. // RCResults.value =items[1].text;
  303. // RCResults.setAttribute("data-index", items[1].id);
  304. // } else if (items[1].text==undefined) {
  305. // RCResults.value = items[0].text;
  306. // RCResults.setAttribute("data-index", items[0].id);
  307. // } else{
  308. // RCResults.value =items[2].text
  309. // RCResults.setAttribute("data-index", items[2].id);
  310. // }
  311. // //RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text;
  312. // //RCResults.setAttribute("data-index", items[0].id);
  313. // //返回 false 可以阻止选择框的关闭
  314. // //return false;
  315. // });
  316. // }, false);
  317. // 接收人员
  318. // cityPicker5 = new $.PopPicker();
  319. //
  320. // var showCityPickerButton5 = doc.getElementById('showCityPicker5');
  321. // var cityResult5 = doc.getElementById('ower_recive');
  322. // showCityPickerButton5.addEventListener('tap', function(event) {
  323. // getReceiveUser();
  324. // cityPicker5.show(function(items) {
  325. //
  326. // cityResult5.value = items[0].text;
  327. // cityResult5.setAttribute("data-index", items[0].value);
  328. // //返回 false 可以阻止选择框的关闭
  329. // //return false;
  330. // });
  331. // }, false);
  332. // 房东关系
  333. var cityPicker3 = new $.PopPicker();
  334. cityPicker3.setData(keyList);
  335. var showCityPickerButton = doc.getElementById('showCityPicker3');
  336. var cityResult3 = doc.getElementById('ower_relationship');
  337. showCityPickerButton.addEventListener('tap', function(event) {
  338. cityPicker3.show(function(items) {
  339. cityResult3.value = items[0].text;
  340. cityResult3.setAttribute("data-index", items[0].value);
  341. //返回 false 可以阻止选择框的关闭
  342. //return false;
  343. });
  344. }, false);
  345. //受理人
  346. // zhuTiPicker7 = new $.PopPicker();
  347. //
  348. // var showZhuTiPickerButton7 = doc.getElementById('showUserPicker2');
  349. // var zhuTiResult7 = doc.getElementById('order_responsible');
  350. // showZhuTiPickerButton7.addEventListener('tap', function(event) {
  351. // getOrderResponsible()
  352. //
  353. // zhuTiPicker7.show(function(items) {
  354. // zhuTiResult7.value = items[0].text;
  355. // zhuTiResult7.setAttribute("data-index", items[0].value);
  356. // //返回 false 可以阻止选择框的关闭
  357. // //return false;
  358. // });
  359. // }, false);
  360. //投诉类型
  361. // var userPicker = new $.PopPicker({
  362. // layer: 3
  363. // });
  364. // userPicker.setData(cityData3);
  365. // var showUserPickerButton = doc.getElementById('showUserPicker');
  366. // var userResult = doc.getElementById('complaintOrder_type');
  367. // var userResult2 = doc.getElementById('serviceOrder_type');
  368. // var userResult3 = doc.getElementById('is_quality_assurance');
  369. // showUserPickerButton.addEventListener('tap', function(event) {
  370. // userPicker.show(function(items) {
  371. // if (items[2].text==undefined) {
  372. // userResult.value = items[0].text + "-" + items[1].text;
  373. // } else if (items[1].text==undefined) {
  374. // userResult.value = items[0].text;
  375. // } else{
  376. // userResult.value = items[0].text + "-" + items[1].text + "-" + items[2].text
  377. // }
  378. // userResult.setAttribute("data-index", items[0].value);
  379. // userResult2.setAttribute("data-index", items[1].value);
  380. // userResult3.setAttribute("data-index", items[2].value);
  381. // //返回 false 可以阻止选择框的关闭
  382. // //return false;
  383. // });
  384. // }, false);
  385. })
  386. })(mui, document);
  387. })