edit_cxg.jade 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. extends ../../layout_nomenu
  2. block content
  3. .main-content
  4. .page-content(style="overflow:scroll;height:450px;")
  5. div
  6. iframe#edit-cxg-iframe.hide(name='edit-cxg-iframe')
  7. form#edit-cxg-form.form-horizontal(role='form', action='#{action}', method='post', target='edit-cxg-iframe', style='height:400x;overflow-x:hidden;overflow-y:scroll;')
  8. .form-group
  9. label.col-xs-3.control-label.no-padding-right(for='ff-ctmbh') 条码编号
  10. .col-xs-9
  11. input#ff-ctmbh.col-xs-6(type='text', name='barcode_long', value='#{barcode_long || ""}', placeholder='请扫描长采血管条码或录入条码编号')
  12. span.help-inline.col-xs-6
  13. button#btn-ctm-scan-id.btn.btn-xs.btn-warning(type='button')
  14. i.icon-undo 重扫
  15. span.middle.hide Inline help text
  16. .space-4
  17. //.form-group
  18. // label.col-xs-3.control-label.no-padding-right(for='ff-dtmbh') 短条码编号
  19. // .col-xs-9
  20. // input#ff-dtmbh.col-xs-6(type='text', name='barcode_short', value='#{barcode_short || ""}', readonly, placeholder='请扫描短采血管条码或录入条码编号')
  21. // span.help-inline.col-xs-6
  22. // button#btn-dtm-scan-id.btn.btn-xs.btn-warning(type='button')
  23. // i.icon-undo 重扫
  24. // span.middle.hide Inline help text
  25. //.space-4
  26. .form-group
  27. label.col-xs-3.control-label.no-padding-right(for='ff-15') 换管人员
  28. .col-xs-9
  29. input#ff-15.col-xs-6(type='text', name='changer', value='#{changer || ""}', readonly, placeholder='')
  30. span.help-inline.col-xs-6
  31. span.middle.hide Inline help text
  32. .space-4
  33. .form-group.hide
  34. label.col-xs-3.control-label.no-padding-right(for='ff-20') 状态
  35. .col-xs-9
  36. input#ff-20.col-xs-6(type='text', name='status', value='#{status || ""}', placeholder='')
  37. span.help-inline.col-xs-6
  38. span.middle.hide Inline help text
  39. .space-4
  40. .form-group
  41. label.col-xs-3.control-label.no-padding-right(for='ff-auto-save') 自动保存
  42. .col-xs-9
  43. input#ff-auto-save.ace.ace-switch.ace-switch-7.col-xs-6(type='checkbox')
  44. span.lbl
  45. .space-4
  46. script.
  47. $('#btn-ctm-scan-id').hide();
  48. $('#btn-dtm-scan-id').hide();
  49. var ctmbh = $('#ff-ctmbh').val();
  50. if (ctmbh) {// 修改
  51. $('#ff-ctmbh').attr('readonly', true);
  52. $('#ff-dtmbh').removeAttr('readonly').focus();
  53. itvl2 = setInterval(function () {
  54. $('#ff-dtmbh').focus();
  55. }, 200);
  56. } else { // 新增
  57. var itvl = setInterval(function () {
  58. $('#ff-ctmbh').focus();
  59. }, 200);
  60. $('#ff-ctmbh').change(function () {
  61. clearInterval(itvl);
  62. $('#btn-ctm-scan-id').show();
  63. $('#ff-ctmbh').attr('readonly', true);
  64. submitForm();
  65. if ($('#ff-dtmbh').val())return;
  66. $('#ff-dtmbh').removeAttr('readonly').focus();
  67. itvl2 = setInterval(function () {
  68. $('#ff-dtmbh').focus();
  69. }, 200);
  70. });
  71. $('#btn-ctm-scan-id').click(function (e) {
  72. e.stopPropagation();
  73. e.preventDefault();
  74. clearInterval(itvl2);
  75. itvl = setInterval(function () {
  76. $('#ff-ctmbh').focus();
  77. }, 200);
  78. $('#ff-ctmbh').removeAttr('readonly').val('').focus();
  79. return false;
  80. });
  81. }
  82. var itvl2 = null;
  83. function clearItvl2() {
  84. clearInterval(itvl2);
  85. $('#btn-dtm-scan-id').show();
  86. $('#ff-dtmbh').attr('readonly', true);
  87. submitForm();
  88. }
  89. $('#ff-dtmbh').change(function () {
  90. var self = this;
  91. var barcode_short = $(this).val();
  92. $.post('dna/receive/getByBarcodeShort', {
  93. barcode_short: barcode_short
  94. }, function (rows) {
  95. if (rows && rows.length == 1) {
  96. var row = rows[0];
  97. var barcode_long = row.barcode_long;
  98. // console.log(ctmbh, barcode_long);
  99. if (ctmbh == barcode_long) {
  100. Toast.show('此短条码相同,请换一个:' + barcode_short);
  101. $(self).val('');
  102. }else{
  103. Toast.show('此短条码已被使用,请换一个:' + barcode_short);
  104. $(self).val('');
  105. }
  106. } else {
  107. clearItvl2();
  108. }
  109. });
  110. });
  111. $('#btn-dtm-scan-id').click(function (e) {
  112. e.stopPropagation();
  113. e.preventDefault();
  114. itvl2 = setInterval(function () {
  115. $('#ff-dtmbh').focus();
  116. }, 200);
  117. $('#ff-dtmbh').removeAttr('readonly').val('').focus();
  118. return false;
  119. });
  120. var isAutoSave = localStorage.getItem('_auto_save_addCxg');
  121. if (isAutoSave == '1') {
  122. $('#ff-auto-save').prop('checked', true);
  123. }
  124. $('#ff-auto-save').change(function () {
  125. var value = $('#ff-auto-save').prop('checked');
  126. localStorage.setItem('_auto_save_addCxg', value ? '1' : '0');
  127. });
  128. function submitForm() {
  129. if ($('#ff-auto-save').prop('checked')) {
  130. var ctm = $('#ff-ctmbh').val();
  131. var dtm = $('#ff-dtmbh').val();
  132. if (ctm && dtm) {
  133. $('#edit-cxg-form').submit();
  134. }
  135. }
  136. }