index.stub 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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('{%langPrefix%}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 { {%controllerUrlVarName%} } from '/@/api/controllerUrls'
  20. import { defaultOptButtons } from '/@/components/table'
  21. import { baTableApi } from '/@/api/common'
  22. import { useI18n } from 'vue-i18n'
  23. import PopupForm from './popupForm.vue'
  24. import Table from '/@/components/table/index.vue'
  25. import TableHeader from '/@/components/table/header/index.vue'
  26. const { t } = useI18n()
  27. const tableRef = ref()
  28. const optButtons = defaultOptButtons({%optButtons%})
  29. const baTable = new baTableClass(
  30. new baTableApi({%controllerUrlVarName%}),
  31. {
  32. pk: '{%tablePk%}',
  33. column: [
  34. {%tableColumnList%}
  35. ],
  36. dblClickNotEditColumn: {%dblClickNotEditColumn%},{%defaultOrderStub%}
  37. },
  38. {
  39. defaultItems: {%inputDefaultItems%},
  40. }
  41. )
  42. provide('baTable', baTable)
  43. onMounted(() => {
  44. baTable.table.ref = tableRef.value
  45. baTable.mount()
  46. baTable.getIndex()?.then(() => {
  47. baTable.initSort()
  48. baTable.dragSort()
  49. })
  50. })
  51. </script>
  52. <script lang="ts">
  53. import { defineComponent } from 'vue'
  54. export default defineComponent({
  55. name: '{%originControllerUrl%}',
  56. })
  57. </script>
  58. <style scoped lang="scss"></style>