WindDoorFaultTable.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div class="windDoorFaultTable">
  3. <a-table size="small" :dataSource="dataSource" :columns="faultColumns" :pagination="pagination"
  4. :scroll="{ y: 200, }" @change="pageChange">
  5. <template #bodyCell="{ column, text }">
  6. <template v-if="column.dataIndex == 'status'">
  7. <div>{{ text == '1' ? '是' : '否' }}</div>
  8. </template>
  9. </template>
  10. </a-table>
  11. </div>
  12. </template>
  13. <script setup lang="ts">
  14. import { reactive, ref, onMounted } from 'vue'
  15. import { faultColumns } from '../gate.data'
  16. let props = defineProps({
  17. deviceListApi: {
  18. type: Function,
  19. required: true,
  20. },
  21. })
  22. let dataSource = ref<any[]>([])
  23. //分页参数配置
  24. let pagination = reactive({
  25. current: 1, // 当前页码
  26. pageSize: 10, // 每页显示条数
  27. total: 0, // 总条目数,后端返回
  28. // showTotal: (total, range) => `${range[0]}-${range[1]} 条,总共 ${total} 条`, // 分页右下角显示信息
  29. showSizeChanger: true, // 是否可改变每页显示条数
  30. pageSizeOptions: ['10', '20', '50'], // 可选的每页显示条数
  31. });
  32. //查询列表
  33. async function getList() {
  34. let res = await props.deviceListApi({ pageNo: pagination.current, pageSize: pagination.pageSize })
  35. dataSource.value = res.records || []
  36. pagination.total = res.total
  37. }
  38. function pageChange(val) {
  39. pagination.current = val.current;
  40. pagination.pageSize = val.pageSize;
  41. getList()
  42. }
  43. onMounted(() => {
  44. getList()
  45. })
  46. </script>
  47. <style lang="less" scoped></style>