scheduling.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. $(".btn-add").data("area",["1000px","450px"]);
  6. Table.api.init({
  7. extend: {
  8. index_url: 'scheduling/index' + location.search,
  9. add_url: 'scheduling/add',
  10. edit_url: 'scheduling/edit',
  11. del_url: 'scheduling/del',
  12. multi_url: 'scheduling/multi',
  13. import_url: 'scheduling/import',
  14. table: 'scheduling',
  15. }
  16. });
  17. var table = $("#table");
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'id',
  22. sortName: 'id',
  23. columns: [
  24. [
  25. {checkbox: true},
  26. {field: 'order_number', title: __('序号')},
  27. {field: 'people_id_text', title: __('People_id')},
  28. {field: 'people_id1_text', title: __('People_id1')},
  29. {field: 'people_id2_text', title: __('People_id2')},
  30. {field: 'people_id3_text', title: __('People_id3')},
  31. {field: 'people_id4_text', title: __('People_id4')},
  32. {field: 'people_id5_text', title: __('People_id5')},
  33. {field: 'unit_id_text', title: __('值班分队')},
  34. {field: 'date', title: __('Date'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  35. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  36. ]
  37. ]
  38. });
  39. // 为表格绑定事件
  40. Table.api.bindevent(table);
  41. table.on('post-body.bs.table',function(){
  42. $(".btn-editone").data("area",["1000px","450px"]);
  43. })
  44. },
  45. add: function () {
  46. Controller.api.bindevent();
  47. $("#c-people_id6").data("params", function (obj) {
  48. var unit_id = $('#J_unitselect').val();
  49. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  50. });
  51. $("#c-people_id").data("eSelect", function(){
  52. $.get('scheduling/huoq',{id:$("#c-people_id").val()},function(res){
  53. $('#c-phone').val(res.data.phone);
  54. });
  55. });
  56. $("#c-people_id1").data("eSelect", function(){
  57. $.get('scheduling/huoq',{id:$("#c-people_id1").val()},function(res){
  58. $('#c-phone1').val(res.data.phone);
  59. });
  60. });
  61. $("#c-people_id2").data("eSelect", function(){
  62. $.get('scheduling/huoq',{id:$("#c-people_id2").val()},function(res){
  63. $('#c-phone2').val(res.data.phone);
  64. });
  65. });
  66. $("#c-people_id3").data("eSelect", function(){
  67. $.get('scheduling/huoq',{id:$("#c-people_id3").val()},function(res){
  68. $('#c-phone3').val(res.data.phone);
  69. });
  70. });
  71. $("#c-people_id4").data("eSelect", function(){
  72. $.get('scheduling/huoq',{id:$("#c-people_id4").val()},function(res){
  73. $('#c-phone4').val(res.data.phone);
  74. });
  75. });
  76. $("#c-people_id5").data("eSelect", function(){
  77. $.get('scheduling/huoq',{id:$("#c-people_id5").val()},function(res){
  78. $('#c-phone5').val(res.data.phone);
  79. });
  80. });
  81. $("#c-people_id6").data("eSelect", function(){
  82. $.get('scheduling/huoq',{id:$("#c-people_id6").val()},function(res){
  83. $('#c-phone6').val(res.data.phone);
  84. });
  85. });
  86. $("#c-people_id7").data("eSelect", function(){
  87. $.get('scheduling/huoq',{id:$("#c-people_id7").val()},function(res){
  88. $('#c-phone7').val(res.data.phone);
  89. });
  90. });
  91. },
  92. edit: function () {
  93. Controller.api.bindevent();
  94. $("#c-people_id6").data("params", function (obj) {
  95. var unit_id = $('#J_unitselect').val();
  96. return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
  97. });
  98. $("#c-people_id").data("eSelect", function(){
  99. $.get('scheduling/huoq',{id:$("#c-people_id").val()},function(res){
  100. $('#c-phone').val(res.data.phone);
  101. });
  102. });
  103. $("#c-people_id1").data("eSelect", function(){
  104. $.get('scheduling/huoq',{id:$("#c-people_id1").val()},function(res){
  105. $('#c-phone1').val(res.data.phone);
  106. });
  107. });
  108. $("#c-people_id2").data("eSelect", function(){
  109. $.get('scheduling/huoq',{id:$("#c-people_id2").val()},function(res){
  110. $('#c-phone2').val(res.data.phone);
  111. });
  112. });
  113. $("#c-people_id3").data("eSelect", function(){
  114. $.get('scheduling/huoq',{id:$("#c-people_id3").val()},function(res){
  115. $('#c-phone3').val(res.data.phone);
  116. });
  117. });
  118. $("#c-people_id4").data("eSelect", function(){
  119. $.get('scheduling/huoq',{id:$("#c-people_id4").val()},function(res){
  120. $('#c-phone4').val(res.data.phone);
  121. });
  122. });
  123. $("#c-people_id5").data("eSelect", function(){
  124. $.get('scheduling/huoq',{id:$("#c-people_id5").val()},function(res){
  125. $('#c-phone5').val(res.data.phone);
  126. });
  127. });
  128. $("#c-people_id6").data("eSelect", function(){
  129. $.get('scheduling/huoq',{id:$("#c-people_id6").val()},function(res){
  130. $('#c-phone6').val(res.data.phone);
  131. });
  132. });
  133. $("#c-people_id7").data("eSelect", function(){
  134. $.get('scheduling/huoq',{id:$("#c-people_id7").val()},function(res){
  135. $('#c-phone7').val(res.data.phone);
  136. });
  137. });
  138. },
  139. api: {
  140. bindevent: function () {
  141. Form.api.bindevent($("form[role=form]"));
  142. }
  143. }
  144. };
  145. return Controller;
  146. });