list-xuetangyi.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. var category_code = null;
  2. var patient = null;
  3. mui.init();
  4. mui.plusReady(function() {
  5. plus.nativeUI.showWaiting();
  6. self = plus.webview.currentWebview();
  7. category_code = self.category_code;
  8. patient = self.patient;
  9. initPage();
  10. });
  11. function initPage(){
  12. getDevices();
  13. }
  14. function getDevices(){
  15. var params = {};
  16. params.category_code= category_code;
  17. sendGet("common/device/DeviceList",params,queryListFailed,queryListSuccess);
  18. }
  19. function queryListSuccess(res){
  20. plus.nativeUI.closeWaiting();
  21. if(res.status==200){
  22. if(res.data&&res.data.length>0){
  23. for(var i in res.data){
  24. showList(res.data[i]);
  25. }
  26. }else{
  27. mui.toast("无更多设备");
  28. }
  29. }else{
  30. queryListFailed(res);
  31. }
  32. }
  33. function showList(rowData){
  34. var showDomLi = '<li class="inp'+rowData.id+'" >'+
  35. '<div class="div-xuetangyi-img">'+
  36. '<img src="'+getImgUrl(rowData.photo)+'" ></div>'+
  37. '<div class="deviceTitle">'+rowData.name+'</div>'+
  38. '</li>';
  39. $(".c-list").append(showDomLi);
  40. $(".inp"+rowData.id+" div").click(function(){
  41. var params = {};
  42. params.deviceId = rowData.id;
  43. params.patient = patient;
  44. openWebviewExtras("edit-xuetangyi.html",params)
  45. })
  46. }
  47. function queryListFailed(res) {
  48. plus.nativeUI.closeWaiting();
  49. if (res && res.msg) {
  50. mui.toast(res.msg);
  51. } else {
  52. mui.toast("加载设备型号列表失败!");
  53. }
  54. }