Brak opisu

index.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * Created by TT on 2017/5/8.
  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_demand_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);
  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.on("click", ".opt-auth", function () {
  24. var demandId = $(this).parent().attr("demandId");
  25. if (demandId) {
  26. util.boxMsg({
  27. title: "确认关闭",
  28. content: "您是否要关闭选中的需求!!!!!!!!!!!!!!!!!!",
  29. btns: [{
  30. caption: "关闭", hand: function () {
  31. util.post("../ajax/demand/close", {
  32. id: demandId
  33. }, function () {
  34. pdg.reload();
  35. });
  36. }
  37. },
  38. {caption: "取消"}
  39. ]
  40. });
  41. }
  42. });
  43. var bindDataEvent = function() {
  44. root.find(".table-opt a.title").on("click", function () {
  45. var demandId = $(this).parent().attr("demandId");
  46. window.open('http://www.ekexiu.com/demandShow.html?demandId=' + demandId);
  47. });
  48. };
  49. pdg.code.listen(bindDataEvent);
  50. }
  51. };
  52. });
  53. });