|
@@ -1,42 +1,42 @@
|
|
|
<template>
|
|
|
<div class="tab-content h-full">
|
|
|
- <div class="subtitle"><span></span> <el-button type="primary" v-auth="'add'" size="small" @click="addDevice()">添加监控</el-button></div>
|
|
|
+ <div class="subtitle"><span></span> <el-button type="primary" v-auth="'add'" size="small" @click="addDevice()">{{ $t('message.projects.detail.video.actions.add') }}</el-button></div>
|
|
|
<el-table :data="tableData" style="width: 100%" v-loading="loading" max-height="calc(100vh - 280px)">
|
|
|
- <el-table-column prop="name" label="设备名称" min-width="130" align="center" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="deviceId" label="设备ID" min-width="210" align="center" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="name" label="通道名称" min-width="140" align="center" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="model" label="型号" width="100" align="center" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="manufacturer" label="厂商" width="100" align="center" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="liveStatus" label="状态" width="100" align="center" :formatter="formatLiveStatus" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="keepAliveTime" label="最后心跳时间" :formatter="formatTime" width="170" align="center" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="registerTime" label="注册时间" :formatter="formatTime" width="170" align="center" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="updateAt" label="更新时间" :formatter="formatTime" width="170" align="center" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column label="操作" width="120" align="center" fixed="right">
|
|
|
+ <el-table-column prop="name" :label="$t('message.projects.detail.video.table.columns.deviceName')" min-width="130" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="deviceId" :label="$t('message.projects.detail.video.table.columns.deviceId')" min-width="210" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="name" :label="$t('message.projects.detail.video.table.columns.channelName')" min-width="140" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="model" :label="$t('message.projects.detail.video.table.columns.model')" width="100" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="manufacturer" :label="$t('message.projects.detail.video.table.columns.manufacturer')" width="100" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="liveStatus" :label="$t('message.projects.detail.video.table.columns.liveStatus')" width="100" align="center" :formatter="formatLiveStatus" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="keepAliveTime" :label="$t('message.projects.detail.video.table.columns.keepAliveTime')" :formatter="formatTime" width="170" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="registerTime" :label="$t('message.projects.detail.video.table.columns.registerTime')" :formatter="formatTime" width="170" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="updateAt" :label="$t('message.projects.detail.video.table.columns.updateAt')" :formatter="formatTime" width="170" align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column :label="$t('message.projects.detail.video.table.columns.actions')" width="120" align="center" fixed="right">
|
|
|
<template #default="scope">
|
|
|
- <el-button size="small" text type="primary" v-auth="'detail'" @click="view(scope.row)">查看监控</el-button>
|
|
|
- <el-button size="small" text type="warning" v-auth="'del'" @click="onDel(scope.row)">解绑</el-button>
|
|
|
+ <el-button size="small" text type="primary" v-auth="'detail'" @click="view(scope.row)">{{ $t('message.projects.detail.video.table.actions.view') }}</el-button>
|
|
|
+ <el-button size="small" text type="warning" v-auth="'del'" @click="onDel(scope.row)">{{ $t('message.projects.detail.video.table.actions.unbind') }}</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <el-dialog title="添加监控" v-model="isShowDialog" width="400">
|
|
|
+ <el-dialog :title="$t('message.projects.detail.video.dialog.addTitle')" v-model="isShowDialog" width="400">
|
|
|
<el-form v-if="isShowDialog">
|
|
|
- <el-form-item label="监控" style="margin-bottom: 0">
|
|
|
- <el-select v-model="form.resourcesKey" filterable placeholder="选择监控" :clearable="false" style="width: 100%">
|
|
|
+ <el-form-item :label="$t('message.projects.detail.video.form.labels.video')" style="margin-bottom: 0">
|
|
|
+ <el-select v-model="form.resourcesKey" filterable :placeholder="$t('message.projects.detail.video.form.placeholders.video')" :clearable="false" style="width: 100%">
|
|
|
<el-option v-for="item in options" :disabled="item.disabled" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
|
- <el-button @click="onCancel">取 消</el-button>
|
|
|
- <el-button type="primary" @click="onSubmit">确 定</el-button>
|
|
|
+ <el-button @click="onCancel">{{ $t('message.projects.detail.video.actions.cancel') }}</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit">{{ $t('message.projects.detail.video.actions.confirm') }}</el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
- <el-dialog title="预览监控" v-model="isShowPreviewDialog" width="90vh">
|
|
|
+ <el-dialog :title="$t('message.projects.detail.video.dialog.previewTitle')" v-model="isShowPreviewDialog" width="90vh">
|
|
|
<template #header>
|
|
|
<span class="dialog-footer">
|
|
|
- <el-button type="primary" size="small" @click="openToNewWindow">新窗口预览</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="openToNewWindow">{{ $t('message.projects.detail.video.actions.openInNewWindow') }}</el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
<iframe v-if="isShowPreviewDialog" :src="previewUrl" style="width: 100%; height: 50vh"></iframe>
|
|
@@ -45,13 +45,15 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { reactive, ref } from "vue";
|
|
|
+import { reactive, ref, toRef } from "vue";
|
|
|
import api from "/@/api/projects";
|
|
|
import { useRoute } from "vue-router";
|
|
|
import { dayjs, ElMessage, ElMessageBox } from "element-plus";
|
|
|
import axios from "axios";
|
|
|
import { getMediaOrigin } from "/@/utils/origin";
|
|
|
+import { useI18n } from 'vue-i18n';
|
|
|
const route = useRoute();
|
|
|
+const { t } = useI18n();
|
|
|
|
|
|
const props = defineProps({ resourcesTypes: Number });
|
|
|
const isShowDialog = ref(false);
|
|
@@ -61,13 +63,13 @@ const previewUrl = ref("");
|
|
|
const options = ref<any[]>([]);
|
|
|
const tableData = ref<any[]>([]);
|
|
|
const channels = ref<any[]>([]);
|
|
|
-const resourcesTypes = props.resourcesTypes!;
|
|
|
+const resourcesTypes = toRef(props, 'resourcesTypes');
|
|
|
const projectsCode = route.params.id;
|
|
|
|
|
|
const baseForm = {
|
|
|
resourcesKey: "",
|
|
|
projectsCode,
|
|
|
- resourcesTypes,
|
|
|
+ resourcesTypes: resourcesTypes.value,
|
|
|
};
|
|
|
|
|
|
const form = reactive({
|
|
@@ -78,7 +80,7 @@ getOptions();
|
|
|
|
|
|
function getSourceList() {
|
|
|
api.getProjectResourcesByCode({ projectsCode }).then((res: any) => {
|
|
|
- const ids = (res || []).filter((item: any) => item.resourcesTypes === resourcesTypes).map((item: any) => item.resourcesKey);
|
|
|
+ const ids = (res || []).filter((item: any) => item.resourcesTypes === resourcesTypes.value).map((item: any) => item.resourcesKey);
|
|
|
|
|
|
const tableDataList: any[] = [];
|
|
|
|
|
@@ -126,11 +128,11 @@ function onCancel() {
|
|
|
}
|
|
|
|
|
|
function onSubmit() {
|
|
|
- if (!form.resourcesKey) return ElMessage("请先选择监控");
|
|
|
+ if (!form.resourcesKey) return ElMessage(t('message.projects.detail.video.messages.selectVideoFirst'));
|
|
|
api.bindResources(form).then(() => {
|
|
|
onCancel();
|
|
|
getSourceList();
|
|
|
- ElMessage.success("添加成功");
|
|
|
+ ElMessage.success(t('message.projects.detail.video.messages.addSuccess'));
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -149,20 +151,20 @@ function openToNewWindow() {
|
|
|
}
|
|
|
|
|
|
function onDel(row: any) {
|
|
|
- ElMessageBox.confirm(`确定要解绑该监控?`, "提示", {
|
|
|
- confirmButtonText: "确认",
|
|
|
- cancelButtonText: "取消",
|
|
|
+ ElMessageBox.confirm(t('message.projects.detail.video.messages.unbindConfirm'), t('message.projects.detail.video.messages.tip'), {
|
|
|
+ confirmButtonText: t('message.projects.detail.video.messages.confirm'),
|
|
|
+ cancelButtonText: t('message.projects.detail.video.messages.cancel'),
|
|
|
type: "warning",
|
|
|
}).then(() => {
|
|
|
api
|
|
|
.unbindResources({
|
|
|
projectsCode,
|
|
|
- resourcesTypes,
|
|
|
+ resourcesTypes: resourcesTypes.value,
|
|
|
resourcesKey: row.deviceId + "-" + row.channelId,
|
|
|
})
|
|
|
.then(() => {
|
|
|
getSourceList();
|
|
|
- ElMessage.success("解绑成功");
|
|
|
+ ElMessage.success(t('message.projects.detail.video.messages.unbindSuccess'));
|
|
|
});
|
|
|
});
|
|
|
}
|
|
@@ -173,6 +175,6 @@ function formatTime(row: any, column: any) {
|
|
|
|
|
|
function formatLiveStatus(row: any, column: any) {
|
|
|
// 0 代表空闲,1 代表正在调用 invite,2 代表正在拉流
|
|
|
- return row[column.property] === 0 ? "空闲" : row[column.property] === 1 ? "调用中" : "拉流中";
|
|
|
+ return row[column.property] === 0 ? t('message.projects.detail.video.liveStatusTags.idle') : row[column.property] === 1 ? t('message.projects.detail.video.liveStatusTags.inviting') : t('message.projects.detail.video.liveStatusTags.streaming');
|
|
|
}
|
|
|
</script>
|