AllotLogList.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <ContentWrap>
  3. <!-- <div v-loading="loading" style="height: 1000px">-->
  4. <el-table :data="deviceAllots" style="width: 100%">
  5. <el-table-column prop="deviceName" label="设备名称" />
  6. <el-table-column prop="deviceCode" label="设备编码" />
  7. <el-table-column prop="oldDeptName" label="调整前部门" />
  8. <el-table-column prop="newDeptName" label="调用后部门" />
  9. <el-table-column prop="reason" label="调拨原因" />
  10. <el-table-column prop="creatorName" label="调整人" />
  11. <el-table-column
  12. label="调整时间"
  13. align="center"
  14. prop="createTime"
  15. :formatter="dateFormatter"
  16. />
  17. </el-table>
  18. <!-- 分页 -->
  19. <Pagination
  20. :total="total"
  21. v-model:page="queryParams.pageNo"
  22. v-model:limit="queryParams.pageSize"
  23. @pagination="loadDeviceAllots(props.deviceId)"
  24. />
  25. <!-- </div>-->
  26. </ContentWrap>
  27. </template>
  28. <script setup lang="ts">
  29. import { defineEmits, defineOptions, ref } from 'vue'
  30. import { ElMessage } from 'element-plus'
  31. import { dateFormatter } from '@/utils/formatTime'
  32. import { IotDeviceAllotLogApi } from '@/api/pms/iotdeviceallotlog'
  33. const drawerVisible = ref<boolean>(false)
  34. const emit = defineEmits(['update:modelValue', 'add', 'delete'])
  35. defineOptions({
  36. name: 'DeviceAllotLogList'
  37. })
  38. const queryParams = reactive({
  39. pageNo: 1,
  40. pageSize: 10,
  41. createTime: [],
  42. deviceId: '',
  43. name: '',
  44. code: ''
  45. })
  46. const loading = ref(false)
  47. const total = ref(0) // 列表的总页数
  48. const deviceAllots = ref([])
  49. const props = defineProps({
  50. deviceId: Number
  51. })
  52. // 加载设备的状态调整记录
  53. const loadDeviceAllots = async (deviceId) => {
  54. queryParams.deviceId = deviceId
  55. queryParams.pageNo = 1
  56. try {
  57. loading.value = true
  58. // API调用
  59. const data = await IotDeviceAllotLogApi.getIotDeviceAllotLogPage(queryParams)
  60. deviceAllots.value = data.list
  61. total.value = data.total
  62. } catch (error) {
  63. ElMessage.error('数据加载失败')
  64. } finally {
  65. loading.value = false
  66. }
  67. }
  68. onMounted(() => {
  69. debugger
  70. loadDeviceAllots(props.deviceId)
  71. })
  72. </script>
  73. <style lang="scss" scoped></style>