Няма описание

myindex.js 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ;
  2. spa_define(function() {
  3. return $.use(["spa", "pagedatagrid", "util"], function(spa, pdgf, util) {
  4. return {
  5. main: function() {
  6. var root = spa.findInMain(".sys_customer_myindex");
  7. var pdg = pdgf.build(root);
  8. pdg.code.shell("showDay", function(env) {
  9. if (env.cd && env.cd[this.k]) {
  10. var day = env.cd[this.k];
  11. return day.substring(0, 4) + "-" + day.substring(4, 6) + "-" + day.substring(6, 8);
  12. }
  13. return "";
  14. });
  15. pdg.code.listen($.dict.doTransfer);
  16. root.find(".opt-query").on("click", function() {
  17. pdg.load();
  18. });
  19. pdg.load();
  20. root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function() {
  21. var $this = $(this);
  22. $this.toggleClass("checked");
  23. if($this.hasClass("checked")) {
  24. root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
  25. } else {
  26. root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
  27. }
  28. });
  29. root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function() {
  30. var $this = $(this);
  31. $this.toggleClass("checked");
  32. });
  33. root.find(".opt-mail").on("click", function() {
  34. var $org = root.find("td.opt-check>i.checked");
  35. if($org.length) {
  36. var emails = [];
  37. var phones = [];
  38. var inviteCodes = [];
  39. var names = [];
  40. $org.each(function() {
  41. emails.push($(this).attr("email"));
  42. phones.push($(this).attr("phone"));
  43. inviteCodes.push($(this).attr("inviteCode"));
  44. names.push($(this).attr("name"));
  45. });
  46. var rd = {emails: emails, phones: phones,inviteCodes:inviteCodes,names:names};
  47. spa.showModal("sys_customer_myindex_mail", rd);
  48. // util.boxMsg({
  49. // });
  50. } else {
  51. util.alert("请选择一个用户");
  52. }
  53. });
  54. root.on("click", ".icon-edit", function() {
  55. var $this = $(this);
  56. var powerId = $this.parent().attr("powerId");
  57. util.get("../ajax/sys/mycustomer/id/" + powerId, null, function(rd) {
  58. if (rd) {
  59. spa.showModal("sys_customer_myedit", {
  60. data: rd,
  61. hand: function() {
  62. pdg.load()
  63. }
  64. })
  65. } else {
  66. util.alert("客户选择有误", function() {
  67. pdg.load();
  68. });
  69. }
  70. }, {});
  71. });
  72. root.on("click",".table-opt a.name", function () {
  73. var professorId = $(this).parent().attr("professorId");
  74. window.open('http://www.ekexiu.com/information-brow.html?professorId=' + professorId);
  75. });
  76. }
  77. };
  78. });
  79. });