list.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div class="app-list-content">
  3. <x-crud class="liu-crud-wrap" @load="onLoad">
  4. <!-- 日期 -->
  5. <template #table-column-month="{scope}">
  6. <span>{{ scope.row.month + '.' + scope.row.day }}</span>
  7. </template>
  8. </x-crud>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. // x-crud
  16. app: null
  17. };
  18. },
  19. mounted() {},
  20. methods: {
  21. // crud
  22. onLoad({ ctx, app }) {
  23. this.app = app;
  24. ctx.service(this.$service.sassFest)
  25. .set('table', {
  26. columns: [
  27. {
  28. prop: 'id',
  29. label: 'ID',
  30. align: 'center'
  31. },
  32. {
  33. prop: 'name',
  34. label: '名称',
  35. align: 'center'
  36. },
  37. {
  38. prop: 'month',
  39. label: '时间',
  40. align: 'center'
  41. }
  42. ],
  43. // 操作列
  44. op: {
  45. visible: true, // 是否显示
  46. // 同 element-ui Table-column Attributes
  47. props: {
  48. width: 150,
  49. align: 'center',
  50. fixed: 'right',
  51. label: '操作'
  52. },
  53. // 布局,请移步 `layout`
  54. layout: ['edit']
  55. }
  56. })
  57. .set('upsert', {
  58. props: {
  59. width: '500px'
  60. },
  61. items: [
  62. {
  63. prop: 'name',
  64. label: '名称',
  65. span: 24,
  66. component: {
  67. name: 'el-input'
  68. },
  69. rules: {
  70. required: true,
  71. message: '名称不能为空'
  72. }
  73. },
  74. {
  75. prop: 'month',
  76. label: '月份',
  77. span: 24,
  78. component: {
  79. name: 'el-input'
  80. },
  81. rules: {
  82. required: true,
  83. message: '月份不能为空'
  84. }
  85. },
  86. {
  87. prop: 'day',
  88. label: '日',
  89. span: 24,
  90. component: {
  91. name: 'el-input'
  92. },
  93. rules: {
  94. required: true,
  95. message: '日不能为空'
  96. }
  97. }
  98. ]
  99. })
  100. .set('layout', [['slot-tabs'], ['flex1', 'add-btn', 'refresh-btn'], ['data-table']])
  101. .done();
  102. app.refresh();
  103. }
  104. }
  105. };
  106. </script>