WindDoorFaultTable.vue 1.6 KB

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