Brak opisu

equipment_management_modify.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. var id = helper.request.queryString("id");
  2. $(document).ready(function () {
  3. //获取详情
  4. getEquipmentDetails()
  5. //保存
  6. $('.customerSubmit').click(function() {
  7. saveCustomer();
  8. });
  9. })
  10. //设备详情
  11. function getEquipmentDetails() {
  12. $.ajax({
  13. type: "get",
  14. url: huayi.config.callcenter_url + "EquipmentNumber/GetDetails",
  15. dataType: "json",
  16. async: true,
  17. data: {
  18. token: $.cookie("token"),
  19. id: id,
  20. },
  21. success: function(data){
  22. if (data.state.toLowerCase() == "success") {
  23. var data = data.rows;
  24. displayEquipmentDetails(data);
  25. }
  26. }
  27. })
  28. }
  29. //回显
  30. function displayEquipmentDetails(data) {
  31. $("#addProduction").val(data.F_Production); //生产单位
  32. $("#addFactoryCode").val(data.F_FactoryCode); //工程代码
  33. $("#addLigatureMachineCode").val(data.F_LigatureMachineCode); //结扎机编号
  34. $("#addStretchFilmCode").val(data.F_StretchFilmCode); //拉伸膜包装机编号
  35. $("#addQCStaffCode").val(data.F_QCStaffCode); //品管员代码
  36. }
  37. //保存
  38. function saveCustomer() {
  39. $.ajax({
  40. type: "post",
  41. url: huayi.config.callcenter_url + "EquipmentNumber/Update",
  42. dataType: 'json',
  43. async: true,
  44. beforeSend: function() { //触发ajax请求开始时执行
  45. $('.customerSubmit').attr("disabled", true);
  46. $('.customerSubmit').text('确定中...');
  47. },
  48. data: {
  49. token: $.cookie("token"),
  50. F_ID: id,
  51. F_Production: $("#addProduction").val(),//生产单位
  52. F_FactoryCode: $("#addFactoryCode").val(),//工厂代码
  53. F_LigatureMachineCode: $("#addLigatureMachineCode").val(),//结扎机编号
  54. F_StretchFilmCode: $("#addStretchFilmCode").val(),//拉伸膜包装机编号
  55. F_QCStaffCode: $("#addQCStaffCode").val(),//品管员代码
  56. },
  57. success: function(data) {
  58. if (data.state.toLowerCase() == 'success') {
  59. $('.customerSubmit').attr("disabled", false);
  60. $('.customerSubmit').text('确定');
  61. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  62. parent.layer.close(index); //再执行关闭
  63. parent.layer.msg("保存成功!");
  64. parent.initTable();
  65. } else {
  66. $('.customerSubmit').attr("disabled", false);
  67. $('.customerSubmit').text('确定');
  68. }
  69. }
  70. });
  71. }