tab2.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div>
  3. <a-row>
  4. <a-col :span="24">
  5. <div class="container search-container">
  6. <a-form
  7. layout="inline"
  8. :model="formState"
  9. @finish="handleFinish"
  10. @finishFailed="handleFinishFailed"
  11. >
  12. <a-form-item label="房间名称" name="roomTitle">
  13. <a-input
  14. v-model:value="formState.roomTitle"
  15. placeholder="房间名称"
  16. >
  17. </a-input>
  18. </a-form-item>
  19. <a-form-item label="使用时间" name="username">
  20. <a-range-picker
  21. :show-time="{ format: 'HH:mm' }"
  22. format="YYYY-MM-DD HH:mm"
  23. style="width: 80%"
  24. v-model:value="formState.userTime"
  25. />
  26. </a-form-item>
  27. <a-form-item>
  28. <a-button type="primary" html-type="submit"> 确定 </a-button>
  29. </a-form-item>
  30. </a-form>
  31. </div>
  32. </a-col>
  33. </a-row>
  34. <a-row>
  35. <div class="container">
  36. <a-table :columns="columns" :data-source="data" bordered>
  37. <template #name="{ text }">
  38. <a>{{ text }}</a>
  39. </template>
  40. </a-table>
  41. </div>
  42. </a-row>
  43. </div>
  44. </template>
  45. <script lang="ts" setup>
  46. import { computed, onMounted, UnwrapRef, reactive } from 'vue'
  47. import { TableColumnProps } from 'ant-design-vue'
  48. import { useStatisticStore } from '@/store/modules/statistic'
  49. const statisticStore = useStatisticStore()
  50. interface FormState {
  51. roomTitle: string
  52. userTime: string[]
  53. }
  54. const formState: UnwrapRef<FormState> = reactive({
  55. roomTitle: '',
  56. userTime: []
  57. })
  58. const columns: TableColumnProps[] = [
  59. // {
  60. // title: '房间id',
  61. // dataIndex: 'roomId'
  62. // },
  63. {
  64. title: '房间名称',
  65. dataIndex: 'roomTitle'
  66. },
  67. {
  68. title: '相关场景',
  69. // className: 'column-money',
  70. dataIndex: 'sceneNames'
  71. },
  72. {
  73. title: '时长/分',
  74. dataIndex: 'totalViewTime'
  75. },
  76. {
  77. title: '创建时间',
  78. dataIndex: 'createTime'
  79. },
  80. {
  81. title: '状态',
  82. dataIndex: 'status'
  83. },
  84. {
  85. title: '观看',
  86. dataIndex: 'viewPersonNums'
  87. },
  88. {
  89. title: '分享',
  90. dataIndex: 'shareNums'
  91. }
  92. ]
  93. const data = [
  94. {
  95. key: '1',
  96. roomTitle: '测试房间',
  97. sceneNames: ['11', '22'],
  98. totalViewTime: 1212121212,
  99. createTime: 1212121212,
  100. status: 0,
  101. viewPersonNums: 100,
  102. shareNums: 29292
  103. },
  104. {
  105. key: '2',
  106. roomTitle: '测试房间',
  107. sceneNames: ['11', '22'],
  108. totalViewTime: 1212121212,
  109. createTime: 1212121212,
  110. status: 0,
  111. viewPersonNums: 100,
  112. shareNums: 29292
  113. },
  114. {
  115. key: '3',
  116. roomTitle: '测试房间',
  117. sceneNames: ['11', '22'],
  118. totalViewTime: 1212121212,
  119. createTime: 1212121212,
  120. status: 0,
  121. viewPersonNums: 100,
  122. shareNums: 29292
  123. },
  124. {
  125. key: '4',
  126. roomTitle: '测试房间',
  127. sceneNames: ['11', '22'],
  128. totalViewTime: 1212121212,
  129. createTime: 1212121212,
  130. status: 0,
  131. viewPersonNums: 100,
  132. shareNums: 29292
  133. }
  134. ]
  135. const handleFinish = () => {}
  136. const handleFinishFailed = () => {}
  137. </script>
  138. <style lang="less">
  139. .container {
  140. background-color: #fff;
  141. padding: 25px;
  142. width: 100%;
  143. margin-bottom: 25px;
  144. }
  145. </style>