index.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <div class="default-main ">
  3. <el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info"
  4. show-icon/>
  5. <el-row>
  6. <el-col :span="24">
  7. <!-- 表格顶部菜单 -->
  8. <TableHeader :buttons="['refresh', 'add', 'edit', 'delete', 'comSearch']"
  9. quick-search-placeholder="通过标题模糊搜索"
  10. @action="baTable.onTableHeaderAction"/>
  11. <!-- 表格 -->
  12. <!-- 要使用`el-table`组件原有的属性,直接加在Table标签上即可 -->
  13. <Table @action="baTable.onTableAction"/>
  14. </el-col>
  15. </el-row>
  16. <!-- 表单 -->
  17. <PopupForm ref="formRef"/>
  18. </div>
  19. </template>
  20. <script setup lang="ts">
  21. import {ref, onMounted, provide} from 'vue'
  22. import { store } from "/@/api/controllerUrls";
  23. import Table from '/@/components/table/index.vue'
  24. import TableHeader from '/@/components/table/header/index.vue'
  25. import {defaultOptButtons} from '/@/components/table'
  26. import PopupForm from './popupForm.vue'
  27. import {baTableApi} from '/@/api/common'
  28. import baTableClass from '/@/utils/baTable'
  29. const baTable = new baTableClass(
  30. new baTableApi(store),
  31. {
  32. dblClickNotEditColumn: [undefined, 'status'],
  33. column: [
  34. {type: 'selection', align: 'center', operator: false},
  35. {label: '门店名称', prop: 'storeName', align: 'left', operator: 'LIKE'},
  36. {
  37. label: "门店类型",
  38. prop: "storeType",
  39. align: "center",
  40. render: "tag",
  41. operator: "=",
  42. replaceValue: { 0: "自营", 1: "加盟" }
  43. },
  44. {label: '门店LOGO', prop: 'storeLogo', align: 'center',render:'images', operator: false},
  45. {
  46. label: "门店状态",
  47. prop: "storeStatus",
  48. align: "center",
  49. render: "tag",
  50. operator: "=",
  51. replaceValue: { 0: "正常", 1: "停用" }
  52. },
  53. {label: '创建人', prop: 'creatorName', align: 'center', width: '120', operator: false},
  54. {label: '创建时间', prop: 'createTime', align: 'center', width: '180', operator: false},
  55. {
  56. label: '操作',
  57. align: 'center',
  58. width: '160',
  59. render: 'buttons',
  60. buttons: defaultOptButtons(),
  61. operator: false
  62. },
  63. ],
  64. },
  65. {
  66. defaultItems: {},
  67. },
  68. {
  69. // 获得编辑数据后
  70. requestEdit: () => {
  71. if (baTable.form.items && !baTable.form.items.icon) baTable.form.items.icon = 'el-icon-Minus'
  72. },
  73. }
  74. )
  75. provide('baTable', baTable)
  76. onMounted(() => {
  77. baTable.mount()
  78. baTable.getIndex()
  79. })
  80. </script>
  81. <style scoped lang="scss"></style>