DeviceAlarm.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. { prop: 'file', label: '截图', type: 'asset', refresh: true, on: this.onView },
  30. { prop: 'type', label: '类型', 'min-width': 120 },
  31. { prop: 'handle', label: '处理方式' },
  32. { prop: 'status', label: '处理结果', type: 'tag' },
  33. ...SupportedAlarmStrategies.map(({ key, label }) => {
  34. return {
  35. prop: key,
  36. label: `${label}通知`,
  37. type: 'tag'
  38. }
  39. }),
  40. { prop: 'happenTime', label: '时间', 'min-width': 120 }
  41. ]
  42. }
  43. }
  44. },
  45. methods: {
  46. onView ({ file }) {
  47. this.$refs.previewDialog.show(file)
  48. }
  49. }
  50. }
  51. </script>