amountStandard.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /**
  2. * 人才津贴配置管理初始化
  3. */
  4. var AmountStandard = {
  5. id: "AmountStandardTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. AmountStandard.initColumn = function () {
  14. return [
  15. {field: 'selectItem', radio: true},
  16. {title: '人才类型', field: 'type', visible: true, align: 'center', valign: 'middle',
  17. formatter:function (value,row,index) {
  18. if(value==1){
  19. return "晋江市现代产业体系人才";
  20. }
  21. if(value==2){
  22. return "集成电路优秀人才";
  23. }
  24. }
  25. },
  26. {title: '津贴类别', field: 'allowanceType', visible: true, align: 'center', valign: 'middle',
  27. formatter:function (value,row,index) {
  28. if(value==1){
  29. return "人才津贴";
  30. }
  31. if(value==2){
  32. return "交通津贴";
  33. }
  34. if(value==3){
  35. return "购房补贴";
  36. }
  37. }
  38. },
  39. {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle'},
  40. {title: '金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
  41. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'}
  42. ];
  43. };
  44. /**
  45. * 检查是否选中
  46. */
  47. AmountStandard.check = function () {
  48. var selected = $('#' + this.id).bootstrapTable('getSelections');
  49. if(selected.length == 0){
  50. Feng.info("请先选中表格中的某一记录!");
  51. return false;
  52. }else{
  53. AmountStandard.seItem = selected[0];
  54. return true;
  55. }
  56. };
  57. /**
  58. * 点击添加人才津贴配置
  59. */
  60. AmountStandard.openAddAmountStandard = function () {
  61. var index = layer.open({
  62. type: 2,
  63. title: '添加人才津贴配置',
  64. area: ['800px', '420px'], //宽高
  65. fix: false, //不固定
  66. maxmin: true,
  67. content: Feng.ctxPath + '/amountStandard/amountStandard_add'
  68. });
  69. this.layerIndex = index;
  70. };
  71. /**
  72. * 打开查看人才津贴配置详情
  73. */
  74. AmountStandard.openAmountStandardDetail = function () {
  75. if (this.check()) {
  76. var index = layer.open({
  77. type: 2,
  78. title: '人才津贴配置详情',
  79. area: ['800px', '420px'], //宽高
  80. fix: false, //不固定
  81. maxmin: true,
  82. content: Feng.ctxPath + '/amountStandard/amountStandard_update/' + AmountStandard.seItem.id
  83. });
  84. this.layerIndex = index;
  85. }
  86. };
  87. /**
  88. * 删除人才津贴配置
  89. */
  90. AmountStandard.delete = function () {
  91. if (this.check()) {
  92. var operation = function() {
  93. var ajax = new $ax(Feng.ctxPath + "/amountStandard/delete", function (data) {
  94. if(data.code==200){
  95. AmountStandard.table.refresh();
  96. Feng.success(data.msg);
  97. }else{
  98. Feng.info(data.msg);
  99. }
  100. }, function (data) {
  101. Feng.error("删除失败!" + data.responseJSON.message + "!");
  102. });
  103. ajax.set("amountStandardId", this.seItem.id);
  104. ajax.start();
  105. };
  106. Feng.confirm("确定要删除吗?", operation);
  107. }
  108. };
  109. /**
  110. * 查询表单提交参数对象
  111. * @returns {{}}
  112. */
  113. AmountStandard.formParams = function() {
  114. var queryData = {};
  115. queryData['type'] = $("#type").val();
  116. queryData['allowanceType'] = $("#allowanceType").val();
  117. return queryData;
  118. }
  119. /**
  120. * 查询批次管理列表
  121. */
  122. AmountStandard.search = function () {
  123. AmountStandard.table.refresh({query: AmountStandard.formParams()});
  124. };
  125. /**
  126. * 重置
  127. */
  128. AmountStandard.reset = function (){
  129. $("#type").val("");
  130. $("#allowanceType").val("");
  131. }
  132. $(function () {
  133. var defaultColunms = AmountStandard.initColumn();
  134. var table = new BSTable(AmountStandard.id, "/amountStandard/list", defaultColunms);
  135. table.setPaginationType("server");
  136. AmountStandard.table = table.init();
  137. });