samelevelTransfer.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //通用弹出式文件上传
  2. function commonUpload(callback){
  3. $.dialog({
  4. content: "url:systemController.do?commonUpload",
  5. lock : true,
  6. title:"文件上传",
  7. zIndex:2100,
  8. width:700,
  9. height: 200,
  10. parent:windowapi,
  11. cache:false,
  12. ok: function(){
  13. var iframe = this.iframe.contentWindow;
  14. iframe.uploadCallback(callback);
  15. return true;
  16. },
  17. cancelVal: '关闭',
  18. cancel: function(){
  19. }
  20. });
  21. }
  22. function decode(value, id) {//value传入值,id接受值
  23. var last = value.lastIndexOf("/");
  24. var filename = value.substring(last + 1, value.length);
  25. $("#" + id).text(decodeURIComponent(filename));
  26. }
  27. //取得当月的最后一天
  28. function getCurrentMonthLast(){
  29. var date=new Date();
  30. var currentMonth=date.getMonth();
  31. var nextMonth=++currentMonth;
  32. var nextMonthFirstDay=new Date(date.getFullYear(),nextMonth,1);
  33. var oneDay=1000*60*60*24;
  34. return new Date(nextMonthFirstDay-oneDay);
  35. }
  36. //取得后一天日期
  37. function getNextDay(d){
  38. d = new Date(d);
  39. d = +d + 1000*60*60*24;
  40. d = new Date(d);
  41. //return d;
  42. //格式化
  43. return d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
  44. }
  45. //日期格式化
  46. Date.prototype.Format = function (fmt) { //author: meizz
  47. var o = {
  48. "M+": this.getMonth() + 1, //月份
  49. "d+": this.getDate(), //日
  50. "h+": this.getHours(), //小时
  51. "m+": this.getMinutes(), //分
  52. "s+": this.getSeconds(), //秒
  53. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  54. "S": this.getMilliseconds() //毫秒
  55. };
  56. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  57. for (var k in o)
  58. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  59. return fmt;
  60. }