Nav apraksta

index.js 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /**
  2. * Created by TT on 2017/8/9.
  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_patent_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-patentid").each(function() {
  21. var $e = $(this);
  22. var patentid = $e.attr("patentid");
  23. if (patentid) {
  24. util.get("/ajax/content/lwCount/patent", {patentId: patentid}, function (data) {
  25. $e.text(data);
  26. }, {});
  27. $e.removeClass("hand-patentid");
  28. }
  29. });
  30. root.find(".hand-collectionid").each(function() {
  31. var $e = $(this);
  32. var collectionid = $e.attr("collectionid");
  33. util.get("/ajax/content/countProfessor",{id:collectionid,type:4},function(data){
  34. $e.text(data);
  35. },{});
  36. $e.removeClass("hand-collectionid");
  37. });
  38. root.find(".hand-agreeid").each(function() {
  39. var $e = $(this);
  40. var agreeid = $e.attr("agreeid");
  41. util.get("/ajax/patent/agreeCount",{id:agreeid},function(data){
  42. $e.text(data);
  43. },{});
  44. $e.removeClass("hand-agreeid");
  45. });
  46. });
  47. root.find(".opt-query").on("click", function () {
  48. pdg.load();
  49. });
  50. pdg.load();
  51. root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
  52. var $this = $(this);
  53. $this.toggleClass("checked");
  54. if ($this.hasClass("checked")) {
  55. root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
  56. } else {
  57. root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
  58. }
  59. });
  60. root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
  61. var $this = $(this);
  62. $this.toggleClass("checked");
  63. });
  64. // root.find(".opt-del").on("click", function() {
  65. // var $org = root.find("td.opt-check>i.checked");
  66. // if($org.length) {
  67. // var ret = [];
  68. // $org.each(function() {
  69. // ret.push($(this).attr("articleId"));
  70. // });
  71. // util.boxMsg({
  72. // title: "确认删除",
  73. // content: "您是否要删除选中的文章?",
  74. // btns: [{
  75. // caption: "删除",
  76. // hand: function () {
  77. // util.post("../ajax/patent/deleteArticle", {articleIds: ret}, function () {
  78. // pdg.reload()
  79. // }, {});
  80. // }
  81. // },
  82. // {caption: "取消"}
  83. // ]
  84. // });
  85. // } else {
  86. // util.alert("请选择一个用户");
  87. // }
  88. // });
  89. root.find(".opt-sort-num").on("click", function() {
  90. var $patent = root.find("td.opt-check>i.checked");
  91. if($patent.length) {
  92. if($patent.length > 1) {
  93. util.alert("只能选择一篇资源");
  94. } else {
  95. $.util.get("../ajax/patent/id/"+$patent.attr("patentId"),null,function(rd){
  96. if(rd){
  97. spa.showModal("sys_patent_sort", { data:rd, hand: function() { pdg.reload() } })
  98. }else{
  99. util.alertMsg("资源不存在", function(){pdg.reload();});
  100. }
  101. },{});
  102. }
  103. } else {
  104. util.alert("请选择一篇资源");
  105. }
  106. });
  107. root.find(".opt-keyword").on("click", function () {
  108. var $patent = root.find("td.opt-check>i.checked");
  109. if ($patent.length) {
  110. if ($patent.length > 1) {
  111. util.alert("只能选择一篇资源");
  112. } else {
  113. $.util.get("../ajax/patent/id/" + $patent.attr("patentId"), null, function (rd) {
  114. if (rd) {
  115. spa.showModal("sys_patent_keyword", {
  116. data: rd, hand: function () {
  117. pdg.reload()
  118. }
  119. })
  120. } else {
  121. util.alertMsg("资源不存在", function () {
  122. pdg.reload();
  123. });
  124. }
  125. }, {});
  126. }
  127. } else {
  128. util.alert("请选择一篇资源");
  129. }
  130. });
  131. root.find(".opt-view").on("click", function () {
  132. var $org = root.find("td.opt-check>i.checked");
  133. if ($org.length) {
  134. if ($org.length > 1) {
  135. util.alert("只能选择一篇资源");
  136. } else {
  137. window.open('http://www.ekexiu.com/patentShow.html?patentId=' + $org.attr("patentId"));
  138. }
  139. } else {
  140. util.alert("请选择一篇资源");
  141. }
  142. });
  143. }, mainDestory: function () {
  144. }
  145. };
  146. });
  147. });