Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
11
apps/web-antd/src/api/common.d.ts
vendored
11
apps/web-antd/src/api/common.d.ts
vendored
@@ -1,3 +1,5 @@
|
|||||||
|
import type { DataNode } from 'ant-design-vue/es/tree';
|
||||||
|
|
||||||
export type ID = number | string;
|
export type ID = number | string;
|
||||||
export type IDS = (number | string)[];
|
export type IDS = (number | string)[];
|
||||||
|
|
||||||
@@ -42,15 +44,12 @@ export interface PageQuery {
|
|||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TreeNode<T = any> {
|
export interface TreeNode<T = any> extends DataNode {
|
||||||
level: number;
|
level: number;
|
||||||
code: T;
|
code: T;
|
||||||
ParentCode: T;
|
ParentCode: T;
|
||||||
label: string;
|
label: string;
|
||||||
children: TreeNode<T>;
|
|
||||||
|
|
||||||
title?: string;
|
|
||||||
key?:any
|
|
||||||
disabled: boolean
|
|
||||||
|
|
||||||
|
data?: [];
|
||||||
|
disabled: boolean;
|
||||||
}
|
}
|
||||||
|
74
apps/web-antd/src/api/sis/deviceChannel/index.ts
Normal file
74
apps/web-antd/src/api/sis/deviceChannel/index.ts
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
import type {
|
||||||
|
DeviceChannelForm,
|
||||||
|
DeviceChannelQuery,
|
||||||
|
DeviceChannelVO,
|
||||||
|
} from './model';
|
||||||
|
|
||||||
|
import type { ID, IDS, PageResult, TreeNode } from '#/api/common';
|
||||||
|
|
||||||
|
import { commonExport } from '#/api/helper';
|
||||||
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备通道管理列表
|
||||||
|
* @param params
|
||||||
|
* @returns 设备通道管理列表
|
||||||
|
*/
|
||||||
|
export function deviceChannelList(params?: DeviceChannelQuery) {
|
||||||
|
return requestClient.get<PageResult<DeviceChannelVO>>(
|
||||||
|
'/sis/deviceChannel/list',
|
||||||
|
{ params },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取通道树结构
|
||||||
|
*/
|
||||||
|
export function treeList() {
|
||||||
|
return requestClient.get<TreeNode[]>('/sis/deviceChannel/treeList');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备通道管理列表
|
||||||
|
* @param params
|
||||||
|
* @returns 设备通道管理列表
|
||||||
|
*/
|
||||||
|
export function deviceChannelExport(params?: DeviceChannelQuery) {
|
||||||
|
return commonExport('/sis/deviceChannel/export', params ?? {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备通道管理详情
|
||||||
|
* @param id id
|
||||||
|
* @returns 设备通道管理详情
|
||||||
|
*/
|
||||||
|
export function deviceChannelInfo(id: ID) {
|
||||||
|
return requestClient.get<DeviceChannelVO>(`/sis/deviceChannel/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备通道管理
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function deviceChannelAdd(data: DeviceChannelForm) {
|
||||||
|
return requestClient.postWithMsg<void>('/sis/deviceChannel', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备通道管理
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function deviceChannelUpdate(data: DeviceChannelForm) {
|
||||||
|
return requestClient.putWithMsg<void>('/sis/deviceChannel', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备通道管理
|
||||||
|
* @param id id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function deviceChannelRemove(id: ID | IDS) {
|
||||||
|
return requestClient.deleteWithMsg<void>(`/sis/deviceChannel/${id}`);
|
||||||
|
}
|
159
apps/web-antd/src/api/sis/deviceChannel/model.d.ts
vendored
Normal file
159
apps/web-antd/src/api/sis/deviceChannel/model.d.ts
vendored
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
|
export interface DeviceChannelVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
deviceId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
deviceName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道分组组id
|
||||||
|
*/
|
||||||
|
groupId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ip
|
||||||
|
*/
|
||||||
|
deviceIp: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备端口
|
||||||
|
*/
|
||||||
|
devicePort: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备账号
|
||||||
|
*/
|
||||||
|
deviceAccount: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备密码
|
||||||
|
*/
|
||||||
|
devicePwd: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备
|
||||||
|
*/
|
||||||
|
deviceMac: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备通道编号
|
||||||
|
*/
|
||||||
|
channelNo: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeviceChannelForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
deviceId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
deviceName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道分组组id
|
||||||
|
*/
|
||||||
|
groupId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ip
|
||||||
|
*/
|
||||||
|
deviceIp?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备端口
|
||||||
|
*/
|
||||||
|
devicePort?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备账号
|
||||||
|
*/
|
||||||
|
deviceAccount?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备密码
|
||||||
|
*/
|
||||||
|
devicePwd?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备
|
||||||
|
*/
|
||||||
|
deviceMac?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备通道编号
|
||||||
|
*/
|
||||||
|
channelNo?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeviceChannelQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
deviceId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
deviceName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道分组组id
|
||||||
|
*/
|
||||||
|
groupId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ip
|
||||||
|
*/
|
||||||
|
deviceIp?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备端口
|
||||||
|
*/
|
||||||
|
devicePort?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备账号
|
||||||
|
*/
|
||||||
|
deviceAccount?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备密码
|
||||||
|
*/
|
||||||
|
devicePwd?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备
|
||||||
|
*/
|
||||||
|
deviceMac?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备通道编号
|
||||||
|
*/
|
||||||
|
channelNo?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
61
apps/web-antd/src/api/sis/deviceGroup/index.ts
Normal file
61
apps/web-antd/src/api/sis/deviceGroup/index.ts
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import type { DeviceGroupVO, DeviceGroupForm, DeviceGroupQuery } from './model';
|
||||||
|
|
||||||
|
import type { ID, IDS } from '#/api/common';
|
||||||
|
import type { PageResult } from '#/api/common';
|
||||||
|
|
||||||
|
import { commonExport } from '#/api/helper';
|
||||||
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备组管理列表
|
||||||
|
* @param params
|
||||||
|
* @returns 设备组管理列表
|
||||||
|
*/
|
||||||
|
export function deviceGroupList(params?: DeviceGroupQuery) {
|
||||||
|
return requestClient.get<PageResult<DeviceGroupVO>>('/sis/deviceGroup/list', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备组管理列表
|
||||||
|
* @param params
|
||||||
|
* @returns 设备组管理列表
|
||||||
|
*/
|
||||||
|
export function deviceGroupExport(params?: DeviceGroupQuery) {
|
||||||
|
return commonExport('/sis/deviceGroup/export', params ?? {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备组管理详情
|
||||||
|
* @param id id
|
||||||
|
* @returns 设备组管理详情
|
||||||
|
*/
|
||||||
|
export function deviceGroupInfo(id: ID) {
|
||||||
|
return requestClient.get<DeviceGroupVO>(`/sis/deviceGroup/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备组管理
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function deviceGroupAdd(data: DeviceGroupForm) {
|
||||||
|
return requestClient.postWithMsg<void>('/sis/deviceGroup', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备组管理
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function deviceGroupUpdate(data: DeviceGroupForm) {
|
||||||
|
return requestClient.putWithMsg<void>('/sis/deviceGroup', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备组管理
|
||||||
|
* @param id id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function deviceGroupRemove(id: ID | IDS) {
|
||||||
|
return requestClient.deleteWithMsg<void>(`/sis/deviceGroup/${id}`);
|
||||||
|
}
|
64
apps/web-antd/src/api/sis/deviceGroup/model.d.ts
vendored
Normal file
64
apps/web-antd/src/api/sis/deviceGroup/model.d.ts
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
|
export interface DeviceGroupVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组名称
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父编码id(-1 表示根节点)
|
||||||
|
*/
|
||||||
|
parentId: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeviceGroupForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组名称
|
||||||
|
*/
|
||||||
|
name?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父编码id(-1 表示根节点)
|
||||||
|
*/
|
||||||
|
parentId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeviceGroupQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 分组名称
|
||||||
|
*/
|
||||||
|
name?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父编码id(-1 表示根节点)
|
||||||
|
*/
|
||||||
|
parentId?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
import type { BaseEntity, PageQuery } from '#/api/common';
|
||||||
|
|
||||||
export interface DeviceManageVO {
|
export interface DeviceManageVO {
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +80,6 @@ export interface DeviceManageVO {
|
|||||||
* 门禁id
|
* 门禁id
|
||||||
*/
|
*/
|
||||||
accessControlId: string | number;
|
accessControlId: string | number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeviceManageForm extends BaseEntity {
|
export interface DeviceManageForm extends BaseEntity {
|
||||||
@@ -128,42 +127,6 @@ export interface DeviceManageForm extends BaseEntity {
|
|||||||
* 设备在线状态 0:离线 1:在线 2:未知
|
* 设备在线状态 0:离线 1:在线 2:未知
|
||||||
*/
|
*/
|
||||||
deviceStatus?: number;
|
deviceStatus?: number;
|
||||||
|
|
||||||
/**
|
|
||||||
* 父级设备id
|
|
||||||
*/
|
|
||||||
parentId?: string | number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备通道编号
|
|
||||||
*/
|
|
||||||
channelNo?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 录像机ip
|
|
||||||
*/
|
|
||||||
vcrIp?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 录像机端口
|
|
||||||
*/
|
|
||||||
vcrPort?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 录像机账号
|
|
||||||
*/
|
|
||||||
vcrAccount?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 录像机密码
|
|
||||||
*/
|
|
||||||
vcrPwd?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 门禁id
|
|
||||||
*/
|
|
||||||
accessControlId?: string | number;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeviceManageQuery extends PageQuery {
|
export interface DeviceManageQuery extends PageQuery {
|
||||||
@@ -208,42 +171,7 @@ export interface DeviceManageQuery extends PageQuery {
|
|||||||
deviceStatus?: number;
|
deviceStatus?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父级设备id
|
* 日期范围参数
|
||||||
*/
|
*/
|
||||||
parentId?: string | number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备通道编号
|
|
||||||
*/
|
|
||||||
channelNo?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 录像机ip
|
|
||||||
*/
|
|
||||||
vcrIp?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 录像机端口
|
|
||||||
*/
|
|
||||||
vcrPort?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 录像机账号
|
|
||||||
*/
|
|
||||||
vcrAccount?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 录像机密码
|
|
||||||
*/
|
|
||||||
vcrPwd?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 门禁id
|
|
||||||
*/
|
|
||||||
accessControlId?: string | number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期范围参数
|
|
||||||
*/
|
|
||||||
params?: any;
|
params?: any;
|
||||||
}
|
}
|
||||||
|
69
apps/web-antd/src/views/sis/deviceGroup/data.ts
Normal file
69
apps/web-antd/src/views/sis/deviceGroup/data.ts
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
|
||||||
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'name',
|
||||||
|
label: '分组名称',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||||
|
export const columns: VxeGridProps['columns'] = [
|
||||||
|
{ type: 'checkbox', width: 60 },
|
||||||
|
{
|
||||||
|
title: '主键id',
|
||||||
|
field: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '分组名称',
|
||||||
|
field: 'name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '父节点',
|
||||||
|
field: 'parentId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '备注',
|
||||||
|
field: 'remark',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
slots: { default: 'action' },
|
||||||
|
title: '操作',
|
||||||
|
width: 180,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const modalSchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
label: '主键id',
|
||||||
|
fieldName: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
dependencies: {
|
||||||
|
show: () => false,
|
||||||
|
triggerFields: [''],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '分组名称',
|
||||||
|
fieldName: 'name',
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '父节点',
|
||||||
|
fieldName: 'parentId',
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '备注',
|
||||||
|
fieldName: 'remark',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
];
|
101
apps/web-antd/src/views/sis/deviceGroup/deviceGroup-modal.vue
Normal file
101
apps/web-antd/src/views/sis/deviceGroup/deviceGroup-modal.vue
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { $t } from '@vben/locales';
|
||||||
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
|
import { useVbenForm } from '#/adapter/form';
|
||||||
|
import { deviceGroupAdd, deviceGroupInfo, deviceGroupUpdate } from '#/api/sis/deviceGroup';
|
||||||
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
|
import { modalSchema } from './data';
|
||||||
|
|
||||||
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const title = computed(() => {
|
||||||
|
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||||
|
});
|
||||||
|
|
||||||
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
|
commonConfig: {
|
||||||
|
// 默认占满两列
|
||||||
|
formItemClass: 'col-span-2',
|
||||||
|
// 默认label宽度 px
|
||||||
|
labelWidth: 80,
|
||||||
|
// 通用配置项 会影响到所有表单项
|
||||||
|
componentProps: {
|
||||||
|
class: 'w-full',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
schema: modalSchema(),
|
||||||
|
showDefaultActions: false,
|
||||||
|
wrapperClass: 'grid-cols-2',
|
||||||
|
});
|
||||||
|
|
||||||
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||||
|
{
|
||||||
|
initializedGetter: defaultFormValueGetter(formApi),
|
||||||
|
currentGetter: defaultFormValueGetter(formApi),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
|
// 在这里更改宽度
|
||||||
|
class: 'w-[550px]',
|
||||||
|
fullscreenButton: false,
|
||||||
|
onBeforeClose,
|
||||||
|
onClosed: handleClosed,
|
||||||
|
onConfirm: handleConfirm,
|
||||||
|
onOpenChange: async (isOpen) => {
|
||||||
|
if (!isOpen) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
modalApi.modalLoading(true);
|
||||||
|
|
||||||
|
const { id } = modalApi.getData() as { id?: number | string };
|
||||||
|
isUpdate.value = !!id;
|
||||||
|
|
||||||
|
if (isUpdate.value && id) {
|
||||||
|
const record = await deviceGroupInfo(id);
|
||||||
|
await formApi.setValues(record);
|
||||||
|
}
|
||||||
|
await markInitialized();
|
||||||
|
|
||||||
|
modalApi.modalLoading(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
try {
|
||||||
|
modalApi.lock(true);
|
||||||
|
const { valid } = await formApi.validate();
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||||
|
const data = cloneDeep(await formApi.getValues());
|
||||||
|
await (isUpdate.value ? deviceGroupUpdate(data) : deviceGroupAdd(data));
|
||||||
|
resetInitialized();
|
||||||
|
emit('reload');
|
||||||
|
modalApi.close();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
modalApi.lock(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleClosed() {
|
||||||
|
await formApi.resetForm();
|
||||||
|
resetInitialized();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<BasicModal :title="title">
|
||||||
|
<BasicForm />
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
182
apps/web-antd/src/views/sis/deviceGroup/index.vue
Normal file
182
apps/web-antd/src/views/sis/deviceGroup/index.vue
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { Recordable } from '@vben/types';
|
||||||
|
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||||
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
import {
|
||||||
|
useVbenVxeGrid,
|
||||||
|
vxeCheckboxChecked,
|
||||||
|
type VxeGridProps
|
||||||
|
} from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import {
|
||||||
|
deviceGroupExport,
|
||||||
|
deviceGroupList,
|
||||||
|
deviceGroupRemove,
|
||||||
|
} from '#/api/sis/deviceGroup';
|
||||||
|
import type { DeviceGroupForm } from '#/api/sis/deviceGroup/model';
|
||||||
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
|
import deviceGroupModal from './deviceGroup-modal.vue';
|
||||||
|
import { columns, querySchema } from './data';
|
||||||
|
|
||||||
|
const formOptions: VbenFormProps = {
|
||||||
|
commonConfig: {
|
||||||
|
labelWidth: 80,
|
||||||
|
componentProps: {
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
schema: querySchema(),
|
||||||
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||||
|
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到
|
||||||
|
// 不需要直接删除
|
||||||
|
// fieldMappingTime: [
|
||||||
|
// [
|
||||||
|
// 'createTime',
|
||||||
|
// ['params[beginTime]', 'params[endTime]'],
|
||||||
|
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
||||||
|
// ],
|
||||||
|
// ],
|
||||||
|
};
|
||||||
|
|
||||||
|
const gridOptions: VxeGridProps = {
|
||||||
|
checkboxConfig: {
|
||||||
|
// 高亮
|
||||||
|
highlight: true,
|
||||||
|
// 翻页时保留选中状态
|
||||||
|
reserve: true,
|
||||||
|
// 点击行选中
|
||||||
|
// trigger: 'row',
|
||||||
|
},
|
||||||
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
|
// columns: columns(),
|
||||||
|
columns,
|
||||||
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
|
pagerConfig: {},
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({ page }, formValues = {}) => {
|
||||||
|
return await deviceGroupList({
|
||||||
|
pageNum: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
},
|
||||||
|
// 表格全局唯一表示 保存列配置需要用到
|
||||||
|
id: 'sis-deviceGroup-index'
|
||||||
|
};
|
||||||
|
|
||||||
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
|
formOptions,
|
||||||
|
gridOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [DeviceGroupModal, modalApi] = useVbenModal({
|
||||||
|
connectedComponent: deviceGroupModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
modalApi.setData({});
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleEdit(row: Required<DeviceGroupForm>) {
|
||||||
|
modalApi.setData({ id: row.id });
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(row: Required<DeviceGroupForm>) {
|
||||||
|
await deviceGroupRemove(row.id);
|
||||||
|
await tableApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMultiDelete() {
|
||||||
|
const rows = tableApi.grid.getCheckboxRecords();
|
||||||
|
const ids = rows.map((row: Required<DeviceGroupForm>) => row.id);
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
okType: 'danger',
|
||||||
|
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||||
|
onOk: async () => {
|
||||||
|
await deviceGroupRemove(ids);
|
||||||
|
await tableApi.query();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(deviceGroupExport, '设备组管理数据', tableApi.formApi.form.values, {
|
||||||
|
fieldMappingTime: formOptions.fieldMappingTime,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Page :auto-content-height="true">
|
||||||
|
<BasicTable table-title="设备组管理列表">
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Space>
|
||||||
|
<a-button
|
||||||
|
v-access:code="['sis:deviceGroup:export']"
|
||||||
|
@click="handleDownloadExcel"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.export') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['sis:deviceGroup:remove']"
|
||||||
|
@click="handleMultiDelete">
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['sis:deviceGroup:add']"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.add') }}
|
||||||
|
</a-button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<Space>
|
||||||
|
<ghost-button
|
||||||
|
v-access:code="['sis:deviceGroup:edit']"
|
||||||
|
@click.stop="handleEdit(row)"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.edit') }}
|
||||||
|
</ghost-button>
|
||||||
|
<Popconfirm
|
||||||
|
:get-popup-container="getVxePopupContainer"
|
||||||
|
placement="left"
|
||||||
|
title="确认删除?"
|
||||||
|
@confirm="handleDelete(row)"
|
||||||
|
>
|
||||||
|
<ghost-button
|
||||||
|
danger
|
||||||
|
v-access:code="['sis:deviceGroup:remove']"
|
||||||
|
@click.stop=""
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</ghost-button>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<DeviceGroupModal @reload="tableApi.query()" />
|
||||||
|
</Page>
|
||||||
|
</template>
|
@@ -15,6 +15,11 @@ export const querySchema: FormSchemaGetter = () => [
|
|||||||
fieldName: 'deviceIp',
|
fieldName: 'deviceIp',
|
||||||
label: '设备ip',
|
label: '设备ip',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'deviceType',
|
||||||
|
label: '设备类型',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'deviceStatus',
|
fieldName: 'deviceStatus',
|
||||||
label: '在线状态',
|
label: '在线状态',
|
||||||
@@ -34,6 +39,14 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
title: '设备名称',
|
title: '设备名称',
|
||||||
field: 'deviceName',
|
field: 'deviceName',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '厂商编号',
|
||||||
|
field: 'factoryNo',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备类型',
|
||||||
|
field: 'device_type',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '设备ip',
|
title: '设备ip',
|
||||||
field: 'deviceIp',
|
field: 'deviceIp',
|
||||||
@@ -43,30 +56,13 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
field: 'devicePort',
|
field: 'devicePort',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '设备',
|
title: '设备mac',
|
||||||
field: 'deviceMac',
|
field: 'deviceMac',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '在线状态',
|
title: '在线状态',
|
||||||
field: 'deviceStatus',
|
field: 'deviceStatus',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
title: '通道编号',
|
|
||||||
field: 'channelNo',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '录像机ip',
|
|
||||||
field: 'vcrIp',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '录像机端口',
|
|
||||||
field: 'vcrPort',
|
|
||||||
},
|
|
||||||
/*{
|
|
||||||
title: '门禁id',
|
|
||||||
field: 'accessControlId',
|
|
||||||
},*/
|
|
||||||
{
|
{
|
||||||
field: 'action',
|
field: 'action',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
@@ -92,6 +88,18 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
component: 'Input',
|
component: 'Input',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '设备厂商',
|
||||||
|
fieldName: 'facrotyNo',
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '设备类型',
|
||||||
|
fieldName: 'deviceType',
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: '设备ip',
|
label: '设备ip',
|
||||||
fieldName: 'deviceIp',
|
fieldName: 'deviceIp',
|
||||||
@@ -116,53 +124,10 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
component: 'Input',
|
component: 'Input',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: '设备Mac',
|
label: '设备Mac',
|
||||||
fieldName: 'deviceMac',
|
fieldName: 'deviceMac',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: '通道编号',
|
|
||||||
fieldName: 'channelNo',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '录像机ip',
|
|
||||||
fieldName: 'vcrIp',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '录像机端口',
|
|
||||||
fieldName: 'vcrPort',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '录像机账号',
|
|
||||||
fieldName: 'vcrAccount',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '录像机密码',
|
|
||||||
fieldName: 'vcrPwd',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
/*{
|
|
||||||
label: '绑定门禁',
|
|
||||||
fieldName: 'accessControlId',
|
|
||||||
component: 'ApiSelect',
|
|
||||||
componentProps: {
|
|
||||||
// mode: 'multiple', // 关键属性,启用多选模式
|
|
||||||
resultField: 'list', // 根据API返回结构调整
|
|
||||||
labelField: 'accessName',
|
|
||||||
valueField: 'accessCode',
|
|
||||||
api: async () => {
|
|
||||||
const params: AccessControlQuery = {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 500,
|
|
||||||
};
|
|
||||||
const res = await accessControlList(params);
|
|
||||||
return res.rows;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},*/
|
|
||||||
];
|
];
|
||||||
|
@@ -126,7 +126,7 @@ function handleDownloadExcel() {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page :auto-content-height="true">
|
<Page :auto-content-height="true">
|
||||||
<BasicTable table-title="设备管理列表">
|
<BasicTable class="flex-1 overflow-hidden" table-title="设备管理列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<Space>
|
<Space>
|
||||||
<a-button
|
<a-button
|
||||||
|
114
apps/web-antd/src/views/sis/video/channel-tree.vue
Normal file
114
apps/web-antd/src/views/sis/video/channel-tree.vue
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { PropType } from 'vue';
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
import { SyncOutlined } from '@ant-design/icons-vue';
|
||||||
|
import { InputSearch, Skeleton, Tree } from 'ant-design-vue';
|
||||||
|
import { treeList } from '#/api/sis/deviceChannel';
|
||||||
|
import type { TreeNode } from '#/api/common';
|
||||||
|
|
||||||
|
defineOptions({ inheritAttrs: false });
|
||||||
|
|
||||||
|
withDefaults(defineProps<{ showSearch?: boolean }>(), { showSearch: true });
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
/**
|
||||||
|
* 点击刷新按钮的事件
|
||||||
|
*/
|
||||||
|
reload: [];
|
||||||
|
/**
|
||||||
|
* 点击节点的事件
|
||||||
|
*/
|
||||||
|
select: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const channelId = defineModel('channelId', {
|
||||||
|
required: true,
|
||||||
|
type: Array as PropType<string[]>,
|
||||||
|
});
|
||||||
|
|
||||||
|
const searchValue = defineModel('searchValue', {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 通道数据源 */
|
||||||
|
const channelTree = ref<TreeNode[]>([]);
|
||||||
|
/** 骨架屏加载 */
|
||||||
|
const showTreeSkeleton = ref<boolean>(true);
|
||||||
|
|
||||||
|
async function loadChannelTree() {
|
||||||
|
showTreeSkeleton.value = true;
|
||||||
|
searchValue.value = '';
|
||||||
|
channelId.value = [];
|
||||||
|
const ret = await treeList();
|
||||||
|
channelTree.value = ret;
|
||||||
|
showTreeSkeleton.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleReload() {
|
||||||
|
await loadChannelTree();
|
||||||
|
emit('reload');
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(loadChannelTree);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div :class="$attrs.class">
|
||||||
|
<Skeleton
|
||||||
|
:loading="showTreeSkeleton"
|
||||||
|
:paragraph="{ rows: 8 }"
|
||||||
|
active
|
||||||
|
class="p-[8px]"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="bg-background flex h-full flex-col overflow-y-auto rounded-lg"
|
||||||
|
>
|
||||||
|
<!-- 固定在顶部 必须加上bg-background背景色 否则会产生'穿透'效果 -->
|
||||||
|
<div
|
||||||
|
v-if="showSearch"
|
||||||
|
class="bg-background z-100 sticky left-0 top-0 p-[8px]"
|
||||||
|
>
|
||||||
|
<InputSearch
|
||||||
|
v-model:value="searchValue"
|
||||||
|
:placeholder="$t('pages.common.search')"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<template #enterButton>
|
||||||
|
<a-button @click="handleReload">
|
||||||
|
<SyncOutlined class="text-primary" />
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</InputSearch>
|
||||||
|
</div>
|
||||||
|
<div class="h-full overflow-x-hidden px-[8px]">
|
||||||
|
<Tree
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-if="channelTree.length > 0"
|
||||||
|
v-model:selected-keys="channelId"
|
||||||
|
:class="$attrs.class"
|
||||||
|
:field-names="{ title: 'label', key: 'id' }"
|
||||||
|
:show-line="{ showLeafIcon: false }"
|
||||||
|
:tree-data="channelTree"
|
||||||
|
:virtual="false"
|
||||||
|
default-expand-all
|
||||||
|
@select="$emit('select')"
|
||||||
|
>
|
||||||
|
<template #title="{ label }">
|
||||||
|
<span v-if="label.indexOf(searchValue) > -1">
|
||||||
|
{{ label.substring(0, label.indexOf(searchValue)) }}
|
||||||
|
<span style="color: #f50">{{ searchValue }}</span>
|
||||||
|
{{
|
||||||
|
label.substring(
|
||||||
|
label.indexOf(searchValue) + searchValue.length,
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
<span v-else>{{ label }}</span>
|
||||||
|
</template>
|
||||||
|
</Tree>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Skeleton>
|
||||||
|
</div>
|
||||||
|
</template>
|
0
apps/web-antd/src/views/sis/video/data.ts
Normal file
0
apps/web-antd/src/views/sis/video/data.ts
Normal file
37
apps/web-antd/src/views/sis/video/index.vue
Normal file
37
apps/web-antd/src/views/sis/video/index.vue
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<Page class="h-full w-full">
|
||||||
|
<!-- 设备分组区域 -->
|
||||||
|
<div class="flex h-full gap-[8px]">
|
||||||
|
<ChannelTree v-model:channel-id="channelId" class="w-[260px]" />
|
||||||
|
|
||||||
|
<!-- 设备分组区域 -->
|
||||||
|
<div class="bg-background flex-1">
|
||||||
|
<div class="video-play-area h-[calc(100%-40px)]">
|
||||||
|
<div
|
||||||
|
v-for="i in playerNum"
|
||||||
|
class="player"
|
||||||
|
:class="'player-' + i"
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
<div class="player-area h-[40px]">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Page>
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { Page } from '@vben/common-ui';
|
||||||
|
import ChannelTree from './channel-tree.vue';
|
||||||
|
|
||||||
|
const channelId = ref("");
|
||||||
|
/**
|
||||||
|
* 屏幕播放器数量
|
||||||
|
*/
|
||||||
|
const playerNum = ref(1);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
Reference in New Issue
Block a user