RoadFlow2.1 临时演示

roadui.calendar.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //日期
  2. ; RoadUI.Calendar = function ()
  3. {
  4. var instance = this;
  5. this.init = function ($cts)
  6. {
  7. $.each($cts, function ()
  8. {
  9. var istime = $(this).attr("istime");
  10. var minDate = $(this).attr("mindate");
  11. var maxDate = $(this).attr("maxdate");
  12. var daybefor = $(this).attr("daybefor");
  13. var dayafter = $(this).attr("dayafter");
  14. var currentmonth = $(this).attr("currentmonth");
  15. var format = $(this).attr("format");
  16. if (!format || format.length == 0)
  17. {
  18. format = "yyyy-MM-dd";
  19. if (istime != null && (istime.toLowerCase() == "true" || istime == "1"))
  20. {
  21. format = "yyyy-MM-dd HH:mm";
  22. }
  23. }
  24. var opts = { dateFmt: format };
  25. if (minDate)
  26. {
  27. opts.minDate = minDate;
  28. }
  29. if (maxDate)
  30. {
  31. opts.maxDate = maxDate;
  32. }
  33. if (daybefor != null && (daybefor.toLowerCase() == "true" || daybefor == "1"))
  34. {
  35. opts.maxDate = '%y-%M-%d';
  36. }
  37. if (dayafter != null && (dayafter.toLowerCase() == "true" || dayafter == "1"))
  38. {
  39. opts.minDate = '%y-%M-{%d}';
  40. }
  41. if (currentmonth != null && (currentmonth.toLowerCase() == "true" || currentmonth == "1"))
  42. {
  43. opts.minDate = '%y-%M-01';
  44. opts.maxDate = '%y-%M-%ld';
  45. }
  46. $(this).removeClass().addClass("mytext").bind("click", function ()
  47. {
  48. WdatePicker(opts);
  49. });
  50. });
  51. };
  52. }