contract_list.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. $(function () {
  2. });
  3. /*
  4. 参数解释:
  5. title 标题
  6. url 请求的url
  7. id 需要操作的数据id
  8. w 弹出层宽度(缺省调默认值)
  9. h 弹出层高度(缺省调默认值)
  10. */
  11. /*管理员-增加*/
  12. function contract_dialog(title, url, w, h) {
  13. var index = layer_show(title, pagePath+url, w, h);
  14. layer.full(index);
  15. }
  16. //管理员-删除
  17. function contract_del(url) {
  18. layer.confirm('确认要删除吗?', function () {
  19. //此处请求后台程序,下方是成功后的前台处理……
  20. $.ajax({
  21. type: "delete",
  22. dataType: "json",
  23. url: pagePath+url,
  24. data: {
  25. "timestamp": new Date().getTime(),
  26. },
  27. success: function (result) {
  28. if (result.success) {
  29. smileMessage(result.message);
  30. setTime();
  31. } else {
  32. errorMessage(result.message);
  33. }
  34. },
  35. error: function () {
  36. errorMessage('系统错误!');
  37. }
  38. });
  39. });
  40. }
  41. function contract_archive(url) {
  42. getSelectedItem();
  43. var ids = [];
  44. if(null != item_selected_arr){
  45. ids = getIdsFromItemArr(item_selected_arr);
  46. }
  47. var objIndex = [];
  48. var obj = $("input[name='id']:checked");
  49. if (obj.length == 0) {
  50. errorMessage("请选择合同");
  51. return false;
  52. }
  53. //使用中合同不能归档
  54. var canArchive = true;
  55. obj.each(function (index, item) {
  56. if($(this).attr("status")=="0"){
  57. canArchive = false;
  58. return false;
  59. }
  60. /*ids.push(item.value);*/
  61. objIndex.push(item.id);
  62. });
  63. if(!canArchive){
  64. sadMessage("使用中合同不能归档,请重新选择!");
  65. return false;
  66. }
  67. layer.confirm('确认要归档吗?', function (index) {
  68. //此处请求后台程序,下方是成功后的前台处理……
  69. $.ajax({
  70. type: "PUT",
  71. dataType: "json",
  72. url: pagePath+url,
  73. data: {
  74. "timestamp": new Date().getTime(),
  75. "ids": ids
  76. },
  77. success: function (result) {
  78. if (result.success) {
  79. setTime();
  80. smileMessage(result.message)
  81. } else {
  82. errorMessage(result.message);
  83. }
  84. },
  85. error: function () {
  86. errorMessage('系统错误!');
  87. }
  88. });
  89. });
  90. }