AdminContentList.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div class="AdminPostList"
  3. :style="localOptions.style">
  4. <div class="title">
  5. نوشته ها
  6. <div class="back-action">
  7. <q-btn :to="{name: 'Admin.Content.Create'}"
  8. color="primary">
  9. ایجاد محتوای جدید
  10. </q-btn>
  11. </div>
  12. </div>
  13. <q-card class="list"
  14. flat>
  15. <entity-index v-if="mounted"
  16. v-model:value="inputs"
  17. title=""
  18. :api="api"
  19. :table="table"
  20. :table-keys="tableKeys"
  21. :create-route-name="createRouteName"
  22. :default-layout="false"
  23. :show-search-button="false"
  24. :show-expand-button="false"
  25. :show-reload-button="false">
  26. <template #entity-index-table-cell="{inputData}">
  27. <template v-if="inputData.col.name === 'number'">
  28. {{ inputData.rowNumber }}
  29. </template>
  30. <template v-else-if="inputData.col.name === 'thumbnail'">
  31. <q-img :src="inputData.col.value"
  32. width="100px" />
  33. </template>
  34. <template v-else-if="inputData.col.name === 'action'">
  35. <q-btn color="primary"
  36. :to="{name: 'AdminPanel.Post.Show', params: {id: inputData.props.row.id}}">
  37. مشاهده جزییات
  38. </q-btn>
  39. </template>
  40. <template v-else>
  41. {{ inputData.col.value }}
  42. </template>
  43. </template>
  44. </entity-index>
  45. </q-card>
  46. </div>
  47. </template>
  48. <script>
  49. import { EntityIndex } from 'quasar-crud'
  50. import { mixinWidget } from 'src/mixin/Mixins.js'
  51. import { APIGateway } from 'src/api/APIGateway.js'
  52. export default {
  53. name: 'AdminPostList',
  54. components: { EntityIndex },
  55. mixins: [mixinWidget],
  56. data: () => {
  57. return {
  58. api: APIGateway.content.APIAdresses.base,
  59. tableKeys: {
  60. data: 'results',
  61. total: 'count',
  62. currentPage: 'current',
  63. perPage: 'per_page',
  64. pageKey: 'page'
  65. },
  66. inputs: [],
  67. table: {
  68. columns: [
  69. {
  70. name: 'number',
  71. required: true,
  72. label: 'شماره',
  73. align: 'left',
  74. field: () => ''
  75. },
  76. {
  77. name: 'thumbnail',
  78. required: true,
  79. label: 'تصویر',
  80. align: 'left',
  81. field: row => row.thumbnail
  82. },
  83. {
  84. name: 'title',
  85. required: true,
  86. label: 'عنوان',
  87. align: 'left',
  88. field: row => row.title
  89. },
  90. {
  91. name: 'category_info',
  92. required: true,
  93. label: 'دسته',
  94. align: 'left',
  95. field: row => row.category_info?.title
  96. },
  97. {
  98. name: 'action',
  99. required: true,
  100. label: 'جزییات',
  101. align: 'left',
  102. field: row => ''
  103. }
  104. ]
  105. },
  106. mounted: false,
  107. createRouteName: ''
  108. }
  109. },
  110. mounted() {
  111. this.mounted = true
  112. }
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. .AdminPostList {
  117. .title {
  118. font-style: normal;
  119. font-weight: 700;
  120. font-size: 24px;
  121. line-height: 140%;
  122. color: #424242;
  123. margin-bottom: 27px;
  124. position: relative;
  125. .back-action {
  126. position: absolute;
  127. right: 0;
  128. top: 0;
  129. }
  130. }
  131. :deep(.list) {
  132. .quasar-crud-index-table {
  133. padding: 0;
  134. .q-table__container {
  135. background-color: transparent;
  136. box-shadow: none;
  137. border: none;
  138. .q-table__top {
  139. display: none;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. </style>