萤石摄像头
This commit is contained in:
145
src/views/other/ys7Device/component/add.vue
Normal file
145
src/views/other/ys7Device/component/add.vue
Normal file
@ -0,0 +1,145 @@
|
||||
<template>
|
||||
<div class="system-ys7Devices-add">
|
||||
<!-- 添加或修改荧石摄像头对话框 -->
|
||||
<el-dialog v-model="isShowDialog" width="769px" :close-on-click-modal="false" :destroy-on-close="true">
|
||||
<template #header>
|
||||
<div v-drag="['.system-ys7Devices-add .el-dialog', '.system-ys7Devices-add .el-dialog__header']">添加荧石摄像头</div>
|
||||
</template>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="90px">
|
||||
<el-form-item label="设备序列号" prop="deviceSerial">
|
||||
<el-input v-model="formData.deviceSerial" placeholder="请输入设备串号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input v-model="formData.deviceName" placeholder="请输入设备名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型" prop="deviceType">
|
||||
<el-input v-model="formData.deviceType" placeholder="请输入设备类型" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态" prop="status">
|
||||
<el-input v-model="formData.status" placeholder="请输入状态" />
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="defence">
|
||||
<el-input v-model="formData.defence" placeholder="请输入" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="设备版本" prop="deviceVersion">
|
||||
<el-input v-model="formData.deviceVersion" placeholder="请输入设备版本" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="项目ID" prop="projectId">
|
||||
<el-input v-model="formData.projectId" placeholder="请输入项目ID" />
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="onSubmit">确 定</el-button>
|
||||
<el-button @click="onCancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { reactive, toRefs, defineComponent,ref,unref,getCurrentInstance } from 'vue';
|
||||
import {ElMessageBox, ElMessage, FormInstance,UploadProps} from 'element-plus';
|
||||
import {
|
||||
listYs7Devices,
|
||||
getYs7Devices,
|
||||
delYs7Devices,
|
||||
addYs7Devices,
|
||||
updateYs7Devices,
|
||||
} from "/@/api/system/ys7Devices";
|
||||
import {
|
||||
Ys7DevicesTableColumns,
|
||||
Ys7DevicesInfoData,
|
||||
Ys7DevicesTableDataState,
|
||||
Ys7DevicesEditState,
|
||||
} from "/@/views/system/ys7Devices/list/component/model"
|
||||
export default defineComponent({
|
||||
name:"apiV1SystemYs7DevicesEdit",
|
||||
components:{
|
||||
},
|
||||
props:{
|
||||
},
|
||||
setup(props,{emit}) {
|
||||
const {proxy} = <any>getCurrentInstance()
|
||||
const formRef = ref<HTMLElement | null>(null);
|
||||
const menuRef = ref();
|
||||
const state = reactive<Ys7DevicesEditState>({
|
||||
loading:false,
|
||||
isShowDialog: false,
|
||||
formData: {
|
||||
id: undefined,
|
||||
createdAt: undefined,
|
||||
deviceSerial: undefined,
|
||||
deviceName: undefined,
|
||||
deviceType: undefined,
|
||||
status: undefined,
|
||||
defence: undefined,
|
||||
deviceVersion: undefined,
|
||||
projectId: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
id : [
|
||||
{ required: true, message: "id不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
});
|
||||
// 打开弹窗
|
||||
const openDialog = () => {
|
||||
resetForm();
|
||||
state.isShowDialog = true;
|
||||
};
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
state.isShowDialog = false;
|
||||
};
|
||||
// 取消
|
||||
const onCancel = () => {
|
||||
closeDialog();
|
||||
};
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
const formWrap = unref(formRef) as any;
|
||||
if (!formWrap) return;
|
||||
formWrap.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
state.loading = true;
|
||||
//添加
|
||||
addYs7Devices(state.formData).then(()=>{
|
||||
ElMessage.success('添加成功');
|
||||
closeDialog(); // 关闭弹窗
|
||||
emit('ys7DevicesList')
|
||||
}).finally(()=>{
|
||||
state.loading = false;
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
const resetForm = ()=>{
|
||||
state.formData = {
|
||||
id: undefined,
|
||||
createdAt: undefined,
|
||||
deviceSerial: undefined,
|
||||
deviceName: undefined,
|
||||
deviceType: undefined,
|
||||
status: undefined,
|
||||
defence: undefined,
|
||||
deviceVersion: undefined,
|
||||
projectId: undefined,
|
||||
}
|
||||
};
|
||||
return {
|
||||
proxy,
|
||||
openDialog,
|
||||
closeDialog,
|
||||
onCancel,
|
||||
onSubmit,
|
||||
menuRef,
|
||||
formRef,
|
||||
...toRefs(state),
|
||||
};
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
108
src/views/other/ys7Device/component/bindPro.vue
Normal file
108
src/views/other/ys7Device/component/bindPro.vue
Normal file
@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<div class="system-ys7Devices-add">
|
||||
<!-- 摄像头绑定项目对话框 -->
|
||||
<el-dialog v-model="state.isShowDialog" width="769px" :close-on-click-modal="false" :destroy-on-close="true">
|
||||
<template #header>
|
||||
<div v-drag="['.system-ys7Devices-add .el-dialog', '.system-ys7Devices-add .el-dialog__header']">设备分配</div>
|
||||
</template>
|
||||
<el-form ref="formRef" :model="state.formData" label-width="90px">
|
||||
<el-radio-group v-model="state.formData.projectId" class="device_box">
|
||||
<div v-for="item in projectList" class="device_row" :key="item.id">
|
||||
<el-radio :label="item.id">{{ item.name }}</el-radio>
|
||||
</div>
|
||||
</el-radio-group>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="onSubmit">确 定</el-button>
|
||||
<el-button @click="onCancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, toRefs, getCurrentInstance } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { devicesLinkPro } from '@/api/other/ys7Device';
|
||||
// props
|
||||
defineProps<{
|
||||
projectList: Array<any>;
|
||||
}>();
|
||||
|
||||
// emit
|
||||
const emit = defineEmits<{
|
||||
(e: 'ys7DevicesList'): void;
|
||||
}>();
|
||||
|
||||
const { proxy } = getCurrentInstance() as any;
|
||||
|
||||
const formRef = ref<HTMLElement | null>(null);
|
||||
const menuRef = ref();
|
||||
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
isShowDialog: false,
|
||||
formData: { projectId: null, id: null }
|
||||
});
|
||||
|
||||
const openDialog = (row: any) => {
|
||||
resetForm();
|
||||
|
||||
if (row.row && row.row.id) {
|
||||
state.formData.id = row.row.id;
|
||||
}
|
||||
state.isShowDialog = true;
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
state.isShowDialog = false;
|
||||
};
|
||||
|
||||
const onCancel = () => {
|
||||
closeDialog();
|
||||
};
|
||||
|
||||
const onSubmit = () => {
|
||||
if (state.formData.projectId) {
|
||||
state.loading = true;
|
||||
devicesLinkPro(state.formData)
|
||||
.then(() => {
|
||||
ElMessage.success('分配成功');
|
||||
closeDialog();
|
||||
emit('ys7DevicesList');
|
||||
})
|
||||
.finally(() => {
|
||||
state.loading = false;
|
||||
});
|
||||
} else {
|
||||
ElMessage.warning('未选择所属项目');
|
||||
}
|
||||
};
|
||||
|
||||
const resetForm = () => {
|
||||
state.formData = {
|
||||
id: null,
|
||||
projectId: null
|
||||
};
|
||||
};
|
||||
|
||||
// 暴露用于父组件调用的 openDialog 方法(如果需要)
|
||||
defineExpose({
|
||||
openDialog,
|
||||
closeDialog
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.device_box {
|
||||
width: 100%;
|
||||
|
||||
> div {
|
||||
padding-right: 30px;
|
||||
height: 45px;
|
||||
line-height: 45px;
|
||||
}
|
||||
}
|
||||
</style>
|
149
src/views/other/ys7Device/component/detail.vue
Normal file
149
src/views/other/ys7Device/component/detail.vue
Normal file
@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<!-- 荧石摄像头详情抽屉 -->
|
||||
<div class="system-ys7Devices-detail">
|
||||
<el-drawer v-model="isShowDialog" size="80%" direction="ltr">
|
||||
<template #header>
|
||||
<h4>荧石摄像头详情</h4>
|
||||
</template>
|
||||
<el-form ref="formRef" :model="formData" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="创建时间">{{ proxy.parseTime(formData.createdAt, '{y}-{m}-{d} {h}:{i}:{s}') }}</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备串号">{{ formData.deviceSerial }}</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备名称">{{ formData.deviceName }}</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备类型">{{ formData.deviceType }}</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态">{{ formData.status }}</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12">
|
||||
<el-form-item label="">{{ formData.defence }}</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备版本">{{ formData.deviceVersion }}</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属项目">{{ formData.projectId }}</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { reactive, toRefs, defineComponent,ref,unref,getCurrentInstance,computed } from 'vue';
|
||||
import {ElMessageBox, ElMessage, FormInstance,UploadProps} from 'element-plus';
|
||||
import {
|
||||
listYs7Devices,
|
||||
getYs7Devices,
|
||||
delYs7Devices,
|
||||
addYs7Devices,
|
||||
updateYs7Devices,
|
||||
} from "/@/api/system/ys7Devices";
|
||||
import {
|
||||
Ys7DevicesTableColumns,
|
||||
Ys7DevicesInfoData,
|
||||
Ys7DevicesTableDataState,
|
||||
Ys7DevicesEditState,
|
||||
} from "/@/views/system/ys7Devices/list/component/model"
|
||||
export default defineComponent({
|
||||
name:"apiV1SystemYs7DevicesDetail",
|
||||
components:{
|
||||
},
|
||||
props:{
|
||||
},
|
||||
setup(props,{emit}) {
|
||||
const {proxy} = <any>getCurrentInstance()
|
||||
const formRef = ref<HTMLElement | null>(null);
|
||||
const menuRef = ref();
|
||||
const state = reactive<Ys7DevicesEditState>({
|
||||
loading:false,
|
||||
isShowDialog: false,
|
||||
formData: {
|
||||
id: undefined,
|
||||
createdAt: undefined,
|
||||
deviceSerial: undefined,
|
||||
deviceName: undefined,
|
||||
deviceType: undefined,
|
||||
status: undefined,
|
||||
defence: undefined,
|
||||
deviceVersion: undefined,
|
||||
projectId: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
id : [
|
||||
{ required: true, message: "id不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
});
|
||||
// 打开弹窗
|
||||
const openDialog = (row?: Ys7DevicesInfoData) => {
|
||||
resetForm();
|
||||
if(row) {
|
||||
getYs7Devices(row.id!).then((res:any)=>{
|
||||
const data = res.data;
|
||||
state.formData = data;
|
||||
})
|
||||
}
|
||||
state.isShowDialog = true;
|
||||
};
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
state.isShowDialog = false;
|
||||
};
|
||||
// 取消
|
||||
const onCancel = () => {
|
||||
closeDialog();
|
||||
};
|
||||
const resetForm = ()=>{
|
||||
state.formData = {
|
||||
id: undefined,
|
||||
createdAt: undefined,
|
||||
deviceSerial: undefined,
|
||||
deviceName: undefined,
|
||||
deviceType: undefined,
|
||||
status: undefined,
|
||||
defence: undefined,
|
||||
deviceVersion: undefined,
|
||||
projectId: undefined,
|
||||
}
|
||||
};
|
||||
return {
|
||||
proxy,
|
||||
openDialog,
|
||||
closeDialog,
|
||||
onCancel,
|
||||
menuRef,
|
||||
formRef,
|
||||
...toRefs(state),
|
||||
};
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
.system-ys7Devices-detail :deep(.el-form-item--large .el-form-item__label){
|
||||
font-weight: bolder;
|
||||
}
|
||||
.pic-block{
|
||||
margin-right: 8px;
|
||||
}
|
||||
.file-block{
|
||||
width: 100%;
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: var(--el-transition-duration-fast);
|
||||
margin-bottom: 5px;
|
||||
padding: 3px 6px;
|
||||
}
|
||||
.ml-2{margin-right: 5px;}
|
||||
</style>
|
174
src/views/other/ys7Device/component/edit.vue
Normal file
174
src/views/other/ys7Device/component/edit.vue
Normal file
@ -0,0 +1,174 @@
|
||||
<template>
|
||||
<div class="system-ys7Devices-edit">
|
||||
<!-- 添加或修改荧石摄像头对话框 -->
|
||||
<el-dialog v-model="isShowDialog" width="769px" :close-on-click-modal="false" :destroy-on-close="true" custom-class="ys7Devices_edit">
|
||||
<template #header>
|
||||
<div v-drag="['.system-ys7Devices-edit .el-dialog', '.system-ys7Devices-edit .el-dialog__header']">{{(!formData.id || formData.id==0?'添加':'修改')+'荧石摄像头'}}</div>
|
||||
</template>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="90px">
|
||||
<el-form-item label="设备序列号" prop="deviceSerial">
|
||||
<el-input v-model="formData.deviceSerial" placeholder="请输入设备串号" disabled/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input v-model="formData.deviceName" placeholder="请输入设备名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型" prop="deviceType">
|
||||
<el-input v-model="formData.deviceType" placeholder="请输入设备类型" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态" prop="status">
|
||||
<el-input v-model="formData.status" placeholder="请输入状态" />
|
||||
</el-form-item>
|
||||
<el-form-item label="" prop="defence">
|
||||
<el-input v-model="formData.defence" placeholder="请输入" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="设备版本" prop="deviceVersion">
|
||||
<el-input v-model="formData.deviceVersion" placeholder="请输入设备版本" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注信息" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="项目ID" prop="projectId">
|
||||
<el-input v-model="formData.projectId" placeholder="请输入项目ID" />
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="onSubmit">确 定</el-button>
|
||||
<el-button @click="onCancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { reactive, toRefs, defineComponent,ref,unref,getCurrentInstance } from 'vue';
|
||||
import {ElMessageBox, ElMessage, FormInstance,ElLoading} from 'element-plus';
|
||||
import {
|
||||
listYs7Devices,
|
||||
getYs7Devices,
|
||||
delYs7Devices,
|
||||
addYs7Devices,
|
||||
updateYs7Devices,
|
||||
} from "/@/api/system/ys7Devices";
|
||||
import {
|
||||
Ys7DevicesTableColumns,
|
||||
Ys7DevicesInfoData,
|
||||
Ys7DevicesTableDataState,
|
||||
Ys7DevicesEditState,
|
||||
} from "/@/views/system/ys7Devices/list/component/model"
|
||||
export default defineComponent({
|
||||
name:"apiV1SystemYs7DevicesEdit",
|
||||
components:{
|
||||
},
|
||||
props:{
|
||||
},
|
||||
setup(props,{emit}) {
|
||||
const {proxy} = <any>getCurrentInstance()
|
||||
const formRef = ref<HTMLElement | null>(null);
|
||||
const menuRef = ref();
|
||||
const state = reactive<Ys7DevicesEditState>({
|
||||
loading:false,
|
||||
isShowDialog: false,
|
||||
formData: {
|
||||
id: undefined,
|
||||
createdAt: undefined,
|
||||
deviceSerial: undefined,
|
||||
deviceName: undefined,
|
||||
deviceType: undefined,
|
||||
status: undefined,
|
||||
defence: undefined,
|
||||
deviceVersion: undefined,
|
||||
projectId: undefined,
|
||||
remark: undefined
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
id : [
|
||||
{ required: true, message: "id不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
});
|
||||
// 打开弹窗
|
||||
const openDialog = (row?: Ys7DevicesInfoData) => {
|
||||
resetForm();
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '正在加载中……',
|
||||
background: 'rgba(0, 0, 0, 0.7)',
|
||||
target: '.ys7Devices_edit',
|
||||
});
|
||||
if(row) {
|
||||
getYs7Devices(row.id!).then((res:any)=>{
|
||||
loading.close();
|
||||
const data = res.data;
|
||||
state.formData = data;
|
||||
})
|
||||
}
|
||||
state.isShowDialog = true;
|
||||
};
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
state.isShowDialog = false;
|
||||
};
|
||||
// 取消
|
||||
const onCancel = () => {
|
||||
closeDialog();
|
||||
};
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
const formWrap = unref(formRef) as any;
|
||||
if (!formWrap) return;
|
||||
formWrap.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
state.loading = true;
|
||||
if(!state.formData.id || state.formData.id===0){
|
||||
//添加
|
||||
addYs7Devices(state.formData).then(()=>{
|
||||
ElMessage.success('添加成功');
|
||||
closeDialog(); // 关闭弹窗
|
||||
emit('ys7DevicesList')
|
||||
}).finally(()=>{
|
||||
state.loading = false;
|
||||
})
|
||||
}else{
|
||||
//修改
|
||||
updateYs7Devices(state.formData).then(()=>{
|
||||
ElMessage.success('修改成功');
|
||||
closeDialog(); // 关闭弹窗
|
||||
emit('ys7DevicesList')
|
||||
}).finally(()=>{
|
||||
state.loading = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const resetForm = ()=>{
|
||||
state.formData = {
|
||||
id: undefined,
|
||||
createdAt: undefined,
|
||||
deviceSerial: undefined,
|
||||
deviceName: undefined,
|
||||
deviceType: undefined,
|
||||
status: undefined,
|
||||
defence: undefined,
|
||||
deviceVersion: undefined,
|
||||
projectId: undefined,
|
||||
remark: undefined
|
||||
}
|
||||
};
|
||||
return {
|
||||
proxy,
|
||||
openDialog,
|
||||
closeDialog,
|
||||
onCancel,
|
||||
onSubmit,
|
||||
menuRef,
|
||||
formRef,
|
||||
...toRefs(state),
|
||||
};
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
284
src/views/other/ys7Device/component/presetAdd.vue
Normal file
284
src/views/other/ys7Device/component/presetAdd.vue
Normal file
@ -0,0 +1,284 @@
|
||||
<template>
|
||||
<div class="system-busPresettingBit-add">
|
||||
<el-dialog v-model="isShowDialog" width="1250px" :close-on-click-modal="false" :destroy-on-close="true">
|
||||
<template #header>
|
||||
<div v-drag="['.system-busPresettingBit-add .el-dialog', '.system-busPresettingBit-add .el-dialog__header']">
|
||||
{{ title }}:添加摄像头预置位
|
||||
</div>
|
||||
</template>
|
||||
<div class="info_list">
|
||||
<div class="video_box">
|
||||
<div class="video-container" id="video-container" style="width: 870px; height: 600px"></div>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" style="margin: 0 20px 10px" @click="addPre">
|
||||
<el-icon><ele-Plus /></el-icon>
|
||||
添加预置点</el-button
|
||||
>
|
||||
<el-table v-loading="loading" :data="tableData.data" border>
|
||||
<el-table-column label="序号" align="center" type="index" width="50" />
|
||||
<el-table-column label="名称" align="center" prop="name" width="100px" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<el-input placeholder="请输入内容" v-model="scope.row.name" @change="handleEdit(scope.row)"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="130px">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="handleDebug(scope.row)"
|
||||
><el-icon><ele-View /></el-icon>调用</el-button
|
||||
>
|
||||
<el-button type="danger" link @click="handleDelete(scope.row)"
|
||||
><el-icon><ele-DeleteFilled /></el-icon>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
style="padding: 5px 16px"
|
||||
v-show="tableData.total > 0"
|
||||
:total="tableData.total"
|
||||
v-model:page="tableData.param.pageNum"
|
||||
v-model:limit="tableData.param.pageSize"
|
||||
@pagination="busPresettingBitList"
|
||||
:layout="layout"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { reactive, toRefs, defineComponent, ref, unref, getCurrentInstance, nextTick, onBeforeUnmount } from 'vue';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import {
|
||||
listDevicePreset,
|
||||
getDevicePreset,
|
||||
addDevicePreset,
|
||||
updateDevicePreset,
|
||||
delDevicePreset,
|
||||
callDevicePreset,
|
||||
} from '/@/api/system/devicePreset';
|
||||
import { getAccessToken } from '/@/api/system/ys7Devices';
|
||||
export default defineComponent({
|
||||
name: 'index',
|
||||
setup(props, { emit }) {
|
||||
const { proxy } = <any>getCurrentInstance();
|
||||
const formRef = ref<HTMLElement | null>(null);
|
||||
const menuRef = ref();
|
||||
const loading = ref(false);
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
isShowDialog: false,
|
||||
formData: {
|
||||
deviceSerial: undefined,
|
||||
channelNo: '1',
|
||||
presetName: undefined,
|
||||
},
|
||||
layout: 'total, prev, pager, next',
|
||||
tableData: {
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
param: {
|
||||
pageNum: 1,
|
||||
pageSize: 15,
|
||||
deviceSerial: '',
|
||||
},
|
||||
},
|
||||
// 表单校验
|
||||
rules: {},
|
||||
title: '',
|
||||
updateRow: null,
|
||||
src: null,
|
||||
flvPlayer: null,
|
||||
});
|
||||
// 打开弹窗
|
||||
const openDialog = (row) => {
|
||||
resetForm();
|
||||
state.updateRow = row;
|
||||
state.title = row.deviceName; //摄像头名称
|
||||
state.formData.deviceSerial = row.deviceSerial;
|
||||
state.tableData.param.deviceSerial = row.deviceSerial;
|
||||
state.isShowDialog = true;
|
||||
busPresettingBitList(); // 获取预置点列表数据
|
||||
nextTick(() => {
|
||||
videoPlay(row);
|
||||
});
|
||||
};
|
||||
// 添加预置点
|
||||
const addPre = () => {
|
||||
ElMessageBox.prompt('请输入预置点名称', '添加预置点', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputErrorMessage: '请输入预置点名称',
|
||||
})
|
||||
.then(({ value }) => {
|
||||
state.formData.presetName = value;
|
||||
addDevicePreset(state.formData)
|
||||
.then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
busPresettingBitList(); //获取预置点
|
||||
})
|
||||
.finally(() => {
|
||||
state.loading = false;
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
// 视频播放
|
||||
const videoPlay = (obj) => {
|
||||
getAccessToken({}).then((res: any) => {
|
||||
if (res.code == 0 && obj.deviceSerial) {
|
||||
state.flvPlayer = new EZUIKit.EZUIKitPlayer({
|
||||
audio: '0',
|
||||
id: 'video-container', // 视频容器ID
|
||||
accessToken: res.data.token,
|
||||
url: `ezopen://open.ys7.com/${obj.deviceSerial}/1.hd.live`, // 初始化写死一个离线或者找不到的设备,避免初始化无法创建播放器;
|
||||
template: 'pcLive', //standard pcLive
|
||||
width: 870, //默认值为容器容器DOM宽高度
|
||||
height: 600,
|
||||
plugin: ['talk'], // 加载插件,talk-对讲
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
if (state.flvPlayer) {
|
||||
const destroyPromise = state.flvPlayer.destroy();
|
||||
destroyPromise.then((data: any) => {
|
||||
console.log('promise 获取 数据', data);
|
||||
});
|
||||
state.flvPlayer = null;
|
||||
}
|
||||
state.isShowDialog = false;
|
||||
};
|
||||
// 获取预置点列表数据
|
||||
const busPresettingBitList = () => {
|
||||
loading.value = true;
|
||||
listDevicePreset(state.tableData.param).then((res: any) => {
|
||||
let list = res.data.list ?? [];
|
||||
state.tableData.data = list;
|
||||
state.tableData.total = res.data.total;
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
// 取消
|
||||
const onCancel = () => {
|
||||
closeDialog();
|
||||
};
|
||||
const handleDelete = (row: any) => {
|
||||
let msg = '你确定要删除所选数据?';
|
||||
let id: number[] = [];
|
||||
if (row) {
|
||||
msg = `此操作将永久删除数据,是否继续?`;
|
||||
id = [row.id];
|
||||
}
|
||||
if (id.length === 0) {
|
||||
ElMessage.error('请选择要删除的数据。');
|
||||
return;
|
||||
}
|
||||
ElMessageBox.confirm(msg, '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
let obj = {
|
||||
deviceSerial: row.deviceSerial,
|
||||
ids: id,
|
||||
};
|
||||
delDevicePreset(obj).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
ElMessage.success('删除成功');
|
||||
busPresettingBitList();
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
// 调用
|
||||
const handleDebug = (row) => {
|
||||
let obj = {
|
||||
deviceSerial: row.deviceSerial,
|
||||
index: row.index,
|
||||
};
|
||||
callDevicePreset(obj).then((res: any) => {
|
||||
if (res.code == 0) {
|
||||
ElMessage.success('调用成功');
|
||||
}
|
||||
});
|
||||
};
|
||||
const handleEdit = (row: any) => {
|
||||
let param = {
|
||||
id: row.id,
|
||||
deviceSerial: row.deviceSerial,
|
||||
newName: row.name,
|
||||
};
|
||||
updateDevicePreset(param)
|
||||
.then(() => {
|
||||
ElMessage.success('修改成功');
|
||||
busPresettingBitList(); //获取预置点
|
||||
})
|
||||
.finally(() => {
|
||||
state.loading = false;
|
||||
});
|
||||
};
|
||||
const resetForm = () => {
|
||||
state.formData = {
|
||||
deviceSerial: undefined,
|
||||
channelNo: '1',
|
||||
presetName: undefined,
|
||||
};
|
||||
};
|
||||
onBeforeUnmount(() => {
|
||||
if (state.flvPlayer) {
|
||||
const destroyPromise = state.flvPlayer.destroy();
|
||||
destroyPromise.then((data: any) => {
|
||||
console.log('promise 获取 数据', data);
|
||||
});
|
||||
state.flvPlayer = null;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
proxy,
|
||||
openDialog,
|
||||
closeDialog,
|
||||
onCancel,
|
||||
menuRef,
|
||||
formRef,
|
||||
handleDebug,
|
||||
handleDelete,
|
||||
addPre,
|
||||
handleEdit,
|
||||
loading,
|
||||
busPresettingBitList,
|
||||
...toRefs(state),
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.system-busPresettingBit-add {
|
||||
.info_list {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
height: 100%;
|
||||
.video_box {
|
||||
width: 75%;
|
||||
height: 600px;
|
||||
margin-right: 10px;
|
||||
.iframe {
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
.video_air {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: fill;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
376
src/views/other/ys7Device/index.vue
Normal file
376
src/views/other/ys7Device/index.vue
Normal file
@ -0,0 +1,376 @@
|
||||
<template>
|
||||
<div class="system-ys7Devices-container">
|
||||
<el-card shadow="hover">
|
||||
<div class="system-ys7Devices-search mb8">
|
||||
<el-form :model="tableData.param" ref="queryRef" :inline="true" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8" class="colBlock">
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input v-model="tableData.param.deviceName" placeholder="请输入设备名称" clearable @keyup.enter.native="ys7DevicesList" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="colBlock">
|
||||
<el-form-item label="设备类型" prop="deviceType">
|
||||
<el-input v-model="tableData.param.deviceType" placeholder="请输入设备类型" clearable @keyup.enter.native="ys7DevicesList" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :class="!showAll ? 'colBlock' : 'colNone'">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="ys7DevicesList"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
<el-button @click="resetQuery(queryRef)"
|
||||
><el-icon><Refresh /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button type="primary" link @click="toggleSearch">
|
||||
{{ word }}
|
||||
<el-icon v-show="showAll"><ArrowUp /></el-icon>
|
||||
<el-icon v-show="!showAll"><ArrowDown /></el-icon>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :class="showAll ? 'colBlock' : 'colNone'">
|
||||
<el-form-item label="设备序列号" prop="deviceSerial">
|
||||
<el-input v-model="tableData.param.deviceSerial" placeholder="请输入设备串号" clearable @keyup.enter.native="ys7DevicesList" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :class="showAll ? 'colBlock' : 'colNone'">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="tableData.param.status" placeholder="请选择设备状态" clearable>
|
||||
<el-option label="在线" :value="1" />
|
||||
<el-option label="离线" :value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :class="showAll ? 'colBlock' : 'colNone'">
|
||||
<el-form-item label="设备版本" prop="deviceVersion">
|
||||
<el-input v-model="tableData.param.deviceVersion" placeholder="请输入设备版本" clearable @keyup.enter.native="ys7DevicesList" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :class="showAll ? 'colBlock' : 'colNone'">
|
||||
<el-form-item label="所属项目" prop="projectId">
|
||||
<el-select v-model="tableData.param.projectId" placeholder="请选择所属项目" clearable filterable>
|
||||
<el-option v-for="item in projectList" class="device_row" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" :class="showAll ? 'colBlock' : 'colNone'">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="ys7DevicesList"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
<el-button @click="resetQuery(queryRef)"
|
||||
><el-icon><Refresh /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button type="primary" link @click="toggleSearch">
|
||||
{{ word }}
|
||||
<el-icon v-show="showAll"><ArrowUp /></el-icon>
|
||||
<el-icon v-show="!showAll"><ArrowDown /></el-icon>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="primary" @click="handleAdd" v-auth="'api/v1/system/ys7Devices/add'"
|
||||
><el-icon><Plus /></el-icon>新增</el-button
|
||||
>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" :disabled="single" @click="handleUpdate(null)" v-auth="'api/v1/system/ys7Devices/edit'"
|
||||
><el-icon><Edit /></el-icon>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" :disabled="multiple" @click="handleDelete(null)" v-auth="'api/v1/system/ys7Devices/delete'"
|
||||
><el-icon><Delete /></el-icon>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" :disabled="multiple" @click="onLinkProject(null)" v-auth="'api/v1/system/ys7Devices/add'"
|
||||
><el-icon><Link /></el-icon>设备分配</el-button
|
||||
>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="tableData.data" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="设备序列号" align="center" prop="deviceSerial" min-width="100px" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" min-width="100px" />
|
||||
<el-table-column label="设备类型" align="center" prop="deviceType" min-width="100px" />
|
||||
<el-table-column label="状态" align="center" prop="status" min-width="100px">
|
||||
<template #default="scope">
|
||||
<el-tag type="success" v-if="scope.row.status === 1">在线</el-tag>
|
||||
<el-tag type="danger" v-if="scope.row.status === 0">离线</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="视频加密" align="center" prop="videoEncrypted" min-width="100px">
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.videoEncrypted"
|
||||
class="ml-2"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
:loading="scope.row.enctyptLoading"
|
||||
@change="encryptChange(scope.row)"
|
||||
inline-prompt
|
||||
active-text="开启"
|
||||
inactive-text="关闭"
|
||||
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="" align="center" prop="defence" min-width="100px" /> -->
|
||||
<el-table-column label="设备版本" align="center" prop="deviceVersion" min-width="100px" />
|
||||
<el-table-column label="所属项目" align="center" prop="projectId" min-width="100px">
|
||||
<template #default="scope">
|
||||
{{ scope.row.projectName ? scope.row.projectName : '未分配' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" min-width="100px" />
|
||||
<el-table-column label="创建时间" align="center" prop="deviceCreateTime" min-width="100px">
|
||||
<template #default="scope">
|
||||
<span>{{ proxy.parseTime(scope.row.deviceCreateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding" min-width="160px" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="handleUpdate(scope.row)" v-auth="'api/v1/system/ys7Devices/edit'"
|
||||
><el-icon><EditPen /></el-icon>修改</el-button
|
||||
>
|
||||
<el-button type="primary" link @click="handleDelete(scope.row)" v-auth="'api/v1/system/ys7Devices/delete'"
|
||||
><el-icon><DeleteFilled /></el-icon>删除</el-button
|
||||
>
|
||||
<el-button type="primary" link @click="onLinkProject(scope.row)" v-auth="'api/v1/system/ys7Devices/delete'"
|
||||
><el-icon><Link /></el-icon>设备分配</el-button
|
||||
>
|
||||
<el-button type="primary" link @click="addPreset(scope.row)"
|
||||
><el-icon><Plus /></el-icon>添加预置位</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="tableData.total > 0"
|
||||
:total="tableData.total"
|
||||
v-model:page="tableData.param.pageNum"
|
||||
v-model:limit="tableData.param.pageSize"
|
||||
@pagination="ys7DevicesList"
|
||||
/>
|
||||
</el-card>
|
||||
<!-- <apiV1SystemYs7DevicesAdd ref="addRef" @ys7DevicesList="ys7DevicesList"></apiV1SystemYs7DevicesAdd>
|
||||
<apiV1SystemYs7DevicesEdit ref="editRef" @ys7DevicesList="ys7DevicesList"></apiV1SystemYs7DevicesEdit>
|
||||
<apiV1SystemYs7DevicesDetail ref="detailRef" @ys7DevicesList="ys7DevicesList"></apiV1SystemYs7DevicesDetail> -->
|
||||
<bindPro ref="bindProRef" :projectList="projectList" @ys7DevicesList="ys7DevicesList"></bindPro>
|
||||
<!-- <presetAdd ref="presetAddRef" @busPresettingBitList="busPresettingBitList"></presetAdd> -->
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
// import { ref, reactive, onMounted, computed, toRefs, getCurrentInstance, toRaw } from 'vue';
|
||||
import { ElMessageBox, ElMessage, FormInstance } from 'element-plus';
|
||||
import { listYs7Device, delYs7Device, toggleEncrypt } from '@/api/other/ys7Device';
|
||||
// import { Ys7DeviceVO, Ys7DevicesInfoData, Ys7DevicesTableDataState } from './component/model';
|
||||
import { Ys7DeviceVO, Ys7DeviceForm, Ys7DeviceQuery } from '@/api/other/ys7Device/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
// import apiV1SystemYs7DevicesAdd from './component/add.vue';
|
||||
// import apiV1SystemYs7DevicesEdit from './component/edit.vue';
|
||||
// import apiV1SystemYs7DevicesDetail from './component/detail.vue';
|
||||
import bindPro from './component/bindPro.vue';
|
||||
import presetAdd from './component/presetAdd.vue';
|
||||
|
||||
// proxy 获取
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
// ref 定义
|
||||
const loading = ref(false);
|
||||
const queryRef = ref<FormInstance>();
|
||||
const addRef = ref();
|
||||
const editRef = ref();
|
||||
const detailRef = ref();
|
||||
const bindProRef = ref();
|
||||
const presetAddRef = ref();
|
||||
|
||||
// 展开/收起搜索项
|
||||
const showAll = ref(false);
|
||||
const word = computed(() => (showAll.value ? '收起搜索' : '展开搜索'));
|
||||
|
||||
// 多选控制
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const projects = computed(() => userStore.projects);
|
||||
|
||||
// 状态管理
|
||||
const state = reactive<any>({
|
||||
ids: [],
|
||||
serials: [],
|
||||
tableData: {
|
||||
data: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
param: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
id: undefined,
|
||||
createdAt: undefined,
|
||||
deviceSerial: undefined,
|
||||
deviceName: undefined,
|
||||
deviceType: undefined,
|
||||
status: undefined,
|
||||
defence: undefined,
|
||||
deviceVersion: undefined,
|
||||
projectId: currentProject.value?.id,
|
||||
dateRange: [],
|
||||
isFront: false
|
||||
}
|
||||
},
|
||||
projectList: projects.value
|
||||
});
|
||||
|
||||
// 初始化
|
||||
const initTableData = () => {
|
||||
ys7DevicesList();
|
||||
// sysProjectList();
|
||||
};
|
||||
|
||||
// 搜索重置
|
||||
const resetQuery = (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
ys7DevicesList();
|
||||
};
|
||||
|
||||
// 获取设备列表
|
||||
const ys7DevicesList = () => {
|
||||
loading.value = true;
|
||||
listYs7Device(state.tableData.param).then((res: any) => {
|
||||
let list = res.rows ?? [];
|
||||
state.tableData.data = list.map((item) => {
|
||||
item.enctyptLoading = false;
|
||||
return item;
|
||||
});
|
||||
state.tableData.total = res.total;
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
// 展开/收起搜索项
|
||||
const toggleSearch = () => {
|
||||
showAll.value = !showAll.value;
|
||||
};
|
||||
|
||||
// 多选事件
|
||||
const handleSelectionChange = (selection: any[]) => {
|
||||
state.ids = selection.map((item) => item.id);
|
||||
state.serials = selection.map((item) => item.deviceSerial);
|
||||
single.value = selection.length !== 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
// 新增
|
||||
const handleAdd = () => {
|
||||
addRef.value.openDialog();
|
||||
};
|
||||
|
||||
// 编辑
|
||||
const handleUpdate = (row?: Ys7DeviceVO) => {
|
||||
if (!row) {
|
||||
row = state.tableData.data.find((item) => item.id === state.ids[0])!;
|
||||
}
|
||||
editRef.value.openDialog(toRaw(row));
|
||||
};
|
||||
|
||||
// 删除
|
||||
const handleDelete = (row?: Ys7DeviceVO) => {
|
||||
let msg = row ? `此操作将永久删除数据,是否继续?` : '你确定要删除所选数据?';
|
||||
let id = row ? [row.id] : state.ids;
|
||||
|
||||
if (id.length === 0) {
|
||||
ElMessage.error('请选择要删除的数据。');
|
||||
return;
|
||||
}
|
||||
|
||||
ElMessageBox.confirm(msg, '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
delYs7Device(id).then(() => {
|
||||
ElMessage.success('删除成功');
|
||||
ys7DevicesList();
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
// 查看详情
|
||||
const handleView = (row: Ys7DeviceVO) => {
|
||||
detailRef.value.openDialog(toRaw(row));
|
||||
};
|
||||
|
||||
// 绑定项目
|
||||
const onLinkProject = (row?: Ys7DeviceVO) => {
|
||||
let serials = row ? [row.deviceSerial] : state.serials;
|
||||
if (serials.length === 0) {
|
||||
ElMessage.error('请选择要绑定项目的设备');
|
||||
return;
|
||||
}
|
||||
let info = { serials, row };
|
||||
bindProRef.value.openDialog(toRaw(info));
|
||||
};
|
||||
|
||||
// 添加预置位
|
||||
const addPreset = (row: any) => {
|
||||
presetAddRef.value.openDialog(row);
|
||||
};
|
||||
|
||||
// 开关加密
|
||||
const encryptChange = (row: Ys7DeviceVO | any) => {
|
||||
row.enctyptLoading = true;
|
||||
// const action = row.videoEncrypted === 0 ? 1 : 0;
|
||||
console.log(row.videoEncrypted);
|
||||
|
||||
toggleEncrypt({ videoEncrypted: row.videoEncrypted, id: row.id })
|
||||
.then(() => {
|
||||
proxy?.$modal.msgSuccess(row.videoEncrypted === 0 ? '关闭成功' : '开启成功');
|
||||
})
|
||||
.finally(() => {
|
||||
row.enctyptLoading = false;
|
||||
ys7DevicesList();
|
||||
});
|
||||
};
|
||||
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
() => currentProject.value.id,
|
||||
(nid, oid) => {
|
||||
tableData.value.param.projectId = nid;
|
||||
initTableData();
|
||||
}
|
||||
);
|
||||
|
||||
// 页面加载
|
||||
onMounted(() => {
|
||||
initTableData();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
|
||||
// 暴露变量
|
||||
const { tableData, projectList } = toRefs(state);
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.colBlock {
|
||||
display: block;
|
||||
}
|
||||
.colNone {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
@ -10,7 +10,8 @@
|
||||
:options="matrixOptions"
|
||||
placeholder="请选择"
|
||||
@change="handleChange"
|
||||
:props="{ value: 'id', label: 'matrixName' }"
|
||||
:props="{ value: 'matrixId', label: 'name' }"
|
||||
v-model="queryParams.matrixId"
|
||||
clearable
|
||||
/>
|
||||
<!-- <el-select v-model="matrixValue" placeholder="请选择" @change="handleChange" clearable>
|
||||
@ -272,15 +273,23 @@ const { queryParams, form, rules } = toRefs(data);
|
||||
const getList = async () => {
|
||||
if (!queryParams.value.matrixId) {
|
||||
const res = await getProjectSquare(currentProject.value.id);
|
||||
if (res.rows.length === 0) {
|
||||
if (res.data.length === 0) {
|
||||
proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵');
|
||||
} else {
|
||||
if (!matrixValue.value) matrixValue.value = res.rows[0].id;
|
||||
matrixOptions.value = res.rows;
|
||||
queryParams.value.matrixId = res.rows[0].id;
|
||||
let matrixList = res.data.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
matrixId: item.projectId
|
||||
};
|
||||
});
|
||||
if (!matrixValue.value) matrixValue.value = matrixList[0].id;
|
||||
matrixOptions.value = matrixList;
|
||||
queryParams.value.matrixId = matrixList[0].children[0].matrixId;
|
||||
}
|
||||
}
|
||||
loading.value = true;
|
||||
console.log(queryParams.value);
|
||||
|
||||
const res = await listProgressCategory(queryParams.value);
|
||||
const data = proxy?.handleTree<ProgressCategoryVO>(res.data, 'id', 'pid');
|
||||
if (data) {
|
||||
@ -324,7 +333,7 @@ const handleQuery = () => {
|
||||
|
||||
/** 级联选择器改变事件 */
|
||||
const handleChange = (value: number) => {
|
||||
queryParams.value.matrixId = value;
|
||||
queryParams.value.matrixId = value[1];
|
||||
|
||||
getList();
|
||||
};
|
||||
|
@ -15,9 +15,17 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="请选择方阵:" prop="pid" label-width="100" style="margin-bottom: 0">
|
||||
<el-select v-model="matrixValue" placeholder="请选择" @change="handleChange" clearable>
|
||||
<!-- <el-select v-model="matrixValue" placeholder="请选择" @change="handleChange" clearable>
|
||||
<el-option v-for="item in matrixOptions" :key="item.id" :label="item.matrixName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-select> -->
|
||||
<el-cascader
|
||||
:options="matrixOptions"
|
||||
placeholder="请选择"
|
||||
@change="handleChange"
|
||||
:props="{ value: 'matrixId', label: 'name' }"
|
||||
v-model="queryParams.matrixId"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@ -274,7 +282,7 @@ const resetTreeAndMap = () => {
|
||||
|
||||
/** 方阵选择器改变事件 */
|
||||
const handleChange = (value: number) => {
|
||||
queryParams.value.matrixId = value;
|
||||
queryParams.value.matrixId = value[1];
|
||||
|
||||
getList();
|
||||
};
|
||||
@ -363,12 +371,18 @@ const resetMatrix = () => {
|
||||
const getList = async () => {
|
||||
if (!queryParams.value.matrixId) {
|
||||
const res = await getProjectSquare(currentProject.value.id);
|
||||
if (res.rows.length === 0) {
|
||||
if (res.data.length === 0) {
|
||||
proxy?.$modal.msgWarning('当前项目下没有方阵,请先创建方阵');
|
||||
} else {
|
||||
if (!matrixValue.value) matrixValue.value = res.rows[0].id;
|
||||
matrixOptions.value = res.rows;
|
||||
queryParams.value.matrixId = res.rows[0].id;
|
||||
let matrixList = res.data.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
matrixId: item.projectId
|
||||
};
|
||||
});
|
||||
if (!matrixValue.value) matrixValue.value = matrixList[0].id;
|
||||
matrixOptions.value = matrixList;
|
||||
queryParams.value.matrixId = matrixList[0].children[0].matrixId;
|
||||
}
|
||||
}
|
||||
loading.value = true;
|
||||
|
Reference in New Issue
Block a user