调整OneNET账号和设备
This commit is contained in:
parent
a8f585d7e9
commit
55ac423faa
@ -3,6 +3,9 @@
|
||||
import type { Options, OptionsLegacyParser } from '@hey-api/client-axios';
|
||||
|
||||
import type {
|
||||
DeviceArchivesDown,
|
||||
DeviceInfoPageListInput,
|
||||
DeviceInfoPageListResult,
|
||||
GetApiAbpApiDefinitionData,
|
||||
GetApiAbpApiDefinitionError,
|
||||
GetApiAbpApiDefinitionResponse,
|
||||
@ -16,11 +19,23 @@ import type {
|
||||
GetApiAppAbpProBasicApplicationConfigurationResponse,
|
||||
IoTDBCTWingLogInfoDtoPageListInput,
|
||||
IoTDBCTWingLogInfoDtoPageListResult,
|
||||
IoTDBDataInfoErrorResponse,
|
||||
IoTDBOneNETLogInfoPageListInput,
|
||||
IoTDBOneNETLogInfoPageListResult,
|
||||
IoTDBTreeModelDeviceDataPageAllResponse,
|
||||
IoTDBTreeModelDeviceDataPageDataInput,
|
||||
IoTErrorResponse,
|
||||
OneNETAccountCreateInput,
|
||||
OneNETAccountCreateInput,
|
||||
OneNETAccountCreateResponse,
|
||||
OneNETAccountCreateResponse,
|
||||
OneNETAccountPageListInput,
|
||||
OneNETAccountPageListResult,
|
||||
OneNETProductCreateInput,
|
||||
OneNETProductCreateInput,
|
||||
OneNETProductCreateResponse,
|
||||
OneNETProductCreateResponse,
|
||||
OneNETProductPageListInput,
|
||||
OneNETProductPageListResult,
|
||||
PostApiAppAccountLogin2FaData,
|
||||
PostApiAppAccountLogin2FaError,
|
||||
PostApiAppAccountLogin2FaResponse,
|
||||
@ -147,8 +162,6 @@ import type {
|
||||
PostFilesUploadData,
|
||||
PostFilesUploadError,
|
||||
PostFilesUploadResponse,
|
||||
PostFoucsCreateData,
|
||||
postFoucsUpdateData,
|
||||
PostGeneratorDownData,
|
||||
PostGeneratorDownError,
|
||||
PostGeneratorDownResponse,
|
||||
@ -202,8 +215,6 @@ import type {
|
||||
PostMenusUpdateResponse,
|
||||
PostMenusUserMenuError,
|
||||
PostMenusUserMenuResponse,
|
||||
postMetersArchivesIssued,
|
||||
PostMetersCreateData,
|
||||
PostNotificationBatchReadData,
|
||||
PostNotificationBatchReadError,
|
||||
PostNotificationBatchReadResponse,
|
||||
@ -2960,25 +2971,25 @@ export const postUsersNeedChangePassword = <
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取集中器分页
|
||||
* 获取设备管理分页
|
||||
*/
|
||||
export const postFocusesPage = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostUsersPageData, ThrowOnError>,
|
||||
export const postDeviceInfoPage = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<DeviceInfoPageListInput, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostRolesAllResponse,
|
||||
DeviceInfoPageListResult,
|
||||
PostRolesAllError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Focuses/Page',
|
||||
url: '/DeviceInfo/Page',
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 创建集中器
|
||||
* 创建设备
|
||||
*/
|
||||
export const postFocusesCreate = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostFoucsCreateData, ThrowOnError>,
|
||||
export const postDeviceInfoCreate = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostDeviceInfoCreateData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersCreateResponse,
|
||||
@ -2986,14 +2997,14 @@ export const postFocusesCreate = <ThrowOnError extends boolean = false>(
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Focuses/Create',
|
||||
url: '/Aggregation/Device/Create',
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 编辑集中器
|
||||
* 编辑设备
|
||||
*/
|
||||
export const postFocusesUpdate = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<postFoucsUpdateData, ThrowOnError>,
|
||||
export const postDeviceInfoUpdate = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostDeviceInfoCreateData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersUpdateResponse,
|
||||
@ -3001,13 +3012,13 @@ export const postFocusesUpdate = <ThrowOnError extends boolean = false>(
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Focuses/Update',
|
||||
url: '/Aggregation/Device/Update',
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 删除集中器
|
||||
* 删除设备
|
||||
*/
|
||||
export const postFocusesDelete = <ThrowOnError extends boolean = false>(
|
||||
export const postDeviceInfoDelete = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostUsersDeleteData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
@ -3016,77 +3027,17 @@ export const postFocusesDelete = <ThrowOnError extends boolean = false>(
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Focuses/Delete',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取表计管理分页
|
||||
*/
|
||||
export const postMetersPage = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostUsersPageData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostRolesAllResponse,
|
||||
PostRolesAllError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
// ...formDataBodySerializer,
|
||||
url: '/Meters/Page',
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 创建表计
|
||||
*/
|
||||
export const postMetersCreate = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostMetersCreateData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersCreateResponse,
|
||||
PostUsersCreateError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Meters/Create',
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 编辑表计
|
||||
*/
|
||||
export const postMetersUpdate = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostMetersCreateData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersUpdateResponse,
|
||||
PostUsersUpdateError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Meters/Update',
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 删除表计
|
||||
*/
|
||||
export const postMetersDelete = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostUsersDeleteData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersDeleteResponse,
|
||||
PostUsersDeleteError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Meters/Delete',
|
||||
url: '/Aggregation/Device/Delete',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 档案下发
|
||||
*/
|
||||
export const postMetersArchivesDown = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<postMetersArchivesIssued, ThrowOnError>,
|
||||
export const postDeviceInfoArchivesDown = <
|
||||
ThrowOnError extends boolean = false,
|
||||
>(
|
||||
options?: Options<DeviceArchivesDown, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersDeleteResponse,
|
||||
@ -3094,30 +3045,12 @@ export const postMetersArchivesDown = <ThrowOnError extends boolean = false>(
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Meters/ArchivesDown',
|
||||
url: '/DeviceInfo/ArchivesDown',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取集中器状态分页
|
||||
*/
|
||||
export const postTreeModelFocusStatusInfoPage = <
|
||||
ThrowOnError extends boolean = false,
|
||||
>(
|
||||
options?: Options<PostUsersPageData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostRolesAllResponse,
|
||||
PostRolesAllError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/TreeModel/FocusStatusInfoPage',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取日志分页
|
||||
* 获取遥测日志分页
|
||||
*/
|
||||
export const postTableModelPacketInfoPage = <
|
||||
ThrowOnError extends boolean = false,
|
||||
@ -3144,7 +3077,7 @@ export const postTreeModelDeviceDataInfoPage = <
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
IoTDBTreeModelDeviceDataPageAllResponse,
|
||||
IoTDBDataInfoErrorResponse,
|
||||
IoTErrorResponse,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
@ -3161,7 +3094,7 @@ export const getSelectResultList = <ThrowOnError extends boolean = false>(
|
||||
) => {
|
||||
return (options?.client ?? client).get<
|
||||
SelectResultListAllResponse,
|
||||
IoTDBDataInfoErrorResponse,
|
||||
IoTErrorResponse,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
@ -3177,7 +3110,7 @@ export const postOneNETLogInfoPage = <ThrowOnError extends boolean = false>(
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
IoTDBOneNETLogInfoPageListResult,
|
||||
IoTDBDataInfoErrorResponse,
|
||||
IoTErrorResponse,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
@ -3194,7 +3127,7 @@ export const postCTWingLogInfoPage = <ThrowOnError extends boolean = false>(
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
IoTDBCTWingLogInfoDtoPageListResult,
|
||||
IoTDBDataInfoErrorResponse,
|
||||
IoTErrorResponse,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
@ -3202,3 +3135,69 @@ export const postCTWingLogInfoPage = <ThrowOnError extends boolean = false>(
|
||||
url: '/TableModel/CTWingLogInfo',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* OneNET 账号管理
|
||||
*/
|
||||
export const postOneNETAccountInfoPage = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<OneNETAccountPageListInput, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
OneNETAccountPageListResult,
|
||||
IoTErrorResponse,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
...formDataBodySerializer,
|
||||
url: '/OneNETAccount/ListAsync',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* OneNET 创建账号
|
||||
*/
|
||||
export const postOneNETAccountCreate = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<OneNETAccountCreateInput, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
OneNETAccountCreateResponse,
|
||||
IoTErrorResponse,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/OneNETAccount/InsertAsync',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* OneNET 产品管理
|
||||
*/
|
||||
export const postOneNETProductInfoPage = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<OneNETProductPageListInput, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
OneNETProductPageListResult,
|
||||
IoTErrorResponse,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
...formDataBodySerializer,
|
||||
url: '/OneNETProduct/ListAsync',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* OneNET 创建产品
|
||||
*/
|
||||
export const postOneNETProductCreate = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<OneNETProductCreateInput, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
OneNETProductCreateResponse,
|
||||
IoTErrorResponse,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/OneNETProduct/InsertAsync',
|
||||
});
|
||||
};
|
||||
|
||||
@ -1783,24 +1783,6 @@ export type IdentityFocusUpdateDto = {
|
||||
selfDevelop?: boolean;
|
||||
status?: boolean;
|
||||
};
|
||||
|
||||
export type IdentityMetersUpdateDto = {
|
||||
dynamicPassword?: boolean;
|
||||
haveValve?: boolean;
|
||||
id?: string;
|
||||
meterAddress: number;
|
||||
meterName: string;
|
||||
meterType?: number;
|
||||
password?: number | string;
|
||||
selfDevelop?: boolean;
|
||||
singleRate?: number | string;
|
||||
};
|
||||
export type IdentityMetersArchivesDown = {
|
||||
focusAddress: number | string;
|
||||
meterAddress: number | string;
|
||||
meterType: number | string;
|
||||
};
|
||||
|
||||
export type IdInput = {
|
||||
id?: string;
|
||||
};
|
||||
@ -4930,14 +4912,6 @@ export type PostUsersCreateData = {
|
||||
body?: IdentityUserCreateDto;
|
||||
};
|
||||
|
||||
export type PostFoucsCreateData = {
|
||||
body?: IdentityFocusUpdateDto;
|
||||
};
|
||||
|
||||
export type PostMetersCreateData = {
|
||||
body?: IdentityMetersUpdateDto;
|
||||
};
|
||||
|
||||
export type PostUsersCreateResponse = IdentityUserDto;
|
||||
|
||||
export type PostUsersCreateError = RemoteServiceErrorResponse;
|
||||
@ -4946,18 +4920,6 @@ export type PostUsersUpdateData = {
|
||||
body?: UpdateUserInput;
|
||||
};
|
||||
|
||||
export type postFoucsUpdateData = {
|
||||
body?: IdentityFocusUpdateDto;
|
||||
};
|
||||
|
||||
export type postMetersUpdateData = {
|
||||
body?: IdentityMetersUpdateDto;
|
||||
};
|
||||
|
||||
export type postMetersArchivesIssued = {
|
||||
body?: IdentityMetersArchivesDown;
|
||||
};
|
||||
|
||||
export type PostUsersUpdateResponse = IdentityUserDto;
|
||||
|
||||
export type PostUsersUpdateError = RemoteServiceErrorResponse;
|
||||
@ -5050,7 +5012,7 @@ export type PostUsersNeedChangePasswordResponse = NeedChangePasswordOutput;
|
||||
|
||||
export type PostUsersNeedChangePasswordError = RemoteServiceErrorResponse;
|
||||
|
||||
export type IoTDBDataInfoPageInput = {
|
||||
export type IoTPageInput = {
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
@ -5076,12 +5038,12 @@ export type IoTDBDataInfoPageInput = {
|
||||
sorting?: null | string;
|
||||
};
|
||||
|
||||
export type IoTDBDataInfoErrorResponse = {
|
||||
export type IoTErrorResponse = {
|
||||
error?: RemoteServiceErrorInfo;
|
||||
};
|
||||
|
||||
export type IoTDBTreeModelDeviceDataPageDataInput = {
|
||||
body?: IoTDBDataInfoPageInput;
|
||||
body?: IoTPageInput;
|
||||
};
|
||||
|
||||
export type IoTDBTreeModelDeviceDataDto = {
|
||||
@ -5142,7 +5104,7 @@ export type OneNETLogInfoDto = {
|
||||
};
|
||||
|
||||
export type IoTDBOneNETLogInfoPageListInput = {
|
||||
body?: IoTDBDataInfoPageInput;
|
||||
body?: IoTPageInput;
|
||||
};
|
||||
export type IoTDBOneNETLogInfoPageListResult = {
|
||||
items?: Array<OneNETLogInfoDto> | null;
|
||||
@ -5193,9 +5155,89 @@ export type CTWingLogInfoDto = {
|
||||
};
|
||||
|
||||
export type IoTDBCTWingLogInfoDtoPageListInput = {
|
||||
body?: IoTDBDataInfoPageInput;
|
||||
body?: IoTPageInput;
|
||||
};
|
||||
export type IoTDBCTWingLogInfoDtoPageListResult = {
|
||||
items?: Array<CTWingLogInfoDto> | null;
|
||||
totalCount?: number;
|
||||
};
|
||||
|
||||
export type OneNETAccountDto = {
|
||||
accesskey: string;
|
||||
accountName: string;
|
||||
oneNETAccountId?: string;
|
||||
phoneNumber: string;
|
||||
productCount: number;
|
||||
};
|
||||
|
||||
export type OneNETAccountPageListInput = {
|
||||
body?: IoTPageInput;
|
||||
};
|
||||
export type OneNETAccountPageListResult = {
|
||||
items?: Array<OneNETAccountDto> | null;
|
||||
totalCount?: number;
|
||||
};
|
||||
|
||||
export type OneNETAccountCreateInput = {
|
||||
body?: OneNETAccountDto;
|
||||
};
|
||||
export type OneNETAccountCreateResponse = {
|
||||
body?: OneNETAccountDto;
|
||||
};
|
||||
|
||||
export type OneNETProductDto = {
|
||||
ioTPlatformProductId: string;
|
||||
isEncrypted?: string;
|
||||
oneNETAccountId: string;
|
||||
productAccesskey: string;
|
||||
productName: string;
|
||||
};
|
||||
|
||||
export type OneNETProductPageListInput = {
|
||||
body?: IoTPageInput;
|
||||
};
|
||||
export type OneNETProductPageListResult = {
|
||||
items?: Array<OneNETProductDto> | null;
|
||||
totalCount?: number;
|
||||
};
|
||||
|
||||
export type OneNETProductCreateInput = {
|
||||
body?: OneNETProductDto;
|
||||
};
|
||||
export type OneNETProductCreateResponse = {
|
||||
body?: OneNETProductDto;
|
||||
};
|
||||
|
||||
export type DeviceInfoDto = {
|
||||
dynamicPassword?: boolean;
|
||||
haveValve?: boolean;
|
||||
id?: string;
|
||||
meterAddress: number;
|
||||
meterName: string;
|
||||
meterType?: number;
|
||||
password?: number | string;
|
||||
selfDevelop?: boolean;
|
||||
singleRate?: number | string;
|
||||
};
|
||||
|
||||
export type DeviceInfoPageListInput = {
|
||||
body?: IoTPageInput;
|
||||
};
|
||||
export type DeviceInfoPageListResult = {
|
||||
items?: Array<DeviceInfoDto> | null;
|
||||
totalCount?: number;
|
||||
};
|
||||
|
||||
export type DeviceArchivesDown = {
|
||||
focusAddress: number | string;
|
||||
meterAddress: number | string;
|
||||
meterType: number | string;
|
||||
};
|
||||
|
||||
export type PostDeviceCreateData = {
|
||||
body?: DeviceInfoDto;
|
||||
};
|
||||
|
||||
export type postDeviceUpdateData = {
|
||||
body?: DeviceInfoDto;
|
||||
};
|
||||
|
||||
@ -195,35 +195,18 @@
|
||||
"checkFocusAddress": "The concentrator address is 9 bits",
|
||||
"statusData": "statusData"
|
||||
},
|
||||
"meters": {
|
||||
"meterName": "meterName",
|
||||
"meterAddress": "meterAddress",
|
||||
"meterType": "meterType",
|
||||
"dynamicPassword": "dynamicPassword",
|
||||
"password": "password",
|
||||
"singleRate": "singleRate",
|
||||
"selfDevelop": "selfDevelopedOrNot",
|
||||
"brandType": "BrandAndModel",
|
||||
"archiveStatus": "File distribution status",
|
||||
"tripState": "Valve control status",
|
||||
"timesA": "CT",
|
||||
"timev": "PT",
|
||||
"haveValve": "With or without valve",
|
||||
"gatherCount": "Quantity of collected items",
|
||||
"functionCount": "Number of functions",
|
||||
"checkmeterAddress": "Table The communication address is 9 pure numbers",
|
||||
"ElectricityMeter": "ElectricityMeter",
|
||||
"waterMeter": "waterMeter",
|
||||
"GasMeter": "GasMeter",
|
||||
"HeatMeter": "HeatMeter",
|
||||
"WaterMeterFlowmeter": "WaterMeterFlowmeter",
|
||||
"GasMeterFlowmeter": "GasMeterFlowmeter",
|
||||
"MultipleRate": "MultipleRate",
|
||||
"SingleRate": "SingleRate",
|
||||
"meteringCode": "meteringCode",
|
||||
"DeviceType": "DeviceType",
|
||||
"pointData": "pointData",
|
||||
"archivesIssued": "archivesIssued"
|
||||
"deviceInfos": {
|
||||
"deviceName": "DeviceName",
|
||||
"deviceAddress": "DeviceAddress",
|
||||
"ioTPlatform": "Platform Type",
|
||||
"ioTPlatformName": "PlatformName",
|
||||
"ioTPlatformDeviceOpenInfo": "DeviceOpenInfo",
|
||||
"platformPassword": "Password",
|
||||
"ioTPlatformProductId": "ProductId",
|
||||
"ioTPlatformProductName": "ProductName",
|
||||
"ioTPlatformAccountId": "AccountId",
|
||||
"ioTPlatformAccountName": "AccountName",
|
||||
"ioTPlatformResponse": "Response"
|
||||
},
|
||||
"IoTDBBase": {
|
||||
"IoTDataType": "IoTDataType",
|
||||
|
||||
@ -195,35 +195,18 @@
|
||||
"checkFocusAddress": "集中器地址为9位",
|
||||
"statusData": "状态数据"
|
||||
},
|
||||
"meters": {
|
||||
"meterName": "表计名称",
|
||||
"meterAddress": "表通信地址",
|
||||
"meterType": "表计类型",
|
||||
"dynamicPassword": "是否动态密码",
|
||||
"password": "表密码",
|
||||
"singleRate": "费率类型",
|
||||
"selfDevelop": "是否自研",
|
||||
"brandType": "品牌型号",
|
||||
"archiveStatus": "档案下发状态",
|
||||
"tripState": "阀控状态",
|
||||
"timesA": "CT",
|
||||
"timev": "PT",
|
||||
"haveValve": "是否带阀",
|
||||
"gatherCount": "采集项数量",
|
||||
"functionCount": "功能数量",
|
||||
"checkmeterAddress": "表通信地址为9纯数字",
|
||||
"ElectricityMeter": "电表",
|
||||
"waterMeter": "水表",
|
||||
"GasMeter": "燃气表",
|
||||
"HeatMeter": "热能表",
|
||||
"WaterMeterFlowmeter": "水表流量计",
|
||||
"GasMeterFlowmeter": "燃气表流量计",
|
||||
"MultipleRate": "复费率",
|
||||
"SingleRate": "单费率",
|
||||
"meteringCode": "计量点",
|
||||
"DeviceType": "设备类型",
|
||||
"pointData": "测点数据",
|
||||
"archivesIssued": "档案下发"
|
||||
"deviceInfos": {
|
||||
"deviceName": "设备名称",
|
||||
"deviceAddress": "设备地址",
|
||||
"ioTPlatform": "物联网平台类型",
|
||||
"ioTPlatformName": "物联网平台类型",
|
||||
"ioTPlatformDeviceOpenInfo": "平台设备信息",
|
||||
"platformPassword": "设备密码",
|
||||
"ioTPlatformProductId": "产品Id",
|
||||
"ioTPlatformProductName": "产品名称",
|
||||
"ioTPlatformAccountId": "所属账号Id",
|
||||
"ioTPlatformAccountName": "所属账号",
|
||||
"ioTPlatformResponse": "平台响应"
|
||||
},
|
||||
"IoTDBBase": {
|
||||
"IoTDataType": "数据类型",
|
||||
@ -278,5 +261,17 @@
|
||||
"DeviceCreateTime": "设备创建时间",
|
||||
"DeviceUpdateTime": "设备更新时间",
|
||||
"DeviceLastActiveTime": "设备最后活跃时间"
|
||||
},
|
||||
"OneNETManagement": {
|
||||
"AccountName": "账号名称",
|
||||
"AccountId": "账号ID",
|
||||
"PhoneNumber": "手机号码",
|
||||
"AccountAccesskey": "账户通信密钥",
|
||||
"ProductCount": "产品数量",
|
||||
"OneNETAccountId": "OneNET账户Id",
|
||||
"IoTPlatformProductId": "物联网平台对应的产品Id",
|
||||
"ProductName": "产品名称",
|
||||
"ProductAccesskey": "产品访问密钥",
|
||||
"IsEncrypted": "是否加密"
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,5 +52,6 @@
|
||||
"exporting": "正在导出数据...",
|
||||
"exportSuccess": "数据导出成功",
|
||||
"exportFailed": "数据导出失败",
|
||||
"getDataFailed": "获取数据失败"
|
||||
"getDataFailed": "获取数据失败",
|
||||
"IsEnabled": "是否启用"
|
||||
}
|
||||
|
||||
@ -12,18 +12,18 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
postMetersArchivesDown,
|
||||
postMetersCreate,
|
||||
postMetersDelete,
|
||||
postMetersPage,
|
||||
postMetersUpdate,
|
||||
postDeviceInfoArchivesDown,
|
||||
postDeviceInfoCreate,
|
||||
postDeviceInfoDelete,
|
||||
postDeviceInfoPage,
|
||||
postDeviceInfoUpdate,
|
||||
} from '#/api-client';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import {
|
||||
addUserFormSchema,
|
||||
editUserFormSchemaEdit,
|
||||
addDeviceFormSchema,
|
||||
editDeviceFormSchemaEdit,
|
||||
meterTypeOptions,
|
||||
querySchema,
|
||||
rateOptions,
|
||||
@ -31,7 +31,7 @@ import {
|
||||
} from './schema';
|
||||
|
||||
defineOptions({
|
||||
name: 'AbpUser',
|
||||
name: 'DeviceInfo',
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
@ -56,7 +56,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
const { data } = await postMetersPage({
|
||||
const { data } = await postDeviceInfoPage({
|
||||
body: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@ -92,7 +92,7 @@ const [AddForm, addFormApi] = useVbenForm({
|
||||
},
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: addUserFormSchema.value,
|
||||
schema: addDeviceFormSchema.value,
|
||||
showCollapseButton: false,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
@ -110,7 +110,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
},
|
||||
// 提交函数
|
||||
layout: 'horizontal',
|
||||
schema: editUserFormSchemaEdit.value,
|
||||
schema: editDeviceFormSchemaEdit.value,
|
||||
showCollapseButton: false,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
@ -120,7 +120,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
const api = isEdit ? postMetersUpdate : postMetersCreate;
|
||||
const api = isEdit ? postDeviceInfoUpdate : postDeviceInfoCreate;
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
|
||||
@ -165,7 +165,7 @@ function onDel(row: any) {
|
||||
Modal.confirm({
|
||||
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
|
||||
onOk: async () => {
|
||||
const result = await postMetersDelete({ body: { id: row.id } });
|
||||
const result = await postDeviceInfoDelete({ body: { id: row.id } });
|
||||
if (result) {
|
||||
gridApi.reload();
|
||||
Message.success($t('common.deleteSuccess'));
|
||||
@ -189,7 +189,7 @@ const toStatusData = (row: Record<string, any>) => {
|
||||
};
|
||||
// 档案下发
|
||||
const archivesIssued = async (row: Record<string, any>) => {
|
||||
const result = await postMetersArchivesDown({
|
||||
const result = await postDeviceInfoArchivesDown({
|
||||
body: {
|
||||
meterAddress: row.meterAddress,
|
||||
meterType: row.meterType,
|
||||
@ -284,14 +284,14 @@ const openAddModal = async () => {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.pointData'),
|
||||
label: $t('abp.DeviceInfo.pointData'),
|
||||
icon: 'ant-design:profile-outlined',
|
||||
type: 'primary',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
onClick: toStatusData.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.archivesIssued'),
|
||||
label: $t('abp.DeviceInfo.archivesIssued'),
|
||||
icon: 'ant-design:cloud-download-outlined',
|
||||
type: 'primary',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
|
||||
@ -9,109 +9,92 @@ import { $t } from '#/locales';
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterAddress',
|
||||
label: $t('abp.meters.meterAddress'),
|
||||
fieldName: 'deviceAddress',
|
||||
label: $t('abp.deviceInfos.deviceAddress'),
|
||||
},
|
||||
]);
|
||||
export const meterTypeOptions = [
|
||||
{
|
||||
label: $t('abp.meters.ElectricityMeter'),
|
||||
label: $t('abp.deviceInfos.ElectricityMeter'),
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.waterMeter'),
|
||||
label: $t('abp.deviceInfos.waterMeter'),
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.GasMeter'),
|
||||
label: $t('abp.deviceInfos.GasMeter'),
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.HeatMeter'),
|
||||
label: $t('abp.deviceInfos.HeatMeter'),
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.WaterMeterFlowmeter'),
|
||||
label: $t('abp.deviceInfos.WaterMeterFlowmeter'),
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.GasMeterFlowmeter'),
|
||||
label: $t('abp.deviceInfos.GasMeterFlowmeter'),
|
||||
value: 6,
|
||||
},
|
||||
];
|
||||
export const rateOptions = [
|
||||
{
|
||||
label: $t('abp.meters.MultipleRate'),
|
||||
label: $t('abp.deviceInfos.MultipleRate'),
|
||||
value: false,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.SingleRate'),
|
||||
label: $t('abp.deviceInfos.SingleRate'),
|
||||
value: true,
|
||||
},
|
||||
];
|
||||
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
||||
{ field: 'meterName', title: $t('abp.meters.meterName'), minWidth: '150' },
|
||||
{
|
||||
field: 'meterAddress',
|
||||
title: $t('abp.meters.meterAddress'),
|
||||
field: 'deviceName',
|
||||
title: $t('abp.deviceInfos.deviceName'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'meterType',
|
||||
title: $t('abp.meters.meterType'),
|
||||
field: 'deviceAddress',
|
||||
title: $t('abp.deviceInfos.deviceAddress'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isMeterType' },
|
||||
},
|
||||
{
|
||||
field: 'dynamicPassword',
|
||||
title: $t('abp.meters.dynamicPassword'),
|
||||
field: 'ioTPlatform',
|
||||
title: $t('abp.deviceInfos.ioTPlatform'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isDynamicPassword' },
|
||||
},
|
||||
{
|
||||
field: 'password',
|
||||
title: $t('abp.meters.password'),
|
||||
field: 'ioTPlatformName',
|
||||
title: $t('abp.deviceInfos.ioTPlatformName'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'ioTPlatformDeviceOpenInfo',
|
||||
title: $t('abp.deviceInfos.ioTPlatformDeviceOpenInfo'),
|
||||
minWidth: '100',
|
||||
},
|
||||
{
|
||||
field: 'singleRate',
|
||||
title: $t('abp.meters.singleRate'),
|
||||
field: 'platformPassword',
|
||||
title: $t('abp.deviceInfos.platformPassword'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isSingleRate' },
|
||||
},
|
||||
{
|
||||
field: 'selfDevelop',
|
||||
title: $t('abp.meters.selfDevelop'),
|
||||
field: 'ioTPlatformProductName',
|
||||
title: $t('abp.deviceInfos.ioTPlatformProductName'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isSelfDevelop' },
|
||||
},
|
||||
{ field: 'brandType', title: $t('abp.meters.brandType'), minWidth: '150' },
|
||||
{
|
||||
field: 'archiveStatus',
|
||||
title: $t('abp.meters.archiveStatus'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isArchiveStatus' },
|
||||
},
|
||||
{
|
||||
field: 'tripState',
|
||||
title: $t('abp.meters.tripState'),
|
||||
field: 'ioTPlatformAccountName',
|
||||
title: $t('abp.deviceInfos.ioTPlatformAccountName'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isTripState' },
|
||||
},
|
||||
{ field: 'timesA', title: $t('abp.meters.timesA'), minWidth: '100' },
|
||||
{ field: 'timev', title: $t('abp.meters.timev'), minWidth: '100' },
|
||||
{
|
||||
field: 'haveValve',
|
||||
title: $t('abp.meters.haveValve'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isHaveValve' },
|
||||
},
|
||||
{
|
||||
field: 'enabled',
|
||||
title: $t('common.isEnable'),
|
||||
field: 'ioTPlatformResponse',
|
||||
title: $t('abp.deviceInfos.ioTPlatformResponse'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isEnable' },
|
||||
},
|
||||
{
|
||||
title: $t('common.action'),
|
||||
@ -122,199 +105,55 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
},
|
||||
]);
|
||||
|
||||
export const addUserFormSchema: any = computed(() => [
|
||||
export const addDeviceFormSchema: any = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterName',
|
||||
label: $t('abp.meters.meterName'),
|
||||
fieldName: 'deviceAddress',
|
||||
label: $t('abp.deviceInfos.deviceAddress'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.meters.meterName')}`,
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.deviceAddress')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterAddress',
|
||||
label: $t('abp.meters.meterAddress'),
|
||||
rules: z
|
||||
.string()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.numberType')}${$t('abp.meters.meterAddress')}`,
|
||||
})
|
||||
.refine((value) => /^\d+$/.test(value), {
|
||||
message: $t('abp.meters.checkmeterAddress'),
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: meterTypeOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
},
|
||||
fieldName: 'meterType',
|
||||
label: $t('abp.meters.meterType'),
|
||||
rules: z
|
||||
.number()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
})
|
||||
.default(1),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: rateOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.singleRate')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
rules(values: any) {
|
||||
if (values.meterType === 1) {
|
||||
return 'required';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'singleRate',
|
||||
label: $t('abp.meters.singleRate'),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'selfDevelop',
|
||||
label: $t('abp.meters.selfDevelop'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'brandType',
|
||||
label: $t('abp.meters.brandType'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'dynamicPassword',
|
||||
label: $t('abp.meters.dynamicPassword'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'password',
|
||||
label: $t('abp.meters.password'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 2;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'haveValve',
|
||||
label: $t('abp.meters.haveValve'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timesA',
|
||||
label: $t('abp.meters.timesA'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timev',
|
||||
label: $t('abp.meters.timev'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timev')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meteringCode',
|
||||
label: $t('abp.meters.meteringCode'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
})
|
||||
.default('1'),
|
||||
fieldName: 'platformPassword',
|
||||
label: $t('abp.deviceInfos.platformPassword'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.platformPassword')}`,
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
export const editUserFormSchemaEdit: any = computed(() => [
|
||||
export const editDeviceFormSchemaEdit: any = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterName',
|
||||
label: $t('abp.meters.meterName'),
|
||||
fieldName: 'deviceAddress',
|
||||
label: $t('abp.deviceInfos.deviceAddress'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.meters.meterName')}`,
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.deviceInfos.deviceAddress')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterAddress',
|
||||
label: $t('abp.meters.meterAddress'),
|
||||
rules: z
|
||||
.string()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.numberType')}${$t('abp.meters.meterAddress')}`,
|
||||
})
|
||||
.refine((value) => /^\d+$/.test(value), {
|
||||
message: $t('abp.meters.checkmeterAddress'),
|
||||
}),
|
||||
fieldName: 'platformPassword',
|
||||
label: $t('abp.deviceInfos.platformPassword'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.deviceInfos.platformPassword')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: meterTypeOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.meterType')}`,
|
||||
},
|
||||
fieldName: 'meterType',
|
||||
label: $t('abp.meters.meterType'),
|
||||
label: $t('abp.deviceInfos.meterType'),
|
||||
rules: z
|
||||
.number()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
message: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.meterType')}`,
|
||||
})
|
||||
.default(1),
|
||||
},
|
||||
@ -323,7 +162,7 @@ export const editUserFormSchemaEdit: any = computed(() => [
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: rateOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.singleRate')}`,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.deviceInfos.singleRate')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
@ -338,7 +177,7 @@ export const editUserFormSchemaEdit: any = computed(() => [
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'singleRate',
|
||||
label: $t('abp.meters.singleRate'),
|
||||
label: $t('abp.deviceInfos.singleRate'),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
@ -346,12 +185,12 @@ export const editUserFormSchemaEdit: any = computed(() => [
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'selfDevelop',
|
||||
label: $t('abp.meters.selfDevelop'),
|
||||
label: $t('abp.deviceInfos.selfDevelop'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'brandType',
|
||||
label: $t('abp.meters.brandType'),
|
||||
label: $t('abp.deviceInfos.brandType'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
@ -360,12 +199,12 @@ export const editUserFormSchemaEdit: any = computed(() => [
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'dynamicPassword',
|
||||
label: $t('abp.meters.dynamicPassword'),
|
||||
label: $t('abp.deviceInfos.dynamicPassword'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'password',
|
||||
label: $t('abp.meters.password'),
|
||||
label: $t('abp.deviceInfos.password'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
@ -380,15 +219,15 @@ export const editUserFormSchemaEdit: any = computed(() => [
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'haveValve',
|
||||
label: $t('abp.meters.haveValve'),
|
||||
label: $t('abp.deviceInfos.haveValve'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timesA',
|
||||
label: $t('abp.meters.timesA'),
|
||||
label: $t('abp.deviceInfos.timesA'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.timesA')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
@ -398,17 +237,17 @@ export const editUserFormSchemaEdit: any = computed(() => [
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.timesA')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timev',
|
||||
label: $t('abp.meters.timev'),
|
||||
label: $t('abp.deviceInfos.timev'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timev')}`,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.timev')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
@ -418,21 +257,21 @@ export const editUserFormSchemaEdit: any = computed(() => [
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timev')}`,
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.timev')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meteringCode',
|
||||
label: $t('abp.meters.meteringCode'),
|
||||
label: $t('abp.deviceInfos.meteringCode'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.meteringCode')}`,
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.deviceInfos.meteringCode')}`,
|
||||
})
|
||||
.min(1, {
|
||||
message: `${$t('common.MustGreaterTthan0')}`,
|
||||
|
||||
@ -1,279 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { h, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message as Message, Modal, Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
postFocusesCreate,
|
||||
postFocusesDelete,
|
||||
postFocusesPage,
|
||||
postFocusesUpdate,
|
||||
} from '#/api-client';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import {
|
||||
addUserFormSchema,
|
||||
editUserFormSchemaEdit,
|
||||
querySchema,
|
||||
tableSchema,
|
||||
} from './schema';
|
||||
|
||||
defineOptions({
|
||||
name: 'AbpUser',
|
||||
});
|
||||
const router = useRouter();
|
||||
const formOptions: VbenFormProps = {
|
||||
schema: querySchema.value,
|
||||
};
|
||||
const gridOptions: VxeGridProps<any> = {
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
labelField: 'name',
|
||||
},
|
||||
columns: tableSchema.value,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
toolbarConfig: {
|
||||
custom: true,
|
||||
},
|
||||
customConfig: {
|
||||
storage: true,
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
const { data } = await postFocusesPage({
|
||||
body: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||
|
||||
const editRow: Record<string, any> = ref({});
|
||||
const [UserModal, userModalApi] = useVbenModal({
|
||||
draggable: true,
|
||||
onConfirm: submit,
|
||||
onBeforeClose: () => {
|
||||
editRow.value = {};
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
const [AddForm, addFormApi] = useVbenForm({
|
||||
// 默认展开
|
||||
collapsed: false,
|
||||
// 所有表单项共用,可单独在表单内覆盖
|
||||
commonConfig: {
|
||||
labelWidth: 110,
|
||||
componentProps: {
|
||||
class: 'w-4/5',
|
||||
},
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: addUserFormSchema.value,
|
||||
showCollapseButton: false,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const [EditForm, editFormApi] = useVbenForm({
|
||||
// 默认展开
|
||||
collapsed: false,
|
||||
// 所有表单项共用,可单独在表单内覆盖
|
||||
commonConfig: {
|
||||
labelWidth: 110,
|
||||
componentProps: {
|
||||
class: 'w-4/5',
|
||||
},
|
||||
},
|
||||
// 提交函数
|
||||
layout: 'horizontal',
|
||||
schema: editUserFormSchemaEdit.value,
|
||||
showCollapseButton: false,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
// 新增和编辑提交的逻辑
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
const api = isEdit ? postFocusesUpdate : postFocusesCreate;
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
|
||||
const formValues = await formApi.getValues();
|
||||
const fetchParams: any = isEdit
|
||||
? {
|
||||
id: editRow.value.id,
|
||||
...formValues,
|
||||
}
|
||||
: formValues;
|
||||
|
||||
try {
|
||||
userModalApi.setState({ loading: true, confirmLoading: true });
|
||||
const resp = await api({ body: fetchParams });
|
||||
if (resp.data) {
|
||||
Message.success(
|
||||
editRow.value.id ? $t('common.editSuccess') : $t('common.addSuccess'),
|
||||
);
|
||||
userModalApi.close();
|
||||
gridApi.reload();
|
||||
} else {
|
||||
Message.error(
|
||||
editRow.value.id ? $t('common.editFail') : $t('common.addFail'),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
userModalApi.setState({ loading: false, confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
async function onEdit(record: any) {
|
||||
editRow.value = record;
|
||||
userModalApi.open();
|
||||
editFormApi.setValues({ ...record });
|
||||
}
|
||||
|
||||
function onDel(row: any) {
|
||||
Modal.confirm({
|
||||
title: `${$t('common.confirmDelete')}${row.name} ?`,
|
||||
onOk: async () => {
|
||||
const result = await postFocusesDelete({ body: { id: row.id } });
|
||||
if (result) {
|
||||
gridApi.reload();
|
||||
Message.success($t('common.deleteSuccess'));
|
||||
} else {
|
||||
Message.error($t('common.deleteFail'));
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const toStatusData = (row: Record<string, any>) => {
|
||||
// 或者使用编程式导航
|
||||
router.push({
|
||||
path: '/iotdb/deviceData',
|
||||
query: {
|
||||
DeviceType: 10,
|
||||
DeviceId: row.focusId,
|
||||
FocusAddress: row.focusAddress,
|
||||
SystemName: row.businessSystemName,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const onLock = async (row: Record<string, any>) => {
|
||||
await postFocusesUpdate({
|
||||
body: {
|
||||
id: row.id,
|
||||
name: row.name,
|
||||
focusAddress: row.focusAddress,
|
||||
enabled: !row.enabled,
|
||||
},
|
||||
});
|
||||
gridApi.reload();
|
||||
};
|
||||
|
||||
const openAddModal = async () => {
|
||||
editRow.value = {};
|
||||
userModalApi.open();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<Grid>
|
||||
<template #toolbar-actions>
|
||||
<TableAction :actions="[
|
||||
{
|
||||
label: $t('common.add'),
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
onClick: openAddModal.bind(null),
|
||||
auth: ['AbpIdentity.Users.Create'],
|
||||
},
|
||||
]" />
|
||||
</template>
|
||||
|
||||
<template #isSelfDevelop="{ row }">
|
||||
<component :is="h(Tag, { color: row.selfDevelop ? 'green' : 'red' }, () =>
|
||||
row.selfDevelop ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
" />
|
||||
</template>
|
||||
<template #isStatus="{ row }">
|
||||
<component :is="h(Tag, { color: row.status ? 'green' : 'red' }, () =>
|
||||
row.status ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
" />
|
||||
</template>
|
||||
<template #isEnable="{ row }">
|
||||
<component :is="h(Tag, { color: row.enabled ? 'green' : 'red' }, () =>
|
||||
row.enabled ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
" />
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<TableAction :actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Update'],
|
||||
onClick: onEdit.bind(null, row),
|
||||
},
|
||||
]" :drop-down-actions="[
|
||||
{
|
||||
label: row.enabled ? $t('common.disabled') : $t('common.enabled'),
|
||||
icon: `ant-design:${row.enabled ? 'close' : 'check'}-outlined`,
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Enable'],
|
||||
onClick: onLock.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
icon: 'ant-design:delete-outlined',
|
||||
type: 'primary',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
popConfirm: {
|
||||
title: $t('common.askConfirmDelete'),
|
||||
confirm: onDel.bind(null, row),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: $t('abp.focus.statusData'),
|
||||
icon: 'ant-design:profile-outlined',
|
||||
type: 'primary',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
onClick: toStatusData.bind(null, row),
|
||||
},
|
||||
]" />
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
<UserModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
|
||||
<component :is="editRow.id ? EditForm : AddForm" />
|
||||
</UserModal>
|
||||
</Page>
|
||||
</template>
|
||||
@ -1,216 +0,0 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { z } from '@vben/common-ui';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'focusAddress',
|
||||
label: $t('abp.focus.focusAddress'),
|
||||
},
|
||||
]);
|
||||
|
||||
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
||||
{ field: 'name', title: $t('abp.focus.name'), minWidth: '150' },
|
||||
{
|
||||
field: 'focusAddress',
|
||||
title: $t('abp.focus.focusAddress'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{ field: 'focusCode', title: $t('abp.focus.focusCode'), minWidth: '150' },
|
||||
{
|
||||
field: 'selfDevelop',
|
||||
title: $t('abp.focus.selfDevelop'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isSelfDevelop' },
|
||||
},
|
||||
{
|
||||
field: 'enabled',
|
||||
title: $t('common.isEnable'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isEnable' },
|
||||
},
|
||||
{ field: 'apn', title: $t('abp.focus.apn'), minWidth: '100' },
|
||||
{
|
||||
field: 'masterStation',
|
||||
title: $t('abp.focus.masterStation'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: $t('abp.focus.status'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isStatus' },
|
||||
},
|
||||
{
|
||||
field: 'heartbeatInterval',
|
||||
title: $t('abp.focus.heartbeatInterval'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'lastRefreshTime',
|
||||
title: $t('abp.focus.lastRefreshTime'),
|
||||
minWidth: '150',
|
||||
formatter: ({ cellValue }) => {
|
||||
return cellValue ? dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss') : '-';
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'deviceNo',
|
||||
title: $t('abp.focus.deviceNo'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
title: $t('common.action'),
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
width: '150',
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
]);
|
||||
|
||||
export const addUserFormSchema: any = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {},
|
||||
fieldName: 'name',
|
||||
label: $t('abp.focus.name'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.focus.name')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {},
|
||||
fieldName: 'focusAddress',
|
||||
label: $t('abp.focus.focusAddress'),
|
||||
rules: z
|
||||
.string()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.focus.focusAddress')}`,
|
||||
})
|
||||
.refine((value) => value.length === 9, {
|
||||
message: $t('abp.focus.checkFocusAddress'),
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'selfDevelop',
|
||||
label: $t('abp.focus.selfDevelop'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {},
|
||||
fieldName: 'focusCode',
|
||||
label: $t('abp.focus.focusCode'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {},
|
||||
fieldName: 'apn',
|
||||
label: $t('abp.focus.apn'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'enabled',
|
||||
label: $t('common.isEnable'),
|
||||
},
|
||||
// {
|
||||
// component: 'Input',
|
||||
// componentProps: {},
|
||||
// fieldName: 'phoneNumber',
|
||||
// label: $t('abp.focus.phone'),
|
||||
// rules: z
|
||||
// .string()
|
||||
// .min(1, { message: $t('common.pleaseInput') + $t('abp.focus.phone') }),
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// componentProps: {},
|
||||
// fieldName: 'password',
|
||||
// label: $t('abp.focus.password'),
|
||||
// rules: z
|
||||
// .string()
|
||||
// .min(1, { message: $t('common.pleaseInput') + $t('abp.focus.password') }),
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// componentProps: {},
|
||||
// fieldName: 'confirmPassword',
|
||||
// label: $t('abp.focus.comfirmPassword'),
|
||||
// rules: z.string().min(1, {
|
||||
// message: $t('common.pleaseInput') + $t('abp.focus.comfirmPassword'),
|
||||
// }),
|
||||
// },
|
||||
]);
|
||||
|
||||
export const editUserFormSchemaEdit: any = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {},
|
||||
fieldName: 'name',
|
||||
label: $t('abp.focus.name'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.focus.name')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {},
|
||||
fieldName: 'focusAddress',
|
||||
label: $t('abp.focus.focusAddress'),
|
||||
rules: z
|
||||
.string()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.focus.focusAddress')}`,
|
||||
})
|
||||
.refine((value) => value.length === 9, {
|
||||
message: $t('abp.focus.checkFocusAddress'),
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'selfDevelop',
|
||||
label: $t('abp.focus.selfDevelop'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {},
|
||||
fieldName: 'focusCode',
|
||||
label: $t('abp.focus.focusCode'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {},
|
||||
fieldName: 'apn',
|
||||
label: $t('abp.focus.apn'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'enabled',
|
||||
label: $t('common.isEnable'),
|
||||
},
|
||||
]);
|
||||
@ -2,31 +2,26 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { h, ref } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message as Message, Modal, Tag } from 'ant-design-vue';
|
||||
import { message as Message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
postMetersArchivesDown,
|
||||
postMetersCreate,
|
||||
postMetersDelete,
|
||||
postMetersPage,
|
||||
postMetersUpdate,
|
||||
postOneNETAccountCreate,
|
||||
postOneNETAccountInfoPage,
|
||||
} from '#/api-client';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import {
|
||||
addUserFormSchema,
|
||||
editUserFormSchemaEdit,
|
||||
meterTypeOptions,
|
||||
addAccountFormSchema,
|
||||
editAccountFormSchemaEdit,
|
||||
querySchema,
|
||||
rateOptions,
|
||||
tableSchema,
|
||||
} from './schema';
|
||||
|
||||
@ -56,7 +51,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
const { data } = await postMetersPage({
|
||||
const { data } = await postOneNETAccountInfoPage({
|
||||
body: {
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@ -92,7 +87,7 @@ const [AddForm, addFormApi] = useVbenForm({
|
||||
},
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: addUserFormSchema.value,
|
||||
schema: addAccountFormSchema.value,
|
||||
showCollapseButton: false,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
@ -110,7 +105,7 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
},
|
||||
// 提交函数
|
||||
layout: 'horizontal',
|
||||
schema: editUserFormSchemaEdit.value,
|
||||
schema: editAccountFormSchemaEdit.value,
|
||||
showCollapseButton: false,
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
@ -120,21 +115,21 @@ const [EditForm, editFormApi] = useVbenForm({
|
||||
async function submit() {
|
||||
const isEdit = !!editRow.value.id;
|
||||
const formApi = isEdit ? editFormApi : addFormApi;
|
||||
const api = isEdit ? postMetersUpdate : postMetersCreate;
|
||||
const api = postOneNETAccountCreate;
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) return;
|
||||
|
||||
const formValues = await formApi.getValues();
|
||||
const fetchParams: any = isEdit
|
||||
? {
|
||||
id: editRow.value.id,
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
}
|
||||
id: editRow.value.id,
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
}
|
||||
: {
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
};
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
};
|
||||
|
||||
try {
|
||||
userModalApi.setState({ loading: true, confirmLoading: true });
|
||||
@ -161,47 +156,6 @@ async function onEdit(record: any) {
|
||||
editFormApi.setValues({ ...record });
|
||||
}
|
||||
|
||||
function onDel(row: any) {
|
||||
Modal.confirm({
|
||||
title: `${$t('common.confirmDelete')}${row.meterName} ?`,
|
||||
onOk: async () => {
|
||||
const result = await postMetersDelete({ body: { id: row.id } });
|
||||
if (result) {
|
||||
gridApi.reload();
|
||||
Message.success($t('common.deleteSuccess'));
|
||||
} else {
|
||||
Message.error($t('common.deleteFail'));
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
const toStatusData = (row: Record<string, any>) => {
|
||||
// 或者使用编程式导航
|
||||
router.push({
|
||||
path: '/iotdb/point',
|
||||
query: {
|
||||
DeviceType: row.meterType,
|
||||
DeviceId: row.meterId,
|
||||
FocusAddress: row.focusAddress,
|
||||
},
|
||||
});
|
||||
};
|
||||
// 档案下发
|
||||
const archivesIssued = async (row: Record<string, any>) => {
|
||||
const result = await postMetersArchivesDown({
|
||||
body: {
|
||||
meterAddress: row.meterAddress,
|
||||
meterType: row.meterType,
|
||||
focusAddress: row.focusAddress,
|
||||
},
|
||||
});
|
||||
if (result) {
|
||||
gridApi.reload();
|
||||
Message.success($t('common.success'));
|
||||
} else {
|
||||
Message.error($t('common.error'));
|
||||
}
|
||||
};
|
||||
const openAddModal = async () => {
|
||||
editRow.value = {};
|
||||
userModalApi.open();
|
||||
@ -212,82 +166,27 @@ const openAddModal = async () => {
|
||||
<Page auto-content-height>
|
||||
<Grid>
|
||||
<template #toolbar-actions>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.add'),
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
onClick: openAddModal.bind(null),
|
||||
auth: ['AbpIdentity.Users.Create'],
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #isMeterType="{ row }">
|
||||
{{ meterTypeOptions[row.meterType - 1]?.label }}
|
||||
</template>
|
||||
<template #isSingleRate="{ row }">
|
||||
{{ rateOptions.find((item) => item.value === row.singleRate)?.label }}
|
||||
</template>
|
||||
<template #isArchiveStatus="{ row }">
|
||||
{{
|
||||
row.archiveStatus ? $t('common.Issued') : $t('common.Undistributed')
|
||||
}}
|
||||
</template>
|
||||
<template #isTripState="{ row }">
|
||||
{{ row.tripState ? $t('common.SwitchOff') : $t('common.Closing') }}
|
||||
</template>
|
||||
<template #isHaveValve="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.haveValve ? 'green' : 'red' }, () =>
|
||||
row.haveValve ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #isSelfDevelop="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.selfDevelop ? 'green' : 'red' }, () =>
|
||||
row.selfDevelop ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #isDynamicPassword="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.dynamicPassword ? 'green' : 'red' }, () =>
|
||||
row.dynamicPassword ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #isEnable="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.enabled ? 'green' : 'red' }, () =>
|
||||
row.enabled ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
<TableAction :actions="[
|
||||
{
|
||||
label: $t('common.add'),
|
||||
type: 'primary',
|
||||
icon: 'ant-design:plus-outlined',
|
||||
onClick: openAddModal.bind(null),
|
||||
auth: ['AbpIdentity.Users.Create'],
|
||||
},
|
||||
]" />
|
||||
</template>
|
||||
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Update'],
|
||||
onClick: onEdit.bind(null, row),
|
||||
},
|
||||
]"
|
||||
:drop-down-actions="[
|
||||
<TableAction :actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'link',
|
||||
size: 'small',
|
||||
auth: ['AbpIdentity.Users.Update'],
|
||||
onClick: onEdit.bind(null, row),
|
||||
},
|
||||
]" :drop-down-actions="[
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
icon: 'ant-design:delete-outlined',
|
||||
@ -299,27 +198,23 @@ const openAddModal = async () => {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.pointData'),
|
||||
label: $t('abp.Account.pointData'),
|
||||
icon: 'ant-design:profile-outlined',
|
||||
type: 'primary',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
onClick: toStatusData.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.archivesIssued'),
|
||||
label: $t('abp.Account.archivesIssued'),
|
||||
icon: 'ant-design:cloud-download-outlined',
|
||||
type: 'primary',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
onClick: archivesIssued.bind(null, row),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
]" />
|
||||
</template>
|
||||
</Grid>
|
||||
<UserModal
|
||||
:title="editRow.id ? $t('common.edit') : $t('common.add')"
|
||||
class="w-[800px]"
|
||||
>
|
||||
<UserModal :title="editRow.id ? $t('common.edit') : $t('common.add')" class="w-[800px]">
|
||||
<component :is="editRow.id ? EditForm : AddForm" />
|
||||
</UserModal>
|
||||
</Page>
|
||||
|
||||
@ -9,109 +9,37 @@ import { $t } from '#/locales';
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterAddress',
|
||||
label: $t('abp.meters.meterAddress'),
|
||||
fieldName: 'phoneNumber',
|
||||
label: $t('abp.OneNETManagement.PhoneNumber'),
|
||||
},
|
||||
]);
|
||||
export const meterTypeOptions = [
|
||||
{
|
||||
label: $t('abp.meters.ElectricityMeter'),
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.waterMeter'),
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.GasMeter'),
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.HeatMeter'),
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.WaterMeterFlowmeter'),
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.GasMeterFlowmeter'),
|
||||
value: 6,
|
||||
},
|
||||
];
|
||||
export const rateOptions = [
|
||||
{
|
||||
label: $t('abp.meters.MultipleRate'),
|
||||
value: false,
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.SingleRate'),
|
||||
value: true,
|
||||
},
|
||||
];
|
||||
|
||||
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
||||
{ field: 'meterName', title: $t('abp.meters.meterName'), minWidth: '150' },
|
||||
{
|
||||
field: 'meterAddress',
|
||||
title: $t('abp.meters.meterAddress'),
|
||||
field: 'accountId',
|
||||
title: $t('abp.OneNETManagement.AccountId'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'meterType',
|
||||
title: $t('abp.meters.meterType'),
|
||||
field: 'accountName',
|
||||
title: $t('abp.OneNETManagement.AccountName'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isMeterType' },
|
||||
},
|
||||
{
|
||||
field: 'dynamicPassword',
|
||||
title: $t('abp.meters.dynamicPassword'),
|
||||
field: 'phoneNumber',
|
||||
title: $t('abp.OneNETManagement.PhoneNumber'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isDynamicPassword' },
|
||||
},
|
||||
{
|
||||
field: 'password',
|
||||
title: $t('abp.meters.password'),
|
||||
minWidth: '100',
|
||||
field: 'accesskey',
|
||||
title: $t('abp.OneNETManagement.AccountAccesskey'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'singleRate',
|
||||
title: $t('abp.meters.singleRate'),
|
||||
field: 'productCount',
|
||||
title: $t('abp.OneNETManagement.ProductCount'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isSingleRate' },
|
||||
},
|
||||
{
|
||||
field: 'selfDevelop',
|
||||
title: $t('abp.meters.selfDevelop'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isSelfDevelop' },
|
||||
},
|
||||
{ field: 'brandType', title: $t('abp.meters.brandType'), minWidth: '150' },
|
||||
{
|
||||
field: 'archiveStatus',
|
||||
title: $t('abp.meters.archiveStatus'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isArchiveStatus' },
|
||||
},
|
||||
{
|
||||
field: 'tripState',
|
||||
title: $t('abp.meters.tripState'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isTripState' },
|
||||
},
|
||||
{ field: 'timesA', title: $t('abp.meters.timesA'), minWidth: '100' },
|
||||
{ field: 'timev', title: $t('abp.meters.timev'), minWidth: '100' },
|
||||
{
|
||||
field: 'haveValve',
|
||||
title: $t('abp.meters.haveValve'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isHaveValve' },
|
||||
},
|
||||
{
|
||||
field: 'enabled',
|
||||
title: $t('common.isEnable'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isEnable' },
|
||||
},
|
||||
{
|
||||
title: $t('common.action'),
|
||||
@ -122,165 +50,47 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
},
|
||||
]);
|
||||
|
||||
export const addUserFormSchema: any = computed(() => [
|
||||
export const addAccountFormSchema: any = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterName',
|
||||
label: $t('abp.meters.meterName'),
|
||||
fieldName: 'accountId',
|
||||
label: $t('abp.OneNETManagement.AccountId'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.meters.meterName')}`,
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.AccountId')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterAddress',
|
||||
label: $t('abp.meters.meterAddress'),
|
||||
fieldName: 'accountName',
|
||||
label: $t('abp.OneNETManagement.AccountName'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.AccountName')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'accountAccesskey',
|
||||
label: $t('abp.OneNETManagement.AccountAccesskey'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.OneNETManagement.AccountAccesskey')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'phoneNumber',
|
||||
label: $t('abp.OneNETManagement.PhoneNumber'),
|
||||
rules: z
|
||||
.string()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.numberType')}${$t('abp.meters.meterAddress')}`,
|
||||
message: `${$t('common.pleaseInput')}${$t('common.numberType')}${$t('abp.OneNETManagement.PhoneNumber')}`,
|
||||
})
|
||||
.refine((value) => /^\d+$/.test(value), {
|
||||
message: $t('abp.meters.checkmeterAddress'),
|
||||
message: $t('abp.OneNETManagement.PhoneNumber'),
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: meterTypeOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
},
|
||||
fieldName: 'meterType',
|
||||
label: $t('abp.meters.meterType'),
|
||||
rules: z
|
||||
.number()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
})
|
||||
.default(1),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: rateOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.singleRate')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
rules(values: any) {
|
||||
if (values.meterType === 1) {
|
||||
return 'required';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'singleRate',
|
||||
label: $t('abp.meters.singleRate'),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'selfDevelop',
|
||||
label: $t('abp.meters.selfDevelop'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'brandType',
|
||||
label: $t('abp.meters.brandType'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'dynamicPassword',
|
||||
label: $t('abp.meters.dynamicPassword'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'password',
|
||||
label: $t('abp.meters.password'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 2;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'haveValve',
|
||||
label: $t('abp.meters.haveValve'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timesA',
|
||||
label: $t('abp.meters.timesA'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timev',
|
||||
label: $t('abp.meters.timev'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timev')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meteringCode',
|
||||
label: $t('abp.meters.meteringCode'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
]);
|
||||
|
||||
export const editUserFormSchemaEdit: any = computed(() => [
|
||||
export const editAccountFormSchemaEdit: any = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterName',
|
||||
@ -302,141 +112,4 @@ export const editUserFormSchemaEdit: any = computed(() => [
|
||||
message: $t('abp.meters.checkmeterAddress'),
|
||||
}),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: meterTypeOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
},
|
||||
fieldName: 'meterType',
|
||||
label: $t('abp.meters.meterType'),
|
||||
rules: z
|
||||
.number()
|
||||
.min(1, {
|
||||
message: `${$t('common.pleaseSelect')}${$t('abp.meters.meterType')}`,
|
||||
})
|
||||
.default(1),
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: rateOptions,
|
||||
placeholder: `${$t('common.pleaseSelect')}${$t('abp.meters.singleRate')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
rules(values: any) {
|
||||
if (values.meterType === 1) {
|
||||
return 'required';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'singleRate',
|
||||
label: $t('abp.meters.singleRate'),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'selfDevelop',
|
||||
label: $t('abp.meters.selfDevelop'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'brandType',
|
||||
label: $t('abp.meters.brandType'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
fieldName: 'dynamicPassword',
|
||||
label: $t('abp.meters.dynamicPassword'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'password',
|
||||
label: $t('abp.meters.password'),
|
||||
rules: z.string().optional(),
|
||||
},
|
||||
{
|
||||
component: 'Switch',
|
||||
componentProps: {
|
||||
class: 'w-auto',
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 2;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
fieldName: 'haveValve',
|
||||
label: $t('abp.meters.haveValve'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timesA',
|
||||
label: $t('abp.meters.timesA'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timesA')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'timev',
|
||||
label: $t('abp.meters.timev'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.timev')}`,
|
||||
},
|
||||
dependencies: {
|
||||
show(values: any) {
|
||||
return values.meterType === 1;
|
||||
},
|
||||
triggerFields: ['meterType'],
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.timev')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meteringCode',
|
||||
label: $t('abp.meters.meteringCode'),
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
},
|
||||
rules: z
|
||||
.string({
|
||||
message: `${$t('common.pleaseInput')}${$t('abp.meters.meteringCode')}`,
|
||||
})
|
||||
.min(1, {
|
||||
message: `${$t('common.MustGreaterTthan0')}`,
|
||||
})
|
||||
.default('1'),
|
||||
},
|
||||
]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user