Geen omschrijving

index.js 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. root.find(".table-opt a.name").on("click",function () {
  47. // var patentId = $(this).parent().attr("patentid");
  48. var time = $(this).parent().attr("createTime").substring(0,8);
  49. var shareId = $(this).parent().attr("shareId");
  50. // window.open('http://www.ekexiu.com/patentShow.html?patentId=' + patentId);
  51. window.open('http://www.ekexiu.com/shtml/pt/'+time+'/' + shareId+'.html');
  52. })
  53. });
  54. root.find(".opt-query").on("click", function () {
  55. pdg.load();
  56. });
  57. pdg.load();
  58. root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
  59. var $this = $(this);
  60. $this.toggleClass("checked");
  61. if ($this.hasClass("checked")) {
  62. root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
  63. } else {
  64. root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
  65. }
  66. });
  67. root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
  68. var $this = $(this);
  69. $this.toggleClass("checked");
  70. });
  71. // root.find(".opt-del").on("click", function() {
  72. // var $org = root.find("td.opt-check>i.checked");
  73. // if($org.length) {
  74. // var ret = [];
  75. // $org.each(function() {
  76. // ret.push($(this).attr("articleId"));
  77. // });
  78. // util.boxMsg({
  79. // title: "确认删除",
  80. // content: "您是否要删除选中的文章?",
  81. // btns: [{
  82. // caption: "删除",
  83. // hand: function () {
  84. // util.post("../ajax/patent/deleteArticle", {articleIds: ret}, function () {
  85. // pdg.reload()
  86. // }, {});
  87. // }
  88. // },
  89. // {caption: "取消"}
  90. // ]
  91. // });
  92. // } else {
  93. // util.alert("请选择一个用户");
  94. // }
  95. // });
  96. root.find(".opt-sort-num").on("click", function() {
  97. var $patent = root.find("td.opt-check>i.checked");
  98. if($patent.length) {
  99. if($patent.length > 1) {
  100. util.alert("只能选择一篇资源");
  101. } else {
  102. $.util.get("../ajax/patent/id/"+$patent.attr("patentId"),null,function(rd){
  103. if(rd){
  104. spa.showModal("sys_patent_sort", { data:rd, hand: function() { pdg.reload() } })
  105. }else{
  106. util.alertMsg("资源不存在", function(){pdg.reload();});
  107. }
  108. },{});
  109. }
  110. } else {
  111. util.alert("请选择一篇资源");
  112. }
  113. });
  114. root.find(".opt-keyword").on("click", function () {
  115. var $patent = root.find("td.opt-check>i.checked");
  116. if ($patent.length) {
  117. if ($patent.length > 1) {
  118. util.alert("只能选择一篇资源");
  119. } else {
  120. $.util.get("../ajax/patent/id/" + $patent.attr("patentId"), null, function (rd) {
  121. if (rd) {
  122. spa.showModal("sys_patent_keyword", {
  123. data: rd, hand: function () {
  124. pdg.reload()
  125. }
  126. })
  127. } else {
  128. util.alertMsg("资源不存在", function () {
  129. pdg.reload();
  130. });
  131. }
  132. }, {});
  133. }
  134. } else {
  135. util.alert("请选择一篇资源");
  136. }
  137. });
  138. root.find(".opt-view").on("click", function () {
  139. var $patent = root.find("td.opt-check>i.checked");
  140. if ($patent.length) {
  141. if ($patent.length > 1) {
  142. util.alert("只能选择一篇资源");
  143. } else {
  144. var time = $patent.attr("createTime").substring(0,8);
  145. var shareId = $patent.attr("shareId");
  146. // window.open('http://www.ekexiu.com/patentShow.html?patentId=' + $patent.attr("patentId"));
  147. window.open('http://www.ekexiu.com/shtml/pt/'+time+'/' + shareId+'.html');
  148. }
  149. } else {
  150. util.alert("请选择一篇资源");
  151. }
  152. });
  153. }, mainDestory: function () {
  154. }
  155. };
  156. });
  157. });