OrderMg.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. function showSelectProductDialog() {
  2. var productNo = $("#productNo").val();
  3. if (!productNo) {
  4. return;
  5. }
  6. let reg = new RegExp(/^s.{13}/g);
  7. if (!reg.test(productNo)) {
  8. abp.message.warn(`此产品已被弃用,只支持新产品查询使用!`);
  9. return;
  10. }
  11. let model = $("#Model").val();
  12. let modelNo = getNumByProductNo(productNo, 1);
  13. let material = $("#Material").val();
  14. let materialNo = getNumByProductNo(productNo, 2);
  15. let rigidity = $("#Rigidity").val();
  16. let rigidityNo = getNumByProductNo(productNo, 3);
  17. let surfaceColor = $("#SurfaceColor").val();
  18. let surfaceColorNo = getNumByProductNo(productNo, 4);
  19. tmpSearch[0].KeyWords = 's' + modelNo;
  20. if (isFirstEnter) {
  21. initQueryTable();
  22. } else {
  23. $tableProductionOrder.iwbTable('setSearchList', tmpSearch);
  24. $tableProductionOrder.iwbTable('refresh');
  25. $tableProductStore.iwbTable('setSearchList', tmpSearch);
  26. $tableProductStore.iwbTable('refresh');
  27. $tableSemiStore.iwbTable('setSearchList', tmpSearch);
  28. $tableSemiStore.iwbTable('refresh');
  29. }
  30. $('.tool-rc-group').html(
  31. `<label style=" margin-right: 10px; font-size: 1.5rem;" class="iwb-checkbox"><input name="propType" data-index="1" type="checkbox" disabled checked value="${
  32. modelNo}" /><span></span>规格:(${model})</label>
  33. <label style=" margin-right: 10px; font-size: 1.5rem;" class="iwb-checkbox"><input name="propType" data-index="2" type="checkbox" value="${
  34. materialNo}" /><span></span>材质:(${material})</label>
  35. <label style=" margin-right: 10px; font-size: 1.5rem;" class="iwb-checkbox"><input name="propType" data-index="3" type="checkbox" value="${
  36. rigidityNo}" /><span></span>硬度:(${rigidity})</label>
  37. <label style=" margin-right: 10px; font-size: 1.5rem;" class="iwb-checkbox"><input name="propType" data-index="4" type="checkbox" value="${
  38. surfaceColorNo}" /><span></span>表色:(${surfaceColor})</label >`);
  39. $('.tool-rc-group input[name="propType"]').on('change',
  40. function(e) {
  41. let $checkbox = $(this);
  42. let flag = $checkbox.is(':checked');
  43. let $as = $('.tool-rc-group input[name="propType"]');
  44. if (flag) {
  45. $.each($as,
  46. function(i, v) {
  47. if ($(v).data('index') < $checkbox.data('index')) {
  48. $(v).prop("checked", "checked");
  49. }
  50. });
  51. } else {
  52. $.each($as,
  53. function (i, v) {
  54. if ($(v).data('index') > $checkbox.data('index')) {
  55. $(v).prop("checked", false);
  56. }
  57. });
  58. }
  59. searchProductInfo();
  60. e.stopPropagation();
  61. });
  62. $("#modal_queryProductionStore").modal('show');
  63. }
  64. var isFirstEnter = true;
  65. function initQueryTable() {
  66. console.log(tmpSearch)
  67. $tableProductionOrder = LoadTable1(
  68. {
  69. table: $("#tableProductionOrder"),
  70. height: 480,
  71. //isPage: false,
  72. //modal: "modalItem",
  73. //searchForm: "itemSearch",
  74. searchValidate: false,
  75. searchList: tmpSearch,
  76. onlySearchList: true,
  77. });
  78. $tableProductStore = LoadTable1(
  79. {
  80. table: $("#tableProductStore"),
  81. height: 480,
  82. //isPage: false,
  83. //modal: "modalItem",
  84. //searchForm: "itemSearch",
  85. searchValidate: false,
  86. searchList: tmpSearch,
  87. onlySearchList: true,
  88. });
  89. $tableSemiStore = LoadTable1(
  90. {
  91. table: $("#tableSemiStore"),
  92. height: 480,
  93. //isPage: false,
  94. //modal: "modalItem",
  95. //searchForm: "itemSearch",
  96. searchValidate: false,
  97. searchList: tmpSearch,
  98. onlySearchList: true,
  99. });
  100. }
  101. function LoadTable1(option) {
  102. if (!option) {
  103. option = { table: "table" };
  104. }
  105. option.table = option.table ? option.table : "table";
  106. var $table = typeof option.table === 'string' ? $('#' + option.table) : $(option.table);
  107. if ($table.length < 1) {
  108. console.log('没有发现表格:', option.table);
  109. }
  110. $table.iwbTable(option);
  111. return $table;
  112. }
  113. //item
  114. var $tableProductionOrder, $tableProductStore, $tableSemiStore;
  115. var tmpSearch = [
  116. { KeyWords: "0", KeyField: "ProductNo", FieldType: "1", ExpType: "0" }
  117. ];
  118. function searchProductInfo() {
  119. isFirstEnter = false;
  120. let proNo = '';
  121. let $as = $('.tool-rc-group input[name="propType"]');
  122. $.each($as,
  123. function (i, v) {
  124. if ($(v).is(':checked')) {
  125. proNo += $(v).val();
  126. }
  127. });
  128. console.log('proNo', proNo);
  129. tmpSearch[0].KeyWords = 's' + proNo;
  130. $tableProductionOrder.iwbTable('setSearchList', tmpSearch);
  131. $tableProductionOrder.iwbTable('refresh');
  132. $tableProductStore.iwbTable('setSearchList', tmpSearch);
  133. $tableProductStore.iwbTable('refresh');
  134. $tableSemiStore.iwbTable('setSearchList', tmpSearch);
  135. $tableSemiStore.iwbTable('refresh');
  136. }
  137. function getNumByProductNo(pNo, type) {
  138. let result = '';
  139. switch (type) {
  140. case 1:
  141. result = pNo.substr(1, 4);//规格
  142. break;
  143. case 2:
  144. result = pNo.substr(5, 2);//材质
  145. break;
  146. case 3:
  147. result = pNo.substr(7, 2);//硬度
  148. break;
  149. case 4:
  150. result = pNo.substr(9, 3);//表色
  151. break;
  152. default:
  153. break;
  154. }
  155. return result;
  156. }