No Description

index.js 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /**
  2. * Created by TT on 2018/3/22.
  3. */
  4. ;
  5. spa_define(function () {
  6. return $.use(["spa", "pagedatagrid", "util"], function (spa, pdgf, util) {
  7. return {
  8. main: function () {
  9. var root = spa.findInMain(".sys_ware_index");
  10. var pdg = pdgf.build(root);
  11. pdg.code.shell("showDay", function (env) {
  12. if (env.cd && env.cd[this.k]) {
  13. var day = env.cd[this.k];
  14. return day.substring(0, 4) + "年" + day.substring(4, 6) + "月" + day.substring(6, 8) + "日 " + day.substring(8, 10) + ":" + day.substring(10, 12);
  15. }
  16. return "";
  17. });
  18. pdg.code.listen($.dict.doTransfer);
  19. pdg.code.listen(function(){
  20. root.find(".hand-collectionid").each(function() {
  21. var $e = $(this);
  22. var collectionid = $e.attr("collectionid");
  23. util.get("/ajax/content/countProfessor",{id:collectionid,type:2},function(data){
  24. $e.text(data);
  25. },{});
  26. $e.removeClass("hand-collectionid");
  27. });
  28. root.find(".table-opt a.name").on("click",function () {
  29. var wareId = $(this).parent().attr("wareId");
  30. window.open('http://www.ekexiu.com/sevriceShow.html?sevriceId=' + wareId);
  31. })
  32. });
  33. root.find(".opt-query").on("click", function () {
  34. pdg.load();
  35. });
  36. pdg.load();
  37. root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
  38. var $this = $(this);
  39. $this.toggleClass("checked");
  40. if ($this.hasClass("checked")) {
  41. root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
  42. } else {
  43. root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
  44. }
  45. });
  46. root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
  47. var $this = $(this);
  48. $this.toggleClass("checked");
  49. });
  50. root.find(".opt-del").on("click", function() {
  51. var $ware = root.find("td.opt-check>i.checked");
  52. if ($ware.length) {
  53. var ret = [];
  54. $ware.each(function() {
  55. ret.push($(this).attr("wareId"));
  56. });
  57. util.boxMsg({
  58. title: "确认删除",
  59. content: "您是否要删除选中的服务?",
  60. btns: [{
  61. caption: "删除",
  62. hand: function () {
  63. util.post("../ajax/ware/deleteWare", {ids:ret}, function () {
  64. pdg.reload()
  65. }, {});
  66. }
  67. },
  68. {caption: "取消"}
  69. ]
  70. });
  71. } else {
  72. util.alert("请选择一个服务");
  73. }
  74. });
  75. root.find(".opt-sort").on("click", function() {
  76. var $ware = root.find("td.opt-check>i.checked");
  77. if($ware.length) {
  78. if($ware.length > 1) {
  79. util.alert("只能选择一个服务");
  80. } else {
  81. $.util.get("../ajax/ware/id/"+$ware.attr("wareId"),null,function(rd){
  82. if(rd){
  83. spa.showModal("sys_ware_sort", { data:rd, hand: function() { pdg.reload() } })
  84. }else{
  85. util.alertMsg("服务不存在", function(){pdg.reload();});
  86. }
  87. },{});
  88. }
  89. } else {
  90. util.alert("请选择一个服务");
  91. }
  92. });
  93. root.find(".opt-keywords").on("click", function() {
  94. var $ware = root.find("td.opt-check>i.checked");
  95. if($ware.length) {
  96. if($ware.length > 1) {
  97. util.alert("只能选择一个服务");
  98. } else {
  99. $.util.get("../ajax/ware/id/"+$ware.attr("wareId"),null,function(rd){
  100. if(rd){
  101. spa.showModal("sys_ware_keywords", { data:rd, hand: function() { pdg.reload() } })
  102. }else{
  103. util.alertMsg("服务不存在", function(){pdg.reload();});
  104. }
  105. },{});
  106. }
  107. } else {
  108. util.alert("请选择一个服务");
  109. }
  110. });
  111. root.find(".opt-view").on("click", function () {
  112. var $ware = root.find("td.opt-check>i.checked");
  113. if ($ware.length) {
  114. if ($ware.length > 1) {
  115. util.alert("只能选择一个服务");
  116. } else {
  117. window.open('http://www.ekexiu.com/sevriceShow.html?sevriceId=' + $ware.attr("resourceId"));
  118. }
  119. } else {
  120. util.alert("请选择一个服务");
  121. }
  122. });
  123. // root.find(".opt-edit").on("click", function() {
  124. // var $ware = root.find("td.opt-check>i.checked");
  125. // if($ware.length) {
  126. // if($ware.length > 1) {
  127. // util.alert("只能选择一个服务");
  128. // } else {
  129. // window.open('http://'+window.location.host+'/html/model/sys/resourceinfo/resourceIssue.html?resourceId=' + $ware.attr("wareId"));
  130. // }
  131. // } else {
  132. // util.alert("请选择一个服务");
  133. // }
  134. // });
  135. }, mainDestory: function () {
  136. }
  137. };
  138. });
  139. });