picking.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'picking/index' + location.search,
  8. add_url: 'picking/add',
  9. edit_url: 'picking/edit',
  10. del_url: 'picking/del',
  11. multi_url: 'picking/multi',
  12. table: 'picking',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. sortName: 'id',
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('Id')},
  25. {field: 'picking', title: __('领料单编码')},
  26. {field: 'order', title: __('工单编号')},
  27. {field: 'matter', title: __('原墨名称')},
  28. {field: 'code', title: __('存货编码')},
  29. {field: 'weight', title: __('重量(kg)')},
  30. {field: 'create', title: __('创建时间')},
  31. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  32. ]
  33. ],
  34. showToggle:false,
  35. showColumns:false,
  36. showExport:false,
  37. // search: false,
  38. commonSearch: false,
  39. //可以控制是否默认显示搜索单表,false则隐藏,默认为false
  40. searchFormVisible: false,
  41. });
  42. // 为表格绑定事件
  43. Table.api.bindevent(table);
  44. },
  45. add: function () {
  46. Controller.api.bindevent();
  47. },
  48. edit: function () {
  49. Controller.api.bindevent();
  50. },
  51. order: function () {
  52. // 初始化表格参数配置
  53. Table.api.init({
  54. extend: {
  55. index_url: 'picking/order' + location.search,
  56. add_url: 'picking/add',
  57. table: 'picking',
  58. }
  59. });
  60. var table = $("#table");
  61. // 初始化表格
  62. table.bootstrapTable({
  63. url: $.fn.bootstrapTable.defaults.extend.index_url,
  64. pk: 'id',
  65. sortName: 'Gy0_sbbh',
  66. columns: [
  67. [
  68. {checkbox: true,},
  69. {field: 'Gd_gdbh', title: __('工单编号'),},
  70. {field: 'Gd_cpmc', title: __('产品名称'),operate:false},
  71. {field: 'gd_statu', title: __('工单状态'),operate:false},
  72. {field: 'Gy0_sbbh', title: __('机台')},
  73. {field: 'Gy0_sj1', title: __('生产时间安排(开始)'),operate:false},
  74. {field: 'Gy0_sj2', title: __('生产时间安排(结束)'),operate:false},
  75. // {field: 'operate', title: __('操作'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  76. ]
  77. ],
  78. showToggle:false,
  79. showColumns:false,
  80. showExport:false,
  81. // search: false,
  82. // commonSearch: false,
  83. //可以控制是否默认显示搜索单表,false则隐藏,默认为false
  84. // searchFormVisible: false,
  85. pageSize: 50,
  86. });
  87. $("#button").on("click",function(){
  88. var temp=table.bootstrapTable('getSelections');
  89. var ids = '';
  90. for (i=0;i<temp.length;i++){
  91. ids += temp[i].id+',';
  92. }
  93. if (ids == ''){
  94. return false;
  95. }
  96. Fast.config.openArea = ['100%','100%'];
  97. //发送给控制器
  98. Fast.api.open("Picking/picking?temp="+ids, "生成领料单", {
  99. });
  100. });
  101. $("#urgent").on("click",function () {
  102. var html = '';
  103. html+= '<div className="form-group" style="margin-left: 15px;margin-top: 15px;">';
  104. html+= '<label className="control-label col-xs-12 col-sm-2">请输入工单号(多个工单请用英文逗号隔开):</label>';
  105. html+= '<div className="col-xs-12 col-sm-8"><input className="form-control" id="order" name="" type="text" value="" data-rule="number" style="width: 350px"> </div>';
  106. html+= '<div class="form-group layer-footer" style="margin: 50px 0 0 50px"><button type="submit" class="btn btn-success btn-embossed sure" style="margin-left: 90px;">确定</button></div>';
  107. html+= '</div>';
  108. layer.open({
  109. type: 1,
  110. skin: 'layui-layer-rim', //加上边框
  111. area: ['420px', '240px'], //宽高
  112. content: html
  113. })
  114. })
  115. $(document).on('click','.sure',function (){
  116. var order = document.getElementById('order').value;
  117. if (order == ''){
  118. return false;
  119. }
  120. layer.close(layer.index);
  121. Fast.config.openArea = ['100%','100%'];
  122. //发送给控制器
  123. Fast.api.open("Picking/picking?temp="+order, "生成领料单", {
  124. });
  125. })
  126. // 为表格绑定事件
  127. Table.api.bindevent(table);
  128. },
  129. api: {
  130. bindevent: function () {
  131. Form.api.bindevent($("form[role=form]"));
  132. }
  133. }
  134. };
  135. return Controller;
  136. });