SetGrpForm.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * 描 述:功能模块
  3. */
  4. var acceptClick;
  5. var keyValue = '';
  6. var bootstrap = function ($, learun) {
  7. "use strict";
  8. var selectedRow = learun.frameTab.currentIframe().selectedRow || {};
  9. const setgrps = [{ id: "18异常工字轮码垛", text: "18异常工字轮码垛" }, { id: "09", text: "09" }];
  10. const newsetgrps = [{ id: "3x0.28四爪吊具专用垛型", text: "3x0.28四爪吊具专用垛型" }, { id: "0240225", text: "0240225" }];
  11. const relations = [{ id: "18异常工字轮码垛", value: "3x0.28四爪吊具专用垛型" }, { id: "09", value: "0240225" }];
  12. var page = {
  13. init: function () {
  14. page.bind();
  15. page.initData();
  16. },
  17. /*绑定事件和初始化控件*/
  18. bind: function () {
  19. // 上级
  20. for (let j = 0; j < setgrps.length; j++) {
  21. $("#SetGrp").append($("<option value='" + setgrps[j].id + "'>" + setgrps[j].text + "</option>"));
  22. }
  23. //for (let j = 0; j < newsetgrps.length; j++) {
  24. // $("#NewSetGrp").append($("<option value='" + newsetgrps[j].id + "'>" + newsetgrps[j].text + "</option>"));
  25. //}
  26. $('#WarehouseId').lrselect({
  27. url: top.$.rootUrl + '/FJManager/BaseWarehouse/GetSelectWarehouseNameList',
  28. maxHeight: 180,
  29. allowSearch: false
  30. });
  31. $('#User').val(top.$.lcoreUser.account);
  32. $("#SetGrp").change(function () {
  33. var value = this.value;
  34. var typenum = value == "09" ? "1" : "0";
  35. var url = top.$.rootUrl + '/FJManager/BillBomSet/GetSelectCodeListByType?typenum=' + typenum;
  36. learun.httpAsyncGet(url, function (data) {
  37. if (data.IsSucc) {
  38. $("#NewSetGrp").empty();
  39. for (let j = 0; j < data.data.length; j++) {
  40. $("#NewSetGrp").append($("<option value='" + data.data[j].id + "'>" + data.data[j].text + "</option>"));
  41. }
  42. }
  43. });
  44. })
  45. $("#SetGrp option:eq(0)").prop("selected", true);
  46. $("#SetGrp").trigger('change');
  47. },
  48. /*初始化数据*/
  49. initData: function () {
  50. if (!!selectedRow) {
  51. keyValue = selectedRow.Id;
  52. $('#form').lrSetFormData(selectedRow);
  53. }
  54. }
  55. };
  56. acceptClick = function (callBack) {
  57. if (!$('#form').lrValidform()) {
  58. return false;
  59. }
  60. var postData = $('#form').lrGetFormData(keyValue);
  61. $.lrSaveForm(top.$.rootUrl + '/FJManager/Inventorys/ChangeSetGrp', postData, function (res) {
  62. // 保存成功后才回调
  63. if (!!callBack) {
  64. callBack();
  65. }
  66. });
  67. };
  68. page.init();
  69. }