|
|
@@ -2,22 +2,8 @@
|
|
|
<div class="app-container">
|
|
|
<el-card shadow="never" class="mb16 filter-card">
|
|
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px" size="small">
|
|
|
- <el-form-item label="租户名称" prop="companyId">
|
|
|
- <el-select
|
|
|
- v-model="queryParams.companyId"
|
|
|
- placeholder="选择租户"
|
|
|
- clearable
|
|
|
- filterable
|
|
|
- size="small"
|
|
|
- style="width: 200px"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in companyList"
|
|
|
- :key="item.companyId"
|
|
|
- :label="item.companyName"
|
|
|
- :value="item.companyId"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="租户名称" prop="tenantId">
|
|
|
+ <inline-tenant-selector :key="tenantSelectorKey" @change="handleTenantChange" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="直播标题" prop="liveTitle">
|
|
|
<el-input
|
|
|
@@ -88,8 +74,8 @@
|
|
|
<el-table-column label="直播时长" align="center" prop="duration" min-width="90" />
|
|
|
<el-table-column label="直播状态" align="center" prop="status" min-width="90">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tag v-if="scope.row.status == 0" type="success">直播中</el-tag>
|
|
|
- <el-tag v-else-if="scope.row.status == 1" type="warning">未开始</el-tag>
|
|
|
+ <el-tag v-if="scope.row.status == 2" type="success">直播中</el-tag>
|
|
|
+ <el-tag v-else-if="scope.row.status == 1" type="warning">待支付</el-tag>
|
|
|
<el-tag v-else type="info">已结束</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -139,8 +125,8 @@
|
|
|
<span>{{ viewForm.duration }}</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="直播状态">
|
|
|
- <el-tag v-if="viewForm.status == 0" type="success">直播中</el-tag>
|
|
|
- <el-tag v-else-if="viewForm.status == 1" type="warning">未开始</el-tag>
|
|
|
+ <el-tag v-if="viewForm.status == 2" type="success">直播中</el-tag>
|
|
|
+ <el-tag v-else-if="viewForm.status == 1" type="warning">待支付</el-tag>
|
|
|
<el-tag v-else type="info">已结束</el-tag>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -182,65 +168,50 @@
|
|
|
|
|
|
<script>
|
|
|
import { listAllLives, getLiveInfo, getLiveStatistics, exportAllLives } from '@/api/admin/live'
|
|
|
-import { listAllCompanies } from '@/api/admin/sysCompany'
|
|
|
+import InlineTenantSelector from '@/components/InlineTenantSelector'
|
|
|
|
|
|
export default {
|
|
|
name: 'LiveAdmin',
|
|
|
+ components: { InlineTenantSelector },
|
|
|
data() {
|
|
|
return {
|
|
|
- // 遮罩层
|
|
|
- loading: true,
|
|
|
- // 导出遮罩层
|
|
|
+ loading: false,
|
|
|
exportLoading: false,
|
|
|
- // 显示搜索条件
|
|
|
showSearch: true,
|
|
|
- // 总条数
|
|
|
total: 0,
|
|
|
- // 直播列表
|
|
|
liveList: [],
|
|
|
- // 租户列表
|
|
|
- companyList: [],
|
|
|
- // 统计数据
|
|
|
statistics: {
|
|
|
totalCount: 0,
|
|
|
totalViewerCount: 0,
|
|
|
livingCount: 0,
|
|
|
endedCount: 0
|
|
|
},
|
|
|
- // 状态选项
|
|
|
statusOptions: [
|
|
|
- { value: 0, label: '直播中' },
|
|
|
- { value: 1, label: '未开始' },
|
|
|
- { value: 2, label: '已结束' }
|
|
|
+ { value: 1, label: '待支付' },
|
|
|
+ { value: 2, label: '直播中' },
|
|
|
+ { value: 3, label: '已结束' }
|
|
|
],
|
|
|
- // 查询参数
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
- companyId: null,
|
|
|
+ tenantId: null,
|
|
|
liveTitle: null,
|
|
|
status: null
|
|
|
},
|
|
|
- // 详情弹窗
|
|
|
viewOpen: false,
|
|
|
viewForm: {},
|
|
|
- // 统计弹窗
|
|
|
- showStatistics: false
|
|
|
+ showStatistics: false,
|
|
|
+ tenantSelectorKey: 0
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- this.getCompanyList()
|
|
|
- this.getList()
|
|
|
- },
|
|
|
methods: {
|
|
|
- /** 获取租户列表 */
|
|
|
- getCompanyList() {
|
|
|
- listAllCompanies({ pageSize: 9999 }).then(response => {
|
|
|
- this.companyList = response.rows || []
|
|
|
- })
|
|
|
- },
|
|
|
- /** 查询列表 */
|
|
|
getList() {
|
|
|
+ if (!this.queryParams.tenantId) {
|
|
|
+ this.liveList = []
|
|
|
+ this.total = 0
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
this.loading = true
|
|
|
listAllLives(this.queryParams).then(response => {
|
|
|
this.liveList = response.rows
|
|
|
@@ -248,32 +219,40 @@ export default {
|
|
|
this.loading = false
|
|
|
})
|
|
|
},
|
|
|
- /** 搜索按钮操作 */
|
|
|
+ handleTenantChange(val) {
|
|
|
+ this.queryParams.tenantId = val || null
|
|
|
+ if (val) {
|
|
|
+ this.handleQuery()
|
|
|
+ }
|
|
|
+ },
|
|
|
handleQuery() {
|
|
|
+ if (!this.queryParams.tenantId) {
|
|
|
+ this.$message.warning('请先选择租户')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.queryParams.pageNum = 1
|
|
|
this.getList()
|
|
|
},
|
|
|
- /** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
+ this.$store.dispatch('tenant/setTenantId', null)
|
|
|
this.resetForm('queryForm')
|
|
|
- this.queryParams.companyId = null
|
|
|
- this.handleQuery()
|
|
|
+ this.queryParams.tenantId = null
|
|
|
+ this.liveList = []
|
|
|
+ this.total = 0
|
|
|
+ this.tenantSelectorKey++
|
|
|
},
|
|
|
- /** 查看详情 */
|
|
|
handleView(row) {
|
|
|
getLiveInfo(row.liveId).then(response => {
|
|
|
this.viewForm = response.data
|
|
|
this.viewOpen = true
|
|
|
})
|
|
|
},
|
|
|
- /** 查看统计 */
|
|
|
showStatisticsDialog() {
|
|
|
getLiveStatistics().then(response => {
|
|
|
this.statistics = response.data
|
|
|
this.showStatistics = true
|
|
|
})
|
|
|
},
|
|
|
- /** 导出按钒操作 */
|
|
|
handleExport() {
|
|
|
this.exportLoading = true
|
|
|
exportAllLives(this.queryParams).then(response => {
|