Compare commits

..

3 Commits

Author SHA1 Message Date
ChenYi
0a1bffe8f8 更新接口调用 2025-07-28 15:06:31 +08:00
ChenYi
afeb8fcaee 更新后端接口并修改应用 2025-07-28 14:38:00 +08:00
ChenYi
ecebc32a99 优化接口封装 2025-07-28 11:54:55 +08:00
25 changed files with 12804 additions and 14592 deletions

View File

@ -2,6 +2,6 @@ import { defineConfig } from '@hey-api/openapi-ts';
export default defineConfig({ export default defineConfig({
client: '@hey-api/client-axios', client: '@hey-api/client-axios',
input: 'http://localhost:44315/swagger/AbpPro/swagger.json', input: 'http://localhost:10500/swagger/AbpPro/swagger.json',
output: 'src/api-client', output: 'src/api-client',
}); });

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -77,7 +77,7 @@
"loginMode": "Login Method", "loginMode": "Login Method",
"loginUrl": "Login URL", "loginUrl": "Login URL",
"detail": "Details", "detail": "Details",
"systemName": "System Name", "dataBaseName": "Database Name",
"projectId": "Project ID", "projectId": "Project ID",
"dataType": "Data Type", "dataType": "Data Type",
"deviceType": "Device Type", "deviceType": "Device Type",
@ -210,6 +210,7 @@
}, },
"IoTDBBase": { "IoTDBBase": {
"IoTDataType": "IoTDataType", "IoTDataType": "IoTDataType",
"DataBaseName": "DataBaseName",
"DeviceType": "DeviceType", "DeviceType": "DeviceType",
"Timestamps": "Timestamps", "Timestamps": "Timestamps",
"FormattedTimestamps": "Formatted Timestamps", "FormattedTimestamps": "Formatted Timestamps",

View File

@ -77,7 +77,7 @@
"loginMode": "登录方式", "loginMode": "登录方式",
"loginUrl": "登录地址", "loginUrl": "登录地址",
"detail": "详情", "detail": "详情",
"systemName": "系统名称", "dataBaseName": "数据库名称",
"projectId": "项目编码", "projectId": "项目编码",
"dataType": "数据类型", "dataType": "数据类型",
"deviceType": "设备类型", "deviceType": "设备类型",
@ -210,6 +210,7 @@
}, },
"IoTDBBase": { "IoTDBBase": {
"IoTDataType": "数据类型", "IoTDataType": "数据类型",
"DataBaseName": "所属数据库",
"DeviceType": "设备类型", "DeviceType": "设备类型",
"Timestamps": "时标(纳秒)", "Timestamps": "时标(纳秒)",
"FormattedTimestamps": "时标", "FormattedTimestamps": "时标",

View File

@ -12,10 +12,10 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
postMetersCreate, postDeviceInfoPage,
postMetersDelete, postAggregationDeviceDeleteAsync,
postMetersPage, postDeviceInfoPage,
postMetersUpdate, postAggregationDeviceCreateAsync,
} from '#/api-client'; } from '#/api-client';
import { TableAction } from '#/components/table-action'; import { TableAction } from '#/components/table-action';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -55,7 +55,7 @@ const gridOptions: VxeGridProps<any> = {
proxyConfig: { proxyConfig: {
ajax: { ajax: {
query: async ({ page }, formValues) => { query: async ({ page }, formValues) => {
const { data } = await postMetersPage({ const { data } = await postDeviceInfoPage({
body: { body: {
pageIndex: page.currentPage, pageIndex: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
@ -119,7 +119,8 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() { async function submit() {
const isEdit = !!editRow.value.id; const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi; const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postMetersUpdate : postMetersCreate; // TODO: 使
const api = postAggregationDeviceCreateAsync;
const { valid } = await formApi.validate(); const { valid } = await formApi.validate();
if (!valid) return; if (!valid) return;
@ -164,7 +165,7 @@ function onDel(row: any) {
Modal.confirm({ Modal.confirm({
title: `${$t('common.confirmDelete')}${row.meterName} ?`, title: `${$t('common.confirmDelete')}${row.meterName} ?`,
onOk: async () => { onOk: async () => {
const result = await postMetersDelete({ body: { id: row.id } }); const result = await postAggregationDeviceDeleteAsync({ body: { id: row.id } });
if (result) { if (result) {
gridApi.reload(); gridApi.reload();
Message.success($t('common.deleteSuccess')); Message.success($t('common.deleteSuccess'));

View File

@ -12,10 +12,10 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
postMetersCreate, postDeviceInfoPage,
postMetersDelete, postAggregationDeviceDeleteAsync,
postMetersPage, postDeviceInfoPage,
postMetersUpdate, postAggregationDeviceCreateAsync,
} from '#/api-client'; } from '#/api-client';
import { TableAction } from '#/components/table-action'; import { TableAction } from '#/components/table-action';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -55,7 +55,7 @@ const gridOptions: VxeGridProps<any> = {
proxyConfig: { proxyConfig: {
ajax: { ajax: {
query: async ({ page }, formValues) => { query: async ({ page }, formValues) => {
const { data } = await postMetersPage({ const { data } = await postDeviceInfoPage({
body: { body: {
pageIndex: page.currentPage, pageIndex: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
@ -119,7 +119,8 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() { async function submit() {
const isEdit = !!editRow.value.id; const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi; const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postMetersUpdate : postMetersCreate; // TODO: 使
const api = postAggregationDeviceCreateAsync;
const { valid } = await formApi.validate(); const { valid } = await formApi.validate();
if (!valid) return; if (!valid) return;
@ -164,7 +165,7 @@ function onDel(row: any) {
Modal.confirm({ Modal.confirm({
title: `${$t('common.confirmDelete')}${row.meterName} ?`, title: `${$t('common.confirmDelete')}${row.meterName} ?`,
onOk: async () => { onOk: async () => {
const result = await postMetersDelete({ body: { id: row.id } }); const result = await postAggregationDeviceDeleteAsync({ body: { id: row.id } });
if (result) { if (result) {
gridApi.reload(); gridApi.reload();
Message.success($t('common.deleteSuccess')); Message.success($t('common.deleteSuccess'));

View File

@ -13,10 +13,10 @@ import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
postDeviceInfoArchivesDown, postDeviceInfoArchivesDown,
postDeviceInfoCreate, postAggregationDeviceCreateAsync,
postDeviceInfoDelete, postAggregationDeviceDeleteAsync,
postDeviceInfoPage, postDeviceInfoPage,
postDeviceInfoUpdate, postAggregationDeviceFindByIdAsync,
} from '#/api-client'; } from '#/api-client';
import { TableAction } from '#/components/table-action'; import { TableAction } from '#/components/table-action';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -120,7 +120,8 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() { async function submit() {
const isEdit = !!editRow.value.id; const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi; const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postDeviceInfoUpdate : postDeviceInfoCreate; // TODO: 使
const api = postAggregationDeviceCreateAsync;
const { valid } = await formApi.validate(); const { valid } = await formApi.validate();
if (!valid) return; if (!valid) return;
@ -165,7 +166,7 @@ function onDel(row: any) {
Modal.confirm({ Modal.confirm({
title: `${$t('common.confirmDelete')}${row.meterName} ?`, title: `${$t('common.confirmDelete')}${row.meterName} ?`,
onOk: async () => { onOk: async () => {
const result = await postDeviceInfoDelete({ body: { id: row.id } }); const result = await postAggregationDeviceDeleteAsync({ body: { id: row.id } });
if (result) { if (result) {
gridApi.reload(); gridApi.reload();
Message.success($t('common.deleteSuccess')); Message.success($t('common.deleteSuccess'));
@ -183,7 +184,7 @@ const toStatusData = (row: Record<string, any>) => {
DeviceType: row.meterType, DeviceType: row.meterType,
DeviceId: row.meterId, DeviceId: row.meterId,
FocusAddress: row.focusAddress, FocusAddress: row.focusAddress,
SystemName: row.businessSystemName, DataBaseName: row.businessSystemName,
}, },
}); });
}; };

View File

@ -21,7 +21,7 @@ CTWing日志管理页面用于查看和管理CTWing物联网平台的设备数
DeviceType?: string, // 设备类型 DeviceType?: string, // 设备类型
DeviceId?: string, // 设备ID DeviceId?: string, // 设备ID
FocusAddress?: string, // 集中器地址 FocusAddress?: string, // 集中器地址
SystemName?: string, // 系统名称 DataBaseName?: string, // 数据库名称
ProjectId?: string // 项目ID ProjectId?: string // 项目ID
} }
``` ```
@ -32,7 +32,7 @@ CTWing日志管理页面用于查看和管理CTWing物联网平台的设备数
{ {
items: [ items: [
{ {
systemName: string, // 系统名称 dataBaseName: string, // 数据库名称
projectId: string, // 项目ID projectId: string, // 项目ID
dataType: string, // 数据类型 dataType: string, // 数据类型
deviceType: string, // 设备类型 deviceType: string, // 设备类型
@ -74,7 +74,7 @@ CTWing日志管理页面用于查看和管理CTWing物联网平台的设备数
| 字段名 | 显示名称 | 说明 | | 字段名 | 显示名称 | 说明 |
| ---------------- | ---------- | ------------------ | | ---------------- | ---------- | ------------------ |
| systemName | 系统名称 | 所属系统 | | dataBaseName | 数据库名称 | 所属数据库 |
| projectId | 项目编码 | 项目标识 | | projectId | 项目编码 | 项目标识 |
| dataType | 数据类型 | 数据类型 | | dataType | 数据类型 | 数据类型 |
| deviceType | 设备类型 | 设备类型 | | deviceType | 设备类型 | 设备类型 |

View File

@ -8,7 +8,8 @@ import { useRoute } from 'vue-router';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { postCTWingLogInfoPage, postMetersPage } from '#/api-client'; import { postDeviceInfoPage } from '#/api-client';
import { postCTWingLogInfoPage } from '#/api-client';
import DeviceSelect from '../deviceData/DeviceSelect.vue'; import DeviceSelect from '../deviceData/DeviceSelect.vue';
import { querySchema, tableSchema } from './schema'; import { querySchema, tableSchema } from './schema';
@ -32,7 +33,7 @@ const deviceOptions = ref<any[]>();
// //
const fetchDeviceOptions = async () => { const fetchDeviceOptions = async () => {
try { try {
const { data } = await postMetersPage({ const { data } = await postDeviceInfoPage({
body: { body: {
pageIndex: 1, pageIndex: 1,
pageSize: 1000, pageSize: 1000,
@ -139,7 +140,7 @@ const formOptions: VbenFormProps = {
'EndCreationTime', 'EndCreationTime',
'IoTDataType', 'IoTDataType',
'StartCreationTime', 'StartCreationTime',
'SystemName', 'DataBaseName',
]); ]);
const hasRelevantChange = changedFields.some((field) => const hasRelevantChange = changedFields.some((field) =>
relevantFields.has(field), relevantFields.has(field),
@ -183,7 +184,7 @@ const gridOptions: VxeGridProps<any> = {
// //
let deviceId = currentFormValues.DeviceId || ''; let deviceId = currentFormValues.DeviceId || '';
let systemName = ''; let dataBaseName = '';
const deviceType = currentFormValues.DeviceType || ''; const deviceType = currentFormValues.DeviceType || '';
// 使 // 使
@ -194,7 +195,7 @@ const gridOptions: VxeGridProps<any> = {
: null); : null);
if (deviceInfo) { if (deviceInfo) {
systemName = deviceInfo.businessSystemName || ''; dataBaseName = deviceInfo.businessSystemName || '';
// id // id
if (Number(deviceType) === 10) { if (Number(deviceType) === 10) {
// 使 focusId // 使 focusId
@ -212,7 +213,7 @@ const gridOptions: VxeGridProps<any> = {
DeviceType: deviceType, DeviceType: deviceType,
IoTDataType: currentFormValues.IoTDataType || '', IoTDataType: currentFormValues.IoTDataType || '',
DeviceId: deviceId, DeviceId: deviceId,
SystemName: systemName || currentFormValues.SystemName || '', DataBaseName: dataBaseName || currentFormValues.DataBaseName || '',
StartCreationTime: formatDate(currentFormValues.StartCreationTime), StartCreationTime: formatDate(currentFormValues.StartCreationTime),
EndCreationTime: formatDate(currentFormValues.EndCreationTime), EndCreationTime: formatDate(currentFormValues.EndCreationTime),
FocusAddress: currentFormValues.FocusAddress || '', FocusAddress: currentFormValues.FocusAddress || '',

View File

@ -4,19 +4,20 @@ import { computed } from 'vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { getSelectResultList } from '#/api-client'; import { getCommonGetSelectList } from '#/api-client';
import { $t } from '#/locales'; import { $t } from '#/locales';
export const querySchema = computed(() => [ export const querySchema = computed(() => [
{ {
component: 'ApiSelect', component: 'ApiSelect',
fieldName: 'SystemName', fieldName: 'DataBaseName',
label: $t('abp.IoTDBBase.SystemName'), label: $t('abp.IoTDBBase.DataBaseName'),
componentProps: { componentProps: {
api: getSelectResultList, api: getCommonGetSelectList,
params: { params: {
query: { query: {
TypeName: 'BusinessSystemEnum', typeName: 'BusinessSystemEnum'
}, },
}, },
labelField: 'secondValue', labelField: 'secondValue',
@ -46,10 +47,10 @@ export const querySchema = computed(() => [
fieldName: 'DeviceType', fieldName: 'DeviceType',
label: $t('abp.IoTDBBase.DeviceType'), label: $t('abp.IoTDBBase.DeviceType'),
componentProps: { componentProps: {
api: getSelectResultList, api: getCommonGetSelectList,
params: { params: {
query: { query: {
TypeName: 'MeterTypeEnum', typeName: 'MeterTypeEnum'
}, },
}, },
labelField: 'value', labelField: 'value',
@ -79,10 +80,12 @@ export const querySchema = computed(() => [
fieldName: 'IoTDataType', fieldName: 'IoTDataType',
label: $t('abp.IoTDBBase.IoTDataType'), label: $t('abp.IoTDBBase.IoTDataType'),
componentProps: { componentProps: {
api: getSelectResultList, api: getCommonGetSelectList,
params: { params: {
query: { query: {
TypeName: 'IoTDBDataTypeConst', input: {
typeName: 'IoTDBDataTypeConst',
},
}, },
}, },
labelField: 'value', labelField: 'value',

View File

@ -2,7 +2,7 @@
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { Select, Divider, Row } from 'ant-design-vue'; import { Select, Divider, Row } from 'ant-design-vue';
import { ChevronLeft, ChevronRight } from '@vben/icons'; import { ChevronLeft, ChevronRight } from '@vben/icons';
import { postMetersPage } from '#/api-client'; import { postDeviceInfoPage } from '#/api-client';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { useDebounceFn } from '@vueuse/core'; import { useDebounceFn } from '@vueuse/core';
@ -49,7 +49,7 @@ const maxPage = computed(() => {
const fetchData = async () => { const fetchData = async () => {
loading.value = true; loading.value = true;
try { try {
const { data } = await postMetersPage({ const { data } = await postDeviceInfoPage({
body: { body: {
pageIndex: query.value.pageIndex, pageIndex: query.value.pageIndex,
pageSize: query.value.pageSize, pageSize: query.value.pageSize,

View File

@ -63,7 +63,7 @@ if (data?.items && data.items.length > 0) {
```typescript ```typescript
// 在 dynamicColumns.ts 中添加字段映射 // 在 dynamicColumns.ts 中添加字段映射
export const fieldNameMapping: FieldMapping = { export const fieldNameMapping: FieldMapping = {
SystemName: '系统名称', DataBaseName: '数据库名称',
ProjectId: '项目ID', ProjectId: '项目ID',
// 添加新的字段映射 // 添加新的字段映射
CustomField: '自定义字段', CustomField: '自定义字段',
@ -96,7 +96,7 @@ export const fieldTypeConfig: FieldTypeConfig = {
| 字段名 | 显示名称 | 说明 | | 字段名 | 显示名称 | 说明 |
|--------|----------|------| |--------|----------|------|
| SystemName | 系统名称 | 系统名称字段 | | DataBaseName | 数据库名称 | 数据库名称字段 |
| ProjectId | 项目ID | 项目标识符 | | ProjectId | 项目ID | 项目标识符 |
| ProjectName | 项目名称 | 项目名称 | | ProjectName | 项目名称 | 项目名称 |
| IoTDataType | IoT数据类型 | 数据类型标识 | | IoTDataType | IoT数据类型 | 数据类型标识 |
@ -124,7 +124,7 @@ export const fieldTypeConfig: FieldTypeConfig = {
// 固定列定义 // 固定列定义
const fixedColumns = computed(() => [ const fixedColumns = computed(() => [
{ title: '序号', type: 'seq', width: 50 }, { title: '序号', type: 'seq', width: 50 },
{ field: 'SystemName', title: '系统名称', width: 150 }, { field: 'DataBaseName', title: '数据库名称', width: 150 },
]); ]);
// 动态列 // 动态列
@ -142,9 +142,9 @@ const allColumns = computed(() => [
```typescript ```typescript
import { sortFieldsByImportance } from './example'; import { sortFieldsByImportance } from './example';
const fields = ['CustomField', 'Timestamps', 'SystemName']; const fields = ['CustomField', 'Timestamps', 'DataBaseName'];
const sortedFields = sortFieldsByImportance(fields); const sortedFields = sortFieldsByImportance(fields);
// 结果: ['Timestamps', 'SystemName', 'CustomField'] // 结果: ['Timestamps', 'DataBaseName', 'CustomField']
``` ```
### 3. 数据验证 ### 3. 数据验证

View File

@ -7,12 +7,12 @@ import type {
// 字段名映射配置 // 字段名映射配置
export const fieldNameMapping: FieldMapping = { export const fieldNameMapping: FieldMapping = {
// SystemName: '系统名称', // DataBaseName: '数据库名称',
// ProjectId: '项目ID', // ProjectId: '项目ID',
// ProjectName: '项目名称', // ProjectName: '项目名称',
IoTDataType: 'IoT数据类型', IoTDataType: 'IoT数据类型',
DeviceType: '设备类型', DeviceType: '设备类型',
DeviceId: '设备ID', DeviceAddress: '设备ID',
Timestamps: '时间戳', Timestamps: '时间戳',
// 可以根据需要添加更多映射 // 可以根据需要添加更多映射
}; };
@ -34,10 +34,10 @@ export const fieldTypeConfig: FieldTypeConfig = {
// 固定字段列表 - 这些字段已经在固定列中定义,不需要在动态列中重复生成 // 固定字段列表 - 这些字段已经在固定列中定义,不需要在动态列中重复生成
const FIXED_FIELDS = [ const FIXED_FIELDS = [
// 'SystemName', // 'DataBaseName',
'DeviceType', 'DeviceType',
'IoTDataType', 'IoTDataType',
'DeviceId', 'DeviceAddress',
'Timestamps', 'Timestamps',
'FormattedTimestamps', 'FormattedTimestamps',
'DeviceAddress', 'DeviceAddress',

View File

@ -8,7 +8,8 @@ import { useRoute } from 'vue-router';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { postMetersPage, postTreeModelDeviceDataInfoPage } from '#/api-client'; import { postDeviceInfoPage } from '#/api-client';
import { postTreeModelDeviceDataInfoPage } from '#/api-client';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { generateDynamicColumns } from './dynamicColumns'; import { generateDynamicColumns } from './dynamicColumns';
@ -26,7 +27,7 @@ const selectedDeviceInfo = ref<any>(null);
// ID // ID
const fetchDeviceOptions = async () => { const fetchDeviceOptions = async () => {
try { try {
const { data } = await postMetersPage({ const { data } = await postDeviceInfoPage({
body: { body: {
pageIndex: 1, pageIndex: 1,
pageSize: 1000, pageSize: 1000,
@ -67,7 +68,7 @@ const formatDate = (date: Date | string) => {
}; };
const route = useRoute(); const route = useRoute();
const { DeviceType, DeviceId, FocusAddress, SystemName } = route.query; const { DeviceType, DeviceId, FocusAddress, DataBaseName } = route.query;
// //
const dynamicColumns = ref<any[]>([]); const dynamicColumns = ref<any[]>([]);
@ -90,8 +91,8 @@ const fixedColumns = [
slots: {}, slots: {},
}, },
{ {
field: 'SystemName', field: 'DataBaseName',
title: $t('abp.IoTDBBase.SystemName'), title: $t('abp.IoTDBBase.DataBaseName'),
minWidth: 150, minWidth: 150,
showOverflow: true, showOverflow: true,
slots: {}, slots: {},
@ -110,13 +111,6 @@ const fixedColumns = [
showOverflow: true, showOverflow: true,
slots: {}, slots: {},
}, },
{
field: 'DeviceId',
title: $t('abp.IoTDBBase.DeviceId'),
minWidth: 150,
showOverflow: true,
slots: {},
},
{ {
field: 'DeviceAddress', field: 'DeviceAddress',
title: $t('abp.IoTDBBase.DeviceAddress'), title: $t('abp.IoTDBBase.DeviceAddress'),
@ -169,7 +163,7 @@ const formOptions: VbenFormProps = {
FocusAddress: FocusAddress as string, FocusAddress: FocusAddress as string,
DeviceType: DeviceType ? Number(DeviceType) : undefined, DeviceType: DeviceType ? Number(DeviceType) : undefined,
DeviceId: DeviceId as string, DeviceId: DeviceId as string,
SystemName: SystemName as string, DataBaseName: DataBaseName as string,
}, },
// 使 // 使
submitOnChange: false, submitOnChange: false,
@ -183,7 +177,7 @@ const formOptions: VbenFormProps = {
'FocusAddress', 'FocusAddress',
'IoTDataType', 'IoTDataType',
'StartCreationTime', 'StartCreationTime',
'SystemName', 'DataBaseName',
]); ]);
const hasRelevantChange = changedFields.some((field) => const hasRelevantChange = changedFields.some((field) =>
relevantFields.has(field), relevantFields.has(field),
@ -335,7 +329,7 @@ const gridOptions: VxeGridProps<any> = {
DeviceId: finalDeviceId ? finalDeviceId.toString() : '', DeviceId: finalDeviceId ? finalDeviceId.toString() : '',
FocusAddress: finalFocusAddress || FocusAddress || '', FocusAddress: finalFocusAddress || FocusAddress || '',
// //
SystemName: currentFormValues.SystemName || SystemName, DataBaseName: currentFormValues.DataBaseName || DataBaseName,
IoTDataType: ioTDataTypeValue || undefined, IoTDataType: ioTDataTypeValue || undefined,
// //
StartCreationTime: startCreationTime || undefined, StartCreationTime: startCreationTime || undefined,
@ -442,7 +436,7 @@ const initializeGrid = async () => {
} }
// //
if (DeviceType || DeviceId || FocusAddress || SystemName) { if (DeviceType || DeviceId || FocusAddress || DataBaseName) {
// //
setTimeout(() => { setTimeout(() => {
if (gridApi) { if (gridApi) {
@ -457,7 +451,7 @@ const initializeGrid = async () => {
// //
watch( watch(
() => [DeviceType, DeviceId, FocusAddress, SystemName], () => [DeviceType, DeviceId, FocusAddress, DataBaseName],
async (newValues, oldValues) => { async (newValues, oldValues) => {
// //
if (newValues.some(Boolean) && gridApi && isGridInitialized.value) { if (newValues.some(Boolean) && gridApi && isGridInitialized.value) {

View File

@ -2,19 +2,19 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
import { computed } from 'vue'; import { computed } from 'vue';
import { getSelectResultList } from '#/api-client'; import { getCommonGetSelectList } from '#/api-client';
import { $t } from '#/locales'; import { $t } from '#/locales';
export const querySchema = computed(() => [ export const querySchema = computed(() => [
{ {
component: 'ApiSelect', component: 'ApiSelect',
fieldName: 'SystemName', fieldName: 'DataBaseName',
label: $t('abp.IoTDBBase.SystemName'), label: $t('abp.IoTDBBase.DataBaseName'),
componentProps: { componentProps: {
api: getSelectResultList, api: getCommonGetSelectList,
params: { params: {
query: { query: {
TypeName: 'BusinessSystemEnum', typeName: 'BusinessSystemEnum',
}, },
}, },
labelField: 'secondValue', labelField: 'secondValue',
@ -44,10 +44,10 @@ export const querySchema = computed(() => [
fieldName: 'DeviceType', fieldName: 'DeviceType',
label: $t('abp.IoTDBBase.DeviceType'), label: $t('abp.IoTDBBase.DeviceType'),
componentProps: { componentProps: {
api: getSelectResultList, api: getCommonGetSelectList,
params: { params: {
query: { query: {
TypeName: 'MeterTypeEnum', typeName: 'MeterTypeEnum'
}, },
}, },
labelField: 'value', labelField: 'value',
@ -77,10 +77,10 @@ export const querySchema = computed(() => [
fieldName: 'IoTDataType', fieldName: 'IoTDataType',
label: $t('abp.IoTDBBase.IoTDataType'), label: $t('abp.IoTDBBase.IoTDataType'),
componentProps: { componentProps: {
api: getSelectResultList, api: getCommonGetSelectList,
params: { params: {
query: { query: {
TypeName: 'IoTDBDataTypeConst', typeName: 'IoTDBDataTypeConst'
}, },
}, },
labelField: 'value', labelField: 'value',
@ -147,13 +147,8 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
minWidth: '150', minWidth: '150',
}, },
{ {
field: 'SystemName', field: 'DataBaseName',
title: $t('abp.IoTDBBase.SystemName'), title: $t('abp.IoTDBBase.DataBaseName'),
minWidth: '150',
},
{
field: 'ProjectId',
title: $t('abp.IoTDBBase.ProjectId'),
minWidth: '150', minWidth: '150',
}, },
{ {
@ -167,8 +162,8 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
minWidth: '150', minWidth: '150',
}, },
{ {
field: 'DeviceId', field: 'DeviceAddress',
title: $t('abp.IoTDBBase.DeviceId'), title: $t('abp.IoTDBBase.DeviceAddress'),
minWidth: '150', minWidth: '150',
}, },
]); ]);

View File

@ -1,6 +1,6 @@
// 基础设备数据类型 // 基础设备数据类型
export interface BaseDeviceData { export interface BaseDeviceData {
SystemName?: string; DataBaseName?: string;
ProjectId?: string; ProjectId?: string;
ProjectName?: string; ProjectName?: string;
IoTDataType?: string; IoTDataType?: string;

View File

@ -8,7 +8,8 @@ import { useRoute } from 'vue-router';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { postMetersPage, postOneNETLogInfoPage } from '#/api-client'; import { postDeviceInfoPage } from '#/api-client';
import { postOneNETLogInfoPage } from '#/api-client';
import DeviceSelect from '../deviceData/DeviceSelect.vue'; import DeviceSelect from '../deviceData/DeviceSelect.vue';
import { querySchema, tableSchema } from './schema'; import { querySchema, tableSchema } from './schema';
@ -32,7 +33,7 @@ const deviceOptions = ref<any[]>();
// //
const fetchDeviceOptions = async () => { const fetchDeviceOptions = async () => {
try { try {
const { data } = await postMetersPage({ const { data } = await postDeviceInfoPage({
body: { body: {
pageIndex: 1, pageIndex: 1,
pageSize: 1000, pageSize: 1000,
@ -138,7 +139,7 @@ const formOptions: VbenFormProps = {
'EndCreationTime', 'EndCreationTime',
'IoTDataType', 'IoTDataType',
'StartCreationTime', 'StartCreationTime',
'SystemName', 'DataBaseName',
]); ]);
const hasRelevantChange = changedFields.some((field) => const hasRelevantChange = changedFields.some((field) =>
relevantFields.has(field), relevantFields.has(field),
@ -181,7 +182,7 @@ const gridOptions: VxeGridProps<any> = {
// //
let deviceId = currentFormValues.DeviceId || ''; let deviceId = currentFormValues.DeviceId || '';
let systemName = ''; let dataBaseName = '';
const deviceType = currentFormValues.DeviceType || ''; const deviceType = currentFormValues.DeviceType || '';
// 使 // 使
@ -192,7 +193,7 @@ const gridOptions: VxeGridProps<any> = {
: null); : null);
if (deviceInfo) { if (deviceInfo) {
systemName = deviceInfo.businessSystemName || ''; dataBaseName = deviceInfo.businessSystemName || '';
// id // id
if (Number(deviceType) === 10) { if (Number(deviceType) === 10) {
// 使 focusId // 使 focusId
@ -211,7 +212,7 @@ const gridOptions: VxeGridProps<any> = {
DeviceType: deviceType, DeviceType: deviceType,
IoTDataType: currentFormValues.IoTDataType || '', IoTDataType: currentFormValues.IoTDataType || '',
DeviceId: deviceId, DeviceId: deviceId,
SystemName: systemName || currentFormValues.SystemName || '', DataBaseName: dataBaseName || currentFormValues.DataBaseName || '',
StartCreationTime: formatDate(currentFormValues.StartCreationTime), StartCreationTime: formatDate(currentFormValues.StartCreationTime),
EndCreationTime: formatDate(currentFormValues.EndCreationTime), EndCreationTime: formatDate(currentFormValues.EndCreationTime),
}; };

View File

@ -4,19 +4,19 @@ import { computed } from 'vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { getSelectResultList } from '#/api-client'; import { getCommonGetSelectList } from '#/api-client';
import { $t } from '#/locales'; import { $t } from '#/locales';
export const querySchema = computed(() => [ export const querySchema = computed(() => [
{ {
component: 'ApiSelect', component: 'ApiSelect',
fieldName: 'SystemName', fieldName: 'DataBaseName',
label: $t('abp.IoTDBBase.SystemName'), label: $t('abp.IoTDBBase.DataBaseName'),
componentProps: { componentProps: {
api: getSelectResultList, api: getCommonGetSelectList,
params: { params: {
query: { query: {
TypeName: 'BusinessSystemEnum', typeName: 'BusinessSystemEnum',
}, },
}, },
labelField: 'secondValue', labelField: 'secondValue',
@ -46,10 +46,10 @@ export const querySchema = computed(() => [
fieldName: 'DeviceType', fieldName: 'DeviceType',
label: $t('abp.IoTDBBase.DeviceType'), label: $t('abp.IoTDBBase.DeviceType'),
componentProps: { componentProps: {
api: getSelectResultList, api: getCommonGetSelectList,
params: { params: {
query: { query: {
TypeName: 'MeterTypeEnum', typeName: 'MeterTypeEnum',
}, },
}, },
labelField: 'value', labelField: 'value',
@ -79,10 +79,10 @@ export const querySchema = computed(() => [
fieldName: 'IoTDataType', fieldName: 'IoTDataType',
label: $t('abp.IoTDBBase.IoTDataType'), label: $t('abp.IoTDBBase.IoTDataType'),
componentProps: { componentProps: {
api: getSelectResultList, api: getCommonGetSelectList,
params: { params: {
query: { query: {
TypeName: 'IoTDBDataTypeConst', typeName: 'IoTDBDataTypeConst',
}, },
}, },
labelField: 'value', labelField: 'value',

View File

@ -62,40 +62,28 @@ const [Grid] = useVbenVxeGrid({ formOptions, gridOptions });
{{ row.deviceType }} {{ row.deviceType }}
</template> </template>
<template #ismanualOrNot="{ row }"> <template #ismanualOrNot="{ row }">
<component <component :is="h(Tag, { color: row.manualOrNot ? 'green' : 'red' }, () =>
:is=" row.manualOrNot ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.manualOrNot ? 'green' : 'red' }, () => )
row.manualOrNot ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
<template #isTimeout="{ row }"> <template #isTimeout="{ row }">
<component <component :is="h(Tag, { color: row.isTimeout ? 'green' : 'red' }, () =>
:is=" row.isTimeout ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.isTimeout ? 'green' : 'red' }, () => )
row.isTimeout ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
<template #isSend="{ row }"> <template #isSend="{ row }">
<component <component :is="h(Tag, { color: row.isSend ? 'green' : 'red' }, () =>
:is=" row.isSend ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.isSend ? 'green' : 'red' }, () => )
row.isSend ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
<template #isReceived="{ row }"> <template #isReceived="{ row }">
<component <component :is="h(Tag, { color: row.isReceived ? 'green' : 'red' }, () =>
:is=" row.isReceived ? $t('common.yes') : $t('common.no'),
h(Tag, { color: row.isReceived ? 'green' : 'red' }, () => )
row.isReceived ? $t('common.yes') : $t('common.no'), " />
)
"
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>

View File

@ -19,7 +19,7 @@ export const querySchema = computed(() => [
export const tableSchema: any = computed((): VxeGridProps['columns'] => [ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
{ title: $t('common.seq'), type: 'seq', width: 50 }, { title: $t('common.seq'), type: 'seq', width: 50 },
{ field: 'systemName', title: $t('abp.log.systemName'), minWidth: '150' }, { field: 'dataBaseName', title: $t('abp.log.dataBaseName'), minWidth: '150' },
{ {
field: 'projectId', field: 'projectId',
title: $t('abp.log.projectId'), title: $t('abp.log.projectId'),

View File

@ -12,10 +12,10 @@ import { message as Message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
postOneNETAccountDelete, postOneNetAccountDeleteAsync,
postOneNETAccountInfoPage, postOneNetAccountListAsync,
postOneNETAccountInsert, postOneNetAccountInsertAsync,
postOneNETAccountModify, postOneNetAccountModifyAsync,
} from '#/api-client'; } from '#/api-client';
import { TableAction } from '#/components/table-action'; import { TableAction } from '#/components/table-action';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -53,7 +53,7 @@ const gridOptions: VxeGridProps<any> = {
proxyConfig: { proxyConfig: {
ajax: { ajax: {
query: async ({ page }, formValues) => { query: async ({ page }, formValues) => {
const { data } = await postOneNETAccountInfoPage({ const { data } = await postOneNetAccountListAsync({
body: { body: {
pageIndex: page.currentPage, pageIndex: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
@ -117,21 +117,21 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() { async function submit() {
const isEdit = !!editRow.value.id; const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi; const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postOneNETAccountModify : postOneNETAccountInsert; const api = isEdit ? postOneNetAccountModifyAsync : postOneNetAccountInsertAsync;
const { valid } = await formApi.validate(); const { valid } = await formApi.validate();
if (!valid) return; if (!valid) return;
const formValues = await formApi.getValues(); const formValues = await formApi.getValues();
const fetchParams: any = isEdit const fetchParams: any = isEdit
? { ? {
id: editRow.value.id, id: editRow.value.id,
...formValues, ...formValues,
password: formValues.password || '000000', password: formValues.password || '000000',
} }
: { : {
...formValues, ...formValues,
password: formValues.password || '000000', password: formValues.password || '000000',
}; };
try { try {
userModalApi.setState({ loading: true, confirmLoading: true }); userModalApi.setState({ loading: true, confirmLoading: true });
@ -172,7 +172,7 @@ async function onDel(record: any) {
} }
try { try {
const resp = await postOneNETAccountDelete({ body: { id: record.id } }); const resp = await postOneNetAccountDeleteAsync({ body: { id: record.id } });
if (resp.data) { if (resp.data) {
Message.success($t('common.deleteSuccess')); Message.success($t('common.deleteSuccess'));
gridApi.reload(); gridApi.reload();
@ -189,27 +189,31 @@ async function onDel(record: any) {
<Page auto-content-height> <Page auto-content-height>
<Grid> <Grid>
<template #toolbar-actions> <template #toolbar-actions>
<TableAction :actions="[ <TableAction
{ :actions="[
label: $t('common.add'), {
type: 'primary', label: $t('common.add'),
icon: 'ant-design:plus-outlined', type: 'primary',
onClick: openAddModal.bind(null), icon: 'ant-design:plus-outlined',
auth: ['AbpIdentity.Users.Create'], onClick: openAddModal.bind(null),
}, auth: ['AbpIdentity.Users.Create'],
]" /> },
]"
/>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<TableAction :actions="[ <TableAction
{ :actions="[
label: $t('common.edit'), {
type: 'link', label: $t('common.edit'),
size: 'small', type: 'link',
auth: ['AbpIdentity.Users.Update'], size: 'small',
onClick: onEdit.bind(null, row), auth: ['AbpIdentity.Users.Update'],
}, onClick: onEdit.bind(null, row),
]" :drop-down-actions="[ },
]"
:drop-down-actions="[
{ {
label: $t('common.delete'), label: $t('common.delete'),
icon: 'ant-design:delete-outlined', icon: 'ant-design:delete-outlined',
@ -224,10 +228,14 @@ async function onDel(record: any) {
confirm: onDel.bind(null, row), confirm: onDel.bind(null, row),
}, },
}, },
]" /> ]"
/>
</template> </template>
</Grid> </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" /> <component :is="editRow.id ? EditForm : AddForm" />
</UserModal> </UserModal>
</Page> </Page>

View File

@ -12,10 +12,10 @@ import { message as Message, Modal, Tag } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { import {
postMetersCreate, postOneNetProductInsertAsync,
postMetersDelete, postOneNetProductDeleteAsync,
postMetersPage, postOneNetProductListAsync,
postMetersUpdate, postOneNetProductModifyAsync,
} from '#/api-client'; } from '#/api-client';
import { TableAction } from '#/components/table-action'; import { TableAction } from '#/components/table-action';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -55,7 +55,7 @@ const gridOptions: VxeGridProps<any> = {
proxyConfig: { proxyConfig: {
ajax: { ajax: {
query: async ({ page }, formValues) => { query: async ({ page }, formValues) => {
const { data } = await postMetersPage({ const { data } = await postOneNetProductListAsync({
body: { body: {
pageIndex: page.currentPage, pageIndex: page.currentPage,
pageSize: page.pageSize, pageSize: page.pageSize,
@ -119,7 +119,7 @@ const [EditForm, editFormApi] = useVbenForm({
async function submit() { async function submit() {
const isEdit = !!editRow.value.id; const isEdit = !!editRow.value.id;
const formApi = isEdit ? editFormApi : addFormApi; const formApi = isEdit ? editFormApi : addFormApi;
const api = isEdit ? postMetersUpdate : postMetersCreate; const api = isEdit ? postOneNetProductModifyAsync : postOneNetProductInsertAsync;
const { valid } = await formApi.validate(); const { valid } = await formApi.validate();
if (!valid) return; if (!valid) return;
@ -164,7 +164,7 @@ function onDel(row: any) {
Modal.confirm({ Modal.confirm({
title: `${$t('common.confirmDelete')}${row.meterName} ?`, title: `${$t('common.confirmDelete')}${row.meterName} ?`,
onOk: async () => { onOk: async () => {
const result = await postMetersDelete({ body: { id: row.id } }); const result = await postOneNetProductDeleteAsync({ body: { id: row.id } });
if (result) { if (result) {
gridApi.reload(); gridApi.reload();
Message.success($t('common.deleteSuccess')); Message.success($t('common.deleteSuccess'));