对接接口
This commit is contained in:
parent
382c772db6
commit
5bbda24d3a
@ -29,7 +29,8 @@ VITE_REFRESH_ROLE = true
|
||||
# VITE_WEBSOCKET_URL=http://182.43.18.151:44317/signalr/notification
|
||||
|
||||
# 后端接口地址
|
||||
VITE_APP_API_ADDRESS=http://localhost:44315
|
||||
VITE_APP_API_ADDRESS=http://47.110.53.196:28080
|
||||
# VITE_APP_API_ADDRESS=http://10.10.70.222:44333
|
||||
|
||||
# websocket地址
|
||||
VITE_WEBSOCKET_URL=http://localhost:44315/signalr/notification
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { Options } from '@hey-api/client-axios';
|
||||
import type { Options, OptionsLegacyParser } from '@hey-api/client-axios';
|
||||
|
||||
import type {
|
||||
GetApiAbpApiDefinitionData,
|
||||
@ -140,6 +140,8 @@ import type {
|
||||
PostFilesUploadData,
|
||||
PostFilesUploadError,
|
||||
PostFilesUploadResponse,
|
||||
PostFoucsCreateData,
|
||||
postFoucsUpdateData,
|
||||
PostGeneratorDownData,
|
||||
PostGeneratorDownError,
|
||||
PostGeneratorDownResponse,
|
||||
@ -193,6 +195,8 @@ import type {
|
||||
PostMenusUpdateResponse,
|
||||
PostMenusUserMenuError,
|
||||
PostMenusUserMenuResponse,
|
||||
postMetersArchivesIssued,
|
||||
PostMetersCreateData,
|
||||
PostNotificationBatchReadData,
|
||||
PostNotificationBatchReadError,
|
||||
PostNotificationBatchReadResponse,
|
||||
@ -2934,7 +2938,7 @@ export const postUsersResetTwoFactor = <ThrowOnError extends boolean = false>(
|
||||
export const postUsersNeedChangePassword = <
|
||||
ThrowOnError extends boolean = false,
|
||||
>(
|
||||
options?: Options<unknown, ThrowOnError>,
|
||||
options?: OptionsLegacyParser<unknown, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersNeedChangePasswordResponse,
|
||||
@ -2945,3 +2949,197 @@ export const postUsersNeedChangePassword = <
|
||||
url: '/Users/needChangePassword',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取集中器分页
|
||||
*/
|
||||
export const postFocusesPage = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostUsersPageData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostRolesAllResponse,
|
||||
PostRolesAllError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
// ...formDataBodySerializer,
|
||||
url: '/Focuses/Page',
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 创建集中器
|
||||
*/
|
||||
export const postFocusesCreate = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostFoucsCreateData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersCreateResponse,
|
||||
PostUsersCreateError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Focuses/Create',
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 编辑集中器
|
||||
*/
|
||||
export const postFocusesUpdate = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<postFoucsUpdateData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersUpdateResponse,
|
||||
PostUsersUpdateError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Focuses/Update',
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 删除集中器
|
||||
*/
|
||||
export const postFocusesDelete = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<PostUsersDeleteData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersDeleteResponse,
|
||||
PostUsersDeleteError,
|
||||
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',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 档案下发
|
||||
*/
|
||||
export const postMetersArchivesDown = <ThrowOnError extends boolean = false>(
|
||||
options?: Options<postMetersArchivesIssued, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostUsersDeleteResponse,
|
||||
PostUsersDeleteError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/Meters/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,
|
||||
>(
|
||||
options?: Options<PostUsersPageData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostRolesAllResponse,
|
||||
PostRolesAllError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/TableModel/PacketInfoPage',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取测点数据分页
|
||||
*/
|
||||
export const postTableModelDeviceDataInfoPage = <
|
||||
ThrowOnError extends boolean = false,
|
||||
>(
|
||||
options?: Options<PostUsersPageData, ThrowOnError>,
|
||||
) => {
|
||||
return (options?.client ?? client).post<
|
||||
PostRolesAllResponse,
|
||||
PostRolesAllError,
|
||||
ThrowOnError
|
||||
>({
|
||||
...options,
|
||||
url: '/TableModel/DeviceDataInfoPage',
|
||||
});
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -67,16 +67,35 @@
|
||||
},
|
||||
"log": {
|
||||
"loginTime": "Login Time",
|
||||
"userName": "UserName",
|
||||
"userName": "Username",
|
||||
"tenant": "Tenant",
|
||||
"executionTime": "Execution Time",
|
||||
"responseTime": "Response Time (ms)",
|
||||
"clientIp": "ClientIp",
|
||||
"clientIp": "Client IP",
|
||||
"exception": "Exception",
|
||||
"applicationName": "Application Name",
|
||||
"loginMode": "LoginMode",
|
||||
"loginUrl": "LoginUrl",
|
||||
"detail": "Detail"
|
||||
"loginMode": "Login Method",
|
||||
"loginUrl": "Login URL",
|
||||
"detail": "Details",
|
||||
"systemName": "System Name",
|
||||
"projectId": "Project ID",
|
||||
"dataType": "Data Type",
|
||||
"deviceType": "Device Type",
|
||||
"timestamps": "Timestamps",
|
||||
"manualOrNot": "Manual Operation",
|
||||
"isTimeout": "Timeout Status",
|
||||
"afn": "AFN Function Code",
|
||||
"fn": "Reading Function Code",
|
||||
"pn": "Reading Measurement Point",
|
||||
"itemCode": "Collection Item Code",
|
||||
"isSend": "Send Status",
|
||||
"sendNum": "Number of Sends",
|
||||
"nextSendTime": "Next Send Time",
|
||||
"issuedMessageHexString": "Issued Message (Hex)",
|
||||
"receivedMessageHexString": "Received Message (Hex)",
|
||||
"receivedTime": "Received Time",
|
||||
"isReceived": "Received Status",
|
||||
"receivedRemark": "Report Parsing Remarks"
|
||||
},
|
||||
"message": {
|
||||
"title": "Title",
|
||||
@ -159,5 +178,49 @@
|
||||
"componentType": "Component",
|
||||
"internalLink": "InternalLink",
|
||||
"externalLink": "ExternalLink"
|
||||
},
|
||||
"focus": {
|
||||
"name": "concentratorName",
|
||||
"focusAddress": "concentratorLocation",
|
||||
"selfDevelop": "selfDevelopedOrNot",
|
||||
"apn": "APN",
|
||||
"masterStation": "masterStation",
|
||||
"status": "OnlineStatus",
|
||||
"heartbeatInterval": "heartbeatInterval",
|
||||
"lastRefreshTime": "lastRefreshTime",
|
||||
"deviceNo": "deviceNo",
|
||||
"focusCode": "Self developed model",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,39 +3,49 @@
|
||||
"edit": "Edit",
|
||||
"delete": "Delete",
|
||||
"search": "Search",
|
||||
"save": "Save",
|
||||
"export": "Export",
|
||||
"save": "save",
|
||||
"seq": "Seq",
|
||||
"isEnable": "IsEnable",
|
||||
"isEnable": "Enabled Status",
|
||||
"enabled": "Enabled",
|
||||
"disabled": "Disabled",
|
||||
"seq": "Sequence",
|
||||
"action": "Action",
|
||||
"createTime": "Creation Time",
|
||||
"pleaseInput": "Please input",
|
||||
"addSuccess": "Add Success",
|
||||
"editSuccess": "Edit Success",
|
||||
"deleteSuccess": "Delete Success",
|
||||
"yes": "yes",
|
||||
"no": "no",
|
||||
"confirmDelete": "Confirm to delete",
|
||||
"askConfirmDelete": "Confirm to delete?",
|
||||
"warning": "warning",
|
||||
"info": "info",
|
||||
"error": "error",
|
||||
"pleaseSelect": "Please select",
|
||||
"addSuccess": "Added successfully!",
|
||||
"editSuccess": "Edited successfully!",
|
||||
"deleteSuccess": "Deleted successfully!",
|
||||
"addFail": "Failed to add!",
|
||||
"editFail": "Failed to edit!",
|
||||
"deleteFail": "Failed to delete!",
|
||||
"yes": "Yes",
|
||||
"no": "No",
|
||||
"confirmDelete": "Confirm deletion",
|
||||
"askConfirmDelete": "Are you sure to delete?",
|
||||
"warning": "Warning",
|
||||
"info": "Info",
|
||||
"error": "Error",
|
||||
"success": "Success",
|
||||
"keyword": "Keyword",
|
||||
"mesage403": "You don't have permission to access this page or function!",
|
||||
"mesage401": "You are not logged in or the login has timed out. Please log in again!",
|
||||
"mesage403": "You don't have permission to access this page or feature!",
|
||||
"mesage401": "Not logged in or session expired, please login again!",
|
||||
"mesage500": "Internal server error!",
|
||||
"mesage404": "The page you are trying to access does not exist!",
|
||||
"mesage404": "The page you requested does not exist!",
|
||||
"mesage400": "Request error!",
|
||||
"mesage405": "Incorrect request method!",
|
||||
"timeOut": "Request timed out!",
|
||||
"expandAll": "EexpandAll",
|
||||
"collapseAll": "CollapseAll",
|
||||
"description": "description",
|
||||
"comfirm": "Comfirm",
|
||||
"valid": "Valid",
|
||||
"mesage405": "Request method error!",
|
||||
"timeOut": "Request timeout!",
|
||||
"expandAll": "Expand all",
|
||||
"collapseAll": "Collapse all",
|
||||
"description": "Description",
|
||||
"comfirm": "Confirm",
|
||||
"valid": "Validate",
|
||||
"upload": "Upload",
|
||||
"download": "Download"
|
||||
"download": "Download",
|
||||
"numberType": "Number type",
|
||||
"Issued": "Issued",
|
||||
"Undistributed": "Undistributed",
|
||||
"SwitchOff": "Tripped",
|
||||
"Closing": "Closed",
|
||||
"MustGreaterTthan0": "Must be greater than 0"
|
||||
}
|
||||
|
||||
@ -76,7 +76,26 @@
|
||||
"applicationName": "应用名称",
|
||||
"loginMode": "登录方式",
|
||||
"loginUrl": "登录地址",
|
||||
"detail": "详情"
|
||||
"detail": "详情",
|
||||
"systemName": "系统名称",
|
||||
"projectId": "项目编码",
|
||||
"dataType": "数据类型",
|
||||
"deviceType": "设备类型",
|
||||
"timestamps": "时标",
|
||||
"manualOrNot": "是否手动操作",
|
||||
"isTimeout": "是否超时",
|
||||
"afn": "AFN功能码",
|
||||
"fn": "抄读功能码",
|
||||
"pn": "抄读计量点",
|
||||
"itemCode": "采集项编码",
|
||||
"isSend": "是否发送",
|
||||
"sendNum": "发送次数",
|
||||
"nextSendTime": "下次发送时间",
|
||||
"issuedMessageHexString": "下发消息内容",
|
||||
"receivedMessageHexString": "消息上报内容",
|
||||
"receivedTime": "消息上报时间",
|
||||
"isReceived": "是否已上报",
|
||||
"receivedRemark": "上报报文解析备注"
|
||||
},
|
||||
"message": {
|
||||
"title": "标题",
|
||||
@ -159,5 +178,49 @@
|
||||
"componentType": "组件",
|
||||
"internalLink": "内链",
|
||||
"externalLink": "外链"
|
||||
},
|
||||
"focus": {
|
||||
"name": "集中器名称",
|
||||
"focusAddress": "集中器地址",
|
||||
"selfDevelop": "是否自研",
|
||||
"apn": "APN",
|
||||
"masterStation": "主站",
|
||||
"status": "是否在线状态",
|
||||
"heartbeatInterval": "心跳间隔(分钟)",
|
||||
"lastRefreshTime": "最后一次刷新时间",
|
||||
"deviceNo": "设备编号",
|
||||
"focusCode": "自研型号",
|
||||
"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": "档案下发"
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,9 +12,13 @@
|
||||
"action": "操作",
|
||||
"createTime": "创建时间",
|
||||
"pleaseInput": "请输入",
|
||||
"pleaseSelect": "请选择",
|
||||
"addSuccess": "新增成功!",
|
||||
"editSuccess": "编辑成功!",
|
||||
"deleteSuccess": "删除成功!",
|
||||
"addFail": "新增失败!",
|
||||
"editFail": "编辑失败!",
|
||||
"deleteFail": "删除失败!",
|
||||
"yes": "是",
|
||||
"no": "否",
|
||||
"confirmDelete": "确认删除",
|
||||
@ -37,5 +41,11 @@
|
||||
"comfirm": "确认",
|
||||
"valid": "验证",
|
||||
"upload": "上传",
|
||||
"download": "下载"
|
||||
"download": "下载",
|
||||
"numberType": "数字类型",
|
||||
"Issued": "已下发",
|
||||
"Undistributed": "未下发",
|
||||
"SwitchOff": "跳闸",
|
||||
"Closing": "合闸",
|
||||
"MustGreaterTthan0": "必须大于0"
|
||||
}
|
||||
|
||||
102
apps/web-antd/src/views/dataManger/collectionLog/index.vue
Normal file
102
apps/web-antd/src/views/dataManger/collectionLog/index.vue
Normal file
@ -0,0 +1,102 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { h } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { postTableModelPacketInfoPage } from '#/api-client';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { querySchema, tableSchema } from './schema';
|
||||
|
||||
defineOptions({
|
||||
name: 'CollectionLog',
|
||||
});
|
||||
|
||||
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 postTableModelPacketInfoPage({
|
||||
body: {
|
||||
...formValues,
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const [Grid] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<Grid>
|
||||
<template #isdeviceType="{ row }">
|
||||
{{ row.deviceType }}
|
||||
</template>
|
||||
<template #ismanualOrNot="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.manualOrNot ? 'green' : 'red' }, () =>
|
||||
row.manualOrNot ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #isTimeout="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.isTimeout ? 'green' : 'red' }, () =>
|
||||
row.isTimeout ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #isSend="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.isSend ? 'green' : 'red' }, () =>
|
||||
row.isSend ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #isReceived="{ row }">
|
||||
<component
|
||||
:is="
|
||||
h(Tag, { color: row.isReceived ? 'green' : 'red' }, () =>
|
||||
row.isReceived ? $t('common.yes') : $t('common.no'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
107
apps/web-antd/src/views/dataManger/collectionLog/schema.ts
Normal file
107
apps/web-antd/src/views/dataManger/collectionLog/schema.ts
Normal file
@ -0,0 +1,107 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'focusAddress',
|
||||
label: $t('abp.focus.focusAddress'),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterAddress',
|
||||
label: $t('abp.meters.meterAddress'),
|
||||
},
|
||||
]);
|
||||
|
||||
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
||||
{ field: 'systemName', title: $t('abp.log.systemName'), minWidth: '150' },
|
||||
{
|
||||
field: 'projectId',
|
||||
title: $t('abp.log.projectId'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'meterAddress',
|
||||
title: $t('abp.meters.meterAddress'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'focusAddress',
|
||||
title: $t('abp.focus.focusAddress'),
|
||||
minWidth: '100',
|
||||
},
|
||||
{
|
||||
field: 'deviceType',
|
||||
title: $t('abp.log.deviceType'),
|
||||
minWidth: '100',
|
||||
slots: { default: 'isdeviceType' },
|
||||
},
|
||||
{
|
||||
field: 'timestamps',
|
||||
title: $t('abp.log.timestamps'),
|
||||
minWidth: '100',
|
||||
},
|
||||
{
|
||||
field: 'manualOrNot',
|
||||
title: $t('abp.log.manualOrNot'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'ismanualOrNot' },
|
||||
},
|
||||
{
|
||||
field: 'isTimeout',
|
||||
title: $t('abp.log.isTimeout'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isTimeout' },
|
||||
},
|
||||
{ field: 'afn', title: $t('abp.log.afn'), minWidth: '150' },
|
||||
{ field: 'fn', title: $t('abp.log.fn'), minWidth: '100' },
|
||||
{ field: 'pn', title: $t('abp.log.pn'), minWidth: '100' },
|
||||
{ field: 'itemCode', title: $t('abp.log.itemCode'), minWidth: '100' },
|
||||
{
|
||||
field: 'isSend',
|
||||
title: $t('abp.log.isSend'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isSend' },
|
||||
},
|
||||
{
|
||||
field: 'sendNum',
|
||||
title: $t('abp.log.sendNum'),
|
||||
minWidth: '100',
|
||||
},
|
||||
{
|
||||
field: 'nextSendTime',
|
||||
title: $t('abp.log.nextSendTime'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'issuedMessageHexString',
|
||||
title: $t('abp.log.issuedMessageHexString'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'receivedMessageHexString',
|
||||
title: $t('abp.log.receivedMessageHexString'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'receivedTime',
|
||||
title: $t('abp.log.receivedTime'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'isReceived',
|
||||
title: $t('abp.log.isReceived'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isReceived' },
|
||||
},
|
||||
{
|
||||
field: 'receivedRemark',
|
||||
title: $t('abp.log.receivedRemark'),
|
||||
minWidth: '150',
|
||||
},
|
||||
]);
|
||||
@ -0,0 +1,66 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { postTreeModelFocusStatusInfoPage } from '#/api-client';
|
||||
|
||||
import { querySchema, tableSchema } from './schema';
|
||||
|
||||
defineOptions({
|
||||
name: 'ConcentratorStatus',
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const { DeviceType, DeviceId, FocusAddress } = route.query;
|
||||
|
||||
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 postTreeModelFocusStatusInfoPage({
|
||||
body: {
|
||||
...formValues,
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
DeviceType,
|
||||
DeviceId,
|
||||
FocusAddress,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const [Grid] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<Grid />
|
||||
</Page>
|
||||
</template>
|
||||
@ -0,0 +1,47 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'DatePicker',
|
||||
fieldName: 'Timestamps',
|
||||
label: $t('abp.log.timestamps'),
|
||||
},
|
||||
]);
|
||||
export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
{ title: $t('common.seq'), type: 'seq', width: 50 },
|
||||
{ field: 'systemName', title: $t('abp.log.systemName'), minWidth: '150' },
|
||||
{
|
||||
field: 'projectId',
|
||||
title: $t('abp.log.projectId'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'dataType',
|
||||
title: $t('abp.log.dataType'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'deviceType',
|
||||
title: $t('abp.log.deviceType'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'type',
|
||||
title: $t('abp.dataDictionary.status'),
|
||||
minWidth: '100',
|
||||
},
|
||||
{
|
||||
field: 'times',
|
||||
title: $t('abp.log.timestamps'),
|
||||
minWidth: '150',
|
||||
formatter: ({ cellValue }) => {
|
||||
return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss');
|
||||
},
|
||||
},
|
||||
]);
|
||||
64
apps/web-antd/src/views/dataManger/measuringPoint/index.vue
Normal file
64
apps/web-antd/src/views/dataManger/measuringPoint/index.vue
Normal file
@ -0,0 +1,64 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { postTableModelDeviceDataInfoPage } from '#/api-client';
|
||||
|
||||
import { querySchema, tableSchema } from './schema';
|
||||
|
||||
defineOptions({
|
||||
name: 'MeasuringPoint',
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const { DeviceType, DeviceId, FocusAddress } = route.query;
|
||||
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 postTableModelDeviceDataInfoPage({
|
||||
body: {
|
||||
...formValues,
|
||||
pageIndex: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
DeviceType,
|
||||
DeviceId,
|
||||
FocusAddress,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const [Grid] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<Grid />
|
||||
</Page>
|
||||
</template>
|
||||
42
apps/web-antd/src/views/dataManger/measuringPoint/schema.ts
Normal file
42
apps/web-antd/src/views/dataManger/measuringPoint/schema.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
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: 'systemName', title: $t('abp.log.systemName'), minWidth: '150' },
|
||||
{
|
||||
field: 'projectId',
|
||||
title: $t('abp.log.projectId'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'dataType',
|
||||
title: $t('abp.log.dataType'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'deviceType',
|
||||
title: $t('abp.log.deviceType'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'times',
|
||||
title: $t('abp.log.timestamps'),
|
||||
minWidth: '150',
|
||||
formatter: ({ cellValue }) => {
|
||||
return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss');
|
||||
},
|
||||
},
|
||||
]);
|
||||
295
apps/web-antd/src/views/device/focus/index.vue
Normal file
295
apps/web-antd/src/views/device/focus/index.vue
Normal file
@ -0,0 +1,295 @@
|
||||
<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/status',
|
||||
query: {
|
||||
DeviceType: 10,
|
||||
DeviceId: row.focusId,
|
||||
FocusAddress: row.focusAddress,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
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>
|
||||
216
apps/web-antd/src/views/device/focus/schema.ts
Normal file
216
apps/web-antd/src/views/device/focus/schema.ts
Normal file
@ -0,0 +1,216 @@
|
||||
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'),
|
||||
},
|
||||
]);
|
||||
326
apps/web-antd/src/views/device/meter/index.vue
Normal file
326
apps/web-antd/src/views/device/meter/index.vue
Normal file
@ -0,0 +1,326 @@
|
||||
<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 {
|
||||
postMetersArchivesDown,
|
||||
postMetersCreate,
|
||||
postMetersDelete,
|
||||
postMetersPage,
|
||||
postMetersUpdate,
|
||||
} from '#/api-client';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import {
|
||||
addUserFormSchema,
|
||||
editUserFormSchemaEdit,
|
||||
meterTypeOptions,
|
||||
querySchema,
|
||||
rateOptions,
|
||||
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 postMetersPage({
|
||||
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 ? postMetersUpdate : postMetersCreate;
|
||||
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',
|
||||
}
|
||||
: {
|
||||
...formValues,
|
||||
password: formValues.password || '000000',
|
||||
};
|
||||
|
||||
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.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();
|
||||
};
|
||||
</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 #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'),
|
||||
)
|
||||
"
|
||||
/>
|
||||
</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: $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.meters.pointData'),
|
||||
icon: 'ant-design:profile-outlined',
|
||||
type: 'primary',
|
||||
auth: ['AbpIdentity.Users.Delete'],
|
||||
onClick: toStatusData.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('abp.meters.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]"
|
||||
>
|
||||
<component :is="editRow.id ? EditForm : AddForm" />
|
||||
</UserModal>
|
||||
</Page>
|
||||
</template>
|
||||
442
apps/web-antd/src/views/device/meter/schema.ts
Normal file
442
apps/web-antd/src/views/device/meter/schema.ts
Normal file
@ -0,0 +1,442 @@
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { z } from '@vben/common-ui';
|
||||
|
||||
import { $t } from '#/locales';
|
||||
|
||||
export const querySchema = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterAddress',
|
||||
label: $t('abp.meters.meterAddress'),
|
||||
},
|
||||
]);
|
||||
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'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'meterType',
|
||||
title: $t('abp.meters.meterType'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isMeterType' },
|
||||
},
|
||||
{
|
||||
field: 'dynamicPassword',
|
||||
title: $t('abp.meters.dynamicPassword'),
|
||||
minWidth: '150',
|
||||
slots: { default: 'isDynamicPassword' },
|
||||
},
|
||||
{
|
||||
field: 'password',
|
||||
title: $t('abp.meters.password'),
|
||||
minWidth: '100',
|
||||
},
|
||||
{
|
||||
field: 'singleRate',
|
||||
title: $t('abp.meters.singleRate'),
|
||||
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'),
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
width: '150',
|
||||
slots: { default: 'action' },
|
||||
},
|
||||
]);
|
||||
|
||||
export const addUserFormSchema: any = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterName',
|
||||
label: $t('abp.meters.meterName'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.meters.meterName')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
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'),
|
||||
},
|
||||
]);
|
||||
|
||||
export const editUserFormSchemaEdit: any = computed(() => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterName',
|
||||
label: $t('abp.meters.meterName'),
|
||||
rules: z.string().min(1, {
|
||||
message: `${$t('common.pleaseInput')}${$t('common.info')}${$t('abp.meters.meterName')}`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
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.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