index.stub 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <div class="default-main ba-table-box">
  3. <el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />
  4. <!-- 表格顶部菜单 -->
  5. <TableHeader
  6. :buttons="['refresh', 'add', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']"
  7. :quick-search-placeholder="t('quick Search Placeholder', { fields: t('{%webTranslate%}quick Search Fields') })"
  8. />
  9. <!-- 表格 -->
  10. <!-- 要使用`el-table`组件原有的属性,直接加在Table标签上即可 -->
  11. <Table ref="tableRef" />
  12. <!-- 表单 -->
  13. <PopupForm />
  14. </div>
  15. </template>
  16. <script setup lang="ts">
  17. import { ref, provide, onMounted } from 'vue'
  18. import baTableClass from '/@/utils/baTable'
  19. import { defaultOptButtons } from '/@/components/table'
  20. import { baTableApi } from '/@/api/common'
  21. import { useI18n } from 'vue-i18n'
  22. import PopupForm from './popupForm.vue'
  23. import Table from '/@/components/table/index.vue'
  24. import TableHeader from '/@/components/table/header/index.vue'
  25. const { t } = useI18n()
  26. const tableRef = ref()
  27. const optButtons = defaultOptButtons({%optButtons%})
  28. const baTable = new baTableClass(
  29. new baTableApi({%controllerUrl%}),
  30. {
  31. pk: '{%tablePk%}',
  32. column: [
  33. {%tableColumn%}
  34. ],
  35. dblClickNotEditColumn: {%dblClickNotEditColumn%},{%defaultOrder%}
  36. },
  37. {
  38. defaultItems: {%defaultItems%},
  39. }
  40. )
  41. provide('baTable', baTable)
  42. onMounted(() => {
  43. baTable.table.ref = tableRef.value
  44. baTable.mount()
  45. baTable.getIndex()?.then(() => {
  46. baTable.initSort()
  47. baTable.dragSort()
  48. })
  49. })
  50. </script>
  51. <script lang="ts">
  52. import { defineComponent } from 'vue'
  53. export default defineComponent({
  54. name: '{%componentName%}',
  55. })
  56. </script>
  57. <style scoped lang="scss"></style>