index.vue 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="app-container">
  3. <el-card shadow="never" class="mb16 filter-card">
  4. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" size="small" label-width="100px">
  5. <el-form-item label="租户名称" prop="tenantId">
  6. <inline-tenant-selector @change="handleTenantChange" />
  7. </el-form-item>
  8. <el-form-item label="视频名称" prop="videoName">
  9. <el-input v-model="queryParams.videoName" placeholder="请输入视频名称" clearable size="small" @keyup.enter.native="handleQuery" />
  10. </el-form-item>
  11. <el-form-item label-width="0px">
  12. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  13. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  14. </el-form-item>
  15. </el-form>
  16. </el-card>
  17. <el-table border size="small" style="width:100%" v-loading="loading" :data="list">
  18. <el-table-column label="租户名称" prop="companyName" width="160" />
  19. <el-table-column label="视频名称" prop="videoName" :show-overflow-tooltip="true" />
  20. <el-table-column label="视频类型" prop="videoType" width="100" />
  21. <el-table-column label="播放地址" prop="playUrl" :show-overflow-tooltip="true" />
  22. <el-table-column label="时长(秒)" prop="duration" width="100" />
  23. <el-table-column label="状态" prop="status" width="80" align="center">
  24. <template slot-scope="scope">
  25. <el-tag :type="scope.row.status === 1 ? 'success' : 'info'" size="mini">
  26. {{ scope.row.status === 1 ? '正常' : '禁用' }}
  27. </el-tag>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="创建时间" prop="createTime" width="160" align="center" />
  31. </el-table>
  32. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  33. </div>
  34. </template>
  35. <script>
  36. import { listAllVideoResources } from '@/api/admin/videoResource'
  37. import InlineTenantSelector from '@/components/InlineTenantSelector'
  38. export default {
  39. name: 'AdminVideoResource',
  40. components: { InlineTenantSelector },
  41. data() {
  42. return {
  43. loading: false,
  44. showSearch: true,
  45. list: [],
  46. total: 0,
  47. queryParams: {
  48. pageNum: 1,
  49. pageSize: 10,
  50. tenantId: null,
  51. videoName: null
  52. }
  53. }
  54. },
  55. methods: {
  56. getList() {
  57. if (!this.queryParams.tenantId) {
  58. this.list = []
  59. this.total = 0
  60. this.loading = false
  61. return
  62. }
  63. this.loading = true
  64. listAllVideoResources(this.queryParams).then(res => {
  65. this.list = res.rows
  66. this.total = res.total
  67. this.loading = false
  68. }).catch(() => { this.loading = false })
  69. },
  70. handleTenantChange(val) {
  71. this.queryParams.tenantId = val || null
  72. this.handleQuery()
  73. },
  74. handleQuery() {
  75. if (!this.queryParams.tenantId) {
  76. this.$message.warning('请先选择租户')
  77. return
  78. }
  79. this.queryParams.pageNum = 1
  80. this.getList()
  81. },
  82. resetQuery() {
  83. this.resetForm('queryForm')
  84. this.queryParams.tenantId = null
  85. this.handleQuery()
  86. }
  87. }
  88. }
  89. </script>
  90. <style scoped>
  91. .mb16 { margin-bottom: 16px; }
  92. .filter-card { padding-bottom: 0; }
  93. </style>