Brak opisu

index.js 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * Created by TT on 2017/7/25.
  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_feedback_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. pdg.load();
  21. });
  22. pdg.load();
  23. root.find(".dt-tpl").on("click", "th.opt-check>i.icon-st-check", function () {
  24. var $this = $(this);
  25. $this.toggleClass("checked");
  26. if ($this.hasClass("checked")) {
  27. root.find(".dt-tpl td.opt-check>i.icon-st-check").addClass("checked");
  28. } else {
  29. root.find(".dt-tpl td.opt-check>i.icon-st-check").removeClass("checked");
  30. }
  31. });
  32. root.find(".dt-tpl").on("click", "td.opt-check>i.icon-st-check", function () {
  33. var $this = $(this);
  34. $this.toggleClass("checked");
  35. });
  36. root.find(".opt-edit").on("click", function () {
  37. var $org = root.find("td.opt-check>i.checked");
  38. if ($org.length) {
  39. if ($org.length > 1) {
  40. util.alert("只能选择一个用户");
  41. } else {
  42. util.get("../ajax/feedback/id/" + $org.attr("feedbackId"), null, function (data) {
  43. if (data) {
  44. spa.showModal("sys_feedback_operate", {
  45. data: data,
  46. hand: function () {
  47. pdg.reload()
  48. }
  49. })
  50. } else {
  51. util.alert("用户不存在了", function () {
  52. pdg.reload();
  53. });
  54. }
  55. }, {});
  56. }
  57. } else {
  58. util.alert("请选择一个用户");
  59. }
  60. });
  61. }, mainDestory: function () {
  62. }
  63. };
  64. });
  65. });