暂无描述

myedit.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ;
  2. spa_define(function() {
  3. return $.use(["spa", "code", "util", "form"], function(spa, code, util, form) {
  4. return {
  5. modal: function(data) {
  6. var root = spa.findInModal(".sys_customer_myedit");
  7. root.find(".modal-ctrl .icon-times").on("click", function() {
  8. spa.closeModal();
  9. });
  10. var ef = form.build(root.find(".opt-form"));
  11. ef.val(data.data);
  12. var addf = form.build(root.find(".opt-addform"));
  13. var userid = util.data("loginUser").id;
  14. var cusername = util.data("loginUser").name;
  15. addf.val({
  16. professorId: data.data.id,
  17. cuserId: userid,
  18. cuserName: cusername
  19. });
  20. root.find(".opt-save").on("click", function() {
  21. addf.doPost("../ajax/sys/crecord", function() {
  22. var date = new Date(),
  23. month = date.getMonth() + 1,
  24. day = date.getDate();
  25. var myDate = "" + date.getFullYear() + (month > 9 ? month : ("0" + month)) + (day > 9 ? day : ("0" + day));
  26. var dd = {
  27. descp: addf.val().descp,
  28. cuserName: cusername,
  29. createTime: myDate
  30. };
  31. //var dd =;
  32. allData.push(dd);
  33. cr.val(allData);
  34. ef.doPost("../ajax/sys/cpow/updatacpow", function() {}, {});
  35. }, {});
  36. });
  37. var cr = code.parseCode(root.find(".dt-tpl"));
  38. cr.shell("showDay", function(env) {
  39. if (env.cd && env.cd[this.k]) {
  40. var day = env.cd[this.k];
  41. return day.substring(0, 4) + "-" + day.substring(4, 6) + "-" + day.substring(6, 8);
  42. }
  43. return "";
  44. });
  45. var allData;
  46. util.get("../ajax/sys/crecord/qrecord?professorId=" + data.data.id, null, function(data) {
  47. allData = data || [];
  48. cr.val(data);
  49. }, {});
  50. }
  51. };
  52. });
  53. });