Нет описания

salesedit.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_salesedit");
  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. var descps = document.getElementById("temdescp").querySelector("textarea");
  16. root.find(".opt-save").on("click", function() {
  17. var sss = "领导点评: " + descps.value;
  18. addf.val({
  19. professorId: data.data.id,
  20. cuserId: userid,
  21. cuserName: cusername,
  22. descp: sss
  23. });
  24. addf.doPost("../ajax/sys/crecord", function() {
  25. var date = new Date(),
  26. month = date.getMonth() + 1,
  27. day = date.getDate();
  28. var myDate = "" + date.getFullYear() + (month > 9 ? month : ("0" + month)) + (day > 9 ? day : ("0" + day));
  29. var dd = {
  30. descp: sss,
  31. cuserName: cusername,
  32. createTime: myDate
  33. };
  34. //var dd =;
  35. allData.push(dd);
  36. cr.val(allData);
  37. ef.doPost("../ajax/sys/cpow/updatacpow", function() {}, {});
  38. }, {});
  39. });
  40. var cr = code.parseCode(root.find(".dt-tpl"));
  41. cr.shell("showDay", function(env) {
  42. if (env.cd && env.cd[this.k]) {
  43. var day = env.cd[this.k];
  44. return day.substring(0, 4) + "-" + day.substring(4, 6) + "-" + day.substring(6, 8);
  45. }
  46. return "";
  47. });
  48. var allData;
  49. util.get("../ajax/sys/crecord/qrecord?professorId=" + data.data.id, null, function(data) {
  50. allData = data || [];
  51. cr.val(data);
  52. }, {});
  53. }
  54. };
  55. });
  56. });