Sin descripción

addOrEditPerformanceReduce.js 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. var id = helper.request.queryString("id");
  2. $(document).ready(function () {
  3. getReactionCategory();
  4. $(".addBtn").click(function () {
  5. saveCon();
  6. });
  7. //获取知识库详情
  8. if (id) {
  9. $.ajax({
  10. type: "get",
  11. url: huayi.config.callcenter_url + "Achievements/GetModel",
  12. async: true,
  13. dataType: "json",
  14. data: {
  15. token: $.cookie("token"),
  16. id: id,
  17. },
  18. success: function (result) {
  19. if (result.state.toLowerCase() == "success") {
  20. var data = result.data;
  21. $("#workOrderId").val(data.F_WorkOrderId);
  22. $("#PID").val(data.F_Deptid);
  23. $(".inps").val(data.F_DeptName);
  24. $("#evaluation option:selected").text(data.F_Evaluation);
  25. $("#evaluation option:selected").val(data.F_Evaluation);
  26. $("#bonusitems option:selected").text(data.F_Bonusitems);
  27. $("#bonusitems option:selected").val(data.F_Bonusitems);
  28. $("#remark").val(data.F_Remarks);
  29. }
  30. },
  31. });
  32. }
  33. });
  34. //保存
  35. function saveCon() {
  36. $.ajax({
  37. type: "post",
  38. url: huayi.config.callcenter_url + "Achievements/AddAchievements",
  39. async: true,
  40. dataType: "json",
  41. data: {
  42. token: $.cookie("token"),
  43. F_ID: id,
  44. F_Type: 0, // 0减分项,1加分项
  45. F_WorkOrderId: $("#workOrderId").val(), // 工单编号
  46. F_Deptid: $("#PID").val(), // 部门id
  47. F_DeptName: $(".inps").val(), // 部门名称
  48. F_Evaluation: $("#evaluation option:selected").text(), // 考评内容
  49. F_Bonusitems: $("#bonusitems option:selected").text(), // 二级考评内容
  50. F_Remarks: $("#remark").val(), // 备注
  51. },
  52. success: function (data) {
  53. if (data.state.toLowerCase() == "success") {
  54. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  55. parent.layer.close(index); //再执行关闭
  56. parent.layer.msg(data.message); //再执行关闭
  57. parent.$("#tableList").bootstrapTable("refresh"); //再执行关闭
  58. }
  59. },
  60. });
  61. }
  62. //获取考评内容
  63. function getReactionCategory(pid = 2509) {
  64. $.ajax({
  65. type: "get",
  66. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListById",
  67. async: false,
  68. dataType: "json",
  69. data: {
  70. token: $.cookie("token"),
  71. id: pid,
  72. },
  73. success: function (result) {
  74. if (result.state.toLowerCase() == "success") {
  75. var content = result.data;
  76. $("#evaluation").empty();
  77. $("#evaluation").append("<option value=''>请选择</option>");
  78. $(content).each(function (i, e) {
  79. $("#evaluation").append(
  80. "<option value='" +
  81. e.F_ValueId +
  82. "'>" +
  83. e.F_Value +
  84. "</option>"
  85. );
  86. });
  87. }
  88. },
  89. });
  90. }
  91. // $("#evaluation").change(function () {
  92. // var pid = $("#evaluation").val();
  93. // var type = 1;
  94. // getReactionCategory(pid, type);
  95. // });