process_info.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**
  2. * 初始化报销管理详情对话框
  3. */
  4. var ExpenseInfoDlg = {
  5. expenseInfoData : {}
  6. };
  7. /**
  8. * 清除数据
  9. */
  10. ExpenseInfoDlg.clearData = function() {
  11. this.expenseInfoData = {};
  12. }
  13. /**
  14. * 设置对话框中的数据
  15. *
  16. * @param key 数据的名称
  17. * @param val 数据的具体值
  18. */
  19. ExpenseInfoDlg.set = function(key, val) {
  20. this.expenseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  21. return this;
  22. }
  23. /**
  24. * 设置对话框中的数据
  25. *
  26. * @param key 数据的名称
  27. * @param val 数据的具体值
  28. */
  29. ExpenseInfoDlg.get = function(key) {
  30. return $("#" + key).val();
  31. }
  32. /**
  33. * 关闭此对话框
  34. */
  35. ExpenseInfoDlg.close = function() {
  36. parent.layer.close(window.parent.Expense.layerIndex);
  37. }
  38. /**
  39. * 收集数据
  40. */
  41. ExpenseInfoDlg.collectData = function() {
  42. this
  43. .set('id')
  44. .set('money')
  45. .set('desc')
  46. ;
  47. }
  48. /**
  49. * 提交添加
  50. */
  51. ExpenseInfoDlg.addSubmit = function() {
  52. this.clearData();
  53. this.collectData();
  54. //提交信息
  55. var ajax = new $ax(Feng.ctxPath + "/expense/add", function(data){
  56. Feng.success("添加成功!");
  57. window.parent.Expense.table.refresh();
  58. ExpenseInfoDlg.close();
  59. },function(data){
  60. Feng.error("添加失败!" + data.responseJSON.message + "!");
  61. });
  62. ajax.set(this.expenseInfoData);
  63. ajax.start();
  64. }
  65. /**
  66. * 提交修改
  67. */
  68. ExpenseInfoDlg.editSubmit = function() {
  69. this.clearData();
  70. this.collectData();
  71. //提交信息
  72. var ajax = new $ax(Feng.ctxPath + "/expense/update", function(data){
  73. Feng.success("修改成功!");
  74. window.parent.Expense.table.refresh();
  75. ExpenseInfoDlg.close();
  76. },function(data){
  77. Feng.error("修改失败!" + data.responseJSON.message + "!");
  78. });
  79. ajax.set(this.expenseInfoData);
  80. ajax.start();
  81. }
  82. $(function() {
  83. });