risk_examine_question.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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: 'risk_examine_question/index' + location.search,
  8. // add_url: 'risk_examine_question/add',
  9. // edit_url: 'risk_examine_question/edit',
  10. // del_url: 'risk_examine_question/del',
  11. // multi_url: 'risk_examine_question/multi',
  12. // import_url: 'risk_examine_question/import',
  13. table: 'risk_examine_question',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'order_number', title: __('序号')},
  26. //{field: 'risk_examine_id', title: __('Risk_examine_id')},
  27. {field: 'question', title: __('问题')},
  28. {field: 'plan', title: __('措施')},
  29. //{field: 'status', title: __('Status'), searchList: {"未完成":__('未完成'),"已完成":__('已完成')}, formatter: Table.api.formatter.status},
  30. // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  31. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  32. //{field: 'file', title: __('File'), formatter: Controller.api.formatter.thumb, operate: false},
  33. {field: 'picture', title: __('图片'), formatter: Controller.api.formatter.thumb, operate: false},
  34. {field: 'file_name', title: __('文件'), operate: 'LIKE',formatter: Controller.api.formatter.link},
  35. {field: 'time_limit', title: __('整改时限')},
  36. // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  37. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,buttons: [
  39. {
  40. name: '审批',
  41. text: '审批',
  42. title: '审批',
  43. classname: 'btn btn-xs btn-info btn-view btn-dialog ',
  44. icon: 'fa fa-search',
  45. url: 'risk_examine_question/examine',
  46. extend: 'data-area=\'["450px","70%"]\'',
  47. visible: function (row) {
  48. if (row['state'] == 0) {
  49. return true;
  50. } else {
  51. return false;
  52. }
  53. },
  54. refresh: true
  55. },
  56. {
  57. name: '审批已通过',
  58. text: '审批已通过',
  59. title: '审批已通过',
  60. classname: 'btn btn-xs btn-info btn-view',
  61. icon: 'fa',
  62. //url: 'risk_live_question/examine',
  63. //extend: 'data-area=\'["1000px","80%"]\'',
  64. visible: function (row) {
  65. if (row['state'] == 1) {
  66. return true;
  67. } else {
  68. return false;
  69. }
  70. },
  71. refresh: true
  72. },
  73. {
  74. name: '审批不通过',
  75. text: '审批不通过',
  76. title: '审批不通过',
  77. classname: 'btn btn-xs btn-info btn-view',
  78. icon: 'fa',
  79. //url: 'risk_live_question/examine',
  80. //extend: 'data-area=\'["1000px","80%"]\'',
  81. visible: function (row) {
  82. if (row['state'] == 2) {
  83. return true;
  84. } else {
  85. return false;
  86. }
  87. },
  88. refresh: true
  89. },{
  90. name: '重新整改',
  91. text: '重新整改',
  92. title: '重新整改',
  93. classname: 'btn btn-xs btn-info btn-dialog',
  94. icon: 'fa',
  95. //url: 'risk_live_question/examine1',
  96. url:function(row){
  97. return 'risk_examine_question/examine1?ids='+row['id'];
  98. },
  99. //extend: 'data-area=\'["1000px","80%"]\'',
  100. visible: function (row) {
  101. if (row['state'] == 2) {
  102. return true;
  103. } else {
  104. return false;
  105. }
  106. },
  107. refresh: true
  108. }
  109. ], formatter: Table.api.formatter.operate}
  110. ]
  111. ]
  112. });
  113. // 为表格绑定事件
  114. Table.api.bindevent(table);
  115. },
  116. add: function () {
  117. Controller.api.bindevent();
  118. },
  119. edit: function () {
  120. Controller.api.bindevent();
  121. },
  122. examine: function () {
  123. Controller.api.bindevent();
  124. },
  125. examine1: function () {
  126. Controller.api.bindevent();
  127. $("#faupload-file").data("upload-success", function(data, ret){
  128. //这里进行后续操作
  129. $('#c-file_name').val(data.name);
  130. });
  131. },
  132. api: {
  133. bindevent: function () {
  134. Form.api.bindevent($("form[role=form]"));
  135. },
  136. formatter: {
  137. thumb: function (value, row, index) {
  138. return '<a href="' + value + '" class="btn-dialog"><img src="' + value + '" alt="" style="height:90px;width:120px"></a>';
  139. },
  140. url: function (value, row, index) {
  141. return '<a href="' + row.fullurl + '" target="_blank" class="label bg-green">' + row.url + '</a>';
  142. },
  143. link: function (value, row, index) {
  144. return '<a href="' + row.file + '" target="_blank" class="label bg-green">' + row.file_name + '</a>';
  145. },
  146. filename: function (value, row, index) {
  147. return '<div style="width:180px;margin:0 auto;text-align:center;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">' + Table.api.formatter.search.call(this, value, row, index) + '</div>';
  148. },
  149. }
  150. }
  151. };
  152. return Controller;
  153. });