新建文本文档.txt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. {
  2. constructor: function(){
  3. },
  4. ngOnInit: function() {
  5. },
  6. ngAfterViewInit: function() {
  7. console.log(this);
  8. this.load();
  9. },
  10. add: function(){
  11. var that = this;
  12. this.open(2,{},{size: 'xl'}).subscribe(function(res){
  13. if(res)
  14. that.load();
  15. });
  16. },
  17. searchSchema: {
  18. properties: {
  19. no: {
  20. type: 'string',
  21. title: '编号',
  22. ui: {
  23. errors: {
  24. 'required': '必填项'
  25. }
  26. }
  27. },
  28. name: {
  29. type: 'string',
  30. title: '名称'
  31. }
  32. },
  33. required: ['no','name']
  34. },
  35. page: {
  36. front: false,
  37. },
  38. formSubmit: function(event){
  39. },
  40. formReset: function(event) {
  41. },
  42. list: [],
  43. columns: [
  44. { title: 'ID', index: 'id' ,sort:{} },
  45. { title: '名称', index: 'name' },
  46. { title: '状态', index: 'status' },
  47. { title: '创建时间', type: 'date', index: 'created_at' },
  48. {title: '修改时间',type: 'date', index: 'updated_at'},
  49. {
  50. title: '操作',
  51. buttons: [
  52. { text: '查看' },
  53. { text: "编辑" ,click: function(a,b,c){
  54. this.open(2,a,{size: 'xl'}).subscribe(function(res){
  55. });
  56. } }
  57. ]
  58. }
  59. ],
  60. total: 0,
  61. change: function(event) {
  62. },
  63. query: {
  64. body: {
  65. },
  66. id: '',
  67. name: 'list',
  68. },
  69. load: function(){
  70. var that =this;
  71. this.query.id = this['module'].id;
  72. this.moduleSvr
  73. .getData(this.query)
  74. .subscribe(function(res){
  75. if(res.code === 0){
  76. that.list = res.data.list;
  77. that.total = res.data.total;
  78. }
  79. });
  80. }
  81. }
  82. <page-header [autoTitle]="false" [title]="&nbsp;" [action]="phActionTpl">
  83. </page-header>
  84. <nz-card>
  85. <div nz-row>
  86. <div nz-col nzSpan="20">
  87. <sf mode="search" [schema]="searchSchema" (formSubmit)="formSubmit($event)" (formReset)="formSubmit($event)"></sf>
  88. </div>
  89. <div nz-col nzSpan="4">
  90. <button nz-button nzType="primary" style="float:right" (click)="add()">新增</button>
  91. </div>
  92. </div>
  93. <st #st [data]="list" [total]="total" [columns]="columns"></st>
  94. </nz-card>