No Description

buttedpro.js 4.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /**
  2. * Created by TT on 2018/5/25.
  3. */
  4. ;
  5. spa_define(function () {
  6. return $.use(["spa", "pagedatagrid", "util","form"], function (spa, pdgf, util,form) {
  7. return {
  8. main: function () {
  9. var root = spa.findInMain(".sys_buttedpro_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. root.find(".opt-query").on("click", function () {
  20. if(pdg.form.val().pid == null){
  21. util.alert("请先选择一个平台");
  22. return;
  23. }
  24. pdg.load();
  25. });
  26. if (pdg.form.val().pid == null) {
  27. root.find(".ifempty").hide();
  28. }
  29. root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
  30. var $this = $(this);
  31. $this.toggleClass("checked");
  32. if ($this.hasClass("checked")) {
  33. root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
  34. } else {
  35. root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
  36. }
  37. });
  38. root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
  39. var $this = $(this);
  40. $this.toggleClass("checked");
  41. });
  42. root.find(".opt-new").on("click", function () {
  43. var pid = pdg.form.val().pid;
  44. if(pid==null) {
  45. util.alert("请先选择一个平台");
  46. return;
  47. }
  48. spa.showModal("sys_buttedpro_new", {
  49. data:pid,
  50. hand: function() {
  51. pdg.reload()
  52. }
  53. })
  54. });
  55. root.find(".opt-del").on("click", function () {
  56. var $proId = root.find("td.opt-check>i.checked");
  57. if ($proId.length) {
  58. if ($proId.length > 1) {
  59. util.alert("只能选择一个专家");
  60. } else {
  61. var proId = $proId.attr("proId");
  62. var platformId = pdg.form.val().pid;
  63. util.boxMsg({
  64. title: "确认删除",
  65. content: "您是否要删除选中的对接专家?",
  66. btns: [{
  67. caption: "删除",
  68. hand: function () {
  69. util.post(baseUrl + "/ajax/platform/buttedProfessor/delete", {
  70. uid: proId,
  71. pid: platformId
  72. }, function () {
  73. pdg.reload()
  74. }, {});
  75. }
  76. },
  77. {caption: "取消"}
  78. ]
  79. });
  80. }
  81. } else {
  82. util.alert("请选择一个专家");
  83. }
  84. });
  85. root.on("click", "div .select-item", function() {
  86. pdg.load();
  87. });
  88. }, mainDestory: function () {
  89. }
  90. };
  91. });
  92. });