|
|
@@ -1,20 +1,31 @@
|
|
|
<template>
|
|
|
<a-card title="空间管理" >
|
|
|
- <a-row justify="space-between" >
|
|
|
- <a-col><a-space><InputTsx placeholder="请输入空间名称进行搜索" /> <a-button type="primary">搜索</a-button> </a-space></a-col>
|
|
|
- <a-col><a-button type="primary" @click="openModal">创建空间</a-button></a-col>
|
|
|
- </a-row>
|
|
|
|
|
|
- <table-pro
|
|
|
- :request="{
|
|
|
- get: SpaceController.page
|
|
|
- }"
|
|
|
+ <table-pro
|
|
|
+ :service="SpaceController.page"
|
|
|
:columns="columns"
|
|
|
- :easy="true"
|
|
|
@add="openModal"
|
|
|
+ ref="tableProDom"
|
|
|
>
|
|
|
-
|
|
|
- </table-pro>
|
|
|
+ <template v-slot:search >
|
|
|
+ <a-space><InputTsx placeholder="请输入空间名称进行搜索" /> <a-button type="primary">搜索</a-button> </a-space>
|
|
|
+ </template>
|
|
|
+ <template v-slot:render="{column, record}" >
|
|
|
+ <template v-if="column.key === 'status'" >
|
|
|
+ <div style="display: flex;align-items: center;" >
|
|
|
+ <div :style="{width: '8px',height: '8px',borderRadius: '50%', backgroundColor:SpaceController.statusMap.get(record.status)?.color, marginRight: '5px' }" ></div>
|
|
|
+ <div>{{SpaceController.statusMap.get(record.status)?.label}}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template v-if="column.key === 'action'" >
|
|
|
+ <a-space>
|
|
|
+ <a @click="openModal(record)" >配置管理</a>
|
|
|
+ <a @click="pushCvsDevicePage(record)" >设备管理</a>
|
|
|
+ <a @click="changeStatus(record)" >{{record.status === 'RUNNING' ? '停用' : "启用"}}</a>
|
|
|
+ </a-space>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </table-pro>
|
|
|
|
|
|
<StepModal
|
|
|
:step="step"
|
|
|
@@ -27,8 +38,8 @@
|
|
|
>
|
|
|
<a-form style="width: 100%;display: block;" :labelCol="{span: 2}" :wrapperCol="{span: 14}" >
|
|
|
<div v-show="step === 0" >
|
|
|
- <a-form-item label="空间名称" v-bind="validateInfos.edgeName" >
|
|
|
- <InputTsx allowClear placeholder="请输入空间名称" v-model:value="spaceState.edgeName" />
|
|
|
+ <a-form-item label="空间名称" v-bind="validateInfos.spaceName" >
|
|
|
+ <InputTsx allowClear placeholder="请输入空间名称" v-model:value="spaceState.spaceName" />
|
|
|
</a-form-item>
|
|
|
<a-form-item label="空间类型" v-bind="validateInfos.type" >
|
|
|
<a-radio-group v-model:value="spaceState.type" button-style="solid">
|
|
|
@@ -161,6 +172,7 @@
|
|
|
</div>
|
|
|
</a-form>
|
|
|
</StepModal>
|
|
|
+
|
|
|
</a-card>
|
|
|
</template>
|
|
|
<script lang='ts' setup >
|
|
|
@@ -170,15 +182,20 @@ import { InputTsx } from '@/components/MicroComponents/index'
|
|
|
import { ref, reactive } from 'vue'
|
|
|
import { Form } from 'ant-design-vue'
|
|
|
import { SpaceController } from '@/controller'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
|
|
|
const useForm = Form.useForm
|
|
|
|
|
|
+const router = useRouter()
|
|
|
+
|
|
|
const steps = [{ title: '空间基本信息' }, { title: '空间配置' }]
|
|
|
|
|
|
const step = ref(0)
|
|
|
|
|
|
const visible = ref<boolean>(false)
|
|
|
|
|
|
+const tableProDom = ref()
|
|
|
+
|
|
|
const columns = [
|
|
|
{
|
|
|
title: '空间ID',
|
|
|
@@ -195,11 +212,6 @@ const columns = [
|
|
|
dataIndex: 'type',
|
|
|
key: 'type'
|
|
|
},
|
|
|
- {
|
|
|
- title: '接入节点',
|
|
|
- dataIndex: 'edgeName',
|
|
|
- key: 'edgeName'
|
|
|
- },
|
|
|
{
|
|
|
title: '设备数量',
|
|
|
dataIndex: 'deviceCount',
|
|
|
@@ -224,14 +236,9 @@ const columns = [
|
|
|
|
|
|
const spaceState = reactive<CVS.space>({
|
|
|
description: '',
|
|
|
- deviceCount: null,
|
|
|
- deviceMode: '',
|
|
|
- edgeId: null,
|
|
|
- edgeName: '',
|
|
|
- serialId: '',
|
|
|
- spaceId: null,
|
|
|
- status: '',
|
|
|
+ spaceName: '',
|
|
|
type: 'RTMP',
|
|
|
+ spaceId: '',
|
|
|
upstreamAuth: {
|
|
|
enabled: false,
|
|
|
key: '',
|
|
|
@@ -263,16 +270,34 @@ const spaceState = reactive<CVS.space>({
|
|
|
})
|
|
|
|
|
|
const { resetFields, validate, validateInfos } = useForm(spaceState, {
|
|
|
- edgeName: [{ required: true, message: '请填写空间名称' }],
|
|
|
+ spaceName: [{ required: true, message: '请填写空间名称' }],
|
|
|
type: [{ required: true }]
|
|
|
})
|
|
|
|
|
|
-const openModal = () => visible.value = true
|
|
|
+const openModal = async (record = { spaceId: '' }) => {
|
|
|
+ if (record.spaceId) {
|
|
|
+ spaceState.spaceId = record.spaceId
|
|
|
+ resetFields(await SpaceController.byId(record.spaceId))
|
|
|
+ } else {
|
|
|
+ resetFields({})
|
|
|
+ }
|
|
|
+ visible.value = true
|
|
|
+}
|
|
|
|
|
|
const closeModal = () => visible.value = false
|
|
|
|
|
|
-const submit = () => {
|
|
|
- SpaceController.add(spaceState)
|
|
|
+const submit = async () => {
|
|
|
+ spaceState.spaceId ? await SpaceController.update(spaceState) : await SpaceController.add(spaceState)
|
|
|
+ closeModal()
|
|
|
+}
|
|
|
+
|
|
|
+const changeStatus = async (record: CVS.space) => {
|
|
|
+ await SpaceController.updateStatue(record.spaceId, record.status === 'RUNNING' ? 'STOPPED' : 'RUNNING')
|
|
|
+ tableProDom.value.reload()
|
|
|
+}
|
|
|
+
|
|
|
+const pushCvsDevicePage = (record: CVS.space) => {
|
|
|
+ router.push({ path: '/cvs/video/device', query: { spaceId: record.spaceId } })
|
|
|
}
|
|
|
|
|
|
const stepNext = () => {
|