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:
61
apps/web-antd/src/api/property/meter/index.ts
Normal file
61
apps/web-antd/src/api/property/meter/index.ts
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import type { MeterVO, MeterForm, MeterQuery } 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 meterList(params?: MeterQuery) {
|
||||||
|
return requestClient.get<PageResult<MeterVO>>('/property/meter/list', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出水电气列表
|
||||||
|
* @param params
|
||||||
|
* @returns 水电气列表
|
||||||
|
*/
|
||||||
|
export function meterExport(params?: MeterQuery) {
|
||||||
|
return commonExport('/property/meter/export', params ?? {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询水电气详情
|
||||||
|
* @param id id
|
||||||
|
* @returns 水电气详情
|
||||||
|
*/
|
||||||
|
export function meterInfo(id: ID) {
|
||||||
|
return requestClient.get<MeterVO>(`/property/meter/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增水电气
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function meterAdd(data: MeterForm) {
|
||||||
|
return requestClient.postWithMsg<void>('/property/meter', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新水电气
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function meterUpdate(data: MeterForm) {
|
||||||
|
return requestClient.putWithMsg<void>('/property/meter', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除水电气
|
||||||
|
* @param id id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function meterRemove(id: ID | IDS) {
|
||||||
|
return requestClient.deleteWithMsg<void>(`/property/meter/${id}`);
|
||||||
|
}
|
229
apps/web-antd/src/api/property/meter/model.d.ts
vendored
Normal file
229
apps/web-antd/src/api/property/meter/model.d.ts
vendored
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
|
export interface MeterVO {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 水表名称
|
||||||
|
*/
|
||||||
|
meterName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
meterCode: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备厂商
|
||||||
|
*/
|
||||||
|
factoryNo: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型(1-电表,2-水表,3-气表)
|
||||||
|
*/
|
||||||
|
meterType: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表用途(1-分表,2-总表,3-公摊表)
|
||||||
|
*/
|
||||||
|
meterPurpose: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分摊类型(1-不公摊,2-按分表用量,3-按租客面积,4-按房源数量,5-按固定比例)
|
||||||
|
*/
|
||||||
|
shareType: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付费类型(1-先付费,2-后付费)
|
||||||
|
*/
|
||||||
|
payType: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前表显示读数
|
||||||
|
*/
|
||||||
|
display: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大表显读数(超过归0)
|
||||||
|
*/
|
||||||
|
maxDisplay: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计费倍率
|
||||||
|
*/
|
||||||
|
billingRate: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余量
|
||||||
|
*/
|
||||||
|
surplus: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通信状态
|
||||||
|
*/
|
||||||
|
communicationState: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行状态
|
||||||
|
*/
|
||||||
|
runningState: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MeterForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 水表名称
|
||||||
|
*/
|
||||||
|
meterName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
meterCode?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备厂商
|
||||||
|
*/
|
||||||
|
factoryNo?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型(1-电表,2-水表,3-气表)
|
||||||
|
*/
|
||||||
|
meterType?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表用途(1-分表,2-总表,3-公摊表)
|
||||||
|
*/
|
||||||
|
meterPurpose?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分摊类型(1-不公摊,2-按分表用量,3-按租客面积,4-按房源数量,5-按固定比例)
|
||||||
|
*/
|
||||||
|
shareType?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付费类型(1-先付费,2-后付费)
|
||||||
|
*/
|
||||||
|
payType?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前表显示读数
|
||||||
|
*/
|
||||||
|
display?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大表显读数(超过归0)
|
||||||
|
*/
|
||||||
|
maxDisplay?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计费倍率
|
||||||
|
*/
|
||||||
|
billingRate?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余量
|
||||||
|
*/
|
||||||
|
surplus?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通信状态
|
||||||
|
*/
|
||||||
|
communicationState?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行状态
|
||||||
|
*/
|
||||||
|
runningState?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MeterQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 水表名称
|
||||||
|
*/
|
||||||
|
meterName?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
meterCode?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备厂商
|
||||||
|
*/
|
||||||
|
factoryNo?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型(1-电表,2-水表,3-气表)
|
||||||
|
*/
|
||||||
|
meterType?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表用途(1-分表,2-总表,3-公摊表)
|
||||||
|
*/
|
||||||
|
meterPurpose?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分摊类型(1-不公摊,2-按分表用量,3-按租客面积,4-按房源数量,5-按固定比例)
|
||||||
|
*/
|
||||||
|
shareType?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付费类型(1-先付费,2-后付费)
|
||||||
|
*/
|
||||||
|
payType?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前表显示读数
|
||||||
|
*/
|
||||||
|
display?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大表显读数(超过归0)
|
||||||
|
*/
|
||||||
|
maxDisplay?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计费倍率
|
||||||
|
*/
|
||||||
|
billingRate?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余量
|
||||||
|
*/
|
||||||
|
surplus?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通信状态
|
||||||
|
*/
|
||||||
|
communicationState?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行状态
|
||||||
|
*/
|
||||||
|
runningState?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
import type { ElevatorInfoVO, ElevatorInfoForm, ElevatorInfoQuery } from './model';
|
import type { ElevatorInfoVO, ElevatorInfoForm, ElevatorInfoQuery, ElevatorFloorRefForm, ElevatorFloorRefVo } from './model';
|
||||||
|
|
||||||
import type { ID, IDS } from '#/api/common';
|
import type { ID, IDS } from '#/api/common';
|
||||||
import type { PageResult } from '#/api/common';
|
import type { PageResult } from '#/api/common';
|
||||||
@@ -59,3 +59,22 @@ export function elevatorInfoUpdate(data: ElevatorInfoForm) {
|
|||||||
export function elevatorInfoRemove(elevatorId: ID | IDS) {
|
export function elevatorInfoRemove(elevatorId: ID | IDS) {
|
||||||
return requestClient.deleteWithMsg<void>(`/sis/elevatorInfo/${elevatorId}`);
|
return requestClient.deleteWithMsg<void>(`/sis/elevatorInfo/${elevatorId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增电梯⇄楼层关联
|
||||||
|
* @param params
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function refAdd(data: ElevatorFloorRefForm) {
|
||||||
|
return requestClient.postWithMsg<void>('/sis/elevatorInfo/ref/add', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询电梯⇄楼层关联
|
||||||
|
* @param id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function refQuery(id: ID) {
|
||||||
|
return requestClient.get<ElevatorFloorRefVo[]>(`/sis/elevatorInfo/ref/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
144
apps/web-antd/src/api/sis/elevatorInfo/model.d.ts
vendored
144
apps/web-antd/src/api/sis/elevatorInfo/model.d.ts
vendored
@@ -1,100 +1,100 @@
|
|||||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
import type { PageQuery, BaseEntity } from '#/api/common'
|
||||||
|
|
||||||
export interface ElevatorInfoVO {
|
export interface ElevatorInfoVO {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
elevatorId: string | number;
|
elevatorId: string | number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电梯编号
|
* 电梯编号
|
||||||
*/
|
*/
|
||||||
elevatorCode: string;
|
elevatorCode: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电梯名称
|
* 电梯名称
|
||||||
*/
|
*/
|
||||||
elevatorName: string;
|
elevatorName: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装位置
|
* 安装位置
|
||||||
*/
|
*/
|
||||||
location: string;
|
location: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品牌
|
* 品牌
|
||||||
*/
|
*/
|
||||||
brand: string;
|
brand: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 型号
|
* 型号
|
||||||
*/
|
*/
|
||||||
model: string;
|
model: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产日期
|
* 生产日期
|
||||||
*/
|
*/
|
||||||
manufactureDate: string;
|
manufactureDate: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装日期
|
* 安装日期
|
||||||
*/
|
*/
|
||||||
installationDate: string;
|
installationDate: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最大载重(kg)
|
* 最大载重(kg)
|
||||||
*/
|
*/
|
||||||
maxLoad: number;
|
maxLoad: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务楼层数
|
* 服务楼层数
|
||||||
*/
|
*/
|
||||||
floorsServed: number;
|
floorsServed: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维保公司
|
* 维保公司
|
||||||
*/
|
*/
|
||||||
maintenanceCompany: string;
|
maintenanceCompany: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维保电话
|
* 维保电话
|
||||||
*/
|
*/
|
||||||
maintenancePhone: string;
|
maintenancePhone: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上次年检日期
|
* 上次年检日期
|
||||||
*/
|
*/
|
||||||
lastInspectionDate: string;
|
lastInspectionDate: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下次年检日期
|
* 下次年检日期
|
||||||
*/
|
*/
|
||||||
nextInspectionDate: string;
|
nextInspectionDate: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控厂商
|
* 梯控厂商
|
||||||
*/
|
*/
|
||||||
controlFactory: string;
|
controlFactory: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备ip
|
* 梯控设备ip
|
||||||
*/
|
*/
|
||||||
controlIp: string;
|
controlIp: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备编码
|
* 梯控设备编码
|
||||||
*/
|
*/
|
||||||
controlPort: number;
|
controlPort: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备登录账号
|
* 梯控设备登录账号
|
||||||
*/
|
*/
|
||||||
controlAccount: string;
|
controlAccount: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备登录密码
|
* 梯控设备登录密码
|
||||||
*/
|
*/
|
||||||
controlPwd: string;
|
controlPwd: string
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,102 +102,102 @@ export interface ElevatorInfoForm extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
elevatorId?: string | number;
|
elevatorId?: string | number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电梯编号
|
* 电梯编号
|
||||||
*/
|
*/
|
||||||
elevatorCode?: string;
|
elevatorCode?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电梯名称
|
* 电梯名称
|
||||||
*/
|
*/
|
||||||
elevatorName?: string;
|
elevatorName?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装位置
|
* 安装位置
|
||||||
*/
|
*/
|
||||||
location?: string;
|
location?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品牌
|
* 品牌
|
||||||
*/
|
*/
|
||||||
brand?: string;
|
brand?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 型号
|
* 型号
|
||||||
*/
|
*/
|
||||||
model?: string;
|
model?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产日期
|
* 生产日期
|
||||||
*/
|
*/
|
||||||
manufactureDate?: string;
|
manufactureDate?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装日期
|
* 安装日期
|
||||||
*/
|
*/
|
||||||
installationDate?: string;
|
installationDate?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最大载重(kg)
|
* 最大载重(kg)
|
||||||
*/
|
*/
|
||||||
maxLoad?: number;
|
maxLoad?: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务楼层数
|
* 服务楼层数
|
||||||
*/
|
*/
|
||||||
floorsServed?: number;
|
floorsServed?: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维保公司
|
* 维保公司
|
||||||
*/
|
*/
|
||||||
maintenanceCompany?: string;
|
maintenanceCompany?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维保电话
|
* 维保电话
|
||||||
*/
|
*/
|
||||||
maintenancePhone?: string;
|
maintenancePhone?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上次年检日期
|
* 上次年检日期
|
||||||
*/
|
*/
|
||||||
lastInspectionDate?: string;
|
lastInspectionDate?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下次年检日期
|
* 下次年检日期
|
||||||
*/
|
*/
|
||||||
nextInspectionDate?: string;
|
nextInspectionDate?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控厂商
|
* 梯控厂商
|
||||||
*/
|
*/
|
||||||
controlFactory?: string;
|
controlFactory?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备ip
|
* 梯控设备ip
|
||||||
*/
|
*/
|
||||||
controlIp?: string;
|
controlIp?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备编码
|
* 梯控设备编码
|
||||||
*/
|
*/
|
||||||
controlPort?: number;
|
controlPort?: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备登录账号
|
* 梯控设备登录账号
|
||||||
*/
|
*/
|
||||||
controlAccount?: string;
|
controlAccount?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备登录密码
|
* 梯控设备登录密码
|
||||||
*/
|
*/
|
||||||
controlPwd?: string;
|
controlPwd?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单元ID
|
* 单元ID
|
||||||
*/
|
*/
|
||||||
unitId?: number;
|
unitId?: number
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,95 +205,121 @@ export interface ElevatorInfoQuery extends PageQuery {
|
|||||||
/**
|
/**
|
||||||
* 电梯编号
|
* 电梯编号
|
||||||
*/
|
*/
|
||||||
elevatorCode?: string;
|
elevatorCode?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电梯名称
|
* 电梯名称
|
||||||
*/
|
*/
|
||||||
elevatorName?: string;
|
elevatorName?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装位置
|
* 安装位置
|
||||||
*/
|
*/
|
||||||
location?: string;
|
location?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品牌
|
* 品牌
|
||||||
*/
|
*/
|
||||||
brand?: string;
|
brand?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 型号
|
* 型号
|
||||||
*/
|
*/
|
||||||
model?: string;
|
model?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产日期
|
* 生产日期
|
||||||
*/
|
*/
|
||||||
manufactureDate?: string;
|
manufactureDate?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装日期
|
* 安装日期
|
||||||
*/
|
*/
|
||||||
installationDate?: string;
|
installationDate?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最大载重(kg)
|
* 最大载重(kg)
|
||||||
*/
|
*/
|
||||||
maxLoad?: number;
|
maxLoad?: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务楼层数
|
* 服务楼层数
|
||||||
*/
|
*/
|
||||||
floorsServed?: number;
|
floorsServed?: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维保公司
|
* 维保公司
|
||||||
*/
|
*/
|
||||||
maintenanceCompany?: string;
|
maintenanceCompany?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维保电话
|
* 维保电话
|
||||||
*/
|
*/
|
||||||
maintenancePhone?: string;
|
maintenancePhone?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上次年检日期
|
* 上次年检日期
|
||||||
*/
|
*/
|
||||||
lastInspectionDate?: string;
|
lastInspectionDate?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下次年检日期
|
* 下次年检日期
|
||||||
*/
|
*/
|
||||||
nextInspectionDate?: string;
|
nextInspectionDate?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控厂商
|
* 梯控厂商
|
||||||
*/
|
*/
|
||||||
controlFactory?: string;
|
controlFactory?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备ip
|
* 梯控设备ip
|
||||||
*/
|
*/
|
||||||
controlIp?: string;
|
controlIp?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备编码
|
* 梯控设备编码
|
||||||
*/
|
*/
|
||||||
controlPort?: number;
|
controlPort?: number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备登录账号
|
* 梯控设备登录账号
|
||||||
*/
|
*/
|
||||||
controlAccount?: string;
|
controlAccount?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 梯控设备登录密码
|
* 梯控设备登录密码
|
||||||
*/
|
*/
|
||||||
controlPwd?: string;
|
controlPwd?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期范围参数
|
* 日期范围参数
|
||||||
*/
|
*/
|
||||||
params?: any;
|
params?: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ElevatorFloorRefVo {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
elevatorId: string | number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 楼层层数
|
||||||
|
*/
|
||||||
|
floorNum: string | number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ElevatorFloorRefForm extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电梯id
|
||||||
|
*/
|
||||||
|
elevatorId?: string | number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 楼层层数
|
||||||
|
*/
|
||||||
|
floorNums?: [number]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
238
apps/web-antd/src/views/property/meter/data.ts
Normal file
238
apps/web-antd/src/views/property/meter/data.ts
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
|
||||||
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'meterName',
|
||||||
|
label: '水表名称',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'meterCode',
|
||||||
|
label: '设备编码',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'factoryNo',
|
||||||
|
label: '设备厂商',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
},
|
||||||
|
fieldName: 'meterType',
|
||||||
|
label: '设备类型(1-电表,2-水表,3-气表)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'meterPurpose',
|
||||||
|
label: '表用途(1-分表,2-总表,3-公摊表)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
},
|
||||||
|
fieldName: 'shareType',
|
||||||
|
label: '分摊类型',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
},
|
||||||
|
fieldName: 'payType',
|
||||||
|
label: '付费类型(1-先付费,2-后付费)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'display',
|
||||||
|
label: '当前表显示读数',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'maxDisplay',
|
||||||
|
label: '最大表显读数(超过归0)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'billingRate',
|
||||||
|
label: '计费倍率',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'surplus',
|
||||||
|
label: '剩余量',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'communicationState',
|
||||||
|
label: '通信状态',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'runningState',
|
||||||
|
label: '运行状态',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||||
|
export const columns: VxeGridProps['columns'] = [
|
||||||
|
{ type: 'checkbox', width: 60 },
|
||||||
|
{
|
||||||
|
title: '主键id',
|
||||||
|
field: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '水表名称',
|
||||||
|
field: 'meterName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备编码',
|
||||||
|
field: 'meterCode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备厂商',
|
||||||
|
field: 'factoryNo',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备类型(1-电表,2-水表,3-气表)',
|
||||||
|
field: 'meterType',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '表用途(1-分表,2-总表,3-公摊表)',
|
||||||
|
field: 'meterPurpose',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '分摊类型',
|
||||||
|
field: 'shareType',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '付费类型(1-先付费,2-后付费)',
|
||||||
|
field: 'payType',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '当前表显示读数',
|
||||||
|
field: 'display',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '最大表显读数(超过归0)',
|
||||||
|
field: 'maxDisplay',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '计费倍率',
|
||||||
|
field: 'billingRate',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '剩余量',
|
||||||
|
field: 'surplus',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '通信状态',
|
||||||
|
field: 'communicationState',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '运行状态',
|
||||||
|
field: 'runningState',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: 'meterName',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '设备编码',
|
||||||
|
fieldName: 'meterCode',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '设备厂商',
|
||||||
|
fieldName: 'factoryNo',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '设备类型(1-电表,2-水表,3-气表)',
|
||||||
|
fieldName: 'meterType',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '表用途(1-分表,2-总表,3-公摊表)',
|
||||||
|
fieldName: 'meterPurpose',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '分摊类型',
|
||||||
|
fieldName: 'shareType',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '付费类型(1-先付费,2-后付费)',
|
||||||
|
fieldName: 'payType',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '当前表显示读数',
|
||||||
|
fieldName: 'display',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '最大表显读数(超过归0)',
|
||||||
|
fieldName: 'maxDisplay',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '计费倍率',
|
||||||
|
fieldName: 'billingRate',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '剩余量',
|
||||||
|
fieldName: 'surplus',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '通信状态',
|
||||||
|
fieldName: 'communicationState',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '运行状态',
|
||||||
|
fieldName: 'runningState',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '备注',
|
||||||
|
fieldName: 'remark',
|
||||||
|
component: 'Textarea',
|
||||||
|
},
|
||||||
|
];
|
182
apps/web-antd/src/views/property/meter/index.vue
Normal file
182
apps/web-antd/src/views/property/meter/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 {
|
||||||
|
meterExport,
|
||||||
|
meterList,
|
||||||
|
meterRemove,
|
||||||
|
} from '#/api/property/meter';
|
||||||
|
import type { MeterForm } from '#/api/property/meter/model';
|
||||||
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
|
import meterModal from './meter-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 meterList({
|
||||||
|
pageNum: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
},
|
||||||
|
// 表格全局唯一表示 保存列配置需要用到
|
||||||
|
id: 'property-meter-index'
|
||||||
|
};
|
||||||
|
|
||||||
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
|
formOptions,
|
||||||
|
gridOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [MeterModal, modalApi] = useVbenModal({
|
||||||
|
connectedComponent: meterModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
modalApi.setData({});
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleEdit(row: Required<MeterForm>) {
|
||||||
|
modalApi.setData({ id: row.id });
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(row: Required<MeterForm>) {
|
||||||
|
await meterRemove(row.id);
|
||||||
|
await tableApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMultiDelete() {
|
||||||
|
const rows = tableApi.grid.getCheckboxRecords();
|
||||||
|
const ids = rows.map((row: Required<MeterForm>) => row.id);
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
okType: 'danger',
|
||||||
|
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||||
|
onOk: async () => {
|
||||||
|
await meterRemove(ids);
|
||||||
|
await tableApi.query();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(meterExport, '水电气数据', 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="['property:meter:export']"
|
||||||
|
@click="handleDownloadExcel"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.export') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['property:meter:remove']"
|
||||||
|
@click="handleMultiDelete">
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['property:meter:add']"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.add') }}
|
||||||
|
</a-button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<Space>
|
||||||
|
<ghost-button
|
||||||
|
v-access:code="['property:meter: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="['property:meter:remove']"
|
||||||
|
@click.stop=""
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</ghost-button>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<MeterModal @reload="tableApi.query()" />
|
||||||
|
</Page>
|
||||||
|
</template>
|
101
apps/web-antd/src/views/property/meter/meter-modal.vue
Normal file
101
apps/web-antd/src/views/property/meter/meter-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 { meterAdd, meterInfo, meterUpdate } from '#/api/property/meter';
|
||||||
|
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 meterInfo(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 ? meterUpdate(data) : meterAdd(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>
|
||||||
|
|
@@ -5,35 +5,12 @@ import { cloneDeep } from '@vben/utils'
|
|||||||
import { useVbenModal } from '@vben/common-ui'
|
import { useVbenModal } from '@vben/common-ui'
|
||||||
import { useVbenForm } from '#/adapter/form'
|
import { useVbenForm } from '#/adapter/form'
|
||||||
import { queryByUnitId } from '#/api/property/floor'
|
import { queryByUnitId } from '#/api/property/floor'
|
||||||
import { message } from 'ant-design-vue'
|
import { refAdd, refQuery } from '#/api/sis/elevatorInfo'
|
||||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'
|
||||||
|
|
||||||
const dataForm = ref<any>()
|
const dataForm = ref<any>()
|
||||||
const floorArr = ref<any[]>([])
|
|
||||||
const title = ref('楼层授权')
|
const title = ref('楼层授权')
|
||||||
|
|
||||||
const [BasicModal, modalApi] = useVbenModal({
|
|
||||||
// 在这里更改宽度
|
|
||||||
class: 'w-[700px]',
|
|
||||||
fullscreenButton: false,
|
|
||||||
onClosed: handleClosed,
|
|
||||||
onConfirm: handleConfirm,
|
|
||||||
onOpened: () => {
|
|
||||||
dataForm.value = modalApi.getData()
|
|
||||||
const { unitId } = modalApi.getData()
|
|
||||||
queryByUnitId(unitId).then((res) => {
|
|
||||||
const arr: any[] = []
|
|
||||||
res.forEach((item) => {
|
|
||||||
arr.push({
|
|
||||||
label: item.floorName,
|
|
||||||
value: item.id,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
floorArr.value = arr
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const [BasicForm, formApi] = useVbenForm({
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
// 所有表单项共用,可单独在表单内覆盖
|
// 所有表单项共用,可单独在表单内覆盖
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
@@ -50,24 +27,62 @@ const [BasicForm, formApi] = useVbenForm({
|
|||||||
component: 'CheckboxGroup',
|
component: 'CheckboxGroup',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
name: 'cname',
|
name: 'cname',
|
||||||
options: floorArr,
|
options: [],
|
||||||
},
|
},
|
||||||
fieldName: 'checkboxGroup',
|
defaultValue: [],
|
||||||
|
fieldName: 'floorNums',
|
||||||
label: '楼层'
|
label: '楼层'
|
||||||
}],
|
}],
|
||||||
wrapperClass: 'grid-cols-1',
|
wrapperClass: 'grid-cols-1',
|
||||||
showDefaultActions: false
|
showDefaultActions: false
|
||||||
})
|
})
|
||||||
|
|
||||||
// formApi.updateSchema(
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
// [
|
// 在这里更改宽度
|
||||||
// {
|
class: 'w-[700px]',
|
||||||
// componentProps: {
|
fullscreenButton: false,
|
||||||
// options: floorArr,
|
loading: true,
|
||||||
// },
|
onClosed: handleClosed,
|
||||||
// fieldName: 'checkboxGroup',
|
onConfirm: handleConfirm,
|
||||||
// },
|
onOpened: handleInit,
|
||||||
// ])
|
})
|
||||||
|
|
||||||
|
function handleInit() {
|
||||||
|
dataForm.value = modalApi.getData()
|
||||||
|
const { unitId } = modalApi.getData()
|
||||||
|
queryByUnitId(unitId).then((res) => {
|
||||||
|
const arr: any[] = []
|
||||||
|
res.forEach((item) => {
|
||||||
|
arr.push({
|
||||||
|
label: item.floorName,
|
||||||
|
value: item.floorNumber,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
formApi.updateSchema([
|
||||||
|
{
|
||||||
|
fieldName: 'floorNums',
|
||||||
|
componentProps: { options: arr },
|
||||||
|
}
|
||||||
|
])
|
||||||
|
handleChecked()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleChecked() {
|
||||||
|
const { elevatorId } = modalApi.getData()
|
||||||
|
refQuery(elevatorId).then((res) => {
|
||||||
|
const arr: any[] = []
|
||||||
|
res.forEach((item) => {
|
||||||
|
arr.push(item.floorNum)
|
||||||
|
})
|
||||||
|
formApi.setFieldValue('floorNums', arr)
|
||||||
|
}).finally(() => {
|
||||||
|
modalApi.setState({ loading: false });
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const { resetInitialized } = useBeforeCloseDiff(
|
const { resetInitialized } = useBeforeCloseDiff(
|
||||||
{
|
{
|
||||||
@@ -75,12 +90,17 @@ const { resetInitialized } = useBeforeCloseDiff(
|
|||||||
currentGetter: defaultFormValueGetter(formApi),
|
currentGetter: defaultFormValueGetter(formApi),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
async function handleConfirm() {
|
async function handleConfirm() {
|
||||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||||
const data = cloneDeep(await formApi.getValues())
|
const data = cloneDeep(await formApi.getValues())
|
||||||
console.log(data)
|
const params = {
|
||||||
console.log(dataForm.value.elevatorId)
|
elevatorId: dataForm.value.elevatorId,
|
||||||
|
floorNums: data.floorNums
|
||||||
|
}
|
||||||
|
refAdd(params).finally(() => {
|
||||||
modalApi.close()
|
modalApi.close()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleClosed() {
|
async function handleClosed() {
|
||||||
|
Reference in New Issue
Block a user