|
@@ -0,0 +1,321 @@
|
|
|
+<template>
|
|
|
+ <div class="p-4">
|
|
|
+ <BasicTable @register="registerTable" :rowSelection="{ type: 'checkbox' }">
|
|
|
+ <template #toolbar>
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ v-show="
|
|
|
+ getCheckRole(['super', 'plat_admin']) ||
|
|
|
+ (!getCheckRole(['host', 'tourist', 'company_viewer']) && getEquity([1, 2]))
|
|
|
+ "
|
|
|
+ @click="handleAddLiveScene"
|
|
|
+ >
|
|
|
+ 创建房间</a-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ <template #cover="{ record }">
|
|
|
+ <TableImg
|
|
|
+ :size="150"
|
|
|
+ :simpleShow="true"
|
|
|
+ :imgList="[record.appListPicUrl || '/resource/img/pic_bg@2x.png']"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <template #Time="{ record }">
|
|
|
+ <Time :value="record.effectiveStartTime" mode="datetime" />
|
|
|
+ </template>
|
|
|
+ <template #houseType="{ record }">
|
|
|
+ {{ renderHouseType(Number(record.type)) }}
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #action="{ record }">
|
|
|
+ <TableAction
|
|
|
+ :actions="[
|
|
|
+ {
|
|
|
+ label: '结束房间',
|
|
|
+ color: 'error',
|
|
|
+ onClick: handleBindAnchor.bind(null, record),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ color: 'warning',
|
|
|
+ label: '编辑',
|
|
|
+ onClick: handleEditLiveScene.bind(null, record),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ color: 'error',
|
|
|
+ label: '删除',
|
|
|
+ popConfirm: {
|
|
|
+ title: '删除房间后,房间信息及数据将进行销毁,是否继续删除?',
|
|
|
+ confirm: handleDeleteLiveScene.bind(null, record),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ <roomDeital @register="registerModal" @submit="handleAddUser" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script lang="ts">
|
|
|
+ import { defineComponent, computed } from 'vue';
|
|
|
+ import {
|
|
|
+ BasicTable,
|
|
|
+ useTable,
|
|
|
+ BasicColumn,
|
|
|
+ FormProps,
|
|
|
+ TableAction,
|
|
|
+ TableImg,
|
|
|
+ } from '/@/components/Table';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import { Time } from '/@/components/Time';
|
|
|
+ import { LiveSceneDeleteApi } from '/@/api/scene/live';
|
|
|
+ import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
+ import { useUserStore } from '/@/store/modules/user';
|
|
|
+ import { useModal } from '/@/components/Modal';
|
|
|
+ import roomDeital from './roomDeital.vue';
|
|
|
+ import { listRoomsApi } from '/@/api/scene/list';
|
|
|
+
|
|
|
+ export default defineComponent({
|
|
|
+ components: { BasicTable, TableAction, TableImg, roomDeital, Time },
|
|
|
+ setup() {
|
|
|
+ const { createMessage, createConfirm } = useMessage();
|
|
|
+ const userStore = useUserStore();
|
|
|
+ const { getCheckRole, getEquity } = userStore;
|
|
|
+ const { t } = useI18n();
|
|
|
+ const [registerModal, { openModal: addopenModal }] = useModal();
|
|
|
+
|
|
|
+ const permList = computed(() => userStore.getPermList);
|
|
|
+ const columns: BasicColumn[] = [
|
|
|
+ {
|
|
|
+ title: 'ID',
|
|
|
+ dataIndex: 'id',
|
|
|
+ fixed: 'left',
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('routes.scenes.anchorRoom'),
|
|
|
+ dataIndex: 'name',
|
|
|
+ ellipsis: false,
|
|
|
+ width: 130,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('routes.scenes.capacities'),
|
|
|
+ dataIndex: 'capacities',
|
|
|
+ // slots: { customRender: 'houseType' },
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '主持人',
|
|
|
+ dataIndex: 'anchorUserName',
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '助理',
|
|
|
+ dataIndex: 'assistantUserName',
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '助理手机号',
|
|
|
+ dataIndex: 'assistantPhone',
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '创建时间',
|
|
|
+ dataIndex: 'assistantPhone',
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '开播时间段',
|
|
|
+ dataIndex: 'assistantPhone',
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '直播结束时间',
|
|
|
+ dataIndex: 'effectiveEndTime',
|
|
|
+ slots: { customRender: 'Time' },
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '创建人',
|
|
|
+ dataIndex: 'createUserId',
|
|
|
+ width: 140,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('routes.scenes.roomStatus'),
|
|
|
+ dataIndex: 'state',
|
|
|
+ width: 180,
|
|
|
+ customRender: ({ record }) => {
|
|
|
+ const enable = record.payStatus == 1;
|
|
|
+ const text = enable ? t('routes.scenes.statusText.1') : t('routes.scenes.statusText.0');
|
|
|
+ return text;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: t('common.operation'),
|
|
|
+ dataIndex: '',
|
|
|
+ slots: { customRender: 'action' },
|
|
|
+ ifShow:
|
|
|
+ (!getCheckRole(['host', 'tourist']) && getEquity(2)) ||
|
|
|
+ getCheckRole(['super', 'plat_admin']),
|
|
|
+ width: 220,
|
|
|
+ fixed: 'right',
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ const searchForm: Partial<FormProps> = {
|
|
|
+ labelWidth: 100,
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'sceneName',
|
|
|
+ label: t('routes.scenes.anchorRoom'),
|
|
|
+ component: 'Input',
|
|
|
+ componentProps: {
|
|
|
+ maxLength: 100,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ xl: 5,
|
|
|
+ xxl: 5,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'anchorUserName',
|
|
|
+ label: t('routes.scenes.anchorUserName'),
|
|
|
+ component: 'Input',
|
|
|
+ componentProps: {
|
|
|
+ maxLength: 100,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ xl: 5,
|
|
|
+ xxl: 5,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'state',
|
|
|
+ label: t('routes.scenes.listRoomsState'),
|
|
|
+ component: 'Select',
|
|
|
+ colProps: {
|
|
|
+ xl: 5,
|
|
|
+ xxl: 5,
|
|
|
+ },
|
|
|
+ defaultValue: '',
|
|
|
+ componentProps: {
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ label: t('common.all'),
|
|
|
+ value: '',
|
|
|
+ key: '0',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: t('routes.scenes.statusText.101'),
|
|
|
+ value: 101,
|
|
|
+ key: '101',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: t('routes.scenes.statusText.102'),
|
|
|
+ value: 102,
|
|
|
+ key: '102',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: t('routes.scenes.statusText.103'),
|
|
|
+ value: 103,
|
|
|
+ key: '103',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+
|
|
|
+ function renderHouseType(type: number): string {
|
|
|
+ switch (type) {
|
|
|
+ case 0:
|
|
|
+ return '新房';
|
|
|
+ case 1:
|
|
|
+ return '二手房';
|
|
|
+ case 2:
|
|
|
+ return '公寓';
|
|
|
+ case 3:
|
|
|
+ return '民宿';
|
|
|
+ case 4:
|
|
|
+ return '装修';
|
|
|
+ default:
|
|
|
+ return t(`routes.scenes.houseType.9`);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const [registerTable, { reload }] = useTable({
|
|
|
+ title: t(`routes.scenes.liveBroadcast`),
|
|
|
+ api: listRoomsApi,
|
|
|
+ columns: columns,
|
|
|
+ useSearchForm: true,
|
|
|
+ formConfig: searchForm,
|
|
|
+ showTableSetting: true,
|
|
|
+ tableSetting: { fullScreen: true },
|
|
|
+ showIndexColumn: false,
|
|
|
+ rowKey: 'id',
|
|
|
+ pagination: { pageSize: 20 },
|
|
|
+ clickToRowSelect: false,
|
|
|
+ fetchSetting: {
|
|
|
+ pageField: 'page',
|
|
|
+ sizeField: 'limit',
|
|
|
+ listField: 'list',
|
|
|
+ totalField: 'totalCount',
|
|
|
+ },
|
|
|
+ sortFn: (sortInfo) => {
|
|
|
+ console.log('sortInfo', sortInfo);
|
|
|
+ let order = sortInfo.order && sortInfo.order.replace('end', '');
|
|
|
+ return { ...sortInfo, sidx: sortInfo.field, order: order };
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ function handleBindAnchor(record: Recordable) {
|
|
|
+ createConfirm({
|
|
|
+ width: 500,
|
|
|
+ iconType: 'warning',
|
|
|
+ title: '温馨提示',
|
|
|
+ content: `关闭房间后,房间内的所有人都会退出房间,是否继续关闭?<br>(关闭后,房间状态将改为已结束)`,
|
|
|
+ onOk: async () => {
|
|
|
+ console.log('record', record);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function openTargetModal() {
|
|
|
+ console.log('openTargetModal');
|
|
|
+ addopenModal(true);
|
|
|
+ }
|
|
|
+ function handleAddLiveScene() {
|
|
|
+ addopenModal(true, {
|
|
|
+ isUpdate: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function handleEditLiveScene(record: Recordable) {
|
|
|
+ openLiveDrawer(true, {
|
|
|
+ record,
|
|
|
+ isUpdate: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ async function handleDeleteLiveScene(record: Recordable) {
|
|
|
+ const id = [record.id];
|
|
|
+ await LiveSceneDeleteApi(id);
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ reload();
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ registerTable,
|
|
|
+ createMessage,
|
|
|
+ renderHouseType,
|
|
|
+ t,
|
|
|
+ registerModal,
|
|
|
+ registerBindModal,
|
|
|
+ handleBindAnchor,
|
|
|
+ permList,
|
|
|
+ reload,
|
|
|
+ openTargetModal,
|
|
|
+ handleAddLiveScene,
|
|
|
+ handleDeleteLiveScene,
|
|
|
+ handleEditLiveScene,
|
|
|
+ getCheckRole,
|
|
|
+ getEquity,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ });
|
|
|
+</script>
|