index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <div class="">
  3. <toolbar @on-filter="filterData" @on-reset="filterData" />
  4. <div class="m-10 bg-w p-20 br-10">
  5. <!-- <el-button type="primary" icon="el-icon-plus" @click="handleAdd"
  6. >新增</el-button
  7. > -->
  8. <base-table
  9. :columns="columns"
  10. :items="items"
  11. :pagination="pagination"
  12. :page-change="pageChange"
  13. />
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import toolbar from './toolbar';
  19. import mxFilterList from '@/mixins/filterList';
  20. import { getPage, delItem } from '@/api/scene';
  21. export default {
  22. name: 'SceneList',
  23. components: { toolbar },
  24. mixins: [
  25. mxFilterList({
  26. fetchList: getPage, // 在下方data再声明一个 fetchList: iGetList 同等效果
  27. internalFilterObj: {
  28. isDel: false,
  29. auditStatus: 1
  30. }
  31. })
  32. ],
  33. data() {
  34. return {
  35. columns: [
  36. {
  37. key: 'name',
  38. name: '机构名称',
  39. width: this.$col.b
  40. },
  41. {
  42. key: 'logo',
  43. name: 'Logo',
  44. width: this.$col.b,
  45. render: (h, { row }) =>
  46. h('img', {
  47. style: {
  48. width: '120px',
  49. height: '90px'
  50. },
  51. class: 'pre-fix',
  52. attrs: {
  53. src: row.logo
  54. },
  55. on: {
  56. click: () =>
  57. this.$AdvanceViewImageModal({
  58. items: [{ src: row.logo }]
  59. })
  60. }
  61. })
  62. },
  63. {
  64. key: 'region',
  65. name: '所在地区',
  66. minWidth: this.$col.auto(200),
  67. render: (h, { row }) =>
  68. h('span', `${row.province}/${row.city}/${row.area}`)
  69. },
  70. {
  71. key: 'type',
  72. name: '机构类型',
  73. width: this.$col.b
  74. },
  75. {
  76. key: 'realName',
  77. name: '申请人',
  78. width: this.$col.m
  79. },
  80. {
  81. key: 'phonenumber',
  82. name: '办公号码',
  83. width: this.$col.b
  84. },
  85. {
  86. key: 'isShow',
  87. name: '状态',
  88. width: this.$col.s,
  89. type: 'tag',
  90. fetchTagType: val => (val ? 'success' : 'info'),
  91. tagName: row => (row.isShow ? '显示' : '隐藏')
  92. },
  93. {
  94. key: 'action',
  95. name: '操作',
  96. width: '120',
  97. render: (h, { row }) => {
  98. const action = [];
  99. action.push(
  100. h(
  101. 'el-button',
  102. {
  103. props: {
  104. type: 'text'
  105. },
  106. on: {
  107. click: () =>
  108. this.$SceneItemModal({
  109. id: row.id
  110. })
  111. }
  112. },
  113. '编辑'
  114. )
  115. );
  116. action.push(
  117. h(
  118. 'BaseBtn',
  119. {
  120. props: {
  121. popip: true,
  122. txt: '删除',
  123. type: 'text'
  124. },
  125. class: 'ml-10',
  126. on: {
  127. ok: () => this.handleDelItem(row)
  128. }
  129. },
  130. '删除'
  131. )
  132. );
  133. return h('div', action);
  134. }
  135. }
  136. ]
  137. };
  138. },
  139. created() {
  140. this.$g_on('scene_reload', this.reload);
  141. },
  142. beforeDestroy() {
  143. this.$g_off('scene_reload', this.reload);
  144. },
  145. methods: {
  146. handleAdd() {
  147. this.$SceneItemModal();
  148. },
  149. async handleDelItem(item) {
  150. const { success, msg } = await delItem({
  151. id: item.id
  152. });
  153. if (success) {
  154. this.$success('删除成功!');
  155. this.$g_emit('scene_reload');
  156. }
  157. }
  158. }
  159. };
  160. </script>
  161. <style type="scss" scoped></style>