授权逻辑更改
This commit is contained in:
parent
332d8eccba
commit
195d7fff7d
@ -1,78 +0,0 @@
|
||||
import type {
|
||||
AccessControlDeviceForm,
|
||||
AccessControlDeviceQuery,
|
||||
AccessControlDeviceVO,
|
||||
} from './model';
|
||||
|
||||
import type { ID, IDS, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询门禁设备列表
|
||||
* @param params
|
||||
* @returns 门禁设备列表
|
||||
*/
|
||||
export function accessControlDeviceList(params?: AccessControlDeviceQuery) {
|
||||
return requestClient.get<PageResult<AccessControlDeviceVO>>(
|
||||
'/sis/accessControlDevice/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据厂商编号查询设备列表
|
||||
* @param params
|
||||
* @returns 门禁设备列表
|
||||
*/
|
||||
export function queryListByFactoryNo(factory: string) {
|
||||
return requestClient.get<AccessControlDeviceVO[]>(`/sis/accessControlDevice/list/${factory}`,);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出门禁设备列表
|
||||
* @param params
|
||||
* @returns 门禁设备列表
|
||||
*/
|
||||
export function accessControlDeviceExport(params?: AccessControlDeviceQuery) {
|
||||
return commonExport('/sis/accessControlDevice/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询门禁设备详情
|
||||
* @param id id
|
||||
* @returns 门禁设备详情
|
||||
*/
|
||||
export function accessControlDeviceInfo(id: ID) {
|
||||
return requestClient.get<AccessControlDeviceVO>(
|
||||
`/sis/accessControlDevice/${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增门禁设备
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function accessControlDeviceAdd(data: AccessControlDeviceForm) {
|
||||
return requestClient.postWithMsg<void>('/sis/accessControlDevice', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新门禁设备
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function accessControlDeviceUpdate(data: AccessControlDeviceForm) {
|
||||
return requestClient.putWithMsg<void>('/sis/accessControlDevice', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除门禁设备
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function accessControlDeviceRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/sis/accessControlDevice/${id}`);
|
||||
}
|
@ -1,202 +0,0 @@
|
||||
import type { BaseEntity, PageQuery } from '#/api/common';
|
||||
|
||||
export interface AccessControlDeviceVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id: number | string;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
eqpNo: string;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
eqpName: string;
|
||||
|
||||
/**
|
||||
* 厂商编码
|
||||
*/
|
||||
factoryNo: string;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
eqpType: number;
|
||||
|
||||
/**
|
||||
* 接入类型(1: 平台接入,2:设备接入)
|
||||
*/
|
||||
accessType: number;
|
||||
|
||||
/**
|
||||
* 设备ip
|
||||
*/
|
||||
eqpIp: string;
|
||||
|
||||
/**
|
||||
* 设备端口
|
||||
*/
|
||||
eqpPort: number;
|
||||
|
||||
/**
|
||||
* 设备账号
|
||||
*/
|
||||
eqpAccount: string;
|
||||
|
||||
/**
|
||||
* 设备密码
|
||||
*/
|
||||
eqpPwd: string;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById: number | string;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById: number | string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue: string;
|
||||
}
|
||||
|
||||
export interface AccessControlDeviceForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: number | string;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
eqpNo?: string;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
eqpName?: string;
|
||||
|
||||
/**
|
||||
* 厂商编码
|
||||
*/
|
||||
factoryNo?: string;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
eqpType?: number;
|
||||
|
||||
/**
|
||||
* 接入类型(1: 平台接入,2:设备接入)
|
||||
*/
|
||||
accessType?: number;
|
||||
|
||||
/**
|
||||
* 设备ip
|
||||
*/
|
||||
eqpIp?: string;
|
||||
|
||||
/**
|
||||
* 设备端口
|
||||
*/
|
||||
eqpPort?: number;
|
||||
|
||||
/**
|
||||
* 设备账号
|
||||
*/
|
||||
eqpAccount?: string;
|
||||
|
||||
/**
|
||||
* 设备密码
|
||||
*/
|
||||
eqpPwd?: string;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById?: number | string;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById?: number | string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
}
|
||||
|
||||
export interface AccessControlDeviceQuery extends PageQuery {
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
eqpNo?: string;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
eqpName?: string;
|
||||
|
||||
/**
|
||||
* 厂商编码
|
||||
*/
|
||||
factoryNo?: string;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
eqpType?: number;
|
||||
|
||||
/**
|
||||
* 接入类型(1: 平台接入,2:设备接入)
|
||||
*/
|
||||
accessType?: number;
|
||||
|
||||
/**
|
||||
* 设备ip
|
||||
*/
|
||||
eqpIp?: string;
|
||||
|
||||
/**
|
||||
* 设备端口
|
||||
*/
|
||||
eqpPort?: number;
|
||||
|
||||
/**
|
||||
* 设备账号
|
||||
*/
|
||||
eqpAccount?: string;
|
||||
|
||||
/**
|
||||
* 设备密码
|
||||
*/
|
||||
eqpPwd?: string;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById?: number | string;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById?: number | string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
@ -1,18 +1,19 @@
|
||||
import type { AuthRecordVO, AuthRecordForm, AuthRecordQuery } from './model';
|
||||
import type { AuthRecordForm, AuthRecordQuery, AuthRecordVO } from './model';
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
import type { PageResult } from '#/api/common';
|
||||
import type { ID, IDS, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询授权记录列表
|
||||
* @param params
|
||||
* @returns 授权记录列表
|
||||
*/
|
||||
* 查询授权记录列表
|
||||
* @param params
|
||||
* @returns 授权记录列表
|
||||
*/
|
||||
export function authRecordList(params?: AuthRecordQuery) {
|
||||
return requestClient.get<PageResult<AuthRecordVO>>('/sis/authRecord/list', { params });
|
||||
return requestClient.get<PageResult<AuthRecordVO>>('/sis/authRecord/list', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,3 +60,15 @@ export function authRecordUpdate(data: AuthRecordForm) {
|
||||
export function authRecordRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/sis/authRecord/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对人员库进行授权
|
||||
* @param params id
|
||||
*/
|
||||
export function authPersonLib(params: any) {
|
||||
return requestClient.postWithMsg<void>(`/sis/authRecord/authLib`, params);
|
||||
}
|
||||
|
||||
export function queryAuthDevice(id: ID) {
|
||||
return requestClient.get<AuthRecordVO[]>(`/sis/authRecord/authDevice/${id}`);
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ export interface AuthRecordVO {
|
||||
* 门禁id
|
||||
*/
|
||||
acdId: string | number;
|
||||
|
||||
deviceId: string | number;
|
||||
}
|
||||
|
||||
export interface AuthRecordForm extends BaseEntity {
|
||||
|
@ -1,18 +1,24 @@
|
||||
import type { DeviceManageVO, DeviceManageForm, DeviceManageQuery } from './model';
|
||||
import type {
|
||||
DeviceManageForm,
|
||||
DeviceManageQuery,
|
||||
DeviceManageVO,
|
||||
} from './model';
|
||||
|
||||
import type { ID, IDS } from '#/api/common';
|
||||
import type { PageResult } from '#/api/common';
|
||||
import type { ID, IDS, PageResult, TreeNode } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询设备管理列表
|
||||
* @param params
|
||||
* @returns 设备管理列表
|
||||
*/
|
||||
* 查询设备管理列表
|
||||
* @param params
|
||||
* @returns 设备管理列表
|
||||
*/
|
||||
export function deviceManageList(params?: DeviceManageQuery) {
|
||||
return requestClient.get<PageResult<DeviceManageVO>>('/sis/deviceManage/list', { params });
|
||||
return requestClient.get<PageResult<DeviceManageVO>>(
|
||||
'/sis/deviceManage/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,3 +65,11 @@ export function deviceManageUpdate(data: DeviceManageForm) {
|
||||
export function deviceManageRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/sis/deviceManage/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询门禁书
|
||||
* @returns void
|
||||
*/
|
||||
export function queryTree() {
|
||||
return requestClient.get<TreeNode<Number>[]>(`/sis/deviceManage/tree`);
|
||||
}
|
||||
|
@ -1,62 +0,0 @@
|
||||
import type { DevicePointForm, DevicePointQuery, DevicePointVO } from './model';
|
||||
|
||||
import type { ID, IDS, PageResult } from '#/api/common';
|
||||
|
||||
import { commonExport } from '#/api/helper';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 查询宇视设备点位(通道)列表
|
||||
* @param params
|
||||
* @returns 宇视设备点位(通道)列表
|
||||
*/
|
||||
export function devicePointList(params?: DevicePointQuery) {
|
||||
return requestClient.get<PageResult<DevicePointVO>>('/sis/devicePoint/list', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出宇视设备点位(通道)列表
|
||||
* @param params
|
||||
* @returns 宇视设备点位(通道)列表
|
||||
*/
|
||||
export function devicePointExport(params?: DevicePointQuery) {
|
||||
return commonExport('/sis/devicePoint/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询宇视设备点位(通道)详情
|
||||
* @param id id
|
||||
* @returns 宇视设备点位(通道)详情
|
||||
*/
|
||||
export function devicePointInfo(id: ID) {
|
||||
return requestClient.get<DevicePointVO>(`/sis/devicePoint/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增宇视设备点位(通道)
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function devicePointAdd(data: DevicePointForm) {
|
||||
return requestClient.postWithMsg<void>('/sis/devicePoint', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新宇视设备点位(通道)
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function devicePointUpdate(data: DevicePointForm) {
|
||||
return requestClient.putWithMsg<void>('/sis/devicePoint', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除宇视设备点位(通道)
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function devicePointRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/sis/devicePoint/${id}`);
|
||||
}
|
259
apps/web-antd/src/api/sis/devicePoint/model.d.ts
vendored
259
apps/web-antd/src/api/sis/devicePoint/model.d.ts
vendored
@ -1,259 +0,0 @@
|
||||
import type { BaseEntity, PageQuery } from '#/api/common';
|
||||
|
||||
export interface DevicePointVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id: number | string;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
eqpCode: string;
|
||||
|
||||
/**
|
||||
* 视频协议 1:onvif 2:
|
||||
rtsp
|
||||
*/
|
||||
video: number | string;
|
||||
|
||||
/**
|
||||
* 传输协议(AIBOX 需要,一
|
||||
体机不需要) 1: tcp 2:
|
||||
udp
|
||||
*/
|
||||
transportType: number;
|
||||
|
||||
/**
|
||||
* 点位名称
|
||||
*/
|
||||
channelName: string;
|
||||
|
||||
/**
|
||||
* rtsp 地址(当视频协议为
|
||||
rtsp 时,该字段必填)
|
||||
*/
|
||||
rtspAddr: string;
|
||||
|
||||
/**
|
||||
* 点位名称
|
||||
*/
|
||||
ip: string;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
port: number;
|
||||
|
||||
/**
|
||||
* 通道相机账号
|
||||
*/
|
||||
username: string;
|
||||
|
||||
/**
|
||||
* 相机密码
|
||||
*/
|
||||
pwd: string;
|
||||
|
||||
/**
|
||||
* onvif 设备码流添加方
|
||||
式:1:主码流 2:自定
|
||||
义码流
|
||||
*/
|
||||
videoType: number | string;
|
||||
|
||||
/**
|
||||
* 码流 id:当选择自定义码
|
||||
流时,该字段必填,值为
|
||||
获取设备码流信息接口返
|
||||
回的码流 id
|
||||
*/
|
||||
videoId: number | string;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById: number | string;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById: number | string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue: string;
|
||||
}
|
||||
|
||||
export interface DevicePointForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: number | string;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
eqpCode?: string;
|
||||
|
||||
/**
|
||||
* 视频协议 1:onvif 2:
|
||||
rtsp
|
||||
*/
|
||||
video?: number | string;
|
||||
|
||||
/**
|
||||
* 传输协议(AIBOX 需要,一
|
||||
体机不需要) 1: tcp 2:
|
||||
udp
|
||||
*/
|
||||
transportType?: number;
|
||||
|
||||
/**
|
||||
* 点位名称
|
||||
*/
|
||||
channelName?: string;
|
||||
|
||||
/**
|
||||
* rtsp 地址(当视频协议为
|
||||
rtsp 时,该字段必填)
|
||||
*/
|
||||
rtspAddr?: string;
|
||||
|
||||
/**
|
||||
* 点位名称
|
||||
*/
|
||||
ip?: string;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* 通道相机账号
|
||||
*/
|
||||
username?: string;
|
||||
|
||||
/**
|
||||
* 相机密码
|
||||
*/
|
||||
pwd?: string;
|
||||
|
||||
/**
|
||||
* onvif 设备码流添加方
|
||||
式:1:主码流 2:自定
|
||||
义码流
|
||||
*/
|
||||
videoType?: number | string;
|
||||
|
||||
/**
|
||||
* 码流 id:当选择自定义码
|
||||
流时,该字段必填,值为
|
||||
获取设备码流信息接口返
|
||||
回的码流 id
|
||||
*/
|
||||
videoId?: number | string;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById?: number | string;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById?: number | string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
}
|
||||
|
||||
export interface DevicePointQuery extends PageQuery {
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
eqpCode?: string;
|
||||
|
||||
/**
|
||||
* 视频协议 1:onvif 2:
|
||||
rtsp
|
||||
*/
|
||||
video?: number | string;
|
||||
|
||||
/**
|
||||
* 传输协议(AIBOX 需要,一
|
||||
体机不需要) 1: tcp 2:
|
||||
udp
|
||||
*/
|
||||
transportType?: number;
|
||||
|
||||
/**
|
||||
* 点位名称
|
||||
*/
|
||||
channelName?: string;
|
||||
|
||||
/**
|
||||
* rtsp 地址(当视频协议为
|
||||
rtsp 时,该字段必填)
|
||||
*/
|
||||
rtspAddr?: string;
|
||||
|
||||
/**
|
||||
* 点位名称
|
||||
*/
|
||||
ip?: string;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* 通道相机账号
|
||||
*/
|
||||
username?: string;
|
||||
|
||||
/**
|
||||
* 相机密码
|
||||
*/
|
||||
pwd?: string;
|
||||
|
||||
/**
|
||||
* onvif 设备码流添加方
|
||||
式:1:主码流 2:自定
|
||||
义码流
|
||||
*/
|
||||
videoType?: number | string;
|
||||
|
||||
/**
|
||||
* 码流 id:当选择自定义码
|
||||
流时,该字段必填,值为
|
||||
获取设备码流信息接口返
|
||||
回的码流 id
|
||||
*/
|
||||
videoId?: number | string;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
createById?: number | string;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
updateById?: number | string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
@ -27,7 +27,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
labelWidth: 120,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
|
@ -143,9 +143,10 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
label: '绑定设备',
|
||||
fieldName: 'bindDeviceIp',
|
||||
fieldName: 'bindDeviceId',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
resultField: 'list', // 根据API返回结构调整
|
||||
labelField: 'deviceName',
|
||||
valueField: 'id',
|
||||
|
@ -1,106 +0,0 @@
|
||||
<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 {
|
||||
accessControlDeviceAdd,
|
||||
accessControlDeviceInfo,
|
||||
accessControlDeviceUpdate,
|
||||
} from '#/api/sis/accessControlDevice';
|
||||
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-1',
|
||||
// 默认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-[60%]',
|
||||
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 accessControlDeviceInfo(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
|
||||
? accessControlDeviceUpdate(data)
|
||||
: accessControlDeviceAdd(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>
|
@ -1,117 +0,0 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { DictEnum } from '@vben/constants';
|
||||
import { getPopupContainer } from '@vben/utils';
|
||||
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'eqpName',
|
||||
label: '设备名称',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.SIS_ACCESS_CONTROL_DEVICE_TYPE),
|
||||
},
|
||||
fieldName: 'factoryNo',
|
||||
label: '设备厂商',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '设备编码',
|
||||
field: 'eqpNo',
|
||||
},
|
||||
{
|
||||
title: '设备名称',
|
||||
field: 'eqpName',
|
||||
},
|
||||
{
|
||||
title: '设备厂商',
|
||||
field: 'factoryName',
|
||||
},
|
||||
|
||||
{
|
||||
title: '设备ip',
|
||||
field: 'eqpIp',
|
||||
},
|
||||
{
|
||||
title: '设备端口',
|
||||
field: 'eqpPort',
|
||||
},
|
||||
{
|
||||
title: '设备账号',
|
||||
field: 'eqpAccount',
|
||||
},
|
||||
{
|
||||
title: '设备密码',
|
||||
field: 'eqpPwd',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '设备名称',
|
||||
fieldName: 'eqpName',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '设备厂商',
|
||||
fieldName: 'factoryNo',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.SIS_ACCESS_CONTROL_DEVICE_TYPE),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '设备ip',
|
||||
fieldName: 'eqpIp',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '设备端口',
|
||||
fieldName: 'eqpPort',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '设备账号',
|
||||
fieldName: 'eqpAccount',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '设备密码',
|
||||
fieldName: 'eqpPwd',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
];
|
@ -1,182 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '@vben/common-ui';
|
||||
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { AccessControlDeviceForm } from '#/api/sis/accessControlDevice/model';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
|
||||
import {
|
||||
accessControlDeviceExport,
|
||||
accessControlDeviceList,
|
||||
accessControlDeviceRemove,
|
||||
} from '#/api/sis/accessControlDevice';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import accessControlDeviceModal from './accessControlDevice-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 accessControlDeviceList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'sis-accessControlDevice-index',
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [AccessControlDeviceModal, modalApi] = useVbenModal({
|
||||
connectedComponent: accessControlDeviceModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<AccessControlDeviceForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<AccessControlDeviceForm>) {
|
||||
await accessControlDeviceRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<AccessControlDeviceForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await accessControlDeviceRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(
|
||||
accessControlDeviceExport,
|
||||
'门禁设备数据',
|
||||
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:accessControlDevice:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['sis:accessControlDevice:remove']"
|
||||
@click="handleMultiDelete"
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['sis:accessControlDevice:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['sis:accessControlDevice: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:accessControlDevice:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<AccessControlDeviceModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
@ -23,7 +23,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
labelWidth: 120,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
|
@ -1,236 +0,0 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'eqpCode',
|
||||
label: '设备编码',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'video',
|
||||
label: '视频协议',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
fieldName: 'transportType',
|
||||
label: '传输协议',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'channelName',
|
||||
label: '点位名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'rtspAddr',
|
||||
label: 'rtsp 地址',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'ip',
|
||||
label: '点位名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'port',
|
||||
label: '端口',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'username',
|
||||
label: '通道相机账号',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'pwd',
|
||||
label: '相机密码',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
fieldName: 'videoType',
|
||||
label: '码流',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'videoId',
|
||||
label: '码流id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'createById',
|
||||
label: '创建人id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'updateById',
|
||||
label: '更新人id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'searchValue',
|
||||
label: '搜索值',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '主键id',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '设备编码',
|
||||
field: 'eqpCode',
|
||||
},
|
||||
{
|
||||
title: '视频协议',
|
||||
},
|
||||
{
|
||||
title: '传输协议',
|
||||
field: 'transportType',
|
||||
},
|
||||
{
|
||||
title: '点位名称',
|
||||
field: 'channelName',
|
||||
},
|
||||
{
|
||||
title: 'rtsp 地址',
|
||||
field: 'rtspAddr',
|
||||
},
|
||||
{
|
||||
title: '点位名称',
|
||||
field: 'ip',
|
||||
},
|
||||
{
|
||||
title: '端口',
|
||||
field: 'port',
|
||||
},
|
||||
{
|
||||
title: '通道相机账号',
|
||||
field: 'username',
|
||||
},
|
||||
{
|
||||
title: '相机密码',
|
||||
field: 'pwd',
|
||||
},
|
||||
{
|
||||
title: '设备码流',
|
||||
field: 'videoType',
|
||||
},
|
||||
{
|
||||
title: '码流id',
|
||||
field: 'videoId',
|
||||
},
|
||||
{
|
||||
title: '创建人id',
|
||||
field: 'createById',
|
||||
},
|
||||
{
|
||||
title: '更新人id',
|
||||
field: 'updateById',
|
||||
},
|
||||
{
|
||||
title: '搜索值',
|
||||
field: 'searchValue',
|
||||
},
|
||||
{
|
||||
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: 'eqpCode',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '视频协议',
|
||||
fieldName: 'video',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '传输协议',
|
||||
fieldName: 'transportType',
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
label: '点位名称',
|
||||
fieldName: 'channelName',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: 'rtsp 地址',
|
||||
fieldName: 'rtspAddr',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '点位名称',
|
||||
fieldName: 'ip',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '端口',
|
||||
fieldName: 'port',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '通道相机账号',
|
||||
fieldName: 'username',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '相机密码',
|
||||
fieldName: 'pwd',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '设备码流',
|
||||
fieldName: 'videoType',
|
||||
component: 'Select',
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
label: '码流id',
|
||||
fieldName: 'videoId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '创建人id',
|
||||
fieldName: 'createById',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '更新人id',
|
||||
fieldName: 'updateById',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '搜索值',
|
||||
fieldName: 'searchValue',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
@ -1,104 +0,0 @@
|
||||
<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 {
|
||||
devicePointAdd,
|
||||
devicePointInfo,
|
||||
devicePointUpdate,
|
||||
} from '#/api/sis/devicePoint';
|
||||
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 devicePointInfo(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 ? devicePointUpdate(data) : devicePointAdd(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>
|
@ -1,182 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '@vben/common-ui';
|
||||
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { DevicePointForm } from '#/api/sis/devicePoint/model';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
|
||||
import {
|
||||
devicePointExport,
|
||||
devicePointList,
|
||||
devicePointRemove,
|
||||
} from '#/api/sis/devicePoint';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import { columns, querySchema } from './data';
|
||||
import devicePointModal from './devicePoint-modal.vue';
|
||||
|
||||
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 devicePointList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'sis-devicePoint-index',
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [DevicePointModal, modalApi] = useVbenModal({
|
||||
connectedComponent: devicePointModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<DevicePointForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<DevicePointForm>) {
|
||||
await devicePointRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<DevicePointForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await devicePointRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(
|
||||
devicePointExport,
|
||||
'宇视设备点位(通道)数据',
|
||||
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:devicePoint:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['sis:devicePoint:remove']"
|
||||
@click="handleMultiDelete"
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['sis:devicePoint:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['sis:devicePoint: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:devicePoint:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<DevicePointModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
@ -1,5 +1,7 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import type { DeviceManageQuery } from '#/api/sis/deviceManage/model';
|
||||
import { deviceManageList } from '#/api/sis/deviceManage';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
@ -58,18 +60,6 @@ export const columns: VxeGridProps['columns'] = [
|
||||
title: '维保公司',
|
||||
field: 'maintenanceCompany',
|
||||
},
|
||||
/*{
|
||||
title: '维保电话',
|
||||
field: 'maintenancePhone',
|
||||
},
|
||||
{
|
||||
title: '上次年检日期',
|
||||
field: 'lastInspectionDate',
|
||||
},
|
||||
{
|
||||
title: '下次年检日期',
|
||||
field: 'nextInspectionDate',
|
||||
},*/
|
||||
{
|
||||
title: '梯控厂商',
|
||||
field: 'controlFactory',
|
||||
@ -173,31 +163,6 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
fieldName: 'maintenanceCompany',
|
||||
component: 'Input',
|
||||
},
|
||||
/* {
|
||||
label: '维保电话',
|
||||
fieldName: 'maintenancePhone',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '上次年检日期',
|
||||
fieldName: 'lastInspectionDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '下次年检日期',
|
||||
fieldName: 'nextInspectionDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},*/
|
||||
{
|
||||
label: '梯控厂商',
|
||||
fieldName: 'controlFactory',
|
||||
@ -228,4 +193,18 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
fieldName: 'remoteCallElevatorDeviceId',
|
||||
defaultValue: undefined,
|
||||
label: '呼梯摄像头',
|
||||
},
|
||||
|
||||
{
|
||||
component: 'Select',
|
||||
fieldName: 'elevatorControlDeviceId',
|
||||
defaultValue: undefined,
|
||||
label: '梯控摄像头',
|
||||
|
||||
},
|
||||
];
|
||||
|
@ -6,11 +6,17 @@ import { $t } from '@vben/locales';
|
||||
import { cloneDeep, getPopupContainer, handleNode } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { elevatorInfoAdd, elevatorInfoInfo, elevatorInfoUpdate } from '#/api/sis/elevatorInfo';
|
||||
import {
|
||||
elevatorInfoAdd,
|
||||
elevatorInfoInfo,
|
||||
elevatorInfoUpdate,
|
||||
} from '#/api/sis/elevatorInfo';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
import type { DeviceManageForm, DeviceManageQuery } from '#/api/sis/deviceManage/model';
|
||||
import { deviceManageList } from '#/api/sis/deviceManage';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@ -24,11 +30,11 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 100,
|
||||
labelWidth: 200,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
@ -54,7 +60,10 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
setupCommunitySelect()
|
||||
// 加载社区树
|
||||
setupCommunitySelect();
|
||||
// 加载未绑定的设备
|
||||
loadDeviceList();
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
@ -88,6 +97,56 @@ async function handleConfirm() {
|
||||
}
|
||||
}
|
||||
|
||||
let rows: any = [];
|
||||
|
||||
async function loadDeviceList() {
|
||||
if (rows.length === 0) {
|
||||
const params: DeviceManageQuery = {
|
||||
pageNum: 1,
|
||||
pageSize: 500,
|
||||
};
|
||||
const res = await deviceManageList(params);
|
||||
if (res && res.rows && res.rows.length > 0) {
|
||||
rows = res.rows;
|
||||
}
|
||||
}
|
||||
const arr = rows.map((item: DeviceManageForm) => {
|
||||
return {
|
||||
label: item.deviceName,
|
||||
value: item.id,
|
||||
deviceIp: item.deviceIp,
|
||||
deviceId: item.id,
|
||||
};
|
||||
});
|
||||
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
options: arr,
|
||||
mode: 'multiple', // 关键属性,启用多选模式
|
||||
onChange: async (value: string, option: any) => {
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
data.remoteCallElevatorDeviceId = option;
|
||||
formApi.setValues(data);
|
||||
},
|
||||
}),
|
||||
fieldName: 'remoteCallElevatorDeviceId',
|
||||
},
|
||||
{
|
||||
componentProps: () => ({
|
||||
options: arr,
|
||||
allowClear: true,
|
||||
onChange: async (value: string, option: any) => {
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
data.elevatorControlDeviceId = option;
|
||||
formApi.setValues(data);
|
||||
},
|
||||
}),
|
||||
fieldName: 'elevatorControlDeviceId',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化城市
|
||||
*/
|
||||
@ -127,7 +186,6 @@ async function setupCommunitySelect() {
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
@ -139,4 +197,3 @@ async function handleClosed() {
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@ -1,12 +1,6 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { DictEnum } from '@vben/constants';
|
||||
import { getPopupContainer } from '@vben/utils';
|
||||
|
||||
import { queryListByFactoryNo } from '#/api/sis/accessControlDevice';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
@ -58,32 +52,8 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '人员库描述',
|
||||
label: '描述',
|
||||
fieldName: 'libDesc',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '库类型',
|
||||
fieldName: 'libType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.SIS_LIB_TYPE),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '设备',
|
||||
fieldName: 'eqpIds',
|
||||
component: 'ApiSelect',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
mode: 'multiple', // 关键属性,启用多选模式
|
||||
resultField: 'list', // 根据API返回结构调整
|
||||
labelField: 'eqpName',
|
||||
valueField: 'id',
|
||||
api: async () => {
|
||||
return await queryListByFactoryNo('2');
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@ -1,15 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '@vben/common-ui';
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
|
||||
import type { PersonLibForm } from '#/api/sis/personLib/model';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
|
||||
import {
|
||||
personLibExport,
|
||||
personLibList,
|
||||
@ -19,6 +17,7 @@ import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import { columns, querySchema } from './data';
|
||||
import personLibModal from './personLib-modal.vue';
|
||||
import libAuthModal from '#/views/sis/personLib/libAuth-modal.vue';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
@ -82,6 +81,10 @@ const [PersonLibModal, modalApi] = useVbenModal({
|
||||
connectedComponent: personLibModal,
|
||||
});
|
||||
|
||||
const [LibAuthModal, libAuthModalApi] = useVbenModal({
|
||||
connectedComponent: libAuthModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
@ -121,6 +124,11 @@ function handleDownloadExcel() {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
function handleAuth(row: Required<PersonLibForm>) {
|
||||
libAuthModalApi.setData({ id: row.id });
|
||||
libAuthModalApi.open();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -154,6 +162,8 @@ function handleDownloadExcel() {
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button @click.stop="handleAuth(row)"> 授权</ghost-button>
|
||||
|
||||
<ghost-button
|
||||
v-access:code="['sis:personLib:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
@ -183,5 +193,6 @@ function handleDownloadExcel() {
|
||||
</template>
|
||||
</BasicTable>
|
||||
<PersonLibModal @reload="tableApi.query()" />
|
||||
<LibAuthModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
||||
|
95
apps/web-antd/src/views/sis/personLib/libAuth-modal.vue
Normal file
95
apps/web-antd/src/views/sis/personLib/libAuth-modal.vue
Normal file
@ -0,0 +1,95 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { useBeforeCloseDiff } from '#/utils/popup';
|
||||
import { message, Tree } from 'ant-design-vue';
|
||||
import { queryTree } from '#/api/sis/deviceManage';
|
||||
import { authPersonLib, queryAuthDevice } from '#/api/sis/authRecord';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
const title = ref('门禁授权');
|
||||
const { onBeforeClose } = useBeforeCloseDiff({});
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[700px]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
const { id } = modalApi.getData();
|
||||
queryAuthDevice(id).then((res = []) => {
|
||||
const arr: any[] = [];
|
||||
res.forEach((item) => {
|
||||
arr.push(item.deviceId);
|
||||
checkedKeys.value = arr;
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { id } = modalApi.getData();
|
||||
const arr = checkedKeys.value;
|
||||
if (!arr || arr.length == 0) {
|
||||
message.error('请选择授权设备');
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
libId: id,
|
||||
deviceIds: arr,
|
||||
};
|
||||
authPersonLib(params);
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
|
||||
function handleClosed() {
|
||||
// await formApi.resetForm();
|
||||
// resetInitialized();
|
||||
}
|
||||
|
||||
const checkedKeys = ref<any[]>([]);
|
||||
const treeData = ref([]);
|
||||
|
||||
const fieldNames = {
|
||||
title: 'label',
|
||||
key: 'code',
|
||||
children: 'children',
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadDeviceTree();
|
||||
});
|
||||
|
||||
function loadDeviceTree() {
|
||||
queryTree().then((data: any) => {
|
||||
treeData.value = data;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<div class="p-4">
|
||||
<Tree
|
||||
defaultExpandAll
|
||||
:fieldNames="fieldNames"
|
||||
v-model:checkedKeys="checkedKeys"
|
||||
checkable
|
||||
:tree-data="treeData"
|
||||
>
|
||||
</Tree>
|
||||
</div>
|
||||
</BasicModal>
|
||||
</template>
|
@ -7,7 +7,6 @@ import { getPopupContainer } from '@vben/utils';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { personLibList } from '#/api/sis/personLib';
|
||||
import type { PersonLibQuery, PersonLibVO } from '#/api/sis/personLib/model';
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
let libArr: PersonLibVO[] = [];
|
||||
const labelText: VbenFormSchema = {
|
||||
@ -16,7 +15,7 @@ const labelText: VbenFormSchema = {
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
resultField: 'list', // 根据API返回结构调整
|
||||
labelField: 'labelText',
|
||||
labelField: 'libName',
|
||||
valueField: 'id',
|
||||
// immediate: true,
|
||||
api: async () => {
|
||||
@ -26,19 +25,6 @@ const labelText: VbenFormSchema = {
|
||||
pageSize: 500,
|
||||
};
|
||||
const res = await personLibList(params);
|
||||
res.rows.forEach((item) => {
|
||||
let tag =
|
||||
item.libType == 1 ? (
|
||||
<Tag color="#108ee9">人像库</Tag>
|
||||
) : (
|
||||
<Tag color="#2db7f5">工服库</Tag>
|
||||
);
|
||||
item.labelText = (
|
||||
<span>
|
||||
{item.libName} {tag}
|
||||
</span>
|
||||
);
|
||||
});
|
||||
libArr = res.rows;
|
||||
}
|
||||
return libArr;
|
||||
|
@ -27,7 +27,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
labelWidth: 100,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
|
@ -28,7 +28,7 @@ export default defineConfig(async () => {
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
// mock代理目标地址
|
||||
// target: 'http://192.168.43.169:8080',
|
||||
target: 'http://192.168.110.207:8080',
|
||||
target: 'http://127.0.0.1:8080',
|
||||
// target: 'http://192.168.0.108:8080',
|
||||
// target: 'http://192.168.0.106:8080',
|
||||
// target: 'http://47.109.37.87:3010',
|
||||
|
Loading…
Reference in New Issue
Block a user