property_log.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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: 'property_log/index' + location.search,
  8. add_url: 'property_log/add',
  9. edit_url: 'property_log/edit',
  10. del_url: 'property_log/del',
  11. multi_url: 'property_log/multi',
  12. import_url: 'property_log/import',
  13. table: 'property_log',
  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: __('Id'),operate:false},
  26. {field: 'p.type', title: __('类型'), searchList:{0:'公物',1:'营具'} ,visible:false},
  27. {field: 'name', title: __('公用物资名称'), operate: 'LIKE'},
  28. {field: 'specification', title: __('Specification'),operate:false},
  29. {field: 'version', title: __('Version'),operate:false},
  30. {field: 'value', title: __('Value'),operate:false},
  31. {field: 'time2', title: __('Time2'),operate:false,formatter: Table.api.formatter.datetime},
  32. {field: 'amount', title: __('Amount'),operate:false},
  33. // {field: 'surplus', title: __('现有库存'),operate:false},
  34. {field: 'admin_id_text', title: __('Admin_id'),operate:false},
  35. {field: 'time1', title: __('入库时间'),operate:false,formatter: Table.api.formatter.datetime},
  36. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  37. ]
  38. ]
  39. });
  40. // 为表格绑定事件
  41. Table.api.bindevent(table);
  42. },index1: function () {
  43. // 初始化表格参数配置
  44. Table.api.init({
  45. extend: {
  46. index_url: 'property_log/index1' + location.search,
  47. add_url: 'property_log/add1',
  48. edit_url: 'property_log/edit1',
  49. del_url: 'property_log/del',
  50. multi_url: 'property_log/multi',
  51. import_url: 'property_log/import',
  52. table: 'property_log',
  53. }
  54. });
  55. var table = $("#table");
  56. // 初始化表格
  57. table.bootstrapTable({
  58. url: $.fn.bootstrapTable.defaults.extend.index_url,
  59. pk: 'id',
  60. sortName: 'id',
  61. columns: [
  62. [
  63. {checkbox: true},
  64. {field: 'order_number', title: __('Id'), operate: false},
  65. {field: 'p.type', title: __('类型'), searchList:{0:'公物',1:'营具'} ,visible:false},
  66. {field: 'name', title: __('公用物资名称'), operate: false},
  67. {field: 'specification', title: __('Specification'), operate: false},
  68. {field: 'version', title: __('Version'), operate: false},
  69. {field: 'category_id_text', title: __('Category_id'), operate: false},
  70. {field: 'amount', title: __('Amount'), operate: false},
  71. {field: 'value', title: __('Value'), operate: false},
  72. {field: 'time1', title: __('发放时间'),formatter: Table.api.formatter.datetime, operate: false},
  73. {field: 'unit1_id_text', title: __('Unit1_id'), operate: false},
  74. {field: 'unit_id_text', title: __('Unit_id'), operate: false},
  75. {field: 'people_id_text', title: __('People_id'), operate: false},
  76. {field: 'admin_id_text', title: __('Admin_id'), operate: false},
  77. {field: 'createtime', title: __('Createtime'),formatter: Table.api.formatter.datetime, operate: false},
  78. {field: 'updatetime', title: __('Updatetime'),formatter: Table.api.formatter.datetime, operate: false},
  79. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  80. ]
  81. ]
  82. });
  83. // 为表格绑定事件
  84. Table.api.bindevent(table);
  85. },index2: function () {
  86. // 初始化表格参数配置
  87. Table.api.init({
  88. extend: {
  89. index_url: 'property_log/index2' + location.search,
  90. table: 'property_log',
  91. }
  92. });
  93. var table = $("#table");
  94. // 初始化表格
  95. table.bootstrapTable({
  96. url: $.fn.bootstrapTable.defaults.extend.index_url,
  97. pk: 'id',
  98. sortName: 'id',
  99. columns: [
  100. [
  101. {checkbox: true},
  102. {field: 'order_number', title: __('Id')},
  103. {field: 'name', title: __('公用物资名称'), operate: false},
  104. {field: 'specification', title: __('Specification'), operate: false},
  105. {field: 'version', title: __('Version'), operate: false},
  106. {field: 'category_id_text', title: __('Category_id'), operate: false},
  107. {field: 'amount', title: __('Amount'), operate: false},
  108. {field: 'value', title: __('Value'), operate: false},
  109. {field: 'time1', title: __('发放时间'),formatter: Table.api.formatter.datetime, operate: false},
  110. {field: 'unit1_id_text', title: __('Unit1_id'), operate: false},
  111. {field: 'unit_id_text', title: __('Unit_id'), operate: false},
  112. {field: 'people_id_text', title: __('People_id'), operate: false},
  113. {field: 'admin_id_text', title: __('Admin_id'), operate: false},
  114. {field: 'createtime', title: __('Createtime'),formatter: Table.api.formatter.datetime, operate: false},
  115. {field: 'updatetime', title: __('Updatetime'),formatter: Table.api.formatter.datetime, operate: false},
  116. ]
  117. ]
  118. });
  119. // 为表格绑定事件
  120. Table.api.bindevent(table);
  121. },
  122. add: function () {
  123. $(document).on("change", "#c-property_id", function(){
  124. $.get('property/huoq',{ids:$(this).val()},function(res){
  125. $('#c-name').val(res.name);
  126. $('#c-specification').val(res.specification);
  127. $('#c-surplus').val(res.amount);
  128. $('#c-version').val(res.version);
  129. });
  130. });
  131. $("#c-property_id").data("params", function (obj) {
  132. return {custom: {type: $("#c-type").val(),unit_id:Config.admin.unit_id}};
  133. });
  134. Controller.api.bindevent();
  135. },
  136. add1: function () {
  137. $(document).on("change", "#c-property_id", function(){
  138. $.get('property/huoq',{ids:$(this).val()},function(res){
  139. $('#c-name').val(res.name);
  140. $('#c-specification').val(res.specification);
  141. $('#c-surplus').val(res.amount);
  142. $('#c-version').val(res.version);
  143. });
  144. });
  145. $("#c-people_id").data("params", function (obj) {
  146. return {custom: {unit_id: $("#c-unit_id").val(),}};
  147. });
  148. $(document).on('change',"#c-people_id",function(){
  149. $("input[id=c-people_id]").val($(this).val());
  150. $("input[id=c-people_id]").selectPageRefresh();
  151. });
  152. $(document).on("change", "#c-fafang_type", function(){
  153. var t = $(this).val()==1?0:1;
  154. $('.J_type'+$(this).val()).show();
  155. $('.J_type'+t).hide();
  156. });
  157. var t = $("#c-fafang_type").val()==1?0:1;
  158. $('.J_type'+$("#c-fafang_type").val()).show();
  159. $('.J_type'+t).hide();
  160. Controller.api.bindevent();
  161. },
  162. edit: function () {
  163. $(document).on("change", "#c-property_id", function(){
  164. $.get('property/huoq',{ids:$(this).val()},function(res){
  165. $('#c-name').val(res.name);
  166. $('#c-specification').val(res.specification);
  167. $('#c-surplus').val(res.amount);
  168. $('#c-version').val(res.version);
  169. });
  170. });
  171. $("#c-property_id").data("params", function (obj) {
  172. return {custom: {type: $("#c-type").val(),unit_id:Config.admin.unit_id}};
  173. });
  174. Controller.api.bindevent();
  175. },
  176. edit1: function () {
  177. $(document).on("change", "#c-property_id", function(){
  178. $.get('property/huoq',{ids:$(this).val()},function(res){
  179. $('#c-name').val(res.name);
  180. $('#c-specification').val(res.specification);
  181. $('#c-surplus').val(res.amount);
  182. $('#c-version').val(res.version);
  183. });
  184. });
  185. $(document).on('change',"#c-people_id",function(){
  186. $("input[id=c-people_id]").val($(this).val());
  187. $("input[id=c-people_id]").selectPageRefresh();
  188. });
  189. $(document).on("change", "#c-fafang_type", function(){
  190. var t = $(this).val()==1?0:1;
  191. $('.J_type'+$(this).val()).show();
  192. $('.J_type'+t).hide();
  193. });
  194. var t = $("#c-fafang_type").val()==1?0:1;
  195. $('.J_type'+$("#c-fafang_type").val()).show();
  196. $('.J_type'+t).hide();
  197. setTimeout(function() {
  198. $("#c-people_id").selectPageRefresh();
  199. }, 1000);
  200. // $("#c-people_id").selectPageRefresh();
  201. Controller.api.bindevent();
  202. },
  203. yj_index: function () {
  204. // 初始化表格参数配置
  205. Table.api.init({
  206. extend: {
  207. index_url: 'property_log/yj_index' + location.search,
  208. add_url: 'property_log/yj_add',
  209. edit_url: 'property_log/yj_edit',
  210. del_url: 'property_log/del',
  211. multi_url: 'property_log/multi',
  212. import_url: 'property_log/import',
  213. table: 'property_log',
  214. }
  215. });
  216. var table = $("#table");
  217. // 初始化表格
  218. table.bootstrapTable({
  219. url: $.fn.bootstrapTable.defaults.extend.index_url,
  220. pk: 'id',
  221. sortName: 'id',
  222. columns: [
  223. [
  224. {checkbox: true},
  225. {field: 'order_number', title: __('Id'),operate:false},
  226. {field: 'name', title: __('公用物资名称'), operate: 'LIKE'},
  227. {field: 'specification', title: __('Specification'),operate:false},
  228. {field: 'version', title: __('Version'),operate:false},
  229. {field: 'value', title: __('Value'),operate:false},
  230. {field: 'time2', title: __('Time2'),operate:false,formatter: Table.api.formatter.datetime},
  231. {field: 'amount', title: __('Amount'),operate:false},
  232. // {field: 'surplus', title: __('现有库存'),operate:false},
  233. {field: 'admin_id_text', title: __('Admin_id'),operate:false},
  234. {field: 'time1', title: __('入库时间'),operate:false,formatter: Table.api.formatter.datetime},
  235. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  236. ]
  237. ]
  238. });
  239. // 为表格绑定事件
  240. Table.api.bindevent(table);
  241. },yj_index1: function () {
  242. // 初始化表格参数配置
  243. Table.api.init({
  244. extend: {
  245. index_url: 'property_log/yj_index1' + location.search,
  246. add_url: 'property_log/yj_add1',
  247. edit_url: 'property_log/yj_edit1',
  248. del_url: 'property_log/del',
  249. multi_url: 'property_log/multi',
  250. import_url: 'property_log/import',
  251. table: 'property_log',
  252. }
  253. });
  254. var table = $("#table");
  255. // 初始化表格
  256. table.bootstrapTable({
  257. url: $.fn.bootstrapTable.defaults.extend.index_url,
  258. pk: 'id',
  259. sortName: 'id',
  260. columns: [
  261. [
  262. {checkbox: true},
  263. {field: 'order_number', title: __('Id')},
  264. {field: 'name', title: __('公用物资名称'), operate: false},
  265. {field: 'specification', title: __('Specification'), operate: false},
  266. {field: 'version', title: __('Version'), operate: false},
  267. {field: 'category_id_text', title: __('Category_id'), operate: false},
  268. {field: 'amount', title: __('Amount'), operate: false},
  269. {field: 'value', title: __('Value'), operate: false},
  270. {field: 'time1', title: __('发放时间'),formatter: Table.api.formatter.datetime, operate: false},
  271. {field: 'unit1_id_text', title: __('Unit1_id'), operate: false},
  272. {field: 'unit_id_text', title: __('Unit_id'), operate: false},
  273. {field: 'people_id_text', title: __('People_id'), operate: false},
  274. {field: 'admin_id_text', title: __('Admin_id'), operate: false},
  275. {field: 'createtime', title: __('Createtime'),formatter: Table.api.formatter.datetime, operate: false},
  276. {field: 'updatetime', title: __('Updatetime'),formatter: Table.api.formatter.datetime, operate: false},
  277. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  278. ]
  279. ]
  280. });
  281. // 为表格绑定事件
  282. Table.api.bindevent(table);
  283. },yj_index2: function () {
  284. // 初始化表格参数配置
  285. Table.api.init({
  286. extend: {
  287. index_url: 'property_log/yj_index2' + location.search,
  288. table: 'property_log',
  289. }
  290. });
  291. var table = $("#table");
  292. // 初始化表格
  293. table.bootstrapTable({
  294. url: $.fn.bootstrapTable.defaults.extend.index_url,
  295. pk: 'id',
  296. sortName: 'id',
  297. columns: [
  298. [
  299. {checkbox: true},
  300. {field: 'order_number', title: __('Id')},
  301. {field: 'name', title: __('公用物资名称'), operate: false},
  302. {field: 'specification', title: __('Specification'), operate: false},
  303. {field: 'version', title: __('Version'), operate: false},
  304. {field: 'category_id_text', title: __('Category_id'), operate: false},
  305. {field: 'amount', title: __('Amount'), operate: false},
  306. {field: 'value', title: __('Value'), operate: false},
  307. {field: 'time1', title: __('发放时间'),formatter: Table.api.formatter.datetime, operate: false},
  308. {field: 'unit1_id_text', title: __('Unit1_id'), operate: false},
  309. {field: 'unit_id_text', title: __('Unit_id'), operate: false},
  310. {field: 'people_id_text', title: __('People_id'), operate: false},
  311. {field: 'admin_id_text', title: __('Admin_id'), operate: false},
  312. {field: 'createtime', title: __('Createtime'),formatter: Table.api.formatter.datetime, operate: false},
  313. {field: 'updatetime', title: __('Updatetime'),formatter: Table.api.formatter.datetime, operate: false},
  314. ]
  315. ]
  316. });
  317. // 为表格绑定事件
  318. Table.api.bindevent(table);
  319. },
  320. yj_add: function () {
  321. $(document).on("change", "#c-property_id", function(){
  322. $.get('property/huoq',{ids:$(this).val()},function(res){
  323. $('#c-name').val(res.name);
  324. $('#c-specification').val(res.specification);
  325. $('#c-surplus').val(res.amount);
  326. $('#c-version').val(res.version);
  327. });
  328. });
  329. Controller.api.bindevent();
  330. },
  331. yj_add1: function () {
  332. $(document).on("change", "#c-property_id", function(){
  333. $.get('property/huoq',{ids:$(this).val()},function(res){
  334. $('#c-name').val(res.name);
  335. $('#c-specification').val(res.specification);
  336. $('#c-surplus').val(res.amount);
  337. $('#c-version').val(res.version);
  338. });
  339. });
  340. $("#c-people_id").data("params", function (obj) {
  341. return {custom: {unit_id: $("#c-unit_id").val()}};
  342. });
  343. Controller.api.bindevent();
  344. },
  345. yj_edit: function () {
  346. $(document).on("change", "#c-property_id", function(){
  347. $.get('property/huoq',{ids:$(this).val()},function(res){
  348. $('#c-name').val(res.name);
  349. $('#c-specification').val(res.specification);
  350. $('#c-surplus').val(res.amount);
  351. $('#c-version').val(res.version);
  352. });
  353. });
  354. Controller.api.bindevent();
  355. },
  356. yj_edit1: function () {
  357. $(document).on("change", "#c-property_id", function(){
  358. $.get('property/huoq',{ids:$(this).val()},function(res){
  359. $('#c-name').val(res.name);
  360. $('#c-specification').val(res.specification);
  361. $('#c-surplus').val(res.amount);
  362. $('#c-version').val(res.version);
  363. });
  364. });
  365. Controller.api.bindevent();
  366. },
  367. api: {
  368. bindevent: function () {
  369. Form.api.bindevent($("form[role=form]"));
  370. }
  371. }
  372. };
  373. return Controller;
  374. });