DeviceAlarm.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <schema-table
  3. ref="table"
  4. class="l-flex__self"
  5. :schema="schema"
  6. >
  7. <preview-dialog ref="previewDialog" />
  8. </schema-table>
  9. </template>
  10. <script>
  11. import { getDeviceAlarms } from '@/api/device'
  12. import { createListOptions } from '@/utils'
  13. import { SupportedAlarmStrategies } from '@/constant'
  14. export default {
  15. name: 'DeviceAlarm',
  16. props: {
  17. device: {
  18. type: Object,
  19. required: true
  20. }
  21. },
  22. data () {
  23. return {
  24. options: createListOptions({ deviceId: this.device.id }),
  25. schema: {
  26. condition: { deviceId: this.device.id },
  27. list: getDeviceAlarms,
  28. cols: [
  29. { type: 'refresh' },
  30. { prop: 'file', label: '截图', type: 'asset', on: this.onView },
  31. { prop: 'type', label: '类型', 'min-width': 120 },
  32. { prop: 'handle', label: '处理方式' },
  33. { prop: 'status', label: '处理结果', type: 'tag' },
  34. ...SupportedAlarmStrategies.map(({ key, label }) => {
  35. return {
  36. prop: key,
  37. label: `${label}通知`,
  38. type: 'tag'
  39. }
  40. }),
  41. { prop: 'happenTime', label: '时间', 'min-width': 120 }
  42. ]
  43. }
  44. }
  45. },
  46. methods: {
  47. onView ({ file }) {
  48. this.$refs.previewDialog.show(file)
  49. }
  50. }
  51. }
  52. </script>