index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <a-card>
  3. <a-table
  4. style="margin-top: 20px;"
  5. :columns="columns"
  6. :data-source="state.dataSource"
  7. :loading="state.loading"
  8. >
  9. <template #bodyCell="{column, record}">
  10. <template v-if="column.key === 'action'">
  11. <a-space>
  12. <a @click="goGB28181Records(record.id)">查看录像</a>
  13. <a @click="openModal(record.id)" >控制</a>
  14. </a-space>
  15. </template>
  16. </template>
  17. </a-table>
  18. </a-card>
  19. <a-modal
  20. title="控制设备"
  21. :open="state.controlVisible"
  22. ok-text="确定"
  23. cancel-text="取消"
  24. @cancel="closeModel"
  25. @ok="controlGB28181Device"
  26. >
  27. <a-form :label-col="{span: 4}" :wrapper-col="{span: 14}">
  28. <a-form-item label="通道" v-bind="controlParamsState.channel">
  29. <a-input v-model:value="controlParamsState.channel" />
  30. </a-form-item>
  31. <a-form-item label="命令" v-bind="controlParamsState.ptzcmd">
  32. <a-input v-model:value="controlParamsState.ptzcmd" />
  33. </a-form-item>
  34. </a-form>
  35. </a-modal>
  36. </template>
  37. <script lang="ts" setup >
  38. import { RtsController } from '@/controller/rts'
  39. import { onMounted, reactive } from 'vue'
  40. const columns = [
  41. {
  42. title: 'ID',
  43. dataIndex: 'ID'
  44. },
  45. {
  46. title: '名称',
  47. dataIndex: 'Name'
  48. },
  49. {
  50. title: '制造商',
  51. dataIndex: 'Manufacturer'
  52. },
  53. {
  54. title: '注册时间',
  55. dataIndex: 'RegisterTime'
  56. },
  57. {
  58. title: '状态',
  59. dataIndex: 'Status'
  60. },
  61. {
  62. title: '网络地址',
  63. dataIndex: 'NetAddr'
  64. },
  65. {
  66. title: 'Owner',
  67. dataIndex: 'Owner'
  68. },
  69. {
  70. title: 'gps时间',
  71. dataIndex: 'GpsTime'
  72. },
  73. {
  74. title: '经度',
  75. dataIndex: 'Longitude'
  76. },
  77. {
  78. title: '纬度',
  79. dataIndex: 'Latitude'
  80. },
  81. {
  82. title: '操作',
  83. dataIndex: 'action',
  84. key: 'action'
  85. }
  86. ]
  87. const controlParamsState = reactive({
  88. id: '',
  89. channel: '',
  90. ptzcmd: ''
  91. })
  92. const state = reactive<{
  93. dataSource: RTS.GB2881.Detail[]
  94. loading: boolean
  95. controlVisible: boolean
  96. detail: Partial<RTS.GB2881.Detail>
  97. }>({
  98. loading: false,
  99. controlVisible: false,
  100. detail: {},
  101. dataSource: []
  102. })
  103. const getGB28181List = async () => {
  104. const { data } = await RtsController.listGB28181()
  105. state.dataSource = data
  106. }
  107. const goGB28181Records = async (id :string) => {
  108. router.push({ path: '/gb28181/record', query: { id } })
  109. }
  110. const controlGB28181Device = async () => {
  111. const { data } = await RtsController.controlGB28181(controlParamsState)
  112. console.log(data)
  113. }
  114. onMounted(() => {
  115. getGB28181List()
  116. })
  117. const openModal = (id:string) => {
  118. state.controlVisible = true
  119. controlParamsState.id = id
  120. }
  121. const closeModel = () => {
  122. state.controlVisible = false
  123. }
  124. </script>
  125. <style lang="less" scoped >
  126. </style>