hpSjlrZzzqEdit.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. $(function(){
  2. /* 滚轮 */
  3. var myScroll = new IScroll(".iscroll",{
  4. scrollbars: true,
  5. fadeScrollbars:true,
  6. scrollbars: 'custom',
  7. shrinkScrollbars:'clip',
  8. tap:true
  9. });
  10. setTimeout(function () {
  11. myScroll.refresh();
  12. }, 100);
  13. var theme="android-ics";
  14. $("#date").mobiscroll().date({
  15. lang: "zh",//显示中文
  16. theme: theme,//主题
  17. setText: '确定',//确认按钮名称
  18. cancelText: '取消',//取消按钮名称
  19. dateFormat: 'yy-mm-dd',// 日期格式
  20. dateOrder: 'yymmdd',//面板中日期排列格式
  21. display: 'bottom',//显示方式
  22. endYear:2050,//结束年份
  23. });
  24. $("#eph").bind("click", function() {
  25. var id = $("#id").val();
  26. if (id == "") {
  27. haifmp.loadMobilePage("haifmp", "getZzzqSearchDweb.htm?mcid=" + $("#mcid").val() + "&date=" + $("#date").val());
  28. }
  29. });
  30. //日期不能修改
  31. if ($("#id").val() != "" && $("#id").val() != "0"){
  32. $("#date" ).prop("disabled" , true);
  33. }
  34. var date = $("#date").val();
  35. var rq = date.split("-");
  36. var year = rq[0];
  37. var month = rq[1];
  38. var day = rq[2];
  39. var myDate = new Date();
  40. //获取当前年
  41. var y = myDate.getFullYear();
  42. //获取当前月
  43. var m = myDate.getMonth()+1;
  44. //获取当前日
  45. var d = myDate.getDate();
  46. //点击input键盘弹出滚动区域translateY往上滚动;
  47. $(document).ready(function () {
  48. var clickQian = document.body.clientHeight;
  49. var switcha = true;
  50. var a = null;
  51. $("input[type='text']").on("tap",function(){
  52. a = $(".content")[0].style.transform.split(',')[1].split(' ')[1].match(/\d+(\.\d+)?/)[0];
  53. if($("input[type='number']") && switcha){
  54. setTimeout(function(){
  55. var clickHou = document.body.clientHeight;
  56. var zimujpHeight = clickQian - clickHou - a - 218 + "px";
  57. $(".content")[0].style.transform = "translateY(-"+zimujpHeight+")";
  58. myScroll.refresh();
  59. switcha = false;
  60. },250);
  61. }
  62. });
  63. });
  64. //元素失去焦点隐藏软键盘
  65. $("#zzzqForm").on("tap",function(e){
  66. if(e.target.nodeName != "INPUT"){
  67. $('input').blur();
  68. };
  69. });
  70. });
  71. /**
  72. * 保存
  73. * @param type
  74. */
  75. function saveZzzq(type) {
  76. var dweb = $("#dweb").val();
  77. var eph = $("#eph").val();
  78. if (eph == "") {
  79. alert("请输入正确的耳牌号!");
  80. return false;
  81. } else {
  82. jQuery('#zzzqForm').ajaxSubmit({
  83. dataType : 'json',
  84. data : {"mcid" : $("#mcid").val(),
  85. "dweb" : dweb
  86. },
  87. success : function(data) {
  88. // 保存成功
  89. if (data.count > 0) {
  90. alert("保存成功!");
  91. if (type == "1") {
  92. haifmp.loadMobilePage("haifmp", "hpSjlrZzzqIndex.htm?mcid=" + $("#mcid").val());
  93. return;
  94. } else {
  95. haifmp.loadMobilePage("haifmp", "hpSjlrZzzqEdit.htm?mcid=" + $("#mcid").val());
  96. }
  97. }
  98. },
  99. error : function(data) {
  100. alert("保存失败!系统错误!");
  101. }
  102. });
  103. }
  104. }
  105. /**
  106. * 返回
  107. */
  108. function backUrl() {
  109. haifmp.loadMobilePage("haifmp", "hpSjlrZzzqIndex.htm?mcid=" + $("#mcid").val());
  110. }