staff.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. (function(vc){
  2. vc.extends({
  3. data:{
  4. staffData:[],
  5. },
  6. _initMethod:function(){
  7. vc.component.loadData();
  8. },
  9. _initEvent:function(){
  10. vc.component.$on('pagination_page_event',function(_currentPage){
  11. vc.component.currentPage(_currentPage);
  12. });
  13. vc.component.$on('addStaff_reload_event',function(){
  14. vc.component.loadData();
  15. });
  16. vc.component.$on('editStaff_reload_event',function(){
  17. vc.component.loadData();
  18. });
  19. },
  20. methods:{
  21. loadData:function(){
  22. var param = {
  23. params:{
  24. page:1,
  25. rows:10
  26. }
  27. };
  28. //发送get请求
  29. vc.http.get('staff',
  30. 'loadData',
  31. param,
  32. function(json){
  33. var _staffInfo = JSON.parse(json);
  34. vc.component.staffData = _staffInfo.datas;
  35. vc.component.$emit('pagination_info_event',{
  36. total:_staffInfo.total,
  37. currentPage:_staffInfo.page
  38. });
  39. },function(){
  40. console.log('请求失败处理');
  41. }
  42. );
  43. },
  44. currentPage:function(_currentPage){
  45. },
  46. openEditStaff:function(_staffInfo){
  47. vc.component.$emit('edit_staff_event',_staffInfo);
  48. }
  49. }
  50. });
  51. })(window.vc);