Keine Beschreibung

editWorkolder.js 12KB

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