homeIndex.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <el-row>
  3. <el-col :span="24" class="main animate__animated animate__backInRight">
  4. <el-col :span="24" class="one">
  5. <el-table :data="list" border stripe style="width: 100%" @selection-change="toSelect">
  6. <el-table-column type="selection" width="55" />
  7. <el-table-column type="index" label="序号" align="center" width="80" />
  8. <el-table-column prop="dict_label" label="字典标签" align="center" show-overflow-tooltip sortable />
  9. <el-table-column prop="dict_value" label="字典键值" align="center" show-overflow-tooltip sortable />
  10. <el-table-column prop="dict_sort" label="字典排序" align="center" show-overflow-tooltip sortable />
  11. <el-table-column prop="status" label="状态" align="center" show-overflow-tooltip sortable />
  12. <el-table-column fixed="right" label="操作" width="100" align="center">
  13. <template #default>
  14. <el-button link type="primary" size="small">修改</el-button>
  15. <el-button link type="danger" size="small">删除</el-button>
  16. </template>
  17. </el-table-column>
  18. </el-table>
  19. </el-col>
  20. <el-col :span="24" class="two">
  21. <cButton></cButton>
  22. </el-col>
  23. </el-col>
  24. </el-row>
  25. </template>
  26. <script setup lang="ts">
  27. // 基础
  28. import type { Ref } from 'vue'
  29. // reactive, ref, onMounted
  30. import { onMounted, ref } from 'vue'
  31. // 接口
  32. import { DictDataStore } from '@common/src/stores/users/sysdictdata'
  33. import type { IQueryResult } from '@/util/types.util'
  34. const testAxios = DictDataStore()
  35. // 分页数据
  36. const skip = 0
  37. const limit = 10
  38. const list: Ref<any[]> = ref([])
  39. const total: Ref<number> = ref(0)
  40. // 请求
  41. onMounted(async () => {
  42. await search({ skip, limit })
  43. })
  44. const search = async (e: { skip: number; limit: number }) => {
  45. const info = { skip: e.skip, limit: e.limit }
  46. const res: IQueryResult = await testAxios.query(info)
  47. if (res.errcode == '0') {
  48. console.log(res.data)
  49. list.value = res.data as any[]
  50. total.value = res.total
  51. }
  52. }
  53. // 多选
  54. const toSelect = (val: Array<[]>) => {
  55. console.log('多选')
  56. console.log(val)
  57. }
  58. </script>
  59. <style scoped lang="less"></style>